Debian Codegraph @

packages/seacas/applications/epu/EP_Internals.h

raw
1 /*
2 * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8 #pragma once
9
10 #include <string> // for string
11 #include <vector> // for vector
12 namespace Excn {
13 class Block;
14 class CommunicationMetaData;
15 class Mesh;
16 template <typename INT> class NodeSet;
17 template <typename INT> class SideSet;
18 template <typename INT> class EdgeBlock;
19 template <typename INT> class FaceBlock;
20 } // namespace Excn
21
22 /*!
23 * This set of classes provides a thin wrapper around the exodusII
24 * internals. It supplants several of the exodusII API calls in
25 * order to avoid ncredef calls which totally rewrite the existing
26 * database and can be very expensive. These routines provide all
27 * required variable, dimension, and attribute definitions to the
28 * underlying netcdf file with only a single ncredef call.
29 *
30 * To use the application must create an Excn::Internals instance
31 * and call the Excn::Internals::write_meta_data() function. This
32 * function requires several classes as arguments including:
33 * <ul>
34 * <li> Mesh -- defines mesh global metadata
35 * <li> Block -- defines metadata for each block
36 * <li> NodeSet -- defines metadata for each nodeset
37 * <li> SideSet -- defines metadata for each sideset
38 * <li> CommunicationMetaData -- global metadata relating to
39 * parallel info.
40 * </ul>
41 *
42 * Calling Excn::Internals::write_meta_data(), replaces the
43 * following exodusII and nemesis API calls:
44 * <ul>
45 * <li> ex_put_init(),
46 * <li> ex_put_elem_block(),
47 * <li> ex_put_node_set_param(),
48 * <li> ex_put_side_set_param(),
49 * <li> ne_put_init_info(),
50 * <li> ne_put_loadbal_param(),
51 * <li> ne_put_cmap_params(),
52 * </ul>
53 */
54
55 namespace Excn {
56
57 class Redefine
58 {
59 public:
60 explicit Redefine(int exoid);
61 ~Redefine();
62
63 private:
64 int exodusFilePtr;
65 };
66
67 bool is_path_absolute(const std::string &path);
68
69 template <typename INT> class Internals
70 {
71 public:
72 Internals(int exoid, int maximum_name_length, int change_set_number)
73 : exodusFilePtr(exoid), maximumNameLength(maximum_name_length),
74 changeSetNumber(change_set_number)
75 {
76 }
77
78 int write_meta_data(const Mesh &mesh, const std::vector<Block> &blocks,
79 const std::vector<NodeSet<INT>> &nodesets,
80 const std::vector<SideSet<INT>> &sidesets,
81 const std::vector<EdgeBlock<INT>> &edgeblocks,
82 const std::vector<FaceBlock<INT>> &faceblocks,
83 const CommunicationMetaData &comm);
84
85 bool check_meta_data(const Mesh &mesh, const std::vector<Block> &blocks,
86 const std::vector<NodeSet<INT>> &nodesets,
87 const std::vector<SideSet<INT>> &sidesets,
88 const std::vector<EdgeBlock<INT>> &edgeblocks,
89 const std::vector<FaceBlock<INT>> &faceblocks,
90 const CommunicationMetaData &comm);
91
92 private:
93 int put_metadata(const Mesh &mesh, const CommunicationMetaData &comm);
94 int put_metadata(const std::vector<Block> &blocks);
95 int put_metadata(const std::vector<NodeSet<INT>> &nodesets);
96 int put_metadata(const std::vector<SideSet<INT>> &sidesets);
97 int put_metadata(const std::vector<EdgeBlock<INT>> &edgeblocks);
98 int put_metadata(const std::vector<FaceBlock<INT>> &faceblocks);
99
100 int put_non_define_data(const Mesh &mesh, const CommunicationMetaData &comm);
101 int put_non_define_data(const std::vector<Block> &blocks);
102 int put_non_define_data(const std::vector<NodeSet<INT>> &nodesets);
103 int put_non_define_data(const std::vector<SideSet<INT>> &sidesets);
104 int put_non_define_data(const std::vector<EdgeBlock<INT>> &edgeblocks);
105 int put_non_define_data(const std::vector<FaceBlock<INT>> &faceblocks);
106
107 int exodusFilePtr{};
108 int nodeMapVarID[3]{};
109 int elementMapVarID[2]{};
110 int commIndexVar{};
111 int elemCommIndexVar{};
112 int maximumNameLength{};
113 int changeSetNumber{0};
114 };
115 } // namespace Excn