122 lines
4.3 KiB
C++
122 lines
4.3 KiB
C++
#ifndef FESA_ANALYSIS_NONLINEAR_ANALYSIS_STATE_H_
|
|
#define FESA_ANALYSIS_NONLINEAR_ANALYSIS_STATE_H_
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
#include "fesa/core/source_identity.h"
|
|
#include "fesa/core/status.h"
|
|
#include "fesa/fem/dof_manager.h"
|
|
#include "fesa/math/vector.h"
|
|
#include "fesa/model/domain.h"
|
|
#include "fesa/results/result_records.h"
|
|
|
|
namespace fesa {
|
|
|
|
/// @brief Stores one fixed-reference baseline orientation for a source node.
|
|
struct NonlinearNodeBaseline {
|
|
EntityIndex node_index;
|
|
SourceEntityId source_id;
|
|
std::array<std::array<double, 3>, 3> triad;
|
|
std::array<double, 3> director;
|
|
};
|
|
|
|
/// @brief Carries the complete stable-order nonlinear node baseline.
|
|
struct NonlinearStateBaselineInput {
|
|
std::vector<NonlinearNodeBaseline> node_baselines;
|
|
};
|
|
|
|
/// @brief Owns one complete nonlinear trial or committed state identity.
|
|
struct NonlinearTrialState {
|
|
std::uint32_t increment_index;
|
|
double load_factor;
|
|
bool is_factor_zero_baseline;
|
|
std::vector<EntityIndex> nodal_internal_order;
|
|
std::vector<SourceEntityId> nodal_source_ids;
|
|
Vector generalized_coordinates;
|
|
Vector displacement;
|
|
Vector rotation_vector;
|
|
std::vector<std::array<std::array<double, 3>, 3>> nodal_triad;
|
|
std::vector<std::array<double, 3>> nodal_director;
|
|
Vector internal_force;
|
|
Vector external_force;
|
|
Vector residual;
|
|
Vector reaction;
|
|
std::vector<ShellResultRow> shell_results;
|
|
double physical_strain_energy;
|
|
std::array<double, 6> global_equilibrium;
|
|
std::optional<Mitc4DrillingEvidence> mitc4_drilling;
|
|
};
|
|
|
|
/// @brief Stores one authoritative nonlinear increment frame.
|
|
struct AcceptedFrameState {
|
|
std::uint32_t frame_index;
|
|
std::uint32_t increment_index;
|
|
double load_factor;
|
|
std::uint32_t iteration_count;
|
|
bool is_factor_one;
|
|
std::vector<EntityIndex> nodal_internal_order;
|
|
std::vector<SourceEntityId> nodal_source_ids;
|
|
Vector generalized_coordinates;
|
|
Vector displacement;
|
|
Vector rotation_vector;
|
|
std::vector<std::array<std::array<double, 3>, 3>> nodal_triad;
|
|
std::vector<std::array<double, 3>> nodal_director;
|
|
Vector internal_force;
|
|
Vector external_force;
|
|
Vector residual;
|
|
Vector reaction;
|
|
std::vector<ShellResultRow> shell_results;
|
|
double physical_strain_energy;
|
|
std::array<double, 6> global_equilibrium;
|
|
std::optional<Mitc4DrillingEvidence> mitc4_drilling;
|
|
};
|
|
|
|
/// @brief Owns committed nonlinear state and validated accepted frames.
|
|
class NonlinearAnalysisState {
|
|
public:
|
|
/// @brief Creates the factor-zero committed state from fixed node baselines.
|
|
/// @param domain Immutable owner of stable node and shell-element identities.
|
|
/// @param dofs Owner of the full global [u, phi] dimension.
|
|
/// @param baseline One finite triad/director entry per Domain node.
|
|
/// @return A factor-zero state or a structured model failure.
|
|
static Result<NonlinearAnalysisState> Create(
|
|
const Domain& domain, const DofManager& dofs,
|
|
const NonlinearStateBaselineInput& baseline);
|
|
|
|
/// @brief Returns an independent trial initialized from committed state.
|
|
/// @return A copy that the caller may mutate without changing committed state.
|
|
Result<NonlinearTrialState> BeginTrialFromCommitted() const;
|
|
|
|
/// @brief Atomically appends one complete validated accepted frame.
|
|
/// @param frame Converged factor-ordered state with full residual evidence.
|
|
/// @return Success after replacing committed state and appending the frame.
|
|
Status CommitAcceptedFrame(const AcceptedFrameState& frame);
|
|
|
|
/// @brief Discards caller-owned trial work without changing committed state.
|
|
void DiscardTrial() noexcept;
|
|
|
|
/// @brief Returns accepted frames in stable load-factor order.
|
|
const std::vector<AcceptedFrameState>& AcceptedFrames() const noexcept;
|
|
|
|
/// @brief Returns the current committed factor-zero or accepted state.
|
|
const NonlinearTrialState& CommittedState() const noexcept;
|
|
|
|
private:
|
|
/// @brief Retains the validated immutable inventory for frame commits.
|
|
NonlinearAnalysisState(NonlinearTrialState committed_state,
|
|
std::size_t full_dof_count,
|
|
std::vector<EntityIndex> shell_element_order);
|
|
|
|
NonlinearTrialState committed_state_;
|
|
std::size_t full_dof_count_;
|
|
std::vector<EntityIndex> shell_element_order_;
|
|
std::vector<AcceptedFrameState> accepted_frames_;
|
|
};
|
|
|
|
} // namespace fesa
|
|
|
|
#endif // FESA_ANALYSIS_NONLINEAR_ANALYSIS_STATE_H_
|