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.
87 const ElementBlock *parent_element_block() const
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
101 const ElementTopology *parent_element_topology() const { return parentTopology_; }
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;
107 void set_consistent_side_number(int side) { consistentSideNumber = side; }
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)
119 const EntityBlock *parentBlock_;
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
Ioss::ElementTopology
Represents an element topology.
Definition: Ioss_ElementTopology.h:72
Ioss_EntityBlock.h
Ioss::Property
A named value that has a known type.
Definition: Ioss_Property.h:47
Ioss::SideBlock::set_consistent_side_number
void set_consistent_side_number(int side)
Definition: Ioss_SideBlock.h:107
Ioss_Property.h
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::DatabaseIO
An input or output Database.
Definition: Ioss_DatabaseIO.h:82
Ioss::SideBlock::type_string
std::string type_string() const override
Get the name of the particular type of entity.
Definition: Ioss_SideBlock.h:69
Ioss::SideBlock::owner
const SideSet * owner() const
Definition: Ioss_SideBlock.h:74
Ioss::SideBlock::get_consistent_side_number
int get_consistent_side_number() const
Definition: Ioss_SideBlock.C:143
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:70
Ioss::SideBlock
A collection of element sides having the same topology.
Definition: Ioss_SideBlock.h:61
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:101
Ioss::SideBlock::owner_
const SideSet * owner_
Definition: Ioss_SideBlock.h:117
Ioss::SideBlock::parentBlock_
const EntityBlock * parentBlock_
Definition: Ioss_SideBlock.h:119
Ioss::SIDEBLOCK
Definition: Ioss_EntityType.h:51
Ioss::ElementBlock
A collection of elements having the same topology.
Definition: Ioss_ElementBlock.h:48
Ioss::SideBlock::parent_block
const EntityBlock * parent_block() const
Definition: Ioss_SideBlock.h:97
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::contains_string
std::string contains_string() const override
What does this entity contain.
Definition: Ioss_SideBlock.h:71
Ioss::SideBlock::parent_element_block
const ElementBlock * parent_element_block() const
Definition: Ioss_SideBlock.h:87
Ioss::SideBlock::type
EntityType type() const override
Get the EntityType, which indicates the particular type of GroupingEntity this is.
Definition: Ioss_SideBlock.h:72
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::set_parent_element_block
void set_parent_element_block(const ElementBlock *element_block)
Definition: Ioss_SideBlock.h:92
Ioss::SideBlock::parentTopology_
ElementTopology * parentTopology_
Definition: Ioss_SideBlock.h:118
anonymous_namespace{cth_pressure_map.C}::data
std::vector< char > data
Definition: cth_pressure_map.C:73
Ioss::SideBlock::set_parent_block
void set_parent_block(const EntityBlock *block)
Definition: Ioss_SideBlock.h:98
Ioss::SideSet
A collection of element sides.
Definition: Ioss_SideSet.h:59
Ioss::Field
Holds metadata for bulk data associated with a GroupingEntity.
Definition: Ioss_Field.h:47
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:122
Ioss::EntityType
EntityType
The particular type of GroupingEntity.
Definition: Ioss_EntityType.h:39
Ioss_EntityType.h
Ioss::SideBlock::consistentSideNumber
int consistentSideNumber
Definition: Ioss_SideBlock.h:124
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_ElementBlock.h