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 textmesh 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
98 std::vector<double> get_db_step_times_nl() override;
99
100 void get_nodeblocks();
101 void get_elemblocks();
102 void get_nodesets();
103 void get_sidesets();
104 void get_commsets();
105 void get_assemblies();
106
107 void compute_block_membership_nl(Ioss::SideBlock *efblock,
108 std::vector<std::string> &block_membership) const override;
109
110 void update_block_omissions_from_assemblies();
111
112 const Ioss::Map &get_node_map() const;
113 const Ioss::Map &get_element_map() const;
114
115 int64_t get_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data,
116 size_t data_size) const override;
117 int64_t get_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void *data,
118 size_t data_size) const override;
119 int64_t get_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data,
120 size_t data_size) const override;
121 int64_t get_field_internal(const Ioss::SideBlock *ef_blk, const Ioss::Field &field, void *data,
122 size_t data_size) const override;
123 int64_t get_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void *data,
124 size_t data_size) const override;
125 int64_t get_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
126 size_t data_size) const override;
127 int64_t get_field_internal(const Ioss::Assembly *assem, const Ioss::Field &field, void *data,
128 size_t data_size) const override;
129
138
139 // Input only database -- these will never be called...
155
156 void add_transient_fields(Ioss::GroupingEntity *entity);
157
158 TextMesh *m_textMesh{nullptr};
159
160 double currentTime{0.0};
161 int spatialDimension{3};
162
163 int elementBlockCount{0};
164 int nodesetCount{0};
165 int sidesetCount{0};
166 int assemblyCount{0};
167
168 bool m_useVariableDf{true};
169 };
170} // namespace Iotm
#define IOSS_NOOP_PFI(type)
Definition Ioss_CodeTypes.h:119
int Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:64
#define IOSS_NOOP_GFI(type)
Definition Ioss_CodeTypes.h:114
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: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 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 textmesh database format.
Definition Iotm_DatabaseIO.C:95