24#include "ioss_export.h"
34 : m_bcName(std::move(name)), m_famName(std::move(fam_name)), m_rangeBeg(range_beg),
41 : m_bcName(name), m_famName(std::move(name)), m_rangeBeg(range_beg), m_rangeEnd(range_end)
66 std::string m_bcName{};
67 std::string m_famName{};
73 mutable int m_face{-1};
75 template <
class Archive>
void serialize(Archive &archive)
77 archive(m_bcName, m_famName, m_rangeBeg, m_rangeEnd, m_face);
84 IOSS_EXPORT std::ostream &
operator<<(std::ostream &os,
const BoundaryCondition &bc);
94 int nj,
int nk,
int off_i,
int off_j,
int off_k,
int glo_ni,
int glo_nj,
160 void set_ijk_offset(
int axis,
size_t offset);
161 void set_ijk_global(
int axis,
size_t global);
163 void set_ijk_offset(
const IJK_t &offset);
164 void set_ijk_global(
const IJK_t &global);
174 return m_cellGlobalOffset +
static_cast<size_t>(k - 1) * m_ijkGlobal[0] * m_ijkGlobal[1] +
175 static_cast<size_t>(j - 1) * m_ijkGlobal[0] + i;
180 return get_global_cell_id(index[0], index[1], index[2]);
188 return m_nodeGlobalOffset +
189 static_cast<size_t>(k - 1) * (m_ijkGlobal[0] + 1) * (m_ijkGlobal[1] + 1) +
190 static_cast<size_t>(j - 1) * (m_ijkGlobal[0] + 1) + i - 1;
195 return get_global_node_offset(index[0], index[1], index[2]);
202 auto i = ii - m_offset[0];
203 auto j = jj - m_offset[1];
204 auto k = kk - m_offset[2];
205 assert(i > 0 && i <= m_ijk[0] + 1 && j > 0 && j <= m_ijk[1] + 1 && k > 0 &&
207 return static_cast<size_t>(k - 1) * (m_ijk[0] + 1) * (m_ijk[1] + 1) +
208 static_cast<size_t>(j - 1) * (m_ijk[0] + 1) + i - 1;
213 return get_block_local_node_offset(index[0], index[1], index[2]);
220 return get_block_local_node_offset(i, j, k) + m_nodeOffset;
225 return get_local_node_offset(index[0], index[1], index[2]);
241 size_t offset = add_offset ? m_nodeGlobalOffset : 0;
243 if (m_ijk[2] == 0 && m_ijk[1] == 0 && m_ijk[0] == 0) {
247 for (
int kk = 0; kk < m_ijk[2] + 1; kk++) {
248 size_t k = m_offset[2] + kk;
249 for (
int jj = 0; jj < m_ijk[1] + 1; jj++) {
250 size_t j = m_offset[1] + jj;
251 for (
int ii = 0; ii < m_ijk[0] + 1; ii++) {
252 size_t i = m_offset[0] + ii;
255 k * (m_ijkGlobal[0] + 1) * (m_ijkGlobal[1] + 1) + j * (m_ijkGlobal[0] + 1) + i;
257 idata[index++] = ind + offset + 1;
262 for (
const auto &idx_id : m_globalIdMap) {
263 idata[idx_id.first] = idx_id.second;
269 template <
typename INT_t>
size_t get_cell_ids(INT_t *idata,
bool add_offset)
const
282 size_t offset = add_offset ? m_cellGlobalOffset : 0;
284 if (m_ijk[2] == 0 && m_ijk[1] == 0 && m_ijk[0] == 0) {
288 for (
int kk = 0; kk < m_ijk[2]; kk++) {
289 size_t k = m_offset[2] + kk;
290 for (
int jj = 0; jj < m_ijk[1]; jj++) {
291 size_t j = m_offset[1] + jj;
292 for (
int ii = 0; ii < m_ijk[0]; ii++) {
293 size_t i = m_offset[0] + ii;
295 size_t ind = k * m_ijkGlobal[0] * m_ijkGlobal[1] + j * m_ijkGlobal[0] + i;
297 idata[index++] = ind + offset + 1;
306 return (global_offset >= m_nodeOffset &&
307 global_offset < m_nodeOffset + get_property(
"node_count").get_int());
316 int64_t internal_get_field_data(
const Field &field,
void *data,
317 size_t data_size)
const override;
319 int64_t internal_put_field_data(
const Field &field,
void *data,
320 size_t data_size)
const override;
322 int64_t internal_get_zc_field_data(
const Field &field,
void **data,
323 size_t *data_size)
const override;
331 size_t m_nodeOffset{};
332 size_t m_cellOffset{};
334 size_t m_nodeGlobalOffset{};
335 size_t m_cellGlobalOffset{};
345 template <
class Archive>
void serialize(Archive &archive)
347 archive(m_zoneConnectivity, m_boundaryConditions, m_blockLocalNodeIndex, m_globalIdMap);
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
An input or output Database.
Definition Ioss_DatabaseIO.h:63
Base class for all 'block'-type grouping entities, which means all members of the block are similar o...
Definition Ioss_EntityBlock.h:38
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
A collection of all nodes in the region.
Definition Ioss_NodeBlock.h:33
A named value that has a known type.
Definition Ioss_Property.h:27
A structured zone – i,j,k.
Definition Ioss_StructuredBlock.h:91
IOSS_NODISCARD bool is_active() const
Does block contain any cells.
Definition Ioss_StructuredBlock.h:118
void serialize(Archive &archive)
Definition Ioss_StructuredBlock.h:345
IOSS_NODISCARD size_t get_cell_offset() const
Definition Ioss_StructuredBlock.h:156
void set_node_global_offset(size_t offset)
Definition Ioss_StructuredBlock.h:152
IOSS_NODISCARD std::string type_string() const override
Get the name of the particular type of entity.
Definition Ioss_StructuredBlock.h:108
std::vector< ZoneConnectivity > m_zoneConnectivity
Definition Ioss_StructuredBlock.h:340
std::vector< std::pair< size_t, size_t > > m_globalIdMap
Definition Ioss_StructuredBlock.h:343
IOSS_NODISCARD Ioss::NodeBlock & get_node_block()
Definition Ioss_StructuredBlock.h:114
IOSS_NODISCARD size_t get_global_node_offset(int i, int j, int k) const
Definition Ioss_StructuredBlock.h:186
IOSS_NODISCARD size_t get_block_local_node_offset(IJK_t index) const
Definition Ioss_StructuredBlock.h:211
IOSS_NODISCARD std::string short_type_string() const override
Get a short name of the particular type of entity.
Definition Ioss_StructuredBlock.h:109
IOSS_NODISCARD bool contains_node(size_t global_offset) const
Definition Ioss_StructuredBlock.h:304
IOSS_NODISCARD size_t get_node_offset() const
Definition Ioss_StructuredBlock.h:155
IOSS_NODISCARD std::string contains_string() const override
What does this entity contain.
Definition Ioss_StructuredBlock.h:110
void set_cell_offset(size_t offset)
Definition Ioss_StructuredBlock.h:151
IOSS_NODISCARD size_t get_global_cell_id(int i, int j, int k) const
Definition Ioss_StructuredBlock.h:172
IOSS_NODISCARD const Ioss::NodeBlock & get_node_block() const
Definition Ioss_StructuredBlock.h:113
size_t get_cell_node_ids(INT_t *idata, bool add_offset) const
Definition Ioss_StructuredBlock.h:228
std::vector< size_t > m_blockLocalNodeIndex
Definition Ioss_StructuredBlock.h:342
IOSS_NODISCARD size_t get_global_cell_id(IJK_t index) const
Definition Ioss_StructuredBlock.h:178
IOSS_NODISCARD EntityType type() const override
Get the EntityType, which indicates the particular type of GroupingEntity this is.
Definition Ioss_StructuredBlock.h:111
IOSS_NODISCARD size_t get_node_global_offset() const
Definition Ioss_StructuredBlock.h:157
IJK_t m_ijk
Definition Ioss_StructuredBlock.h:327
size_t get_cell_ids(INT_t *idata, bool add_offset) const
Definition Ioss_StructuredBlock.h:269
IOSS_NODISCARD IJK_t get_ijk_local() const
Definition Ioss_StructuredBlock.h:167
Ioss::NodeBlock m_nodeBlock
Definition Ioss_StructuredBlock.h:337
void set_cell_global_offset(size_t offset)
Definition Ioss_StructuredBlock.h:153
IOSS_NODISCARD IJK_t get_ijk_offset() const
Definition Ioss_StructuredBlock.h:166
IOSS_NODISCARD size_t get_block_local_node_offset(int ii, int jj, int kk) const
Definition Ioss_StructuredBlock.h:200
IJK_t m_offset
Definition Ioss_StructuredBlock.h:328
IOSS_NODISCARD size_t get_local_node_offset(int i, int j, int k) const
Definition Ioss_StructuredBlock.h:218
IOSS_NODISCARD size_t get_local_node_offset(IJK_t index) const
Definition Ioss_StructuredBlock.h:223
IOSS_NODISCARD IJK_t get_ijk_global() const
Definition Ioss_StructuredBlock.h:168
IOSS_NODISCARD size_t get_global_node_offset(IJK_t index) const
Definition Ioss_StructuredBlock.h:193
IJK_t m_ijkGlobal
Definition Ioss_StructuredBlock.h:329
void set_node_offset(size_t offset)
Set the 'offset' for the block.
Definition Ioss_StructuredBlock.h:150
std::vector< BoundaryCondition > m_boundaryConditions
Definition Ioss_StructuredBlock.h:341
IOSS_NODISCARD size_t get_cell_global_offset() const
Definition Ioss_StructuredBlock.h:158
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
std::ostream & operator<<(std::ostream &os, const Field &fld)
Definition Ioss_Field.C:41
std::array< int, 3 > IJK_t
Definition Ioss_CodeTypes.h:24
EntityType
The particular type of GroupingEntity.
Definition Ioss_EntityType.h:12
@ STRUCTUREDBLOCK
Definition Ioss_EntityType.h:27
Definition Ioss_BoundingBox.h:13
Definition Ioss_StructuredBlock.h:31
void serialize(Archive &archive)
Definition Ioss_StructuredBlock.h:75
BoundaryCondition(std::string name, Ioss::IJK_t range_beg, Ioss::IJK_t range_end)
Definition Ioss_StructuredBlock.h:40
BoundaryCondition(std::string name, std::string fam_name, Ioss::IJK_t range_beg, Ioss::IJK_t range_end)
Definition Ioss_StructuredBlock.h:32
BoundaryCondition & operator=(const BoundaryCondition ©_from)=default
BoundaryCondition(const BoundaryCondition ©_from)=default
BoundaryCondition()=default
IOSS_NODISCARD bool operator!=(const Ioss::BoundaryCondition &rhs) const