47 #ifndef MUELU_MAPTRANSFERFACTORY_DEF_HPP_
48 #define MUELU_MAPTRANSFERFACTORY_DEF_HPP_
52 #include <Xpetra_Map.hpp>
53 #include <Xpetra_MapFactory.hpp>
54 #include <Xpetra_Matrix.hpp>
62 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
82 return validParamList;
85 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
88 std::string mapFactName = pL.
get<std::string>(
"map: factory");
89 std::string mapName = pL.
get<std::string>(
"map: name");
92 if (mapFactName ==
"" || mapFactName ==
"NoFactory") {
95 else if (mapFactName !=
"null") {
105 if (tentPFact == Teuchos::null)
110 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 Monitor m(*
this,
"Contact Map transfer factory");
115 std::string mapName = pL.
get<std::string>(
"map: name");
117 if (fineLevel.
IsAvailable(mapName, mapFact_.get())==
false)
118 GetOStream(
Runtime0) <<
"MapTransferFactory::Build: User provided map " << mapName <<
" not found in Level class." << std::endl;
127 if (tentPFact == Teuchos::null)
130 "MueLu::MapTransferFactory::Build(): P (generated by TentativePFactory) not available.");
133 std::vector<GO > coarseMapGids;
136 for (
size_t row=0; row<Ptent->getNodeNumRows(); row++) {
137 GO grid = Ptent->getRowMap()->getGlobalElement(row);
139 if (transferMap->isNodeGlobalElement(grid)) {
142 Ptent->getLocalRowView(row, indices, vals);
144 for (
size_t i = 0; i < as<size_t>(indices.
size()); i++) {
146 GO gcid = Ptent->getColMap()->getGlobalElement(indices[i]);
147 coarseMapGids.push_back(gcid);
154 std::sort(coarseMapGids.begin(), coarseMapGids.end());
155 coarseMapGids.erase(std::unique(coarseMapGids.begin(), coarseMapGids.end()), coarseMapGids.end());
157 Teuchos::RCP<Map> coarseTransferMap = MapFactory::Build(Ptent->getColMap()->lib(), INVALID, coarseMapGidsView, Ptent->getColMap()->getIndexBase(), Ptent->getColMap()->getComm());
160 coarseLevel.
Set(mapName, coarseTransferMap, mapFact_.get());
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)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
One-liner description of what is happening.
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
Timer to be used in non-factories.
const RCP< const FactoryManagerBase > GetFactoryManager()
returns the current factory manager
Exception throws to report errors in the internal logical of the program.
MapTransferFactory()
Constructor.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
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.
static const RCP< const NoFactory > getRCP()
Static Get() functions.