1 // Copyright(C) 1999-2020 National Technology & Engineering Solutions 2 // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with 3 // NTESS, the U.S. Government retains certain rights in this software. 4 // 5 // See packages/seacas/LICENSE for details 6 7 #ifndef IOSS_Ioss_Assembly_h 8 #define IOSS_Ioss_Assembly_h 9 10 #include "vtk_ioss_mangle.h" 11 12 #include "Ioss_EntityType.h" // for EntityType, etc 13 #include "Ioss_Property.h" // for Property 14 #include <Ioss_GroupingEntity.h> 15 #include <cstddef> // for size_t 16 #include <cstdint> // for int64_t 17 #include <string> // for string 18 namespace Ioss { 19 class DatabaseIO; 20 class Field; 21 } // namespace Ioss 22 23 namespace Ioss { 24 25 using EntityContainer = std::vector<const Ioss::GroupingEntity *>; 26 27 /** \brief A homogeneous collection of other GroupingEntities. 28 */ 29 class Assembly : public GroupingEntity 30 { 31 public: 32 Assembly() = default; // Used for template typing only 33 ~Assembly() override = default; 34 Assembly(const Assembly &); 35 36 Assembly(DatabaseIO *io_database, const std::string &my_name); 37 type_string()38 std::string type_string() const override { return "Assembly"; } short_type_string()39 std::string short_type_string() const override { return "assembly"; } contains_string()40 std::string contains_string() const override 41 { 42 return m_members.empty() ? "<EMPTY>" : m_members[0]->type_string(); 43 } type()44 EntityType type() const override { return ASSEMBLY; } 45 get_member_type()46 EntityType get_member_type() const { return m_type; } 47 48 bool add(const GroupingEntity *member); 49 bool remove(const GroupingEntity *member); 50 const EntityContainer &get_members() const; 51 const GroupingEntity * get_member(const std::string &my_name) const; 52 void remove_members(); member_count()53 size_t member_count() const { return m_members.size(); } 54 55 // Handle implicit properties -- These are calcuated from data stored 56 // in the grouping entity instead of having an explicit value assigned. 57 // An example would be 'element_block_count' for a region. 58 Property get_implicit_property(const std::string &my_name) const override; 59 60 protected: 61 int64_t internal_get_field_data(const Field &field, void *data, 62 size_t data_size) const override; 63 64 int64_t internal_put_field_data(const Field &field, void *data, 65 size_t data_size) const override; 66 67 private: 68 EntityContainer m_members; 69 EntityType m_type{INVALID_TYPE}; 70 }; 71 } // namespace Ioss 72 #endif 73