OGS
MeshGeoToolsLib::BoundaryElementsOnSurface Class Reference

Detailed Description

This class collects element faces located along a surface. Note that internal faces are not collected in this class.

Definition at line 32 of file BoundaryElementsOnSurface.h.

#include <BoundaryElementsOnSurface.h>

Collaboration diagram for MeshGeoToolsLib::BoundaryElementsOnSurface:
[legend]

Public Member Functions

 BoundaryElementsOnSurface (MeshLib::Mesh const &mesh, MeshNodeSearcher const &mshNodeSearcher, GeoLib::Surface const &sfc)
 
virtual ~BoundaryElementsOnSurface ()
 destructor
 
GeoLib::Surface const & getSurface () const
 
std::vector< MeshLib::Element * > const & getBoundaryElements () const
 

Private Attributes

GeoLib::Surface const & _sfc
 
std::vector< MeshLib::Element * > _boundary_elements
 

Constructor & Destructor Documentation

◆ BoundaryElementsOnSurface()

MeshGeoToolsLib::BoundaryElementsOnSurface::BoundaryElementsOnSurface ( MeshLib::Mesh const & mesh,
MeshNodeSearcher const & mshNodeSearcher,
GeoLib::Surface const & sfc )

Constructor

Parameters
mesha mesh object
mshNodeSearchera MeshNodeSearcher object which is internally used to search mesh nodes
sfca surface object where face elements are searched for

Definition at line 20 of file BoundaryElementsOnSurface.cpp.

23 : _sfc(sfc)
24{
25 // search elements near the surface
26 auto node_ids_on_sfc = mshNodeSearcher.getMeshNodeIDs(sfc);
28 es.searchByNodeIDs(node_ids_on_sfc);
29 auto& ele_ids_near_sfc = es.getSearchedElementIDs();
30
31 // get a list of faces made of the nodes
32 for (auto ele_id : ele_ids_near_sfc)
33 {
34 auto* e = mesh.getElement(ele_id);
35 // skip internal elements
36 if (!e->isBoundaryElement())
37 {
38 continue;
39 }
40 // find faces on surface
41 for (unsigned i = 0; i < e->getNumberOfFaces(); i++)
42 {
43 auto* face = e->getFace(i);
44 // check
45 std::size_t cnt_match = 0;
46 for (std::size_t j = 0; j < face->getNumberOfBaseNodes(); j++)
47 {
48 if (std::find(node_ids_on_sfc.begin(), node_ids_on_sfc.end(),
49 getNodeIndex(*face, j)) != node_ids_on_sfc.end())
50 {
51 cnt_match++;
52 }
53 else
54 {
55 break;
56 }
57 }
58 // update the list
59 if (cnt_match == face->getNumberOfBaseNodes())
60 {
61 _boundary_elements.push_back(
62 const_cast<MeshLib::Element*>(face));
63 }
64 else
65 {
66 delete face;
67 }
68 }
69 }
70}
std::vector< MeshLib::Element * > _boundary_elements
Element search class.
std::size_t getNodeIndex(Element const &element, unsigned const idx)
Definition Element.cpp:219

References _boundary_elements, MeshLib::Mesh::getElement(), MeshLib::Element::getFace(), MeshGeoToolsLib::MeshNodeSearcher::getMeshNodeIDs(), MeshLib::ElementSearch::getSearchedElementIDs(), and MeshLib::ElementSearch::searchByNodeIDs().

◆ ~BoundaryElementsOnSurface()

MeshGeoToolsLib::BoundaryElementsOnSurface::~BoundaryElementsOnSurface ( )
virtual

destructor

Definition at line 72 of file BoundaryElementsOnSurface.cpp.

73{
74 for (auto p : _boundary_elements)
75 {
76 delete p;
77 }
78}

References _boundary_elements.

Member Function Documentation

◆ getBoundaryElements()

std::vector< MeshLib::Element * > const & MeshGeoToolsLib::BoundaryElementsOnSurface::getBoundaryElements ( ) const
inline

Return the vector of boundary elements (i.e. faces). The elements are unsorted.

Definition at line 58 of file BoundaryElementsOnSurface.h.

58{return _boundary_elements;}

References _boundary_elements.

◆ getSurface()

GeoLib::Surface const & MeshGeoToolsLib::BoundaryElementsOnSurface::getSurface ( ) const
inline

Deploying this method the user can get access to the underlying GeoLib::Surface.

Returns
the underlying GeoLib::Surface

Definition at line 53 of file BoundaryElementsOnSurface.h.

53{return _sfc;}

References _sfc.

Referenced by MeshGeoToolsLib::BoundaryElementsSearcher::getBoundaryElements().

Member Data Documentation

◆ _boundary_elements

std::vector<MeshLib::Element*> MeshGeoToolsLib::BoundaryElementsOnSurface::_boundary_elements
private

◆ _sfc

GeoLib::Surface const& MeshGeoToolsLib::BoundaryElementsOnSurface::_sfc
private

Definition at line 61 of file BoundaryElementsOnSurface.h.

Referenced by getSurface().


The documentation for this class was generated from the following files: