WARPXM v1.10.0
Loading...
Searching...
No Matches
wmfunctionapplicator.h
Go to the documentation of this file.
1#ifndef WMFUNCTIONAPPLICATOR_H
2#define WMFUNCTIONAPPLICATOR_H
3
4// Wm includes
6//#include "lib/wmvariableparser.h"
7#include "variable/distributed_variable.h"
8
9// STL includes
10#include <vector>
11
16class WmICFunction;
18
44{
45public:
51 class applicator_t;
52
54 {
55 public:
57 {
58 public:
60 {
61 public:
63 friend class components_t;
64
66 {
67 }
68
75 wxm::array::patch_array_t& patch_array(const int patch_index)
76 {
77 return _variable->patch_array(_component_index, patch_index);
78 }
79
84 const wxm::array::patch_array_t& patch_array(const int patch_index) const
85 {
86 return _variable->patch_array(_component_index, patch_index);
87 }
88
89 protected:
92
94 std::string _variable_name;
95
98 };
99
101 typedef std::vector<component_t> component_list_t;
102
107 {
108 }
109
112 {
113 // Everything that components_t owns is deleted automatically
114 }
115
120 void set_parent_solver(const WmSolverBase& solver)
121 {
122 _parent_solver = &solver;
123 }
124
125 int num_components() const
126 {
127 return _components.size();
128 }
129
135 void setup(const WxCryptSet& wxc, const std::string& field_name);
136
143 const int component_index)
144 {
145 return _components[component_index].patch_array(patch_index);
146 }
147
153 const wxm::array::patch_array_t& patch_array(const int patch_index,
154 const int component_index) const
155 {
156 return _components[component_index].patch_array(patch_index);
157 }
158
159 bool exists_on(const std::string& subdomain_name) const
160 {
161 for (const component_t& component : _components)
162 {
163 if (!component._variable->on_subdomain(subdomain_name))
164 {
165 return false;
166 }
167 }
168 return true;
169 }
170
171 protected:
172 void parse_variable_name(const std::string& variable_name_set);
173
176
179 };
180
186 enum
187 {
192 };
193
201
208
216 void setup(const WxCryptSet& wxc);
217
225 void apply(const WmUnstructuredPatch& patch);
226
227 // /**
228 // * Grabs the components used by this applicator
229 // *
230 // * @return list of components
231 // */
232
233 // const WmVariableParser::componentList_t & getComponents() const {return
234 //_args;}
235
236 protected:
239
242
245
247 std::string _basisSetName;
248
251
254
255 // Kinetic Piece -> phase space basis order
257
258 // Kinetic Piece -> number of elements in velocity space
259 std::vector<int> _vspace_nelems;
260
261 // Kinetic Piece -> number of dimensions in velocity space
263
264 // Kinetic Piece -> minimum v value in each velocity space dimension (vector)
265 std::vector<real> _vspace_minimums;
266
267 // Kinetic Piece -> delta v in each velocity space dimension (vector)
268 std::vector<real> _vspace_dv;
269 };
270
271 typedef std::vector<WmICFunction*> functions_t;
272 typedef std::vector<applicator_t*> applicators_t;
273
281
288
296 void setup(const WxCryptSet& wxc);
297
303 virtual void typeCheck();
304
312
318 bool needsDomain() const
319 {
320 return false;
321 }
322
323private:
324 WmICFunction* has_function(const std::string& name);
325
326 const WmDomain& _domain;
327
328 applicators_t _applicators;
329 functions_t _functions;
330};
331
334#endif // WMFUNCTIONAPPLICATOR_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
const wxm::array::patch_array_t & patch_array(const int patch_index) const
Get array associated with variable.
Definition: wmfunctionapplicator.h:84
wxm::variable::distributed_variable_t * _variable
Pointer to variable.
Definition: wmfunctionapplicator.h:97
std::string _variable_name
Name of variable.
Definition: wmfunctionapplicator.h:94
wxm::array::patch_array_t & patch_array(const int patch_index)
Get array associated with variable.
Definition: wmfunctionapplicator.h:75
int _component_index
Component index in variable.
Definition: wmfunctionapplicator.h:91
component_t()
Definition: wmfunctionapplicator.h:65
Definition: wmfunctionapplicator.h:57
int num_components() const
Definition: wmfunctionapplicator.h:125
void setup(const WxCryptSet &wxc, const std::string &field_name)
Parse the input to find the variables.
~components_t()
Destructor.
Definition: wmfunctionapplicator.h:111
bool exists_on(const std::string &subdomain_name) const
Definition: wmfunctionapplicator.h:159
components_t()
Default constructor.
Definition: wmfunctionapplicator.h:106
component_list_t _components
List of components that make up components_t.
Definition: wmfunctionapplicator.h:178
std::vector< component_t > component_list_t
Used to store variables.
Definition: wmfunctionapplicator.h:101
wxm::array::patch_array_t & patch_array(const int patch_index, const int component_index)
Grab an array for a variable.
Definition: wmfunctionapplicator.h:142
const wxm::array::patch_array_t & patch_array(const int patch_index, const int component_index) const
Grab an array for a variable.
Definition: wmfunctionapplicator.h:153
void parse_variable_name(const std::string &variable_name_set)
void set_parent_solver(const WmSolverBase &solver)
Assign the parent solver to allow variable parsing.
Definition: wmfunctionapplicator.h:120
const WmSolverBase * _parent_solver
Parent solver.
Definition: wmfunctionapplicator.h:175
Definition: wmfunctionapplicator.h:54
std::string _basisSetName
Name of the basis set.
Definition: wmfunctionapplicator.h:247
components_t _components
List of variables - TODO: move variables_t out of WmTimeIntegration.
Definition: wmfunctionapplicator.h:250
applicator_t(WmFunctionApplicator *parent)
Create new applicator_t.
int _spatialScheme
Spatial scheme.
Definition: wmfunctionapplicator.h:241
int _spatialOrder
Spatial order.
Definition: wmfunctionapplicator.h:244
void setup(const WxCryptSet &wxc)
Setup the applicator_t from a cryptset and an application index.
@ WMFUNCTIONAPPLICATOR_NODAL
Definition: wmfunctionapplicator.h:189
@ WMFUNCTIONAPPLICATOR_FV
Definition: wmfunctionapplicator.h:190
@ WMFUNCTIONAPPLICATOR_NODAL_KINETIC
Definition: wmfunctionapplicator.h:191
@ WMFUNCTIONAPPLICATOR_MODAL
Definition: wmfunctionapplicator.h:188
void apply(const WmUnstructuredPatch &patch)
Applies the initial condition to the variable for a given patch TODO: needs to work with any patch (s...
WmFunctionApplicator * _parent
Parent function applicator.
Definition: wmfunctionapplicator.h:238
int _vspace_dims
Definition: wmfunctionapplicator.h:262
std::vector< real > _vspace_dv
Definition: wmfunctionapplicator.h:268
std::vector< real > _vspace_minimums
Definition: wmfunctionapplicator.h:265
std::vector< int > _vspace_nelems
Definition: wmfunctionapplicator.h:259
std::string _phase_space_order
Definition: wmfunctionapplicator.h:256
WmICFunction * _function
Function to apply.
Definition: wmfunctionapplicator.h:253
~applicator_t()
Destroy applicator_t.
The WmFunctionApplicator class generates initial conditions.
Definition: wmfunctionapplicator.h:44
~WmFunctionApplicator()
Destroy WmFunctionApplicator host action.
WxStepperStatus step()
Step the solver by assigned time step.
std::vector< applicator_t * > applicators_t
Definition: wmfunctionapplicator.h:272
bool needsDomain() const
Return false because icGenerator is not yet setup for structured grids.
Definition: wmfunctionapplicator.h:318
WmFunctionApplicator(const WmConstOpaquePtr &parent_solver)
Create new WmFunctionApplicator host action.
virtual void typeCheck()
check that variable types are appropriate for this HostAction.
std::vector< WmICFunction * > functions_t
Definition: wmfunctionapplicator.h:271
void setup(const WxCryptSet &wxc)
Setup HostAction object using supplied cryptset.
The WmHostAction class is a base class for sub-solvers in the WARPXM system.
Definition: wmhostaction.h:35
Base class for functions used in generating initial conditions.
Definition: wmicfunction.h:25
A base class for solvers in WARPM.
Definition: wmsolverbase.h:35
Definition: wmunstructuredpatch.h:22
WxCryptSet extends WxCrypt by providing, in addition to name-value pairs, an set of named WxCryptSets...
Definition: wxcryptset.h:35
virtual std::string name() const
Get name of object.
Represents important parameters for the efficacy of a completing simulation step.
Definition: wxstepperstatus.h:19
Definition: array.h:190
Defines an interface for variables that exits over distributed memory.
Definition: distributed_variable.h:28
virtual wxm::array::patch_array_t & patch_array(const int component_index, const int patch_index)=0
Aquire a patch array for a specified component.