feat(nonlinear-static-newton-raphson): step 10 - prepared-analysis-flow-and-full-procedure
This commit is contained in:
@@ -1,18 +1,7 @@
|
||||
#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 {
|
||||
|
||||
@@ -20,9 +9,8 @@ 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.
|
||||
/// @brief Retains the legacy Analysis facade for linear-static callers.
|
||||
/// @note Numerical stages are owned by LinearStaticProcedureExecutor.
|
||||
class LinearStaticAnalysis final : public Analysis {
|
||||
public:
|
||||
/// @brief Creates a procedure using non-owned backend adapters.
|
||||
@@ -31,42 +19,14 @@ class LinearStaticAnalysis final : public Analysis {
|
||||
LinearSolver& linear_solver,
|
||||
ResultsWriter& results_writer);
|
||||
|
||||
/// @brief Runs the approved eight-stage linear-static lifecycle.
|
||||
/// @brief Prepares, executes, and writes a linear-static analysis.
|
||||
/// @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
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef FESA_ANALYSIS_LINEAR_STATIC_PROCEDURE_H_
|
||||
#define FESA_ANALYSIS_LINEAR_STATIC_PROCEDURE_H_
|
||||
|
||||
#include "fesa/analysis/prepared_analysis.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
class LinearSolver;
|
||||
class ParallelFor;
|
||||
|
||||
/// @brief Executes the approved linear-static procedure on a prepared Domain.
|
||||
class LinearStaticProcedureExecutor {
|
||||
public:
|
||||
/// @brief Creates a procedure executor with caller-owned backend adapters.
|
||||
/// @param parallel_for Deterministic element-local execution adapter.
|
||||
/// @param linear_solver Factorization and substitution adapter.
|
||||
LinearStaticProcedureExecutor(const ParallelFor& parallel_for,
|
||||
LinearSolver& linear_solver);
|
||||
|
||||
/// @brief Computes linear-static state without writing HDF5 output.
|
||||
/// @return A validated state and sorted diagnostics, or a procedure failure.
|
||||
Result<LinearStaticExecutionResult> Execute(const Domain& domain) const;
|
||||
|
||||
private:
|
||||
const ParallelFor& parallel_for_;
|
||||
LinearSolver& linear_solver_;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_ANALYSIS_LINEAR_STATIC_PROCEDURE_H_
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef FESA_ANALYSIS_NONLINEAR_STATIC_PROCEDURE_H_
|
||||
#define FESA_ANALYSIS_NONLINEAR_STATIC_PROCEDURE_H_
|
||||
|
||||
#include "fesa/analysis/prepared_analysis.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
class NewtonIterationLogWriter;
|
||||
class ParallelFor;
|
||||
class TangentSolver;
|
||||
|
||||
/// @brief Executes fixed-load-factor full-Newton nonlinear static analysis.
|
||||
class NonlinearStaticProcedureExecutor {
|
||||
public:
|
||||
/// @brief Creates a procedure executor with caller-owned backend adapters.
|
||||
/// @param parallel_for Deterministic element-local execution adapter.
|
||||
/// @param tangent_solver Fresh unsymmetric tangent solve adapter.
|
||||
NonlinearStaticProcedureExecutor(const ParallelFor& parallel_for,
|
||||
TangentSolver& tangent_solver);
|
||||
|
||||
/// @brief Computes accepted nonlinear frames and appends iteration records.
|
||||
/// @return A validated nonlinear state without writing HDF5 output.
|
||||
Result<NonlinearStaticExecutionResult> Execute(
|
||||
const Domain& domain, NewtonIterationLogWriter& log) const;
|
||||
|
||||
private:
|
||||
const ParallelFor& parallel_for_;
|
||||
TangentSolver& tangent_solver_;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_ANALYSIS_NONLINEAR_STATIC_PROCEDURE_H_
|
||||
@@ -0,0 +1,71 @@
|
||||
#ifndef FESA_ANALYSIS_PREPARED_ANALYSIS_H_
|
||||
#define FESA_ANALYSIS_PREPARED_ANALYSIS_H_
|
||||
|
||||
#include <filesystem>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/analysis/analysis_state.h"
|
||||
#include "fesa/analysis/nonlinear_analysis_state.h"
|
||||
#include "fesa/core/diagnostic.h"
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
class LinearStaticProcedureExecutor;
|
||||
class NewtonIterationLogWriter;
|
||||
class NonlinearResultsWriter;
|
||||
class NonlinearStaticProcedureExecutor;
|
||||
class ResultsWriter;
|
||||
struct DerivedOutputPaths;
|
||||
|
||||
/// @brief Owns one parsed and semantically mapped analysis input.
|
||||
struct PreparedAnalysisInput {
|
||||
Domain domain;
|
||||
std::vector<Diagnostic> diagnostics;
|
||||
};
|
||||
|
||||
/// @brief Parses and maps an input file exactly once for procedure execution.
|
||||
/// @param input_path Source Abaqus input path.
|
||||
/// @return A movable Domain and sorted mapping diagnostics, or an input
|
||||
/// failure.
|
||||
Result<PreparedAnalysisInput> PrepareAnalysisInput(
|
||||
const std::filesystem::path& input_path);
|
||||
|
||||
/// @brief Stores a completed linear-static calculation before result writing.
|
||||
struct LinearStaticExecutionResult {
|
||||
AnalysisState state;
|
||||
std::vector<Diagnostic> diagnostics;
|
||||
};
|
||||
|
||||
/// @brief Stores a completed nonlinear-static calculation before result
|
||||
/// writing.
|
||||
struct NonlinearStaticExecutionResult {
|
||||
NonlinearAnalysisState state;
|
||||
std::vector<Diagnostic> diagnostics;
|
||||
};
|
||||
|
||||
using PreparedAnalysisOutcome =
|
||||
std::variant<LinearStaticExecutionResult, NonlinearStaticExecutionResult>;
|
||||
|
||||
/// @brief Selects the approved procedure from a prepared Domain.
|
||||
/// @pre The executors and log outlive this call.
|
||||
/// @return A validated procedure outcome without opening a result file.
|
||||
Result<PreparedAnalysisOutcome> ExecutePreparedAnalysis(
|
||||
const Domain& domain, LinearStaticProcedureExecutor& linear_executor,
|
||||
NonlinearStaticProcedureExecutor& nonlinear_executor,
|
||||
NewtonIterationLogWriter& log);
|
||||
|
||||
/// @brief Writes an already computed outcome to its authoritative result file.
|
||||
/// @pre The Newton log has closed successfully before this function is called.
|
||||
/// @return Success after the selected writer atomically finalizes its result.
|
||||
Status FinalizePreparedAnalysisResult(
|
||||
const DerivedOutputPaths& paths, const Domain& domain,
|
||||
const PreparedAnalysisOutcome& outcome,
|
||||
const std::vector<Diagnostic>& diagnostics, ResultsWriter& linear_writer,
|
||||
NonlinearResultsWriter& nonlinear_writer);
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_ANALYSIS_PREPARED_ANALYSIS_H_
|
||||
Reference in New Issue
Block a user