IOSS 2.0
Loading...
Searching...
No Matches
Ioss_DynamicTopologyStateLocator.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 DynamicTopologyStateLocator(Region *region, bool loadAllFiles = true);
32 DynamicTopologyStateLocator(Ioss::DatabaseIO *db, const std::string &dbName,
33 const std::string &dbType, unsigned fileCyclicCount = 0,
34 bool loadAllFiles = true);
35 DynamicTopologyStateLocator(Ioss::DatabaseIO *db, unsigned fileCyclicCount = 0,
36 bool loadAllFiles = true);
37
41
42 DatabaseIO *get_database() const;
43
44 std::tuple<std::string, int, double> locate_db_state(double targetTime) const;
45 std::tuple<std::string, int, double> get_db_min_time() const;
46 std::tuple<std::string, int, double> get_db_max_time() const;
47
48 private:
50 {
52 {
54 changeSet = db->get_filename();
55 }
56 }
57
58 std::string changeSet{"/"};
59 int state{-1};
60 double time{-std::numeric_limits<double>::max()};
61 };
62
63 using StateLocatorCompare = std::function<bool(double, double)>;
64
65 void locate_state_impl(Ioss::DatabaseIO *db, double targetTime, StateLocatorCompare comparator,
66 DatabaseState &loc) const;
67
68 void locate_state(Ioss::DatabaseIO *db, double targetTime, DatabaseState &loc) const;
69
70 void locate_db_state_impl(double targetTime, DatabaseState &loc) const;
71
72 void get_db_time_impl(double init_time, StateLocatorCompare comparator,
73 DatabaseState &loc) const;
74
75 IOSS_NODISCARD const ParallelUtils &util() const;
76
77 Ioss::DatabaseIO *m_database{nullptr};
78 std::string m_ioDB;
79 std::string m_dbType;
80 unsigned m_fileCyclicCount{0};
81 bool m_loadAllFiles{true};
82 };
83
84} // namespace Ioss
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
An input or output Database.
Definition Ioss_DatabaseIO.h:63
IOSS_NODISCARD std::string get_filename() const
Get the file name associated with the database.
Definition Ioss_DatabaseIO.h:174
bool supports_internal_change_set()
Checks if a database type supports internal change sets.
Definition Ioss_DatabaseIO.h:317
Definition Ioss_DynamicTopologyStateLocator.h:29
std::string m_dbType
Definition Ioss_DynamicTopologyStateLocator.h:79
std::function< bool(double, double)> StateLocatorCompare
Definition Ioss_DynamicTopologyStateLocator.h:63
DynamicTopologyStateLocator(const DynamicTopologyStateLocator &)=delete
std::string m_ioDB
Definition Ioss_DynamicTopologyStateLocator.h:78
Definition Ioss_ParallelUtils.h:32
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
Definition Ioss_DynamicTopologyStateLocator.h:50
DatabaseState(Ioss::DatabaseIO *db)
Definition Ioss_DynamicTopologyStateLocator.h:51