diff --git a/MeshLib/Elements/Element.cpp b/MeshLib/Elements/Element.cpp index 9806066e1eda0b42fcbac9d389cb9833bf8c40d2..fb834b37fdcccd2adf6a31d58afb9f4f5194f01b 100644 --- a/MeshLib/Elements/Element.cpp +++ b/MeshLib/Elements/Element.cpp @@ -41,7 +41,8 @@ void Element::setNeighbor(Element* neighbor, unsigned const face_id) std::optional<unsigned> Element::addNeighbor(Element* e) { - if (e == this || e == nullptr || e->getDimension() != this->getDimension()) + const unsigned dim(this->getDimension()); + if (e == this || e == nullptr || e->getDimension() != dim) { return std::optional<unsigned>(); } @@ -56,7 +57,6 @@ std::optional<unsigned> Element::addNeighbor(Element* e) const unsigned eNodes(e->getNumberOfBaseNodes()); const Node* const* e_nodes = e->getNodes(); unsigned count(0); - const unsigned dim(this->getDimension()); for (unsigned i(0); i < nNodes; i++) { for (unsigned j(0); j < eNodes; j++) diff --git a/MeshLib/Elements/Element.h b/MeshLib/Elements/Element.h index 70df4294d416646af8ebf7ce61c21324f653fb7b..b84173206d3452f6ebdc8edfba3ccf5672cf3fee 100644 --- a/MeshLib/Elements/Element.h +++ b/MeshLib/Elements/Element.h @@ -68,7 +68,7 @@ public: virtual Node* const* getNodes() const = 0; /// Get dimension of the mesh element. - virtual unsigned getDimension() const = 0; + virtual constexpr unsigned getDimension() const = 0; /// Returns the i-th edge of the element. virtual const Element* getEdge(unsigned i) const = 0; diff --git a/MeshLib/Elements/TemplateElement.h b/MeshLib/Elements/TemplateElement.h index 27b3427ba150f3136d3b0b0fc13fe9bdac6f4959..d2f6286758b9415fa2fe068ae0237ee6382db9db 100644 --- a/MeshLib/Elements/TemplateElement.h +++ b/MeshLib/Elements/TemplateElement.h @@ -74,7 +74,7 @@ public: } /// Get dimension of the mesh element. - unsigned getDimension() const override { return dimension; } + constexpr unsigned getDimension() const override { return dimension; } /// Returns the edge i of the element. const Element* getEdge(unsigned i) const override { diff --git a/MeshLib/MeshGenerators/VtkMeshConverter.h b/MeshLib/MeshGenerators/VtkMeshConverter.h index 883ac6e0563a8225a690b6c34728815250672bf7..f7ba3cbcab8f880d513db47898491cd905497947 100644 --- a/MeshLib/MeshGenerators/VtkMeshConverter.h +++ b/MeshLib/MeshGenerators/VtkMeshConverter.h @@ -18,11 +18,9 @@ #include <vtkType.h> #include "BaseLib/Logging.h" - #include "GeoLib/Raster.h" #include "MeshLib/Location.h" #include "MeshLib/MeshEnums.h" -#include "MeshLib/Node.h" #include "MeshLib/Properties.h" #include "MeshLib/PropertyVector.h" @@ -32,7 +30,8 @@ class vtkDataArray; // For node/cell properties namespace MeshLib { class Mesh; -class Properties; +class Element; +class Node; /** * \brief Converter for VtkUnstructured Grids to OGS meshes