OGS
convertGEO.cpp File Reference

Detailed Description

Definition in file convertGEO.cpp.

#include <tclap/CmdLine.h>
#include <string>
#include <vector>
#include "Applications/FileIO/readGeometryFromFile.h"
#include "Applications/FileIO/writeGeometryToFile.h"
#include "BaseLib/MPI.h"
#include "GeoLib/GEOObjects.h"
#include "InfoLib/GitInfo.h"
Include dependency graph for convertGEO.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 22 of file convertGEO.cpp.

23{
24 TCLAP::CmdLine cmd(
25 "Converts OGS geometry file into another file format. "
26 "Currently *.gml (OGS6 XML-based format) and *.gli (OGS5 format) "
27 "formats are supported.\n\n"
28 "OpenGeoSys-6 software, version " +
30 ".\n"
31 "Copyright (c) 2012-2025, OpenGeoSys Community "
32 "(http://www.opengeosys.org)",
34 TCLAP::ValueArg<std::string> argInputFileName(
35 "i", "input-file", "the name of the geometry file to be converted",
36 true, "", "file name");
37 cmd.add(argInputFileName);
38 TCLAP::ValueArg<std::string> argOutputFileName(
39 "o", "output-file",
40 "the name of the new geometry file whose file format is guessed from "
41 "its file extension",
42 true, "", "file name");
43 cmd.add(argOutputFileName);
44
45 TCLAP::ValueArg<std::string> gmsh_path_arg("g", "gmsh-path",
46 "the path to the gmsh binary",
47 false, "", "path as string");
48 cmd.add(gmsh_path_arg);
49 cmd.parse(argc, argv);
50
51 BaseLib::MPI::Setup mpi_setup(argc, argv);
52
53 GeoLib::GEOObjects geoObjects;
54 FileIO::readGeometryFromFile(argInputFileName.getValue(), geoObjects,
55 gmsh_path_arg.getValue());
56 auto const geo_names = geoObjects.getGeometryNames();
57 assert(geo_names.size() == 1);
58
59 FileIO::writeGeometryToFile(geo_names[0], geoObjects,
60 argOutputFileName.getValue());
61
62 return EXIT_SUCCESS;
63}
Container class for geometric objects.
Definition GEOObjects.h:57
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
void readGeometryFromFile(std::string const &fname, GeoLib::GEOObjects &geo_objs, std::string const &gmsh_path)
void writeGeometryToFile(std::string const &geo_name, GeoLib::GEOObjects &geo_objs, std::string const &fname)
GITINFOLIB_EXPORT const std::string ogs_version

References GeoLib::GEOObjects::getGeometryNames(), GitInfoLib::GitInfo::ogs_version, FileIO::readGeometryFromFile(), and FileIO::writeGeometryToFile().