feat: add solver core skeleton
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
#include <fesa/model/domain.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
|
||||
int fail()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main()
|
||||
{
|
||||
fesa::model::Domain domain;
|
||||
|
||||
domain.add_node(fesa::model::Node{fesa::core::NodeId{1}, {1.0, 2.0, 3.0}});
|
||||
domain.add_element(fesa::model::Element{
|
||||
fesa::core::ElementId{10},
|
||||
fesa::model::ElementTopology::truss2,
|
||||
{fesa::core::NodeId{1}, fesa::core::NodeId{2}},
|
||||
fesa::core::PropertyId{20}
|
||||
});
|
||||
domain.add_material(fesa::model::Material{fesa::core::MaterialId{30}, "steel"});
|
||||
domain.add_property(fesa::model::Property{
|
||||
fesa::core::PropertyId{20},
|
||||
"bar",
|
||||
fesa::core::MaterialId{30}
|
||||
});
|
||||
|
||||
fesa::model::AnalysisStep step{fesa::core::StepId{40}, "load"};
|
||||
step.add_boundary_condition({fesa::core::NodeId{1}, fesa::model::DofComponent::ux, 0.0});
|
||||
step.add_load({fesa::core::NodeId{2}, fesa::model::DofComponent::ux, 10.0});
|
||||
domain.add_step(step);
|
||||
|
||||
const auto* node = domain.find_node(fesa::core::NodeId{1});
|
||||
if (node == nullptr || node->coordinates()[2] != 3.0) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
const auto* element = domain.find_element(fesa::core::ElementId{10});
|
||||
if (element == nullptr ||
|
||||
element->topology() != fesa::model::ElementTopology::truss2 ||
|
||||
element->node_ids().size() != 2 ||
|
||||
element->property_id().value != 20) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
const auto* material = domain.find_material(fesa::core::MaterialId{30});
|
||||
if (material == nullptr || material->name() != "steel") {
|
||||
return fail();
|
||||
}
|
||||
|
||||
const auto* property = domain.find_property(fesa::core::PropertyId{20});
|
||||
if (property == nullptr ||
|
||||
property->name() != "bar" ||
|
||||
property->material_id().value != 30) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
const auto* analysis_step = domain.find_step(fesa::core::StepId{40});
|
||||
if (analysis_step == nullptr ||
|
||||
analysis_step->boundary_conditions().size() != 1 ||
|
||||
analysis_step->loads().size() != 1) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
if (domain.find_node(fesa::core::NodeId{999}) != nullptr ||
|
||||
domain.find_element(fesa::core::ElementId{999}) != nullptr ||
|
||||
domain.find_material(fesa::core::MaterialId{999}) != nullptr ||
|
||||
domain.find_property(fesa::core::PropertyId{999}) != nullptr ||
|
||||
domain.find_step(fesa::core::StepId{999}) != nullptr) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user