46 #ifndef MUELU_MERGEDBLOCKEDMATRIXFACTORY_DEF_HPP_ 47 #define MUELU_MERGEDBLOCKEDMATRIXFACTORY_DEF_HPP_ 49 #ifdef HAVE_MUELU_EXPERIMENTAL 51 #include <Xpetra_BlockedCrsMatrix.hpp> 52 #include <Xpetra_MultiVectorFactory.hpp> 53 #include <Xpetra_VectorFactory.hpp> 54 #include <Xpetra_MatrixFactory.hpp> 55 #include <Xpetra_Matrix.hpp> 56 #include <Xpetra_CrsMatrixWrap.hpp> 57 #include <Xpetra_BlockedCrsMatrix.hpp> 58 #include <Xpetra_CrsMatrix.hpp> 61 #include "MueLu_Utilities.hpp" 62 #include "MueLu_HierarchyHelpers.hpp" 64 #include "MueLu_MergedBlockedMatrixFactory.hpp" 68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
72 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
74 RCP<ParameterList> validParamList = rcp(
new ParameterList());
76 validParamList->set< RCP<const FactoryBase> >(
"A",
MueLu::NoFactory::getRCP(),
"Generating factory of the matrix A used for building SchurComplement (must be a 2x2 blocked operator, default = MueLu::NoFactory::getRCP())");
78 return validParamList;
82 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
84 Input(currentLevel,
"A");
87 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
91 Teuchos::RCP<Matrix> A = Get<RCP<Matrix> >(currentLevel,
"A");
93 RCP<BlockedCrsMatrix> bA = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(A);
94 TEUCHOS_TEST_FOR_EXCEPTION(bA == Teuchos::null,
Exceptions::BadCast,
"MueLu::MergedBlockedMatrixFactory::Build: input matrix A is not of type BlockedCrsMatrix! A generated by AFact_ must be a 2x2 block operator. error.");
96 Teuchos::RCP<CrsMatrix> mergedMat = bA->Merge();
97 Teuchos::RCP<CrsMatrixWrap> mergedOp = Teuchos::rcp(
new CrsMatrixWrap(mergedMat));
98 Teuchos::RCP<Matrix> mergedA = Teuchos::rcp_dynamic_cast<Matrix>(mergedOp);
103 Set(currentLevel,
"A", mergedA);
Exception indicating invalid cast attempted.
MergedBlockedMatrixFactory()
Timer to be used in factories. Similar to Monitor but with additional timers.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Namespace for MueLu classes and methods.
Class that holds all level-specific information.
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
void Build(Level ¤tLevel) const
Build an object with this factory.
static const RCP< const NoFactory > getRCP()
Static Get() functions.