36 std::vector<GMSHPoint*>
const& points)
38 for (
auto& point : points)
51 double const pnt_density,
double const station_density,
52 std::size_t
const max_pnts_per_leaf,
53 std::vector<std::string>
const& selected_geometries,
bool const rotate,
54 bool const keep_preprocessed_geometry)
58 _selected_geometries(selected_geometries),
60 _keep_preprocessed_geometry(keep_preprocessed_geometry)
62 switch (mesh_density_algorithm)
66 std::make_unique<GMSH::GMSHFixedMeshDensity>(pnt_density);
70 std::make_unique<GMSH::GMSHAdaptiveMeshDensity>(
71 pnt_density, station_density, max_pnts_per_leaf);
90 out <<
"// GMSH input file created by OpenGeoSys "
99 DBUG(
"GMSHInterface::writeGMSHInputFile(): get data from GEOObjects.");
121 auto* merged_pnts(
const_cast<std::vector<GeoLib::Point*>*
>(
125 ERR(
"GMSHInterface::writeGMSHInputFile(): Did not found any points.");
142 for (
auto pnt : *merged_pnts)
148 std::vector<GeoLib::Polyline*>
const* merged_plys(
150 DBUG(
"GMSHInterface::writeGMSHInputFile(): Obtained data.");
154 ERR(
"GMSHInterface::writeGMSHInputFile(): Did not find any polylines.");
162 pnt_vec, *(
const_cast<std::vector<GeoLib::Polyline*>*
>(merged_plys)));
164 std::vector<GeoLib::Polyline*> polygons;
167 for (
auto polyline : *merged_plys)
169 if (!polyline->isClosed())
175 if (polygons.empty())
177 OGS_FATAL(
"GMSHInterface::writeGMSHInputFile(): no polygons found.");
182 for (
auto* polygon : polygons)
189 "GMSHInterface::writeGMSHInputFile(): Computed topological hierarchy - "
190 "detected {:d} polygons.",
195 "GMSHInterface::writeGMSHInputFile(): Computed topological hierarchy - "
196 "calculated {:d} polygon trees.",
202 polygon_tree->markSharedSegments();
209 auto gmsh_stations = std::make_unique<std::vector<GeoLib::Point*>>();
215 for (
auto* station : *stations)
224 if ((*it)->insertStation(gmsh_stations->back()))
233 if (!gmsh_stations->empty())
239 for (
auto polyline : *merged_plys)
241 if (!polyline->isClosed())
245 auto polyline_with_segment_marker =
247 polygon_tree->insertPolyline(polyline_with_segment_marker);
255 polygon_tree->initMeshDensityStrategy();
259 const std::size_t n_merged_pnts(merged_pnts->size());
261 for (std::size_t k(0); k < n_merged_pnts; k++)
279 polygon_tree->writeSubPolygonsAsLineConstraints(
_n_lines,
283 polygon_tree->writeAdditionalPointData(pnt_id_offset,
_n_plane_sfc - 1,
Definition of analytical geometry functions.
Definition of the GEOObjects class.
void ERR(char const *fmt, Args const &... args)
void DBUG(char const *fmt, Args const &... args)
Definition of the Polygon class.
Definition of the PolylineWithSegmentMarker class.
Definition of the Station class.
std::ostringstream out
The stream to write to.
~GMSHInterface() override
bool _write_physical_groups
GMSHInterface(GeoLib::GEOObjects &geo_objs, bool include_stations_as_constraints, GMSH::MeshDensityAlgorithm mesh_density_algorithm, double pnt_density, double station_density, std::size_t max_pnts_per_leaf, std::vector< std::string > const &selected_geometries, bool rotate, bool keep_preprocessed_geometry)
std::string _gmsh_geo_name
bool _keep_preprocessed_geometry
std::unique_ptr< GMSH::GMSHMeshDensityStrategy > _mesh_density_strategy
Eigen::Matrix3d _inverse_rot_mat
std::vector< GMSH::GMSHPoint * > _gmsh_pnts
int writeGMSHInputFile(std::ostream &out)
std::vector< std::string > const & _selected_geometries
GeoLib::GEOObjects & _geo_objs
bool write() override
Writes the object to the internal stream. This method must be implemented by a subclass....
std::list< GMSH::GMSHPolygonTree * > _polygon_tree_list
Container class for geometric objects.
void addStationVec(std::unique_ptr< std::vector< Point * >> stations, std::string &name)
Adds a vector of stations with the given name and colour to GEOObjects.
const std::vector< Point * > * getPointVec(const std::string &name) const
const PointVec * getPointVecObj(const std::string &name) const
bool removePointVec(const std::string &name)
bool removeSurfaceVec(const std::string &name)
bool removeStationVec(const std::string &name)
Removes the station vector with the given name from GEOObjects.
int mergeGeometries(std::vector< std::string > const &geo_names, std::string &merged_geo_name)
const std::vector< Polyline * > * getPolylineVec(const std::string &name) const
bool appendPolylineVec(const std::vector< Polyline * > &polylines, const std::string &name)
const std::vector< GeoLib::Point * > * getStationVec(const std::string &name) const
Returns the station vector with the given name.
bool removePolylineVec(const std::string &name)
This class manages pointers to Points in a std::vector along with a name. It also handles the deletin...
A Station (observation site) is basically a Point with some additional information.
@ AdaptiveMeshDensity
computing the mesh density employing a QuadTree
@ FixedMeshDensity
set the parameter with a fixed value
static std::ostream & operator<<(std::ostream &os, std::vector< GMSHPoint * > const &points)
void computeAndInsertAllIntersectionPoints(GeoLib::PointVec &pnt_vec, std::vector< GeoLib::Polyline * > &plys)
void rotatePoints(Eigen::Matrix3d const &rot_mat, InputIterator pnts_begin, InputIterator pnts_end)
Eigen::Matrix3d rotatePointsToXY(InputIterator1 p_pnts_begin, InputIterator1 p_pnts_end, InputIterator2 r_pnts_begin, InputIterator2 r_pnts_end)
GITINFOLIB_EXPORT const std::string ogs_version