diff --git a/dune/gfe/parallel/vectorcommunicator.hh b/dune/gfe/parallel/vectorcommunicator.hh index 2fcb7541332a19599540d1c2838470f255b1b149..e9144c11012d39c15b31bfbc54683d618b627bc7 100644 --- a/dune/gfe/parallel/vectorcommunicator.hh +++ b/dune/gfe/parallel/vectorcommunicator.hh @@ -36,8 +36,18 @@ private: globalVectorEntries = MPIFunctions::gatherv(guIndex.getGridView(), localVectorEntries, localVectorEntriesSizes, root_rank); } +public: + VectorCommunicator(const GUIndex& gi, const int& root) + : guIndex(gi), root_rank(root) + { + // Get number of vector entries on each process + localVectorEntriesSizes = MPIFunctions::shareSizes(guIndex.getGridView(), guIndex.nOwnedLocalEntity()); + } + + VectorType reduceAdd(const VectorType& localVector) + { + transferVector(localVector); - VectorType createGlobalVector() const { VectorType globalVector(guIndex.nGlobalEntity()); for (size_t k = 0; k < globalVectorEntries.size(); ++k) @@ -46,7 +56,10 @@ private: return globalVector; } - VectorType copyIntoGlobalVector() const { + VectorType reduceCopy(const VectorType& localVector) + { + transferVector(localVector); + VectorType globalVector(guIndex.nGlobalEntity()); for (size_t k = 0; k < globalVectorEntries.size(); ++k) @@ -55,7 +68,11 @@ private: return globalVector; } - VectorType createLocalSolution() { + VectorType scatter(const VectorType& global) + { + for (size_t k = 0; k < globalVectorEntries.size(); ++k) + globalVectorEntries[k].entry = global[globalVectorEntries[k].row]; + const int localSize = localVectorEntriesSizes[guIndex.getGridView().comm().rank()]; // Create vector for transfer data @@ -73,34 +90,6 @@ private: return x; } -public: - VectorCommunicator(const GUIndex& gi, const int& root) - : guIndex(gi), root_rank(root) - { - // Get number of vector entries on each process - localVectorEntriesSizes = MPIFunctions::shareSizes(guIndex.getGridView(), guIndex.nOwnedLocalEntity()); - } - - VectorType reduceAdd(const VectorType& localVector) - { - transferVector(localVector); - return createGlobalVector(); - } - - VectorType reduceCopy(const VectorType& localVector) - { - transferVector(localVector); - return copyIntoGlobalVector(); - } - - VectorType scatter(const VectorType& global) - { - for (size_t k = 0; k < globalVectorEntries.size(); ++k) - globalVectorEntries[k].entry = global[globalVectorEntries[k].row]; - - return createLocalSolution(); - } - private: const GUIndex& guIndex; int root_rank;