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 <Ioss_SideSet.h>
41 #include <cstddef> // for size_t
42 #include <cstdint> // for int64_t
43 #include <string> // for string
44 #include <vector> // for vector
45 namespace Ioss {
46  class DatabaseIO;
47 } // namespace Ioss
48 namespace Ioss {
49  class ElementTopology;
50 } // namespace Ioss
51 namespace Ioss {
52  class Field;
53 } // namespace Ioss
54 
55 namespace Ioss {
56 
57  /** \brief A collection of element sides having the same topology.
58  */
59  class SideBlock : public EntityBlock
60  {
61  public:
62  friend class SideSet;
63 
64  SideBlock(DatabaseIO *io_database, const std::string &my_name, const std::string &side_type,
65  const std::string &element_type, size_t side_count);
66 
67  std::string type_string() const override { return "SideBlock"; }
68  std::string short_type_string() const override { return "sideblock"; }
69  std::string contains_string() const override { return "Element/Side pair"; }
70  EntityType type() const override { return SIDEBLOCK; }
71 
72  const SideSet * owner() const { return owner_; }
73  const Ioss::GroupingEntity *contained_in() const override { return owner_; }
74 
75  void block_membership(std::vector<std::string> &block_members) override;
76 
77  // Handle implicit properties -- These are calcuated from data stored
78  // in the grouping entity instead of having an explicit value assigned.
79  // An example would be 'element_block_count' for a region.
80  Property get_implicit_property(const std::string &my_name) const override;
81 
82  // For faceblock, edgeblock, if they are split by element block, then this
83  // will be non-nullptr and is a pointer to the parent element block for this
84  // faceblock or edgeblock. Has no meaning for other EntityBlock types or split
85  // types.
87  {
88  return dynamic_cast<const ElementBlock *>(parentBlock_);
89  }
90 
91  void set_parent_element_block(const ElementBlock *element_block)
92  {
93  parentBlock_ = element_block;
94  }
95 
96  const EntityBlock *parent_block() const { return parentBlock_; }
97  void set_parent_block(const EntityBlock *block) { parentBlock_ = block; }
98 
99  // Describes the contained entities element block topology
101 
102  // For faceblock, edgeblock, return whether the surface is applied
103  // to the same face/edge for all elements in the surface. If not,
104  // return 0; otherwise return the consistent face number.
105  int get_consistent_side_number() const;
107 
108  protected:
109  int64_t internal_get_field_data(const Field &field, void *data,
110  size_t data_size) const override;
111 
112  int64_t internal_put_field_data(const Field &field, void *data,
113  size_t data_size) const override;
114 
115  private:
116  const SideSet * owner_;
117  ElementTopology * parentTopology_; // Topology of parent element (if any)
119 
120  // Pointer to the SideSet (if any) that contains this side block.
121  std::vector<std::string> blockMembership; // What element blocks do the
122  // elements in this sideset belong to.
123  mutable int consistentSideNumber;
124  };
125 } // namespace Ioss
126 #endif
Ioss::SideBlock::internal_get_field_data
int64_t internal_get_field_data(const Field &field, void *data, size_t data_size) const override
Definition: Ioss_SideBlock.C:81
Ioss::SideBlock::parent_element_topology
const ElementTopology * parent_element_topology() const
Definition: Ioss_SideBlock.h:100
Ioss::Field
Holds metadata for bulk data associated with a GroupingEntity.
Definition: Ioss_Field.h:47
Ioss_Property.h
Ioss::SideBlock::consistentSideNumber
int consistentSideNumber
Definition: Ioss_SideBlock.h:123
Ioss::SideBlock::contains_string
std::string contains_string() const override
What does this entity contain.
Definition: Ioss_SideBlock.h:69
Ioss
The main namespace for the Ioss library.
Definition: Ioad_DatabaseIO.C:66
Ioss::SideBlock::get_implicit_property
Property get_implicit_property(const std::string &my_name) const override
Calculate and get an implicit property.
Definition: Ioss_SideBlock.C:93
Ioss::SideBlock::parent_block
const EntityBlock * parent_block() const
Definition: Ioss_SideBlock.h:96
Ioss::SideBlock::set_consistent_side_number
void set_consistent_side_number(int side)
Definition: Ioss_SideBlock.h:106
Ioss::SideBlock::parent_element_block
const ElementBlock * parent_element_block() const
Definition: Ioss_SideBlock.h:86
Ioss::SideBlock::type_string
std::string type_string() const override
Get the name of the particular type of entity.
Definition: Ioss_SideBlock.h:67
Ioss_ElementBlock.h
Ioss_SideSet.h
Ioss::EntityType
EntityType
The particular type of GroupingEntity.
Definition: Ioss_EntityType.h:39
Ioss::SideBlock::short_type_string
std::string short_type_string() const override
Get a short name of the particular type of entity.
Definition: Ioss_SideBlock.h:68
Ioss_EntityType.h
Ioss::SideBlock::parentBlock_
const EntityBlock * parentBlock_
Definition: Ioss_SideBlock.h:118
Ioss::DatabaseIO
An input or output Database.
Definition: Ioss_DatabaseIO.h:82
Ioss::SideBlock
A collection of element sides having the same topology.
Definition: Ioss_SideBlock.h:59
Ioss::SideBlock::owner_
const SideSet * owner_
Definition: Ioss_SideBlock.h:116
Ioss::EntityBlock
Base class for all 'block'-type grouping entities, which means all members of the block are similar o...
Definition: Ioss_EntityBlock.h:61
Ioss::SideBlock::contained_in
const Ioss::GroupingEntity * contained_in() const override
Definition: Ioss_SideBlock.h:73
Ioss::ElementBlock
A collection of elements having the same topology.
Definition: Ioss_ElementBlock.h:48
Ioss::ElementTopology
Represents an element topology.
Definition: Ioss_ElementTopology.h:72
Ioss::SideBlock::SideBlock
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
Ioss::SideBlock::blockMembership
std::vector< std::string > blockMembership
Definition: Ioss_SideBlock.h:121
Ioss::SideBlock::block_membership
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
Ioss::SideBlock::internal_put_field_data
int64_t internal_put_field_data(const Field &field, void *data, size_t data_size) const override
Definition: Ioss_SideBlock.C:87
Ioss::SIDEBLOCK
Definition: Ioss_EntityType.h:51
anonymous_namespace{cth_pressure_map.C}::data
std::vector< char > data
Definition: cth_pressure_map.C:74
Ioss::SideBlock::type
EntityType type() const override
Get the EntityType, which indicates the particular type of GroupingEntity this is.
Definition: Ioss_SideBlock.h:70
Ioss::SideBlock::owner
const SideSet * owner() const
Definition: Ioss_SideBlock.h:72
Ioss::SideBlock::parentTopology_
ElementTopology * parentTopology_
Definition: Ioss_SideBlock.h:117
Ioss::SideBlock::set_parent_block
void set_parent_block(const EntityBlock *block)
Definition: Ioss_SideBlock.h:97
Ioss::SideBlock::set_parent_element_block
void set_parent_element_block(const ElementBlock *element_block)
Definition: Ioss_SideBlock.h:91
Ioss::Property
A named value that has a known type.
Definition: Ioss_Property.h:47
Ioss::SideSet
A collection of element sides.
Definition: Ioss_SideSet.h:53
Ioss::GroupingEntity
Base class for all 'grouping' entities. The following derived classes are typical:
Definition: Ioss_GroupingEntity.h:93
Ioss_EntityBlock.h
Ioss::SideBlock::get_consistent_side_number
int get_consistent_side_number() const
Definition: Ioss_SideBlock.C:143