OGS
VTK2OGS.cpp File Reference

Detailed Description

Converts VTK mesh into OGS mesh.

Author
Norihiro Watanabe
Date
Aug 07, 2013

Definition in file VTK2OGS.cpp.

#include <tclap/CmdLine.h>
#include <string>
#include "InfoLib/GitInfo.h"
#include "MeshLib/IO/Legacy/MeshIO.h"
#include "MeshLib/IO/VtkIO/VtuInterface.h"
#include "MeshLib/Mesh.h"
Include dependency graph for VTK2OGS.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 VTK2OGS.cpp.

25 {
26  TCLAP::CmdLine cmd(
27  "Converts VTK mesh into OGS mesh.\n\n"
28  "OpenGeoSys-6 software, version " +
30  ".\n"
31  "Copyright (c) 2012-2021, OpenGeoSys Community "
32  "(http://www.opengeosys.org)",
34  TCLAP::ValueArg<std::string> mesh_in(
35  "i", "mesh-input-file",
36  "the name of the file containing the input mesh", true, "",
37  "file name of input mesh");
38  cmd.add(mesh_in);
39  TCLAP::ValueArg<std::string> mesh_out(
40  "o", "mesh-output-file",
41  "the name of the file the mesh will be written to", true, "",
42  "file name of output mesh");
43  cmd.add(mesh_out);
44  cmd.parse(argc, argv);
45 
46  MeshLib::Mesh* mesh(
47  MeshLib::IO::VtuInterface::readVTUFile(mesh_in.getValue()));
48  INFO("Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(),
49  mesh->getNumberOfElements());
50 
52  meshIO.setMesh(mesh);
53  BaseLib::IO::writeStringToFile(meshIO.writeToString(), mesh_out.getValue());
54 
55  return EXIT_SUCCESS;
56 }
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:32
std::string writeToString()
Writes the object to a string.
Definition: Writer.cpp:31
Interface for handling mesh files from OGS-5 and below. (*.msh files)
Definition: MeshIO.h:37
void setMesh(const MeshLib::Mesh *mesh)
Set mesh for writing.
Definition: MeshIO.cpp:363
static MeshLib::Mesh * readVTUFile(std::string const &file_name)
int writeStringToFile(std::string content, std::filesystem::path const &file_path)
Definition: Writer.cpp:45
GITINFOLIB_EXPORT const std::string ogs_version

References MeshLib::Mesh::getNumberOfElements(), MeshLib::Mesh::getNumberOfNodes(), INFO(), GitInfoLib::GitInfo::ogs_version, MeshLib::IO::VtuInterface::readVTUFile(), MeshLib::IO::Legacy::MeshIO::setMesh(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().