From ecefe3a066e34e43bdf4c64c2aba5e2e2deb304c Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 27 Feb 2017 12:52:17 +0100
Subject: [PATCH] [ML] VTK 7.1 support.

vtkXMLWriter::Ascii dataMode test dropped. We maybe should drop support
for it completely:

http://www.vtk.org/pipermail/vtkusers/2014-October/089400.html

vtkXMLWriter::Appended test added as this mode was fixed in VTK:

https://gitlab.kitware.com/vtk/vtk/commit/f2fd417af9fdb4d92a87f3bd5e2cb888a82b0883
---
 MeshLib/IO/VtkIO/VtuInterface-impl.h      | 7 +++----
 MeshLib/IO/VtkIO/VtuInterface.cpp         | 2 --
 Tests/MeshLib/TestVtkMappedMeshSource.cpp | 4 ++--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/MeshLib/IO/VtkIO/VtuInterface-impl.h b/MeshLib/IO/VtkIO/VtuInterface-impl.h
index 8825fa2d9ac..7b82d496742 100644
--- a/MeshLib/IO/VtkIO/VtuInterface-impl.h
+++ b/MeshLib/IO/VtkIO/VtuInterface-impl.h
@@ -40,10 +40,6 @@ bool VtuInterface::writeVTU(std::string const &file_name, const int num_partitio
         return false;
     }
 
-    // See http://www.paraview.org/Bug/view.php?id=13382
-    if(_data_mode == vtkXMLWriter::Appended)
-        WARN("Appended data mode is currently not supported, written file is not valid!");
-
     vtkNew<MeshLib::VtkMappedMeshSource> vtkSource;
     vtkSource->SetMesh(_mesh);
 
@@ -64,6 +60,9 @@ bool VtuInterface::writeVTU(std::string const &file_name, const int num_partitio
         // implemented and doing so is not trivial. Therefore for ascii output
         // the mapped unstructured grid is copied to a regular VTK grid.
         // See http://www.vtk.org/pipermail/vtkusers/2014-October/089400.html
+        WARN(
+            "Ascii data mode is currently not supported and the program may "
+            "crash!");
         vtkSource->Update();
         vtkSmartPointer<vtkUnstructuredGrid> tempGrid =
             vtkSmartPointer<vtkUnstructuredGrid>::New();
diff --git a/MeshLib/IO/VtkIO/VtuInterface.cpp b/MeshLib/IO/VtkIO/VtuInterface.cpp
index f155975ac66..dd38a43ccd5 100644
--- a/MeshLib/IO/VtkIO/VtuInterface.cpp
+++ b/MeshLib/IO/VtkIO/VtuInterface.cpp
@@ -43,8 +43,6 @@ namespace IO
 VtuInterface::VtuInterface(const MeshLib::Mesh* mesh, int dataMode, bool compress) :
     _mesh(mesh), _data_mode(dataMode), _use_compressor(compress)
 {
-    if(_data_mode == vtkXMLWriter::Appended)
-        ERR("Appended data mode is currently not supported!");
     if(_data_mode == vtkXMLWriter::Ascii && compress)
         WARN("Ascii data cannot be compressed, ignoring compression flag.")
 }
diff --git a/Tests/MeshLib/TestVtkMappedMeshSource.cpp b/Tests/MeshLib/TestVtkMappedMeshSource.cpp
index 9d137e3237e..f7a66ffa444 100644
--- a/Tests/MeshLib/TestVtkMappedMeshSource.cpp
+++ b/Tests/MeshLib/TestVtkMappedMeshSource.cpp
@@ -258,8 +258,8 @@ TEST_F(InSituMesh, DISABLED_MappedMeshSourceRoundtrip)
     ASSERT_EQ(range[1], mesh->getNumberOfElements() * 2);
 
     // -- Write VTK mesh to file (in all combinations of binary, appended and compressed)
-    // atm vtkXMLWriter::Appended does not work, see http://www.paraview.org/Bug/view.php?id=13382
-    for(int dataMode : { vtkXMLWriter::Ascii, vtkXMLWriter::Binary })
+    // TODO: atm vtkXMLWriter::Ascii fails
+    for(int dataMode : { vtkXMLWriter::Appended, vtkXMLWriter::Binary })
     {
         for(bool compressed : { true, false })
         {
-- 
GitLab