46 #ifndef PACKAGES_MUELU_SRC_REBALANCING_MUELU_CLONEREPARTITIONINTERFACE_DEF_HPP_
47 #define PACKAGES_MUELU_SRC_REBALANCING_MUELU_CLONEREPARTITIONINTERFACE_DEF_HPP_
49 #include <Xpetra_MultiVectorFactory.hpp>
60 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 return validParamList;
70 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
72 Input(currentLevel,
"A");
73 Input(currentLevel,
"Partition");
76 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
85 if (currentLevel.IsAvailable(
"number of partitions")) {
86 GetOStream(
Warnings0) <<
"Using user-provided \"number of partitions\", the performance is unknown" << std::endl;
95 decomposition = Get<RCP<GOVector> >(currentLevel,
"Partition");
99 GetOStream(
Warnings0) <<
"No repartitioning necessary: partitions were left unchanged by the repartitioner" << std::endl;
100 Set<RCP<const Import> >(currentLevel,
"Importer", Teuchos::null);
106 ArrayRCP<GO> retDecompEntries = ret->getDataNonConst(0);
112 if (A->IsView(
"stridedMaps") &&
113 Teuchos::rcp_dynamic_cast<
const StridedMap>(A->getRowMap(
"stridedMaps")) != Teuchos::null) {
117 LocalOrdinal stridedBlock = strMap->getStridedBlockId();
118 if (stridedBlock == -1)
119 blkSize = strMap->getFixedBlockSize();
121 std::vector<size_t> strInfo = strMap->getStridingData();
122 blkSize = strInfo[stridedBlock];
124 oldView = A->SwitchToView(oldView);
125 GetOStream(
Statistics1) <<
"CloneRepartitionInterface::Build():"
126 <<
" found blockdim=" << blkSize <<
" from strided maps." << std::endl;
128 GetOStream(
Statistics1) <<
"CloneRepartitionInterface::Build(): no striding information available. Use blockdim=" << blkSize <<
" (DofsPerNode)." << std::endl;
129 blkSize = A->GetFixedBlockSize();
133 size_t inLocalLength = decomposition->getLocalLength();
134 size_t outLocalLength = A->getRowMap()->getLocalNumElements();
137 size_t numLocalNodes = outLocalLength / blkSize;
140 if (numLocalNodes > 0) {
142 LocalOrdinal inBlkSize = Teuchos::as<LocalOrdinal>(inLocalLength / numLocalNodes);
145 for (
LO i = 0; i < Teuchos::as<LO>(numLocalNodes); i++) {
146 for (
LO j = 0; j < blkSize; j++) {
147 retDecompEntries[i * blkSize + j] = Teuchos::as<GO>(decompEntries[i * inBlkSize]);
151 Set(currentLevel,
"Partition", ret);
Important warning messages (one line)
Exception indicating invalid cast attempted.
MueLu::DefaultLocalOrdinal LocalOrdinal
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void DeclareInput(Level &level) const
Specifies the data that this class needs, and the factories that generate that data.
Print statistics that do not involve significant additional computation.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
static RCP< Vector > Build(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
void print(std::ostream &out, const VerbLevel verbLevel=Default) const
Printing method.
Exception throws to report errors in the internal logical of the program.
void Build(Level &level) const
Build an object with this factory.