IOSS 2.0
Loading...
Searching...
No Matches
Iopg_DatabaseIO.h
Go to the documentation of this file.
1// Copyright(C) 1999-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 "iopg_export.h"
10
11#include "Ioss_CodeTypes.h"
12#include "Ioss_DBUsage.h" // for DatabaseUsage
13#include "Ioss_DatabaseIO.h" // for DatabaseIO
14#include "Ioss_IOFactory.h" // for IOFactory
15#include "Ioss_Map.h" // for Map
16#include "Ioss_State.h" // for State
17#include <stddef.h> // for size_t
18#include <stdint.h> // for int64_t
19#include <string> // for string
20#include <vector> // for vector
21
22namespace Ioss {
23 class Assembly;
24 class Blob;
25 class CommSet;
26 class EdgeBlock;
27 class EdgeSet;
28 class ElementBlock;
29 class ElementSet;
30 class EntityBlock;
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
44/** \brief A namespace for the pamgen database format.
45 */
46namespace Iopg {
47 class IOPG_EXPORT IOFactory : public Ioss::IOFactory
48 {
49 public:
50 static const IOFactory *factory();
51
52 private:
53 IOFactory();
54 IOSS_NODISCARD Ioss::DatabaseIO *make_IO(const std::string &filename,
55 Ioss::DatabaseUsage db_usage,
56 Ioss_MPI_Comm communicator,
57 const Ioss::PropertyManager &properties) const;
58 };
59
60 class IOPG_EXPORT DatabaseIO : public Ioss::DatabaseIO
61 {
62 public:
63 DatabaseIO(Ioss::Region *region, const std::string &filename, Ioss::DatabaseUsage db_usage,
64 Ioss_MPI_Comm communicator, const Ioss::PropertyManager &properties);
66
67 IOSS_NODISCARD std::string get_format() const override { return "PamGen"; }
68
69 // Check capabilities of input/output database... Returns an
70 // unsigned int with the supported Ioss::EntityTypes or'ed
71 // together. If "return_value & Ioss::EntityType" is set, then the
72 // database supports that type (e.g. return_value & Ioss::FACESET)
77
78 IOSS_NODISCARD int int_byte_size_db() const override { return 4; }
79
80 IOSS_NODISCARD std::string title() const { return databaseTitle; }
81 IOSS_NODISCARD int maximum_symbol_length() const override { return 32; }
82
83 void compute_block_membership_nl(Ioss::SideBlock *efblock,
84 Ioss::NameList &block_membership) const override;
85
86 private:
87 void read_meta_data_nl() override;
88
89 bool begin_nl(Ioss::State state) override;
90 bool end_nl(Ioss::State state) override;
91
92 void read_region();
93 void read_communication_metadata();
94
95 void get_nodeblocks();
96 void get_elemblocks();
97 void get_nodesets();
98 void get_sidesets();
99 void get_commsets();
100
101 int get_side_connectivity(const Ioss::SideBlock *fb, int id, int side_count, int *fconnect,
102 size_t data_size) const;
103 int get_side_distributions(const Ioss::SideBlock *fb, int id, int side_count, double *dist_fact,
104 size_t data_size) const;
105
106 const Ioss::Map &get_node_map() const;
107 const Ioss::Map &get_element_map() const;
108
109 int64_t get_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void *data,
110 size_t data_size) const override;
111 int64_t get_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data,
112 size_t data_size) const override;
113 int64_t get_field_internal(const Ioss::SideBlock *fb, const Ioss::Field &field, void *data,
114 size_t data_size) const override;
115 int64_t get_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void *data,
116 size_t data_size) const override;
117 int64_t get_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
118 size_t data_size) const override;
119
130
131 // Input only database -- these will never be called...
147
148 std::string databaseTitle;
149
150 int spatialDimension{3};
151
152 int nodeBlockCount{0};
153 int elementBlockCount{0};
154 int nodesetCount{0};
155 int sidesetCount{0};
156
157 // Communication Set Data
162 int commsetNodeCount{0};
163 int commsetElemCount{0};
164 };
165} // namespace Iopg
#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 Iopg_DatabaseIO.h:61
IOSS_NODISCARD std::string title() const
Definition Iopg_DatabaseIO.h:80
IOSS_NODISCARD int int_byte_size_db() const override
Definition Iopg_DatabaseIO.h:78
Ioss::IntVector nodeCmapNodeCnts
Definition Iopg_DatabaseIO.h:159
IOSS_NODISCARD unsigned entity_field_support() const override
Definition Iopg_DatabaseIO.h:73
Ioss::IntVector nodeCmapIds
Definition Iopg_DatabaseIO.h:158
IOSS_NODISCARD std::string get_format() const override
Definition Iopg_DatabaseIO.h:67
Ioss::IntVector elemCmapElemCnts
Definition Iopg_DatabaseIO.h:161
IOSS_NODISCARD int maximum_symbol_length() const override
Get the length of the longest name in the database file.
Definition Iopg_DatabaseIO.h:81
Ioss::IntVector elemCmapIds
Definition Iopg_DatabaseIO.h:160
Definition Iopg_DatabaseIO.h:48
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
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 pamgen database format.
Definition Iopg_DatabaseIO.C:32
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
std::vector< int > IntVector
Definition Ioss_CodeTypes.h:21
@ ELEMENTBLOCK
Definition Ioss_EntityType.h:16
@ REGION
Definition Ioss_EntityType.h:25
@ NODEBLOCK
Definition Ioss_EntityType.h:13
@ SIDESET
Definition Ioss_EntityType.h:21
@ NODESET
Definition Ioss_EntityType.h:17