OGS
convertGEO.cpp
Go to the documentation of this file.
1
11#include <tclap/CmdLine.h>
12
13#include <string>
14#include <vector>
15
18#include "BaseLib/MPI.h"
19#include "GeoLib/GEOObjects.h"
20#include "InfoLib/GitInfo.h"
21
22int main(int argc, char* argv[])
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-2024, 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}
Definition of the GEOObjects class.
Git information.
Container class for geometric objects.
Definition GEOObjects.h:57
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
int main(int argc, char *argv[])
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