OGS
RemoveGhostData.cpp File Reference

Detailed Description

Definition in file RemoveGhostData.cpp.

#include <tclap/CmdLine.h>
#include <vtkCleanUnstructuredGrid.h>
#include <vtkRemoveGhosts.h>
#include <vtkSmartPointer.h>
#include <vtkUnstructuredGrid.h>
#include <vtkXMLPUnstructuredGridReader.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <mpi.h>
#include "BaseLib/Logging.h"
#include "InfoLib/GitInfo.h"
#include "MeshLib/IO/writeMeshToFile.h"
Include dependency graph for RemoveGhostData.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 26 of file RemoveGhostData.cpp.

27{
28 WARN(
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.");
33
34 TCLAP::CmdLine cmd(
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 " +
39 ".\n"
40 "Copyright (c) 2012-2024, OpenGeoSys Community "
41 "(http://www.opengeosys.org)",
43
44 TCLAP::ValueArg<std::string> output_arg(
45 "o", "output", "the output mesh (*.vtu)", true, "", "output.vtu");
46 cmd.add(output_arg);
47
48 TCLAP::ValueArg<std::string> input_arg(
49 "i", "input", "the partitioned input mesh (*.pvtu)", true, "",
50 "input.pvtu");
51 cmd.add(input_arg);
52 cmd.parse(argc, argv);
53
54#ifdef USE_PETSC
55 MPI_Init(&argc, &argv);
56#endif
57
58 vtkSmartPointer<vtkXMLPUnstructuredGridReader> reader =
59 vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New();
60 reader->SetFileName(input_arg.getValue().c_str());
61
62 vtkSmartPointer<vtkRemoveGhosts> ghosts =
63 vtkSmartPointer<vtkRemoveGhosts>::New();
64 ghosts->SetInputConnection(reader->GetOutputPort());
65
66 vtkSmartPointer<vtkCleanUnstructuredGrid> clean =
67 vtkSmartPointer<vtkCleanUnstructuredGrid>::New();
68 clean->SetInputConnection(ghosts->GetOutputPort());
69
70 vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
71 vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
72 writer->SetInputConnection(clean->GetOutputPort());
73 writer->SetFileName(output_arg.getValue().c_str());
74 writer->Write();
75
76#ifdef USE_PETSC
77 MPI_Finalize();
78#endif
79 return EXIT_SUCCESS;
80}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
GITINFOLIB_EXPORT const std::string ogs_version

References GitInfoLib::GitInfo::ogs_version, and WARN().