WARPXM v1.10.0
Loading...
Searching...
No Matches
variable.h
Go to the documentation of this file.
1#ifndef VARIABLE_VARIABLE_T_H
2#define VARIABLE_VARIABLE_T_H
3
4// STL includes
5#include <vector>
6
7// Wx includes
8#include "lib/wxobject.h"
9
10// Wm includes
11#include "solver/wmsolverbase.h"
12#include "lib/wmopaqueptr.h"
13
14class WmSolverBase;
15
16namespace wxm
17{
18namespace variable
19{
20
21class variable_t : public WxObject
22{
23public:
27 virtual ~variable_t();
28
48 virtual void setup(const WxCryptSet& wxc);
49
54 virtual void fill(const std::vector<real>& values) = 0;
55
63 virtual void swap(variable_t& other) = 0;
64
71 virtual bool check_compatible(const variable_t& other) const = 0;
72
81 virtual void dump(WxIoBase& io, WxIoNodeType& group_node) const;
82
90 virtual void load(WxIoBase& io, const WxIoNodeType& group_node);
91
98 bool has_component(const std::string& component_name) const
99 {
100 return std::find(_component_names.begin(),
101 _component_names.end(),
103 }
104
110 int num_components() const
111 {
112 return _component_names.size();
113 }
114
121 const std::vector<std::string>& component_names() const
122 {
123 return _component_names;
124 }
125
133 int component_index(const std::string& component_name) const;
134
143 const std::string& component_name(const int component_index) const;
144
152 const WmSolverBase& get_parent() const;
153
154protected:
161 variable_t(const WmConstOpaquePtr& parent_solver);
162
164 std::vector<std::string> _component_names;
165
166private:
168 variable_t& operator=(const variable_t& var);
169 variable_t(const variable_t& var);
170
172 const WmSolverBase* _p_parent;
173
175 bool _is_setup;
176};
177
178} // namespace variable
179} // namespace wxm
180
181#endif // VARIABLE_VARIABLE_T_H
Opaque Pointer object that carries the referenced data type, but does not expose this payload type as...
Definition: wmopaqueptr.h:81
A base class for solvers in WARPM.
Definition: wmsolverbase.h:35
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets...
Definition: wxcryptset.h:35
Provides an abstract interface for access to hierachical datasets.
Definition: wxiobase.h:25
WxObject is a base class for WarpX classes which need to go through a creation/destruction cycle with...
Definition: wxobject.h:54
Definition: variable.h:22
virtual void setup(const WxCryptSet &wxc)
Setup object using supplied crypset.
const WmSolverBase & get_parent() const
Get the parent solver.
bool has_component(const std::string &component_name) const
Check if this variable has a component matching the name supplied.
Definition: variable.h:98
virtual void swap(variable_t &other)=0
Swap the internal data storage of this variable with otherVar leaving the outer shell the same,...
int component_index(const std::string &component_name) const
Returns the component number associated with the componentName.
virtual void fill(const std::vector< real > &values)=0
For each component, apply a fill value throughout the domain.
virtual ~variable_t()
Destroy object.
const std::vector< std::string > & component_names() const
Get names of all components.
Definition: variable.h:121
virtual bool check_compatible(const variable_t &other) const =0
Compares this variable to another supplied variable_t and report if they are swap compatible.
virtual void load(WxIoBase &io, const WxIoNodeType &group_node)
Load object from file.
const std::string & component_name(const int component_index) const
Returns the component name for a given index.
virtual void dump(WxIoBase &io, WxIoNodeType &group_node) const
Dump object to file.
std::vector< std::string > _component_names
List of component names in order.
Definition: variable.h:164
int num_components() const
Returns number of components represented in the variable.
Definition: variable.h:110
variable_t(const WmConstOpaquePtr &parent_solver)
Constructor sets up basic variable container, but no properties or specifics.
Base namespace for everything not included in the global namespace.
Definition: field_source.h:8
Provides a means for derived messengers to return implimentation specific message status flags and da...
Definition: wxiotmpl.h:23