IOSS 2.0
Loading...
Searching...
No Matches
Iotm_DatabaseIO.h
Go to the documentation of this file.
1// Copyright(C) 1999-2020, 2022, 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#pragma once
8
9#include "Ioss_CodeTypes.h"
10#include "Ioss_DBUsage.h" // for DatabaseUsage
11#include "Ioss_DatabaseIO.h" // for DatabaseIO
12#include "Ioss_IOFactory.h" // for IOFactory
13#include "Ioss_Map.h" // for Map
14#include <cstddef> // for size_t
15#include <cstdint> // for int64_t
16#include <string> // for string
17#include <vector> // for vector
18
19#include "Ioss_State.h" // for State
20#include "iotm_export.h"
21
22namespace Iotm {
23 class TextMesh;
24} // namespace Iotm
25namespace Ioss {
26 class CommSet;
27 class EdgeBlock;
28 class EdgeSet;
29 class ElementBlock;
30 class ElementSet;
31 class FaceBlock;
32 class FaceSet;
33 class Field;
34 class GroupingEntity;
35 class NodeBlock;
36 class NodeSet;
37 class PropertyManager;
38 class Region;
39 class SideBlock;
40 class SideSet;
41 class StructuredBlock;
42} // namespace Ioss
43
44namespace Ioss {
45 class EntityBlock;
46 class Assembly;
47 class Blob;
48 class Map;
49} // namespace Ioss
50
51/** \brief A namespace for the generated database format.
52 */
53namespace Iotm {
54 class IOTM_EXPORT IOFactory : public Ioss::IOFactory
55 {
56 public:
57 static const IOFactory *factory();
58
59 private:
60 IOFactory();
61 Ioss::DatabaseIO *make_IO(const std::string &filename, Ioss::DatabaseUsage db_usage,
62 Ioss_MPI_Comm communicator,
63 const Ioss::PropertyManager &props) const override;
64 };
65
66 class IOTM_EXPORT DatabaseIO : public Ioss::DatabaseIO
67 {
68 public:
69 DatabaseIO(Ioss::Region *region, const std::string &filename, Ioss::DatabaseUsage db_usage,
70 Ioss_MPI_Comm communicator, const Ioss::PropertyManager &props);
71
72 ~DatabaseIO() override;
73
74 std::string get_format() const override { return "TextMesh"; }
75
76 // Check capabilities of input/output database... Returns an
77 // unsigned int with the supported Ioss::EntityTypes or'ed
78 // together. If "return_value & Ioss::EntityType" is set, then the
79 // database supports that type (e.g. return_value & Ioss::FACESET)
80 unsigned entity_field_support() const override;
81
82 int int_byte_size_db() const override { return int_byte_size_api(); }
83
84 const TextMesh *get_text_mesh() const { return m_textMesh; }
85
86 void set_text_mesh(Iotm::TextMesh *textMesh) { m_textMesh = textMesh; }
87
88 private:
89 void read_meta_data_nl() override;
90
91 bool begin_nl(Ioss::State state) override;
92 bool end_nl(Ioss::State state) override;
93
94 bool begin_state_nl(int state, double time) override;
95
96 void get_step_times_nl() override;
97 void get_nodeblocks();
98 void get_elemblocks();
99 void get_nodesets();
100 void get_sidesets();
101 void get_commsets();
102 void get_assemblies();
103
104 void compute_block_membership_nl(Ioss::SideBlock *efblock,
105 std::vector<std::string> &block_membership) const override;
106
107 void update_block_omissions_from_assemblies();
108
109 const Ioss::Map &get_node_map() const;
110 const Ioss::Map &get_element_map() const;
111
112 int64_t get_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data,
113 size_t data_size) const override;
114 int64_t get_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void *data,
115 size_t data_size) const override;
116 int64_t get_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data,
117 size_t data_size) const override;
118 int64_t get_field_internal(const Ioss::SideBlock *ef_blk, const Ioss::Field &field, void *data,
119 size_t data_size) const override;
120 int64_t get_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void *data,
121 size_t data_size) const override;
122 int64_t get_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
123 size_t data_size) const override;
124 int64_t get_field_internal(const Ioss::Assembly *assem, const Ioss::Field &field, void *data,
125 size_t data_size) const override;
126
135
136 // Input only database -- these will never be called...
152
153 void add_transient_fields(Ioss::GroupingEntity *entity);
154
155 TextMesh *m_textMesh{nullptr};
156
157 double currentTime{0.0};
158 int spatialDimension{3};
159
160 int elementBlockCount{0};
161 int nodesetCount{0};
162 int sidesetCount{0};
163 int assemblyCount{0};
164
165 bool m_useVariableDf{true};
166 };
167} // namespace Iotm
#define IOSS_NOOP_PFI(type)
Definition Ioss_CodeTypes.h:118
int Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:63
#define IOSS_NOOP_GFI(type)
Definition Ioss_CodeTypes.h:113
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
Base class for all 'grouping' entities. The following derived classes are typical:
Definition Ioss_GroupingEntity.h:67
The main public user interface for creating Ioss::DatabaseIO objects.
Definition Ioss_IOFactory.h:35
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:90
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:104
Definition Iotm_DatabaseIO.h:67
int int_byte_size_db() const override
Definition Iotm_DatabaseIO.h:82
const TextMesh * get_text_mesh() const
Definition Iotm_DatabaseIO.h:84
void set_text_mesh(Iotm::TextMesh *textMesh)
Definition Iotm_DatabaseIO.h:86
std::string get_format() const override
Definition Iotm_DatabaseIO.h:74
Definition Iotm_DatabaseIO.h:55
Definition Iotm_TextMesh.h:64
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
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
A namespace for the generated database format.
Definition Iotm_DatabaseIO.C:95