98 DBUG(
"GMSHInterface::writeGMSHInputFile(): get data from GEOObjects.");
120 auto* merged_pnts(
const_cast<std::vector<GeoLib::Point*>*
>(
124 ERR(
"GMSHInterface::writeGMSHInputFile(): Did not found any points.");
139 for (
auto pnt : *merged_pnts)
145 std::vector<GeoLib::Polyline*>
const* merged_plys(
147 DBUG(
"GMSHInterface::writeGMSHInputFile(): Obtained data.");
151 ERR(
"GMSHInterface::writeGMSHInputFile(): Did not find any polylines.");
159 pnt_vec, *(
const_cast<std::vector<GeoLib::Polyline*>*
>(merged_plys)));
161 std::vector<GeoLib::Polyline*> polygons;
164 for (
auto polyline : *merged_plys)
166 if (!polyline->isClosed())
172 if (polygons.empty())
174 OGS_FATAL(
"GMSHInterface::writeGMSHInputFile(): no polygons found.");
180 polygons.begin(), polygons.end(),
182 [
this](
auto const& polygon)
184 return new GMSH::GMSHPolygonTree(
185 dynamic_cast<GeoLib::PolygonWithSegmentMarker*>(polygon),
186 nullptr, _geo_objs, _gmsh_geo_name, *_mesh_density_strategy);
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 std::vector<GeoLib::Point*> gmsh_stations{};
212 auto const* stations(
_geo_objs.getStationVec(geometry_name));
215 for (
auto* station : *stations)
224 if ((*it)->insertStation(gmsh_stations.back()))
233 if (!gmsh_stations.empty())
235 _geo_objs.addStationVec(std::move(gmsh_stations), gmsh_stations_name);
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++)
270 std::stringstream error_messages;
271 error_messages.precision(std::numeric_limits<double>::max_digits10);
272 for (std::size_t k = 0; k <
_gmsh_pnts.size(); ++k)
277 <<
"The point at (" << *(*merged_pnts)[k]
278 <<
") is not part of a polyline, and won't be used in the "
279 "meshing as a constraint. If you want to include it in the "
280 "mesh please create a observation/measurement station for "
281 "the point and include it additional in the meshing "
285 auto const error_message = error_messages.str();
286 if (!error_message.empty())
300 polygon_tree->writeSubPolygonsAsLineConstraints(
_n_lines,
304 polygon_tree->writeAdditionalPointData(pnt_id_offset,
_n_plane_sfc - 1,
313 _geo_objs.removeStationVec(gmsh_stations_name);
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)