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 "BaseLib/Logging.h"
#include "BaseLib/MPI.h"
#include "BaseLib/TCLAPArguments.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 24 of file RemoveGhostData.cpp.

25{
26 TCLAP::CmdLine cmd(
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 " +
31 ".\n"
32 "Copyright (c) 2012-2025, OpenGeoSys Community "
33 "(http://www.opengeosys.org)",
35
36 TCLAP::ValueArg<std::string> output_arg(
37 "o", "output", "Output (.vtu). The output mesh file", true, "",
38 "OUTPUT_FILE");
39 cmd.add(output_arg);
40
41 TCLAP::ValueArg<std::string> input_arg(
42 "i", "input", "Input (.pvtu). The partitioned input mesh file", true,
43 "", "INPUT_FILE");
44 cmd.add(input_arg);
45
46 auto log_level_arg = BaseLib::makeLogLevelArg();
47 cmd.add(log_level_arg);
48 cmd.parse(argc, argv);
49
50 BaseLib::MPI::Setup mpi_setup(argc, argv);
51 BaseLib::initOGSLogger(log_level_arg.getValue());
52
53 WARN(
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.");
58
59 vtkSmartPointer<vtkXMLPUnstructuredGridReader> reader =
60 vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New();
61 reader->SetFileName(input_arg.getValue().c_str());
62
63 vtkSmartPointer<vtkRemoveGhosts> ghosts =
64 vtkSmartPointer<vtkRemoveGhosts>::New();
65 ghosts->SetInputConnection(reader->GetOutputPort());
66
67 vtkSmartPointer<vtkCleanUnstructuredGrid> clean =
68 vtkSmartPointer<vtkCleanUnstructuredGrid>::New();
69 clean->SetInputConnection(ghosts->GetOutputPort());
70
71 vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
72 vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
73 writer->SetInputConnection(clean->GetOutputPort());
74 writer->SetFileName(output_arg.getValue().c_str());
75 writer->Write();
76
77 return EXIT_SUCCESS;
78}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:42
TCLAP::ValueArg< std::string > makeLogLevelArg()
void initOGSLogger(std::string const &log_level)
Definition Logging.cpp:64
GITINFOLIB_EXPORT const std::string ogs_version

References BaseLib::initOGSLogger(), BaseLib::makeLogLevelArg(), GitInfoLib::GitInfo::ogs_version, and WARN().