24int main(
int argc,
char* argv[])
27 "Reads a VTK partitioned unstructured grid (*.pvtu), cleans the ghost "
28 "information and saves the data as as a regular, connected mesh file."
29 "\n\nOpenGeoSys-6 software, version " +
32 "Copyright (c) 2012-2025, OpenGeoSys Community "
33 "(http://www.opengeosys.org)",
36 TCLAP::ValueArg<std::string> output_arg(
37 "o",
"output",
"Output (.vtu). The output mesh file",
true,
"",
41 TCLAP::ValueArg<std::string> input_arg(
42 "i",
"input",
"Input (.pvtu). The partitioned input mesh file",
true,
47 cmd.add(log_level_arg);
48 cmd.parse(argc, argv);
54 "Due to lack of functionality to handle VTU field data, this tool is "
55 "replaced with a new tool, pvtu2vtu. Please use pvtu2vtu instead. If "
56 "you use this tool, please make sure that the field data of the VTU "
57 "file are not used in an OGS simulation.");
59 vtkSmartPointer<vtkXMLPUnstructuredGridReader> reader =
60 vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New();
61 reader->SetFileName(input_arg.getValue().c_str());
63 vtkSmartPointer<vtkRemoveGhosts> ghosts =
64 vtkSmartPointer<vtkRemoveGhosts>::New();
65 ghosts->SetInputConnection(reader->GetOutputPort());
67 vtkSmartPointer<vtkCleanUnstructuredGrid> clean =
68 vtkSmartPointer<vtkCleanUnstructuredGrid>::New();
69 clean->SetInputConnection(ghosts->GetOutputPort());
71 vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
72 vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
73 writer->SetInputConnection(clean->GetOutputPort());
74 writer->SetFileName(output_arg.getValue().c_str());