46 #ifndef MUELU_REBALANCEMAPFACTORY_DEF_HPP_
47 #define MUELU_REBALANCEMAPFACTORY_DEF_HPP_
58 #include "MueLu_Utilities.hpp"
62 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
66 #define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
68 #undef SET_VALID_ENTRY
71 validParamList->
set< std::string > (
"Map name" ,
"",
"Name of map to rebalanced.");
75 validParamList->
set<
RCP<const FactoryBase> >(
"Importer", Teuchos::null,
"Factory of the importer object used for the rebalancing");
77 return validParamList;
81 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
84 std::string mapName = pL.
get<std::string> (
"Map name");
86 currentLevel.
DeclareInput(mapName,mapFactory.get(),
this);
88 Input(currentLevel,
"Importer");
91 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
99 std::string mapName = pL.
get<std::string> (
"Map name");
102 RCP<const Import> rebalanceImporter = Get<RCP<const Import> >(level,
"Importer");
104 if(rebalanceImporter != Teuchos::null) {
115 RCP<const Import> blowUpImporter = ImportFactory::Build(map, rebalanceImporter->getSourceMap());
116 RCP<Vector> pv = VectorFactory::Build(rebalanceImporter->getSourceMap());
120 RCP<Vector> ptv = VectorFactory::Build(rebalanceImporter->getTargetMap());
123 if (pL.
get<
bool>(
"repartition: use subcommunicators") ==
true)
124 ptv->replaceMap(ptv->getMap()->removeEmptyProcesses());
128 std::vector<GlobalOrdinal> localGIDs;
130 for (
size_t k = 0; k < ptv->getLocalLength(); k++) {
131 if(ptvData[k] == 1.0) {
132 localGIDs.push_back(ptv->getMap()->getGlobalElement(k));
142 0, ptv->getMap()->getComm());
146 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.