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