diff --git a/include/ALL.hpp b/include/ALL.hpp index 78e765124f55b66adf09e579f444d1e1aa67e4b2..32aca6f8dc5ceb7394b2864f2b6278ea669e0a6b 100644 --- a/include/ALL.hpp +++ b/include/ALL.hpp @@ -299,6 +299,7 @@ public: switch (method) { case LB_t::TENSOR: balancer->balance(loadbalancing_step); + calculate_outline(); break; case LB_t::STAGGERED: @@ -373,9 +374,11 @@ public: ((Staggered_LB<T,W>*)balancer.get())->setVertices(outline->data()); */ balancer->balance(loadbalancing_step); + calculate_outline(); break; case LB_t::FORCEBASED: balancer->balance(loadbalancing_step); + calculate_outline(); break; #ifdef ALL_VORONOI_ACTIVE case LB_t::VORONOI: @@ -384,6 +387,7 @@ public: #endif case LB_t::HISTOGRAM: balancer->balance(loadbalancing_step); + calculate_outline(); break; default: throw InvalidArgumentException( diff --git a/include/ALL_Staggered.hpp b/include/ALL_Staggered.hpp index 75c38de0da6e4a5c1513aba0fb63b4ac4a546c6c..ecbe3c3cedbab4586be21ef5fbaccc6504a51cf3 100644 --- a/include/ALL_Staggered.hpp +++ b/include/ALL_Staggered.hpp @@ -207,6 +207,7 @@ template <class T, class W> void Staggered_LB<T, W>::setup() { } template <class T, class W> void Staggered_LB<T, W>::balance(int) { + std::vector<Point<T>> newVertices = this->vertices; int dimension = this->getDimension(); // store original vertices @@ -306,28 +307,29 @@ template <class T, class W> void Staggered_LB<T, W>::balance(int) { // for now: test case for simple program - // if a left neighbor exists: shift left border // if a left neighbor exists: shift left border if (rank_left != MPI_PROC_NULL && this->local_coords[i] != 0) - this->vertices.at(0)[i] = this->prevVertices.at(0)[i] + remote_shift; + newVertices.at(0)[i] = this->prevVertices.at(0)[i] + remote_shift; else - this->vertices.at(0)[i] = this->prevVertices.at(0)[i]; + newVertices.at(0)[i] = this->prevVertices.at(0)[i]; // if a right neighbor exists: shift right border if (rank_right != MPI_PROC_NULL && this->local_coords[i] != this->global_dims[i] - 1) - this->vertices.at(1)[i] = this->prevVertices.at(1)[i] + shift; + newVertices.at(1)[i] = this->prevVertices.at(1)[i] + shift; else - this->vertices.at(1)[i] = this->prevVertices.at(1)[i]; + newVertices.at(1)[i] = this->prevVertices.at(1)[i]; // check if vertices are crossed and throw exception if something went wrong - if (this->vertices.at(1)[i] < this->vertices.at(0)[i]) { + if (newVertices.at(1)[i] < newVertices.at(0)[i]) { std::cout << "ERROR on process: " << this->localRank << std::endl; throw InternalErrorException( __FILE__, __func__, __LINE__, "Lower border of process larger than upper border of process!"); } + this->setVertices(newVertices); + #ifdef ALL_DEBUG_ENABLED MPI_Barrier(this->globalComm); if (this->localRank == 0) diff --git a/include/ALL_Tensor.hpp b/include/ALL_Tensor.hpp index a328d64dc97f27583ea15a75b7c0891dca42e10f..f7655fcca190bf8e38a66c7158322be38ae2f022 100644 --- a/include/ALL_Tensor.hpp +++ b/include/ALL_Tensor.hpp @@ -175,6 +175,7 @@ template <class T, class W> void Tensor_LB<T, W>::setup() { template <class T, class W> void Tensor_LB<T, W>::balance(int) { int dim = this->getDimension(); + std::vector<Point<T>> newVertices = this->vertices; this->prevVertices = this->vertices; // loop over all available dimensions @@ -238,16 +239,16 @@ template <class T, class W> void Tensor_LB<T, W>::balance(int) { // if a left neighbor exists: shift left border if (rank_left != MPI_PROC_NULL && this->local_coords[i] != 0) - this->vertices.at(0)[i] = this->prevVertices.at(0)[i] + remote_shift; + newVertices.at(0)[i] = this->prevVertices.at(0)[i] + remote_shift; else - this->vertices.at(0)[i] = this->prevVertices.at(0)[i]; + newVertices.at(0)[i] = this->prevVertices.at(0)[i]; // if a right neighbor exists: shift right border if (rank_right != MPI_PROC_NULL && this->local_coords[i] != this->global_dims[i] - 1) - this->vertices.at(1)[i] = this->prevVertices.at(1)[i] + shift; + newVertices.at(1)[i] = this->prevVertices.at(1)[i] + shift; else - this->vertices.at(1)[i] = this->prevVertices.at(1)[i]; + newVertices.at(1)[i] = this->prevVertices.at(1)[i]; } }