| 1 |
// Copyright(C) 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_DynamicTopology.h" |
| 10 |
|
| 11 |
#include "Ioss_CodeTypes.h" |
| 12 |
#include "Ioss_DBUsage.h" |
| 13 |
#include "Ioss_DatabaseIO.h" // for DatabaseIO |
| 14 |
#include "Ioss_ParallelUtils.h" // for ParallelUtils |
| 15 |
#include "Ioss_PropertyManager.h" // for PropertyManager |
| 16 |
#include "Ioss_Utils.h" |
| 17 |
#include "ioss_export.h" |
| 18 |
|
| 19 |
#include <cstddef> // for size_t, nullptr |
| 20 |
#include <cstdint> // for int64_t |
| 21 |
#include <iomanip> |
| 22 |
#include <sstream> |
| 23 |
#include <string> // for string, operator< |
| 24 |
|
| 25 |
namespace Ioss { |
| 26 |
class Region; |
| 27 |
|
| 28 |
class IOSS_EXPORT DynamicTopologyFileControl |
| 29 |
{ |
| 30 |
public: |
| 31 |
explicit DynamicTopologyFileControl(Region *region); |
| 32 |
|
| 33 |
void clone_and_replace_output_database(int steps = 0); |
| 34 |
void add_output_database_change_set(int steps = 0); |
| 35 |
|
| 36 |
static std::string change_set_prefix() { return "IOSS_FILE_GROUP-"; } |
| 37 |
|
| 38 |
DatabaseIO *get_database() const; |
| 39 |
|
| 40 |
static std::string get_cyclic_database_filename(const std::string &baseFileName, |
| 41 |
unsigned int fileCyclicCount, |
| 42 |
unsigned int step); |
| 43 |
|
| 44 |
static std::string get_linear_database_filename(const std::string &baseFileName, |
| 45 |
unsigned int step); |
| 46 |
|
| 47 |
static std::string get_internal_file_change_set_name(unsigned int step); |
| 48 |
|
| 49 |
unsigned int get_topology_change_count() const { return m_dbChangeCount; } |
| 50 |
unsigned int get_file_cyclic_count() const { return m_fileCyclicCount; } |
| 51 |
IfDatabaseExistsBehavior get_if_database_exists_behavior() const { return m_ifDatabaseExists; } |
| 52 |
|
| 53 |
private: |
| 54 |
Region *m_region{nullptr}; |
| 55 |
std::string m_ioDB; |
| 56 |
std::string m_dbType; |
| 57 |
|
| 58 |
PropertyManager m_properties; |
| 59 |
|
| 60 |
unsigned int m_fileCyclicCount; |
| 61 |
IfDatabaseExistsBehavior m_ifDatabaseExists; |
| 62 |
unsigned int m_dbChangeCount; |
| 63 |
|
| 64 |
IOSS_NODISCARD const ParallelUtils &util() const; |
| 65 |
|
| 66 |
std::string get_unique_linear_filename(DatabaseUsage db_usage); |
| 67 |
std::string construct_database_filename(int &step, DatabaseUsage db_usage); |
| 68 |
bool file_exists(const std::string &filename, const std::string &db_type, |
| 69 |
DatabaseUsage db_usage); |
| 70 |
bool abort_if_exists(const std::string &filename, const std::string &db_type, |
| 71 |
DatabaseUsage db_usage); |
| 72 |
|
| 73 |
DatabaseIO *clone_output_database(int steps); |
| 74 |
bool replace_output_database(DatabaseIO *db); |
| 75 |
}; |
| 76 |
|
| 77 |
} // namespace Ioss |