38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
#include <fesa/analysis/linear_static_analysis.hpp>
|
|
|
|
namespace {
|
|
|
|
fesa::model::Domain make_domain()
|
|
{
|
|
fesa::model::Domain domain;
|
|
domain.add_node({fesa::core::NodeId{1}, {0.0, 0.0, 0.0}});
|
|
domain.add_node({fesa::core::NodeId{2}, {1.0, 0.0, 0.0}});
|
|
domain.add_material({fesa::core::MaterialId{3}, "steel"});
|
|
domain.add_property({fesa::core::PropertyId{4}, "bar", fesa::core::MaterialId{3}});
|
|
domain.add_element({
|
|
fesa::core::ElementId{5},
|
|
fesa::model::ElementTopology::truss2,
|
|
{fesa::core::NodeId{1}, fesa::core::NodeId{2}},
|
|
fesa::core::PropertyId{4}
|
|
});
|
|
fesa::model::AnalysisStep step{fesa::core::StepId{6}, "static"};
|
|
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);
|
|
return domain;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main()
|
|
{
|
|
const auto domain = make_domain();
|
|
fesa::analysis::LinearStaticAnalysis analysis{domain, fesa::core::StepId{6}};
|
|
analysis.run();
|
|
|
|
if (analysis.analysis_model() == nullptr || analysis.state() == nullptr) {
|
|
return 1;
|
|
}
|
|
return analysis.state()->displacement().size() == 6 ? 0 : 1;
|
|
}
|