19{
20 TCLAP::CmdLine cmd(
21 "Reads a VTK partitioned unstructured grid (*.pvtu), cleans the ghost "
22 "information and saves the data as as a regular, connected mesh file."
23 "\n\nOpenGeoSys-6 software, version " +
25 ".\n"
26 "Copyright (c) 2012-2026, OpenGeoSys Community "
27 "(http://www.opengeosys.org)",
29
30 TCLAP::ValueArg<std::string> output_arg(
31 "o", "output", "Output (.vtu). The output mesh file", true, "",
32 "OUTPUT_FILE");
33 cmd.add(output_arg);
34
35 TCLAP::ValueArg<std::string> input_arg(
36 "i", "input", "Input (.pvtu). The partitioned input mesh file", true,
37 "", "INPUT_FILE");
38 cmd.add(input_arg);
39
41 cmd.add(log_level_arg);
42 cmd.parse(argc, argv);
43
46
48 "Due to lack of functionality to handle VTU field data, this tool is "
49 "replaced with a new tool, pvtu2vtu. Please use pvtu2vtu instead. If "
50 "you use this tool, please make sure that the field data of the VTU "
51 "file are not used in an OGS simulation.");
52
53 vtkSmartPointer<vtkXMLPUnstructuredGridReader> reader =
54 vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New();
55 reader->SetFileName(input_arg.getValue().c_str());
56
57 vtkSmartPointer<vtkRemoveGhosts> ghosts =
58 vtkSmartPointer<vtkRemoveGhosts>::New();
59 ghosts->SetInputConnection(reader->GetOutputPort());
60
61 vtkSmartPointer<vtkCleanUnstructuredGrid> clean =
62 vtkSmartPointer<vtkCleanUnstructuredGrid>::New();
63 clean->SetInputConnection(ghosts->GetOutputPort());
64
65 vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
66 vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
67 writer->SetInputConnection(clean->GetOutputPort());
68 writer->SetFileName(output_arg.getValue().c_str());
69 writer->Write();
70
71 return EXIT_SUCCESS;
72}
void WARN(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