10 #ifndef MUELU_REBALANCEMAPFACTORY_DEF_HPP_
11 #define MUELU_REBALANCEMAPFACTORY_DEF_HPP_
24 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
28 #define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
30 #undef SET_VALID_ENTRY
33 validParamList->
set<std::string>(
"Map name",
"",
"Name of map to rebalanced.");
37 validParamList->
set<
RCP<const FactoryBase> >(
"Importer", Teuchos::null,
"Factory of the importer object used for the rebalancing");
39 return validParamList;
42 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
45 std::string mapName = pL.
get<std::string>(
"Map name");
47 currentLevel.
DeclareInput(mapName, mapFactory.get(),
this);
49 Input(currentLevel,
"Importer");
52 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
60 std::string mapName = pL.
get<std::string>(
"Map name");
65 if (rebalanceImporter != Teuchos::null) {
76 RCP<const Import> blowUpImporter = ImportFactory::Build(map, rebalanceImporter->getSourceMap());
77 RCP<Vector> pv = VectorFactory::Build(rebalanceImporter->getSourceMap());
81 RCP<Vector> ptv = VectorFactory::Build(rebalanceImporter->getTargetMap());
84 if (pL.
get<
bool>(
"repartition: use subcommunicators") ==
true)
85 ptv->replaceMap(ptv->getMap()->removeEmptyProcesses());
89 std::vector<GlobalOrdinal> localGIDs;
91 for (
size_t k = 0; k < ptv->getLocalLength(); k++) {
92 if (ptvData[k] == 1.0) {
93 localGIDs.push_back(ptv->getMap()->getGlobalElement(k));
103 0, ptv->getMap()->getComm());
107 level.Set(mapName, localGIDsMap, mapFactory.get());
T & get(const std::string &name, T def_value)
#define SET_VALID_ENTRY(name)
Timer to be used in factories. Similar to Monitor but with additional timers.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()