46 #ifndef MUELU_REBALANCEMAPFACTORY_DEF_HPP_
47 #define MUELU_REBALANCEMAPFACTORY_DEF_HPP_
60 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
64 #define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
66 #undef SET_VALID_ENTRY
69 validParamList->
set<std::string>(
"Map name",
"",
"Name of map to rebalanced.");
73 validParamList->
set<
RCP<const FactoryBase> >(
"Importer", Teuchos::null,
"Factory of the importer object used for the rebalancing");
75 return validParamList;
78 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
81 std::string mapName = pL.
get<std::string>(
"Map name");
83 currentLevel.
DeclareInput(mapName, mapFactory.get(),
this);
85 Input(currentLevel,
"Importer");
88 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
96 std::string mapName = pL.
get<std::string>(
"Map name");
101 if (rebalanceImporter != Teuchos::null) {
112 RCP<const Import> blowUpImporter = ImportFactory::Build(map, rebalanceImporter->getSourceMap());
113 RCP<Vector> pv = VectorFactory::Build(rebalanceImporter->getSourceMap());
117 RCP<Vector> ptv = VectorFactory::Build(rebalanceImporter->getTargetMap());
120 if (pL.
get<
bool>(
"repartition: use subcommunicators") ==
true)
121 ptv->replaceMap(ptv->getMap()->removeEmptyProcesses());
125 std::vector<GlobalOrdinal> localGIDs;
127 for (
size_t k = 0; k < ptv->getLocalLength(); k++) {
128 if (ptvData[k] == 1.0) {
129 localGIDs.push_back(ptv->getMap()->getGlobalElement(k));
139 0, ptv->getMap()->getComm());
143 level.Set(mapName, localGIDsMap, mapFactory.get());
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 SET_VALID_ENTRY(name)
Timer to be used in factories. Similar to Monitor but with additional timers.
void Build(Level &level) const
Build an object with this factory.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
void DeclareInput(Level &level) const
Specifies the data that this class needs, and the factories that generate that data.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
static const RCP< const NoFactory > getRCP()
Static Get() functions.