18{
19 TCLAP::CmdLine cmd(
20 "Converts OGS mesh into VTK mesh.\n\n"
21 "OpenGeoSys-6 software, version " +
23 ".\n"
24 "Copyright (c) 2012-2026, OpenGeoSys Community "
25 "(http://www.opengeosys.org)",
27 TCLAP::ValueArg<std::string> mesh_in(
28 "i", "mesh-input-file",
29 "Input (.msh). The name of the file containing the input mesh", true,
30 "", "INPUT_FILE");
31 cmd.add(mesh_in);
32 TCLAP::ValueArg<std::string> mesh_out(
33 "o", "mesh-output-file",
34 "Output (.vtk), The name of the file the mesh will be written to", true,
35 "", "OUTPUT_FILE");
36 cmd.add(mesh_out);
38 cmd.add(log_level_arg);
39 TCLAP::SwitchArg use_ascii_arg(
40 "", "ascii_output",
41 "Write VTU output in ASCII file. Due to possible rounding the ascii "
42 "output could result in lower accuracy");
43 cmd.add(use_ascii_arg);
44 cmd.parse(argc, argv);
45
48
49 std::unique_ptr<MeshLib::Mesh const> mesh(
51 if (!mesh)
52 {
53 return EXIT_FAILURE;
54 }
55 INFO(
"Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(),
56 mesh->getNumberOfElements());
57
58 auto const data_mode =
59 use_ascii_arg.getValue() ? vtkXMLWriter::Ascii : vtkXMLWriter::Binary;
60
62
63 return EXIT_SUCCESS;
64}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
TCLAP::ValueArg< std::string > makeLogLevelArg()
void initOGSLogger(std::string const &log_level)
GITINFOLIB_EXPORT const std::string ogs_version
int writeVtu(MeshLib::Mesh const &mesh, std::string const &file_name, int const data_mode)
MeshLib::Mesh * readMeshFromFile(const std::string &file_name, bool const compute_element_neighbors)