26int main(
int argc,
char* argv[])
29 "Due to lack of functionality to handle VTU field data, this tool is "
30 "replaced with a new tool, pvtu2vtu. Please use pvtu2vtu instead. If "
31 "you use this tool, please make sure that the field data of the VTU "
32 "file are not used in an OGS simulation.");
35 "Reads a VTK partitioned unstructured grid (*.pvtu), cleans the ghost "
36 "information and saves the data as as a regular, connected mesh file."
37 "\n\nOpenGeoSys-6 software, version " +
40 "Copyright (c) 2012-2024, OpenGeoSys Community "
41 "(http://www.opengeosys.org)",
44 TCLAP::ValueArg<std::string> output_arg(
45 "o",
"output",
"the output mesh (*.vtu)",
true,
"",
"output.vtu");
48 TCLAP::ValueArg<std::string> input_arg(
49 "i",
"input",
"the partitioned input mesh (*.pvtu)",
true,
"",
52 cmd.parse(argc, argv);
55 MPI_Init(&argc, &argv);
58 vtkSmartPointer<vtkXMLPUnstructuredGridReader> reader =
59 vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New();
60 reader->SetFileName(input_arg.getValue().c_str());
62 vtkSmartPointer<vtkRemoveGhosts> ghosts =
63 vtkSmartPointer<vtkRemoveGhosts>::New();
64 ghosts->SetInputConnection(reader->GetOutputPort());
66 vtkSmartPointer<vtkCleanUnstructuredGrid> clean =
67 vtkSmartPointer<vtkCleanUnstructuredGrid>::New();
68 clean->SetInputConnection(ghosts->GetOutputPort());
70 vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
71 vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
72 writer->SetInputConnection(clean->GetOutputPort());
73 writer->SetFileName(output_arg.getValue().c_str());