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

[A/IO] Substitute writePoints by output operator and GL::rotatePoints.

parent 9374baa6
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......
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