#ifndef FESA_MODEL_DOMAIN_H_ #define FESA_MODEL_DOMAIN_H_ #include #include #include #include #include #include "fesa/core/status.h" #include "fesa/model/model_types.h" namespace fesa { /// @brief Exposes immutable references without transferring Domain ownership. /// @tparam T Base or concrete semantic type stored by the Domain. template class DomainCollectionView { public: /// @brief Returns the number of stable collection positions. std::size_t Size() const noexcept { return entries_.size(); } /// @brief Reports whether the collection has no entries. bool Empty() const noexcept { return entries_.empty(); } /// @brief Returns one immutable entry without bounds checking. const T& operator[](const std::size_t index) const noexcept { return *entries_[index]; } /// @brief Returns one immutable entry with bounds checking. const T& At(const std::size_t index) const { return *entries_.at(index); } private: friend class Domain; /// @brief Adds one reference while the owning Domain candidate is built. void Add(const T& entry) { entries_.push_back(&entry); } std::vector entries_; }; /// @brief Owns the complete immutable semantic model definition. /// @note Collection positions remain stable internal indices after /// construction. class Domain { public: /// @brief Creates a Domain that owns a copy or moved model definition. /// @param definition Complete parsed semantic records in declaration order. /// @return A successful owning Domain. static Result Create(ModelDefinition definition); Domain(const Domain&) = delete; Domain& operator=(const Domain&) = delete; Domain(Domain&&) noexcept = default; Domain& operator=(Domain&&) noexcept = default; /// @brief Returns nodes in stable declaration order. const std::vector& Nodes() const noexcept; /// @brief Returns all element definitions in stable Domain index order. const DomainCollectionView& Elements() const noexcept; /// @brief Returns B33 definitions in their stable concrete order. const DomainCollectionView& BeamElements() const noexcept; /// @brief Returns MITC4 shell definitions in stable declaration order. const DomainCollectionView& ShellElements() const noexcept; /// @brief Returns all materials in stable Domain index order. const DomainCollectionView& Materials() const noexcept; /// @brief Returns current isotropic materials in stable concrete order. const DomainCollectionView& LinearElasticMaterials() const noexcept; /// @brief Returns all properties in stable Domain index order. const DomainCollectionView& Properties() const noexcept; /// @brief Returns beam sections in stable declaration order. const DomainCollectionView& Sections() const noexcept; /// @brief Returns shell sections in stable declaration order. const DomainCollectionView& ShellSections() const noexcept; /// @brief Returns preprocessed shell-node frames in stable node order. const std::vector& ShellNodeInitialFrames() const noexcept; /// @brief Returns node sets in stable declaration order. const std::vector& NodeSets() const noexcept; /// @brief Returns element sets in stable declaration order. const std::vector& ElementSets() const noexcept; /// @brief Returns static steps in stable declaration order. const std::vector& Steps() const noexcept; /// @brief Returns sorted nonfatal mapping diagnostics. const std::vector& Warnings() const noexcept; /// @brief Returns the source input path associated with this model. const std::filesystem::path& SourcePath() const noexcept; /// @brief Returns the deterministic source-content identity. const std::string& SourceContentIdentity() const noexcept; private: /// @brief Takes ownership of an already constructed model definition. explicit Domain(ModelDefinition definition); ModelDefinition definition_; std::vector> element_definitions_; std::vector> element_properties_; std::vector> materials_; DomainCollectionView elements_view_; DomainCollectionView beam_elements_view_; DomainCollectionView shell_elements_view_; DomainCollectionView properties_view_; DomainCollectionView sections_view_; DomainCollectionView shell_sections_view_; DomainCollectionView materials_view_; DomainCollectionView linear_materials_view_; }; } // namespace fesa #endif // FESA_MODEL_DOMAIN_H_