Go to the documentation of this file.
21 #ifndef THUNDEREGG_ITERATIVE_PATCHSOLVER_H
22 #define THUNDEREGG_ITERATIVE_PATCHSOLVER_H
53 class SinglePatchOp :
public Operator<D>
59 std::shared_ptr<const PatchOperator<D>> op;
80 op->applySinglePatchWithInternalBoundaryConditions(pinfo, x_view, b_view);
87 SinglePatchOp*
clone()
const override {
return new SinglePatchOp(*
this); }
93 std::shared_ptr<const Solver<D>> solver;
98 std::shared_ptr<const PatchOperator<D>> op;
103 bool continue_on_breakdown;
122 bool continue_on_breakdown =
false)
124 , solver(solver.
clone())
126 , continue_on_breakdown(continue_on_breakdown)
138 SinglePatchOp single_op(pinfo, op);
140 std::array<int, D + 1> f_lengths;
141 for (
int i = 0; i < D + 1; i++) {
142 f_lengths[i] = f_view.
getEnd()[i] + 1;
150 std::array<int, D + 1> u_lengths;
151 for (
int i = 0; i < D + 1; i++) {
152 u_lengths[i] = u_view.
getEnd()[i] + 1;
161 f_copy.
copy(f_single);
162 op->modifyRHSForInternalBoundaryConditions(pinfo, u_view, f_copy.
getPatchView(0));
166 iterations = solver->solve(single_op, u_single, f_copy);
168 if (!continue_on_breakdown) {
173 this->
getDomain().getTimer()->addIntInfo(
"Iterations", iterations);
const Domain< D > & getDomain() const
Get the Domain object.
Definition: PatchSolver.h:84
virtual void apply(const Vector< D > &f, Vector< D > &u) const override
Solve all the patches in the domain, assuming zero boundary conditions for the patches.
Definition: PatchSolver.h:107
const std::array< int, D > & getStrides() const
Get the strides of the patch in each direction.
Definition: View.h:203
Solves the problem on the patches using a specified interface value.
Definition: PatchSolver.h:42
Breakdown exception for iterative methods.
Definition: BreakdownError.h:35
const std::array< int, D > & getGhostStart() const
Get the coordinate of the first ghost cell element.
Definition: View.h:215
void solveSinglePatch(const PatchInfo< D > &pinfo, const PatchView< const double, D > &f_view, const PatchView< double, D > &u_view) const override
Perform a single solve over a patch.
Definition: PatchSolver.h:134
PatchSolver(const Iterative::Solver< D > &solver, const PatchOperator< D > &op, bool continue_on_breakdown=false)
Construct a new IterativePatchSolver object.
Definition: PatchSolver.h:120
Iterative Solvers.
Definition: BiCGStab.h:34
Solves the patches using an iterative Solver on each patch.
Definition: PatchSolver.h:46
View for accessing data of a patch. It supports variable striding.
Definition: PatchView.h:37
The ThunderEgg namespace.
Definition: BiLinearGhostFiller.h:31
void copy(const Vector< D > &b)
copy the values of the other vector
Definition: Vector.h:443
const std::array< int, D > & getEnd() const
Get the coordinate of the last element.
Definition: View.h:211
Contains metadata for a patch.
Definition: PatchInfo.h:51
const GhostFiller< D > & getGhostFiller() const
Get the GhostFiller object.
Definition: PatchSolver.h:90
This is an Operator where derived classes only have to implement the two virtual functions that opera...
Definition: PatchOperator.h:40
Base class for operators.
Definition: Operator.h:37
PatchView< double, D > getPatchView(int patch_local_index)
Get the View objects for the specified patch index of View object will correspond to component index.
Definition: Vector.h:358
wrapper arount MPI_Comm, provides proper copy operators. Classes that have a communicator are meant t...
Definition: Communicator.h:36
Abstract interface for Iterative solvers.
Definition: Solver.h:39
Vector class for use in thunderegg.
Definition: Vector.h:42
Vector< D > getZeroClone() const
Get a vector of the same length initialized to zero.
Definition: Vector.h:601
PatchSolver< D > * clone() const override
Clone this patch solver.
Definition: PatchSolver.h:133