#include "fesa/Boundary/Boundary.hpp" #include "fesa/Core/Core.hpp" #include "fesa/Load/Load.hpp" #include "fesa/Property/Property.hpp" #include "fesa/Util/Util.hpp" #include #include #include #include namespace { void check(bool value, const char* message) { if (!value) { throw std::runtime_error(message); } } } // namespace int main() { static_assert(std::is_same_v, "Real must remain double"); static_assert(std::is_same_v, "GlobalId must remain int64"); static_assert(std::is_same_v, "LocalIndex must remain int64"); static_assert(std::is_same_v, "EquationId must remain int64"); static_assert(std::is_same_v, "SparseIndex must remain int64"); fesa::Domain domain; domain.nodes[10] = {10, {0.0, 0.0, 0.0}}; domain.nodes[20] = {20, {1.0, 0.0, 0.0}}; domain.nodes[30] = {30, {1.0, 1.0, 0.0}}; domain.nodes[40] = {40, {0.0, 1.0, 0.0}}; domain.elements[100] = {100, fesa::ElementType::MITC4, {10, 20, 30, 40}, "EALL"}; domain.element_sets["eall"] = {"EALL", {100}}; domain.node_sets["fixed"] = {"FIXED", {10, 40}}; domain.materials["mat"] = {"MAT", 1000.0, 0.3}; domain.shell_sections.push_back(fesa::ShellSection{"EALL", "MAT", 0.1}); domain.boundary_conditions.push_back(fesa::BoundaryCondition{"FIXED", 1, 6, 0.0}); domain.loads.push_back(fesa::NodalLoad{"20", 3, -1.0}); domain.steps.push_back({"Step-1", "linear_static"}); check(fesa::Domain::key(" EALL ") == "eall", "Domain key normalization changed"); check(fesa::dofFromAbaqus(6).value() == fesa::Dof::RZ, "Abaqus DOF mapping changed"); check(std::string(fesa::dofLabel(fesa::Dof::UX)) == "UX", "DOF label changed"); const auto diagnostics = fesa::validateDomain(domain); check(!fesa::hasError(diagnostics), "Direct module validation reported an error"); const fesa::DofManager dofs(domain); check(dofs.fullDofCount() == 24, "DofManager full DOF count changed"); check(dofs.constrainedDofCount() == 12, "DofManager constrained DOF count changed"); check(dofs.freeDofCount() == 12, "DofManager free DOF count changed"); check(dofs.equation(20, fesa::Dof::UZ) >= 0, "Free equation numbering changed"); check(dofs.equation(10, fesa::Dof::UX) == -1, "Constrained equation numbering changed"); const auto diagnostic = fesa::makeDiagnostic(fesa::Severity::Warning, "FESA-SMOKE", "module smoke", "core"); check(diagnostic.source.keyword == "core", "Diagnostic source keyword changed"); const auto model = fesa::buildLinearStaticAnalysisModel(domain); check(model.ok(), "AnalysisModel direct module construction failed"); check(model.active_element_ids.size() == 1, "AnalysisModel active elements changed"); fesa::AnalysisState state; state.u_full = dofs.reconstructFullVector(std::vector(static_cast(dofs.freeDofCount()), 0.0)); check(state.u_full.size() == static_cast(dofs.fullDofCount()), "AnalysisState full vector ownership changed"); return 0; }