46 #ifndef MUELU_BLOCKEDCOORDINATESTRANSFER_FACTORY_DEF_HPP
47 #define MUELU_BLOCKEDCOORDINATESTRANSFER_FACTORY_DEF_HPP
54 #include "MueLu_CoarseMapFactory.hpp"
55 #include "MueLu_Aggregates.hpp"
63 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
69 return validParamList;
72 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
74 Input(coarseLevel,
"CoarseMap");
77 const size_t numSubFactories = NumFactories();
78 for(
size_t i=0; i<numSubFactories; i++) {
84 for (std::vector<
RCP<const FactoryBase> >::const_iterator it = subFactories_.begin(); it != subFactories_.end(); ++it)
85 (*it)->CallDeclareInput(coarseLevel);
88 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
96 GetOStream(
Runtime0) <<
"Transferring (blocked) coordinates" << std::endl;
98 const size_t numSubFactories = NumFactories();
100 std::vector<RCP<dMV> > subBlockCoords(numSubFactories);
102 if (coarseLevel.
IsAvailable(
"Coordinates",
this)) {
103 GetOStream(
Runtime0) <<
"Reusing coordinates" << std::endl;
108 for(
size_t i=0; i<numSubFactories; i++) {
109 GetOStream(
Runtime1) <<
"Generating Coordinates for block " << i <<
"/"<<numSubFactories <<std::endl;
112 subBlockCoords[i] = coarseLevel.
Get<
RCP<dMV> >(
"Coordinates", myFactory.
get());
120 RCP<dBV> bcoarseCoords =
rcp(
new dBV(coarseMap,subBlockCoords));
123 RCP<dMV> coarseCoords = bcoarseCoords->Merge();
124 Set<RCP<dMV> >(coarseLevel,
"Coordinates", coarseCoords);
127 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
129 subFactories_.push_back(factory);
136 #endif // MUELU_BLOCKEDCOORDINATESTRANSFER_FACTORY_DEF_HPP
void DeclareInput(Level &finelevel, Level &coarseLevel) const
Specifies the data that this class needs, and the factories that generate that data.
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.
virtual void CallBuild(Level &requestedLevel) const =0
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Timer to be used in factories. Similar to Monitor but with additional timers.
One-liner description of what is happening.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
void AddFactory(const RCP< const FactoryBase > &factory)
Add (sub) coords factory in the end of list of factories in BlockedCoordinatesTransferFactory.
Description of what is happening (more verbose)
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
bool IsAvailable(const std::string &ename, const FactoryBase *factory=NoFactory::get()) const
Test whether a need's value has been saved.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.