Files
FESADev/include/fesa/analysis/linear_static_analysis.h

75 lines
2.8 KiB
C++

#ifndef FESA_ANALYSIS_LINEAR_STATIC_ANALYSIS_H_
#define FESA_ANALYSIS_LINEAR_STATIC_ANALYSIS_H_
#include <memory>
#include <vector>
#include "fesa/analysis/analysis.h"
#include "fesa/analysis/analysis_model.h"
#include "fesa/analysis/analysis_state.h"
#include "fesa/constraints/essential_constraint_policy.h"
#include "fesa/elements/element.h"
#include "fesa/fem/dof_manager.h"
#include "fesa/math/sparse_matrix.h"
#include "fesa/math/vector.h"
#include "fesa/model/domain.h"
namespace fesa {
class LinearSolver;
class ParallelFor;
class ResultsWriter;
/// @brief Orchestrates the single-step linear-static procedure.
/// @note Factorization, substitution, recovery, and writing remain separately
/// observable through injected backend boundaries.
class LinearStaticAnalysis final : public Analysis {
public:
/// @brief Creates a procedure using non-owned backend adapters.
/// @note All three adapters must outlive this analysis object.
LinearStaticAnalysis(const ParallelFor& parallel_for,
LinearSolver& linear_solver,
ResultsWriter& results_writer);
/// @brief Runs the approved eight-stage linear-static lifecycle.
/// @return The first stage failure or successful result finalization.
Status Run(const AnalysisRequest& request) override;
private:
/// @brief Initializes owned input and Domain state for a run candidate.
Status InitializeCandidate(const AnalysisRequest& request);
/// @brief Builds the non-owning active-model view.
Status BuildAnalysisModel();
/// @brief Creates runtime elements, stable DOFs, and the sparse pattern.
Status BuildDofMapAndSparsePattern();
/// @brief Assembles full stiffness and stable constraint partitions.
Status AssembleAndPartitionStiffness();
/// @brief Factorizes Kff before any load assembly.
Status FactorizeFreeSystem();
/// @brief Assembles loads and forms Ff-Kfc*dc without solving.
Status AssembleLoadsAndEffectiveRhs();
/// @brief Substitutes the retained factorization and reconstructs full d.
Status SubstituteAndReconstruct();
/// @brief Recovers a complete candidate before writing authoritative output.
Status RecoverAndWrite();
const ParallelFor& parallel_for_;
LinearSolver& linear_solver_;
ResultsWriter& results_writer_;
AnalysisRequest request_;
std::unique_ptr<Domain> domain_;
std::unique_ptr<AnalysisModel> model_;
std::vector<std::unique_ptr<Element>> elements_;
ElementView element_view_;
std::unique_ptr<DofManager> dofs_;
std::unique_ptr<AnalysisState> state_;
std::unique_ptr<SparseMatrix> full_stiffness_;
std::unique_ptr<PartitionedStiffness> partitioned_stiffness_;
std::unique_ptr<Vector> effective_rhs_;
std::vector<Diagnostic> diagnostics_;
};
} // namespace fesa
#endif // FESA_ANALYSIS_LINEAR_STATIC_ANALYSIS_H_