OGS
readGeometryFromFile.cpp
Go to the documentation of this file.
1
13
14#include <vector>
15
16#include "BaseLib/Error.h"
17#include "BaseLib/FileTools.h"
18#include "GeoLib/GEOObjects.h"
20#include "Legacy/OGSIOVer4.h"
21
22namespace FileIO
23{
24void readGeometryFromFile(std::string const& fname,
25 GeoLib::GEOObjects& geo_objs,
26 std::string const& gmsh_path)
27{
28 if (BaseLib::getFileExtension(fname) == ".gml")
29 {
31 xml.readFile(fname);
32 }
33 else
34 {
35 std::vector<std::string> errors;
36 std::string geo_name; // geo_name is output of the reading function
38 fname, geo_objs, geo_name, errors, gmsh_path);
39 }
40
41 if (geo_objs.getGeometryNames().empty())
42 {
44 "GEOObjects has no geometry name after reading the geometry file. "
45 "Something is wrong in the reading function.");
46 }
47}
48} // namespace FileIO
Definition of the BoostXmlGmlInterface class.
#define OGS_FATAL(...)
Definition Error.h:26
Filename manipulation routines.
Definition of the GEOObjects class.
Definition of the OGSIOVer4 class.
Container class for geometric objects.
Definition GEOObjects.h:57
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
bool readFile(const std::string &fname) override
Reads an xml-file containing OGS geometry.
std::string getFileExtension(const std::string &path)
bool readGLIFileV4(const std::string &fname, GeoLib::GEOObjects &geo, std::string &unique_name, std::vector< std::string > &errors, std::string const &gmsh_path)
void readGeometryFromFile(std::string const &fname, GeoLib::GEOObjects &geo_objs, std::string const &gmsh_path)