Skip to content
Snippets Groups Projects
Commit d3eb2d91 authored by Stephan Schulz's avatar Stephan Schulz
Browse files

Merge branch 'verticesUpdate' into 'master'

update the outline used for VTK output when balance is called

See merge request !20
parents 84093182 25907cdd
Branches
Tags
1 merge request!20update the outline used for VTK output when balance is called
Pipeline #74417 passed
...@@ -299,6 +299,7 @@ public: ...@@ -299,6 +299,7 @@ public:
switch (method) { switch (method) {
case LB_t::TENSOR: case LB_t::TENSOR:
balancer->balance(loadbalancing_step); balancer->balance(loadbalancing_step);
calculate_outline();
break; break;
case LB_t::STAGGERED: case LB_t::STAGGERED:
...@@ -373,9 +374,11 @@ public: ...@@ -373,9 +374,11 @@ public:
((Staggered_LB<T,W>*)balancer.get())->setVertices(outline->data()); ((Staggered_LB<T,W>*)balancer.get())->setVertices(outline->data());
*/ */
balancer->balance(loadbalancing_step); balancer->balance(loadbalancing_step);
calculate_outline();
break; break;
case LB_t::FORCEBASED: case LB_t::FORCEBASED:
balancer->balance(loadbalancing_step); balancer->balance(loadbalancing_step);
calculate_outline();
break; break;
#ifdef ALL_VORONOI_ACTIVE #ifdef ALL_VORONOI_ACTIVE
case LB_t::VORONOI: case LB_t::VORONOI:
...@@ -384,6 +387,7 @@ public: ...@@ -384,6 +387,7 @@ public:
#endif #endif
case LB_t::HISTOGRAM: case LB_t::HISTOGRAM:
balancer->balance(loadbalancing_step); balancer->balance(loadbalancing_step);
calculate_outline();
break; break;
default: default:
throw InvalidArgumentException( throw InvalidArgumentException(
......
...@@ -207,6 +207,7 @@ template <class T, class W> void Staggered_LB<T, W>::setup() { ...@@ -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) { template <class T, class W> void Staggered_LB<T, W>::balance(int) {
std::vector<Point<T>> newVertices = this->vertices;
int dimension = this->getDimension(); int dimension = this->getDimension();
// store original vertices // store original vertices
...@@ -306,28 +307,29 @@ template <class T, class W> void Staggered_LB<T, W>::balance(int) { ...@@ -306,28 +307,29 @@ template <class T, class W> void Staggered_LB<T, W>::balance(int) {
// for now: test case for simple program // for now: test case for simple program
// if a left neighbor exists: shift left border
// 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) 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 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 a right neighbor exists: shift right border
if (rank_right != MPI_PROC_NULL && if (rank_right != MPI_PROC_NULL &&
this->local_coords[i] != this->global_dims[i] - 1) 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 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 // 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; std::cout << "ERROR on process: " << this->localRank << std::endl;
throw InternalErrorException( throw InternalErrorException(
__FILE__, __func__, __LINE__, __FILE__, __func__, __LINE__,
"Lower border of process larger than upper border of process!"); "Lower border of process larger than upper border of process!");
} }
this->setVertices(newVertices);
#ifdef ALL_DEBUG_ENABLED #ifdef ALL_DEBUG_ENABLED
MPI_Barrier(this->globalComm); MPI_Barrier(this->globalComm);
if (this->localRank == 0) if (this->localRank == 0)
......
...@@ -175,6 +175,7 @@ template <class T, class W> void Tensor_LB<T, W>::setup() { ...@@ -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) { template <class T, class W> void Tensor_LB<T, W>::balance(int) {
int dim = this->getDimension(); int dim = this->getDimension();
std::vector<Point<T>> newVertices = this->vertices;
this->prevVertices = this->vertices; this->prevVertices = this->vertices;
// loop over all available dimensions // loop over all available dimensions
...@@ -238,16 +239,16 @@ template <class T, class W> void Tensor_LB<T, W>::balance(int) { ...@@ -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 a left neighbor exists: shift left border
if (rank_left != MPI_PROC_NULL && this->local_coords[i] != 0) 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 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 a right neighbor exists: shift right border
if (rank_right != MPI_PROC_NULL && if (rank_right != MPI_PROC_NULL &&
this->local_coords[i] != this->global_dims[i] - 1) 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 else
this->vertices.at(1)[i] = this->prevVertices.at(1)[i]; newVertices.at(1)[i] = this->prevVertices.at(1)[i];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment