feat(cpp-object-oriented-modular-refactoring): step 5 - solver-workflow-google-style
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
#ifndef FESA_ANALYSIS_ANALYSIS_STATE_H_
|
||||
#define FESA_ANALYSIS_ANALYSIS_STATE_H_
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/fem/dof_manager.h"
|
||||
#include "fesa/math/vector.h"
|
||||
#include "fesa/results/result_records.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Owns mutable quantities required by the V0 linear-static frame.
|
||||
class AnalysisState {
|
||||
public:
|
||||
/// @brief Allocates zeroed full-DOF vectors for a DOF manager.
|
||||
/// @param dofs Owner of the full-DOF dimension used by every state vector.
|
||||
/// @param identity Stable step and frame identity for this state.
|
||||
static AnalysisState Create(const DofManager& dofs,
|
||||
StepFrameIdentity identity);
|
||||
|
||||
/// @brief Returns mutable full-space displacement.
|
||||
Vector& Displacement() noexcept;
|
||||
/// @brief Returns full-space displacement.
|
||||
const Vector& Displacement() const noexcept;
|
||||
/// @brief Returns mutable full-space external force.
|
||||
Vector& ExternalForce() noexcept;
|
||||
/// @brief Returns full-space external force.
|
||||
const Vector& ExternalForce() const noexcept;
|
||||
/// @brief Returns mutable full-space internal force.
|
||||
Vector& InternalForce() noexcept;
|
||||
/// @brief Returns full-space internal force.
|
||||
const Vector& InternalForce() const noexcept;
|
||||
/// @brief Returns mutable full residual K*d-F.
|
||||
Vector& Residual() noexcept;
|
||||
/// @brief Returns full residual K*d-F.
|
||||
const Vector& Residual() const noexcept;
|
||||
/// @brief Returns mutable full-index reaction and free residual evidence.
|
||||
Vector& Reaction() noexcept;
|
||||
/// @brief Returns full-index reaction and free residual evidence.
|
||||
const Vector& Reaction() const noexcept;
|
||||
/// @brief Returns the stable step and frame identity.
|
||||
const StepFrameIdentity& Identity() const noexcept;
|
||||
/// @brief Returns mutable beam endpoint result rows.
|
||||
std::vector<EndpointResultRow>& EndpointResults() noexcept;
|
||||
/// @brief Returns beam endpoint result rows.
|
||||
const std::vector<EndpointResultRow>& EndpointResults() const noexcept;
|
||||
/// @brief Returns mutable beam Gauss result rows.
|
||||
std::vector<GaussResultRow>& GaussResults() noexcept;
|
||||
/// @brief Returns beam Gauss result rows.
|
||||
const std::vector<GaussResultRow>& GaussResults() const noexcept;
|
||||
/// @brief Returns mutable beam axial-stress rows.
|
||||
std::vector<StressS11Row>& StressResults() noexcept;
|
||||
/// @brief Returns beam axial-stress rows.
|
||||
const std::vector<StressS11Row>& StressResults() const noexcept;
|
||||
|
||||
/// @brief Validates and atomically replaces all shell recovery evidence.
|
||||
/// @param expected_element_order Unique shell indices in stable order.
|
||||
/// @param candidate Complete shell rows, energy, and equilibrium evidence.
|
||||
/// @return Success only after the complete candidate is validated and
|
||||
/// committed; failure preserves the prior shell state.
|
||||
Status CommitShellResults(
|
||||
const std::vector<EntityIndex>& expected_element_order,
|
||||
ShellStateCandidate candidate);
|
||||
|
||||
/// @brief Returns shell rows in stable element and location order.
|
||||
const std::vector<ShellResultRow>& ShellResults() const noexcept;
|
||||
/// @brief Returns physical shell strain energy without drilling energy.
|
||||
double PhysicalStrainEnergy() const noexcept;
|
||||
/// @brief Returns global force and moment equilibrium components.
|
||||
const std::array<double, 6>& Equilibrium() const noexcept;
|
||||
/// @brief Returns normalized shell verification metrics.
|
||||
const std::array<double, 3>& VerificationMetrics() const noexcept;
|
||||
|
||||
private:
|
||||
/// @brief Allocates state storage for one stable full-DOF dimension.
|
||||
AnalysisState(std::size_t full_dof_count, StepFrameIdentity identity);
|
||||
|
||||
StepFrameIdentity identity_;
|
||||
Vector displacement_;
|
||||
Vector external_force_;
|
||||
Vector internal_force_;
|
||||
Vector residual_;
|
||||
// Reactions retain full-index space so free residual components remain
|
||||
// visible.
|
||||
Vector reaction_;
|
||||
// Recovery appends rows in stable element/location order.
|
||||
std::vector<EndpointResultRow> endpoint_results_;
|
||||
std::vector<GaussResultRow> gauss_results_;
|
||||
std::vector<StressS11Row> stress_results_;
|
||||
// Shell recovery is replaced only through validated candidate commit.
|
||||
std::vector<ShellResultRow> shell_results_;
|
||||
double physical_strain_energy_{0.0};
|
||||
std::array<double, 6> equilibrium_{};
|
||||
std::array<double, 3> verification_metrics_{};
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_ANALYSIS_ANALYSIS_STATE_H_
|
||||
Reference in New Issue
Block a user