17 #ifndef MUELU_REPARTITIONINTERFACE_DEF_HPP_
18 #define MUELU_REPARTITIONINTERFACE_DEF_HPP_
28 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
32 validParamList->
set<
RCP<const FactoryBase> >(
"number of partitions", Teuchos::null,
"Instance of RepartitionHeuristicFactory.");
33 validParamList->
set<
RCP<const FactoryBase> >(
"AmalgamatedPartition", Teuchos::null,
"(advanced) Factory generating the AmalgamatedPartition (e.g. an IsorropiaInterface)");
35 return validParamList;
38 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
40 Input(currentLevel,
"A");
41 Input(currentLevel,
"number of partitions");
42 Input(currentLevel,
"AmalgamatedPartition");
45 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
51 int numParts = Get<int>(level,
"number of partitions");
59 if (numParts == 1 || numParts == -1) {
62 Set(level,
"Partition", decomposition);
72 ArrayRCP<GO> amalgPartitionData = amalgPartition->getDataNonConst(0);
78 LO nStridedOffset = 0;
79 LO stridedblocksize = blockdim;
83 if (A->IsView(
"stridedMaps") &&
84 Teuchos::rcp_dynamic_cast<
const StridedMap>(A->getRowMap(
"stridedMaps")) != Teuchos::null) {
88 blockdim = strMap->getFixedBlockSize();
89 blockid = strMap->getStridedBlockId();
91 std::vector<size_t> stridingInfo = strMap->getStridingData();
92 for (
size_t j = 0; j < Teuchos::as<size_t>(blockid); j++)
93 nStridedOffset += stridingInfo[j];
94 stridedblocksize = Teuchos::as<LocalOrdinal>(stridingInfo[blockid]);
97 stridedblocksize = blockdim;
99 oldView = A->SwitchToView(oldView);
102 GetOStream(
Statistics0, -1) <<
"RepartitionInterface::Build(): no striding information available. Use blockdim=1 with offset=0" << std::endl;
106 ArrayRCP<GO> decompEntries = decomposition->getDataNonConst(0);
108 TEUCHOS_TEST_FOR_EXCEPTION(Teuchos::as<int>(nodeMap->getLocalNumElements()) * stridedblocksize != Teuchos::as<int>(rowMap->getLocalNumElements()),
Exceptions::RuntimeError,
"Inconsistency between nodeMap and dofMap: we are supporting block maps only. No support for general strided maps, yet!");
115 for (
size_t i = 0; i < nodeMap->getLocalNumElements(); i++) {
127 for (
LO j = 0; j < stridedblocksize ; j++) {
133 decompEntries[i * stridedblocksize + j] = amalgPartitionData[i];
138 Set(level,
"Partition", decomposition);
Exception indicating invalid cast attempted.
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Print statistics that do not involve significant additional computation.
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 Build(Level &level) const
Build an object with this factory.
static RCP< Vector > Build(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
Exception throws to report errors in the internal logical of the program.
void DeclareInput(Level &level) const
Specifies the data that this class needs, and the factories that generate that data.