WARPXM v1.10.0
Loading...
Searching...
No Matches
wmtemporalsolver.h
Go to the documentation of this file.
1#ifndef WM_TEMPORALSOLVER_H
2#define WM_TEMPORALSOLVER_H
3
4#include "sync/synchronizer.h"
5#include "wmhostaction.h"
6
7#include <memory>
8#include <vector>
9#include <array>
10#include <numeric>
11
12namespace wxm
13{
14namespace variable
15{
16class distributed_variable_t;
17}
18namespace dfem
19{
20namespace variable_adjuster
21{
22class variable_adjuster_t;
23}
24namespace solver
25{
26class spatial_solver_t;
27}
28} // namespace dfem
29
34{
35 // all spatial operators/variable adjusters are patch processes
36 std::vector<std::unique_ptr<WmHostAction>> processors_;
37
38 bool add_variables(const WxCryptSet& wxc, const std::string& name);
39
40 // all local patch synchronizers
41 std::vector<std::vector<std::unique_ptr<wxm::sync::patch_synchronizer_t>>>
42 synchronizers_;
43
44public:
45 // pair of variable/component
46 typedef std::vector<std::pair<wxm::variable::distributed_variable_t*, size_t>>
48
50 {
51 size_t index;
53 // full range
54 const WxRange* range;
55 size_t num_dof;
56
59 const WxRange* full,
60 size_t num_dof)
62 {
63 }
64 };
65
66 const std::vector<wxm::dfem::variable_adjuster::variable_adjuster_t*>&
68 {
69 return adjusters_;
70 }
71
80 std::vector<variables_type>& getVariables()
81 {
82 return variables_;
83 }
84
85protected:
86 // variable adjusters to be run, in sorted order
87 std::vector<wxm::dfem::variable_adjuster::variable_adjuster_t*> adjusters_;
88
89 // priorities of the various variable adjusters
90 std::vector<int> va_priorities;
91
93 // maximum number of variable adjuster priority levels
95
96 // spatial solvers to run
97 std::vector<wxm::dfem::solver::spatial_solver_t*> spatial_solvers_;
98
99 // pair of distributed variable and component index
100 std::vector<variables_type> variables_;
101
102 // indices of variables which change in time
103 std::vector<temporal_var> temporal_vars_;
104
105public:
106 temporal_solver(const WmConstOpaquePtr& parent_solver) : WmHostAction(parent_solver)
107 {
108 }
109
110 void setup(const WxCryptSet& wxc) override;
111
112 bool needsDomain() const override
113 {
114 return false;
115 }
116
120 void start_sync(size_t i);
121
125 void finish_sync(size_t i);
126
131 void fill_local(size_t i, real val = 0);
132
133protected:
134 void typeCheck() override;
135};
136} // namespace wxm
137
138#endif
Opaque Pointer object that carries the referenced data type, but does not expose this payload type as...
Definition: wmopaqueptr.h:81
The WmHostAction class is a base class for sub-solvers in the WARPXM system.
Definition: wmhostaction.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.
WxRange represents a hyper-rectangular domain of an n-dimensional space of integers.
Definition: wxrange.h:23
Base class for all temporal solvers.
Definition: wmtemporalsolver.h:34
int min_priority
Definition: wmtemporalsolver.h:92
void fill_local(size_t i, real val=0)
fill the temporal variables associated with stage i with the given value
std::vector< std::pair< wxm::variable::distributed_variable_t *, size_t > > variables_type
Definition: wmtemporalsolver.h:47
const std::vector< wxm::dfem::variable_adjuster::variable_adjuster_t * > & getVariableAdjusters() const
Definition: wmtemporalsolver.h:67
std::vector< wxm::dfem::solver::spatial_solver_t * > spatial_solvers_
Definition: wmtemporalsolver.h:97
void start_sync(size_t i)
Asynchronously start syncing ghost cell data on stage i.
void typeCheck() override
Check that the provided variables meet the expected variable types for this hostaction.
void setup(const WxCryptSet &wxc) override
Setup hostaction object using supplied cryptset.
void finish_sync(size_t i)
wait for syncing on stage i to finish
temporal_solver(const WmConstOpaquePtr &parent_solver)
Definition: wmtemporalsolver.h:106
std::vector< wxm::dfem::variable_adjuster::variable_adjuster_t * > adjusters_
Definition: wmtemporalsolver.h:87
std::vector< variables_type > variables_
Definition: wmtemporalsolver.h:100
std::vector< variables_type > & getVariables()
This function grabs the variables owned by this temporal solver.
Definition: wmtemporalsolver.h:80
std::vector< temporal_var > temporal_vars_
Definition: wmtemporalsolver.h:103
int max_priority
Definition: wmtemporalsolver.h:94
bool needsDomain() const override
Return true if this updater needs a domain to work on.
Definition: wmtemporalsolver.h:112
std::vector< int > va_priorities
Definition: wmtemporalsolver.h:90
Base namespace for everything not included in the global namespace.
Definition: field_source.h:8
Definition: wmtemporalsolver.h:50
size_t num_dof
Definition: wmtemporalsolver.h:55
const WxRange * range
Definition: wmtemporalsolver.h:54
size_t index
Definition: wmtemporalsolver.h:51
temporal_var(size_t index, const WmUnstructuredPatch *patch, const WxRange *full, size_t num_dof)
Definition: wmtemporalsolver.h:57
const WmUnstructuredPatch * patch
Definition: wmtemporalsolver.h:52
#define real
Definition: wmoclunstructuredreconstruction.h:11