From 1b1d71985f37be676a2033e39e12af8634f4523d Mon Sep 17 00:00:00 2001
From: Joern Behrens <joern.behrens@uni-hamburg.de>
Date: Sun, 6 Feb 2022 18:59:18 +0100
Subject: [PATCH] write error fixed in stacked VTU output

---
 flash2d/src/options-sphere/IO_vtu_stacked.F90 | 22 ++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/flash2d/src/options-sphere/IO_vtu_stacked.F90 b/flash2d/src/options-sphere/IO_vtu_stacked.F90
index 7ec16c9..30612ad 100644
--- a/flash2d/src/options-sphere/IO_vtu_stacked.F90
+++ b/flash2d/src/options-sphere/IO_vtu_stacked.F90
@@ -26,20 +26,20 @@ PUBLIC :: plot_vtu, t_vtu_data
   INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodesperface = GRID_edgenodes
 
   ! This defines a triangle in VTK format
-  INTEGER(KIND=GRID_SI), PARAMETER         :: i_vtucelltype = 5
+  INTEGER(KIND=GRID_SI), PARAMETER         :: i_vtucelltype  = 5
 #elif defined VTU_OUTPUT3D
   INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodespercell = GRID_tetranodes
   INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodesperface = GRID_elementnodes
 
   ! This defines a tetrahedron in VTK format
-  INTEGER(KIND=GRID_SI), PARAMETER         :: i_vtucelltype = 10
+  INTEGER(KIND=GRID_SI), PARAMETER         :: i_vtucelltype  = 10
 #elif defined VTU_OUTPUTSTC
-  INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodespercell = GRID_elementnodes
-  INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodesperface = GRID_edgenodes
+  INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodespercell    = GRID_elementnodes
+  INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodesperface    = GRID_edgenodes
 
   ! This defines a wedge/prism in VTK format
   INTEGER(KIND=GRID_SI), PARAMETER         :: i_nodespervtucell = GRID_elementnodes*2
-  INTEGER(KIND=GRID_SI), PARAMETER         :: i_vtucelltype = 13
+  INTEGER(KIND=GRID_SI), PARAMETER         :: i_vtucelltype     = 13
 #endif
 
 
@@ -355,14 +355,26 @@ SUBROUTINE plot_vtu(p_mesh, c_filename, &
 
   ! write the cell type. Tetrahedra are represented by 10 and triangles by 5
   WRITE(i_fhandle, *) '<DataArray type="UInt8" Name="types" format="ascii">'
+#if defined VTU_OUTPUT2D || defined VTU_OUTPUTSPH || defined VTU_OUTPUT2D
   DO i_cnt = 1, i_numberofcells
     WRITE(i_fhandle, *) i_vtucelltype
   END DO
+#elif defined VTU_OUTPUTSTC
+  DO i_cnt = 1, i_numberofvtucells
+    WRITE(i_fhandle, *) i_vtucelltype
+  END DO
+#endif
   WRITE(i_fhandle, *) '</DataArray>'
   WRITE(i_fhandle, *) '<DataArray type="Int32" Name="offsets" format="ascii">'
+#if defined VTU_OUTPUT2D || defined VTU_OUTPUTSPH || defined VTU_OUTPUT2D
   DO i_cnt = 1, i_numberofcells
     WRITE(i_fhandle, *) i_cnt * i_nodespercell
   END DO
+#elif defined VTU_OUTPUTSTC
+  DO i_cnt = 1, i_numberofvtucells
+    WRITE(i_fhandle, *) i_cnt * i_nodespervtucell
+  END DO
+#endif
   WRITE(i_fhandle, *) '</DataArray>'
   WRITE(i_fhandle, *) '</Cells>'
 
-- 
GitLab