53 #ifndef MUELU_BLOCKEDCOARSEMAPFACTORY_DEF_HPP_ 54 #define MUELU_BLOCKEDCOARSEMAPFACTORY_DEF_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);
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.
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
Timer to be used in factories. Similar to Monitor but with additional timers.
Namespace for MueLu classes and methods.
Print even more statistics.
virtual ~BlockedCoarseMapFactory()
Destructor.
virtual LocalOrdinal getStridedBlockId() const
getStridedBlockId returns strided block id for the domain DOF map of Ptent (= coarse map) or -1 if fu...
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.
std::vector< size_t > stridingInfo_
virtual size_t getFixedBlockSize() const
getFixedBlockSize returns the full block size (number of DOFs per node) of the domain DOF map (= coar...
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
BlockedCoarseMapFactory()
Constructor.
Exception throws to report errors in the internal logical of the program.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()