From ed89165b5b296fea4c8bb27e7879ef9a8f1ece23 Mon Sep 17 00:00:00 2001 From: Sebastian Reuther <sebastian.reuther@tu-dresden.de> Date: Mon, 16 Nov 2015 10:00:22 +0000 Subject: [PATCH] adapted constant normal extension algorithm of reinit for parallel use --- AMDiS/src/reinit/HL_SignedDistTraverse.cc | 15 ++++++++++++--- AMDiS/src/reinit/VelocityExt.h | 12 ++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/AMDiS/src/reinit/HL_SignedDistTraverse.cc b/AMDiS/src/reinit/HL_SignedDistTraverse.cc index 278818b1..546067e7 100644 --- a/AMDiS/src/reinit/HL_SignedDistTraverse.cc +++ b/AMDiS/src/reinit/HL_SignedDistTraverse.cc @@ -112,7 +112,10 @@ void HL_SignedDistTraverse::initializeBoundary() #ifdef HAVE_PARALLEL_DOMAIN_AMDIS // In parallel AMDiS synchronize the bound_DOF DOFVector with the max-assigner and the sD_DOF DOFVector with the min-assigner - AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVector(*bound_DOF, max_assigner()); + if (velExt) + AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVectorSameWay(*bound_DOF, velExt->getAllDOFVectorsForSynchronization(), max_assigner()); + else + AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVector(*bound_DOF, max_assigner()); AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVector(*sD_DOF, min_to_zero_assigner()); #endif } @@ -131,7 +134,10 @@ void HL_SignedDistTraverse::HL_updateIteration() #ifdef HAVE_PARALLEL_DOMAIN_AMDIS // Update sDOld_DOF on interior domain boundaries - AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVector(*sDOld_DOF, min_to_zero_assigner()); + if (velExt) + AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVectorSameWay(*sDOld_DOF, velExt->getAllDOFVectorsForSynchronization(), min_to_zero_assigner()); + else + AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVector(*sDOld_DOF, min_to_zero_assigner()); #endif // ===== Gauss-Seidel or Jacobi iteration ? ===== @@ -160,7 +166,10 @@ void HL_SignedDistTraverse::HL_updateIteration() #ifdef HAVE_PARALLEL_DOMAIN_AMDIS // Update sD_DOF on interior domain boundaries - AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVector(*sD_DOF, min_to_zero_assigner()); + if (velExt) + AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVectorSameWay(*sD_DOF, velExt->getAllDOFVectorsForSynchronization(), min_to_zero_assigner()); + else + AMDiS::Parallel::MeshDistributor::globalMeshDistributor->synchVector(*sD_DOF, min_to_zero_assigner()); #endif // ===== Is tolerance reached ? ===== diff --git a/AMDiS/src/reinit/VelocityExt.h b/AMDiS/src/reinit/VelocityExt.h index 0d6d50e3..bfa04bf6 100644 --- a/AMDiS/src/reinit/VelocityExt.h +++ b/AMDiS/src/reinit/VelocityExt.h @@ -230,6 +230,18 @@ public: /// Swaps two vertices in the permutation. void swapVertices(int i1, int i2); + +#ifdef HAVE_PARALLEL_DOMAIN_AMDIS + std::vector<DOFVector<double> *> getAllDOFVectorsForSynchronization() { + std::vector<DOFVector<double> *> ret; + ret.reserve(velDOF.size() + origVelDOF.size()); + for ( std::vector<DOFVector<double>*>::iterator it = velDOF.begin() ; it != velDOF.end() ; ++it ) + ret.push_back(*it); + for ( std::vector<DOFVector<double>*>::iterator it = origVelDOF.begin() ; it != origVelDOF.end() ; ++it ) + ret.push_back(*it); + return ret; + } +#endif protected: /// Original velocity vector. -- GitLab