| 1 |
// Copyright(C) 1999-2020, 2022 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 |
#pragma once |
| 7 |
|
| 8 |
#include <vector> // for vector |
| 9 |
namespace Excn { |
| 10 |
struct Block; |
| 11 |
struct CommunicationMetaData; |
| 12 |
template <typename INT> struct Mesh; |
| 13 |
template <typename INT> struct NodeSet; |
| 14 |
template <typename INT> struct SideSet; |
| 15 |
} // namespace Excn |
| 16 |
|
| 17 |
/*! |
| 18 |
* This set of classes provides a thin wrapper around the exodusII |
| 19 |
* internals. It supplants several of the exodusII API calls in |
| 20 |
* order to avoid ncredef calls which totally rewrite the existing |
| 21 |
* database and can be very expensive. These routines provide all |
| 22 |
* required variable, dimension, and attribute definitions to the |
| 23 |
* underlying netcdf file with only a single ncredef call. |
| 24 |
* |
| 25 |
* To use the application must create an Excn::Internals instance |
| 26 |
* and call the Excn::Internals::write_meta_data() function. This |
| 27 |
* function requires several classes as arguments including: |
| 28 |
* <ul> |
| 29 |
* <li> Mesh -- defines mesh global metadata |
| 30 |
* <li> Block -- defines metadata for each block |
| 31 |
* <li> NodeSet -- defines metadata for each nodeset |
| 32 |
* <li> SideSet -- defines metadata for each sideset |
| 33 |
* <li> CommunicationMetaData -- global metadata relating to |
| 34 |
* parallel info. |
| 35 |
* </ul> |
| 36 |
* |
| 37 |
* Calling Excn::Internals::write_meta_data(), replaces the |
| 38 |
* following exodusII and nemesis API calls: |
| 39 |
* <ul> |
| 40 |
* <li> ex_put_init(), |
| 41 |
* <li> ex_put_elem_block(), |
| 42 |
* <li> ex_put_node_set_param(), |
| 43 |
* <li> ex_put_side_set_param(), |
| 44 |
* <li> ne_put_init_info(), |
| 45 |
* <li> ne_put_loadbal_param(), |
| 46 |
* <li> ne_put_cmap_params(), |
| 47 |
* </ul> |
| 48 |
*/ |
| 49 |
|
| 50 |
namespace Excn { |
| 51 |
|
| 52 |
class Redefine |
| 53 |
{ |
| 54 |
public: |
| 55 |
explicit Redefine(int exoid); |
| 56 |
~Redefine(); |
| 57 |
|
| 58 |
private: |
| 59 |
int exodusFilePtr; |
| 60 |
}; |
| 61 |
|
| 62 |
class Internals |
| 63 |
{ |
| 64 |
public: |
| 65 |
explicit Internals(int exoid, int maximum_name_length); |
| 66 |
|
| 67 |
template <typename INT> |
| 68 |
int write_meta_data(const Mesh<INT> &mesh, const std::vector<Block> &blocks, |
| 69 |
const std::vector<NodeSet<INT>> &nodesets, |
| 70 |
const std::vector<SideSet<INT>> &sidesets, |
| 71 |
const CommunicationMetaData &comm); |
| 72 |
|
| 73 |
private: |
| 74 |
template <typename INT> |
| 75 |
int put_metadata(const Mesh<INT> &mesh, const CommunicationMetaData &comm); |
| 76 |
int put_metadata(const std::vector<Block> &blocks); |
| 77 |
template <typename INT> int put_metadata(const std::vector<NodeSet<INT>> &nodesets); |
| 78 |
template <typename INT> int put_metadata(const std::vector<SideSet<INT>> &sidesets); |
| 79 |
|
| 80 |
template <typename INT> |
| 81 |
int put_non_define_data(const Mesh<INT> &mesh, const CommunicationMetaData &comm); |
| 82 |
int put_non_define_data(const std::vector<Block> &blocks); |
| 83 |
template <typename INT> int put_non_define_data(const std::vector<NodeSet<INT>> &nodesets); |
| 84 |
template <typename INT> int put_non_define_data(const std::vector<SideSet<INT>> &sidesets); |
| 85 |
|
| 86 |
int exodusFilePtr; |
| 87 |
int maximumNameLength; |
| 88 |
}; |
| 89 |
} // namespace Excn |