diff --git a/Applications/Utils/MeshEdit/moveMeshNodes.cpp b/Applications/Utils/MeshEdit/moveMeshNodes.cpp index 6325ebc86e62ed5106760dfc82dfd953c222d99e..5c8224b2693a0b179b6a01d3acdd0fa9d7ae41d2 100644 --- a/Applications/Utils/MeshEdit/moveMeshNodes.cpp +++ b/Applications/Utils/MeshEdit/moveMeshNodes.cpp @@ -18,7 +18,6 @@ #include "GeoLib/AABB.h" -#include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/writeMeshToFile.h" #include "MeshLib/Mesh.h" @@ -75,7 +74,6 @@ int main (int argc, char* argv[]) INFO("Usage: %s <msh-file.msh> <keyword> [<value1>] [<value2>]", argv[0]); INFO("Available keywords:"); - //for (std::size_t i=0; i<keywords.size(); i++) INFO( "\t-ALL <value1> <value2> : changes the elevation of all mesh " "nodes by <value2> in direction <value1> [x,y,z]."); @@ -209,7 +207,10 @@ int main (int argc, char* argv[]) } /**** add other keywords here ****/ - MeshLib::IO::VtuInterface vtu (mesh.get(), 0, false); - vtu.writeToFile(msh_name.substr(0, msh_name.length() - 4) + "_new.vtu"); + std::string const new_mesh_name (msh_name.substr(0, msh_name.length() - 4) + "_new.vtu"); + if (MeshLib::IO::writeMeshToFile(*mesh, new_mesh_name) != 0) + return EXIT_FAILURE; + + INFO ("Result successfully written.") return EXIT_SUCCESS; } diff --git a/MeshLib/IO/writeMeshToFile.cpp b/MeshLib/IO/writeMeshToFile.cpp index df6d557b25d8c31d59bdf7141c523096b84d9eb9..0f073aa0e4b58411a1d68538898ed30c1cbbce61 100644 --- a/MeshLib/IO/writeMeshToFile.cpp +++ b/MeshLib/IO/writeMeshToFile.cpp @@ -22,19 +22,22 @@ namespace MeshLib { namespace IO { -void writeMeshToFile(const MeshLib::Mesh &mesh, const std::string &file_name) +int writeMeshToFile(const MeshLib::Mesh &mesh, const std::string &file_name) { if (BaseLib::hasFileExtension("msh", file_name)) { MeshLib::IO::Legacy::MeshIO meshIO; meshIO.setMesh(&mesh); meshIO.writeToFile(file_name); + return 0; } else if (BaseLib::hasFileExtension("vtu", file_name)) { MeshLib::IO::VtuInterface writer(&mesh); writer.writeToFile(file_name); - } else { - ERR("writeMeshToFile(): Unknown mesh file format in file %s.", file_name.c_str()); + return 0; } + + ERR("writeMeshToFile(): Unknown mesh file format in file %s.", file_name.c_str()); + return -1; } } // end namespace IO diff --git a/MeshLib/IO/writeMeshToFile.h b/MeshLib/IO/writeMeshToFile.h index ae58ed033c3dcf7dbfe522af9698f12048d0f36b..6bd0b8476dc87c64f518d53454c3721f45954f1a 100644 --- a/MeshLib/IO/writeMeshToFile.h +++ b/MeshLib/IO/writeMeshToFile.h @@ -16,7 +16,7 @@ namespace MeshLib class Mesh; namespace IO { -void writeMeshToFile(const MeshLib::Mesh &mesh, const std::string &file_name); +int writeMeshToFile(const MeshLib::Mesh &mesh, const std::string &file_name); } }