WARPXM v1.10.0
Loading...
Searching...
No Matches
wmsolverbase.h
Go to the documentation of this file.
1#ifndef wmsolverbase_h
2#define wmsolverbase_h
3
4// Wx includes
5#include "lib/wxany.h"
6#include "lib/wxobject.h"
7#include "solver/wxstepper.h"
8
9// Wm includes
10#include "warpxm/warpxm_config.h"
11
12// STL includes
13#include <string>
14
15// forward declarations
16namespace wxm
17{
18namespace variable
19{
20class variable_t;
21}
22} // namespace wxm
23class WmSimulation;
24class WmDomain;
25class WmSubSolver;
26
34class WmSolverBase : public WxStepper, public WxObject
35{
36public:
38 {
40 : _tstart(0.), _tend(0.), _numFrames(0), _startFrame(0), _isRestart(false)
41 {
42 }
43
45 {
46 return (_tend - _tstart) / real(_numFrames);
47 }
48
51 unsigned int _numFrames;
52 unsigned int _startFrame;
55 };
56
71 parentSim /*, updateCallbackFunc_t setDt_callback = NULL, updateCallbackFunc_t setCurrentTime_callback = NULL */);
72
76 virtual ~WmSolverBase();
77
85 virtual void setup(const WxCryptSet& wxc);
86
90 std::string runName() const;
91
97 std::string getSolverName() const;
98
102 virtual void solve() = 0;
103
110 virtual const WmDomain& getDomain() const = 0;
111
120 virtual WmSubSolver* getSubSolver(const std::string& name) const = 0;
121
128 virtual const wxm::variable::variable_t&
129 getConstVar(const std::string& name) const = 0;
130
140 virtual wxm::variable::variable_t& getVar(const std::string& name) const = 0;
141
148 virtual const std::type_info& getVarType(const std::string& name) const = 0;
149
156 virtual const solverParameters_t& getSolverParameters() const = 0;
157
163 static std::string getSrcDirectory()
164 {
165 return WARPXM_SRC_DIRECTORY;
166 }
167
168protected:
173};
174
177#endif // wmsolverbase_h
Definition: wmdomain.h:35
Top level class for WARPXM simulations.
Definition: wmsimulation.h:28
A base class for solvers in WARPM.
Definition: wmsolverbase.h:35
virtual const WmDomain & getDomain() const =0
Return unstructured domain.
virtual void solve()=0
Run the solver.
const WmSimulation * _parentSim
Parent WmSimulation that owns this solver.
Definition: wmsolverbase.h:172
WmSolverBase(const WmSimulation *parentSim)
Create new solver.
virtual ~WmSolverBase()
Destroy the object.
std::string runName() const
Return the run name (name identifying this run of the simulation)
virtual const std::type_info & getVarType(const std::string &name) const =0
Return a type_info reference for a variable known to the solver.
static std::string getSrcDirectory()
Returns the source directory used for finding kernels.
Definition: wmsolverbase.h:163
virtual void setup(const WxCryptSet &wxc)
Setup object using supplied crypset.
std::string getSolverName() const
Get the solver name (name associaton from the cryptset)
virtual const solverParameters_t & getSolverParameters() const =0
Return number of frames to output.
virtual WmSubSolver * getSubSolver(const std::string &name) const =0
Return pointer to subsolver.
virtual wxm::variable::variable_t & getVar(const std::string &name) const =0
Return reference to a variable.
virtual const wxm::variable::variable_t & getConstVar(const std::string &name) const =0
Return constant reference to a read variable.
Base class for sub-solvers in WARPXM compute kernel system.
Definition: wmsubsolver.h:40
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
virtual std::string name() const
Get name of object.
Base class for objects which can be advanced in time.
Definition: wxstepper.h:26
Definition: variable.h:22
Base namespace for everything not included in the global namespace.
Definition: field_source.h:8
Definition: wmsolverbase.h:38
real _tend
Definition: wmsolverbase.h:50
unsigned int _startFrame
Definition: wmsolverbase.h:52
bool _isRestart
Definition: wmsolverbase.h:53
solverParameters_t()
Definition: wmsolverbase.h:39
real getFrameDt() const
Definition: wmsolverbase.h:44
unsigned int _numFrames
Definition: wmsolverbase.h:51
real _tstart
Definition: wmsolverbase.h:49
bool flexible_writeout
Definition: wmsolverbase.h:54
#define real
Definition: wmoclunstructuredreconstruction.h:11