10 #ifndef THYRA_MUELU_TPETRA_Q2Q1PRECONDITIONER_FACTORY_DEF_HPP
11 #define THYRA_MUELU_TPETRA_Q2Q1PRECONDITIONER_FACTORY_DEF_HPP
13 #ifdef HAVE_MUELU_EXPERIMENTAL
17 #include <Thyra_DefaultPreconditioner.hpp>
18 #include <Thyra_TpetraLinearOp.hpp>
19 #include <Thyra_TpetraThyraWrappers.hpp>
21 #include <Teuchos_Ptr.hpp>
23 #include <Teuchos_Assert.hpp>
25 #include <Teuchos_FancyOStream.hpp>
28 #include <Teko_Utilities.hpp>
31 #include <Xpetra_CrsMatrixWrap.hpp>
39 #include "../../research/q2q1/MueLu_Q2Q1PFactory.hpp"
40 #include "../../research/q2q1/MueLu_Q2Q1uPFactory.hpp"
42 #include "MueLu_AmalgamationFactory.hpp"
44 #include "MueLu_BlockedDirectSolver.hpp"
45 #include "MueLu_BlockedPFactory.hpp"
46 #include "MueLu_BlockedRAPFactory.hpp"
47 #include "MueLu_BraessSarazinSmoother.hpp"
48 #include "MueLu_CoalesceDropFactory.hpp"
49 #include "MueLu_ConstraintFactory.hpp"
51 #include "MueLu_DirectSolver.hpp"
52 #include "MueLu_EminPFactory.hpp"
53 #include "MueLu_FactoryManager.hpp"
54 #include "MueLu_FilteredAFactory.hpp"
55 #include "MueLu_GenericRFactory.hpp"
57 #include "MueLu_PatternFactory.hpp"
58 #include "MueLu_SchurComplementFactory.hpp"
59 #include "MueLu_SmootherFactory.hpp"
60 #include "MueLu_SmootherPrototype.hpp"
61 #include "MueLu_SubBlockAFactory.hpp"
62 #include "MueLu_TpetraOperator.hpp"
63 #include "MueLu_TrilinosSmoother.hpp"
69 #define MUELU_GPD(name, type, defaultValue) \
70 (paramList.isParameter(name) ? paramList.get<type>(name) : defaultValue)
79 using Teuchos::rcp_const_cast;
80 using Teuchos::rcp_dynamic_cast;
83 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
87 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
89 typedef Thyra ::TpetraLinearOp<SC, LO, GO, NO> ThyraTpetraLinOp;
101 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
104 return rcp(
new DefaultPreconditioner<SC>);
107 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
109 initializePrec(
const RCP<
const LinearOpSourceBase<Scalar> >& fwdOpSrc, PreconditionerBase<Scalar>* prec,
const ESupportSolveUse supportSolveUse)
const {
119 typedef Thyra::TpetraLinearOp<SC, LO, GO, NO> ThyraTpetraLinOp;
136 const RCP<TpetraCrsMat> tpetraFwdCrsMatNonConst = rcp_const_cast<TpetraCrsMat>(tpetraFwdCrsMat);
146 Teko::LinearOp thA11, thA12, thA21, thA11_9Pt;
149 paramList.remove(
"Coordinates");
153 paramList.remove(
"Nullspace");
157 paramList.remove(
"Velcoords");
161 paramList.remove(
"Prescoords");
165 paramList.remove(
"p2vMap");
167 if (paramList.isType<Teko::LinearOp>(
"A11")) {
168 thA11 = paramList.
get<Teko::LinearOp>(
"A11");
169 paramList.remove(
"A11");
171 if (paramList.isType<Teko::LinearOp>(
"A12")) {
172 thA12 = paramList.get<Teko::LinearOp>(
"A12");
173 paramList.remove(
"A12");
175 if (paramList.isType<Teko::LinearOp>(
"A21")) {
176 thA21 = paramList.get<Teko::LinearOp>(
"A21");
177 paramList.remove(
"A21");
179 if (paramList.isType<Teko::LinearOp>(
"A11_9Pt")) {
180 thA11_9Pt = paramList.get<Teko::LinearOp>(
"A11_9Pt");
181 paramList.remove(
"A11_9Pt");
185 const RCP<MueLuOperator> mueluPrecOp = Q2Q1MkPrecond(paramList, velCoords, presCoords, p2vMap, thA11, thA12, thA21, thA11_9Pt);
188 defaultPrec->initializeUnspecified(thyraPrecOp);
191 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
193 uninitializePrec(PreconditionerBase<Scalar>* prec,
RCP<
const LinearOpSourceBase<Scalar> >* fwdOp, ESupportSolveUse* supportSolveUse)
const {
203 *fwdOp = Teuchos::null;
206 if (supportSolveUse) {
208 *supportSolveUse = Thyra::SUPPORT_SOLVE_UNSPECIFIED;
211 defaultPrec->uninitialize();
215 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
218 paramList_ = paramList;
221 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
227 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
231 paramList_ = Teuchos::null;
232 return savedParamList;
235 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
241 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
252 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
259 const Teko::LinearOp& thA11,
const Teko::LinearOp& thA12,
const Teko::LinearOp& thA21,
const Teko::LinearOp& thA11_9Pt)
const {
286 RCP<TP_Op> TpetA11 = Thyra::TpetraOperatorVectorExtraction<SC, LO, GO, NO>::getTpetraOperator(ThNonConstA11);
287 RCP<TP_Op> TpetA21 = Thyra::TpetraOperatorVectorExtraction<SC, LO, GO, NO>::getTpetraOperator(ThNonConstA21);
288 RCP<TP_Op> TpetA12 = Thyra::TpetraOperatorVectorExtraction<SC, LO, GO, NO>::getTpetraOperator(ThNonConstA12);
289 RCP<TP_Op> TpetA11_9Pt = Thyra::TpetraOperatorVectorExtraction<SC, LO, GO, NO>::getTpetraOperator(ThNonConstA11_9Pt);
291 RCP<TP_Crs> TpetCrsA11 = rcp_dynamic_cast<TP_Crs>(TpetA11);
292 RCP<TP_Crs> TpetCrsA21 = rcp_dynamic_cast<TP_Crs>(TpetA21);
293 RCP<TP_Crs> TpetCrsA12 = rcp_dynamic_cast<TP_Crs>(TpetA12);
294 RCP<TP_Crs> TpetCrsA11_9Pt = rcp_dynamic_cast<TP_Crs>(TpetA11_9Pt);
316 GO indexBase = domainMap2->getIndexBase();
320 newRowElem2[i] = numVel + rangeElem2[i];
322 RCP<const Map> newRangeMap2 = MapFactory::Build(lib, numRows2, newRowElem2, indexBase, comm);
327 newColElem2[i] = numVel + domainElem2[i];
329 RCP<const Map> newDomainMap2 = MapFactory::Build(lib, numCols2, newColElem2, indexBase, comm);
331 RCP<Matrix> A_12 = MatrixFactory::Build(tmp_A_12->getRangeMap(), newDomainMap2, tmp_A_12->getLocalMaxNumRowEntries());
332 RCP<Matrix> A_21 = MatrixFactory::Build(newRangeMap2, tmp_A_21->getDomainMap(), tmp_A_21->getLocalMaxNumRowEntries());
334 RCP<CrsMatrix> A_11_crs = rcp_dynamic_cast<CrsMatrixWrap>(A_11)->getCrsMatrix();
335 RCP<CrsMatrix> A_12_crs = rcp_dynamic_cast<CrsMatrixWrap>(A_12)->getCrsMatrix();
336 RCP<CrsMatrix> A_21_crs = rcp_dynamic_cast<CrsMatrixWrap>(A_21)->getCrsMatrix();
337 RCP<CrsMatrix> A_11_crs_9Pt = rcp_dynamic_cast<CrsMatrixWrap>(A_11_9Pt)->getCrsMatrix();
340 RCP<Matrix> A_22 = MatrixFactory::Build(newRangeMap2, newDomainMap2, 1);
341 RCP<CrsMatrix> A_22_crs = rcp_dynamic_cast<CrsMatrixWrap>(A_22) ->getCrsMatrix();
351 for (
LO row = 0; row < as<LO>(numRows2); ++row) {
352 tmp_A_21->getLocalRowView(row, inds, vals);
354 size_t nnz = inds.
size();
356 for (
LO colID = 0; colID < as<LO>(nnz); colID++)
357 newInds[colID] = colElem1[inds[colID]];
359 A_21_crs->insertGlobalValues(newRowElem2[row], newInds, vals);
360 A_22_crs->insertGlobalValues(newRowElem2[row],
Array<LO>(1, newRowElem2[row]), smallVal);
362 A_21_crs->fillComplete(tmp_A_21->getDomainMap(), newRangeMap2);
363 A_22_crs->fillComplete(newDomainMap2, newRangeMap2);
370 for (
LO row = 0; row < as<LO>(numRows2); ++row) {
371 tmp_A_21->getLocalRowView(row, inds, vals);
373 size_t nnz = inds.
size();
375 for (
LO colID = 0; colID < as<LO>(nnz); colID++)
376 newInds[colID] = colElem1[inds[colID]];
378 A_21_crs->insertGlobalValues(newRowElem2[row], newInds, vals);
380 A_21_crs->fillComplete(tmp_A_21->getDomainMap(), newRangeMap2);
385 for (
LO row = 0; row < as<LO>(tmp_A_12->getRowMap()->getLocalNumElements()); ++row) {
386 tmp_A_12->getLocalRowView(row, inds, vals);
388 size_t nnz = inds.
size();
390 for (
LO colID = 0; colID < as<LO>(nnz); colID++)
391 newInds[colID] = newColElem2[inds[colID]];
393 A_12_crs->insertGlobalValues(rowElem1[row], newInds, vals);
395 A_12_crs->fillComplete(newDomainMap2, tmp_A_12->getRangeMap());
409 SC dropTol = (paramList.
get<
int>(
"useFilters") ? paramList.
get<
double>(
"tau_1") : 0.00);
410 RCP<Matrix> filteredA = FilterMatrix(*A_11, *A_11, dropTol);
411 RCP<Matrix> filteredB = FilterMatrix(*BBt, *BBt_abs, dropTol);
413 RCP<Matrix> fA_11_crs = rcp_dynamic_cast<CrsMatrixWrap>(filteredA);
416 RCP<Matrix> fA_22_crs = rcp_dynamic_cast<CrsMatrixWrap>(filteredB);
419 std::vector<size_t> stridingInfo(1, 1);
420 int stridedBlockId = -1;
423 Array<GO> velElem = A_12_crs->getRangeMap()->getLocalElementList();
424 Array<GO> presElem = A_21_crs->getRangeMap()->getLocalElementList();
427 for (
Xpetra::global_size_t i = numVel; i < numVel + numPres; i++) elementList[i] = presElem[i - numVel];
430 std::vector<RCP<const Map> > partMaps(2);
431 partMaps[0] = StridedMapFactory::Build(
Xpetra::UseTpetra, numVel, velElem, indexBase, stridingInfo, comm);
432 partMaps[1] = StridedMapFactory::Build(
Xpetra::UseTpetra, numPres, presElem, indexBase, stridingInfo, comm, stridedBlockId, numVel);
437 fA->setMatrix(0, 0, fA_11_crs);
438 fA->setMatrix(0, 1, fA_12_crs);
439 fA->setMatrix(1, 0, fA_21_crs);
440 fA->setMatrix(1, 1, fA_22_crs);
447 SetDependencyTree(M, paramList);
451 finestLevel->
Set(
"A", rcp_dynamic_cast<Matrix>(fA));
452 finestLevel->
Set(
"p2vMap", p2vMap);
455 finestLevel->
Set(
"AForPat", A_11_9Pt);
456 H->SetMaxCoarseSize(
MUELU_GPD(
"coarse: max size",
int, 1));
466 H->Keep(
"Ptent", M.
GetFactory(
"Ptent").get());
467 H->Setup(M, 0,
MUELU_GPD(
"max levels",
int, 3));
470 for (
int i = 1; i < H->GetNumLevels(); i++) {
471 RCP<Matrix> P = H->GetLevel(i)->template Get<RCP<Matrix> >(
"P");
484 std::string smootherType =
MUELU_GPD(
"smoother: type", std::string,
"vanka");
486 if (paramList.
isSublist(
"smoother: params"))
487 smootherParams = paramList.
sublist(
"smoother: params");
488 M.
SetFactory(
"Smoother", GetSmoother(smootherType, smootherParams,
false ));
490 std::string coarseType =
MUELU_GPD(
"coarse: type", std::string,
"direct");
492 if (paramList.
isSublist(
"coarse: params"))
493 coarseParams = paramList.
sublist(
"coarse: params");
494 M.
SetFactory(
"CoarseSolver", GetSmoother(coarseType, coarseParams,
true ));
496 #ifdef HAVE_MUELU_DEBUG
501 A->setMatrix(0, 0, A_11);
502 A->setMatrix(0, 1, A_12);
503 A->setMatrix(1, 0, A_21);
504 A->setMatrix(1, 1, A_22);
507 H->GetLevel(0)->Set(
"A", rcp_dynamic_cast<Matrix>(A));
509 H->Setup(M, 0, H->GetNumLevels());
514 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
535 ParameterList dropParams = *(dropFactory->GetValidParameterList());
536 dropParams.
set(
"lightweight wrap",
true);
537 dropParams.
set(
"aggregation: drop scheme",
"classical");
538 dropParams.
set(
"aggregation: drop tol", dropTol);
540 dropFactory->SetParameterList(dropParams);
541 dropFactory->SetFactory(
"UnAmalgamationInfo", amalgFactory);
545 dropFactory->Build(level);
547 level.
Get(
"Graph", filteredGraph, dropFactory.
get());
556 level.
Set(
"A", rcpFromRef(A));
557 level.
Set(
"Graph", filteredGraph);
558 level.
Set(
"Filtering",
true);
561 ParameterList filterParams = *(filterFactory->GetValidParameterList());
564 filterParams.
set(
"filtered matrix: reuse graph",
false);
565 filterParams.
set(
"filtered matrix: use lumping",
false);
566 filterFactory->SetParameterList(filterParams);
570 filterFactory->Build(level);
572 level.
Get(
"A", filteredA, filterFactory.
get());
576 filteredA->resumeFill();
577 size_t numRows = filteredA->getRowMap()->getLocalNumElements();
578 for (
size_t i = 0; i < numRows; i++) {
581 filteredA->getLocalRowView(i, inds, vals);
583 size_t nnz = inds.
size();
589 for (
size_t j = 0; j < nnz; j++) {
591 if (inds[j] == Teuchos::as<int>(i))
595 "No diagonal found");
599 valsNew[diagIndex] -= diag;
601 filteredA->replaceLocalValues(i, inds, valsNew);
603 filteredA->fillComplete();
608 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
622 M11->SetKokkosRefactor(paramList.
get<
bool>(
"use kokkos refactor"));
623 M22->SetKokkosRefactor(paramList.
get<
bool>(
"use kokkos refactor"));
624 SetBlockDependencyTree(*M11, 0, 0,
"velocity", paramList);
625 SetBlockDependencyTree(*M22, 1, 1,
"pressure", paramList);
628 ParameterList pParamList = *(PFact->GetValidParameterList());
629 pParamList.
set(
"backwards",
true);
630 PFact->SetParameterList(pParamList);
631 PFact->AddFactoryManager(M11);
632 PFact->AddFactoryManager(M22);
636 RFact->SetFactory(
"P", PFact);
652 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
659 typedef MueLu::Q2Q1PFactory<SC, LO, GO, NO> Q2Q1PFactory;
660 typedef MueLu::Q2Q1uPFactory<SC, LO, GO, NO> Q2Q1uPFactory;
671 const bool isStructured =
false;
674 Q2Q1Fact =
rcp(
new Q2Q1PFactory);
677 Q2Q1Fact =
rcp(
new Q2Q1uPFactory);
679 q2q1ParamList.
set(
"mode", mode);
681 q2q1ParamList.
set(
"dump status", paramList.
get<
bool>(
"dump status"));
683 q2q1ParamList.
set(
"phase2", paramList.
get<
bool>(
"phase2"));
685 q2q1ParamList.
set(
"tau_2", paramList.
get<
double>(
"tau_2"));
692 ParameterList patternParams = *(patternFact->GetValidParameterList());
695 patternParams.
set(
"emin: pattern order", 0);
696 patternFact->SetParameterList(patternParams);
697 patternFact->SetFactory(
"A", AFact);
698 patternFact->SetFactory(
"P", Q2Q1Fact);
702 CFact->SetFactory(
"Ppattern", patternFact);
706 ParameterList eminParams = *(EminPFact->GetValidParameterList());
708 eminParams.
set(
"emin: num iterations", paramList.
get<
int>(
"emin: num iterations"));
709 if (mode ==
"pressure") {
710 eminParams.
set(
"emin: iterative method",
"cg");
712 eminParams.
set(
"emin: iterative method",
"gmres");
713 if (paramList.
isParameter(
"emin: iterative method"))
714 eminParams.
set(
"emin: iterative method", paramList.
get<std::string>(
"emin: iterative method"));
716 EminPFact->SetParameterList(eminParams);
717 EminPFact->SetFactory(
"A", AFact);
718 EminPFact->SetFactory(
"Constraint", CFact);
719 EminPFact->SetFactory(
"P", Q2Q1Fact);
722 if (mode ==
"velocity" && (!paramList.
isParameter(
"velocity: use transpose") || paramList.
get<
bool>(
"velocity: use transpose") ==
false)) {
726 RFact->SetFactory(
"P", EminPFact);
731 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
747 if (type ==
"none") {
748 return Teuchos::null;
750 }
else if (type ==
"vanka") {
753 schwarzList.
set(
"schwarz: overlap level", as<int>(0));
754 schwarzList.
set(
"schwarz: zero starting solution",
false);
755 schwarzList.
set(
"subdomain solver name",
"Block_Relaxation");
758 innerSolverList.
set(
"partitioner: type",
"user");
759 innerSolverList.
set(
"partitioner: overlap",
MUELU_GPD(
"partitioner: overlap",
int, 1));
760 innerSolverList.
set(
"relaxation: type",
MUELU_GPD(
"relaxation: type", std::string,
"Gauss-Seidel"));
761 innerSolverList.
set(
"relaxation: sweeps",
MUELU_GPD(
"relaxation: sweeps",
int, 1));
762 innerSolverList.
set(
"relaxation: damping factor",
MUELU_GPD(
"relaxation: damping factor",
double, 0.5));
763 innerSolverList.
set(
"relaxation: zero starting solution",
false);
766 std::string ifpackType =
"SCHWARZ";
768 smootherPrototype =
rcp(
new TrilinosSmoother(ifpackType, schwarzList));
770 }
else if (type ==
"schwarz") {
771 std::string ifpackType =
"SCHWARZ";
773 smootherPrototype =
rcp(
new TrilinosSmoother(ifpackType, paramList));
775 }
else if (type ==
"braess-sarazin") {
778 bool lumping =
MUELU_GPD(
"bs: lumping",
bool,
false);
781 schurFact->SetParameter(
"omega", ParameterEntry(omega));
782 schurFact->SetParameter(
"lumping", ParameterEntry(lumping));
787 std::string schurSmootherType = (paramList.
isParameter(
"schur smoother: type") ? paramList.
get<std::string>(
"schur smoother: type") :
"RELAXATION");
788 if (schurSmootherType ==
"RELAXATION") {
791 schurSmootherPrototype =
rcp(
new TrilinosSmoother(schurSmootherType, schurSmootherParams));
793 schurSmootherPrototype =
rcp(
new DirectSolver());
795 schurSmootherPrototype->SetFactory(
"A", schurFact);
801 braessManager->SetFactory(
"A", schurFact);
802 braessManager->SetFactory(
"Smoother", schurSmootherFact);
803 braessManager->SetFactory(
"PreSmoother", schurSmootherFact);
804 braessManager->SetFactory(
"PostSmoother", schurSmootherFact);
805 braessManager->SetIgnoreUserData(
true);
807 smootherPrototype =
rcp(
new BraessSarazinSmoother());
808 smootherPrototype->SetParameter(
"Sweeps", ParameterEntry(
MUELU_GPD(
"bs: sweeps",
int, 1)));
809 smootherPrototype->SetParameter(
"lumping", ParameterEntry(lumping));
810 smootherPrototype->SetParameter(
"Damping factor", ParameterEntry(omega));
811 smootherPrototype->SetParameter(
"q2q1 mode", ParameterEntry(
true));
812 rcp_dynamic_cast<BraessSarazinSmoother>(smootherPrototype)->AddFactoryManager(braessManager, 0);
814 }
else if (type ==
"ilu") {
815 std::string ifpackType =
"RILUK";
817 smootherPrototype =
rcp(
new TrilinosSmoother(ifpackType, paramList));
819 }
else if (type ==
"direct") {
820 smootherPrototype =
rcp(
new BlockedDirectSolver());
826 return coarseSolver ?
rcp(
new SmootherFactory(smootherPrototype, Teuchos::null)) : rcp(
new SmootherFactory(smootherPrototype));
829 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
836 const CrsMatrixWrap& Awrap =
dynamic_cast<const CrsMatrixWrap&
>(A);
841 Awrap.getCrsMatrix()->getAllValues(iaA, jaA, valA);
846 for (
int i = 0; i < iaA.
size(); i++) iaB[i] = iaA[i];
847 for (
int i = 0; i < jaA.
size(); i++) jaB[i] = jaA[i];
850 RCP<Matrix> B =
rcp(
new CrsMatrixWrap(A.getRowMap(), A.getColMap(), 0));
851 RCP<CrsMatrix> Bcrs = rcp_dynamic_cast<CrsMatrixWrap>(B)->getCrsMatrix();
852 Bcrs->setAllValues(iaB, jaB, valB);
859 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
861 return "Thyra::MueLuTpetraQ2Q1PreconditionerFactory";
867 #endif // ifdef THYRA_MUELU_TPETRA_Q2Q1PRECONDITIONER_FACTORY_DEF_HPP
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
void SetDependencyTree(MueLu::FactoryManager< SC, LO, GO, NO > &M, const ParameterList ¶mList) const
This class specifies the default factory that should generate some data on a Level if the data does n...
MueLu::DefaultLocalOrdinal LocalOrdinal
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level->Get< RCP<Matrix> >("A", factory) if factory == NULL => use default factory.
BraessSarazin smoother for 2x2 block matrices.
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
virtual void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Configuration.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > ¶mList)
Factory for building blocked, segregated prolongation operators.
T & get(const std::string &name, T def_value)
Class that encapsulates external library smoothers.
Factory for building coarse matrices.
bool nonnull(const std::shared_ptr< T > &p)
bool is_null(const std::shared_ptr< T > &p)
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
void uninitializePrec(PreconditionerBase< SC > *prec, Teuchos::RCP< const LinearOpSourceBase< SC > > *fwdOp, ESupportSolveUse *supportSolveUse) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static void Write(const std::string &fileName, const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &M)
Base class for smoother prototypes.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Get factory associated with a particular data name.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
void initializePrec(const Teuchos::RCP< const LinearOpSourceBase< SC > > &fwdOp, PreconditionerBase< SC > *prec, const ESupportSolveUse supportSolveUse) const
Factory for building restriction operators using a prolongator factory.
bool isParameter(const std::string &name) const
std::string description() const
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
virtual void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
Class that holds all level-specific information.
Teuchos::RCP< Xpetra::Matrix< SC, LO, GO, NO > > FilterMatrix(Xpetra::Matrix< SC, LO, GO, NO > &A, Xpetra::Matrix< SC, LO, GO, NO > &Pattern, SC dropTol) const
bool isSublist(const std::string &name) const
Teuchos::RCP< MueLu::TpetraOperator< SC, LO, GO, NO > > Q2Q1MkPrecond(const ParameterList ¶mList, const Teuchos::RCP< Tpetra::MultiVector< SC, LO, GO, NO > > &velCoords, const Teuchos::RCP< Tpetra::MultiVector< SC, LO, GO, NO > > &presCoords, const Teuchos::ArrayRCP< LO > &p2vMap, const Teko::LinearOp &thA11, const Teko::LinearOp &thA12, const Teko::LinearOp &thA21, const Teko::LinearOp &thA11_9Pt) const
RCP< Xpetra::Matrix< SC, LO, GO, NO > > TpetraCrs_To_XpetraMatrix(const Teuchos::RCP< Tpetra::CrsMatrix< SC, LO, GO, NO >> &Atpetra)
Factory for building a thresholded operator.
AmalgamationFactory for subblocks of strided map based amalgamation data.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
virtual RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Factory for building the constraint operator.
direct solver for nxn blocked matrices
bool isCompatible(const LinearOpSourceBase< SC > &fwdOp) const
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
Various adapters that will create a MueLu preconditioner that is a Tpetra::Operator.
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Set Factory.
void SetBlockDependencyTree(MueLu::FactoryManager< SC, LO, GO, NO > &M, LO row, LO col, const std::string &mode, const ParameterList ¶mList) const
Factory for building the Schur Complement for a 2x2 block matrix.
Factory for creating a graph based on a given matrix.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
Teuchos::RCP< Xpetra::Matrix< SC, LO, GO, NO > > Absolute(const Xpetra::Matrix< SC, LO, GO, NO > &A) const
static void Multiply(const Matrix &A, bool transposeA, const Matrix &B, bool transposeB, Matrix &C, bool call_FillComplete_on_result=true, bool doOptimizeStorage=true, const std::string &label=std::string(), const RCP< ParameterList > ¶ms=null)
void SetLevelID(int levelID)
Set level number.
TypeTo as(const TypeFrom &t)
Factory for building nonzero patterns for energy minimization.
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Factory for building Energy Minimization prolongators.
Lightweight MueLu representation of a compressed row storage graph.
Wraps an existing MueLu::Hierarchy as a Tpetra::Operator.
virtual Teuchos::RCP< const Map > getRangeMap() const =0
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Exception throws to report errors in the internal logical of the program.
Factory for building filtered matrices using filtered graphs.
#define MUELU_GPD(name, type, defaultValue)
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< PreconditionerBase< SC > > createPrec() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
virtual Teuchos::RCP< const Map > getDomainMap() const =0
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
void Request(const FactoryBase &factory)
Increment the storage counter for all the inputs of a factory.
MueLuTpetraQ2Q1PreconditionerFactory()
RCP< MueLu::FactoryBase > GetSmoother(const std::string &type, const ParameterList ¶mList, bool coarseSolver) const