46 #ifndef MUELU_MULTIVECTORTRANSFER_FACTORY_DEF_HPP
47 #define MUELU_MULTIVECTORTRANSFER_FACTORY_DEF_HPP
50 #include "Xpetra_MultiVectorFactory.hpp"
57 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
61 validParamList->
set< std::string > (
"Vector name",
"undefined",
"Name of the vector that will be transferred on the coarse grid (level key)");
65 return validParamList;
68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
76 std::string vectorName = pL.
get<std::string>(
"Vector name");
78 fineLevel.
DeclareInput(vectorName, GetFactory(
"Vector factory").
get(),
this);
79 Input(coarseLevel,
"R");
82 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
87 std::string vectorName = pL.
get<std::string>(
"Vector name");
90 RCP<Matrix> transferOp = Get<RCP<Matrix> >(coarseLevel,
"R");
92 RCP<MultiVector> coarseVector = MultiVectorFactory::Build(transferOp->getRangeMap(), fineVector->getNumVectors());
93 GetOStream(
Runtime0) <<
"Transferring multivector \"" << vectorName <<
"\"" << std::endl;
95 RCP<MultiVector> onesVector = MultiVectorFactory::Build(transferOp->getDomainMap(), 1);
97 RCP<MultiVector> rowSumVector = MultiVectorFactory::Build(transferOp->getRangeMap(), 1);
98 transferOp->apply(*onesVector, *rowSumVector);
99 transferOp->apply(*fineVector, *coarseVector);
101 if (vectorName ==
"Coordinates")
104 Set<RCP<MultiVector> >(coarseLevel, vectorName, coarseVector);
108 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
115 for(
int i=0; i<coordinates.
size(); i++) {
116 for(
int j=0; j< blksize; j++) {
117 expandCoord[i*blksize + j] = coordinates[i];
126 #endif // MUELU_MULTIVECTORTRANSFER_FACTORY_DEF_HPP
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
MueLu::DefaultLocalOrdinal LocalOrdinal
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.
T & get(const std::string &name, T def_value)
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.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
One-liner description of what is happening.
void DeclareInput(Level &finelevel, Level &coarseLevel) const
Specifies the data that this class needs, and the factories that generate that data.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
static ArrayRCP< SC > expandCoordinates(ArrayRCP< SC > coord, LocalOrdinal blksize)
Exception throws to report errors in the internal logical of the program.
MultiVectorTransferFactory()
Constructor.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.