WARPXM v1.10.0
Loading...
Searching...
No Matches
wmicfunction.h
Go to the documentation of this file.
1#ifndef wmicfunction_h
2#define wmicfunction_h
3
4// std includes
5#include <vector>
6#include <string>
7
8// Wx includes
9#include "lib/wxany.h"
10#include "lib/wxcryptset.h"
11
12// Wm includes
15#include "warpxm/warpxm_config.h"
16
25{
26public:
33
39 virtual ~WmICFunction();
40
47 virtual void setup(const WxCryptSet& wxc);
48
54 const std::string& getName() const
55 {
56 return _name;
57 }
58
64 int getNumArguments() const
65 {
66 return _numArgs;
67 }
68
77 template<typename T> void apply(const real position[3], T* value) const
78 {
79 applyFunction(position, _rvalues);
80
81 for (int i = 0; i < _numArgs; i++)
82 {
83 value[i] = T(_rvalues[i]);
84 }
85 }
86
87protected:
95 virtual void applyFunction(const real* position, real* value) const = 0;
96
97 std::string _name;
100};
101
104#endif // wmicfunction_h
Base class for functions used in generating initial conditions.
Definition: wmicfunction.h:25
const std::string & getName() const
Get name of this function.
Definition: wmicfunction.h:54
void apply(const real position[3], T *value) const
Evaluate the function at a position and return the result through a pointer position and value must b...
Definition: wmicfunction.h:77
std::string _name
Definition: wmicfunction.h:97
virtual ~WmICFunction()
Destroy WmICFunction.
int getNumArguments() const
Get number of arguments returned by this icFunction.
Definition: wmicfunction.h:64
int _numArgs
Definition: wmicfunction.h:98
virtual void applyFunction(const real *position, real *value) const =0
This is the currently apply function call - recasts to real.
real * _rvalues
Definition: wmicfunction.h:99
WmICFunction()
Create new WmICFunction.
virtual void setup(const WxCryptSet &wxc)
Setup WmICFunction object using supplied cryptset.
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets...
Definition: wxcryptset.h:35
#define real
Definition: wmoclunstructuredreconstruction.h:11