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 EntityType type() const override { return SIDEBLOCK; }
72
73 const SideSet *owner() const { 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.
86 const ElementBlock *parent_element_block() const
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
100 const ElementTopology *parent_element_topology() const { return parentTopology_; }
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;
106 void set_consistent_side_number(int side) { consistentSideNumber = side; }
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)
118 const EntityBlock *parentBlock_;
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::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:106
Ioss_Property.h
Ioss
The main namespace for the Ioss library.
Definition: Iocgns_DatabaseIO.h:50
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:80
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:73
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:100
Ioss::SideBlock::owner_
const SideSet * owner_
Definition: Ioss_SideBlock.h:116
Ioss::SideBlock::parentBlock_
const EntityBlock * parentBlock_
Definition: Ioss_SideBlock.h:118
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:96
Ioss::EntityBlock
Base class for all &#39;block&#39;-type grouping entities, which means all members of the block are similar o...
Definition: Ioss_EntityBlock.h:61
Ioss::SideBlock::parent_element_block
const ElementBlock * parent_element_block() const
Definition: Ioss_SideBlock.h:86
Ioss::SideBlock::type
EntityType type() const override
Get the EntityType, which indicates the particular type of GroupingEntity this is.
Definition: Ioss_SideBlock.h:71
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:91
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::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:121
Ioss::EntityType
EntityType
The particular type of GroupingEntity.
Definition: Ioss_EntityType.h:39
anonymous_namespace{Ioss_Utils.C}::data
std::vector< char > data
Definition: Ioss_Utils.C:78
Ioss_EntityType.h
Ioss::SideBlock::consistentSideNumber
int consistentSideNumber
Definition: Ioss_SideBlock.h:123
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