feat: add solver core skeleton

This commit is contained in:
NINI
2026-06-12 02:25:07 +09:00
parent 4e7fd1087d
commit cbd1a6c5d7
46 changed files with 1911 additions and 19 deletions
+56
View File
@@ -0,0 +1,56 @@
#pragma once
#include <fesa/model/boundary_condition.hpp>
#include <fesa/model/load.hpp>
#include <string>
#include <utility>
#include <vector>
namespace fesa::model {
class AnalysisStep {
public:
AnalysisStep(core::StepId id, std::string name)
: id_(id), name_(std::move(name))
{
}
core::StepId id() const
{
return id_;
}
const std::string& name() const
{
return name_;
}
void add_boundary_condition(BoundaryCondition bc)
{
boundary_conditions_.push_back(std::move(bc));
}
void add_load(Load load)
{
loads_.push_back(std::move(load));
}
const std::vector<BoundaryCondition>& boundary_conditions() const
{
return boundary_conditions_;
}
const std::vector<Load>& loads() const
{
return loads_;
}
private:
core::StepId id_;
std::string name_;
std::vector<BoundaryCondition> boundary_conditions_;
std::vector<Load> loads_;
};
} // namespace fesa::model
+45
View File
@@ -0,0 +1,45 @@
#pragma once
#include <fesa/core/ids.hpp>
namespace fesa::model {
enum class DofComponent {
ux,
uy,
uz,
rx,
ry,
rz,
temperature
};
class BoundaryCondition {
public:
BoundaryCondition(core::NodeId node_id, DofComponent component, double value)
: node_id_(node_id), component_(component), value_(value)
{
}
core::NodeId node_id() const
{
return node_id_;
}
DofComponent component() const
{
return component_;
}
double value() const
{
return value_;
}
private:
core::NodeId node_id_;
DofComponent component_;
double value_;
};
} // namespace fesa::model
+124
View File
@@ -0,0 +1,124 @@
#pragma once
#include <fesa/model/analysis_step.hpp>
#include <fesa/model/element.hpp>
#include <fesa/model/material.hpp>
#include <fesa/model/node.hpp>
#include <fesa/model/property.hpp>
#include <utility>
#include <vector>
namespace fesa::model {
class Domain {
public:
void add_node(Node node)
{
nodes_.push_back(std::move(node));
}
void add_element(Element element)
{
elements_.push_back(std::move(element));
}
void add_material(Material material)
{
materials_.push_back(std::move(material));
}
void add_property(Property property)
{
properties_.push_back(std::move(property));
}
void add_step(AnalysisStep step)
{
steps_.push_back(std::move(step));
}
const std::vector<Node>& nodes() const
{
return nodes_;
}
const std::vector<Element>& elements() const
{
return elements_;
}
const std::vector<Material>& materials() const
{
return materials_;
}
const std::vector<Property>& properties() const
{
return properties_;
}
const std::vector<AnalysisStep>& steps() const
{
return steps_;
}
const Node* find_node(core::NodeId id) const
{
for (const auto& node : nodes_) {
if (node.id().value == id.value) {
return &node;
}
}
return nullptr;
}
const Element* find_element(core::ElementId id) const
{
for (const auto& element : elements_) {
if (element.id().value == id.value) {
return &element;
}
}
return nullptr;
}
const Material* find_material(core::MaterialId id) const
{
for (const auto& material : materials_) {
if (material.id().value == id.value) {
return &material;
}
}
return nullptr;
}
const Property* find_property(core::PropertyId id) const
{
for (const auto& property : properties_) {
if (property.id().value == id.value) {
return &property;
}
}
return nullptr;
}
const AnalysisStep* find_step(core::StepId id) const
{
for (const auto& step : steps_) {
if (step.id().value == id.value) {
return &step;
}
}
return nullptr;
}
private:
std::vector<Node> nodes_;
std::vector<Element> elements_;
std::vector<Material> materials_;
std::vector<Property> properties_;
std::vector<AnalysisStep> steps_;
};
} // namespace fesa::model
+56
View File
@@ -0,0 +1,56 @@
#pragma once
#include <fesa/core/ids.hpp>
#include <utility>
#include <vector>
namespace fesa::model {
enum class ElementTopology {
truss2,
bar2,
unknown
};
class Element {
public:
Element(core::ElementId id,
ElementTopology topology,
std::vector<core::NodeId> node_ids,
core::PropertyId property_id)
: id_(id),
topology_(topology),
node_ids_(std::move(node_ids)),
property_id_(property_id)
{
}
core::ElementId id() const
{
return id_;
}
ElementTopology topology() const
{
return topology_;
}
const std::vector<core::NodeId>& node_ids() const
{
return node_ids_;
}
core::PropertyId property_id() const
{
return property_id_;
}
private:
core::ElementId id_;
ElementTopology topology_;
std::vector<core::NodeId> node_ids_;
core::PropertyId property_id_;
};
} // namespace fesa::model
+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include <fesa/model/boundary_condition.hpp>
namespace fesa::model {
class Load {
public:
Load(core::NodeId node_id, DofComponent component, double value)
: node_id_(node_id), component_(component), value_(value)
{
}
core::NodeId node_id() const
{
return node_id_;
}
DofComponent component() const
{
return component_;
}
double value() const
{
return value_;
}
private:
core::NodeId node_id_;
DofComponent component_;
double value_;
};
} // namespace fesa::model
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <fesa/core/ids.hpp>
#include <string>
#include <utility>
namespace fesa::model {
class Material {
public:
Material(core::MaterialId id, std::string name)
: id_(id), name_(std::move(name))
{
}
core::MaterialId id() const
{
return id_;
}
const std::string& name() const
{
return name_;
}
private:
core::MaterialId id_;
std::string name_;
};
} // namespace fesa::model
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include <fesa/core/ids.hpp>
#include <array>
namespace fesa::model {
class Node {
public:
Node(core::NodeId id, std::array<double, 3> coordinates)
: id_(id), coordinates_(coordinates)
{
}
core::NodeId id() const
{
return id_;
}
const std::array<double, 3>& coordinates() const
{
return coordinates_;
}
private:
core::NodeId id_;
std::array<double, 3> coordinates_;
};
} // namespace fesa::model
+38
View File
@@ -0,0 +1,38 @@
#pragma once
#include <fesa/core/ids.hpp>
#include <string>
#include <utility>
namespace fesa::model {
class Property {
public:
Property(core::PropertyId id, std::string name, core::MaterialId material_id)
: id_(id), name_(std::move(name)), material_id_(material_id)
{
}
core::PropertyId id() const
{
return id_;
}
const std::string& name() const
{
return name_;
}
core::MaterialId material_id() const
{
return material_id_;
}
private:
core::PropertyId id_;
std::string name_;
core::MaterialId material_id_;
};
} // namespace fesa::model