From f0d77b5ef1f082ba6f6d764da921d62bbe65fa85 Mon Sep 17 00:00:00 2001 From: Rene Halver <r.halver@fz-juelich.de> Date: Fri, 12 Apr 2019 12:11:18 +0200 Subject: [PATCH] changes to vtk output (area / volume) --- include/ALL.hpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/include/ALL.hpp b/include/ALL.hpp index 1995258..7852a5c 100644 --- a/include/ALL.hpp +++ b/include/ALL.hpp @@ -912,7 +912,8 @@ template <class T, class W> void ALL<T,W>::print_vtk_outlines(int step) work->SetNumberOfComponents(1); work->SetNumberOfTuples(1); work->SetName("work"); - work->SetValue(0, work_array->at(0)); + W total_work = std::accumulate(work_array->begin(),work_array->end(),(W)0); + work->SetValue(0, total_work); // determine extent of system W global_extent[6]; @@ -920,13 +921,33 @@ template <class T, class W> void ALL<T,W>::print_vtk_outlines(int step) W local_max[3]; W global_min[3]; W global_max[3]; + W width[3]; + W volume = (W)1.0; for(int i = 0; i < 3; ++i) { local_min[i] = outline->at(i); local_max[i] = outline->at(3+i); + width[i] = local_max[i] - local_min[i]; + volume *= width[i]; } + W surface = (W)2.0 * width[0] * width[1] + + (W)2.0 * width[1] * width[2] + + (W)2.0 * width[0] * width[2]; + + auto expanse = vtkSmartPointer<vtkFloatArray>::New(); + expanse->SetNumberOfComponents(6); + expanse->SetNumberOfTuples(1); + expanse->SetName("expanse"); + expanse->SetValue(0, width[0]); + expanse->SetValue(1, width[0]); + expanse->SetValue(2, width[0]); + expanse->SetValue(3, volume); + expanse->SetValue(4, surface); + expanse->SetValue(5, surface/volume); + + MPI_Allreduce(&local_min,&global_min,3,mpi_data_type_W,MPI_MIN,communicator); MPI_Allreduce(&local_max,&global_max,3,mpi_data_type_W,MPI_MAX,communicator); @@ -941,6 +962,7 @@ template <class T, class W> void ALL<T,W>::print_vtk_outlines(int step) unstructuredGrid->SetPoints(points); unstructuredGrid->SetCells(VTK_VOXEL, cellArray); unstructuredGrid->GetCellData()->AddArray(work); + unstructuredGrid->GetCellData()->AddArray(expanse); -- GitLab