Advanced Multi-Physics (AMP)
On-Line Documentation
Variable.h
Go to the documentation of this file.
1#ifndef included_AMP_Variable_h
2#define included_AMP_Variable_h
3
4#include "AMP/utils/Units.h"
5#include "AMP/utils/enable_shared_from_this.h"
6
7#include <memory>
8#include <string_view>
9
10
11namespace AMP::IO {
12class RestartManager;
13}
14
15
16namespace AMP::LinearAlgebra {
17
21enum class ScatterType : uint8_t { CONSISTENT_ADD, CONSISTENT_SET };
22
26enum class UpdateState : uint8_t {
27 UNCHANGED = 0,
28 LOCAL_CHANGED = 1,
29 ADDING = 2,
30 SETTING = 3,
31 MIXED = 4
32};
33
34
35class VectorSelector;
36
37
45class Variable : public AMP::enable_shared_from_this<Variable>
46{
47public:
48 // Empty constructor
49 Variable() = default;
50
56 explicit Variable( const std::string &name );
57
58
60 virtual ~Variable();
61
62
64 virtual void setUnits( const Units &u );
65
66
68 virtual const Units &getUnits() const;
69
70
74 inline auto &getName() const { return d_VariableName; }
75
76
80 virtual std::string className() const { return "Variable"; }
81
82
87 virtual bool operator==( const Variable &rhs ) const;
88
89
94 bool operator!=( const Variable &rhs ) const;
95
96
100 std::shared_ptr<Variable> clone() const;
101
102
106 virtual std::shared_ptr<Variable> clone( const std::string &name ) const;
107
108
114 virtual std::shared_ptr<VectorSelector> createVectorSelector() const;
115
116
118 virtual uint64_t getID() const;
119
120
121public: // Write/read restart data
127 virtual void registerChildObjects( AMP::IO::RestartManager *manager ) const;
128
134 virtual void writeRestart( int64_t fid ) const;
135
136
142 Variable( int64_t fid );
143
144
145protected:
151 std::string d_VariableName;
152
156};
157
158} // namespace AMP::LinearAlgebra
159
160#endif
Class to manage reading/writing restart data.
A description of the data in the vector.
Definition Variable.h:46
Variable(int64_t fid)
Read restart data to file.
virtual ~Variable()
Destructor.
auto & getName() const
A function that returns the name of a variable.
Definition Variable.h:74
virtual std::string className() const
A function that returns the name of a variable.
Definition Variable.h:80
Variable(const std::string &name)
Construct a variable with a name.
virtual void writeRestart(int64_t fid) const
Write restart data to file.
virtual std::shared_ptr< VectorSelector > createVectorSelector() const
Create a VectorSelector.
virtual bool operator==(const Variable &rhs) const
Compares two variables for equality.
virtual const Units & getUnits() const
Get the units of this variable.
virtual std::shared_ptr< Variable > clone(const std::string &name) const
Create a variable of the same type with a new name.
std::string d_VariableName
A name given to the variable.
Definition Variable.h:151
std::shared_ptr< Variable > clone() const
Create a variable of the same type with a new name.
virtual uint64_t getID() const
Get a unique id hash for the vector.
virtual void setUnits(const Units &u)
Set the units of this variable.
bool operator!=(const Variable &rhs) const
Inverse of ==.
virtual void registerChildObjects(AMP::IO::RestartManager *manager) const
Register any child objects.
AMP::Units d_Units
The units this variable is measured in.
Definition Variable.h:155
Provides a class for storing units.
Definition Units.h:101
Enhancement of std::enable_shared_from_this.
UpdateState
The four states a Vector can be in.
Definition Variable.h:26
ScatterType
Flag to choose algorithm for makeConsistent.
Definition Variable.h:21



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page