feat(cpp-object-oriented-modular-refactoring): step 5 - solver-workflow-google-style
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
#ifndef FESA_RESULTS_RESULT_RECORDS_H_
|
||||
#define FESA_RESULTS_RESULT_RECORDS_H_
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/model/model_types.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Identifies one deterministic result frame.
|
||||
struct StepFrameIdentity {
|
||||
std::string step_name;
|
||||
std::size_t frame_index;
|
||||
};
|
||||
|
||||
/// @brief Stores one beam endpoint action and section-resultant row.
|
||||
struct EndpointResultRow {
|
||||
EntityIndex element;
|
||||
int endpoint;
|
||||
SourceEntityId node;
|
||||
std::array<double, 6> end_action;
|
||||
std::array<double, 4> section_resultant;
|
||||
};
|
||||
|
||||
/// @brief Stores one beam Gauss generalized result row.
|
||||
struct GaussResultRow {
|
||||
EntityIndex element;
|
||||
int gauss_point;
|
||||
std::array<double, 4> generalized_strain;
|
||||
std::array<double, 4> generalized_resultant;
|
||||
};
|
||||
|
||||
/// @brief Stores one beam axial-stress section-point row.
|
||||
struct StressS11Row {
|
||||
EntityIndex element;
|
||||
int gauss_point;
|
||||
std::size_t section_point;
|
||||
double x1;
|
||||
double x2;
|
||||
double s11;
|
||||
std::string source;
|
||||
};
|
||||
|
||||
/// @brief Identifies one MITC4 midsurface integration location.
|
||||
enum class ShellMidsurfaceLocation { kGp1, kGp2, kGp3, kGp4 };
|
||||
|
||||
/// @brief Identifies one through-thickness shell recovery position.
|
||||
enum class ShellSectionPosition { kBottom, kMiddle, kTop };
|
||||
|
||||
/// @brief Stores one through-thickness shell stress row.
|
||||
struct ShellSectionStressRow {
|
||||
ShellSectionPosition position;
|
||||
double zeta;
|
||||
std::array<double, 3> components;
|
||||
};
|
||||
|
||||
/// @brief Stores one MITC4 physical recovery row.
|
||||
struct ShellResultRow {
|
||||
EntityIndex element;
|
||||
ShellMidsurfaceLocation location;
|
||||
std::array<double, 2> natural_coordinates;
|
||||
// Axis rows [e1,e2,e3], global-component columns.
|
||||
std::array<std::array<double, 3>, 3> local_frame;
|
||||
std::array<double, 8> generalized_strain;
|
||||
std::array<double, 8> section_resultant;
|
||||
// Fixed BOTTOM, MIDDLE, TOP order; components are [S11,S22,S12].
|
||||
std::array<ShellSectionStressRow, 3> stress;
|
||||
};
|
||||
|
||||
/// @brief Carries a complete shell result candidate for atomic validation.
|
||||
struct ShellStateCandidate {
|
||||
std::vector<ShellResultRow> rows;
|
||||
double physical_strain_energy{0.0};
|
||||
// [FORCE_1,FORCE_2,FORCE_3,MOMENT_1,MOMENT_2,MOMENT_3].
|
||||
std::array<double, 6> equilibrium{};
|
||||
// [FREE_RESIDUAL_NORMALIZED,FORCE_BALANCE_NORMALIZED,
|
||||
// MOMENT_BALANCE_NORMALIZED].
|
||||
std::array<double, 3> verification_metrics{};
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_RESULTS_RESULT_RECORDS_H_
|
||||
@@ -1,83 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/model/model_types.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
struct StepFrameIdentity {
|
||||
std::string stepName;
|
||||
std::size_t frameIndex;
|
||||
};
|
||||
|
||||
struct EndpointResultRow {
|
||||
EntityIndex element;
|
||||
int endpoint;
|
||||
SourceEntityId node;
|
||||
std::array<double, 6> endAction;
|
||||
std::array<double, 4> sectionResultant;
|
||||
};
|
||||
|
||||
struct GaussResultRow {
|
||||
EntityIndex element;
|
||||
int gaussPoint;
|
||||
std::array<double, 4> generalizedStrain;
|
||||
std::array<double, 4> generalizedResultant;
|
||||
};
|
||||
|
||||
struct StressS11Row {
|
||||
EntityIndex element;
|
||||
int gaussPoint;
|
||||
std::size_t sectionPoint;
|
||||
double x1;
|
||||
double x2;
|
||||
double s11;
|
||||
std::string source;
|
||||
};
|
||||
|
||||
enum class ShellMidsurfaceLocation {
|
||||
gp1,
|
||||
gp2,
|
||||
gp3,
|
||||
gp4
|
||||
};
|
||||
|
||||
enum class ShellSectionPosition {
|
||||
bottom,
|
||||
middle,
|
||||
top
|
||||
};
|
||||
|
||||
struct ShellSectionStressRow {
|
||||
ShellSectionPosition position;
|
||||
double zeta;
|
||||
std::array<double, 3> components;
|
||||
};
|
||||
|
||||
struct ShellResultRow {
|
||||
EntityIndex element;
|
||||
ShellMidsurfaceLocation location;
|
||||
std::array<double, 2> naturalCoordinates;
|
||||
// Axis rows [e1,e2,e3], global-component columns.
|
||||
std::array<std::array<double, 3>, 3> localFrame;
|
||||
std::array<double, 8> generalizedStrain;
|
||||
std::array<double, 8> sectionResultant;
|
||||
// Fixed BOTTOM, MIDDLE, TOP order; components are [S11,S22,S12].
|
||||
std::array<ShellSectionStressRow, 3> stress;
|
||||
};
|
||||
|
||||
struct ShellStateCandidate {
|
||||
std::vector<ShellResultRow> rows;
|
||||
double physicalStrainEnergy{0.0};
|
||||
// [FORCE_1,FORCE_2,FORCE_3,MOMENT_1,MOMENT_2,MOMENT_3].
|
||||
std::array<double, 6> equilibrium{};
|
||||
// [FREE_RESIDUAL_NORMALIZED,FORCE_BALANCE_NORMALIZED,
|
||||
// MOMENT_BALANCE_NORMALIZED].
|
||||
std::array<double, 3> verificationMetrics{};
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef FESA_RESULTS_RESULT_RECOVERY_H_
|
||||
#define FESA_RESULTS_RESULT_RECOVERY_H_
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/analysis/analysis_model.h"
|
||||
#include "fesa/analysis/analysis_state.h"
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/fem/dof_manager.h"
|
||||
#include "fesa/math/sparse_matrix.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Stores one normalized positive-local-x node-station row.
|
||||
struct NodeStationResultRow {
|
||||
SourceEntityId node;
|
||||
EntityIndex representative_element;
|
||||
std::array<double, 4> section_resultant;
|
||||
};
|
||||
|
||||
/// @brief Recovers full equilibrium and active concrete element rows.
|
||||
class ResultRecovery {
|
||||
public:
|
||||
/// @brief Builds and atomically commits a complete recovery candidate.
|
||||
/// @return Success after full residual K*d-F and all result rows validate.
|
||||
static Status Recover(const AnalysisModel& model, const DofManager& dofs,
|
||||
const SparseMatrix& full_stiffness,
|
||||
AnalysisState& state);
|
||||
|
||||
/// @brief Normalizes eligible endpoint rows to source node stations.
|
||||
/// @param component_tolerances Per-component interior-station tolerances.
|
||||
/// @return Stable source-node rows or a structured identity/value failure.
|
||||
static Result<std::vector<NodeStationResultRow>>
|
||||
NormalizeSectionResultantsToNodeStations(
|
||||
const AnalysisModel& model,
|
||||
const std::vector<EndpointResultRow>& endpoint_rows,
|
||||
const std::array<double, 4>& component_tolerances);
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_RESULTS_RESULT_RECOVERY_H_
|
||||
@@ -1,36 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/analysis/analysis_model.hpp"
|
||||
#include "fesa/analysis/analysis_state.hpp"
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/fem/dof_manager.hpp"
|
||||
#include "fesa/math/sparse_matrix.h"
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
struct NodeStationResultRow {
|
||||
SourceEntityId node;
|
||||
EntityIndex representativeElement;
|
||||
std::array<double, 4> sectionResultant;
|
||||
};
|
||||
|
||||
// Recovers full-space equilibrium and the active concrete element rows without
|
||||
// exposing element or sparse-backend details to result consumers.
|
||||
class ResultRecovery {
|
||||
public:
|
||||
static Status recover(const AnalysisModel& model,
|
||||
const DofManager& dofs,
|
||||
const SparseMatrix& fullStiffness,
|
||||
AnalysisState& state);
|
||||
|
||||
static Result<std::vector<NodeStationResultRow>>
|
||||
normalizeSectionResultantsToNodeStations(
|
||||
const AnalysisModel& model,
|
||||
const std::vector<EndpointResultRow>& endpointRows,
|
||||
const std::array<double, 4>& componentTolerances);
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef FESA_RESULTS_RESULTS_WRITER_H_
|
||||
#define FESA_RESULTS_RESULTS_WRITER_H_
|
||||
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/analysis/analysis_state.h"
|
||||
#include "fesa/core/diagnostic.h"
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Isolates authoritative result storage from the solver core.
|
||||
class ResultsWriter {
|
||||
public:
|
||||
virtual ~ResultsWriter() = default;
|
||||
|
||||
/// @brief Writes one complete validated analysis state.
|
||||
/// @return Success only after backend-specific finalization completes.
|
||||
virtual Status Write(const std::filesystem::path& output_path,
|
||||
const Domain& domain, const AnalysisState& state,
|
||||
const std::vector<Diagnostic>& diagnostics) = 0;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_RESULTS_RESULTS_WRITER_H_
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/analysis/analysis_state.hpp"
|
||||
#include "fesa/core/diagnostic.h"
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
// Keeps the solver core independent of the authoritative result-storage backend.
|
||||
class ResultsWriter {
|
||||
public:
|
||||
virtual ~ResultsWriter() = default;
|
||||
|
||||
virtual Status write(
|
||||
const std::filesystem::path& outputPath,
|
||||
const Domain& domain,
|
||||
const AnalysisState& state,
|
||||
const std::vector<Diagnostic>& diagnostics) = 0;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
Reference in New Issue
Block a user