feat(cpp-object-oriented-modular-refactoring): step 20 - analysis-hierarchy
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef FESA_ANALYSIS_ANALYSIS_H_
|
||||
#define FESA_ANALYSIS_ANALYSIS_H_
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Carries input and authoritative output paths for one analysis run.
|
||||
struct AnalysisRequest {
|
||||
std::filesystem::path input_path;
|
||||
std::filesystem::path output_path;
|
||||
};
|
||||
|
||||
/// @brief Defines the minimal execution contract shared by analysis procedures.
|
||||
class Analysis {
|
||||
public:
|
||||
virtual ~Analysis() = default;
|
||||
|
||||
/// @brief Executes one procedure for the supplied input and output paths.
|
||||
/// @param request Input and authoritative output paths for this run.
|
||||
/// @return The concrete procedure result without changing its failure
|
||||
/// category.
|
||||
virtual Status Run(const AnalysisRequest& request) = 0;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_ANALYSIS_ANALYSIS_H_
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef FESA_ANALYSIS_LINEAR_STATIC_ANALYSIS_H_
|
||||
#define FESA_ANALYSIS_LINEAR_STATIC_ANALYSIS_H_
|
||||
|
||||
#include <filesystem>
|
||||
#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/core/status.h"
|
||||
#include "fesa/elements/element.h"
|
||||
#include "fesa/fem/dof_manager.h"
|
||||
#include "fesa/math/sparse_matrix.h"
|
||||
#include "fesa/math/vector.h"
|
||||
@@ -20,41 +20,6 @@ class LinearSolver;
|
||||
class ParallelFor;
|
||||
class ResultsWriter;
|
||||
|
||||
/// @brief Carries input and authoritative output paths for one analysis run.
|
||||
struct AnalysisRequest {
|
||||
std::filesystem::path input_path;
|
||||
std::filesystem::path output_path;
|
||||
};
|
||||
|
||||
/// @brief Executes the current approved V0 analysis lifecycle.
|
||||
class Analysis {
|
||||
public:
|
||||
virtual ~Analysis() = default;
|
||||
|
||||
/// @brief Runs the eight current lifecycle stages in their approved order.
|
||||
/// @param request Input and output paths for this run.
|
||||
/// @return The first stage failure or successful result finalization.
|
||||
Status Run(const AnalysisRequest& request);
|
||||
|
||||
protected:
|
||||
/// @brief Initializes owned input and Domain state for a run.
|
||||
virtual Status Initialize(const AnalysisRequest& request) = 0;
|
||||
/// @brief Builds the non-owning active-model view.
|
||||
virtual Status BuildAnalysisModel() = 0;
|
||||
/// @brief Builds stable DOF numbering and the sparse structural pattern.
|
||||
virtual Status BuildDofMapAndSparsePattern() = 0;
|
||||
/// @brief Assembles full stiffness and stable constraint partitions.
|
||||
virtual Status AssembleAndPartitionStiffness() = 0;
|
||||
/// @brief Factorizes Kff before any load assembly.
|
||||
virtual Status Factorize() = 0;
|
||||
/// @brief Assembles loads and forms Ff-Kfc*dc without solving.
|
||||
virtual Status AssembleLoadsAndEffectiveRhs() = 0;
|
||||
/// @brief Substitutes the retained factorization and reconstructs full d.
|
||||
virtual Status SubstituteAndReconstruct() = 0;
|
||||
/// @brief Recovers a complete candidate and writes authoritative results.
|
||||
virtual Status RecoverAndWriteResults() = 0;
|
||||
};
|
||||
|
||||
/// @brief Orchestrates the single-step linear-static procedure.
|
||||
/// @note Factorization, substitution, recovery, and writing remain separately
|
||||
/// observable through injected backend boundaries.
|
||||
@@ -66,31 +31,36 @@ class LinearStaticAnalysis final : public Analysis {
|
||||
LinearSolver& linear_solver,
|
||||
ResultsWriter& results_writer);
|
||||
|
||||
protected:
|
||||
/// @copydoc Analysis::Initialize
|
||||
Status Initialize(const AnalysisRequest& request) override;
|
||||
/// @copydoc Analysis::BuildAnalysisModel
|
||||
Status BuildAnalysisModel() override;
|
||||
/// @copydoc Analysis::BuildDofMapAndSparsePattern
|
||||
Status BuildDofMapAndSparsePattern() override;
|
||||
/// @copydoc Analysis::AssembleAndPartitionStiffness
|
||||
Status AssembleAndPartitionStiffness() override;
|
||||
/// @copydoc Analysis::Factorize
|
||||
Status Factorize() override;
|
||||
/// @copydoc Analysis::AssembleLoadsAndEffectiveRhs
|
||||
Status AssembleLoadsAndEffectiveRhs() override;
|
||||
/// @copydoc Analysis::SubstituteAndReconstruct
|
||||
Status SubstituteAndReconstruct() override;
|
||||
/// @copydoc Analysis::RecoverAndWriteResults
|
||||
Status RecoverAndWriteResults() override;
|
||||
/// @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_;
|
||||
|
||||
Reference in New Issue
Block a user