feat: add domain model foundation

This commit is contained in:
김경종
2026-06-08 16:40:04 +09:00
parent e4e2f57808
commit fdeac602f4
38 changed files with 2685 additions and 5 deletions
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "fesa/core/ModelTypes.hpp"
namespace fesa::core {
class BoundaryCondition {
public:
BoundaryCondition(NodeId node_id, Dof dof, double value);
NodeId nodeId() const noexcept;
Dof dof() const noexcept;
double value() const noexcept;
private:
NodeId node_id_;
Dof dof_;
double value_;
};
} // namespace fesa::core
+77
View File
@@ -0,0 +1,77 @@
#pragma once
#include "fesa/core/BoundaryCondition.hpp"
#include "fesa/core/ElementDefinition.hpp"
#include "fesa/core/LoadDefinition.hpp"
#include "fesa/core/MaterialDefinition.hpp"
#include "fesa/core/ModelTypes.hpp"
#include "fesa/core/Node.hpp"
#include "fesa/core/PropertyDefinition.hpp"
#include "fesa/core/StepDefinition.hpp"
#include <cstddef>
#include <string>
#include <unordered_map>
#include <vector>
namespace fesa::core {
class Domain {
public:
void addNode(Node node);
void addElement(ElementDefinition element);
void addMaterial(LinearElasticMaterialDefinition material);
void addShellProperty(ShellPropertyDefinition property);
void addNodeSet(std::string name, std::vector<NodeId> node_ids);
void addElementSet(std::string name, std::vector<ElementId> element_ids);
std::size_t addBoundaryCondition(BoundaryCondition condition);
std::size_t addNodalLoad(NodalLoadDefinition load);
void addStep(LinearStaticStepDefinition step);
const Node* findNode(NodeId id) const noexcept;
const Node& node(NodeId id) const;
std::size_t nodeCount() const noexcept;
const ElementDefinition* findElement(ElementId id) const noexcept;
const ElementDefinition& element(ElementId id) const;
std::size_t elementCount() const noexcept;
const LinearElasticMaterialDefinition* findMaterial(MaterialId id) const noexcept;
const LinearElasticMaterialDefinition& material(MaterialId id) const;
std::size_t materialCount() const noexcept;
const ShellPropertyDefinition* findShellProperty(PropertyId id) const noexcept;
const ShellPropertyDefinition& shellProperty(PropertyId id) const;
std::size_t shellPropertyCount() const noexcept;
const std::vector<NodeId>* findNodeSet(const std::string& name) const noexcept;
const std::vector<NodeId>& nodeSet(const std::string& name) const;
std::size_t nodeSetCount() const noexcept;
const std::vector<ElementId>* findElementSet(const std::string& name) const noexcept;
const std::vector<ElementId>& elementSet(const std::string& name) const;
std::size_t elementSetCount() const noexcept;
const BoundaryCondition& boundaryCondition(std::size_t index) const;
std::size_t boundaryConditionCount() const noexcept;
const NodalLoadDefinition& nodalLoad(std::size_t index) const;
std::size_t nodalLoadCount() const noexcept;
const LinearStaticStepDefinition* findStep(StepId id) const noexcept;
const LinearStaticStepDefinition& step(StepId id) const;
std::size_t stepCount() const noexcept;
private:
std::unordered_map<NodeId, Node> nodes_;
std::unordered_map<ElementId, ElementDefinition> elements_;
std::unordered_map<MaterialId, LinearElasticMaterialDefinition> materials_;
std::unordered_map<PropertyId, ShellPropertyDefinition> shell_properties_;
std::unordered_map<std::string, std::vector<NodeId>> node_sets_;
std::unordered_map<std::string, std::vector<ElementId>> element_sets_;
std::vector<BoundaryCondition> boundary_conditions_;
std::vector<NodalLoadDefinition> nodal_loads_;
std::unordered_map<StepId, LinearStaticStepDefinition> steps_;
};
} // namespace fesa::core
+33
View File
@@ -0,0 +1,33 @@
#pragma once
#include "fesa/core/ModelTypes.hpp"
#include <array>
namespace fesa::core {
enum class ElementType {
Mitc4
};
class ElementDefinition {
public:
ElementDefinition(
ElementId id,
ElementType type,
std::array<NodeId, 4> connectivity,
PropertyId property_id);
ElementId id() const noexcept;
ElementType type() const noexcept;
const std::array<NodeId, 4>& connectivity() const noexcept;
PropertyId propertyId() const noexcept;
private:
ElementId id_;
ElementType type_;
std::array<NodeId, 4> connectivity_;
PropertyId property_id_;
};
} // namespace fesa::core
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "fesa/core/ModelTypes.hpp"
namespace fesa::core {
class NodalLoadDefinition {
public:
NodalLoadDefinition(NodeId node_id, Dof dof, double value);
NodeId nodeId() const noexcept;
Dof dof() const noexcept;
double value() const noexcept;
private:
NodeId node_id_;
Dof dof_;
double value_;
};
} // namespace fesa::core
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "fesa/core/ModelTypes.hpp"
namespace fesa::core {
class LinearElasticMaterialDefinition {
public:
LinearElasticMaterialDefinition(MaterialId id, double young_modulus, double poisson_ratio);
MaterialId id() const noexcept;
double youngModulus() const noexcept;
double poissonRatio() const noexcept;
private:
MaterialId id_;
double young_modulus_;
double poisson_ratio_;
};
} // namespace fesa::core
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include <cstddef>
#include <cstdint>
namespace fesa::core {
using Id = std::int64_t;
using NodeId = Id;
using ElementId = Id;
using MaterialId = Id;
using PropertyId = Id;
using StepId = Id;
enum class Dof : std::uint8_t {
U1 = 0,
U2 = 1,
U3 = 2,
UR1 = 3,
UR2 = 4,
UR3 = 5
};
constexpr std::size_t kDofPerNode = 6;
} // namespace fesa::core
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#include "fesa/core/ModelTypes.hpp"
#include <array>
namespace fesa::core {
class Node {
public:
Node(NodeId id, double x, double y, double z);
NodeId id() const noexcept;
double x() const noexcept;
double y() const noexcept;
double z() const noexcept;
const std::array<double, 3>& coordinates() const noexcept;
private:
NodeId id_;
std::array<double, 3> coordinates_;
};
} // namespace fesa::core
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "fesa/core/ModelTypes.hpp"
namespace fesa::core {
class ShellPropertyDefinition {
public:
ShellPropertyDefinition(PropertyId id, MaterialId material_id, double thickness);
PropertyId id() const noexcept;
MaterialId materialId() const noexcept;
double thickness() const noexcept;
private:
PropertyId id_;
MaterialId material_id_;
double thickness_;
};
} // namespace fesa::core
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include "fesa/core/ModelTypes.hpp"
#include <cstddef>
#include <string>
#include <vector>
namespace fesa::core {
class LinearStaticStepDefinition {
public:
LinearStaticStepDefinition(
StepId id,
std::string name,
std::vector<std::size_t> boundary_condition_indices,
std::vector<std::size_t> load_indices);
StepId id() const noexcept;
const std::string& name() const noexcept;
const std::vector<std::size_t>& boundaryConditionIndices() const noexcept;
const std::vector<std::size_t>& loadIndices() const noexcept;
private:
StepId id_;
std::string name_;
std::vector<std::size_t> boundary_condition_indices_;
std::vector<std::size_t> load_indices_;
};
} // namespace fesa::core