53 #ifndef MUELU_AMALGAMATIONINFO_DEF_HPP_
54 #define MUELU_AMALGAMATIONINFO_DEF_HPP_
56 #include <Xpetra_MapFactory.hpp>
62 #include "MueLu_Aggregates.hpp"
66 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 UnamalgamateAggregates(aggregates.
GetMap(),
80 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
85 const GO numAggregates,
88 int myPid = nodeMap->getComm()->getRank();
92 const LO size = procWinner.
size();
94 std::vector<LO> sizes(numAggregates);
95 if (stridedblocksize_ == 1) {
96 for (
LO lnode = 0; lnode < size; ++lnode) {
97 LO myAgg = vertex2AggId[lnode];
98 if (procWinner[lnode] == myPid)
102 for (
LO lnode = 0; lnode < size; ++lnode) {
103 LO myAgg = vertex2AggId[lnode];
104 if (procWinner[lnode] == myPid) {
105 GO gnodeid = nodeGlobalElts[lnode];
108 if (columnMap_->isNodeGlobalElement(gDofIndex))
116 for (
GO i = 0; i < numAggregates; ++i) {
117 aggStart[i + 1] = aggStart[i] + sizes[i];
124 if (stridedblocksize_ == 1) {
125 for (
LO lnode = 0; lnode < size; ++lnode) {
126 LO myAgg = vertex2AggId[lnode];
127 if (procWinner[lnode] == myPid) {
128 aggToRowMap[aggStart[myAgg] + numDofs[myAgg]] = ComputeGlobalDOF(nodeGlobalElts[lnode]);
133 for (
LO lnode = 0; lnode < size; ++lnode) {
134 LO myAgg = vertex2AggId[lnode];
136 if (procWinner[lnode] == myPid) {
137 GO gnodeid = nodeGlobalElts[lnode];
140 if (columnMap_->isNodeGlobalElement(gDofIndex)) {
141 aggToRowMap[aggStart[myAgg] + numDofs[myAgg]] = gDofIndex;
152 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
157 UnamalgamateAggregatesLO(aggregates.
GetMap(),
165 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
170 const GO numAggregates,
173 int myPid = nodeMap->getComm()->getRank();
180 const LO size = procWinner.
size();
182 std::vector<LO> sizes(numAggregates);
183 if (stridedblocksize_ == 1) {
184 for (
LO lnode = 0; lnode < size; lnode++)
185 if (procWinner[lnode] == myPid)
186 sizes[vertex2AggId[lnode]]++;
188 for (
LO lnode = 0; lnode < size; lnode++)
189 if (procWinner[lnode] == myPid) {
190 GO nodeGID = nodeGlobalElts[lnode];
192 for (
LO k = 0; k < stridedblocksize_; k++) {
193 GO GID = ComputeGlobalDOF(nodeGID, k);
194 if (columnMap_->isNodeGlobalElement(GID))
195 sizes[vertex2AggId[lnode]]++;
202 for (
GO i = 0; i < numAggregates; i++)
203 aggStart[i + 1] = aggStart[i] + sizes[i];
209 if (stridedblocksize_ == 1) {
210 for (
LO lnode = 0; lnode < size; ++lnode)
211 if (procWinner[lnode] == myPid) {
212 LO myAgg = vertex2AggId[lnode];
213 aggToRowMap[aggStart[myAgg] + numDofs[myAgg]] = lnode;
217 for (
LO lnode = 0; lnode < size; ++lnode)
218 if (procWinner[lnode] == myPid) {
219 LO myAgg = vertex2AggId[lnode];
220 GO nodeGID = nodeGlobalElts[lnode];
222 for (
LO k = 0; k < stridedblocksize_; k++) {
223 GO GID = ComputeGlobalDOF(nodeGID, k);
224 if (columnMap_->isNodeGlobalElement(GID)) {
225 aggToRowMap[aggStart[myAgg] + numDofs[myAgg]] = lnode * stridedblocksize_ + k;
235 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
238 if (!(verbLevel &
Debug))
241 out <<
"AmalgamationInfo -- Striding information:"
242 <<
"\n fullBlockSize = " << fullblocksize_
243 <<
"\n blockID = " << blockid_
244 <<
"\n stridingOffset = " << nStridedOffset_
245 <<
"\n stridedBlockSize = " << stridedblocksize_
246 <<
"\n indexBase = " << indexBase_
249 out <<
"AmalgamationInfo -- DOFs to nodes mapping:\n"
250 <<
" Mapping of row DOFs to row nodes:" << *rowTranslation_()
251 <<
"\n\n Mapping of column DOFs to column nodes:" << *colTranslation_()
254 out <<
"AmalgamationInfo -- row node map:" << std::endl;
257 out <<
"AmalgamationInfo -- column node map:" << std::endl;
263 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
266 return ComputeUnamalgamatedImportDofMap(aggregates.
GetMap());
269 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
274 LO nodeElements = Teuchos::as<LO>(nodeMap->getLocalNumElements());
275 if (stridedblocksize_ == 1) {
276 for (
LO n = 0; n < nodeElements; n++) {
278 myDofGids->push_back(gDofIndex);
281 for (
LO n = 0; n < nodeElements; n++) {
284 if (columnMap_->isNodeGlobalElement(gDofIndex))
285 myDofGids->push_back(gDofIndex);
297 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
302 GlobalOrdinal gDofIndex = offset_ + (gNodeID - indexBase_) * fullblocksize_ + nStridedOffset_ + k + indexBase_;
306 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
312 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
314 return (ldofID - ldofID % fullblocksize_) / fullblocksize_;
LO ComputeLocalNode(LocalOrdinal const &ldofID) const
MueLu::DefaultLocalOrdinal LocalOrdinal
const RCP< LOVector > & GetProcWinner() const
Returns constant vector that maps local node IDs to owning processor IDs.
Container class for aggregation information.
KOKKOS_INLINE_FUNCTION LO GetNumAggregates() const
void UnamalgamateAggregates(const Aggregates &aggregates, Teuchos::ArrayRCP< LocalOrdinal > &aggStart, Teuchos::ArrayRCP< GlobalOrdinal > &aggToRowMap) const
UnamalgamateAggregates.
Print additional debugging information.
void UnamalgamateAggregatesLO(const Aggregates &aggregates, Teuchos::ArrayRCP< LocalOrdinal > &aggStart, Teuchos::ArrayRCP< LO > &aggToRowMap) const
const RCP< const Map > GetMap() const
returns (overlapping) map of aggregate/node distribution
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
GO ComputeGlobalDOF(GO const &gNodeID, LO const &k=0) const
ComputeGlobalDOF.
MueLu::DefaultGlobalOrdinal GlobalOrdinal
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
Teuchos::RCP< Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > ComputeUnamalgamatedImportDofMap(const Aggregates &aggregates) const
ComputeUnamalgamatedImportDofMap build overlapping dof row map from aggregates needed for overlapping...
const RCP< LOMultiVector > & GetVertex2AggId() const
Returns constant vector that maps local node IDs to local aggregates IDs.
LO ComputeLocalDOF(LocalOrdinal const &lNodeID, LocalOrdinal const &k) const
ComputeLocalDOF return locbal dof id associated with local node id lNodeID and dof index k...