IOSS 2.0
Loading...
Searching...
No Matches
Ioss_ChangeSet.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
9#include "Ioss_DBUsage.h"
10#include "Ioss_DatabaseIO.h"
11#include "Ioss_ParallelUtils.h"
13#include "Ioss_Region.h"
14
15#include <cstddef>
16#include <functional>
17#include <sstream>
18#include <string>
19#include <utility>
20
21namespace Ioss {
22
24 std::function<std::string(const std::string &baseFileName, unsigned step)>;
25
32
33 std::pair<std::string, Ioss::DatabaseIO *>
35 const std::string &basename, const std::string &db_type,
36 const Ioss::PropertyManager &properties, Ioss::DatabaseUsage usage,
37 int step);
38
39 std::string expand_topology_files(FileNameGenerator generator, const Ioss::ParallelUtils &util,
40 const std::string &basename,
41 const Ioss::PropertyManager &properties,
42 Ioss::DatabaseUsage usage, int step);
43
46
47 class IOSS_EXPORT ChangeSet
48 {
49 public:
50 explicit ChangeSet(Ioss::Region *region);
51 ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, const std::string &dbType,
52 unsigned fileCyclicCount);
53
54 virtual ~ChangeSet();
55 ChangeSet() = delete;
56 ChangeSet(const ChangeSet &) = delete;
57
58 IOSS_NODISCARD unsigned supported_formats() const { return m_supportedFormats; }
59 IOSS_NODISCARD unsigned database_format() const { return m_databaseFormat; }
60
61 virtual void populate_change_sets(bool loadAllFiles = true);
62
63 IOSS_NODISCARD virtual DatabaseIO *open_change_set(unsigned index, Ioss::DatabaseUsage usage);
64 virtual void close_change_set(unsigned index);
65
66 IOSS_NODISCARD size_t size() const { return m_changeSetNames.size(); }
67 IOSS_NODISCARD const std::vector<std::string> &names() const { return m_changeSetNames; }
68 IOSS_NODISCARD std::string get_change_set_name(unsigned index) const;
69
70 IOSS_NODISCARD unsigned get_file_cyclic_count() const { return m_fileCyclicCount; }
71
72 static std::string get_cyclic_database_filename(const std::string &baseFileName,
73 unsigned int fileCyclicCount,
74 unsigned int step);
75
76 static std::string get_linear_database_filename(const std::string &baseFileName,
77 unsigned int step);
78
79 private:
80 std::vector<DatabaseIO *> m_changeSetDatabases;
81
82 protected:
83 void get_cyclic_multi_file_change_sets();
84 void get_linear_multi_file_change_sets();
85
86 void verify_change_set_index(unsigned index) const;
87
88 virtual void clear_change_sets();
89
90 DatabaseIO *get_database() const;
91 IOSS_NODISCARD const ParallelUtils &util() const;
92
93 Ioss::DatabaseIO *m_database{nullptr};
94 std::string m_ioDB;
95 std::string m_dbType;
96 unsigned m_fileCyclicCount{0};
97
99 unsigned m_databaseFormat{CHANGE_SET_NONE};
100
101 std::vector<std::string> m_changeSetNames;
102 };
103
104} // namespace Ioss
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
Definition Ioss_ChangeSet.h:48
ChangeSet(const ChangeSet &)=delete
std::vector< DatabaseIO * > m_changeSetDatabases
Definition Ioss_ChangeSet.h:80
std::string m_dbType
Definition Ioss_ChangeSet.h:95
IOSS_NODISCARD unsigned database_format() const
Definition Ioss_ChangeSet.h:59
std::vector< std::string > m_changeSetNames
Definition Ioss_ChangeSet.h:101
IOSS_NODISCARD const std::vector< std::string > & names() const
Definition Ioss_ChangeSet.h:67
IOSS_NODISCARD size_t size() const
Definition Ioss_ChangeSet.h:66
std::string m_ioDB
Definition Ioss_ChangeSet.h:94
ChangeSet()=delete
IOSS_NODISCARD unsigned get_file_cyclic_count() const
Definition Ioss_ChangeSet.h:70
IOSS_NODISCARD unsigned supported_formats() const
Definition Ioss_ChangeSet.h:58
An input or output Database.
Definition Ioss_DatabaseIO.h:63
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
ChangeSetFormat
Definition Ioss_ChangeSet.h:26
@ CHANGE_SET_CYCLIC_MULTI_FILES
Definition Ioss_ChangeSet.h:30
@ CHANGE_SET_NONE
Definition Ioss_ChangeSet.h:27
@ CHANGE_SET_INTERNAL_FILES
Definition Ioss_ChangeSet.h:28
@ CHANGE_SET_LINEAR_MULTI_FILES
Definition Ioss_ChangeSet.h:29
Ioss::FileNameGenerator construct_linear_filename_generator()
Definition Ioss_ChangeSet.C:378
std::function< std::string(const std::string &baseFileName, unsigned step)> FileNameGenerator
Definition Ioss_ChangeSet.h:23
Ioss::FileNameGenerator construct_cyclic_filename_generator(unsigned cyclicCount)
Definition Ioss_ChangeSet.C:359
DatabaseUsage
Specifies how an Ioss::DatabaseIO object will be used.
Definition Ioss_DBUsage.h:13
std::string expand_topology_files(FileNameGenerator generator, const Ioss::ParallelUtils &util, const std::string &basename, const Ioss::PropertyManager &properties, Ioss::DatabaseUsage usage, int step)
Definition Ioss_ChangeSet.C:281