From 23dbde1846fb10ba38038eccc5f5fa99d9f02bad Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 4 Jul 2017 13:19:16 +0200
Subject: [PATCH] BUG: foamToVTK -cellSet produces rubbish or segfault (closes
 #516)

- erroneous double logic for subset meshes.

  The underlying vtk::vtuCells uses a cellMap to map into a global
  field, which also allows handling of decomposed polyhedral cells.

  If a mesh subset is involved (eg, cellSet, cellZone), then the
  set/zone cellMap can be used to ensure that the original number is
  properly adjusted. For foamToVTK, the meshSubsetHelper already
  does the subsetting and is used when loading fields.

  Does not affect ParaView reader module since there we work on the
  full field and do the subsetting manually (using the cellMap).
---
 .../dataConversion/foamToVTK/foamToVTK.C             | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
index a012136f01..ccc00ba5d4 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
@@ -831,16 +831,8 @@ int main(int argc, char *argv[])
         {
             if (vtuMeshCells.empty())
             {
+                // subMesh or baseMesh
                 vtuMeshCells.reset(meshRef.mesh());
-
-                // Convert cellMap, addPointCellLabels to global cell ids
-                if (meshRef.useSubMesh())
-                {
-                    vtuMeshCells.renumberCells
-                    (
-                        meshRef.subsetter().cellMap()
-                    );
-                }
             }
 
             // Create file and write header
@@ -856,7 +848,7 @@ int main(int argc, char *argv[])
             // Write mesh
             vtk::internalWriter writer
             (
-                meshRef.baseMesh(),
+                meshRef.mesh(),
                 vtuMeshCells,
                 outputName,
                 fmtType
-- 
GitLab