refactor: store runtime objects in domain

This commit is contained in:
김경종
2026-06-09 10:08:34 +09:00
parent 8f24213ab7
commit f4196efb10
20 changed files with 754 additions and 368 deletions
+22 -48
View File
@@ -1,17 +1,13 @@
#pragma once
#include "fesa/boundary/BoundaryCondition.hpp"
#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 "fesa/element/Element.hpp"
#include "fesa/load/Load.hpp"
#include "fesa/material/Material.hpp"
#include "fesa/property/ShellProperty.hpp"
#include <cstddef>
#include <memory>
@@ -24,33 +20,29 @@ namespace fesa::core {
class Domain {
public:
void addNode(Node node);
void addElement(ElementDefinition element);
void addMaterial(LinearElasticMaterialDefinition material);
void addShellProperty(ShellPropertyDefinition property);
void addElement(std::unique_ptr<fesa::element::Element> element);
void addMaterial(std::unique_ptr<fesa::material::Material> material);
void addShellProperty(fesa::property::ShellProperty 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);
std::size_t addBoundaryCondition(std::unique_ptr<fesa::boundary::BoundaryCondition> boundary);
std::size_t addLoad(std::unique_ptr<fesa::load::Load> load);
void addStep(LinearStaticStepDefinition step);
void addElementObject(std::unique_ptr<fesa::element::Element> element);
void addMaterialObject(std::unique_ptr<fesa::material::Material> material);
std::size_t addLoadObject(std::unique_ptr<fesa::load::Load> load);
std::size_t addBoundaryObject(std::unique_ptr<fesa::boundary::BoundaryCondition> boundary);
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;
const fesa::element::Element* findElement(ElementId id) const noexcept;
const fesa::element::Element& element(ElementId id) const;
std::size_t elementCount() const noexcept;
const LinearElasticMaterialDefinition* findMaterial(MaterialId id) const noexcept;
const LinearElasticMaterialDefinition& material(MaterialId id) const;
const fesa::material::Material* findMaterial(MaterialId id) const noexcept;
const fesa::material::Material& material(MaterialId id) const;
std::size_t materialCount() const noexcept;
const ShellPropertyDefinition* findShellProperty(PropertyId id) const noexcept;
const ShellPropertyDefinition& shellProperty(PropertyId id) const;
const fesa::property::ShellProperty* findShellProperty(PropertyId id) const noexcept;
const fesa::property::ShellProperty& shellProperty(PropertyId id) const;
std::size_t shellPropertyCount() const noexcept;
const std::vector<NodeId>* findNodeSet(const std::string& name) const noexcept;
@@ -61,46 +53,28 @@ public:
const std::vector<ElementId>& elementSet(const std::string& name) const;
std::size_t elementSetCount() const noexcept;
const BoundaryCondition& boundaryCondition(std::size_t index) const;
const fesa::boundary::BoundaryCondition* findBoundaryCondition(std::size_t index) const noexcept;
const fesa::boundary::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 fesa::load::Load* findLoad(std::size_t index) const noexcept;
const fesa::load::Load& load(std::size_t index) const;
std::size_t loadCount() const noexcept;
const LinearStaticStepDefinition* findStep(StepId id) const noexcept;
const LinearStaticStepDefinition& step(StepId id) const;
std::size_t stepCount() const noexcept;
const fesa::element::Element* findElementObject(ElementId id) const noexcept;
const fesa::element::Element& elementObject(ElementId id) const;
std::size_t elementObjectCount() const noexcept;
const fesa::material::Material* findMaterialObject(MaterialId id) const noexcept;
const fesa::material::Material& materialObject(MaterialId id) const;
std::size_t materialObjectCount() const noexcept;
const fesa::load::Load* findLoadObject(std::size_t index) const noexcept;
const fesa::load::Load& loadObject(std::size_t index) const;
std::size_t loadObjectCount() const noexcept;
const fesa::boundary::BoundaryCondition* findBoundaryObject(std::size_t index) const noexcept;
const fesa::boundary::BoundaryCondition& boundaryObject(std::size_t index) const;
std::size_t boundaryObjectCount() 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<ElementId, std::unique_ptr<fesa::element::Element>> elements_;
std::unordered_map<MaterialId, std::unique_ptr<fesa::material::Material>> materials_;
std::unordered_map<PropertyId, fesa::property::ShellProperty> 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::vector<std::unique_ptr<fesa::boundary::BoundaryCondition>> boundary_conditions_;
std::vector<std::unique_ptr<fesa::load::Load>> loads_;
std::unordered_map<StepId, LinearStaticStepDefinition> steps_;
std::unordered_map<ElementId, std::unique_ptr<fesa::element::Element>> element_objects_;
std::unordered_map<MaterialId, std::unique_ptr<fesa::material::Material>> material_objects_;
std::vector<std::unique_ptr<fesa::load::Load>> load_objects_;
std::vector<std::unique_ptr<fesa::boundary::BoundaryCondition>> boundary_objects_;
};
} // namespace fesa::core
-4
View File
@@ -6,10 +6,6 @@
namespace fesa::core {
enum class ElementType {
Mitc4
};
class ElementDefinition {
public:
ElementDefinition(
+4
View File
@@ -21,6 +21,10 @@ enum class Dof : std::uint8_t {
UR3 = 5
};
enum class ElementType {
Mitc4
};
constexpr std::size_t kDofPerNode = 6;
} // namespace fesa::core