Skip to content
Snippets Groups Projects
Commit ca8b6d3c authored by Tom Fischer's avatar Tom Fischer Committed by Dmitri Naumov
Browse files

[MeL/Elements] Mv Element::getNodeIndex to TemplateElement.

parent 36f5dd50
No related branches found
No related tags found
No related merge requests found
......@@ -92,20 +92,6 @@ void Element::setNode(unsigned idx, Node* node)
}
}
std::size_t Element::getNodeIndex(unsigned i) const
{
#ifndef NDEBUG
if (i < getNumberOfNodes())
#endif
{
return _nodes[i]->getID();
}
#ifndef NDEBUG
ERR("Error in MeshLib::Element::getNodeIndex() - Index does not exist.");
return std::numeric_limits<std::size_t>::max();
#endif
}
bool Element::isBoundaryElement() const
{
return std::any_of(
......
......@@ -110,7 +110,7 @@ public:
* @return the global index or std::numeric_limits<unsigned>::max()
* @sa Element::getNode()
*/
std::size_t getNodeIndex(unsigned i) const;
virtual std::size_t getNodeIndex(unsigned i) const = 0;
/**
* Get the type of the mesh element in geometric context (as a MeshElemType-enum).
......
......@@ -116,4 +116,20 @@ const Node* TemplateElement<ELEMENT_RULE>::getNode(unsigned i) const
#endif
}
template <class ELEMENT_RULE>
std::size_t TemplateElement<ELEMENT_RULE>::getNodeIndex(unsigned i) const
{
#ifndef NDEBUG
if (i < getNumberOfNodes())
#endif
{
return _nodes[i]->getID();
}
#ifndef NDEBUG
ERR("Error in MeshLib::TemplateElement::getNodeIndex() - Index does not "
"exist.");
return std::numeric_limits<std::size_t>::max();
#endif
}
} // namespace MeshLib
......@@ -191,6 +191,7 @@ public:
const Node* getNode(unsigned i) const override;
void setNode(unsigned idx, Node* node) override;
Node* const* getNodes() const override { return _nodes; }
std::size_t getNodeIndex(unsigned i) const override;
/// Return a specific edge node.
inline Node* getEdgeNode(unsigned edge_id, unsigned node_id) const override
......
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