OGS
Mesh2Shape.cpp File Reference

Detailed Description

Definition in file Mesh2Shape.cpp.

#include <tclap/CmdLine.h>
#include "Applications/FileIO/SHPInterface.h"
#include "InfoLib/GitInfo.h"
#include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/Mesh.h"
Include dependency graph for Mesh2Shape.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 17 of file Mesh2Shape.cpp.

18 {
19  TCLAP::CmdLine cmd(
20  "Converts 2D mesh file into shapfile such that each element is "
21  "represented by a polygon. Cell attributes are transferred onto shape "
22  "polygons while point attributes are ignored.\n\n"
23  "OpenGeoSys-6 software, version " +
25  ".\n"
26  "Copyright (c) 2012-2021, OpenGeoSys Community "
27  "(http://www.opengeosys.org)",
29 
30  TCLAP::ValueArg<std::string> output_arg("o", "output-file",
31  "Esri Shapefile (*.shp)", true, "",
32  "output_file.shp");
33  cmd.add(output_arg);
34 
35  TCLAP::ValueArg<std::string> input_arg("i", "input-file",
36  "OGS mesh file (*.vtu, *.msh)", true,
37  "", "input_file.vtu");
38  cmd.add(input_arg);
39 
40  cmd.parse(argc, argv);
41 
42  std::string const file_name(input_arg.getValue());
43  std::unique_ptr<MeshLib::Mesh> const mesh(
45  if (FileIO::SHPInterface::write2dMeshToSHP(output_arg.getValue(), *mesh))
46  {
47  return EXIT_SUCCESS;
48  }
49  return EXIT_FAILURE;
50 }
static bool write2dMeshToSHP(const std::string &file_name, const MeshLib::Mesh &mesh)
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)

References GitInfoLib::GitInfo::ogs_version, MeshLib::IO::readMeshFromFile(), and FileIO::SHPInterface::write2dMeshToSHP().