diff --git a/MeshLib/Elements/Element.h b/MeshLib/Elements/Element.h index 7f369e900f39206a2b5238a76e63313b03d5941a..55a9717dcddc0506df6237951ada767d93aa651b 100644 --- a/MeshLib/Elements/Element.h +++ b/MeshLib/Elements/Element.h @@ -55,6 +55,7 @@ public: * @sa getNodeIndex() */ virtual const Node* getNode(unsigned idx) const = 0; + virtual Node* getNode(unsigned idx) = 0; /** * (Re)Sets the node of the element. diff --git a/MeshLib/Elements/TemplateElement-impl.h b/MeshLib/Elements/TemplateElement-impl.h index 9e82b8c8a6a2073a02d6f885133494894ca8dc6f..dfd271a3f5f37e7a1e69037f4c42ffd633497885 100644 --- a/MeshLib/Elements/TemplateElement-impl.h +++ b/MeshLib/Elements/TemplateElement-impl.h @@ -109,6 +109,20 @@ const Node* TemplateElement<ELEMENT_RULE>::getNode(unsigned const idx) const return _nodes[idx]; } +template <class ELEMENT_RULE> +Node* TemplateElement<ELEMENT_RULE>::getNode(unsigned const idx) +{ +#ifndef NDEBUG + if (idx >= getNumberOfNodes()) + { + ERR("Error in MeshLib::TemplateElement::getNode() - Index {:d} in {:s}", + idx, MeshElemType2String(getGeomType())); + return nullptr; + } +#endif + return _nodes[idx]; +} + template <class ELEMENT_RULE> void TemplateElement<ELEMENT_RULE>::setNode(unsigned idx, Node* node) { diff --git a/MeshLib/Elements/TemplateElement.h b/MeshLib/Elements/TemplateElement.h index 4c4d15e7d14588b6b23011807c4b766561f654bd..27b3427ba150f3136d3b0b0fc13fe9bdac6f4959 100644 --- a/MeshLib/Elements/TemplateElement.h +++ b/MeshLib/Elements/TemplateElement.h @@ -189,6 +189,7 @@ public: } const Node* getNode(unsigned idx) const override; + Node* getNode(unsigned idx) override; void setNode(unsigned idx, Node* node) override; Node* const* getNodes() const override { return _nodes.data(); }