feat(cpp-object-oriented-modular-refactoring): step 14 - runtime-element-factory

This commit is contained in:
KOKO\Mimi
2026-08-16 09:38:30 +09:00
parent ace493ee57
commit aaa488211b
14 changed files with 991 additions and 27 deletions
+24 -2
View File
@@ -8,6 +8,7 @@
#include <vector>
#include "fesa/core/status.h"
#include "fesa/elements/element.h"
#include "fesa/elements/element_definition.h"
#include "fesa/materials/isotropic_linear_elastic_material.h"
#include "fesa/math/matrix.h"
@@ -79,7 +80,7 @@ struct BeamRecovery {
/// @brief Implements the approved two-node prismatic B33 Euler beam kernel.
/// @note Equation numbering and semantic element identity remain external.
class EulerBeam3D {
class EulerBeam3D final : public Element {
public:
/// @brief Creates a validated beam kernel and right-handed local frame.
/// @param first_node First source node in the element connectivity.
@@ -92,6 +93,16 @@ class EulerBeam3D {
const GeneralBeamSection& section,
const LinearElasticMaterial& material);
/// @brief Returns the factory-bound B33 DOF order.
const ElementDofLayout& DofLayout() const noexcept override;
/// @brief Computes global B33 stiffness through the runtime contract.
Result<ElementStiffnessContribution> ComputeStiffness() const override;
/// @brief Recovers typed B33 rows through the runtime contract.
Result<ElementResultBundle> Recover(
const Vector& element_displacement) const override;
/// @brief Computes the 12-by-12 stiffness in local DOF order.
/// @note Uses the approved two-point Gauss operation order.
Matrix LocalStiffness() const;
@@ -107,9 +118,16 @@ class EulerBeam3D {
/// @brief Recovers signed physical quantities at their distinct locations.
/// @param global_element_displacement Twelve global element DOF values.
/// @return Beam recovery rows in deterministic location order.
BeamRecovery Recover(const Vector& global_element_displacement) const;
BeamRecovery RecoverBeam(const Vector& global_element_displacement) const;
private:
friend class ElementFactory;
/// @brief Binds Domain identity after the numerical candidate is valid.
void BindRuntime(ElementDofLayout layout, EntityIndex element_index,
std::vector<SourceEntityId> node_source_ids,
SourceLocation location);
/// @brief Stores already validated geometry, material, and section state.
EulerBeam3D(double length, double youngs_modulus, double shear_modulus,
double area, double iy, double iz, double torsional_constant,
@@ -125,6 +143,10 @@ class EulerBeam3D {
double torsional_constant_;
std::array<double, 9> rotation_;
std::vector<std::array<double, 2>> section_points_;
ElementDofLayout dof_layout_;
EntityIndex element_index_{0U};
std::vector<SourceEntityId> node_source_ids_;
SourceLocation runtime_location_;
};
} // namespace fesa