feat(domain-and-input-skeleton): step 0 — semantic-domain-and-origin-types

This commit is contained in:
KOKO\Mimi
2026-07-30 16:38:05 +09:00
parent b851575554
commit c7e64eb841
12 changed files with 455 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <array>
#include <fesa/model/entity_origin.hpp>
#include <fesa/model/ids.hpp>
namespace fesa {
struct BeamElement final {
ElementId id;
EntityOrigin origin;
std::array<NodeId, 2> nodes;
MaterialId material;
SectionId section;
};
} // namespace fesa
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include <array>
#include <string>
#include <vector>
#include <fesa/core/vec3.hpp>
#include <fesa/model/ids.hpp>
namespace fesa {
enum class ShearPropertySource { input, phase1_default };
struct BeamSection final {
SectionId id;
std::string name;
double area;
double iy;
double iz;
double torsion_j;
double shear_area_y;
double shear_area_z;
ShearPropertySource shear_source;
Vec3 orientation;
std::vector<std::array<double, 2>> recovery_points;
};
} // namespace fesa
+96
View File
@@ -0,0 +1,96 @@
#pragma once
#include <algorithm>
#include <span>
#include <stdexcept>
#include <utility>
#include <vector>
#include <fesa/model/beam_element.hpp>
#include <fesa/model/beam_section.hpp>
#include <fesa/model/entity_set.hpp>
#include <fesa/model/material.hpp>
#include <fesa/model/node.hpp>
#include <fesa/model/step_definition.hpp>
namespace fesa {
class Domain final {
public:
Domain(
std::vector<Node> nodes,
std::vector<BeamElement> beam_elements,
std::vector<IsotropicElastic> materials,
std::vector<BeamSection> sections,
std::vector<NodeSet> node_sets,
std::vector<ElementSet> element_sets,
StepDefinition step)
: nodes_{std::move(nodes)},
beam_elements_{std::move(beam_elements)},
materials_{std::move(materials)},
sections_{std::move(sections)},
node_sets_{std::move(node_sets)},
element_sets_{std::move(element_sets)},
step_{std::move(step)} {}
[[nodiscard]] std::span<const Node> nodes() const noexcept {
return nodes_;
}
[[nodiscard]] std::span<const BeamElement> beam_elements() const noexcept {
return beam_elements_;
}
[[nodiscard]] std::span<const IsotropicElastic> materials() const noexcept {
return materials_;
}
[[nodiscard]] std::span<const BeamSection> sections() const noexcept {
return sections_;
}
[[nodiscard]] std::span<const NodeSet> node_sets() const noexcept {
return node_sets_;
}
[[nodiscard]] std::span<const ElementSet> element_sets() const noexcept {
return element_sets_;
}
[[nodiscard]] const StepDefinition& step() const noexcept {
return step_;
}
[[nodiscard]] const Node& node(const NodeId id) const {
const auto found = std::find_if(
nodes_.begin(), nodes_.end(),
[id](const Node& candidate) { return candidate.id == id; });
if (found == nodes_.end()) {
throw std::out_of_range{"Node ID is not present in the Domain."};
}
return *found;
}
[[nodiscard]] const Node& node(const EntityOrigin& origin) const {
const auto found = std::find_if(
nodes_.begin(), nodes_.end(), [&origin](const Node& candidate) {
return candidate.origin == origin;
});
if (found == nodes_.end()) {
throw std::out_of_range{
"Node origin is not present in the Domain."};
}
return *found;
}
private:
std::vector<Node> nodes_;
std::vector<BeamElement> beam_elements_;
std::vector<IsotropicElastic> materials_;
std::vector<BeamSection> sections_;
std::vector<NodeSet> node_sets_;
std::vector<ElementSet> element_sets_;
StepDefinition step_;
};
} // namespace fesa
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#include <cstdint>
#include <string>
namespace fesa {
struct EntityOrigin final {
std::string part_name;
std::string instance_name;
std::int64_t local_label;
bool operator==(const EntityOrigin&) const = default;
};
} // namespace fesa
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include <string>
#include <vector>
#include <fesa/model/ids.hpp>
namespace fesa {
struct NodeSet final {
std::string name;
std::vector<NodeId> members;
};
struct ElementSet final {
std::string name;
std::vector<ElementId> members;
};
} // namespace fesa
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <fesa/core/entity_id.hpp>
namespace fesa {
struct NodeTag;
struct ElementTag;
struct MaterialTag;
struct SectionTag;
using NodeId = EntityId<NodeTag>;
using ElementId = EntityId<ElementTag>;
using MaterialId = EntityId<MaterialTag>;
using SectionId = EntityId<SectionTag>;
} // namespace fesa
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#include <string>
#include <fesa/model/ids.hpp>
namespace fesa {
struct IsotropicElastic final {
MaterialId id;
std::string name;
double young;
double poisson;
};
} // namespace fesa
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include <fesa/core/vec3.hpp>
#include <fesa/model/entity_origin.hpp>
#include <fesa/model/ids.hpp>
namespace fesa {
struct Node final {
NodeId id;
EntityOrigin origin;
Vec3 position;
};
} // namespace fesa
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <array>
#include <cstdint>
#include <string>
#include <vector>
#include <fesa/model/ids.hpp>
namespace fesa {
struct PrescribedDof final {
NodeId node;
std::uint8_t dof;
double value;
};
struct NodalLoad final {
NodeId node;
std::array<double, 6> values;
};
struct StepDefinition final {
std::string name;
std::vector<PrescribedDof> prescribed_dofs;
std::vector<NodalLoad> nodal_loads;
};
} // namespace fesa