#ifndef FESA_RESULTS_RESULT_RECOVERY_H_ #define FESA_RESULTS_RESULT_RECOVERY_H_ #include #include #include "fesa/analysis/analysis_model.h" #include "fesa/analysis/analysis_state.h" #include "fesa/core/status.h" #include "fesa/elements/element.h" #include "fesa/fem/dof_manager.h" #include "fesa/math/sparse_matrix.h" namespace fesa { /// @brief Stores one normalized positive-local-x node-station row. struct NodeStationResultRow { SourceEntityId node; EntityIndex representative_element; std::array section_resultant; }; /// @brief Recovers full equilibrium and typed runtime element rows. class ResultRecovery { public: /// @brief Aggregates runtime element bundles into one atomic state candidate. /// @param model Non-owning active semantic model view. /// @param elements Runtime elements in stable active source order. /// @param dofs Owner of the matching full-space scatter and partition. /// @param full_stiffness Assembled full-space stiffness matrix. /// @param full_displacement Reconstructed full-space displacement candidate. /// @param full_external_force Assembled full-space external-force candidate. /// @param state Prior state replaced only after every bundle and global /// evidence validates. /// @return Success after atomic commit or a structured model failure. static Status Recover(const AnalysisModel& model, const ElementView& elements, const DofManager& dofs, const SparseMatrix& full_stiffness, const Vector& full_displacement, const Vector& full_external_force, AnalysisState& state); /// @brief Builds and atomically commits a complete recovery candidate. /// @note This compatibility facade creates runtime elements until the /// procedure owns their lifetime directly. /// @return Success after full residual K*d-F and all result rows validate. static Status Recover(const AnalysisModel& model, const DofManager& dofs, const SparseMatrix& full_stiffness, AnalysisState& state); /// @brief Normalizes eligible endpoint rows to source node stations. /// @param component_tolerances Per-component interior-station tolerances. /// @return Stable source-node rows or a structured identity/value failure. static Result> NormalizeSectionResultantsToNodeStations( const AnalysisModel& model, const std::vector& endpoint_rows, const std::array& component_tolerances); }; } // namespace fesa #endif // FESA_RESULTS_RESULT_RECOVERY_H_