From f586509b44e9811ec4aeb467574362779276fe6e Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 5 Nov 2019 13:27:08 +0100
Subject: [PATCH] [FileIO] Switch to write GMSH meshes in 'old' fmt.

---
 Applications/DataExplorer/mainwindow.cpp     | 4 ++++
 Applications/FileIO/Legacy/createSurface.cpp | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp
index 850e433f7a3..b83a6728d46 100644
--- a/Applications/DataExplorer/mainwindow.cpp
+++ b/Applications/DataExplorer/mainwindow.cpp
@@ -1107,6 +1107,10 @@ void MainWindow::callGMSH(std::vector<std::string> & selectedGeometries,
                         fname = fname.substr(0, pos);
                     }
                     gmsh_command += " -o " + fname + ".msh";
+                    // Newer gmsh versions write a newer file format for meshes
+                    // per default. At the moment we can't read this new format.
+                    // This is a switch for gmsh to write the 'old' file format.
+                    gmsh_command += " -format msh22";
                     auto const return_value = std::system(gmsh_command.c_str());
                     if (return_value != 0)
                     {
diff --git a/Applications/FileIO/Legacy/createSurface.cpp b/Applications/FileIO/Legacy/createSurface.cpp
index 79ffd930734..68f77873433 100644
--- a/Applications/FileIO/Legacy/createSurface.cpp
+++ b/Applications/FileIO/Legacy/createSurface.cpp
@@ -87,6 +87,10 @@ bool createSurface(GeoLib::Polyline const& ply,
     std::string gmsh_command =
         gmsh_binary + " -2 -algo meshadapt \"" + file_base_name + ".geo\"";
     gmsh_command += " -o \"" + file_base_name + ".msh\"";
+    // Newer gmsh versions write a newer file format for meshes per default. At
+    // the moment we can't read this new format. This is a switch for gmsh to
+    // write the 'old' file format.
+    gmsh_command += " -format msh22";
     int const gmsh_return_value = std::system(gmsh_command.c_str());
     if (gmsh_return_value != 0)
     {
-- 
GitLab