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

[MeL/Elements] Impl. of interface for boundaries.

parent 8814334d
No related branches found
No related tags found
No related merge requests found
...@@ -86,9 +86,13 @@ public: ...@@ -86,9 +86,13 @@ public:
/// Returns the i-th face of the element. /// Returns the i-th face of the element.
virtual const Element* getFace(unsigned i) const = 0; virtual const Element* getFace(unsigned i) const = 0;
virtual const Element* getBoundary(unsigned i) const = 0;
/// Returns the ID of the element. /// Returns the ID of the element.
virtual std::size_t getID() const final { return _id; } virtual std::size_t getID() const final { return _id; }
virtual unsigned getNumberOfBoundaries() const = 0;
/// Get the number of edges for this element. /// Get the number of edges for this element.
virtual unsigned getNumberOfEdges() const = 0; virtual unsigned getNumberOfEdges() const = 0;
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
#include "MeshLib/Elements/Element.h" #include "MeshLib/Elements/Element.h"
#include "MeshLib/Elements/FaceRule.h"
#include "MeshLib/Elements/CellRule.h"
#include "MeshLib/Elements/ElementErrorCode.h" #include "MeshLib/Elements/ElementErrorCode.h"
namespace MeshLib namespace MeshLib
...@@ -85,6 +87,33 @@ public: ...@@ -85,6 +87,33 @@ public:
return ELEMENT_RULE::getFace(this, i); return ELEMENT_RULE::getFace(this, i);
} }
/// Returns the boundary i of the element.
const Element* getBoundary(unsigned i) const override
{
if constexpr (std::is_convertible<ELEMENT_RULE, FaceRule>::value)
{
return ELEMENT_RULE::EdgeReturn::getEdge(this, i);
}
if constexpr (std::is_convertible<ELEMENT_RULE, CellRule>::value)
{
return ELEMENT_RULE::getFace(this, i);
}
OGS_FATAL("TemplateElement::getBoundary for boundary %u failed.", i);
}
/// Returns the number of boundaries of the element.
unsigned getNumberOfBoundaries() const override
{
if constexpr (std::is_convertible<ELEMENT_RULE, FaceRule>::value)
{
return ELEMENT_RULE::n_edges;
}
else
{
return ELEMENT_RULE::n_faces;
}
}
/// Get the number of edges for this element. /// Get the number of edges for this element.
unsigned getNumberOfEdges() const override { return ELEMENT_RULE::n_edges; } unsigned getNumberOfEdges() const override { return ELEMENT_RULE::n_edges; }
/// Get the number of faces for this element. /// Get the number of faces for this element.
......
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