WARPXM v1.10.0
Loading...
Searching...
No Matches
wmhostaction.h
Go to the documentation of this file.
1#ifndef wmhostaction_h
2#define wmhostaction_h
3
4// WarpX lib includes
5#include "lib/wxcrypt.h"
6#include "lib/wxmsgbase.h"
7#include "lib/wxobject.h"
8#include "solver/wxstepper.h"
9#include "lib/wmdomain.h"
10
11// std includes
12#include <string>
13#include <typeinfo>
14#include <vector>
15
16// forward declarations
17class WmSolverBase;
18class WmVariable;
19class WmDomainGeometry;
21
22template<class stepper> class WmExecutionStep;
23class WmDomain;
24
34class WmHostAction : public WxStepper, public WxObject
35{
36public:
38 ~WmHostAction() override;
39
45 void setup(const WxCryptSet& wxc) override;
46
52 std::vector<std::string> readVarNames() const;
53
59 std::vector<std::string> writeVarNames() const;
60
67 unsigned numExpectedReadVars() const;
68
76 unsigned numExpectedWriteVars() const;
77
84
91
97 virtual bool needsDomain() const;
98
107
114 unsigned numActualReadVars() const;
115
122 unsigned numActualWriteVars() const;
123
124 // /**
125 // * Get domain on which host action works
126 // * TODO: Not all host actions work on a domain, yet the current implementation of
127 //this function does not respect that. I'm thinking there should be a derived class
128 //from WmHostAction : WmHostActionOnDomain.
129 // * @return domain object
130 // */
131 // const WmDomainGeometry& getDomain() const;
132
138 const WmDomain& getDomain() const;
139
145 std::vector<std::string> getWriteVarList() const;
146
152 std::vector<std::string> getReadVarList() const;
153
159 const WmSolverBase& getParent() const;
160
161protected:
167 WmHostAction(const WmConstOpaquePtr& parent_solver);
168
175 const std::type_info& getVarType(const std::string& variableName) const;
176
183 const wxm::variable::variable_t& getReadVar(unsigned pos) const;
191
192protected:
199 virtual void typeCheck() = 0;
200
203 bool _allowsVariableReadVars; // true when variable number of read variables allowed
204 // by hostaction
205 bool _allowsVariableWriteVars; // true when variable number of write variables allowed
206 // by hostaction
207 bool _WriteVarConditionHasBeenSet; // true after first time hostaction has been
208 // established as variable or fixed number of
209 // variables
210 bool _ReadVarConditionHasBeenSet; // true after first time hostaction has been
211 // established as variable or fixed number of
212 // variables
215
216private:
218 WmHostAction& operator=(const WmHostAction& var);
219 WmHostAction(const WmHostAction& var);
220 WmHostAction();
221
222 const WmSolverBase* _parent; // parent solver
223 std::vector<std::string> _readVars; // variables to read from
224 std::vector<std::string> _writeVars; // variables to write to
225 std::string _onDomainStr; // domain on which solver acts, if needsDomain returns true
226 unsigned _numActualReadVars;
227 unsigned _numActualWriteVars;
228};
229
232#endif // wmhostaction_h
Opaque Pointer object that carries the referenced data type, but does not expose this payload type as...
Definition: wmopaqueptr.h:81
Definition: wmdomain.h:35
Definition: wmhostaction.h:22
The WmHostAction class is a base class for sub-solvers in the WARPXM system.
Definition: wmhostaction.h:35
const WmDomain & getDomain() const
Get (unstructured) domain on which host action works.
bool _allReadVarsSameType
Definition: wmhostaction.h:201
bool allowsVariableWriteVars() const
Does this hostaction allow variable number of write variables?
unsigned numExpectedWriteVars() const
Return number of write variables expected by this hostaction, or minimum number required for hostacti...
bool _WriteVarConditionHasBeenSet
Definition: wmhostaction.h:207
std::vector< std::string > getReadVarList() const
Returns list of read variables for this hostaction.
bool _ReadVarConditionHasBeenSet
Definition: wmhostaction.h:210
bool allowsVariableReadVars() const
Does this hostaction allow variable number of read variables?
virtual bool needsDomain() const
Return true if this updater needs a domain to work on.
std::vector< std::string > readVarNames() const
Get names of all read variables used.
unsigned numActualReadVars() const
Get number of actual read variables used when user calls this hostaction.
bool _allowsVariableWriteVars
Definition: wmhostaction.h:205
void setParentStepHandler(WmExecutionStep< WmHostAction > *parentStepHandler)
Set enclosing step handler TODO: convert this to being a friend function or something.
std::vector< std::string > writeVarNames() const
Get names of all write variables used.
bool _allWriteVarsSameType
Definition: wmhostaction.h:202
bool _allowsVariableReadVars
Definition: wmhostaction.h:203
WmHostAction(const WmConstOpaquePtr &parent_solver)
Create new hostaction.
unsigned numActualWriteVars() const
Get number of actual write variables used when user calls this hostaction.
const std::type_info & getVarType(const std::string &variableName) const
Get a variable types from the parent solver.
unsigned _numExpectedWriteVars
Definition: wmhostaction.h:214
const WmSolverBase & getParent() const
Get parent solver object.
~WmHostAction() override
Destroy hostaction.
wxm::variable::variable_t & getWriteVar(unsigned pos) const
Get a reference to a write variable.
void setup(const WxCryptSet &wxc) override
Setup hostaction object using supplied cryptset.
unsigned _numExpectedReadVars
Definition: wmhostaction.h:213
unsigned numExpectedReadVars() const
Return number of read variables expected by this hostaction, or minimum number required for hostactio...
const wxm::variable::variable_t & getReadVar(unsigned pos) const
Get a reference to a read variable.
std::vector< std::string > getWriteVarList() const
Returns list of write variables for this hostaction.
virtual void typeCheck()=0
Check that the provided variables meet the expected variable types for this hostaction.
A base class for solvers in WARPM.
Definition: wmsolverbase.h:35
Base class for variables that store one or more components of data.
Definition: wmvariable.h:31
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets...
Definition: wxcryptset.h:35
WxObject is a base class for WarpX classes which need to go through a creation/destruction cycle with...
Definition: wxobject.h:54
Base class for objects which can be advanced in time.
Definition: wxstepper.h:26
Definition: variable.h:22