From 10b34e4e6c90b097b625db8a1f0708bd7f690a66 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Sat, 13 Mar 2021 16:40:54 +0100 Subject: [PATCH] [BL/IO] Remove setPrecision used w/o effect. The default precision of a Writer is set 10 digits anyway upon construction. The extra interface is also not needed, because the standard provided call 'precision' is doing already the same. --- Applications/DataExplorer/mainwindow.cpp | 3 --- Applications/FileIO/Legacy/createSurface.cpp | 1 - Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp | 1 - BaseLib/IO/Writer.cpp | 5 ----- BaseLib/IO/Writer.h | 6 +----- GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp | 1 - 6 files changed, 1 insertion(+), 16 deletions(-) diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index 44db9441875..3162fc3dc77 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -495,7 +495,6 @@ void MainWindow::save() FileIO::GMSH::MeshDensityAlgorithm::FixedMeshDensity, point_density, station_density, max_pnts_per_leaf, selected_geometries, false, false); - gmsh_io.setPrecision(std::numeric_limits<double>::digits10); bool const success = gmsh_io.writeToFile(fileName.toStdString()); if (!success) @@ -1062,14 +1061,12 @@ void MainWindow::callGMSH(std::vector<std::string> & selectedGeometries, _project.getGEOObjects(), true, FileIO::GMSH::MeshDensityAlgorithm::AdaptiveMeshDensity, param2, param3, param1, selectedGeometries, false, false); - gmsh_io.setPrecision(std::numeric_limits<double>::digits10); gmsh_io.writeToFile(fileName.toStdString()); } else { // homogeneous meshing selected FileIO::GMSH::GMSHInterface gmsh_io( _project.getGEOObjects(), true, FileIO::GMSH::MeshDensityAlgorithm::FixedMeshDensity, param4, param3, param1, selectedGeometries, false, false); - gmsh_io.setPrecision(std::numeric_limits<double>::digits10); gmsh_io.writeToFile(fileName.toStdString()); } diff --git a/Applications/FileIO/Legacy/createSurface.cpp b/Applications/FileIO/Legacy/createSurface.cpp index 9876b187172..ffc73e69482 100644 --- a/Applications/FileIO/Legacy/createSurface.cpp +++ b/Applications/FileIO/Legacy/createSurface.cpp @@ -76,7 +76,6 @@ bool createSurface(GeoLib::Polyline const& ply, FileIO::GMSH::GMSHInterface gmsh_io( geo, false, FileIO::GMSH::MeshDensityAlgorithm::FixedMeshDensity, 0.0, 0.0, 0, geo_names, false, false); - gmsh_io.setPrecision(std::numeric_limits<double>::digits10); // write to random file in temp directory auto geo_file = fs::temp_directory_path() /= BaseLib::randomString(32); diff --git a/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp b/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp index e84f0628ad4..a439d3f308c 100644 --- a/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp +++ b/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp @@ -223,7 +223,6 @@ MeshLib::Mesh* generateMesh(GeoLib::GEOObjects& geo, FileIO::GMSH::GMSHInterface gmsh_io( geo, true, FileIO::GMSH::MeshDensityAlgorithm::FixedMeshDensity, res, 0, 0, gmsh_geo, false, false); - gmsh_io.setPrecision(std::numeric_limits<double>::digits10); gmsh_io.writePhysicalGroups(true); bool const success = gmsh_io.writeToFile(gmsh_geo_name); diff --git a/BaseLib/IO/Writer.cpp b/BaseLib/IO/Writer.cpp index 73b01563fc4..ef718453af3 100644 --- a/BaseLib/IO/Writer.cpp +++ b/BaseLib/IO/Writer.cpp @@ -65,10 +65,5 @@ int Writer::writeToFile(std::filesystem::path const& file_path) } return 0; } - -void Writer::setPrecision(unsigned int precision) -{ - out.precision(precision); -} } // namespace IO } // namespace BaseLib diff --git a/BaseLib/IO/Writer.h b/BaseLib/IO/Writer.h index 3ea1e50bc4e..7937aa93502 100644 --- a/BaseLib/IO/Writer.h +++ b/BaseLib/IO/Writer.h @@ -23,8 +23,7 @@ namespace BaseLib namespace IO { /// @brief Base class which enables writing an object to string, stringstream -/// or file. Also formatting (precision, scientific notation of decimal values) -/// can be set. +/// or file. /// /// When subclassing you only need to implement void write() in which you have /// to write to out. @@ -40,9 +39,6 @@ public: /// @brief Writes the object to the given file. int writeToFile(std::filesystem::path const& file_path); - /// @brief Sets the decimal precision. - void setPrecision(unsigned int precision); - protected: /// @brief Writes the object to the internal stream. /// This method must be implemented by a subclass. diff --git a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp index a83515e5430..93c4c7ccd31 100644 --- a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp @@ -311,7 +311,6 @@ bool BoostXmlGmlInterface::write() addSurfacesToPropertyTree(geometry_set); boost::property_tree::xml_writer_settings<std::string> settings('\t', 1); - setPrecision(std::numeric_limits<double>::digits10); write_xml(out, pt, settings); return true; } -- GitLab