OGS
Mesh2Shape.cpp
Go to the documentation of this file.
1
10#include <tclap/CmdLine.h>
11
13#include "BaseLib/MPI.h"
14#include "InfoLib/GitInfo.h"
16#include "MeshLib/Mesh.h"
17
18int main(int argc, char* argv[])
19{
20 TCLAP::CmdLine cmd(
21 "Converts 2D mesh file into shapfile such that each element is "
22 "represented by a polygon. Cell attributes are transferred onto shape "
23 "polygons while point attributes are ignored.\n\n"
24 "OpenGeoSys-6 software, version " +
26 ".\n"
27 "Copyright (c) 2012-2024, OpenGeoSys Community "
28 "(http://www.opengeosys.org)",
30
31 TCLAP::ValueArg<std::string> output_arg("o", "output-file",
32 "Esri Shapefile (*.shp)", true, "",
33 "output_file.shp");
34 cmd.add(output_arg);
35
36 TCLAP::ValueArg<std::string> input_arg("i", "input-file",
37 "OGS mesh file (*.vtu, *.msh)", true,
38 "", "input_file.vtu");
39 cmd.add(input_arg);
40
41 cmd.parse(argc, argv);
42
43 BaseLib::MPI::Setup mpi_setup(argc, argv);
44
45 std::string const file_name(input_arg.getValue());
46 std::unique_ptr<MeshLib::Mesh> const mesh(
48 if (FileIO::SHPInterface::write2dMeshToSHP(output_arg.getValue(), *mesh))
49 {
50 return EXIT_SUCCESS;
51 }
52 return EXIT_FAILURE;
53}
Git information.
int main(int argc, char *argv[])
Definition of the Mesh class.
Implementation of the SHPInterface class.
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, bool const compute_element_neighbors)
Definition of readMeshFromFile function.