Skip to content
Snippets Groups Projects
Commit bd79636f authored by Tom Fischer's avatar Tom Fischer
Browse files

[MGTL] BoundaryElementsSearcher: modernize methods.

parent ab02ba89
No related branches found
No related tags found
No related merge requests found
...@@ -82,33 +82,40 @@ BoundaryElementsSearcher::getBoundaryElementsAtPoint(GeoLib::Point const& point) ...@@ -82,33 +82,40 @@ BoundaryElementsSearcher::getBoundaryElementsAtPoint(GeoLib::Point const& point)
return _boundary_elements_at_point.back()->getBoundaryElements(); return _boundary_elements_at_point.back()->getBoundaryElements();
} }
std::vector<MeshLib::Element*> const& BoundaryElementsSearcher::getBoundaryElementsAlongPolyline(GeoLib::Polyline const& ply) std::vector<MeshLib::Element*> const&
BoundaryElementsSearcher::getBoundaryElementsAlongPolyline(
GeoLib::Polyline const& polyline)
{ {
std::vector<BoundaryElementsAlongPolyline*>::const_iterator it(_boundary_elements_along_polylines.begin()); // look for already saved polylines and return if found.
for (; it != _boundary_elements_along_polylines.end(); ++it) { for (auto const& boundary_elements : _boundary_elements_along_polylines)
if (&(*it)->getPolyline() == &ply) { {
// we calculated mesh nodes for this polyline already if (&boundary_elements->getPolyline() == &polyline)
return (*it)->getBoundaryElements(); {
return boundary_elements->getBoundaryElements();
} }
} }
// create new boundary elements at points.
_boundary_elements_along_polylines.push_back( _boundary_elements_along_polylines.push_back(
new BoundaryElementsAlongPolyline(_mesh, _mshNodeSearcher, ply)); new BoundaryElementsAlongPolyline(_mesh, _mshNodeSearcher, polyline));
return _boundary_elements_along_polylines.back()->getBoundaryElements(); return _boundary_elements_along_polylines.back()->getBoundaryElements();
} }
std::vector<MeshLib::Element*> const& BoundaryElementsSearcher::getBoundaryElementsOnSurface(GeoLib::Surface const& sfc) std::vector<MeshLib::Element*> const&
BoundaryElementsSearcher::getBoundaryElementsOnSurface(
GeoLib::Surface const& surface)
{ {
std::vector<BoundaryElementsOnSurface*>::const_iterator it(_boundary_elements_along_surfaces.begin()); // look for already saved surfaces and return if found.
for (; it != _boundary_elements_along_surfaces.end(); ++it) { for (auto const& boundary_elements : _boundary_elements_along_surfaces)
if (&(*it)->getSurface() == &sfc) { {
// we calculated mesh nodes for this surface already if (&boundary_elements->getSurface() == &surface)
return (*it)->getBoundaryElements(); {
return boundary_elements->getBoundaryElements();
} }
} }
_boundary_elements_along_surfaces.push_back( _boundary_elements_along_surfaces.push_back(
new BoundaryElementsOnSurface(_mesh, _mshNodeSearcher, sfc)); new BoundaryElementsOnSurface(_mesh, _mshNodeSearcher, surface));
return _boundary_elements_along_surfaces.back()->getBoundaryElements(); return _boundary_elements_along_surfaces.back()->getBoundaryElements();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment