91 DBUG(
"GMSHInterface::writeGMSHInputFile(): get data from GEOObjects.");
113 auto* merged_pnts(
const_cast<std::vector<GeoLib::Point*>*
>(
117 ERR(
"GMSHInterface::writeGMSHInputFile(): Did not found any points.");
132 for (
auto pnt : *merged_pnts)
138 std::vector<GeoLib::Polyline*>
const* merged_plys(
140 DBUG(
"GMSHInterface::writeGMSHInputFile(): Obtained data.");
144 ERR(
"GMSHInterface::writeGMSHInputFile(): Did not find any polylines.");
152 pnt_vec, *(
const_cast<std::vector<GeoLib::Polyline*>*
>(merged_plys)));
154 std::vector<GeoLib::Polyline*> polygons;
157 for (
auto polyline : *merged_plys)
159 if (!polyline->isClosed())
165 if (polygons.empty())
167 OGS_FATAL(
"GMSHInterface::writeGMSHInputFile(): no polygons found.");
173 polygons.begin(), polygons.end(),
175 [
this](
auto const& polygon)
177 return new GMSH::GMSHPolygonTree(
178 dynamic_cast<GeoLib::PolygonWithSegmentMarker*>(polygon),
179 nullptr, _geo_objs, _gmsh_geo_name, *_mesh_density_strategy);
182 "GMSHInterface::writeGMSHInputFile(): Computed topological hierarchy - "
183 "detected {:d} polygons.",
188 "GMSHInterface::writeGMSHInputFile(): Computed topological hierarchy - "
189 "calculated {:d} polygon trees.",
195 polygon_tree->markSharedSegments();
202 std::vector<GeoLib::Point*> gmsh_stations{};
205 auto const* stations(
_geo_objs.getStationVec(geometry_name));
208 for (
auto* station : *stations)
217 if ((*it)->insertStation(gmsh_stations.back()))
226 if (!gmsh_stations.empty())
228 _geo_objs.addStationVec(std::move(gmsh_stations), gmsh_stations_name);
232 for (
auto polyline : *merged_plys)
234 if (!polyline->isClosed())
238 auto polyline_with_segment_marker =
240 polygon_tree->insertPolyline(polyline_with_segment_marker);
248 polygon_tree->initMeshDensityStrategy();
252 const std::size_t n_merged_pnts(merged_pnts->size());
254 for (std::size_t k(0); k < n_merged_pnts; k++)
263 std::stringstream error_messages;
264 error_messages.precision(std::numeric_limits<double>::max_digits10);
265 for (std::size_t k = 0; k <
_gmsh_pnts.size(); ++k)
270 <<
"The point at (" << *(*merged_pnts)[k]
271 <<
") is not part of a polyline, and won't be used in the "
272 "meshing as a constraint. If you want to include it in the "
273 "mesh please create a observation/measurement station for "
274 "the point and include it additional in the meshing "
278 auto const error_message = error_messages.str();
279 if (!error_message.empty())
293 polygon_tree->writeSubPolygonsAsLineConstraints(
_n_lines,
297 polygon_tree->writeAdditionalPointData(pnt_id_offset,
_n_plane_sfc - 1,
306 _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)