OGS 6.1.0-1721-g6382411ad
GeoMapper.cpp
Go to the documentation of this file.
1 
15 #include "GeoMapper.h"
16 
17 #include <algorithm>
18 #include <sstream>
19 #include <numeric>
20 
21 #include <logog/include/logog.hpp>
22 
23 #include "BaseLib/Algorithm.h"
24 
25 #include "GeoLib/AABB.h"
27 #include "GeoLib/GEOObjects.h"
28 #include "GeoLib/Raster.h"
29 #include "GeoLib/StationBorehole.h"
30 
31 #include "MeshLib/Mesh.h"
34 #include "MeshLib/Node.h"
38 
39 namespace MeshGeoToolsLib {
40 
41 GeoMapper::GeoMapper(GeoLib::GEOObjects &geo_objects, const std::string &geo_name)
42  : _geo_objects(geo_objects), _geo_name(const_cast<std::string&>(geo_name)),
43  _surface_mesh(nullptr), _grid(nullptr), _raster(nullptr)
44 {
45 }
46 
48 {
49  delete _surface_mesh;
50 }
51 
52 void GeoMapper::mapOnDEM(std::unique_ptr<GeoLib::Raster const> raster)
53 {
54  std::vector<GeoLib::Point*> const* pnts(_geo_objects.getPointVec(_geo_name));
55  if (! pnts) {
56  ERR("Geometry '%s' does not exist.", _geo_name.c_str());
57  return;
58  }
59  _raster = std::move(raster);
60 
61  if (GeoLib::isStation((*pnts)[0])) {
62  mapStationData(*pnts);
63  } else {
64  mapPointDataToDEM(*pnts);
65  }
66 }
67 
68 void GeoMapper::mapOnMesh(MeshLib::Mesh const*const mesh)
69 {
70  std::vector<GeoLib::Point*> const* pnts(_geo_objects.getPointVec(_geo_name));
71  if (! pnts) {
72  ERR("Geometry '%s' does not exist.", _geo_name.c_str());
73  return;
74  }
75 
76  // the variable _surface_mesh is reused below, so first the existing
77  // _surface_mesh has to be cleaned up
78  if (_surface_mesh)
79  delete _surface_mesh;
80 
81  if (mesh->getDimension()<3)
82  _surface_mesh = new MeshLib::Mesh(*mesh);
83  else
84  {
85  const MathLib::Vector3 dir(0,0,-1);
87  }
88 
89  // init grid
90  MathLib::Point3d origin(std::array<double,3>{{0,0,0}});
91  MathLib::Vector3 normal(0,0,-1);
92  std::vector<MeshLib::Node> flat_nodes;
93  flat_nodes.reserve(_surface_mesh->getNumberOfNodes());
94  // copy nodes and project the copied nodes to the x-y-plane, i.e. set
95  // z-coordinate to zero
96  for (auto n_ptr : _surface_mesh->getNodes()) {
97  flat_nodes.emplace_back(*n_ptr);
98  flat_nodes.back()[2] = 0.0;
99  }
100  _grid = new GeoLib::Grid<MeshLib::Node>(flat_nodes.cbegin(), flat_nodes.cend());
101 
102  if (GeoLib::isStation((*pnts)[0])) {
103  mapStationData(*pnts);
104  } else {
106  }
107 
108  delete _grid;
109 }
110 
112 {
113  std::vector<GeoLib::Point*> const* points (this->_geo_objects.getPointVec(this->_geo_name));
114  if (points == nullptr)
115  {
116  ERR("Geometry '%s' not found.", this->_geo_name.c_str());
117  return;
118  }
119  std::for_each(points->begin(), points->end(), [value](GeoLib::Point* pnt){ (*pnt)[2] = value; });
120 }
121 
122 void GeoMapper::mapStationData(std::vector<GeoLib::Point*> const& points)
123 {
124  double min_val(0), max_val(0);
125  if (_surface_mesh)
126  {
127  GeoLib::AABB bounding_box(
128  _surface_mesh->getNodes().begin(), _surface_mesh->getNodes().end());
129  min_val = bounding_box.getMinPoint()[2];
130  max_val = bounding_box.getMaxPoint()[2];
131  }
132 
133  for (auto * pnt : points)
134  {
135  double offset =
136  (_grid)
137  ? (getMeshElevation((*pnt)[0], (*pnt)[1], min_val, max_val) -
138  (*pnt)[2])
139  : getDemElevation(*pnt);
140 
141  if (!GeoLib::isBorehole(pnt))
142  continue;
143  auto const& layers = static_cast<GeoLib::StationBorehole*>(pnt)->getProfile();
144  for (auto * layer_pnt : layers) {
145  (*layer_pnt)[2] = (*layer_pnt)[2] + offset;
146  }
147  }
148 }
149 
150 void GeoMapper::mapPointDataToDEM(std::vector<GeoLib::Point*> const& points)
151 {
152  for (auto * pnt : points)
153  {
154  GeoLib::Point &p(*pnt);
155  p[2] = getDemElevation(p);
156  }
157 }
158 
159 void GeoMapper::mapPointDataToMeshSurface(std::vector<GeoLib::Point*> const& pnts)
160 {
161  GeoLib::AABB const aabb(
162  _surface_mesh->getNodes().cbegin(), _surface_mesh->getNodes().cend());
163  double const min_val(aabb.getMinPoint()[2]);
164  double const max_val(aabb.getMaxPoint()[2]);
165 
166  for (auto * pnt : pnts) {
167  // check if pnt is inside of the bounding box of the _surface_mesh
168  // projected onto the y-x plane
169  GeoLib::Point &p(*pnt);
170  if (p[0] < aabb.getMinPoint()[0] || aabb.getMaxPoint()[0] < p[0])
171  continue;
172  if (p[1] < aabb.getMinPoint()[1] || aabb.getMaxPoint()[1] < p[1])
173  continue;
174 
175  p[2] = getMeshElevation(p[0], p[1], min_val, max_val);
176  }
177 }
178 
180 {
181  double const elevation (_raster->getValueAtPoint(pnt));
182  if (std::abs(elevation-_raster->getHeader().no_data) < std::numeric_limits<double>::epsilon())
183  return 0.0;
184  return static_cast<float>(elevation);
185 }
186 
188  double x, double y, double min_val, double max_val) const
189 {
190  const MeshLib::Node* pnt =
191  _grid->getNearestPoint(MathLib::Point3d{{{x, y, 0}}});
192  const std::vector<MeshLib::Element*> elements(
193  _surface_mesh->getNode(pnt->getID())->getElements());
194  std::unique_ptr<GeoLib::Point> intersection;
195 
196  for (auto const & element : elements)
197  {
198  if (intersection == nullptr &&
199  element->getGeomType() != MeshLib::MeshElemType::LINE)
200  intersection = GeoLib::triangleLineIntersection(
201  *element->getNode(0), *element->getNode(1),
202  *element->getNode(2), GeoLib::Point(x, y, max_val),
203  GeoLib::Point(x, y, min_val));
204 
205  if (intersection == nullptr &&
206  element->getGeomType() == MeshLib::MeshElemType::QUAD)
207  intersection = GeoLib::triangleLineIntersection(
208  *element->getNode(0), *element->getNode(2),
209  *element->getNode(3), GeoLib::Point(x, y, max_val),
210  GeoLib::Point(x, y, min_val));
211  }
212  if (intersection)
213  return (*intersection)[2];
214  // if something goes wrong, simply take the elevation of the nearest mesh node
215  return (*(_surface_mesh->getNode(pnt->getID())))[2];
216 }
217 
224  std::vector<MeshLib::Element const*> const& elements,
225  MathLib::Point3d const& p)
226 {
227  for (auto const elem : elements) {
228  std::unique_ptr<MeshLib::Element> elem_2d(elem->clone());
229  // reset/copy the nodes
230  for (std::size_t k(0); k<elem_2d->getNumberOfNodes(); ++k) {
231  elem_2d->setNode(k, new MeshLib::Node(*elem_2d->getNode(k)));
232  }
233  // project to xy
234  for (std::size_t k(0); k<elem_2d->getNumberOfNodes(); ++k) {
235  (*const_cast<MeshLib::Node*>(elem_2d->getNode(k)))[2] = 0.0;
236  }
237  if (elem_2d->isPntInElement(MathLib::Point3d{ {{p[0], p[1], 0.0}} })) {
238  // clean up the copied nodes
239  for (std::size_t k(0); k<elem_2d->getNumberOfNodes(); ++k) {
240  delete elem_2d->getNode(k);
241  }
242  return elem;
243  }
244  // clean up the copied nodes
245  for (std::size_t k(0); k < elem_2d->getNumberOfNodes(); ++k)
246  {
247  delete elem_2d->getNode(k);
248  }
249  }
250  return nullptr;
251 }
252 
253 static std::vector<MathLib::Point3d> computeElementSegmentIntersections(
254  MeshLib::Element const& elem, GeoLib::LineSegment const& segment)
255 {
256  std::vector<MathLib::Point3d> element_intersections;
257  for (std::size_t k(0); k < elem.getNumberOfEdges(); ++k)
258  {
259  auto const edge =
260  std::unique_ptr<MeshLib::Element const>(elem.getEdge(k));
261  GeoLib::LineSegment elem_segment{
262  new GeoLib::Point(*dynamic_cast<MathLib::Point3d*>(
263  const_cast<MeshLib::Node*>(edge->getNode(0))), 0),
264  new GeoLib::Point(*dynamic_cast<MathLib::Point3d*>(
265  const_cast<MeshLib::Node*>(edge->getNode(1))), 0),
266  true};
267  std::vector<MathLib::Point3d> const intersections(
268  GeoLib::lineSegmentIntersect2d(segment, elem_segment));
269  for (auto const& p : intersections)
270  element_intersections.push_back(std::move(p));
271  }
272  return element_intersections;
273 }
274 
275 static std::vector<GeoLib::LineSegment> createSubSegmentsForElement(
276  std::vector<MathLib::Point3d> const& intersections,
277  MeshLib::Element const* const beg_elem,
278  MeshLib::Element const* const end_elem, MathLib::Point3d const& beg_pnt,
279  MathLib::Point3d const& end_pnt, MeshLib::Element const* const elem)
280 {
281  std::vector<GeoLib::LineSegment> sub_segments;
282  if (intersections.size() > 2) {
283  std::stringstream out;
284  out << "element with id " << elem->getID() << " and seg "
285  << " intersecting at more than two edges\n";
286  for (std::size_t k(0); k<intersections.size(); ++k)
287  out << k << " " << intersections[k]
288  << "\n";
289  out << "Could not map segment on element. Aborting.\n";
290  OGS_FATAL("%s", out.str().c_str());
291  }
292 
293  if (intersections.size() == 1 && elem == beg_elem)
294  {
295  // The line segment intersects the element that contains the begin
296  // point of the line segment. Here the first sub line segment is
297  // added.
298  if (MathLib::sqrDist(beg_pnt, intersections[0]) >
299  std::numeric_limits<double>::epsilon())
300  sub_segments.emplace_back(new GeoLib::Point{beg_pnt, 0},
301  new GeoLib::Point{intersections[0], 0},
302  true);
303  }
304 
305  if (intersections.size() == 1 && elem == end_elem)
306  {
307  // The line segment intersects the element that contains the end
308  // point of the line segment. Here the last sub line segment is
309  // added.
310  if (MathLib::sqrDist(end_pnt, intersections[0]) >
311  std::numeric_limits<double>::epsilon())
312  sub_segments.emplace_back(new GeoLib::Point{intersections[0], 0},
313  new GeoLib::Point{end_pnt, 0}, true);
314  }
315 
316  if (intersections.size() == 1 && (elem != beg_elem && elem != end_elem))
317  {
318  // Since the line segment enters and leaves the element in the same
319  // point there isn't any need to insert a new sub line segment.
320  return sub_segments;
321  }
322 
323  // create sub segment for the current element
324  if (intersections.size() == 2)
325  {
326  sub_segments.emplace_back(new GeoLib::Point{intersections[0], 0},
327  new GeoLib::Point{intersections[1], 0}, true);
328  }
329  return sub_segments;
330 }
331 
332 static std::vector<GeoLib::LineSegment> mapLineSegment(
333  GeoLib::LineSegment const& segment,
334  std::vector<MeshLib::Element const*> const& surface_elements,
335  MeshLib::Element const* const beg_elem,
336  MeshLib::Element const* const end_elem)
337 {
338  std::vector<GeoLib::LineSegment> sub_segments;
339  MathLib::Point3d const& beg_pnt(segment.getBeginPoint());
340  MathLib::Point3d const& end_pnt(segment.getEndPoint());
341 
342  for (auto const elem : surface_elements) {
343  // compute element-segment-intersections (2d in x-y-plane)
344  std::vector<MathLib::Point3d> element_intersections(
345  computeElementSegmentIntersections(*elem, segment));
346  if (element_intersections.empty())
347  continue;
348 
349  BaseLib::makeVectorUnique(element_intersections);
350 
351  std::vector<GeoLib::LineSegment> sub_seg_elem(
352  createSubSegmentsForElement(element_intersections, beg_elem,
353  end_elem, beg_pnt, end_pnt, elem));
354  sub_segments.insert(sub_segments.end(), sub_seg_elem.begin(),
355  sub_seg_elem.end());
356  }
357 
358  // beg_elem == nullptr means there isn't any element corresponding to the
359  // beg_pnt and as a consequence the above algorithm doesn't insert a sub
360  // segment
361  if (beg_elem == nullptr)
362  {
363  auto min_dist_segment = std::min_element(
364  sub_segments.begin(), sub_segments.end(),
365  [&beg_pnt](GeoLib::LineSegment const& seg0,
366  GeoLib::LineSegment const& seg1)
367  {
368  // min dist for segment 0
369  const double d0(
370  std::min(MathLib::sqrDist(beg_pnt, seg0.getBeginPoint()),
371  MathLib::sqrDist(beg_pnt, seg0.getEndPoint())));
372  // min dist for segment 1
373  const double d1(
374  std::min(MathLib::sqrDist(beg_pnt, seg1.getBeginPoint()),
375  MathLib::sqrDist(beg_pnt, seg1.getEndPoint())));
376  return d0 < d1;
377  });
378  GeoLib::Point * pnt{
379  MathLib::sqrDist(beg_pnt, min_dist_segment->getBeginPoint()) <
380  MathLib::sqrDist(beg_pnt, min_dist_segment->getEndPoint())
381  ? new GeoLib::Point{min_dist_segment->getBeginPoint()}
382  : new GeoLib::Point{min_dist_segment->getEndPoint()}};
383  sub_segments.emplace_back(new GeoLib::Point{beg_pnt, 0}, pnt, true);
384  }
385  // sort all sub segments for the given segment (beg_pnt, end_pnt)
386  GeoLib::sortSegments(beg_pnt, sub_segments);
387 
388  sub_segments.erase(std::unique(sub_segments.begin(), sub_segments.end()),
389  sub_segments.end());
390 
391  return sub_segments;
392 }
393 
396 {
397  // create plane equation: n*p = d
398  MathLib::Vector3 const& p(*(elem.getNode(0)));
400  if (n[2] == 0.0) { // vertical plane, z coordinate is arbitrary
401  q[2] = p[2];
402  } else {
403  double const d(MathLib::scalarProduct(n, p));
404  q[2] = (d - n[0]*q[0] - n[1]*q[1])/n[2];
405  }
406 }
407 
408 static std::vector<MeshLib::Element const*>
410  MeshLib::MeshElementGrid const& mesh_element_grid,
411  GeoLib::LineSegment const& segment)
412 {
413  GeoLib::LineSegment seg_deep_copy(
414  new GeoLib::Point(segment.getBeginPoint()),
415  new GeoLib::Point(segment.getEndPoint()), true);
416  // modify z coordinates such that all surface elements around the line
417  // segment are found
418  seg_deep_copy.getBeginPoint()[2] = mesh_element_grid.getMinPoint()[2];
419  seg_deep_copy.getEndPoint()[2] = mesh_element_grid.getMaxPoint()[2];
420  std::array<MathLib::Point3d, 2> const pnts{
421  {seg_deep_copy.getBeginPoint(), seg_deep_copy.getEndPoint()}};
422  GeoLib::AABB aabb(pnts.cbegin(), pnts.cend());
423 
424  auto candidate_elements = mesh_element_grid.getElementsInVolume(
425  aabb.getMinPoint(), aabb.getMaxPoint());
426 
427  // make candidate elements unique
428  BaseLib::makeVectorUnique(candidate_elements);
429 
430  return candidate_elements;
431 }
432 
434  MeshLib::Element const& elem, double rel_eps)
435 {
436  // values will be initialized within computeSqrNodeDistanceRange
437  double sqr_min, sqr_max;
438  elem.computeSqrNodeDistanceRange(sqr_min, sqr_max);
439 
440  double const sqr_eps(rel_eps*rel_eps * sqr_min);
441  for (std::size_t k(0); k<elem.getNumberOfNodes(); ++k) {
442  auto const& node(*elem.getNode(k));
443  double const sqr_dist_2d(MathLib::sqrDist2d(p, node));
444  if (sqr_dist_2d < sqr_eps) {
445 #ifdef DEBUG_GEOMAPPER
446  std::stringstream out;
447  out.precision(std::numeric_limits<double>::digits10);
448  out << "Segment point snapped from " << p;
449 #endif
450  p = node;
451 #ifdef DEBUG_GEOMAPPER
452  out << "to " << p;
453  DBUG("%s", out.str().c_str());
454 #endif
455  return true;
456  }
457  }
458  return false;
459 }
460 
461 static void insertSubSegments(
462  GeoLib::Polyline& ply, GeoLib::PointVec& points,
464  std::vector<GeoLib::LineSegment> const& sub_segments)
465 {
466  std::size_t const j(segment_it.getSegmentNumber());
467  std::size_t new_pnts_cnt(0);
468  for (auto const& segment : sub_segments)
469  {
470  auto const begin_id(points.push_back(
471  new GeoLib::Point(segment.getBeginPoint(), points.size())));
472  if (ply.insertPoint(j + new_pnts_cnt + 1, begin_id))
473  new_pnts_cnt++;
474  auto const end_id(points.push_back(
475  new GeoLib::Point(segment.getEndPoint(), points.size())));
476  if (ply.insertPoint(j + new_pnts_cnt + 1, end_id))
477  new_pnts_cnt++;
478  }
479  segment_it += new_pnts_cnt;
480 }
481 
483  GeoLib::Polyline& ply,
484  GeoLib::PointVec& orig_points,
485  MeshLib::MeshElementGrid const& mesh_element_grid)
486 {
487  // for each segment ...
488  for (auto segment_it(ply.begin()); segment_it != ply.end(); ++segment_it)
489  {
490  auto candidate_elements(getCandidateElementsForLineSegmentIntersection(
491  mesh_element_grid, *segment_it));
492 
493  auto mapPoint = [&candidate_elements](MathLib::Point3d& p) {
494  auto const* elem(
495  findElementContainingPointXY(candidate_elements, p));
496  if (elem)
497  {
498  if (!snapPointToElementNode(p, *elem, 1e-3))
499  mapPointOnSurfaceElement(*elem, p);
500  }
501  return elem;
502  };
503 
504  // map segment begin and end point
505  auto const* beg_elem(mapPoint((*segment_it).getBeginPoint()));
506  auto const* end_elem(mapPoint((*segment_it).getEndPoint()));
507 
508  // Since the mapping of the segment begin and end points the coordinates
509  // changed. The internal data structures of PointVec are possibly
510  // invalid and hence it is necessary to re-create them.
511  orig_points.resetInternalDataStructures();
512 
513  if (beg_elem == end_elem) {
514  // TODO: handle cases: beg_elem == end_elem == nullptr
515  // There are further checks necessary to determine which case we are
516  // in:
517  // 1. beg_elem == end_elem and the segment intersects elements
518  // 2. beg_elem == end_elem and the segment does not intersect any
519  // element, i.e., the segment is located outside of the mesh area
520  //
521  // Case 1 needs additional work.
522  continue;
523  }
524 
525  // map the line segment (and if necessary for the mapping partition it)
526  std::vector<GeoLib::LineSegment> sub_segments(mapLineSegment(
527  *segment_it, candidate_elements, beg_elem, end_elem));
528 
529  if (sub_segments.empty())
530  continue;
531 
532  // The case sub_segment.size() == 1 is already handled above.
533 
534  if (sub_segments.size() > 1)
535  {
536  insertSubSegments(ply, orig_points, segment_it, sub_segments);
537  }
538  }
539 }
540 
542 {
543  // 1. extract surface
544  if (_surface_mesh)
545  delete _surface_mesh;
546  if (mesh.getDimension()<3) {
547  _surface_mesh = new MeshLib::Mesh(mesh);
548  } else {
549  const MathLib::Vector3 dir(0,0,-1);
550  _surface_mesh =
552  }
553 
554  // 2. compute mesh grid for surface
555  MeshLib::MeshElementGrid const mesh_element_grid(*_surface_mesh);
556 
557  // 3. map each polyline
558  auto org_lines(_geo_objects.getPolylineVec(_geo_name));
559  auto org_points(_geo_objects.getPointVecObj(_geo_name));
560  for (auto org_line : *org_lines)
561  {
562  mapPolylineOnSurfaceMesh(*org_line, *org_points, mesh_element_grid);
563  }
564 }
565 
566 } // end namespace MeshGeoToolsLib
Implementation of heuristic search length strategy.
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:99
Container class for geometric objects.
Definition: GEOObjects.h:62
double sqrDist(const double *p0, const double *p1)
Definition: MathTools.h:77
const Node * getNode(std::size_t idx) const
Get the node with the given index.
Definition: Mesh.h:84
std::string & _geo_name
Definition: GeoMapper.h:86
double getMeshElevation(double x, double y, double min_val, double max_val) const
Definition: GeoMapper.cpp:187
std::vector< MathLib::Point3d > lineSegmentIntersect2d(GeoLib::LineSegment const &ab, GeoLib::LineSegment const &cd)
GeoLib::GEOObjects & _geo_objects
Definition: GeoMapper.h:85
void mapOnDEM(std::unique_ptr< GeoLib::Raster const > raster)
Maps geometry based on a raster file.
Definition: GeoMapper.cpp:52
static bool snapPointToElementNode(MathLib::Point3d &p, MeshLib::Element const &elem, double rel_eps)
Definition: GeoMapper.cpp:433
GeoLib::Point const & getBeginPoint() const
Definition: LineSegment.cpp:62
std::size_t size() const
Definition: TemplateVec.h:102
MeshLib::Mesh * _surface_mesh
only necessary for mapping on mesh
Definition: GeoMapper.h:89
Definition of the Node class.
const std::vector< Polyline * > * getPolylineVec(const std::string &name) const
Definition: GEOObjects.cpp:174
void makeVectorUnique(std::vector< T > &v)
Definition: Algorithm.h:177
A borehole as a geometric object.
double sqrDist2d(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition: Point3d.h:58
Definition of the StationBorehole class.
Definition of the GeoMapper class.
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:105
Definition of the GeoLib::Raster class.
Definition of the AABB class.
static void mapPolylineOnSurfaceMesh(GeoLib::Polyline &ply, GeoLib::PointVec &orig_points, MeshLib::MeshElementGrid const &mesh_element_grid)
Definition: GeoMapper.cpp:482
MathLib::Point3d const & getMinPoint() const
Definition: AABB.h:154
Definition of analytical geometry functions.
Definition of the Mesh class.
bool isBorehole(GeoLib::Point const *pnt)
GeoLib::Grid< MeshLib::Node > * _grid
Definition: GeoMapper.h:90
std::size_t getID() const
Definition: Point3dWithID.h:63
std::unique_ptr< GeoLib::Raster const > _raster
only necessary for mapping on DEM
Definition: GeoMapper.h:93
void setNode(unsigned idx, Node *node)
Definition: Element.cpp:156
void advancedMapOnMesh(MeshLib::Mesh const &mesh)
Definition: GeoMapper.cpp:541
std::unique_ptr< GeoLib::Point > triangleLineIntersection(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &p, MathLib::Point3d const &q)
static void mapPointOnSurfaceElement(MeshLib::Element const &elem, MathLib::Point3d &q)
Definition: GeoMapper.cpp:394
Definition of the MeshSurfaceExtraction class.
void sortSegments(MathLib::Point3d const &seg_beg_pnt, std::vector< GeoLib::LineSegment > &sub_segments)
static void insertSubSegments(GeoLib::Polyline &ply, GeoLib::PointVec &points, GeoLib::Polyline::SegmentIterator &segment_it, std::vector< GeoLib::LineSegment > const &sub_segments)
Definition: GeoMapper.cpp:461
static std::vector< MathLib::Point3d > computeElementSegmentIntersections(MeshLib::Element const &elem, GeoLib::LineSegment const &segment)
Definition: GeoMapper.cpp:253
void resetInternalDataStructures()
Definition: PointVec.cpp:250
void mapToConstantValue(double value)
Maps geometry to a constant elevation value.
Definition: GeoMapper.cpp:111
static const double q
static MeshLib::Element const * findElementContainingPointXY(std::vector< MeshLib::Element const *> const &elements, MathLib::Point3d const &p)
Definition: GeoMapper.cpp:223
void mapOnMesh(MeshLib::Mesh const *const mesh)
Definition: GeoMapper.cpp:68
static std::vector< MeshLib::Element const * > getCandidateElementsForLineSegmentIntersection(MeshLib::MeshElementGrid const &mesh_element_grid, GeoLib::LineSegment const &segment)
Definition: GeoMapper.cpp:409
T scalarProduct(T const *const v0, T const *const v1)
Definition: MathTools.h:28
static MathLib::Vector3 getSurfaceNormal(const Element *e)
Returns the surface normal of a 2D element.
Definition: FaceRule.cpp:35
GeoLib::Point const & getEndPoint() const
Definition: LineSegment.cpp:72
POINT * getNearestPoint(P const &pnt) const
Definition: Grid.h:419
MathLib::Point3d const & getMaxPoint() const
const PointVec * getPointVecObj(const std::string &name) const
Definition: GEOObjects.cpp:68
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition: AABB.h:50
virtual bool insertPoint(std::size_t pos, std::size_t pnt_id)
Definition: Polyline.cpp:69
const std::vector< Point * > * getPointVec(const std::string &name) const
Definition: GEOObjects.cpp:57
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition: Polyline.h:50
virtual unsigned getNumberOfEdges() const =0
Get the number of edges for this element.
virtual void computeSqrNodeDistanceRange(double &min, double &max, bool check_allnodes=true) const
Compute the minimum and maximum node distances for this element.
Definition: Element.cpp:107
SegmentIterator begin() const
Definition: Polyline.h:194
virtual const Element * getEdge(unsigned i) const =0
Returns the i-th edge of the element.
TemplateElement< PointRule1 > Point
Definition: Point.h:19
GeoMapper(GeoLib::GEOObjects &geo_objects, const std::string &geo_name)
Definition: GeoMapper.cpp:41
This class manages pointers to Points in a std::vector along with a name. It also handles the deletin...
Definition: PointVec.h:39
static MeshLib::Mesh * getMeshSurface(const MeshLib::Mesh &subsfc_mesh, const MathLib::Vector3 &dir, double angle, std::string const &subsfc_node_id_prop_name="", std::string const &subsfc_element_id_prop_name="", std::string const &face_id_prop_name="")
void mapPointDataToMeshSurface(std::vector< GeoLib::Point *> const &points)
Mapping points on mesh.
Definition: GeoMapper.cpp:159
static std::vector< GeoLib::LineSegment > createSubSegmentsForElement(std::vector< MathLib::Point3d > const &intersections, MeshLib::Element const *const beg_elem, MeshLib::Element const *const end_elem, MathLib::Point3d const &beg_pnt, MathLib::Point3d const &end_pnt, MeshLib::Element const *const elem)
Definition: GeoMapper.cpp:275
float getDemElevation(GeoLib::Point const &pnt) const
Returns the elevation at Point (x,y) based on a raster.
Definition: GeoMapper.cpp:179
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81
virtual std::size_t getID() const final
Returns the ID of the element.
Definition: Element.h:90
Definition of the projectMeshOntoPlane.
#define OGS_FATAL(fmt,...)
Definition: Error.h:71
virtual unsigned getNumberOfNodes() const =0
Returns the number of all nodes including both linear and nonlinear nodes.
std::size_t push_back(Point *pnt)
Definition: PointVec.cpp:124
Definition of the Element class.
MathLib::Point3d const & getMinPoint() const
static std::vector< GeoLib::LineSegment > mapLineSegment(GeoLib::LineSegment const &segment, std::vector< MeshLib::Element const *> const &surface_elements, MeshLib::Element const *const beg_elem, MeshLib::Element const *const end_elem)
Definition: GeoMapper.cpp:332
void mapPointDataToDEM(std::vector< GeoLib::Point *> const &points)
Mapping points on a raster.
Definition: GeoMapper.cpp:150
std::size_t getSegmentNumber() const
Definition: Polyline.cpp:470
void mapStationData(std::vector< GeoLib::Point *> const &points)
Mapping stations, boreholes on a raster or mesh.
Definition: GeoMapper.cpp:122
bool isStation(GeoLib::Point const *pnt)
Definition: Station.cpp:85
std::vector< MeshLib::Element const * > getElementsInVolume(POINT const &min, POINT const &max) const
const Node * getNode(unsigned i) const
Definition: Element.cpp:144
SegmentIterator end() const
Definition: Polyline.h:199