97 lines
2.8 KiB
C++
97 lines
2.8 KiB
C++
#pragma once
|
|
|
|
#include <algorithm>
|
|
#include <span>
|
|
#include <stdexcept>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
#include <fesa/model/beam_element.hpp>
|
|
#include <fesa/model/beam_section.hpp>
|
|
#include <fesa/model/entity_set.hpp>
|
|
#include <fesa/model/material.hpp>
|
|
#include <fesa/model/node.hpp>
|
|
#include <fesa/model/step_definition.hpp>
|
|
|
|
namespace fesa {
|
|
|
|
class Domain final {
|
|
public:
|
|
Domain(
|
|
std::vector<Node> nodes,
|
|
std::vector<BeamElement> beam_elements,
|
|
std::vector<IsotropicElastic> materials,
|
|
std::vector<BeamSection> sections,
|
|
std::vector<NodeSet> node_sets,
|
|
std::vector<ElementSet> 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<const Node> nodes() const noexcept {
|
|
return nodes_;
|
|
}
|
|
|
|
[[nodiscard]] std::span<const BeamElement> beam_elements() const noexcept {
|
|
return beam_elements_;
|
|
}
|
|
|
|
[[nodiscard]] std::span<const IsotropicElastic> materials() const noexcept {
|
|
return materials_;
|
|
}
|
|
|
|
[[nodiscard]] std::span<const BeamSection> sections() const noexcept {
|
|
return sections_;
|
|
}
|
|
|
|
[[nodiscard]] std::span<const NodeSet> node_sets() const noexcept {
|
|
return node_sets_;
|
|
}
|
|
|
|
[[nodiscard]] std::span<const ElementSet> 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<Node> nodes_;
|
|
std::vector<BeamElement> beam_elements_;
|
|
std::vector<IsotropicElastic> materials_;
|
|
std::vector<BeamSection> sections_;
|
|
std::vector<NodeSet> node_sets_;
|
|
std::vector<ElementSet> element_sets_;
|
|
StepDefinition step_;
|
|
};
|
|
|
|
} // namespace fesa
|