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

changes to vtk output (area / volume)

parent 9dca32b5
Branches
Tags
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment