53 #ifndef MUELU_AMALGAMATIONINFO_DEF_HPP_
54 #define MUELU_AMALGAMATIONINFO_DEF_HPP_
61 #include "MueLu_Aggregates.hpp"
65 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 int myPid = aggregates.
GetMap()->getComm()->getRank();
72 LO size = procWinner.
size();
75 std::vector<LO> sizes(numAggregates);
76 if (stridedblocksize_ == 1) {
77 for (
LO lnode = 0; lnode < size; ++lnode) {
78 LO myAgg = vertex2AggId[lnode];
79 if (procWinner[lnode] == myPid)
83 for (
LO lnode = 0; lnode < size; ++lnode) {
84 LO myAgg = vertex2AggId[lnode];
85 if (procWinner[lnode] == myPid) {
86 GO gnodeid = nodeGlobalElts[lnode];
87 for (LocalOrdinal k = 0; k < stridedblocksize_; k++) {
88 GlobalOrdinal gDofIndex = ComputeGlobalDOF(gnodeid,k);
89 if (columnMap_->isNodeGlobalElement(gDofIndex))
97 for (
GO i=0; i<numAggregates; ++i) {
98 aggStart[i+1] = aggStart[i] + sizes[i];
105 if (stridedblocksize_ == 1) {
106 for (
LO lnode = 0; lnode < size; ++lnode) {
107 LO myAgg = vertex2AggId[lnode];
108 if (procWinner[lnode] == myPid) {
109 aggToRowMap[ aggStart[myAgg] + numDofs[myAgg] ] = ComputeGlobalDOF(nodeGlobalElts[lnode]);
114 for (
LO lnode = 0; lnode < size; ++lnode) {
115 LO myAgg = vertex2AggId[lnode];
117 if (procWinner[lnode] == myPid) {
118 GO gnodeid = nodeGlobalElts[lnode];
119 for (LocalOrdinal k = 0; k < stridedblocksize_; k++) {
120 GlobalOrdinal gDofIndex = ComputeGlobalDOF(gnodeid,k);
121 if (columnMap_->isNodeGlobalElement(gDofIndex)) {
122 aggToRowMap[ aggStart[myAgg] + numDofs[myAgg] ] = gDofIndex;
133 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
137 int myPid = aggregates.
GetMap()->getComm()->getRank();
146 LO size = procWinner.
size();
148 std::vector<LO> sizes(numAggregates);
149 if (stridedblocksize_ == 1) {
150 for (
LO lnode = 0; lnode < size; lnode++)
151 if (procWinner[lnode] == myPid)
152 sizes[vertex2AggId[lnode]]++;
154 for (
LO lnode = 0; lnode < size; lnode++)
155 if (procWinner[lnode] == myPid) {
156 GO nodeGID = nodeGlobalElts[lnode];
158 for (
LO k = 0; k < stridedblocksize_; k++) {
159 GO GID = ComputeGlobalDOF(nodeGID, k);
160 if (columnMap_->isNodeGlobalElement(GID))
161 sizes[vertex2AggId[lnode]]++;
168 for (
GO i = 0; i < numAggregates; i++)
169 aggStart[i+1] = aggStart[i] + sizes[i];
175 if (stridedblocksize_ == 1) {
176 for (
LO lnode = 0; lnode < size; ++lnode)
177 if (procWinner[lnode] == myPid) {
178 LO myAgg = vertex2AggId[lnode];
179 aggToRowMap[aggStart[myAgg] + numDofs[myAgg]] = lnode;
183 for (
LO lnode = 0; lnode < size; ++lnode)
184 if (procWinner[lnode] == myPid) {
185 LO myAgg = vertex2AggId[lnode];
186 GO nodeGID = nodeGlobalElts[lnode];
188 for (
LO k = 0; k < stridedblocksize_; k++) {
189 GO GID = ComputeGlobalDOF(nodeGID, k);
190 if (columnMap_->isNodeGlobalElement(GID)) {
191 aggToRowMap[aggStart[myAgg] + numDofs[myAgg]] = lnode*stridedblocksize_ + k;
203 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
209 LO nodeElements = Teuchos::as<LO>(nodeMap->getNodeNumElements());
210 if (stridedblocksize_ == 1) {
211 for (
LO n = 0; n<nodeElements; n++) {
212 GlobalOrdinal gDofIndex = ComputeGlobalDOF(gEltList[n]);
213 myDofGids->push_back(gDofIndex);
216 for (
LO n = 0; n<nodeElements; n++) {
217 for (LocalOrdinal k = 0; k < stridedblocksize_; k++) {
218 GlobalOrdinal gDofIndex = ComputeGlobalDOF(gEltList[n],k);
219 if (columnMap_->isNodeGlobalElement(gDofIndex))
220 myDofGids->push_back(gDofIndex);
232 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
236 GlobalOrdinal gDofIndex = offset_ + (gNodeID-indexBase_)*fullblocksize_ + nStridedOffset_ + k + indexBase_;
const RCP< LOVector > & GetProcWinner() const
Returns constant vector that maps local node IDs to owning processor IDs.
Container class for aggregation information.
void UnamalgamateAggregates(const Aggregates &aggregates, Teuchos::ArrayRCP< LocalOrdinal > &aggStart, Teuchos::ArrayRCP< GlobalOrdinal > &aggToRowMap) const
UnamalgamateAggregates.
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 return global dof id associated with global node id gNodeID and dof index k...
Teuchos::RCP< Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > ComputeUnamalgamatedImportDofMap(const Aggregates &aggregates) const
ComputeUnamalgamatedImportDofMap build overlapping dof row map from aggregates needed for overlapping...
LO GetNumAggregates() const
returns the number of aggregates of the current processor. Note: could/should be renamed to GetNumLoc...
const RCP< LOMultiVector > & GetVertex2AggId() const
Returns constant vector that maps local node IDs to local aggregates IDs.