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