23int main(
int argc,
char* argv[])
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.");
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 " +
37 "Copyright (c) 2012-2024, OpenGeoSys Community "
38 "(http://www.opengeosys.org)",
41 TCLAP::ValueArg<std::string> output_arg(
42 "o",
"output",
"the output mesh (*.vtu)",
true,
"",
"output.vtu");
45 TCLAP::ValueArg<std::string> input_arg(
46 "i",
"input",
"the partitioned input mesh (*.pvtu)",
true,
"",
49 cmd.parse(argc, argv);
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());