IOSS 2.0
Loading...
Searching...
No Matches
Iogs_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 "iogs_export.h"
21
22namespace Iogs {
23 class GeneratedMesh;
24} // namespace Iogs
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 gen_struc database format.
52 */
53namespace Iogs {
54
55 class IOGS_EXPORT IOFactory : public Ioss::IOFactory
56 {
57 public:
58 static const IOFactory *factory();
59
60 private:
61 IOFactory();
62 IOSS_NODISCARD Ioss::DatabaseIO *make_IO(const std::string &filename,
63 Ioss::DatabaseUsage db_usage,
64 Ioss_MPI_Comm communicator,
65 const Ioss::PropertyManager &props) const override;
66 };
67
68 class IOGS_EXPORT DatabaseIO : public Ioss::DatabaseIO
69 {
70 public:
71 DatabaseIO(Ioss::Region *region, const std::string &filename, Ioss::DatabaseUsage db_usage,
72 Ioss_MPI_Comm communicator, const Ioss::PropertyManager &props);
73
74 ~DatabaseIO() override;
75
76 IOSS_NODISCARD std::string get_format() const override { return "Generated_Structured"; }
77
78 // Check capabilities of input/output database... Returns an
79 // unsigned int with the supported Ioss::EntityTypes or'ed
80 // together. If "return_value & Ioss::EntityType" is set, then the
81 // database supports that type (e.g. return_value & Ioss::FACESET)
82 IOSS_NODISCARD unsigned entity_field_support() const override;
83
84 IOSS_NODISCARD int int_byte_size_db() const override { return int_byte_size_api(); }
85
86 IOSS_NODISCARD const GeneratedMesh *get_gen_struc_mesh() const { return m_generatedMesh; }
87
88 void setGeneratedMesh(Iogs::GeneratedMesh *generatedMesh) { m_generatedMesh = generatedMesh; }
89
90 IOSS_NODISCARD const Ioss::NameList &get_sideset_names() const { return m_sideset_names; }
91
92 private:
93 void read_meta_data_nl() override;
94
95 bool begin_nl(Ioss::State state) override;
96 bool end_nl(Ioss::State state) override;
97
98 bool begin_state_nl(int state, double time) override;
99
100 void get_step_times_nl() override;
101 std::vector<double> get_db_step_times_nl() override;
102
103 void get_nodeblocks();
104 void get_structured_blocks();
106 void get_sidesets();
108
109 IOSS_NODISCARD const Ioss::Map &get_node_map() const;
110 IOSS_NODISCARD const Ioss::Map &get_element_map() const;
111
122
123 // Input only database -- these will never be called...
139
140 int64_t get_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data,
141 size_t data_size) const override;
142 int64_t get_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void *data,
143 size_t data_size) const override;
144 int64_t get_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field,
145 void *data, size_t data_size) const override;
146 int64_t get_field_internal(const Ioss::SideBlock *sb, const Ioss::Field &field, void *data,
147 size_t data_size) const override;
148 int64_t get_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
149 size_t data_size) const override;
150
151 void add_transient_fields(Ioss::GroupingEntity *entity);
152
153 GeneratedMesh *m_generatedMesh{nullptr};
154 Ioss::NameList m_sideset_names{};
155
156 double currentTime{0.0};
157 int spatialDimension{3};
158
159 int elementBlockCount{0};
160 int nodesetCount{0};
161 int sidesetCount{0};
162
163 bool m_useVariableDf{true};
164 };
165} // namespace Iogs
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
#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
Definition Iogs_DatabaseIO.h:69
void setGeneratedMesh(Iogs::GeneratedMesh *generatedMesh)
Definition Iogs_DatabaseIO.h:88
IOSS_NODISCARD const GeneratedMesh * get_gen_struc_mesh() const
Definition Iogs_DatabaseIO.h:86
IOSS_NODISCARD int int_byte_size_db() const override
Definition Iogs_DatabaseIO.h:84
IOSS_NODISCARD const Ioss::NameList & get_sideset_names() const
Definition Iogs_DatabaseIO.h:90
IOSS_NODISCARD std::string get_format() const override
Definition Iogs_DatabaseIO.h:76
Definition Iogs_GeneratedMesh.h:23
Definition Iogs_DatabaseIO.h:56
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
A namespace for the gen_struc database format.
Definition Iogs_DatabaseIO.C:87
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
State
Access states for a database.
Definition Ioss_State.h:15
Ioss::NameList NameList
Definition Ioss_ChangeSetFactory.h:25
DatabaseUsage
Specifies how an Ioss::DatabaseIO object will be used.
Definition Ioss_DBUsage.h:13