18 : cycleType(
CycleType::VCYCLE), preSmoothingSteps(1), postSmoothingSteps(1)
28 preSmoothingSteps(1), postSmoothingSteps(1),
29 X(operators_.Size()), Y(X.Size()), R(X.Size()), Z(X.Size())
38 for (
int level = 0; level <
operators.Size(); ++level)
53 for (
int i = 0; i <
operators.Size(); ++i)
141 int postSmoothingSteps_)
159 MFEM_ABORT(
"SetOperator not supported in Multigrid");
162 void Multigrid::SmoothingStep(
int level,
bool transpose)
const
174 add(*
Y[level], 1.0, *
Z[level], *
Y[level]);
177 void Multigrid::Cycle(
int level)
const
187 SmoothingStep(level,
false);
195 GetProlongationAtLevel(level - 1)->
MultTranspose(*
R[level], *
X[level - 1]);
206 for (
int correction = 0; correction < corrections; ++correction)
212 GetProlongationAtLevel(level - 1)->
Mult(*
Y[level - 1], *
R[level]);
215 *
Y[level] += *
R[level];
220 SmoothingStep(level,
true);
224 const Operator* Multigrid::GetProlongationAtLevel(
int level)
const
231 for (
int i = 0; i <
bfs.Size(); ++i)
256 bfs.Last()->RecoverFEMSolution(X, b, x);
259 const Operator* GeometricMultigrid::GetProlongationAtLevel(
int level)
const
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
virtual ~GeometricMultigrid()
Destructor.
Pointer to an Operator of a specified type.
void Copy(Array ©) const
Create a copy of the internal array to the provided copy.
Array< BilinearForm * > bfs
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
void add(const Vector &v1, const Vector &v2, Vector &v)
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Array< Array< int > * > essentialTrueDofs
Array< Operator * > prolongations
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Append(const T &el)
Append element 'el' to array, resize if necessary.
const FiniteElementSpaceHierarchy & fespaces
Array< bool > ownedProlongations
virtual void SetOperator(const Operator &op) override
Not supported for multigrid.
int NumRows() const
Get the number of rows (size of output) of the Operator. Synonym with Height().
void subtract(const Vector &x, const Vector &y, Vector &z)
virtual ~Multigrid()
Destructor.
Array< Solver * > smoothers
int height
Dimension of the output / number of rows in the matrix.
void AddLevel(Operator *opr, Solver *smoother, bool ownOperator, bool ownSmoother)
Adds a level to the multigrid operator hierarchy.
Solver * GetSmootherAtLevel(int level) const
Returns smoother at given level.
const Operator * GetOperatorAtFinestLevel() const
Returns operator at finest level.
virtual void Mult(const Vector &x, Vector &y) const override
Application of the multigrid as a preconditioner.
void RecoverFineFEMSolution(const Vector &X, const Vector &b, Vector &x)
Recover the solution of a linear system formed with FormFineLinearSystem()
int GetFinestLevelIndex() const
Returns the index of the finest level.
void FormFineLinearSystem(Vector &x, Vector &b, OperatorHandle &A, Vector &X, Vector &B)
int NumLevels() const
Returns the number of levels.
const Operator * GetOperatorAtLevel(int level) const
Returns operator at given level.
Array< Operator * > operators
Multigrid()
Constructs an empty multigrid hierarchy.
Array< bool > ownedSmoothers
Operator * GetProlongationAtLevel(int level) const
Returns the prolongation operator from the finite element space at level to the finite element space ...
Array< bool > ownedOperators
int width
Dimension of the input / number of columns in the matrix.
void SetCycleType(CycleType cycleType_, int preSmoothingSteps_, int postSmoothingSteps_)
Set cycle type and number of pre- and post-smoothing steps used by Mult.