53 #ifndef MUELU_BLOCKEDCOARSEMAPFACTORY_DEF_HPP_
54 #define MUELU_BLOCKEDCOARSEMAPFACTORY_DEF_HPP_
56 #include <Xpetra_MultiVector.hpp>
57 #include <Xpetra_StridedMapFactory.hpp>
58 #include <Xpetra_Matrix.hpp>
62 #include "MueLu_Aggregates.hpp"
69 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
76 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
78 RCP<ParameterList> validParamList = rcp(
new ParameterList());
80 validParamList->set< RCP<const FactoryBase> >(
"Aggregates", Teuchos::null,
"Generating factory for aggregates.");
81 validParamList->set< RCP<const FactoryBase> >(
"Nullspace", Teuchos::null,
"Generating factory for null space.");
82 validParamList->set< RCP<const FactoryBase> >(
"CoarseMap", Teuchos::null,
"Generating factory of previous coarse map. (must be set by user!).");
85 validParamList->set< std::string >(
"Striding info",
"{}",
"Striding information");
86 validParamList->set< LocalOrdinal >(
"Strided block id", -1,
"Strided block id");
88 return validParamList;
91 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
93 this->Input(currentLevel,
"Aggregates");
94 this->Input(currentLevel,
"Nullspace");
97 RCP<const FactoryBase> prevCoarseMapFact = this->GetFactory(
"CoarseMap");
98 TEUCHOS_TEST_FOR_EXCEPTION(prevCoarseMapFact==Teuchos::null,
Exceptions::RuntimeError,
"MueLu::BlockedCoarseMapFactory::getDomainMapOffset: user did not specify CoarseMap of previous block. Do not forget to set the CoarseMap factory.");
99 currentLevel.
DeclareInput(
"CoarseMap", prevCoarseMapFact.get(),
this);
102 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
104 FactoryMonitor m(*
this,
"BlockedCoarseMap factory", currentLevel);
106 RCP<const FactoryBase> prevCoarseMapFact = this->GetFactory(
"CoarseMap");
107 RCP<const Map> subPDomainMap = currentLevel.
Get<RCP<const Map> >(
"CoarseMap", prevCoarseMapFact.get() );
109 GlobalOrdinal maxGlobalIndex = subPDomainMap->getMaxAllGlobalIndex();
111 RCP<Aggregates> aggregates = Factory::Get< RCP<Aggregates> >(currentLevel,
"Aggregates");
112 GlobalOrdinal numAggs = aggregates->GetNumAggregates();
115 RCP<const Teuchos::Comm<int> > comm = aggregates->GetMap()->getComm();
118 RCP<MultiVector> nullspace = Factory::Get< RCP<MultiVector> >(currentLevel,
"Nullspace");
119 const size_t NSDim = nullspace->getNumVectors();
124 if( stridedBlockId== -1 ) {
134 TEUCHOS_TEST_FOR_EXCEPTION(stridedBlockSize != NSDim ,
Exceptions::RuntimeError,
"MueLu::CoarseMapFactory::Build(): dimension of strided block != NSDim. error.");
141 GlobalOrdinal indexBase = aggregates->GetMap()->getIndexBase();
143 RCP<const Map> coarseMap = StridedMapFactory::Build(aggregates->GetMap()->lib(),
144 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
152 this->Set(currentLevel,
"CoarseMap", coarseMap);