IOSS 2.0
Loading...
Searching...
No Matches
Iovs_exodus_DatabaseIO.h
Go to the documentation of this file.
1// Copyright(C) 1999-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// -*- Mode: c++ -*-
8#ifndef IOSS_Iovs_exodus_DatabaseIO_h
9#define IOSS_Iovs_exodus_DatabaseIO_h
10
11#include "iovs_export.h"
12
13#include "Ioss_CodeTypes.h"
14#include "Ioss_DBUsage.h"
15#include "Ioss_DatabaseIO.h"
16#include "Ioss_EntityType.h"
17#include "Ioss_Field.h"
18#include "Ioss_Map.h"
19#include "Ioss_Utils.h"
20
21#include <algorithm>
22#include <ctime>
23#include <map>
24#include <set>
25#include <sstream>
26#include <string>
27#include <vector>
28
29/** \brief A namespace for the visualization database format.
30 */
31namespace Iovs_exodus {
32 class CatalystExodusMeshBase;
33
34 typedef std::set<std::pair<int64_t, int64_t>> EntityIdSet;
35
36 class IOVS_EXPORT DatabaseIO : public Ioss::DatabaseIO
37 {
38 public:
39 DatabaseIO(Ioss::Region *region, const std::string &filename, Ioss::DatabaseUsage db_usage,
40 Ioss_MPI_Comm communicator, const Ioss::PropertyManager &props);
41
42 ~DatabaseIO() override;
43
44 std::string get_format() const override { return "Embedded Visualization"; }
45
46 // Check capabilities of input/output database... Returns an
47 // unsigned int with the supported Ioss::EntityTypes or'ed
48 // together. If "return_value & Ioss::EntityType" is set, then the
49 // database supports that type (e.g. return_value & Ioss::FACESET)
50 unsigned entity_field_support() const override { return Ioss::NODEBLOCK | Ioss::ELEMENTBLOCK; }
51
52 // static int parseCatalystFile(const std::string &filepath, std::string &json_result);
53
54 int int_byte_size_db() const override { return int_byte_size_api(); }
55
56 private:
57 bool begin_nl(Ioss::State state) override;
58 bool end_nl(Ioss::State state) override;
59
60 bool begin_state_nl(int state, double time) override;
61 bool end_state_nl(int state, double time) override;
62
63 void read_meta_data_nl() override;
64
65 // For the time being, treat vis as write only. Consider glue pipelines.
66 int64_t get_field_internal(const Ioss::Region * /*reg*/, const Ioss::Field & /*field*/,
67 void * /*data*/, size_t /* data_size */) const override
68 {
69 return 0;
70 }
71 int64_t get_field_internal(const Ioss::NodeBlock * /*nb*/, const Ioss::Field & /*field*/,
72 void * /*data*/, size_t /* data_size */) const override
73 {
74 return 0;
75 }
76 int64_t get_field_internal(const Ioss::EdgeBlock * /*eb*/, const Ioss::Field & /*field*/,
77 void * /*data*/, size_t /* data_size */) const override
78 {
79 return 0;
80 }
81 int64_t get_field_internal(const Ioss::FaceBlock * /*fb*/, const Ioss::Field & /*field*/,
82 void * /*data*/, size_t /* data_size */) const override
83 {
84 return 0;
85 }
86 int64_t get_field_internal(const Ioss::ElementBlock * /*eb*/, const Ioss::Field & /*field*/,
87 void * /*data*/, size_t /* data_size */) const override
88 {
89 return 0;
90 }
91 int64_t get_field_internal(const Ioss::SideBlock * /*sb*/, const Ioss::Field & /*field*/,
92 void * /*data*/, size_t /* data_size */) const override
93 {
94 return 0;
95 }
96 int64_t get_field_internal(const Ioss::NodeSet * /*ns*/, const Ioss::Field & /*field*/,
97 void * /*data*/, size_t /* data_size */) const override
98 {
99 return 0;
100 }
101 int64_t get_field_internal(const Ioss::EdgeSet * /*es*/, const Ioss::Field & /*field*/,
102 void * /*data*/, size_t /* data_size */) const override
103 {
104 return 0;
105 }
106 int64_t get_field_internal(const Ioss::FaceSet * /*fs*/, const Ioss::Field & /*field*/,
107 void * /*data*/, size_t /* data_size */) const override
108 {
109 return 0;
110 }
111 int64_t get_field_internal(const Ioss::ElementSet * /*es*/, const Ioss::Field & /*field*/,
112 void * /*data*/, size_t /* data_size */) const override
113 {
114 return 0;
115 }
116 int64_t get_field_internal(const Ioss::SideSet * /*ss*/, const Ioss::Field & /*field*/,
117 void * /*data*/, size_t /* data_size */) const override
118 {
119 return 0;
120 }
121 int64_t get_field_internal(const Ioss::CommSet * /*cs*/, const Ioss::Field & /*field*/,
122 void * /*data*/, size_t /* data_size */) const override
123 {
124 return 0;
125 }
126
127 int64_t get_field_internal(const Ioss::StructuredBlock * /*sb*/, const Ioss::Field & /*field*/,
128 void * /*data*/, size_t /*data_size*/) const override
129 {
130 return 0;
131 }
132
133 int64_t get_field_internal(const Ioss::Assembly * /*as*/, const Ioss::Field & /*field*/,
134 void * /*data*/, size_t /*data_size*/) const override
135 {
136 return 0;
137 }
138
139 int64_t get_field_internal(const Ioss::Blob * /*bl*/, const Ioss::Field & /*field*/,
140 void * /*data*/, size_t /*data_size*/) const override
141 {
142 return 0;
143 }
144
145 int64_t put_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data,
146 size_t data_size) const override;
147 int64_t put_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void *data,
148 size_t data_size) const override;
149 int64_t put_field_internal(const Ioss::EdgeBlock *eb, const Ioss::Field &field, void *data,
150 size_t data_size) const override;
151 int64_t put_field_internal(const Ioss::FaceBlock *fb, const Ioss::Field &field, void *data,
152 size_t data_size) const override;
153 int64_t put_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data,
154 size_t data_size) const override;
155 int64_t put_field_internal(const Ioss::SideBlock *sb, const Ioss::Field &field, void *data,
156 size_t data_size) const override;
157 int64_t put_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void *data,
158 size_t data_size) const override;
159 int64_t put_field_internal(const Ioss::EdgeSet *es, const Ioss::Field &field, void *data,
160 size_t data_size) const override;
161 int64_t put_field_internal(const Ioss::FaceSet *fs, const Ioss::Field &field, void *data,
162 size_t data_size) const override;
163 int64_t put_field_internal(const Ioss::ElementSet *es, const Ioss::Field &field, void *data,
164 size_t data_size) const override;
165 int64_t put_field_internal(const Ioss::SideSet *ss, const Ioss::Field &field, void *data,
166 size_t data_size) const override;
167 int64_t put_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
168 size_t data_size) const override;
169 int64_t put_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field,
170 void *data, size_t data_size) const override;
171 int64_t put_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, void *data,
172 size_t data_size) const override;
173 int64_t put_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, void *data,
174 size_t data_size) const override;
175
176 void write_meta_data();
177
178 int64_t handle_node_ids(void *ids, int64_t num_to_get);
179 int64_t handle_element_ids(const Ioss::ElementBlock *eb, void *ids, size_t num_to_get);
180
181 const Ioss::Map &get_node_map() const;
182 const Ioss::Map &get_element_map() const;
183
184 DatabaseIO(); // Do not implement
185 DatabaseIO(const DatabaseIO &); // Do not implement
186 DatabaseIO &operator=(const DatabaseIO &); // Do not implement
187
189 bool singleProcOnly; // True if history or heartbeat which is only written from proc 0...
190 bool doLogging; // True if logging field input/output
193
194 std::unique_ptr<CatalystExodusMeshBase> catExoMesh;
195
197 void create_global_node_and_element_ids() const;
198 mutable EntityIdSet ids_{};
199 };
200} // namespace Iovs_exodus
201
202#endif
int Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:64
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
Definition Ioss_Map.h:46
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
Definition Iovs_exodus_DatabaseIO.h:37
unsigned entity_field_support() const override
Definition Iovs_exodus_DatabaseIO.h:50
int64_t get_field_internal(const Ioss::SideSet *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:116
int64_t get_field_internal(const Ioss::FaceSet *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:106
int64_t get_field_internal(const Ioss::NodeBlock *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:71
bool globalNodeAndElementIDsCreated
Definition Iovs_exodus_DatabaseIO.h:196
bool doLogging
Definition Iovs_exodus_DatabaseIO.h:190
int64_t get_field_internal(const Ioss::StructuredBlock *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:127
int64_t get_field_internal(const Ioss::CommSet *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:121
int64_t get_field_internal(const Ioss::EdgeSet *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:101
DatabaseIO & operator=(const DatabaseIO &)
int64_t get_field_internal(const Ioss::ElementBlock *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:86
int64_t get_field_internal(const Ioss::SideBlock *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:91
int64_t get_field_internal(const Ioss::Assembly *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:133
bool isInput
Definition Iovs_exodus_DatabaseIO.h:188
int64_t get_field_internal(const Ioss::EdgeBlock *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:76
int nodeBlockCount
Definition Iovs_exodus_DatabaseIO.h:191
DatabaseIO(const DatabaseIO &)
int int_byte_size_db() const override
Definition Iovs_exodus_DatabaseIO.h:54
int64_t get_field_internal(const Ioss::NodeSet *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:96
bool singleProcOnly
Definition Iovs_exodus_DatabaseIO.h:189
int64_t get_field_internal(const Ioss::Blob *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:139
int elementBlockCount
Definition Iovs_exodus_DatabaseIO.h:192
int64_t get_field_internal(const Ioss::FaceBlock *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:81
int64_t get_field_internal(const Ioss::Region *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:66
int64_t get_field_internal(const Ioss::ElementSet *, const Ioss::Field &, void *, size_t) const override
Definition Iovs_exodus_DatabaseIO.h:111
std::string get_format() const override
Definition Iovs_exodus_DatabaseIO.h:44
std::unique_ptr< CatalystExodusMeshBase > catExoMesh
Definition Iovs_exodus_DatabaseIO.h:194
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
@ ELEMENTBLOCK
Definition Ioss_EntityType.h:16
@ NODEBLOCK
Definition Ioss_EntityType.h:13
A namespace for the visualization database format.
Definition CatalystExodusMesh.h:21
std::set< std::pair< int64_t, int64_t > > EntityIdSet
Definition Iovs_exodus_DatabaseIO.h:34