IOSS 2.0
Loading...
Searching...
No Matches
Iocatalyst_DatabaseIO.h
Go to the documentation of this file.
1// Copyright(C) 1999-2020, 2022, 2023 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#pragma once
8
9#include "iocatalyst_export.h"
10
11#include "Ioss_DBUsage.h"
12#include "Ioss_DatabaseIO.h"
13#include "Ioss_EntitySet.h"
14#include "Ioss_Region.h" // for Region, SideSetContainer, etc
15#include "Ioss_SideSet.h" // for SideBlockContainer, SideSet
16
18#include "Ioss_Field.h" // for Field, etc
19
20#include <memory> // for std::unique_ptr
21
22/** \brief A namespace for the Catalyst 2.0 database format.
23 */
24namespace Iocatalyst {
25 class IOCATALYST_EXPORT DatabaseIO : public Ioss::DatabaseIO
26 {
28
29 public:
30 DatabaseIO(Ioss::Region *region, const std::string &filename, Ioss::DatabaseUsage db_usage,
31 Ioss_MPI_Comm communicator, const Ioss::PropertyManager &props);
32 ~DatabaseIO() override;
33
34 using RegionContainer = std::vector<Ioss::Region *>;
35
36 // Check capabilities of input/output database... Returns an
37 // unsigned int with the supported Ioss::EntityTypes or'ed
38 // together. If "return_value & Ioss::EntityType" is set, then the
39 // database supports that type (e.g. return_value & Ioss::FACESET)
40 unsigned entity_field_support() const override;
41
42 /** If there is a single block of nodes in the model, then it is
43 * considered a node_major() database. If instead the nodes are
44 * local to each element block or structured block, then it is
45 * not a node_major database. Exodus is node major, CGNS is not.
46 */
47 bool node_major() const override { return true; }
48
49 // Do anything that might be needed to the database prior to it
50 // being closed and destructed.
51 void finalize_database() const override {}
52
53 /** Return a string specifying underlying format of database (exodus, cgns, ...) */
54 std::string get_format() const override { return "CATALYST2"; }
55
56 /** \brief Determine whether the database needs information about process ownership of nodes.
57 *
58 * \returns True if database needs information about process ownership of nodes.
59 */
60 bool needs_shared_node_information() const override { return false; }
61
62 bool internal_edges_available() const override { return false; }
63 bool internal_faces_available() const override { return false; }
64
65 /** \brief Get the length of the longest name in the database file.
66 *
67 * \returns The length, or 0 for unlimited.
68 */
69 int maximum_symbol_length() const override { return 0; } // Default is unlimited...
70 void set_maximum_symbol_length(int /* requested_symbol_size */) override {
71 } // Default does nothing...
72
73 int int_byte_size_db() const override { return 8; } //! Returns 4 or 8
74
75 /**
76 * \returns True is fields must be deep-copied. Set 'SHALLOW_COPY_FIELDS' on
77 * database properties to avoid deep-copying of fields. Default is to
78 * shallow copy.
79 */
80 bool deep_copy() const { return this->useDeepCopy; }
81
82 void *get_catalyst_conduit_node();
83
84 void print_catalyst_conduit_node();
85
86 std::string get_catalyst_dump_dir() const;
87
88 void set_split_type_changed(bool split_type_changed) { split_type_c = split_type_changed; }
89 IOSS_NODISCARD bool split_type_changed() const { return split_type_c; }
90
91 private:
92 bool begin_nl(Ioss::State state) override;
93 bool end_nl(Ioss::State state) override;
94
95 void read_meta_data_nl() override;
96 void get_step_times_nl() override;
97 std::vector<double> get_db_step_times_nl() override;
98
99 bool begin_state_nl(int state, double time) override;
100 bool end_state_nl(int state, double time) override;
101
103
104 void
106 std::vector<std::string> & /* block_membership */) const override
107 {
108 }
109
110 int64_t get_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data,
111 size_t data_size) const override;
112 int64_t get_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void *data,
113 size_t data_size) const override;
114 int64_t get_field_internal(const Ioss::EdgeBlock *eb, const Ioss::Field &field, void *data,
115 size_t data_size) const override;
116 int64_t get_field_internal(const Ioss::FaceBlock *fb, const Ioss::Field &field, void *data,
117 size_t data_size) const override;
118 int64_t get_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data,
119 size_t data_size) const override;
120 int64_t get_field_internal(const Ioss::SideBlock *sb, const Ioss::Field &field, void *data,
121 size_t data_size) const override;
122 int64_t get_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void *data,
123 size_t data_size) const override;
124 int64_t get_field_internal(const Ioss::EdgeSet *es, const Ioss::Field &field, void *data,
125 size_t data_size) const override;
126 int64_t get_field_internal(const Ioss::FaceSet *fs, const Ioss::Field &field, void *data,
127 size_t data_size) const override;
128 int64_t get_field_internal(const Ioss::ElementSet *es, const Ioss::Field &field, void *data,
129 size_t data_size) const override;
130 int64_t get_field_internal(const Ioss::SideSet *ss, const Ioss::Field &field, void *data,
131 size_t data_size) const override;
132 int64_t get_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
133 size_t data_size) const override;
134 int64_t get_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, void *data,
135 size_t data_size) const override;
136 int64_t get_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, void *data,
137 size_t data_size) const override;
138 int64_t get_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field,
139 void *data, size_t data_size) const override;
140
141 int64_t get_zc_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void **data,
142 size_t *data_size) const override;
143 int64_t get_zc_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void **data,
144 size_t *data_size) const override;
145 int64_t get_zc_field_internal(const Ioss::EdgeBlock *eb, const Ioss::Field &field, void **data,
146 size_t *data_size) const override;
147 int64_t get_zc_field_internal(const Ioss::FaceBlock *fb, const Ioss::Field &field, void **data,
148 size_t *data_size) const override;
149 int64_t get_zc_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field,
150 void **data, size_t *data_size) const override;
151 int64_t get_zc_field_internal(const Ioss::SideBlock *sb, const Ioss::Field &field, void **data,
152 size_t *data_size) const override;
153 int64_t get_zc_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void **data,
154 size_t *data_size) const override;
155 int64_t get_zc_field_internal(const Ioss::EdgeSet *es, const Ioss::Field &field, void **data,
156 size_t *data_size) const override;
157 int64_t get_zc_field_internal(const Ioss::FaceSet *fs, const Ioss::Field &field, void **data,
158 size_t *data_size) const override;
159 int64_t get_zc_field_internal(const Ioss::ElementSet *es, const Ioss::Field &field, void **data,
160 size_t *data_size) const override;
161 int64_t get_zc_field_internal(const Ioss::SideSet *ss, const Ioss::Field &field, void **data,
162 size_t *data_size) const override;
163 int64_t get_zc_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void **data,
164 size_t *data_size) const override;
165 int64_t get_zc_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, void **data,
166 size_t *data_size) const override;
167 int64_t get_zc_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, void **data,
168 size_t *data_size) const override;
169 int64_t get_zc_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field,
170 void **data, size_t *data_size) const override;
171
172 int64_t put_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data,
173 size_t data_size) const override;
174 int64_t put_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void *data,
175 size_t data_size) const override;
176 int64_t put_field_internal(const Ioss::EdgeBlock *eb, const Ioss::Field &field, void *data,
177 size_t data_size) const override;
178 int64_t put_field_internal(const Ioss::FaceBlock *fb, const Ioss::Field &field, void *data,
179 size_t data_size) const override;
180 int64_t put_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data,
181 size_t data_size) const override;
182 int64_t put_field_internal(const Ioss::SideBlock *sb, const Ioss::Field &field, void *data,
183 size_t data_size) const override;
184 int64_t put_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void *data,
185 size_t data_size) const override;
186 int64_t put_field_internal(const Ioss::EdgeSet *es, const Ioss::Field &field, void *data,
187 size_t data_size) const override;
188 int64_t put_field_internal(const Ioss::FaceSet *fs, const Ioss::Field &field, void *data,
189 size_t data_size) const override;
190 int64_t put_field_internal(const Ioss::ElementSet *es, const Ioss::Field &field, void *data,
191 size_t data_size) const override;
192 int64_t put_field_internal(const Ioss::SideSet *ss, const Ioss::Field &field, void *data,
193 size_t data_size) const override;
194 int64_t put_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
195 size_t data_size) const override;
196 int64_t put_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, void *data,
197 size_t data_size) const override;
198 int64_t put_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, void *data,
199 size_t data_size) const override;
200 int64_t put_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field,
201 void *data, size_t data_size) const override;
202
203 class ImplementationT;
204 std::unique_ptr<ImplementationT> Impl;
206 bool split_type_c{false};
207 };
208} // namespace Iocatalyst
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
int Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:64
unsigned int CatalystPipelineID
Definition Iocatalyst_CatalystManager.h:19
Definition Iocatalyst_DatabaseIO.h:26
IOSS_NODISCARD bool split_type_changed() const
Definition Iocatalyst_DatabaseIO.h:89
int maximum_symbol_length() const override
Get the length of the longest name in the database file.
Definition Iocatalyst_DatabaseIO.h:69
bool node_major() const override
Definition Iocatalyst_DatabaseIO.h:47
CatalystManager::CatalystPipelineID catPipeID
Definition Iocatalyst_DatabaseIO.h:102
std::unique_ptr< ImplementationT > Impl
Definition Iocatalyst_DatabaseIO.h:204
bool internal_faces_available() const override
Definition Iocatalyst_DatabaseIO.h:63
void compute_block_membership_nl(Ioss::SideBlock *, std::vector< std::string > &) const override
Definition Iocatalyst_DatabaseIO.h:105
bool useDeepCopy
Definition Iocatalyst_DatabaseIO.h:205
bool internal_edges_available() const override
Definition Iocatalyst_DatabaseIO.h:62
void finalize_database() const override
Definition Iocatalyst_DatabaseIO.h:51
void set_split_type_changed(bool split_type_changed)
Definition Iocatalyst_DatabaseIO.h:88
bool deep_copy() const
Returns 4 or 8.
Definition Iocatalyst_DatabaseIO.h:80
std::vector< Ioss::Region * > RegionContainer
Definition Iocatalyst_DatabaseIO.h:34
bool needs_shared_node_information() const override
Determine whether the database needs information about process ownership of nodes.
Definition Iocatalyst_DatabaseIO.h:60
int int_byte_size_db() const override
Definition Iocatalyst_DatabaseIO.h:73
void set_maximum_symbol_length(int) override
Definition Iocatalyst_DatabaseIO.h:70
std::string get_format() const override
Definition Iocatalyst_DatabaseIO.h:54
A homogeneous collection of other GroupingEntities.
Definition Ioss_Assembly.h:31
A homogeneous collection of other GroupingEntities.
Definition Ioss_Blob.h:31
Definition Ioss_CommSet.h:27
An input or output Database.
Definition Ioss_DatabaseIO.h:63
A collection of element edges with the same topology.
Definition Ioss_EdgeBlock.h:29
A collection of element edges.
Definition Ioss_EdgeSet.h:30
A collection of elements having the same topology.
Definition Ioss_ElementBlock.h:29
A collection of elements.
Definition Ioss_ElementSet.h:30
A collection of element faces with the same topology.
Definition Ioss_FaceBlock.h:29
A collection of element faces.
Definition Ioss_FaceSet.h:30
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 collection of nodes.
Definition Ioss_NodeSet.h:29
A collection of Ioss::Property objects.
Definition Ioss_PropertyManager.h:36
A grouping entity that contains other grouping entities.
Definition Ioss_Region.h:93
A collection of element sides having the same topology.
Definition Ioss_SideBlock.h:37
A collection of element sides.
Definition Ioss_SideSet.h:29
A structured zone – i,j,k.
Definition Ioss_StructuredBlock.h:91
A namespace for the Catalyst 2.0 database format.
Definition Iocatalyst_CatalystLogging.C:13
State
Access states for a database.
Definition Ioss_State.h:15
DatabaseUsage
Specifies how an Ioss::DatabaseIO object will be used.
Definition Ioss_DBUsage.h:13