Skip to content
Snippets Groups Projects
Commit 548510cf authored by Rene Halver's avatar Rene Halver
Browse files

fix for the general work_array administration and passing from the ALL object

parent e5075238
No related branches found
No related tags found
No related merge requests found
Pipeline #22033 passed
...@@ -112,26 +112,21 @@ template <class T, class W> class ALL ...@@ -112,26 +112,21 @@ template <class T, class W> class ALL
switch(method) switch(method)
{ {
case ALL_LB_t::TENSOR: case ALL_LB_t::TENSOR:
work_array.resize(1); balancer.reset(new ALL_Tensor_LB<T,W>(d,(W)0,g));
balancer.reset(new ALL_Tensor_LB<T,W>(d,work_array.at(0),g));
break; break;
case ALL_LB_t::STAGGERED: case ALL_LB_t::STAGGERED:
work_array.resize(1); balancer.reset(new ALL_Staggered_LB<T,W>(d,(W)0,g));
balancer.reset(new ALL_Staggered_LB<T,W>(d,work_array.at(0),g));
break; break;
case ALL_LB_t::UNSTRUCTURED: case ALL_LB_t::UNSTRUCTURED:
work_array.resize(1); balancer.reset(new ALL_Unstructured_LB<T,W>(d,(W)0,g));
balancer.reset(new ALL_Unstructured_LB<T,W>(d,work_array.at(0),g));
break; break;
case ALL_LB_t::VORONOI: case ALL_LB_t::VORONOI:
#ifdef ALL_VORONOI #ifdef ALL_VORONOI
work_array.resize(1); balancer.reset(new ALL_Voronoi_LB<T,W>(d,(W)0,g));
balancer.reset(new ALL_Voronoi_LB<T,W>(d,work_array.at(0),g));
#endif #endif
break; break;
case ALL_LB_t::HISTOGRAM: case ALL_LB_t::HISTOGRAM:
work_array.resize(1); balancer.reset(new ALL_Histogram_LB<T,W>(d,std::vector<W>(10),g));
balancer.reset(new ALL_Histogram_LB<T,W>(d,work_array,g));
break; break;
default: default:
throw ALL_Invalid_Argument_Exception( throw ALL_Invalid_Argument_Exception(
...@@ -315,13 +310,12 @@ template <class T, class W> void ALL<T,W>::set_vertices(const int n, const int d ...@@ -315,13 +310,12 @@ template <class T, class W> void ALL<T,W>::set_vertices(const int n, const int d
template <class T, class W> void ALL<T,W>::set_work(W work) template <class T, class W> void ALL<T,W>::set_work(W work)
{ {
// set new value for work (single value for whole domain) // set new value for work (single value for whole domain)
work_array.resize(1); balancer->set_work(work);
work_array.at(0) = work;
} }
template <class T, class W> void ALL<T,W>::set_work(const std::vector<W>& work) template <class T, class W> void ALL<T,W>::set_work(const std::vector<W>& work)
{ {
work_array = work; balancer->set_work(work);
} }
template <class T, class W> void ALL<T,W>::set_proc_grid_params(const std::vector<int>& loc, const std::vector<int>& size) template <class T, class W> void ALL<T,W>::set_proc_grid_params(const std::vector<int>& loc, const std::vector<int>& size)
...@@ -429,12 +423,12 @@ template <class T, class W> void ALL<T,W>::calculate_outline() ...@@ -429,12 +423,12 @@ template <class T, class W> void ALL<T,W>::calculate_outline()
template <class T, class W> void ALL<T,W>::get_work(W& result) template <class T, class W> void ALL<T,W>::get_work(W& result)
{ {
result = work_array->at(0); result = balancer->get_work().at(0);
} }
template <class T, class W> void ALL<T,W>::get_work(std::vector<W>& result) template <class T, class W> void ALL<T,W>::get_work(std::vector<W>& result)
{ {
result = work_array; result = balancer->get_work();
} }
template <class T, class W> void ALL<T,W>::setup() template <class T, class W> void ALL<T,W>::setup()
...@@ -706,7 +700,7 @@ template <class T, class W> void ALL<T,W>::print_vtk_outlines(int step) ...@@ -706,7 +700,7 @@ template <class T, class W> void ALL<T,W>::print_vtk_outlines(int step)
work->SetNumberOfComponents(1); work->SetNumberOfComponents(1);
work->SetNumberOfTuples(1); work->SetNumberOfTuples(1);
work->SetName("work"); work->SetName("work");
W total_work = std::accumulate(work_array.begin(),work_array.end(),(W)0); W total_work = std::accumulate(balancer->get_work().begin(),balancer->get_work().end(),(W)0);
work->SetValue(0, total_work); work->SetValue(0, total_work);
// determine extent of system // determine extent of system
...@@ -810,7 +804,7 @@ template <class T, class W> void ALL<T,W>::print_vtk_vertices(int step) ...@@ -810,7 +804,7 @@ template <class T, class W> void ALL<T,W>::print_vtk_vertices(int step)
local_vertices[v * balancer->get_dimension() + d] = balancer->get_vertices().at(v).x(d); local_vertices[v * balancer->get_dimension() + d] = balancer->get_vertices().at(v).x(d);
} }
} }
local_vertices[n_vertices * balancer->get_dimension()] = (T)work_array.at(0); local_vertices[n_vertices * balancer->get_dimension()] = (T)balancer->get_work().at(0);
T* global_vertices; T* global_vertices;
if (local_rank == 0) if (local_rank == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment