IOSS 2.0
Loading...
Searching...
No Matches
Ioss_DynamicTopologyFileControl.h
Go to the documentation of this file.
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
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
25namespace Ioss {
26 class Region;
27
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
59
60 unsigned int m_fileCyclicCount;
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
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
An input or output Database.
Definition Ioss_DatabaseIO.h:63
Definition Ioss_DynamicTopologyFileControl.h:29
IfDatabaseExistsBehavior get_if_database_exists_behavior() const
Definition Ioss_DynamicTopologyFileControl.h:51
std::string m_ioDB
Definition Ioss_DynamicTopologyFileControl.h:55
static std::string change_set_prefix()
Definition Ioss_DynamicTopologyFileControl.h:36
IfDatabaseExistsBehavior m_ifDatabaseExists
Definition Ioss_DynamicTopologyFileControl.h:61
unsigned int m_fileCyclicCount
Definition Ioss_DynamicTopologyFileControl.h:60
std::string m_dbType
Definition Ioss_DynamicTopologyFileControl.h:56
unsigned int get_topology_change_count() const
Definition Ioss_DynamicTopologyFileControl.h:49
unsigned int m_dbChangeCount
Definition Ioss_DynamicTopologyFileControl.h:62
unsigned int get_file_cyclic_count() const
Definition Ioss_DynamicTopologyFileControl.h:50
PropertyManager m_properties
Definition Ioss_DynamicTopologyFileControl.h:58
Definition Ioss_ParallelUtils.h:32
A collection of Ioss::Property objects.
Definition Ioss_PropertyManager.h:36
A grouping entity that contains other grouping entities.
Definition Ioss_Region.h:93
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
DatabaseUsage
Specifies how an Ioss::DatabaseIO object will be used.
Definition Ioss_DBUsage.h:13
IfDatabaseExistsBehavior
Definition Ioss_DBUsage.h:32