diff --git a/dune/gfe/parallel/globalindex.hh b/dune/gfe/parallel/globalindex.hh index 4999ad95c241cd564b860644743f5a3fe8adabea..7978dc97eeb3e181e789c89c414ac11bcdaa4a93 100644 --- a/dune/gfe/parallel/globalindex.hh +++ b/dune/gfe/parallel/globalindex.hh @@ -293,6 +293,15 @@ public: return globalLocalMap_.find(globalIndex)->second; } + int globalIndex(const typename GridView::template Codim<CODIM>::Entity& entity) const + { + return localGlobalMap_.find(gridview_.indexSet().index(entity))->second; + } + + int localIndex(const typename GridView::template Codim<CODIM>::Entity& entity) const { + return gridview_.indexSet().index(entity); + } + inline unsigned int nGlobalEntity() const { return(nGlobalEntity_); diff --git a/dune/gfe/parallel/vectorcommunicator.hh b/dune/gfe/parallel/vectorcommunicator.hh index e9144c11012d39c15b31bfbc54683d618b627bc7..f3d460c363e6c37aa6c3919f1c5eb64e5ebad602 100644 --- a/dune/gfe/parallel/vectorcommunicator.hh +++ b/dune/gfe/parallel/vectorcommunicator.hh @@ -26,8 +26,9 @@ private: std::vector<TransferVectorTuple> localVectorEntries; // Translate vector entries - for (size_t k = 0; k < localVector.size(); ++k) - localVectorEntries.push_back(TransferVectorTuple(guIndex.globalIndex(k), localVector[k])); + const auto& gridView = guIndex.getGridView(); + for (auto it = gridView.template begin<2>(); it != gridView.template end<2>(); ++ it) + localVectorEntries.push_back(TransferVectorTuple(guIndex.globalIndex(*it), localVector[guIndex.localIndex(*it)])); // Get number of vector entries on each process localVectorEntriesSizes = MPIFunctions::shareSizes(guIndex.getGridView(), localVectorEntries.size());