18int main(
int argc,
char* argv[])
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 " +
26 "Copyright (c) 2012-2026, OpenGeoSys Community "
27 "(http://www.opengeosys.org)",
30 TCLAP::ValueArg<std::string> output_arg(
31 "o",
"output",
"Output (.vtu). The output mesh file",
true,
"",
35 TCLAP::ValueArg<std::string> input_arg(
36 "i",
"input",
"Input (.pvtu). The partitioned input mesh file",
true,
41 cmd.add(log_level_arg);
42 cmd.parse(argc, argv);
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.");
53 vtkSmartPointer<vtkXMLPUnstructuredGridReader> reader =
54 vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New();
55 reader->SetFileName(input_arg.getValue().c_str());
57 vtkSmartPointer<vtkRemoveGhosts> ghosts =
58 vtkSmartPointer<vtkRemoveGhosts>::New();
59 ghosts->SetInputConnection(reader->GetOutputPort());
61 vtkSmartPointer<vtkCleanUnstructuredGrid> clean =
62 vtkSmartPointer<vtkCleanUnstructuredGrid>::New();
63 clean->SetInputConnection(ghosts->GetOutputPort());
65 vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
66 vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
67 writer->SetInputConnection(clean->GetOutputPort());
68 writer->SetFileName(output_arg.getValue().c_str());