diff --git a/FileIO/GMSHInterface.cpp b/FileIO/GMSHInterface.cpp index 3c3ef422d3899181ed8071687338aa8b8528d501..46b61068e58c3805330efa29713e0adebc8d92ee 100644 --- a/FileIO/GMSHInterface.cpp +++ b/FileIO/GMSHInterface.cpp @@ -38,14 +38,18 @@ namespace FileIO { -GMSHInterface::GMSHInterface(GeoLib::GEOObjects & geo_objs, +GMSHInterface::GMSHInterface(GeoLib::GEOObjects& geo_objs, bool /*include_stations_as_constraints*/, GMSH::MeshDensityAlgorithm mesh_density_algorithm, - double param1, - double param2, - std::size_t param3, - std::vector<std::string>& selected_geometries) : - _n_lines(0), _n_plane_sfc(0), _geo_objs(geo_objs), _selected_geometries(selected_geometries) + double param1, double param2, std::size_t param3, + std::vector<std::string>& selected_geometries, + bool rotate, bool keep_preprocessed_geometry) + : _n_lines(0), + _n_plane_sfc(0), + _geo_objs(geo_objs), + _selected_geometries(selected_geometries), + _rotate(rotate), + _keep_preprocessed_geometry(keep_preprocessed_geometry) { switch (mesh_density_algorithm) { case GMSH::MeshDensityAlgorithm::FixedMeshDensity: @@ -320,16 +324,14 @@ int GMSHInterface::writeGMSHInputFile(std::ostream& out) if (_selected_geometries.empty()) return 1; - bool remove_geometry(false); // *** get and merge data from _geo_objs if (_selected_geometries.size() > 1) { _gmsh_geo_name = "GMSHGeometry"; - remove_geometry = true; if (_geo_objs.mergeGeometries(_selected_geometries, _gmsh_geo_name)) return 2; } else { _gmsh_geo_name = _selected_geometries[0]; - remove_geometry = false; + _keep_preprocessed_geometry = true; } std::vector<GeoLib::Point*>* merged_pnts( @@ -459,7 +461,7 @@ int GMSHInterface::writeGMSHInputFile(std::ostream& out) (*it)->writeAdditionalPointData(pnt_id_offset, _n_plane_sfc-1, out); } - if (remove_geometry) { + if (! _keep_preprocessed_geometry) { _geo_objs.removeSurfaceVec(_gmsh_geo_name); _geo_objs.removePolylineVec(_gmsh_geo_name); _geo_objs.removePointVec(_gmsh_geo_name); diff --git a/FileIO/GMSHInterface.h b/FileIO/GMSHInterface.h index c47b9f3176217059645cc68207477646a6bd1aa2..78bc53ca0b15d5af78dd13fd9a27a1a09ab415f2 100644 --- a/FileIO/GMSHInterface.h +++ b/FileIO/GMSHInterface.h @@ -57,24 +57,32 @@ enum class MeshDensityAlgorithm { class GMSHInterface final : public BaseLib::IO::Writer { public: - /** - * - * @param geo_objs reference tp instance of class GEOObject that maintains the geometries. - * The instance is used for preparation geometries for writing them to the gmsh file format. - * @param include_stations_as_constraints switch to enable writing stations as constraints - * @param mesh_density_algorithm one of the mesh density algorithms (\@see enum MeshDensityAlgorithm) + * @param geo_objs reference to instance of class GEOObject that maintains + * the geometries. + * The instance is used for preparation geometries for writing them to + * the gmsh file format. + * @param include_stations_as_constraints switch to enable writing stations + * as constraints + * @param mesh_density_algorithm one of the mesh density algorithms (\@see + * enum MeshDensityAlgorithm) * @param param1 parameter that can be used for the mesh density algorithm * @param param2 parameter that can be used for the mesh density algorithm * @param param3 parameter that can be used for the mesh density algorithm - * @param selected_geometries vector of names of geometries, that should be employed for mesh generation. - * @return + * @param selected_geometries vector of names of geometries, that should be + * employed for mesh generation. + * @param rotate if the value of the parameter is true then the input points + * will be rotated on the \f$x\f$-\f$y\f$-plane, else the input points will + * be (orthogonal) projected to the \f$x\f$-\f$y\f$-plane. + * @param keep_preprocessed_geometry keep the pre-processed geometry, useful + * for debugging the mesh creation */ GMSHInterface(GeoLib::GEOObjects& geo_objs, bool include_stations_as_constraints, GMSH::MeshDensityAlgorithm mesh_density_algorithm, double param1, double param2, std::size_t param3, - std::vector<std::string>& selected_geometries); + std::vector<std::string>& selected_geometries, + bool rotate = false, bool keep_preprocessed_geometry = false); GMSHInterface(GMSHInterface const&) = delete; GMSHInterface(GMSHInterface &&) = delete; @@ -140,6 +148,7 @@ private: /// Signals if the input points should be rotated or projected to the /// \f$x\f$-\f$y\f$-plane bool _rotate = false; + bool _keep_preprocessed_geometry = true; }; }