Debian Codegraph @

packages/seacas/libraries/ioss/src/Ioss_ElementBlock.C

raw
1 // Copyright(C) 1999-2021, 2023, 2024 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 // See packages/seacas/LICENSE for details
6
7 #include "Ioss_DatabaseIO.h" // for DatabaseIO
8 #include "Ioss_ElementBlock.h"
9 #include "Ioss_Field.h" // for Field, etc
10 #include "Ioss_Property.h" // for Property
11 #include <cstddef> // for size_t
12 #include <string> // for string
13 #include <vector> // for vector
14
15 #include "Ioss_BoundingBox.h" // for AxisAlignedBoundingBox
16 #include "Ioss_EntityBlock.h" // for EntityBlock
17 #include "Ioss_FieldManager.h" // for FieldManager
18
19 namespace Ioss {
20
21 /** \brief Create an element block.
22 *
23 * \param[in] io_database The database associated with the region containing the element block.
24 * \param[in] my_name The element block's name.
25 * \param[in] element_type The name of the element topology type for the element block.
26 * \param[in] number_elements The number of elements in the element block.
27 */
28 ElementBlock::ElementBlock(DatabaseIO *io_database, const std::string &my_name,
29 const std::string &element_type, int64_t number_elements)
30 : EntityBlock(io_database, my_name, element_type, number_elements)
31 {
32 // The 1..global_element_count id. In a parallel-decomposed run,
33 // if maps the element back to its implicit position in the serial
34 // undecomposed mesh file. This is ONLY provided for backward-
35 // compatibility and should not be used unless absolutely required.
36 fields.add(Ioss::Field("implicit_ids", field_int_type(), "scalar", Ioss::Field::MESH,
37 number_elements));
38 }
39
40 Property ElementBlock::get_implicit_property(const std::string &my_name) const
41 {
42 return EntityBlock::get_implicit_property(my_name);
43 }
44
45 int64_t ElementBlock::internal_get_field_data(const Field &field, void *data,
46 size_t data_size) const
47 {
48 return get_database()->get_field(this, field, data, data_size);
49 }
50
51 int64_t ElementBlock::internal_put_field_data(const Field &field, void *data,
52 size_t data_size) const
53 {
54 return get_database()->put_field(this, field, data, data_size);
55 }
56
57 int64_t ElementBlock::internal_get_zc_field_data(const Field &field, void **data,
58 size_t *data_size) const
59 {
60 return get_database()->get_zc_field(this, field, data, data_size);
61 }
62
63 void ElementBlock::get_block_adjacencies(Ioss::NameList &block_adjacency) const
64 {
65 get_database()->get_block_adjacencies(this, block_adjacency);
66 }
67
68 Ioss::NameList ElementBlock::get_block_adjacencies() const
69 {
70 Ioss::NameList block_adjacency;
71 get_database()->get_block_adjacencies(this, block_adjacency);
72 return block_adjacency;
73 }
74
75 AxisAlignedBoundingBox ElementBlock::get_bounding_box() const
76 {
77 return get_database()->get_bounding_box(this);
78 }
79
80 bool ElementBlock::operator==(const ElementBlock &rhs) const
81 {
82 return EntityBlock::operator==(rhs);
83 }
84
85 bool Ioss::ElementBlock::operator!=(const ElementBlock &rhs) const { return !(*this == rhs); }
86
87 bool ElementBlock::equal(const ElementBlock &rhs) const { return EntityBlock::equal(rhs); }
88 } // namespace Ioss