feat(cpp-object-oriented-modular-refactoring): step 12 - material-property-hierarchy

This commit is contained in:
KOKO\Mimi
2026-08-16 08:48:18 +09:00
parent ec9c3e250a
commit 64a7071986
14 changed files with 746 additions and 31 deletions
@@ -0,0 +1,68 @@
#ifndef FESA_MATERIALS_ISOTROPIC_LINEAR_ELASTIC_MATERIAL_H_
#define FESA_MATERIALS_ISOTROPIC_LINEAR_ELASTIC_MATERIAL_H_
#include <string>
#include "fesa/core/status.h"
#include "fesa/materials/material.h"
namespace fesa {
/// @brief Stores homogeneous isotropic linear-elastic material data.
/// @note Poisson ratios above 0.5 remain valid for the approved beam subset;
/// shell compatibility is checked by the shell kernel.
class IsotropicLinearElasticMaterial final : public Material {
public:
/// @brief Creates a material after validating the current elastic fields.
/// @param source_id Stable semantic identity supplied by the mapper.
/// @param name Source material name.
/// @param youngs_modulus Young's modulus in the active consistent unit
/// system.
/// @param poissons_ratio Dimensionless Poisson ratio.
/// @param location Source MATERIAL keyword location.
/// @return A material or a structured model failure.
static Result<IsotropicLinearElasticMaterial> Create(SourceEntityId source_id,
std::string name,
double youngs_modulus,
double poissons_ratio,
SourceLocation location);
/// @brief Constructs an already validated parser-owned material record.
/// @note This compatibility seam preserves existing semantic mapping until
/// Domain polymorphic ownership is migrated.
IsotropicLinearElasticMaterial(std::string name, double youngs_modulus,
double poissons_ratio,
SourceLocation location);
MaterialKind Kind() const noexcept override;
const SourceEntityId& SourceId() const noexcept override;
const SourceLocation& Location() const noexcept override;
/// @brief Returns the source material name.
const std::string& Name() const noexcept;
/// @brief Returns Young's modulus in the active consistent unit system.
double YoungsModulus() const noexcept;
/// @brief Returns the dimensionless Poisson ratio.
double PoissonsRatio() const noexcept;
// Public storage preserves the current semantic-record API until Domain
// ownership migrates in the next approved Step.
std::string name;
double youngs_modulus;
double poisson_ratio;
SourceLocation location;
private:
/// @brief Constructs a candidate whose fields have already been checked.
IsotropicLinearElasticMaterial(SourceEntityId source_id, std::string name,
double youngs_modulus, double poissons_ratio,
SourceLocation location);
SourceEntityId source_id_;
};
} // namespace fesa
#endif // FESA_MATERIALS_ISOTROPIC_LINEAR_ELASTIC_MATERIAL_H_
+28
View File
@@ -0,0 +1,28 @@
#ifndef FESA_MATERIALS_MATERIAL_H_
#define FESA_MATERIALS_MATERIAL_H_
#include "fesa/core/source_identity.h"
namespace fesa {
/// @brief Identifies the supported concrete material semantics.
enum class MaterialKind { kIsotropicLinearElastic };
/// @brief Provides stable identity for a Domain-owned material definition.
class Material {
public:
virtual ~Material() = default;
/// @brief Returns the concrete material kind.
virtual MaterialKind Kind() const noexcept = 0;
/// @brief Returns the stable source identity preserved for diagnostics.
virtual const SourceEntityId& SourceId() const noexcept = 0;
/// @brief Returns the input location that defined the material.
virtual const SourceLocation& Location() const noexcept = 0;
};
} // namespace fesa
#endif // FESA_MATERIALS_MATERIAL_H_