10 #ifndef MUELU_MULTIVECTORTRANSFER_FACTORY_DEF_HPP
11 #define MUELU_MULTIVECTORTRANSFER_FACTORY_DEF_HPP
14 #include "Xpetra_MultiVectorFactory.hpp"
21 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
25 validParamList->
set<std::string>(
"Vector name",
"undefined",
"Name of the vector that will be transferred on the coarse grid (level key)");
29 return validParamList;
32 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
37 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
40 std::string vectorName = pL.
get<std::string>(
"Vector name");
42 fineLevel.
DeclareInput(vectorName, GetFactory(
"Vector factory").
get(),
this);
43 Input(coarseLevel,
"R");
46 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
51 std::string vectorName = pL.
get<std::string>(
"Vector name");
54 RCP<Matrix> transferOp = Get<RCP<Matrix> >(coarseLevel,
"R");
56 RCP<MultiVector> coarseVector = MultiVectorFactory::Build(transferOp->getRangeMap(), fineVector->getNumVectors());
57 GetOStream(
Runtime0) <<
"Transferring multivector \"" << vectorName <<
"\"" << std::endl;
59 RCP<MultiVector> onesVector = MultiVectorFactory::Build(transferOp->getDomainMap(), 1);
61 RCP<MultiVector> rowSumVector = MultiVectorFactory::Build(transferOp->getRangeMap(), 1);
62 transferOp->apply(*onesVector, *rowSumVector);
63 transferOp->apply(*fineVector, *coarseVector);
65 if (vectorName ==
"Coordinates")
68 Set<RCP<MultiVector> >(coarseLevel, vectorName, coarseVector);
72 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
79 for (
int i = 0; i < coordinates.
size(); i++) {
80 for (
int j = 0; j < blksize; j++) {
81 expandCoord[i * blksize + j] = coordinates[i];
90 #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)
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.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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.