Skip to content
Snippets Groups Projects
Commit 0f03d927 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge branch 'SmallImprovements' into 'master'

[MeL] Small code quality improvements.

See merge request ogs/ogs!3799
parents 4fcc8bb8 fd0e7605
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,8 @@ void Element::setNeighbor(Element* neighbor, unsigned const face_id) ...@@ -41,7 +41,8 @@ void Element::setNeighbor(Element* neighbor, unsigned const face_id)
std::optional<unsigned> Element::addNeighbor(Element* e) 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>(); return std::optional<unsigned>();
} }
...@@ -56,7 +57,6 @@ std::optional<unsigned> Element::addNeighbor(Element* e) ...@@ -56,7 +57,6 @@ std::optional<unsigned> Element::addNeighbor(Element* e)
const unsigned eNodes(e->getNumberOfBaseNodes()); const unsigned eNodes(e->getNumberOfBaseNodes());
const Node* const* e_nodes = e->getNodes(); const Node* const* e_nodes = e->getNodes();
unsigned count(0); unsigned count(0);
const unsigned dim(this->getDimension());
for (unsigned i(0); i < nNodes; i++) for (unsigned i(0); i < nNodes; i++)
{ {
for (unsigned j(0); j < eNodes; j++) for (unsigned j(0); j < eNodes; j++)
......
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
virtual Node* const* getNodes() const = 0; virtual Node* const* getNodes() const = 0;
/// Get dimension of the mesh element. /// 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. /// Returns the i-th edge of the element.
virtual const Element* getEdge(unsigned i) const = 0; virtual const Element* getEdge(unsigned i) const = 0;
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
} }
/// Get dimension of the mesh element. /// 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. /// Returns the edge i of the element.
const Element* getEdge(unsigned i) const override const Element* getEdge(unsigned i) const override
{ {
......
...@@ -18,11 +18,9 @@ ...@@ -18,11 +18,9 @@
#include <vtkType.h> #include <vtkType.h>
#include "BaseLib/Logging.h" #include "BaseLib/Logging.h"
#include "GeoLib/Raster.h" #include "GeoLib/Raster.h"
#include "MeshLib/Location.h" #include "MeshLib/Location.h"
#include "MeshLib/MeshEnums.h" #include "MeshLib/MeshEnums.h"
#include "MeshLib/Node.h"
#include "MeshLib/Properties.h" #include "MeshLib/Properties.h"
#include "MeshLib/PropertyVector.h" #include "MeshLib/PropertyVector.h"
...@@ -32,7 +30,8 @@ class vtkDataArray; // For node/cell properties ...@@ -32,7 +30,8 @@ class vtkDataArray; // For node/cell properties
namespace MeshLib namespace MeshLib
{ {
class Mesh; class Mesh;
class Properties; class Element;
class Node;
/** /**
* \brief Converter for VtkUnstructured Grids to OGS meshes * \brief Converter for VtkUnstructured Grids to OGS meshes
......
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