IOSS  2.0
Ioss_SideBlock.h
Go to the documentation of this file.
1 // Copyright(C) 1999-2017 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 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 //
17 // * Neither the name of NTESS nor the names of its
18 // contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 #ifndef IOSS_Ioss_SideBlock_h
34 #define IOSS_Ioss_SideBlock_h
35 
36 #include <Ioss_ElementBlock.h>
37 #include <Ioss_EntityBlock.h> // for EntityBlock
38 #include <Ioss_EntityType.h> // for EntityType, etc
39 #include <Ioss_Property.h> // for Property
40 #include <cstddef> // for size_t
41 #include <cstdint> // for int64_t
42 #include <string> // for string
43 #include <vector> // for vector
44 namespace Ioss {
45  class DatabaseIO;
46 } // namespace Ioss
47 namespace Ioss {
48  class ElementTopology;
49 } // namespace Ioss
50 namespace Ioss {
51  class Field;
52 } // namespace Ioss
53 namespace Ioss {
54  class SideSet;
55 } // namespace Ioss
56 
57 namespace Ioss {
58 
59  /** \brief A collection of element sides having the same topology.
60  */
61  class SideBlock : public EntityBlock
62  {
63  public:
64  friend class SideSet;
65 
66  SideBlock(DatabaseIO *io_database, const std::string &my_name, const std::string &side_type,
67  const std::string &element_type, size_t side_count);
68 
69  std::string type_string() const override { return "SideBlock"; }
70  std::string short_type_string() const override { return "sideblock"; }
71  std::string contains_string() const override { return "Element/Side pair"; }
72  EntityType type() const override { return SIDEBLOCK; }
73 
74  const SideSet *owner() const { return owner_; }
75 
76  void block_membership(std::vector<std::string> &block_members) override;
77 
78  // Handle implicit properties -- These are calcuated from data stored
79  // in the grouping entity instead of having an explicit value assigned.
80  // An example would be 'element_block_count' for a region.
81  Property get_implicit_property(const std::string &my_name) const override;
82 
83  // For faceblock, edgeblock, if they are split by element block, then this
84  // will be non-nullptr and is a pointer to the parent element block for this
85  // faceblock or edgeblock. Has no meaning for other EntityBlock types or split
86  // types.
88  {
89  return dynamic_cast<const ElementBlock *>(parentBlock_);
90  }
91 
92  void set_parent_element_block(const ElementBlock *element_block)
93  {
94  parentBlock_ = element_block;
95  }
96 
97  const EntityBlock *parent_block() const { return parentBlock_; }
98  void set_parent_block(const EntityBlock *block) { parentBlock_ = block; }
99 
100  // Describes the contained entities element block topology
102 
103  // For faceblock, edgeblock, return whether the surface is applied
104  // to the same face/edge for all elements in the surface. If not,
105  // return 0; otherwise return the consistent face number.
106  int get_consistent_side_number() const;
108 
109  protected:
110  int64_t internal_get_field_data(const Field &field, void *data,
111  size_t data_size) const override;
112 
113  int64_t internal_put_field_data(const Field &field, void *data,
114  size_t data_size) const override;
115 
116  private:
117  const SideSet * owner_;
118  ElementTopology * parentTopology_; // Topology of parent element (if any)
120 
121  // Pointer to the SideSet (if any) that contains this side block.
122  std::vector<std::string> blockMembership; // What element blocks do the
123  // elements in this sideset belong to.
124  mutable int consistentSideNumber;
125  };
126 } // namespace Ioss
127 #endif
Represents an element topology.
Definition: Ioss_ElementTopology.h:72
A named value that has a known type.
Definition: Ioss_Property.h:47
void set_consistent_side_number(int side)
Definition: Ioss_SideBlock.h:107
The main namespace for the Ioss library.
Definition: Ioad_DatabaseIO.C:66
Property get_implicit_property(const std::string &my_name) const override
Calculate and get an implicit property.
Definition: Ioss_SideBlock.C:93
An input or output Database.
Definition: Ioss_DatabaseIO.h:82
std::string type_string() const override
Get the name of the particular type of entity.
Definition: Ioss_SideBlock.h:69
const SideSet * owner() const
Definition: Ioss_SideBlock.h:74
int get_consistent_side_number() const
Definition: Ioss_SideBlock.C:143
std::string short_type_string() const override
Get a short name of the particular type of entity.
Definition: Ioss_SideBlock.h:70
A collection of element sides having the same topology.
Definition: Ioss_SideBlock.h:61
int64_t internal_get_field_data(const Field &field, void *data, size_t data_size) const override
Definition: Ioss_SideBlock.C:81
const ElementTopology * parent_element_topology() const
Definition: Ioss_SideBlock.h:101
const SideSet * owner_
Definition: Ioss_SideBlock.h:117
const EntityBlock * parentBlock_
Definition: Ioss_SideBlock.h:119
Definition: Ioss_EntityType.h:51
A collection of elements having the same topology.
Definition: Ioss_ElementBlock.h:48
const EntityBlock * parent_block() const
Definition: Ioss_SideBlock.h:97
Base class for all 'block'-type grouping entities, which means all members of the block are similar o...
Definition: Ioss_EntityBlock.h:61
std::string contains_string() const override
What does this entity contain.
Definition: Ioss_SideBlock.h:71
const ElementBlock * parent_element_block() const
Definition: Ioss_SideBlock.h:87
EntityType type() const override
Get the EntityType, which indicates the particular type of GroupingEntity this is.
Definition: Ioss_SideBlock.h:72
void block_membership(std::vector< std::string > &block_members) override
Get list of blocks that the entities in this GroupingEntity "touch".
Definition: Ioss_SideBlock.C:110
void set_parent_element_block(const ElementBlock *element_block)
Definition: Ioss_SideBlock.h:92
ElementTopology * parentTopology_
Definition: Ioss_SideBlock.h:118
std::vector< char > data
Definition: cth_pressure_map.C:73
void set_parent_block(const EntityBlock *block)
Definition: Ioss_SideBlock.h:98
A collection of element sides.
Definition: Ioss_SideSet.h:59
Holds metadata for bulk data associated with a GroupingEntity.
Definition: Ioss_Field.h:47
SideBlock(DatabaseIO *io_database, const std::string &my_name, const std::string &side_type, const std::string &element_type, size_t side_count)
Create a side block.
Definition: Ioss_SideBlock.C:58
std::vector< std::string > blockMembership
Definition: Ioss_SideBlock.h:122
EntityType
The particular type of GroupingEntity.
Definition: Ioss_EntityType.h:39
int consistentSideNumber
Definition: Ioss_SideBlock.h:124
int64_t internal_put_field_data(const Field &field, void *data, size_t data_size) const override
Definition: Ioss_SideBlock.C:87