15#define BOOST_FILESYSTEM_VERSION 3
34 : QDialog(parent), _gmsh_path(gmsh_path)
42 const QString& output)
const
52 for (
const auto& input_string : input)
54 const QFileInfo fi(input_string);
55 const std::string output_str =
56 QString(output +
"/" + fi.completeBaseName() +
".gli")
72 catch (std::runtime_error
const& err)
75 "Failed to read file `" + input_string +
"'");
89 const QString& output)
const
99 for (
const auto& input_string : input)
101 const QFileInfo fi(input_string);
102 const std::string output_str =
103 QString(output +
"/" + fi.completeBaseName() +
".gml")
111 std::string unique_name;
112 std::vector<std::string> errors;
116 if (errors.empty() ||
117 (errors.size() == 1 &&
118 errors[0] ==
"[readSurface] polyline for surface not found!"))
120 std::string
const geo_name =
130 for (
auto& error : errors)
140 const QString& output)
const
147 for (
const auto& input_string : input)
149 const QFileInfo fi(input_string);
150 const std::string output_str =
151 QString(output +
"/" + fi.completeBaseName() +
".msh")
175 const QString& output)
const
182 for (
const auto& input_string : input)
184 const QFileInfo fi(input_string);
185 const std::string output_str =
186 QString(output +
"/" + fi.completeBaseName() +
".vtu")
252 std::ifstream
const file(file_name.c_str());
258 "The file '" + name +
259 "' already exists.\n Do you want to overwrite it?",
Definition of FileListDialog class.
Definition of the GEOObjects class.
Definition of the MeshIO class.
Definition of the Mesh class.
Definition of the OGSError class.
Definition of OGSFileConverter class.
Definition of the OGSIOVer4 class.
Implementation of the VtuInterface class.
Definition of the XmlGmlInterface class.
std::string writeToString()
Writes the object to a string.
const QStringList getInputFileList() const
Returns list of all selected files.
const QString getOutputDir() const
Returns selected output directory.
Container class for geometric objects.
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
bool removePointVec(const std::string &name)
bool removeSurfaceVec(const std::string &name)
bool removePolylineVec(const std::string &name)
Reads and writes GeoObjects to and from XML files.
int readFile(const QString &fileName) override
Reads an xml-file containing geometric object definitions into the GEOObjects used in the constructor...
Interface for handling mesh files from OGS-5 and below. (*.msh files)
MeshLib::Mesh * loadMeshFromFile(const std::string &file_name)
Read mesh from file.
void setMesh(const MeshLib::Mesh *mesh)
Set mesh for writing.
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures....
static MeshLib::Mesh * readVTUFile(std::string const &file_name, bool const compute_element_neighbors=false)
bool writeToFile(std::filesystem::path const &file_path)
static void box(const QString &e)
static bool question(const QString &e, const QString &t)
bool fileExists(const std::string &file_name) const
Checks if a given file already exists.
void on_vtu2mshButton_pressed() const
void convertGLI2GML(const QStringList &input, const QString &output) const
std::string const _gmsh_path
void on_msh2vtuButton_pressed() const
OGSFileConverter(std::string const &gmsh_path, QWidget *parent=nullptr)
Constructor.
void on_closeDialogButton_pressed()
void on_gml2gliButton_pressed() const
~OGSFileConverter() override
Destructor.
void convertVTU2MSH(const QStringList &input, const QString &output) const
void convertGML2GLI(const QStringList &input, const QString &output) const
Converts all files in the input list and writes the new files to the output directory with the same f...
void convertMSH2VTU(const QStringList &input, const QString &output) const
void on_gli2gmlButton_pressed() const
int writeStringToFile(std::string_view content, std::filesystem::path const &file_path)
std::string extractBaseName(std::string const &pathname)
bool readGLIFileV4(const std::string &fname, GeoLib::GEOObjects &geo, std::string &unique_name, std::vector< std::string > &errors, std::string const &gmsh_path)
void writeGLIFileV4(const std::string &fname, const std::string &geo_name, const GeoLib::GEOObjects &geo)