26{
27 TCLAP::CmdLine cmd(
28 "Converts OGS mesh into VTK mesh.\n\n"
29 "OpenGeoSys-6 software, version " +
31 ".\n"
32 "Copyright (c) 2012-2024, OpenGeoSys Community "
33 "(http://www.opengeosys.org)",
35 TCLAP::ValueArg<std::string> mesh_in(
36 "i", "mesh-input-file",
37 "the name of the file containing the input mesh", true, "",
38 "file name of input mesh");
39 cmd.add(mesh_in);
40 TCLAP::ValueArg<std::string> mesh_out(
41 "o", "mesh-output-file",
42 "the name of the file the mesh will be written to", true, "",
43 "file name of output mesh");
44 cmd.add(mesh_out);
45 TCLAP::SwitchArg use_ascii_arg(
46 "", "ascii_output",
47 "Write VTU output in ASCII format. Due to possible rounding the ascii "
48 "output could result in lower accuracy.");
49 cmd.add(use_ascii_arg);
50 cmd.parse(argc, argv);
51
53
54 std::unique_ptr<MeshLib::Mesh const> mesh(
56 if (!mesh)
57 {
58 return EXIT_FAILURE;
59 }
60 INFO(
"Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(),
61 mesh->getNumberOfElements());
62
63 auto const data_mode =
64 use_ascii_arg.getValue() ? vtkXMLWriter::Ascii : vtkXMLWriter::Binary;
65
67
68 return EXIT_SUCCESS;
69}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
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)