21std::unique_ptr<const Operator> FilteredSolver::GetPtAP(
const Operator *Aop,
22 const Operator *Pop)
const
25 const HypreParMatrix * Ah =
dynamic_cast<const HypreParMatrix*
>(Aop);
26 const HypreParMatrix * Ph =
dynamic_cast<const HypreParMatrix*
>(Pop);
27 if (Ah && Ph) {
return std::unique_ptr<const Operator>(
RAP(Ah, Ph)); }
30 PetscParMatrix* Ap =
const_cast<PetscParMatrix*
>(
31 dynamic_cast<const PetscParMatrix*
>(Aop));
32 PetscParMatrix* Pp =
const_cast<PetscParMatrix*
>(
33 dynamic_cast<const PetscParMatrix*
>(Pop));
34 if (Ap && Pp) {
return std::unique_ptr<const Operator>(
RAP(Ap, Pp)); }
36 const SparseMatrix * Asp =
dynamic_cast<const SparseMatrix*
>(Aop);
37 const SparseMatrix * Psp =
dynamic_cast<const SparseMatrix*
>(Pop);
38 if (Asp && Psp) {
return std::unique_ptr<const Operator>(
RAP(*Asp, *Psp)); }
40 return std::unique_ptr<const Operator>(
new RAPOperator(*Pop, *Aop, *Pop));
45 MFEM_VERIFY(
A,
"Operator not set");
46 MFEM_VERIFY(
P,
"Transfer operator not set");
47 MFEM_VERIFY(
B,
"Solver is not set.");
48 MFEM_VERIFY(
S,
"Filtered space solver is not set.");
60void FilteredSolver::MakeSolver()
const
106 MFEM_VERIFY(
b.Size() == x.
Size(),
"Inconsistent b and x size");
145 MFEM_VERIFY(Ah,
"AMGFSolver::SetOperator: HypreParMatrix expected.");
void SetFilteredSubspaceTransferOperator(const HypreParMatrix &Pop)
Set the parallel transfer operator P for the filtered subspace.
virtual void SetOperator(const Operator &A) override
Set the system operator A.
std::unique_ptr< const Operator > PtAP
Projected operator.
void Mult(const Vector &x, Vector &y) const override
Apply the filtered solver.
const Operator * P
Transfer operator (not owned).
virtual void SetOperator(const Operator &A) override
Set the system operator A.
void SetFilteredSubspaceTransferOperator(const Operator &P)
Set the transfer operator P from filtered subspace to the full space.
Solver * B
Base solver (not owned).
Solver * S
Subspace solver (not owned).
void InitVectors() const
Initialize work vectors.
void SetFilteredSubspaceSolver(Solver &S)
Set a solver S that operates on the filtered subspace operator .
const Operator * A
System operator (not owned).
virtual void SetSolver(Solver &B)
Set the solver B that operates on the full space.
Wrapper for hypre's ParCSR matrix class.
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
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 ...
virtual void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const
Operator application: y+=A(x) (default) or y+=a*A(x).
virtual void SetOperator(const Operator &op)=0
Set/update the solver for the given operator.
int Size() const
Returns the size of the vector.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
void SetSize(int s)
Resize the vector to size s.
void RAP(const DenseMatrix &A, const DenseMatrix &P, DenseMatrix &RAP)