#pragma once #include #include #include #include #include #include #include #include #include #include #include namespace fesa { class Domain final { public: Domain( std::vector nodes, std::vector beam_elements, std::vector materials, std::vector sections, std::vector node_sets, std::vector 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 nodes() const noexcept { return nodes_; } [[nodiscard]] std::span beam_elements() const noexcept { return beam_elements_; } [[nodiscard]] std::span materials() const noexcept { return materials_; } [[nodiscard]] std::span sections() const noexcept { return sections_; } [[nodiscard]] std::span node_sets() const noexcept { return node_sets_; } [[nodiscard]] std::span 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 nodes_; std::vector beam_elements_; std::vector materials_; std::vector sections_; std::vector node_sets_; std::vector element_sets_; StepDefinition step_; }; } // namespace fesa