IOSS 2.0
Loading...
Searching...
No Matches
Ioss_DynamicTopologyObserver.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 class DynamicTopologyNotifier;
28
29 class IOSS_EXPORT DynamicTopologyObserver
30 {
31 public:
32 explicit DynamicTopologyObserver(Region *region) : m_region(region) {}
33
34 virtual ~DynamicTopologyObserver() = default;
35
36 virtual void reset_topology_modification_all();
37 virtual void reset_topology_modification();
38 virtual void set_topology_modification(unsigned int type);
39 virtual void sync_topology_modification(unsigned int modFlag, unsigned int cumulativeModFlag);
40 virtual unsigned int get_topology_modification() const;
41
42 virtual unsigned int get_cumulative_topology_modification() const;
43 virtual void set_cumulative_topology_modification(unsigned int type);
44
45 int get_cumulative_topology_modification_field();
46
47 virtual bool is_topology_modified() const;
48 virtual bool is_automatic_restart() const { return m_automaticRestart; }
49 virtual bool is_restart_requested() const { return m_restartRequested; }
50
51 void set_automatic_restart(bool flag) { m_automaticRestart = flag; }
52 void set_restart_requested(bool flag) { m_restartRequested = flag; }
53
55 {
56 return std::string("CUMULATIVE_TOPOLOGY_MODIFICATION");
57 }
58
59 void register_region(Region *region);
60 Region *get_region() const { return m_region; }
61
62 void register_notifier(DynamicTopologyNotifier *notifier);
63 DynamicTopologyNotifier *get_notifier() const { return m_notifier; }
64
65 virtual void define_model();
66 virtual void write_model();
67 virtual void define_transient();
68
69 virtual FileControlOption get_control_option() const { return FileControlOption::CONTROL_NONE; }
70
71 virtual bool needs_new_output_file() const;
72
73 protected:
74 Region *m_region{nullptr};
75 unsigned int m_topologyModification{TOPOLOGY_SAME};
76 unsigned int m_cumulativeTopologyModification{TOPOLOGY_SAME};
77
78 bool m_automaticRestart{false};
79 bool m_restartRequested{false};
80
81 DynamicTopologyNotifier *m_notifier{nullptr};
82
83 void verify_region_is_registered() const;
84 IOSS_NODISCARD const ParallelUtils &util() const;
85 void synchronize_topology_modified_flags();
86
87 void set_topology_modification_nl(unsigned int type);
88
89 private:
91 };
92
93} // namespace Ioss
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
Definition Ioss_DynamicTopologyNotifier.h:29
Definition Ioss_DynamicTopologyObserver.h:30
Region * get_region() const
Definition Ioss_DynamicTopologyObserver.h:60
DynamicTopologyNotifier * get_notifier() const
Definition Ioss_DynamicTopologyObserver.h:63
virtual FileControlOption get_control_option() const
Definition Ioss_DynamicTopologyObserver.h:69
DynamicTopologyObserver(Region *region)
Definition Ioss_DynamicTopologyObserver.h:32
virtual bool is_automatic_restart() const
Definition Ioss_DynamicTopologyObserver.h:48
void set_restart_requested(bool flag)
Definition Ioss_DynamicTopologyObserver.h:52
static std::string topology_modification_change_name()
Definition Ioss_DynamicTopologyObserver.h:54
virtual bool is_restart_requested() const
Definition Ioss_DynamicTopologyObserver.h:49
virtual ~DynamicTopologyObserver()=default
void set_automatic_restart(bool flag)
Definition Ioss_DynamicTopologyObserver.h:51
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
FileControlOption
Definition Ioss_DynamicTopology.h:46
@ TOPOLOGY_SAME
No change, also used for initialization.
Definition Ioss_DynamicTopology.h:28