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_SideBlock_h 8 #define IOSS_Ioss_SideBlock_h 9 10 #include "vtk_ioss_mangle.h" 11 12 #include <Ioss_ElementBlock.h> 13 #include <Ioss_EntityBlock.h> // for EntityBlock 14 #include <Ioss_EntityType.h> // for EntityType, etc 15 #include <Ioss_Property.h> // for Property 16 #include <Ioss_SideSet.h> 17 #include <cstddef> // for size_t 18 #include <cstdint> // for int64_t 19 #include <string> // for string 20 #include <vector> // for vector 21 namespace Ioss { 22 class DatabaseIO; 23 } // namespace Ioss 24 namespace Ioss { 25 class ElementTopology; 26 } // namespace Ioss 27 namespace Ioss { 28 class Field; 29 } // namespace Ioss 30 31 namespace Ioss { 32 33 /** \brief A collection of element sides having the same topology. 34 */ 35 class SideBlock : public EntityBlock 36 { 37 public: 38 friend class SideSet; 39 40 SideBlock(DatabaseIO *io_database, const std::string &my_name, const std::string &side_type, 41 const std::string &element_type, size_t side_count); 42 43 SideBlock(const SideBlock &other); 44 type_string()45 std::string type_string() const override { return "SideBlock"; } short_type_string()46 std::string short_type_string() const override { return "sideblock"; } contains_string()47 std::string contains_string() const override { return "Element/Side pair"; } type()48 EntityType type() const override { return SIDEBLOCK; } 49 owner()50 const SideSet * owner() const { return owner_; } contained_in()51 const Ioss::GroupingEntity *contained_in() const override { return owner_; } 52 53 void block_membership(std::vector<std::string> &block_members) override; 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 // For faceblock, edgeblock, if they are split by element block, then this 61 // will be non-nullptr and is a pointer to the parent element block for this 62 // faceblock or edgeblock. Has no meaning for other EntityBlock types or split 63 // types. parent_element_block()64 const ElementBlock *parent_element_block() const 65 { 66 return dynamic_cast<const ElementBlock *>(parentBlock_); 67 } 68 set_parent_element_block(const ElementBlock * element_block)69 void set_parent_element_block(const ElementBlock *element_block) 70 { 71 parentBlock_ = element_block; 72 } 73 parent_block()74 const EntityBlock *parent_block() const { return parentBlock_; } set_parent_block(const EntityBlock * block)75 void set_parent_block(const EntityBlock *block) { parentBlock_ = block; } 76 77 // Describes the contained entities element block topology parent_element_topology()78 const ElementTopology *parent_element_topology() const { return parentTopology_; } 79 80 // For faceblock, edgeblock, return whether the surface is applied 81 // to the same face/edge for all elements in the surface. If not, 82 // return 0; otherwise return the consistent face number. 83 int get_consistent_side_number() const; set_consistent_side_number(int side)84 void set_consistent_side_number(int side) { consistentSideNumber = side; } 85 86 bool operator==(const SideBlock &) const; 87 bool operator!=(const SideBlock &) const; 88 bool equal(const SideBlock &) const; 89 90 protected: 91 int64_t internal_get_field_data(const Field &field, void *data, 92 size_t data_size) const override; 93 94 int64_t internal_put_field_data(const Field &field, void *data, 95 size_t data_size) const override; 96 97 private: 98 bool equal_(const SideBlock &, bool quiet) const; 99 100 const SideSet * owner_{nullptr}; 101 ElementTopology * parentTopology_{nullptr}; // Topology of parent element (if any) 102 const EntityBlock *parentBlock_{nullptr}; 103 104 // Pointer to the SideSet (if any) that contains this side block. 105 std::vector<std::string> blockMembership{}; // What element blocks do the 106 // elements in this sideset belong to. 107 mutable int consistentSideNumber{-1}; 108 }; 109 } // namespace Ioss 110 #endif 111