Skip to content
Snippets Groups Projects
Commit f781f5c9 authored by Tom Fischer's avatar Tom Fischer
Browse files

Merge pull request #1188 from TomFischer/ReworkTools

Cleanup in tools
parents ab823efd 698db5d5
No related branches found
No related tags found
No related merge requests found
Showing
with 133 additions and 315 deletions
...@@ -17,25 +17,18 @@ ...@@ -17,25 +17,18 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog
#include "logog/include/logog.hpp"
// ShapeLib // ShapeLib
#include <shapefil.h> #include <shapefil.h>
// BaseLib #include "Applications/ApplicationsLib/LogogSetup.h"
#include "LogogSimpleFormatter.h"
#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" #include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
#include "GeoLib/IO/XmlIO/Qt/XmlStnInterface.h" #include "GeoLib/IO/XmlIO/Qt/XmlStnInterface.h"
#include "GeoLib/GEOObjects.h"
// GeoLib #include "GeoLib/Point.h"
#include "GEOObjects.h" #include "GeoLib/Station.h"
#include "Point.h"
#include "Station.h"
void convertPoints (DBFHandle dbf_handle, void convertPoints (DBFHandle dbf_handle,
std::string const& out_fname, std::string const& out_fname,
...@@ -140,10 +133,7 @@ void printFieldInformationTable(DBFHandle const& dbf_handle, std::size_t n_field ...@@ -140,10 +133,7 @@ void printFieldInformationTable(DBFHandle const& dbf_handle, std::size_t n_field
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Converts points contained in shape file", ' ', "0.1"); TCLAP::CmdLine cmd("Converts points contained in shape file", ' ', "0.1");
TCLAP::ValueArg<std::string> shapefile_arg("s", TCLAP::ValueArg<std::string> shapefile_arg("s",
...@@ -172,7 +162,7 @@ int main (int argc, char* argv[]) ...@@ -172,7 +162,7 @@ int main (int argc, char* argv[])
ERR("Shape file contains %d polylines.", number_of_elements); ERR("Shape file contains %d polylines.", number_of_elements);
ERR("This programm only handles only files containing points."); ERR("This programm only handles only files containing points.");
SHPClose(hSHP); SHPClose(hSHP);
return 0; return EXIT_SUCCESS;
} }
SHPClose(hSHP); SHPClose(hSHP);
} else { } else {
...@@ -239,9 +229,5 @@ int main (int argc, char* argv[]) ...@@ -239,9 +229,5 @@ int main (int argc, char* argv[])
ERR("Could not open the database file."); ERR("Could not open the database file.");
} }
delete custom_format; return EXIT_SUCCESS;
delete logog_cout;
LOGOG_SHUTDOWN();
return 0;
} }
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
* *
*/ */
// STL
#include <string> #include <string>
#include <memory>
// ThirdParty // ThirdParty
#include "tclap/CmdLine.h" #include <tclap/CmdLine.h>
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib // BaseLib
#include "BaseLib/FileTools.h" #include "BaseLib/FileTools.h"
...@@ -22,23 +21,18 @@ ...@@ -22,23 +21,18 @@
#ifndef WIN32 #ifndef WIN32
#include "BaseLib/MemWatch.h" #include "BaseLib/MemWatch.h"
#endif #endif
#include "BaseLib/LogogSimpleFormatter.h"
// FileIO // FileIO
#include "FileIO/FEFLOWInterface.h"
#include "MeshLib/IO/writeMeshToFile.h" #include "MeshLib/IO/writeMeshToFile.h"
#include "MeshLib/IO/Legacy/MeshIO.h" #include "MeshLib/IO/Legacy/MeshIO.h"
#include "FileIO/FEFLOWInterface.h"
#include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/IO/VtkIO/VtuInterface.h"
// MeshLib
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *const custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Converting a mesh in FEFLOW file format (ASCII, version 5.4) to a vtk unstructured grid file (new OGS file format) or to the old OGS file format - see options.", ' ', "0.1"); TCLAP::CmdLine cmd("Converting a mesh in FEFLOW file format (ASCII, version 5.4) to a vtk unstructured grid file (new OGS file format) or to the old OGS file format - see options.", ' ', "0.1");
...@@ -71,11 +65,12 @@ int main (int argc, char* argv[]) ...@@ -71,11 +65,12 @@ int main (int argc, char* argv[])
BaseLib::RunTime run_time; BaseLib::RunTime run_time;
run_time.start(); run_time.start();
FileIO::FEFLOWInterface feflowIO(nullptr); FileIO::FEFLOWInterface feflowIO(nullptr);
MeshLib::Mesh const*const mesh(feflowIO.readFEFLOWFile(feflow_mesh_arg.getValue())); std::unique_ptr<MeshLib::Mesh const> mesh(
feflowIO.readFEFLOWFile(feflow_mesh_arg.getValue()));
if (mesh == nullptr) { if (mesh == nullptr) {
INFO("Could not read mesh from %s.", feflow_mesh_arg.getValue().c_str()); INFO("Could not read mesh from %s.", feflow_mesh_arg.getValue().c_str());
return -1; return EXIT_FAILURE;
} }
#ifndef WIN32 #ifndef WIN32
unsigned long mem_with_mesh (mem_watch.getVirtMemUsage()); unsigned long mem_with_mesh (mem_watch.getVirtMemUsage());
...@@ -84,13 +79,10 @@ int main (int argc, char* argv[]) ...@@ -84,13 +79,10 @@ int main (int argc, char* argv[])
INFO("Time for reading: %f seconds.", run_time.elapsed()); INFO("Time for reading: %f seconds.", run_time.elapsed());
INFO("Read %d nodes and %d elements.", mesh->getNNodes(), mesh->getNElements()); INFO("Read %d nodes and %d elements.", mesh->getNNodes(), mesh->getNElements());
// *** write mesh in new format
std::string ogs_mesh_fname(ogs_mesh_arg.getValue()); std::string ogs_mesh_fname(ogs_mesh_arg.getValue());
INFO("Writing %s.", ogs_mesh_fname.c_str()); INFO("Writing %s.", ogs_mesh_fname.c_str());
MeshLib::IO::writeMeshToFile(*mesh, ogs_mesh_fname); MeshLib::IO::writeMeshToFile(*mesh, ogs_mesh_fname);
INFO("\tDone."); INFO("\tDone.");
return EXIT_SUCCESS;
delete mesh;
} }
...@@ -17,10 +17,9 @@ ...@@ -17,10 +17,9 @@
#include <algorithm> #include <algorithm>
// ThirdParty // ThirdParty
#include "tclap/CmdLine.h" #include <tclap/CmdLine.h>
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib // BaseLib
#include "FileTools.h" #include "FileTools.h"
...@@ -28,24 +27,18 @@ ...@@ -28,24 +27,18 @@
#ifndef WIN32 #ifndef WIN32
#include "MemWatch.h" #include "MemWatch.h"
#endif #endif
#include "LogogSimpleFormatter.h"
// FileIO // FileIO
#include "FileIO/GMSHInterface.h" #include "FileIO/GMSHInterface.h"
#include "MeshLib/IO/Legacy/MeshIO.h"
#include "MeshLib/IO/VtkIO/VtuInterface.h"
// MeshLib #include "MeshLib/IO/writeMeshToFile.h"
#include "MeshLib/MeshSearch/ElementSearch.h" #include "MeshLib/MeshSearch/ElementSearch.h"
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
#include "MeshLib/MeshEditing/RemoveMeshComponents.h" #include "MeshLib/MeshEditing/RemoveMeshComponents.h"
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *const custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Converting meshes in gmsh file format (ASCII, version 2.2) to a vtk unstructured grid file (new OGS file format) or to the old OGS file format - see options.", ' ', "0.1"); TCLAP::CmdLine cmd("Converting meshes in gmsh file format (ASCII, version 2.2) to a vtk unstructured grid file (new OGS file format) or to the old OGS file format - see options.", ' ', "0.1");
...@@ -110,21 +103,7 @@ int main (int argc, char* argv[]) ...@@ -110,21 +103,7 @@ int main (int argc, char* argv[])
} }
// *** write mesh in new format // *** write mesh in new format
std::string ogs_mesh_fname(ogs_mesh_arg.getValue()); MeshLib::IO::writeMeshToFile(*mesh, ogs_mesh_arg.getValue());
if (BaseLib::getFileExtension(ogs_mesh_fname).compare("msh") == 0) {
INFO("Writing %s.", ogs_mesh_fname.c_str());
MeshLib::IO::Legacy::MeshIO mesh_io;
mesh_io.setMesh(mesh);
mesh_io.writeToFile(ogs_mesh_fname);
} else {
if (BaseLib::getFileExtension(ogs_mesh_fname).compare("vtu") != 0) {
ogs_mesh_fname += ".vtu";
}
INFO("Writing %s.", ogs_mesh_fname.c_str());
MeshLib::IO::VtuInterface mesh_io(mesh);
mesh_io.writeToFile(ogs_mesh_fname);
}
INFO("\tDone.");
delete mesh; delete mesh;
} }
......
...@@ -11,31 +11,20 @@ ...@@ -11,31 +11,20 @@
* http://www.opengeosys.org/LICENSE.txt * http://www.opengeosys.org/LICENSE.txt
*/ */
// STL
#include <string> #include <string>
#include <memory>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib
#include "LogogSimpleFormatter.h"
// FileIO
#include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/IO/VtkIO/VtuInterface.h"
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/Mesh.h"
// MeshLib
#include "Mesh.h"
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Converts OGS mesh into VTK mesh.", ' ', "0.1"); TCLAP::CmdLine cmd("Converts OGS mesh into VTK mesh.", ' ', "0.1");
TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file", TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file",
...@@ -48,15 +37,12 @@ int main (int argc, char* argv[]) ...@@ -48,15 +37,12 @@ int main (int argc, char* argv[])
cmd.add(mesh_out); cmd.add(mesh_out);
cmd.parse(argc, argv); cmd.parse(argc, argv);
MeshLib::Mesh* mesh (MeshLib::IO::readMeshFromFile(mesh_in.getValue())); std::unique_ptr<MeshLib::Mesh const> mesh(
MeshLib::IO::readMeshFromFile(mesh_in.getValue()));
INFO("Mesh read: %d nodes, %d elements.", mesh->getNNodes(), mesh->getNElements()); INFO("Mesh read: %d nodes, %d elements.", mesh->getNNodes(), mesh->getNElements());
MeshLib::IO::VtuInterface vtu(mesh); MeshLib::IO::VtuInterface vtu(mesh.get());
vtu.writeToFile(mesh_out.getValue()); vtu.writeToFile(mesh_out.getValue());
delete custom_format; return EXIT_SUCCESS;
delete logog_cout;
LOGOG_SHUTDOWN();
return 0;
} }
...@@ -11,15 +11,12 @@ ...@@ -11,15 +11,12 @@
#include <string> #include <string>
#include <vector> #include <vector>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib // BaseLib
#include "BaseLib/BuildInfo.h" #include "BaseLib/BuildInfo.h"
#include "BaseLib/LogogSimpleFormatter.h"
#include "BaseLib/FileTools.h" #include "BaseLib/FileTools.h"
// GeoLib // GeoLib
...@@ -28,7 +25,6 @@ ...@@ -28,7 +25,6 @@
#include "GeoLib/PointVec.h" #include "GeoLib/PointVec.h"
#include "GeoLib/IO/TINInterface.h" #include "GeoLib/IO/TINInterface.h"
// FileIO
#include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/IO/VtkIO/VtuInterface.h"
// MeshLib // MeshLib
...@@ -38,10 +34,7 @@ ...@@ -38,10 +34,7 @@
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Converts TIN file into VTU file.", ' ', BaseLib::BuildInfo::git_describe); TCLAP::CmdLine cmd("Converts TIN file into VTU file.", ' ', BaseLib::BuildInfo::git_describe);
TCLAP::ValueArg<std::string> inArg("i", "input-tin-file", TCLAP::ValueArg<std::string> inArg("i", "input-tin-file",
...@@ -62,7 +55,7 @@ int main (int argc, char* argv[]) ...@@ -62,7 +55,7 @@ int main (int argc, char* argv[])
std::unique_ptr<GeoLib::Surface> sfc( std::unique_ptr<GeoLib::Surface> sfc(
GeoLib::IO::TINInterface::readTIN(tinFileName, point_vec)); GeoLib::IO::TINInterface::readTIN(tinFileName, point_vec));
if (!sfc) if (!sfc)
return 1; return EXIT_FAILURE;
INFO("TIN read: %d points, %d triangles", pnt_vec->size(), sfc->getNTriangles()); INFO("TIN read: %d points, %d triangles", pnt_vec->size(), sfc->getNTriangles());
INFO("converting to mesh data"); INFO("converting to mesh data");
...@@ -73,9 +66,5 @@ int main (int argc, char* argv[]) ...@@ -73,9 +66,5 @@ int main (int argc, char* argv[])
MeshLib::IO::VtuInterface writer(mesh.get()); MeshLib::IO::VtuInterface writer(mesh.get());
writer.writeToFile(outArg.getValue()); writer.writeToFile(outArg.getValue());
delete custom_format; return EXIT_SUCCESS;
delete logog_cout;
LOGOG_SHUTDOWN();
return 0;
} }
...@@ -14,16 +14,10 @@ ...@@ -14,16 +14,10 @@
// STL // STL
#include <string> #include <string>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib
#include "LogogSimpleFormatter.h"
// FileIO
#include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/IO/VtkIO/VtuInterface.h"
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
...@@ -31,10 +25,7 @@ ...@@ -31,10 +25,7 @@
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Converts VTK mesh into OGS mesh.", ' ', "0.1"); TCLAP::CmdLine cmd("Converts VTK mesh into OGS mesh.", ' ', "0.1");
TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file", TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file",
...@@ -54,9 +45,5 @@ int main (int argc, char* argv[]) ...@@ -54,9 +45,5 @@ int main (int argc, char* argv[])
meshIO.setMesh(mesh); meshIO.setMesh(mesh);
meshIO.writeToFile(mesh_out.getValue()); meshIO.writeToFile(mesh_out.getValue());
delete custom_format; return EXIT_SUCCESS;
delete logog_cout;
LOGOG_SHUTDOWN();
return 0;
} }
...@@ -11,11 +11,9 @@ ...@@ -11,11 +11,9 @@
#include <string> #include <string>
#include <fstream> #include <fstream>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib // BaseLib
#include "BaseLib/BuildInfo.h" #include "BaseLib/BuildInfo.h"
...@@ -32,16 +30,12 @@ ...@@ -32,16 +30,12 @@
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
#include "MeshLib/convertMeshToGeo.h" #include "MeshLib/convertMeshToGeo.h"
// FileIO
#include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/IO/VtkIO/VtuInterface.h"
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Converts VTK mesh into TIN file.", ' ', BaseLib::BuildInfo::git_describe); TCLAP::CmdLine cmd("Converts VTK mesh into TIN file.", ' ', BaseLib::BuildInfo::git_describe);
TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file", TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file",
...@@ -66,9 +60,5 @@ int main (int argc, char* argv[]) ...@@ -66,9 +60,5 @@ int main (int argc, char* argv[])
mesh_out.getValue()); mesh_out.getValue());
} }
delete custom_format; return EXIT_SUCCESS;
delete logog_cout;
LOGOG_SHUTDOWN();
return 0;
} }
...@@ -14,10 +14,7 @@ ...@@ -14,10 +14,7 @@
#include <memory> #include <memory>
// ThirdParty/logog #include <tclap/CmdLine.h>
#include "logog/include/logog.hpp"
#include "tclap/CmdLine.h"
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
...@@ -90,7 +87,6 @@ int main (int argc, char* argv[]) ...@@ -90,7 +87,6 @@ int main (int argc, char* argv[])
MeshLib::IO::writeMeshToFile(*mesh, new_mshname); MeshLib::IO::writeMeshToFile(*mesh, new_mshname);
INFO("New files \"%s\" and \"%s\" written.", new_mshname.c_str(), new_matname.c_str()); INFO("New files \"%s\" and \"%s\" written.", new_mshname.c_str(), new_matname.c_str());
std::cout << "Conversion finished." << std::endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
...@@ -12,25 +12,22 @@ ...@@ -12,25 +12,22 @@
*/ */
// ThirdParty // ThirdParty
#include "tclap/CmdLine.h" #include <tclap/CmdLine.h>
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
#include "BaseLib/LogogSimpleFormatter.h"
#include "MathLib/Vector3.h"
#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" #include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
#include "GeoLib/GEOObjects.h" #include "GeoLib/GEOObjects.h"
#include "MathLib/Vector3.h"
#include <QCoreApplication> #include <QCoreApplication>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
LOGOG_INITIALIZE();
logog::Cout *logogCout(new logog::Cout); ApplicationsLib::LogogSetup logog_setup;
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logogCout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd TCLAP::CmdLine cmd
("Moves the points of a geometry by a given displacement vector.", ' ', "0.1"); ("Moves the points of a geometry by a given displacement vector.", ' ', "0.1");
...@@ -55,10 +52,7 @@ int main(int argc, char *argv[]) ...@@ -55,10 +52,7 @@ int main(int argc, char *argv[])
GeoLib::IO::XmlGmlInterface xml(geo_objects); GeoLib::IO::XmlGmlInterface xml(geo_objects);
if (!xml.readFile(geo_input_arg.getValue())) if (!xml.readFile(geo_input_arg.getValue()))
{ {
delete logogCout; return EXIT_FAILURE;
delete custom_format;
LOGOG_SHUTDOWN();
return 1;
} }
MathLib::Vector3 displacement(0.0, 0.0, 0.0); MathLib::Vector3 displacement(0.0, 0.0, 0.0);
...@@ -81,8 +75,5 @@ int main(int argc, char *argv[]) ...@@ -81,8 +75,5 @@ int main(int argc, char *argv[])
xml.setNameForExport(geo_names[0]); xml.setNameForExport(geo_names[0]);
xml.writeToFile(geo_output_arg.getValue()); xml.writeToFile(geo_output_arg.getValue());
delete logogCout; return EXIT_SUCCESS;
delete custom_format;
LOGOG_SHUTDOWN();
return 0;
} }
...@@ -13,11 +13,12 @@ ...@@ -13,11 +13,12 @@
#include <string> #include <string>
#include "logog/include/logog.hpp" #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
#include "Applications/ApplicationsLib/LogogSetup.h"
#include "BaseLib/BuildInfo.h" #include "BaseLib/BuildInfo.h"
#include "BaseLib/LogogSimpleFormatter.h"
#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h" #include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
#include "GeoLib/AnalyticalGeometry.h" #include "GeoLib/AnalyticalGeometry.h"
#include "GeoLib/GEOObjects.h" #include "GeoLib/GEOObjects.h"
...@@ -25,7 +26,6 @@ ...@@ -25,7 +26,6 @@
#include <QCoreApplication> #include <QCoreApplication>
std::string output_question() std::string output_question()
{ {
WARN ("Given polyline is not closed. Close polyline now?"); WARN ("Given polyline is not closed. Close polyline now?");
...@@ -39,10 +39,7 @@ int main(int argc, char *argv[]) ...@@ -39,10 +39,7 @@ int main(int argc, char *argv[])
{ {
QCoreApplication app(argc, argv, false); QCoreApplication app(argc, argv, false);
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog::Cout *logogCout(new logog::Cout);
logogCout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Triangulates the specified polyline in the given geometry file.", ' ', BaseLib::BuildInfo::git_describe); TCLAP::CmdLine cmd("Triangulates the specified polyline in the given geometry file.", ' ', BaseLib::BuildInfo::git_describe);
TCLAP::ValueArg<std::string> input_arg("i", "input", "GML input file (*.gml)", true, "", "string"); TCLAP::ValueArg<std::string> input_arg("i", "input", "GML input file (*.gml)", true, "", "string");
...@@ -61,7 +58,7 @@ int main(int argc, char *argv[]) ...@@ -61,7 +58,7 @@ int main(int argc, char *argv[])
if (!xml.readFile(file_name)) if (!xml.readFile(file_name))
{ {
ERR ("Failed to load geometry file."); ERR ("Failed to load geometry file.");
return 1; return EXIT_FAILURE;
} }
std::vector<std::string> geo_names; std::vector<std::string> geo_names;
...@@ -73,14 +70,14 @@ int main(int argc, char *argv[]) ...@@ -73,14 +70,14 @@ int main(int argc, char *argv[])
if (line == nullptr) if (line == nullptr)
{ {
ERR ("No polyline found with name \"%s\". Aborting...", polyline_name.c_str()); ERR ("No polyline found with name \"%s\". Aborting...", polyline_name.c_str());
return 1; return EXIT_FAILURE;
} }
// check if polyline can be triangulated (i.e. closed + coplanar) // check if polyline can be triangulated (i.e. closed + coplanar)
if (!line->isCoplanar()) if (!line->isCoplanar())
{ {
ERR ("Polyline is not coplanar, no unambiguous triangulation possible. Aborting..."); ERR ("Polyline is not coplanar, no unambiguous triangulation possible. Aborting...");
return 1; return EXIT_FAILURE;
} }
if (!line->isClosed()) if (!line->isClosed())
...@@ -95,7 +92,7 @@ int main(int argc, char *argv[]) ...@@ -95,7 +92,7 @@ int main(int argc, char *argv[])
INFO ("Polyline closed."); INFO ("Polyline closed.");
} }
else else
return 1; return EXIT_FAILURE;
} }
// create surface // create surface
...@@ -129,8 +126,5 @@ int main(int argc, char *argv[]) ...@@ -129,8 +126,5 @@ int main(int argc, char *argv[])
xml.writeToFile(output_arg.getValue()); xml.writeToFile(output_arg.getValue());
INFO ("...done."); INFO ("...done.");
delete logogCout; return EXIT_SUCCESS;
delete custom_format;
LOGOG_SHUTDOWN();
return 0;
} }
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
#include <memory> #include <memory>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
......
...@@ -14,33 +14,24 @@ ...@@ -14,33 +14,24 @@
#include <vector> #include <vector>
#include <fstream> #include <fstream>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog
#include "logog/include/logog.hpp"
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
// BaseLib
#include "BaseLib/FileTools.h" #include "BaseLib/FileTools.h"
// FileIO
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/IO/writeMeshToFile.h" #include "MeshLib/IO/writeMeshToFile.h"
// GeoLib
#include "GeoLib/GEOObjects.h" #include "GeoLib/GEOObjects.h"
#include "GeoLib/Point.h" #include "GeoLib/Point.h"
#include "GeoLib/IO/readGeometryFromFile.h" #include "GeoLib/IO/readGeometryFromFile.h"
#include "GeoLib/IO/writeGeometryToFile.h" #include "GeoLib/IO/writeGeometryToFile.h"
// MeshLib
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
#include "MeshLib/MeshSurfaceExtraction.h" #include "MeshLib/MeshSurfaceExtraction.h"
// MeshGeoToolsLib
#include "MeshGeoToolsLib/MeshNodeSearcher.h" #include "MeshGeoToolsLib/MeshNodeSearcher.h"
void convertMeshNodesToGeometry(std::vector<MeshLib::Node*> const& nodes, void convertMeshNodesToGeometry(std::vector<MeshLib::Node*> const& nodes,
...@@ -173,7 +164,8 @@ int main (int argc, char* argv[]) ...@@ -173,7 +164,8 @@ int main (int argc, char* argv[])
// *** read mesh // *** read mesh
INFO("Reading mesh \"%s\" ... ", mesh_arg.getValue().c_str()); INFO("Reading mesh \"%s\" ... ", mesh_arg.getValue().c_str());
MeshLib::Mesh * subsurface_mesh(MeshLib::IO::readMeshFromFile(mesh_arg.getValue())); std::unique_ptr<MeshLib::Mesh> subsurface_mesh(
MeshLib::IO::readMeshFromFile(mesh_arg.getValue()));
INFO("done."); INFO("done.");
INFO("Extracting top surface of mesh \"%s\" ... ", INFO("Extracting top surface of mesh \"%s\" ... ",
mesh_arg.getValue().c_str()); mesh_arg.getValue().c_str());
...@@ -183,8 +175,7 @@ int main (int argc, char* argv[]) ...@@ -183,8 +175,7 @@ int main (int argc, char* argv[])
MeshLib::MeshSurfaceExtraction::getMeshSurface(*subsurface_mesh, dir, MeshLib::MeshSurfaceExtraction::getMeshSurface(*subsurface_mesh, dir,
angle)); angle));
INFO("done."); INFO("done.");
delete subsurface_mesh; subsurface_mesh.reset(nullptr);
subsurface_mesh = nullptr;
// *** read geometry // *** read geometry
GeoLib::GEOObjects geometries; GeoLib::GEOObjects geometries;
...@@ -203,7 +194,7 @@ int main (int argc, char* argv[]) ...@@ -203,7 +194,7 @@ int main (int argc, char* argv[])
if (!plys) { if (!plys) {
ERR("Could not get vector of polylines out of geometry \"%s\".", ERR("Could not get vector of polylines out of geometry \"%s\".",
geo_name.c_str()); geo_name.c_str());
return -1; return EXIT_FAILURE;
} }
MeshGeoToolsLib::SearchLength search_length_strategy; MeshGeoToolsLib::SearchLength search_length_strategy;
...@@ -230,7 +221,7 @@ int main (int argc, char* argv[]) ...@@ -230,7 +221,7 @@ int main (int argc, char* argv[])
geometry_sets.getGeometryNames(geo_names); geometry_sets.getGeometryNames(geo_names);
if (geo_names.empty()) { if (geo_names.empty()) {
ERR("Did not find mesh nodes along polylines."); ERR("Did not find mesh nodes along polylines.");
return -1; return EXIT_FAILURE;
} }
std::string merge_name("AllMeshNodesAlongPolylines"); std::string merge_name("AllMeshNodesAlongPolylines");
...@@ -289,5 +280,5 @@ int main (int argc, char* argv[]) ...@@ -289,5 +280,5 @@ int main (int argc, char* argv[])
BaseLib::dropFileExtension(output_base_fname.getValue())); BaseLib::dropFileExtension(output_base_fname.getValue()));
writeBCsAndGeometry(geometry_sets, surface_name, base_fname, writeBCsAndGeometry(geometry_sets, surface_name, base_fname,
bc_type.getValue(), gml_arg.getValue()); bc_type.getValue(), gml_arg.getValue());
return 0; return EXIT_SUCCESS;
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "tclap/CmdLine.h" #include <tclap/CmdLine.h>
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
......
...@@ -13,34 +13,21 @@ ...@@ -13,34 +13,21 @@
#include <cstdlib> #include <cstdlib>
#include <vector> #include <vector>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib
#include "BaseLib/LogogSimpleFormatter.h"
// FileIO
#include "MeshLib/IO/readMeshFromFile.h"
#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h"
// GeoLib
#include "GeoLib/GEOObjects.h" #include "GeoLib/GEOObjects.h"
#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h"
// MeshLib
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
#include "MeshLib/IO/readMeshFromFile.h"
// MeshGeoToolsLib
#include "MeshGeoToolsLib/GeoMapper.h" #include "MeshGeoToolsLib/GeoMapper.h"
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Maps geometric objects to the surface of a given mesh." TCLAP::CmdLine cmd("Maps geometric objects to the surface of a given mesh."
"The documentation is available at https://docs.opengeosys.org/docs/tools/model-preparation/map-geometric-object-to-the-surface-of-a-mesh", "The documentation is available at https://docs.opengeosys.org/docs/tools/model-preparation/map-geometric-object-to-the-surface-of-a-mesh",
......
...@@ -10,36 +10,26 @@ ...@@ -10,36 +10,26 @@
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
*/ */
// ThirdParty #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib #include "BaseLib/StringTools.h"
#include "StringTools.h" #include "BaseLib/FileTools.h"
#include "FileTools.h"
#include "LogogSimpleFormatter.h"
// FileIO
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/IO/writeMeshToFile.h"
// GeoLib #include "GeoLib/AABB.h"
#include "AABB.h"
// MeshLib
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
#include "Elements/Element.h" #include "MeshLib/Elements/Element.h"
#include "MeshEditing/moveMeshNodes.h" #include "MeshLib/MeshEditing/moveMeshNodes.h"
#include "Mesh.h" #include "MeshLib/Mesh.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog::Cout *logogCout(new logog::Cout);
logogCout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Moves the mesh nodes using the given displacement vector or if no displacement vector is given, moves the mesh nodes such that the centroid of the given mesh is in the origin.", ' ', "0.1"); TCLAP::CmdLine cmd("Moves the mesh nodes using the given displacement vector or if no displacement vector is given, moves the mesh nodes such that the centroid of the given mesh is in the origin.", ' ', "0.1");
// Define a value argument and add it to the command line. // Define a value argument and add it to the command line.
...@@ -65,7 +55,12 @@ int main(int argc, char *argv[]) ...@@ -65,7 +55,12 @@ int main(int argc, char *argv[])
std::string fname (mesh_arg.getValue()); std::string fname (mesh_arg.getValue());
MeshLib::Mesh* mesh = MeshLib::IO::readMeshFromFile(fname); std::unique_ptr<MeshLib::Mesh> mesh(MeshLib::IO::readMeshFromFile(fname));
if (!mesh) {
ERR("Could not read mesh from file \"%s\".", fname.c_str());
return EXIT_FAILURE;
}
MeshLib::Node displacement(0.0, 0.0, 0.0); MeshLib::Node displacement(0.0, 0.0, 0.0);
if (fabs(x_arg.getValue()) < std::numeric_limits<double>::epsilon() if (fabs(x_arg.getValue()) < std::numeric_limits<double>::epsilon()
...@@ -81,11 +76,12 @@ int main(int argc, char *argv[]) ...@@ -81,11 +76,12 @@ int main(int argc, char *argv[])
displacement[2] = z_arg.getValue(); displacement[2] = z_arg.getValue();
} }
INFO("translate model (%f, %f, %f).", displacement[0], displacement[1], displacement[2]); INFO("translate model (%f, %f, %f).",
displacement[0],
displacement[1],
displacement[2]);
MeshLib::moveMeshNodes( MeshLib::moveMeshNodes(
mesh->getNodes().begin(), mesh->getNodes().begin(), mesh->getNodes().end(), displacement);
mesh->getNodes().end(),
displacement);
std::string out_fname(mesh_out_arg.getValue()); std::string out_fname(mesh_out_arg.getValue());
if (out_fname.empty()) { if (out_fname.empty()) {
...@@ -93,13 +89,7 @@ int main(int argc, char *argv[]) ...@@ -93,13 +89,7 @@ int main(int argc, char *argv[])
out_fname += "_displaced.vtu"; out_fname += "_displaced.vtu";
} }
MeshLib::IO::VtuInterface mesh_io(mesh); MeshLib::IO::writeMeshToFile(*mesh, out_fname);
mesh_io.writeToFile(out_fname);
delete mesh; return EXIT_SUCCESS;
delete logogCout;
delete custom_format;
LOGOG_SHUTDOWN();
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "tclap/CmdLine.h" #include <tclap/CmdLine.h>
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
......
...@@ -13,30 +13,21 @@ ...@@ -13,30 +13,21 @@
#include <cstdlib> #include <cstdlib>
#include <vector> #include <vector>
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog
#include "logog/include/logog.hpp"
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
// FileIO
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/IO/writeMeshToFile.h" #include "MeshLib/IO/writeMeshToFile.h"
// GeoLib #include "GeoLib/AnalyticalGeometry.h"
#include "GeoLib/GEOObjects.h" #include "GeoLib/GEOObjects.h"
#include "GeoLib/Polygon.h" #include "GeoLib/Polygon.h"
#include "GeoLib/AnalyticalGeometry.h"
#include "GeoLib/IO/readGeometryFromFile.h" #include "GeoLib/IO/readGeometryFromFile.h"
// MathLib
#include "MathLib/Vector3.h" #include "MathLib/Vector3.h"
#include "MathLib/LinAlg/Dense/DenseMatrix.h" #include "MathLib/LinAlg/Dense/DenseMatrix.h"
// MeshLib
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
#include "MeshLib/Elements/Element.h" #include "MeshLib/Elements/Element.h"
......
...@@ -6,38 +6,25 @@ ...@@ -6,38 +6,25 @@
* http://www.opengeosys.org/LICENSE.txt * http://www.opengeosys.org/LICENSE.txt
*/ */
// TCLAP #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
// ThirdParty/logog #include "Applications/ApplicationsLib/LogogSetup.h"
#include "logog/include/logog.hpp"
// BaseLib #include "BaseLib/FileTools.h"
#include "LogogSimpleFormatter.h"
#include "FileTools.h"
// GeoLib #include "GeoLib/GEOObjects.h"
#include "GEOObjects.h" #include "GeoLib/PolylineVec.h"
#include "PolylineVec.h"
// FileIO
#include "MeshLib/IO/Legacy/MeshIO.h"
#include "MeshLib/IO/readMeshFromFile.h"
#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" #include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h"
// MeshLib
#include "Mesh.h"
// MeshGeoToolsLib
#include "MeshGeoToolsLib/AppendLinesAlongPolyline.h" #include "MeshGeoToolsLib/AppendLinesAlongPolyline.h"
#include "MeshLib/IO/writeMeshToFile.h"
#include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/Mesh.h"
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Append line elements into a mesh.", ' ', "0.1"); TCLAP::CmdLine cmd("Append line elements into a mesh.", ' ', "0.1");
TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file", TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file",
...@@ -64,22 +51,23 @@ int main (int argc, char* argv[]) ...@@ -64,22 +51,23 @@ int main (int argc, char* argv[])
geo_objs.getGeometryNames (geo_names); geo_objs.getGeometryNames (geo_names);
if (geo_names.empty ()) if (geo_names.empty ())
{ {
std::cout << "no geometries found" << std::endl; ERR("No geometries found.");
return -1; return EXIT_FAILURE;
} }
const GeoLib::PolylineVec* ply_vec (geo_objs.getPolylineVecObj(geo_names[0])); const GeoLib::PolylineVec* ply_vec (geo_objs.getPolylineVecObj(geo_names[0]));
if (!ply_vec) if (!ply_vec)
{ {
std::cout << "could not found polylines" << std::endl; ERR("Could not find polylines in geometry \"%s\".",
return -1; geo_names.front().c_str());
return EXIT_FAILURE;
} }
// read a mesh // read a mesh
MeshLib::Mesh const*const mesh (MeshLib::IO::readMeshFromFile(mesh_in.getValue())); MeshLib::Mesh const*const mesh (MeshLib::IO::readMeshFromFile(mesh_in.getValue()));
if (!mesh) if (!mesh)
{ {
ERR("Mesh file %s not found", mesh_in.getValue().c_str()); ERR("Mesh file \"%s\" not found", mesh_in.getValue().c_str());
return 1; return EXIT_FAILURE;
} }
INFO("Mesh read: %d nodes, %d elements.", mesh->getNNodes(), mesh->getNElements()); INFO("Mesh read: %d nodes, %d elements.", mesh->getNNodes(), mesh->getNElements());
...@@ -88,15 +76,7 @@ int main (int argc, char* argv[]) ...@@ -88,15 +76,7 @@ int main (int argc, char* argv[])
MeshGeoToolsLib::appendLinesAlongPolylines(*mesh, *ply_vec); MeshGeoToolsLib::appendLinesAlongPolylines(*mesh, *ply_vec);
INFO("Mesh created: %d nodes, %d elements.", new_mesh->getNNodes(), new_mesh->getNElements()); INFO("Mesh created: %d nodes, %d elements.", new_mesh->getNNodes(), new_mesh->getNElements());
// write into a file MeshLib::IO::writeMeshToFile(*new_mesh, mesh_out.getValue());
MeshLib::IO::Legacy::MeshIO meshIO;
meshIO.setMesh(new_mesh.get());
meshIO.writeToFile(mesh_out.getValue());
delete custom_format;
delete logog_cout;
LOGOG_SHUTDOWN();
return 1; return EXIT_SUCCESS;
} }
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
#include <array> #include <array>
#include <string> #include <string>
#include "logog/include/logog.hpp" #include <tclap/CmdLine.h>
#include "tclap/CmdLine.h"
#include "Applications/ApplicationsLib/LogogSetup.h"
#include "BaseLib/BuildInfo.h" #include "BaseLib/BuildInfo.h"
#include "BaseLib/StringTools.h" #include "BaseLib/StringTools.h"
#include "BaseLib/MemWatch.h" #include "BaseLib/MemWatch.h"
#include "BaseLib/RunTime.h" #include "BaseLib/RunTime.h"
#include "BaseLib/LogogSimpleFormatter.h"
#include "BaseLib/FileTools.h" #include "BaseLib/FileTools.h"
#include "GeoLib/AABB.h" #include "GeoLib/AABB.h"
...@@ -28,14 +28,10 @@ ...@@ -28,14 +28,10 @@
#include "MeshLib/MeshQuality/MeshValidation.h" #include "MeshLib/MeshQuality/MeshValidation.h"
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/IO/Legacy/MeshIO.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
LOGOG_INITIALIZE(); ApplicationsLib::LogogSetup logog_setup;
logog::Cout* logog_cout (new logog::Cout);
BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
logog_cout->SetFormatter(*custom_format);
TCLAP::CmdLine cmd("Checks mesh properties", ' ', BaseLib::BuildInfo::git_describe); TCLAP::CmdLine cmd("Checks mesh properties", ' ', BaseLib::BuildInfo::git_describe);
TCLAP::UnlabeledValueArg<std::string> mesh_arg("mesh-file","input mesh file",true,"","string"); TCLAP::UnlabeledValueArg<std::string> mesh_arg("mesh-file","input mesh file",true,"","string");
...@@ -47,16 +43,15 @@ int main(int argc, char *argv[]) ...@@ -47,16 +43,15 @@ int main(int argc, char *argv[])
cmd.parse( argc, argv ); cmd.parse( argc, argv );
const std::string filename(mesh_arg.getValue());
// read the mesh file // read the mesh file
BaseLib::MemWatch mem_watch; BaseLib::MemWatch mem_watch;
const unsigned long mem_without_mesh (mem_watch.getVirtMemUsage()); const unsigned long mem_without_mesh (mem_watch.getVirtMemUsage());
BaseLib::RunTime run_time; BaseLib::RunTime run_time;
run_time.start(); run_time.start();
const MeshLib::Mesh* mesh = MeshLib::IO::readMeshFromFile(filename); // FileIO outputs nr. of nodes and elements std::unique_ptr<MeshLib::Mesh> mesh(
MeshLib::IO::readMeshFromFile(mesh_arg.getValue()));
if (!mesh) if (!mesh)
return 1; return EXIT_FAILURE;
const unsigned long mem_with_mesh (mem_watch.getVirtMemUsage()); const unsigned long mem_with_mesh (mem_watch.getVirtMemUsage());
if (mem_with_mesh>0) if (mem_with_mesh>0)
...@@ -104,9 +99,9 @@ int main(int argc, char *argv[]) ...@@ -104,9 +99,9 @@ int main(int argc, char *argv[])
} }
if (valid_arg.isSet()) { if (valid_arg.isSet()) {
// Validation // MeshValidation outputs error messages
MeshLib::MeshValidation validation(*const_cast<MeshLib::Mesh*>(mesh)); // MeshValidation outputs error messages // Remark: MeshValidation can modify the original mesh
/* Remark: MeshValidation can modify the original mesh */ MeshLib::MeshValidation validation(*mesh);
unsigned const n_holes (MeshLib::MeshValidation::detectHoles(*mesh)); unsigned const n_holes (MeshLib::MeshValidation::detectHoles(*mesh));
if (n_holes > 0) if (n_holes > 0)
...@@ -116,9 +111,4 @@ int main(int argc, char *argv[]) ...@@ -116,9 +111,4 @@ int main(int argc, char *argv[])
else else
INFO ("No holes found within the mesh."); INFO ("No holes found within the mesh.");
} }
delete mesh;
delete custom_format;
delete logog_cout;
LOGOG_SHUTDOWN();
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "tclap/CmdLine.h" #include <tclap/CmdLine.h>
#include "Applications/ApplicationsLib/LogogSetup.h" #include "Applications/ApplicationsLib/LogogSetup.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment