Skip to content
Snippets Groups Projects
Commit e8502227 authored by Tom Fischer's avatar Tom Fischer Committed by Dmitry Yu. Naumov
Browse files

[MeL] Mv Element::getNode() to TemplateElement.

This remove one dependencies on _nodes pointer C array.
If all dependencies are removed the memory for storing
the nodes can be in a std::array.
parent cc01fcf6
No related branches found
No related tags found
No related merge requests found
......@@ -82,21 +82,6 @@ std::optional<unsigned> Element::addNeighbor(Element* e)
return std::optional<unsigned>();
}
const Node* Element::getNode(unsigned i) const
{
#ifndef NDEBUG
if (i < getNumberOfNodes())
#endif
{
return _nodes[i];
}
#ifndef NDEBUG
ERR("Error in MeshLib::Element::getNode() - Index {:d} in {:s}", i,
MeshElemType2String(getGeomType()));
return nullptr;
#endif
}
void Element::setNode(unsigned idx, Node* node)
{
#ifndef NDEBUG
......
......@@ -54,7 +54,7 @@ public:
* modifiable by the user) instance of class Node or a nullptr
* @sa Element::getNodeIndex()
*/
const Node* getNode(unsigned i) const;
virtual const Node* getNode(unsigned i) const = 0;
/**
* (Re)Sets the node of the element.
......
......@@ -100,4 +100,20 @@ bool TemplateElement<ELEMENT_RULE>::isEdge(unsigned idx1, unsigned idx2) const
return false;
}
template <class ELEMENT_RULE>
const Node* TemplateElement<ELEMENT_RULE>::getNode(unsigned i) const
{
#ifndef NDEBUG
if (i < getNumberOfNodes())
#endif
{
return _nodes[i];
}
#ifndef NDEBUG
ERR("Error in MeshLib::Element::getNode() - Index {:d} in {:s}", i,
MeshElemType2String(getGeomType()));
return nullptr;
#endif
}
} // namespace MeshLib
......@@ -188,6 +188,10 @@ public:
return ELEMENT_RULE::computeVolume(this->_nodes);
}
const Node* getNode(unsigned i) const override;
void setNode(unsigned idx, Node* node) override;
Node* const* getNodes() const override { return _nodes; }
/// 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