diff --git a/Applications/FileIO/Gmsh/GMSHInterface.cpp b/Applications/FileIO/Gmsh/GMSHInterface.cpp index b4f8ccc4083b2cc6948df895599172d14bdf0bee..13dad9fb9998cd8c5f1cf0b7dfc72c5ce47a8dfb 100644 --- a/Applications/FileIO/Gmsh/GMSHInterface.cpp +++ b/Applications/FileIO/Gmsh/GMSHInterface.cpp @@ -33,6 +33,19 @@ namespace FileIO { namespace GMSH { +static std::ostream& operator<<(std::ostream& os, + std::vector<GMSHPoint*> const& points) +{ + for (auto& point : points) + { + if (point) + { + os << *point << "\n"; + } + } + return os; +} + GMSHInterface::GMSHInterface( GeoLib::GEOObjects& geo_objs, bool /*include_stations_as_constraints*/, GMSH::MeshDensityAlgorithm const mesh_density_algorithm, @@ -218,7 +231,9 @@ int GMSHInterface::writeGMSHInputFile(std::ostream& out) } // *** finally write data :-) - writePoints(out); + GeoLib::rotatePoints(_inverse_rot_mat, _gmsh_pnts); + out << _gmsh_pnts; + std::size_t pnt_id_offset(_gmsh_pnts.size()); for (auto* polygon_tree : _polygon_tree_list) { @@ -239,20 +254,5 @@ int GMSHInterface::writeGMSHInputFile(std::ostream& out) return 0; } -void GMSHInterface::writePoints(std::ostream& out) const -{ - for (auto& gmsh_pnt : _gmsh_pnts) - { - // reverse rotation - if (gmsh_pnt) - { - auto p = Eigen::Map<Eigen::Vector3d>( - const_cast<double*>(gmsh_pnt->getCoords())); - p = _inverse_rot_mat * p; - out << *gmsh_pnt << "\n"; - } - } -} - } // end namespace GMSH } // end namespace FileIO diff --git a/Applications/FileIO/Gmsh/GMSHInterface.h b/Applications/FileIO/Gmsh/GMSHInterface.h index 23dbf33f5bef06c4d62272df72c4f60725db1f84..e7d333c3a43b7c4a7ccec4f58850e72ef1345471 100644 --- a/Applications/FileIO/Gmsh/GMSHInterface.h +++ b/Applications/FileIO/Gmsh/GMSHInterface.h @@ -95,8 +95,6 @@ private: */ int writeGMSHInputFile(std::ostream & out); - void writePoints(std::ostream& out) const; - std::size_t _n_lines; std::size_t _n_plane_sfc; @@ -108,7 +106,7 @@ private: std::vector<GMSH::GMSHPoint*> _gmsh_pnts; std::unique_ptr<GMSH::GMSHMeshDensityStrategy> _mesh_density_strategy; - /// Holds the inverse rotation matrix. The matrix is used in writePoints() to + /// Holds the inverse rotation matrix. The matrix is used to /// revert the rotation done in writeGMSHInputFile(). Eigen::Matrix3d _inverse_rot_mat = Eigen::Matrix3d::Zero(); /// Signals if the input points should be rotated or projected to the