46 #ifndef MUELU_BLOCKEDCOORDINATESTRANSFER_FACTORY_DEF_HPP
47 #define MUELU_BLOCKEDCOORDINATESTRANSFER_FACTORY_DEF_HPP
49 #include "Xpetra_ImportFactory.hpp"
50 #include "Xpetra_MultiVectorFactory.hpp"
51 #include "Xpetra_MapFactory.hpp"
52 #include "Xpetra_IO.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>
92 typedef Xpetra::MultiVector<typename Teuchos::ScalarTraits<Scalar>::coordinateType,LO,GO,NO> dMV;
93 typedef Xpetra::BlockedMultiVector<typename Teuchos::ScalarTraits<Scalar>::coordinateType,LO,GO,NO> dBV;
95 GetOStream(
Runtime0) <<
"Transferring (blocked) coordinates" << std::endl;
97 const size_t numSubFactories = NumFactories();
99 std::vector<RCP<dMV> > subBlockCoords(numSubFactories);
101 if (coarseLevel.
IsAvailable(
"Coordinates",
this)) {
102 GetOStream(
Runtime0) <<
"Reusing coordinates" << std::endl;
107 for(
size_t i=0; i<numSubFactories; i++) {
108 GetOStream(
Runtime1) <<
"Generating Coordinates for block " << i <<
"/"<<numSubFactories <<std::endl;
111 subBlockCoords[i] = coarseLevel.
Get<
RCP<dMV> >(
"Coordinates", myFactory.
get());
119 RCP<dBV> bcoarseCoords =
rcp(
new dBV(coarseMap,subBlockCoords));
122 RCP<dMV> coarseCoords = bcoarseCoords->Merge();
123 Set<RCP<dMV> >(coarseLevel,
"Coordinates", coarseCoords);
126 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
128 subFactories_.push_back(factory);
135 #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.