12 std::vector<double>* y_ptr;
18 throw std::logic_error(
"SetGSPETScVecFromPrimarySTLvector");
29 auto psi = groupset.angle_agg_->GetNewDelayedAngularDOFsAsSTLVector();
31 groupset.angle_agg_->SetNewDelayedAngularDOFsFromSTLVector(psi);
36 auto psi = groupset.angle_agg_->GetOldDelayedAngularDOFsAsSTLVector();
38 groupset.angle_agg_->SetOldDelayedAngularDOFsFromSTLVector(psi);
50 const std::vector<double>* y_ptr;
56 throw std::logic_error(
"SetGSPETScVecFromPrimarySTLvector");
60 VecGetArray(x,&x_ref);
62 int gsi = groupset.
groups_.front().id_;
63 int gsf = groupset.
groups_.back().id_;
67 for (
const auto& cell : grid_ptr_->local_cells)
69 auto& transport_view = cell_transport_views_[cell.local_id_];
71 for (
int i=0; i < cell.vertex_ids_.size(); i++)
73 for (
int m=0; m < num_moments_; m++)
75 size_t mapping = transport_view.MapDOF(i,m,gsi);
76 for (
int g=0; g<gss; g++)
79 x_ref[index] = (*y_ptr)[mapping+g];
88 groupset.
angle_agg_->AppendNewDelayedAngularDOFsToArray(index, x_ref);
91 groupset.
angle_agg_->AppendOldDelayedAngularDOFsToArray(index, x_ref);
95 VecRestoreArray(x,&x_ref);
104 std::vector<double>* y_ptr;
110 throw std::logic_error(
"SetPrimarySTLvectorFromGSPETScVec");
114 VecGetArrayRead(x_src,&x_ref);
116 int gsi = groupset.
groups_.front().id_;
117 int gsf = groupset.
groups_.back().id_;
121 for (
const auto& cell : grid_ptr_->local_cells)
123 auto& transport_view = cell_transport_views_[cell.local_id_];
125 for (
int i=0; i < cell.vertex_ids_.size(); i++)
127 for (
int m=0; m < num_moments_; m++)
129 size_t mapping = transport_view.MapDOF(i,m,gsi);
130 for (
int g=0; g<gss; g++)
133 (*y_ptr)[mapping+g] = x_ref[index];
142 groupset.
angle_agg_->SetNewDelayedAngularDOFsFromArray(index, x_ref);
145 groupset.
angle_agg_->SetOldDelayedAngularDOFsFromArray(index, x_ref);
148 VecRestoreArrayRead(x_src,&x_ref);
158 std::vector<double>* y_ptr;
159 switch (to_which_phi)
164 throw std::logic_error(
"GSScopedCopyPrimarySTLvectors");
167 std::vector<double>* x_src_ptr;
168 switch (from_which_phi)
173 throw std::logic_error(
"GSScopedCopyPrimarySTLvectors");
176 int gsi = groupset.
groups_.front().id_;
177 size_t gss = groupset.
groups_.size();
179 for (
const auto& cell : grid_ptr_->local_cells)
181 auto& transport_view = cell_transport_views_[cell.local_id_];
183 for (
int i=0; i < cell.vertex_ids_.size(); i++)
185 for (
int m=0; m < num_moments_; m++)
187 size_t mapping = transport_view.MapDOF(i,m,gsi);
188 for (
int g=0; g<gss; g++)
190 (*y_ptr)[mapping+g] = (*x_src_ptr)[mapping+g];
210 const std::vector<double>* y_ptr;
216 throw std::logic_error(
"SetMultiGSPETScVecFromPrimarySTLvector");
220 VecGetArray(x,&x_ref);
223 for (
int gs_id : gs_ids)
225 auto& groupset = groupsets_.at(gs_id);
227 int gsi = groupset.groups_.front().id_;
228 int gsf = groupset.groups_.back().id_;
231 for (
const auto& cell : grid_ptr_->local_cells)
233 auto& transport_view = cell_transport_views_[cell.local_id_];
235 for (
int i=0; i < cell.vertex_ids_.size(); i++)
237 for (
int m=0; m < num_moments_; m++)
239 size_t mapping = transport_view.MapDOF(i,m,gsi);
240 for (
int g=0; g<gss; g++)
243 x_ref[index] = (*y_ptr)[mapping+g];
252 groupset.angle_agg_->AppendNewDelayedAngularDOFsToArray(index, x_ref);
255 groupset.angle_agg_->AppendOldDelayedAngularDOFsToArray(index, x_ref);
260 VecRestoreArray(x,&x_ref);
270 std::vector<double>* y_ptr;
276 throw std::logic_error(
"SetPrimarySTLvectorFromMultiGSPETScVecFrom");
280 VecGetArrayRead(x_src,&x_ref);
283 for (
int gs_id : gs_ids)
285 auto& groupset = groupsets_.at(gs_id);
287 int gsi = groupset.groups_.front().id_;
288 int gsf = groupset.groups_.back().id_;
291 for (
const auto& cell : grid_ptr_->local_cells)
293 auto& transport_view = cell_transport_views_[cell.local_id_];
295 for (
int i=0; i < cell.vertex_ids_.size(); i++)
297 for (
int m=0; m < num_moments_; m++)
299 size_t mapping = transport_view.MapDOF(i,m,gsi);
300 for (
int g=0; g<gss; g++)
303 (*y_ptr)[mapping+g] = x_ref[index];
312 groupset.angle_agg_->SetNewDelayedAngularDOFsFromArray(index, x_ref);
315 groupset.angle_agg_->SetOldDelayedAngularDOFsFromArray(index, x_ref);
319 VecRestoreArrayRead(x_src,&x_ref);
void SetGSPETScVecFromPrimarySTLvector(LBSGroupset &groupset, Vec x, PhiSTLOption which_phi) override
void SetPrimarySTLvectorFromGSPETScVec(LBSGroupset &groupset, Vec x_src, PhiSTLOption which_phi) override
void SetMultiGSPETScVecFromPrimarySTLvector(const std::vector< int > &gs_ids, Vec x, PhiSTLOption which_phi) override
void GSScopedCopyPrimarySTLvectors(LBSGroupset &groupset, PhiSTLOption from_which_phi, PhiSTLOption to_which_phi) override
void SetPrimarySTLvectorFromMultiGSPETScVecFrom(const std::vector< int > &gs_ids, Vec x_src, PhiSTLOption which_phi) override
void ScalePhiVector(PhiSTLOption which_phi, double value) override
std::vector< LBSGroup > groups_
std::vector< double > phi_new_local_
std::vector< double > phi_old_local_
std::vector< LBSGroupset > groupsets_
void Scale(VecDbl &x, const double &val)