46 #ifndef MUELU_REFMAXWELL_DECL_HPP
47 #define MUELU_REFMAXWELL_DECL_HPP
61 #ifdef HAVE_MUELU_KOKKOS_REFACTOR
78 #include "MueLu_TrilinosSmoother.hpp"
79 #include "MueLu_Hierarchy.hpp"
81 #include "Xpetra_Map_fwd.hpp"
82 #include "Xpetra_Matrix_fwd.hpp"
83 #include "Xpetra_MatrixFactory_fwd.hpp"
84 #include "Xpetra_MultiVectorFactory_fwd.hpp"
85 #include "Xpetra_VectorFactory_fwd.hpp"
86 #include "Xpetra_CrsMatrixWrap_fwd.hpp"
88 #if defined(HAVE_MUELU_IFPACK2) && (!defined(HAVE_MUELU_EPETRA) || defined(HAVE_MUELU_INST_DOUBLE_INT_INT))
90 #include "Ifpack2_Hiptmair.hpp"
127 #undef MUELU_REFMAXWELL_SHORT
132 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType
magnitudeType;
145 RefMaxwell(Teuchos::RCP<Hierarchy> HH, Teuchos::RCP<Hierarchy> H22) :
166 const Teuchos::RCP<Matrix> & D0_Matrix,
167 const Teuchos::RCP<Matrix> & Ms_Matrix,
168 const Teuchos::RCP<Matrix> & M0inv_Matrix,
169 const Teuchos::RCP<Matrix> & M1_Matrix,
170 const Teuchos::RCP<MultiVector> & Nullspace,
171 const Teuchos::RCP<RealValuedMultiVector> & Coords,
172 Teuchos::ParameterList& List,
173 bool ComputePrec =
true)
175 initialize(D0_Matrix,Ms_Matrix,M0inv_Matrix,M1_Matrix,Nullspace,Coords,List);
191 const Teuchos::RCP<Matrix> & D0_Matrix,
192 const Teuchos::RCP<Matrix> & M0inv_Matrix,
193 const Teuchos::RCP<Matrix> & M1_Matrix,
194 const Teuchos::RCP<MultiVector> & Nullspace,
195 const Teuchos::RCP<RealValuedMultiVector> & Coords,
196 Teuchos::ParameterList& List,
197 bool ComputePrec =
true)
199 initialize(D0_Matrix,M1_Matrix,M0inv_Matrix,M1_Matrix,Nullspace,Coords,List);
213 const Teuchos::RCP<Matrix> & M0inv_Matrix,
214 const Teuchos::RCP<Matrix> & M1_Matrix,
215 const Teuchos::RCP<MultiVector> & Nullspace,
216 const Teuchos::RCP<RealValuedMultiVector> & Coords,
219 initialize(D0_Matrix,M1_Matrix,M0inv_Matrix,M1_Matrix,Nullspace,Coords,List);
233 const Teuchos::RCP<Matrix> & D0_Matrix,
234 const Teuchos::RCP<Matrix> & M1_Matrix,
235 const Teuchos::RCP<MultiVector> & Nullspace,
236 const Teuchos::RCP<RealValuedMultiVector> & Coords,
237 Teuchos::ParameterList& List,
240 initialize(D0_Matrix,M1_Matrix,Teuchos::null,M1_Matrix,Nullspace,Coords,List);
253 const Teuchos::RCP<Matrix> & M1_Matrix,
254 const Teuchos::RCP<MultiVector> & Nullspace,
255 const Teuchos::RCP<RealValuedMultiVector> & Coords,
258 initialize(D0_Matrix,M1_Matrix,Teuchos::null,M1_Matrix,Nullspace,Coords,List);
268 Teuchos::ParameterList& List,
269 bool ComputePrec =
true)
272 RCP<MultiVector> Nullspace = List.get<RCP<MultiVector> >(
"Nullspace", Teuchos::null);
273 RCP<RealValuedMultiVector> Coords = List.get<RCP<RealValuedMultiVector> >(
"Coordinates", Teuchos::null);
274 RCP<Matrix> D0_Matrix = List.get<RCP<Matrix> >(
"D0");
275 RCP<Matrix> Ms_Matrix;
276 if (List.isType<Matrix>(
"Ms"))
277 Ms_Matrix = List.get<RCP<Matrix> >(
"Ms");
279 Ms_Matrix = List.get<RCP<Matrix> >(
"M1");
280 RCP<Matrix> M1_Matrix = List.get<RCP<Matrix> >(
"M1");
281 RCP<Matrix> M0inv_Matrix = List.get<RCP<Matrix> >(
"M0inv", Teuchos::null);
283 initialize(D0_Matrix,Ms_Matrix,M0inv_Matrix,M1_Matrix,Nullspace,Coords,List);
285 if (SM_Matrix != Teuchos::null)
307 void compute(
bool reuse=
false);
316 void resetMatrix(Teuchos::RCP<Matrix> SM_Matrix_new,
bool ComputePrec=
true);
321 void apply (
const MultiVector& X, MultiVector& Y,
322 Teuchos::ETransp mode = Teuchos::NO_TRANS,
323 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
324 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero())
const;
329 #ifdef HAVE_MUELU_DEPRECATED_CODE
330 template <
class NewNode>
331 Teuchos::RCP< RefMaxwell<Scalar, LocalOrdinal, GlobalOrdinal, NewNode> >
333 clone (
const RCP<NewNode>& new_node)
const {
340 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::VERB_HIGH)
const;
354 void initialize(
const Teuchos::RCP<Matrix> & D0_Matrix,
355 const Teuchos::RCP<Matrix> & Ms_Matrix,
356 const Teuchos::RCP<Matrix> & M0inv_Matrix,
357 const Teuchos::RCP<Matrix> & M1_Matrix,
358 const Teuchos::RCP<MultiVector> & Nullspace,
359 const Teuchos::RCP<RealValuedMultiVector> & Coords,
360 Teuchos::ParameterList& List);
372 void solveH(
const MultiVector& RHS, MultiVector& X)
const;
375 void solve22(
const MultiVector& RHS, MultiVector& X)
const;
380 #if defined(HAVE_MUELU_IFPACK2) && (!defined(HAVE_MUELU_EPETRA) || defined(HAVE_MUELU_INST_DOUBLE_INT_INT))
381 Teuchos::RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > hiptmairPreSmoother_, hiptmairPostSmoother_;
388 #ifdef HAVE_MUELU_KOKKOS_REFACTOR
414 #define MUELU_REFMAXWELL_SHORT
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Static class that holds the complete list of valid MueLu parameters.
Preconditioner (wrapped as a Xpetra::Operator) for Maxwell's equations in curl-curl form.
Teuchos::RCP< MultiVector > P11resTmp_
Teuchos::RCP< SmootherBase > PreSmoother_
Teuchos::RCP< MultiVector > P11x_
Teuchos::RCP< MultiVector > residual_
Teuchos::RCP< Matrix > D0_Matrix_
Teuchos::RCP< Teuchos::ParameterList > A22_AP_reuse_data_
Teuchos::RCP< MultiVector > P11res_
Temporary memory.
Teuchos::ArrayRCP< const bool > BCcols_
RefMaxwell(const Teuchos::RCP< Matrix > &D0_Matrix, const Teuchos::RCP< Matrix > &M1_Matrix, const Teuchos::RCP< MultiVector > &Nullspace, const Teuchos::RCP< RealValuedMultiVector > &Coords, Teuchos::ParameterList &List)
Teuchos::RCP< MultiVector > D0xTmp_
Teuchos::RCP< RealValuedMultiVector > Coords_
Coordinates.
void formCoarseMatrix()
Compute P11^{T}*A*P11 efficiently.
Teuchos::RCP< Matrix > AH_
Teuchos::RCP< Matrix > M0inv_Matrix_
RefMaxwell(const Teuchos::RCP< Matrix > &SM_Matrix, const Teuchos::RCP< Matrix > &D0_Matrix, const Teuchos::RCP< Matrix > &M1_Matrix, const Teuchos::RCP< MultiVector > &Nullspace, const Teuchos::RCP< RealValuedMultiVector > &Coords, Teuchos::ParameterList &List, bool ComputePrec)
Teuchos::RCP< MultiVector > D0x_
Teuchos::RCP< Matrix > SM_Matrix_
Various matrices.
Teuchos::RCP< Teuchos::ParameterList > AH_AP_reuse_data_
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_HIGH) const
void initialize(const Teuchos::RCP< Matrix > &D0_Matrix, const Teuchos::RCP< Matrix > &Ms_Matrix, const Teuchos::RCP< Matrix > &M0inv_Matrix, const Teuchos::RCP< Matrix > &M1_Matrix, const Teuchos::RCP< MultiVector > &Nullspace, const Teuchos::RCP< RealValuedMultiVector > &Coords, Teuchos::ParameterList &List)
Teuchos::RCP< Matrix > D0_T_Matrix_
int BCrowcount_
Vectors for BCs.
Teuchos::ParameterList smootherList_
Teuchos::RCP< MultiVector > D0res_
void apply(const MultiVector &X, MultiVector &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Teuchos::ArrayRCP< const bool > BCrows_
Teuchos::RCP< Teuchos::ParameterList > A22_RAP_reuse_data_
bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
bool disable_addon_
Some options.
void solveH(const MultiVector &RHS, MultiVector &X) const
apply solve to 1-1 block only
Teuchos::ParameterList precList22_
Teuchos::RCP< MultiVector > P11xTmp_
Teuchos::RCP< const Import > ImporterH_
Importer to coarse (1,1) hierarchy.
RefMaxwell(const Teuchos::RCP< Matrix > &SM_Matrix, const Teuchos::RCP< Matrix > &D0_Matrix, const Teuchos::RCP< Matrix > &M0inv_Matrix, const Teuchos::RCP< Matrix > &M1_Matrix, const Teuchos::RCP< MultiVector > &Nullspace, const Teuchos::RCP< RealValuedMultiVector > &Coords, Teuchos::ParameterList &List, bool ComputePrec=true)
Teuchos::RCP< Matrix > A22_
Teuchos::RCP< Matrix > R11_
Teuchos::ScalarTraits< Scalar >::magnitudeType magnitudeType
void applyInverse121(const MultiVector &RHS, MultiVector &X) const
apply 1-2-1 algorithm for 2x2 solve
Teuchos::RCP< const Import > Importer22_
void buildProlongator()
Setup the prolongator for the (1,1)-block.
Teuchos::RCP< Teuchos::ParameterList > AH_RAP_reuse_data_
Teuchos::RCP< Matrix > A_nodal_Matrix_
Teuchos::RCP< Matrix > P11_
RefMaxwell(Teuchos::RCP< Hierarchy > HH, Teuchos::RCP< Hierarchy > H22)
Constructor with Hierarchies.
virtual ~RefMaxwell()
Destructor.
bool use_as_preconditioner_
const Teuchos::RCP< Matrix > & getJacobian() const
Returns Jacobian matrix SM.
Teuchos::RCP< Hierarchy > Hierarchy22_
Teuchos::RCP< SmootherBase > PostSmoother_
Teuchos::RCP< MultiVector > D0resTmp_
Teuchos::RCP< Matrix > Addon_Matrix_
Teuchos::RCP< Matrix > M1_Matrix_
Xpetra::MultiVector< magnitudeType, LO, GO, NO > RealValuedMultiVector
void applyInverseAdditive(const MultiVector &RHS, MultiVector &X) const
apply additive algorithm for 2x2 solve
RefMaxwell(const Teuchos::RCP< Matrix > &SM_Matrix, Teuchos::ParameterList &List, bool ComputePrec=true)
RefMaxwell(const Teuchos::RCP< Matrix > &D0_Matrix, const Teuchos::RCP< Matrix > &M0inv_Matrix, const Teuchos::RCP< Matrix > &M1_Matrix, const Teuchos::RCP< MultiVector > &Nullspace, const Teuchos::RCP< RealValuedMultiVector > &Coords, Teuchos::ParameterList &List)
Teuchos::RCP< const Map > getRangeMap() const
Returns the Xpetra::Map object associated with the range of this operator.
Teuchos::RCP< RealValuedMultiVector > CoordsH_
void compute(bool reuse=false)
Setup the preconditioner.
Teuchos::RCP< Hierarchy > HierarchyH_
Two hierarchies: one for the coarse (1,1)-block, another for the (2,2)-block.
Teuchos::ParameterList precList11_
Teuchos::RCP< Matrix > Ms_Matrix_
RefMaxwell(const Teuchos::RCP< Matrix > &SM_Matrix, const Teuchos::RCP< Matrix > &D0_Matrix, const Teuchos::RCP< Matrix > &Ms_Matrix, const Teuchos::RCP< Matrix > &M0inv_Matrix, const Teuchos::RCP< Matrix > &M1_Matrix, const Teuchos::RCP< MultiVector > &Nullspace, const Teuchos::RCP< RealValuedMultiVector > &Coords, Teuchos::ParameterList &List, bool ComputePrec=true)
Teuchos::ParameterList parameterList_
Parameter lists.
bool useHiptmairSmoothing_
void resetMatrix(Teuchos::RCP< Matrix > SM_Matrix_new, bool ComputePrec=true)
Reset system matrix.
void setParameters(Teuchos::ParameterList &list)
Set parameters.
Teuchos::RCP< MultiVector > Nullspace_
Nullspace.
void applyInverse212(const MultiVector &RHS, MultiVector &X) const
apply 2-1-2 algorithm for 2x2 solve
void solve22(const MultiVector &RHS, MultiVector &X) const
apply solve to 2-2 block only
Teuchos::RCP< const Map > getDomainMap() const
Returns the Xpetra::Map object associated with the domain of this operator.
Verbose class for MueLu classes.
Namespace for MueLu classes and methods.