Skip to content
Snippets Groups Projects
Commit 0d196ef5 authored by Karsten Rink's avatar Karsten Rink
Browse files

added unified method for length/area/volume of an element

parent 244e1ba5
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,15 @@ namespace MeshLib { ...@@ -18,12 +18,15 @@ namespace MeshLib {
class Cell : public Element class Cell : public Element
{ {
public: public:
/// Get the volume of this 3d element. /// Returns the length, area or volume of a 1D, 2D or 3D element
virtual double getVolume() const { return _volume; }; double getContent() const { return _volume; };
/// Get dimension of the mesh element. /// Get dimension of the mesh element.
unsigned getDimension() const { return 3; }; unsigned getDimension() const { return 3; };
/// Get the volume of this 3d element.
virtual double getVolume() const { return _volume; };
/// Destructor /// Destructor
virtual ~Cell(); virtual ~Cell();
......
...@@ -38,6 +38,9 @@ public: ...@@ -38,6 +38,9 @@ public:
/// Destructor /// Destructor
virtual ~Edge(); virtual ~Edge();
/// Returns the length, area or volume of a 1D, 2D or 3D element
double getContent() const { return _length; };
/// Returns the edge i of the element. /// Returns the edge i of the element.
const Element* getEdge(unsigned i) const { (void)i; return NULL; }; const Element* getEdge(unsigned i) const { (void)i; return NULL; };
......
...@@ -30,6 +30,9 @@ public: ...@@ -30,6 +30,9 @@ public:
/// Compute the minimum and maximum squared edge length for this element /// Compute the minimum and maximum squared edge length for this element
virtual void computeSqrEdgeLengthRange(double &min, double &max) const; virtual void computeSqrEdgeLengthRange(double &min, double &max) const;
/// Returns the length, area or volume of a 1D, 2D or 3D element
virtual double getContent() const = 0;
/// Get node with local index i. /// Get node with local index i.
const Node* getNode(unsigned i) const; const Node* getNode(unsigned i) const;
......
...@@ -21,6 +21,9 @@ public: ...@@ -21,6 +21,9 @@ public:
/// Get the area of this 2d element. /// Get the area of this 2d element.
virtual double getArea() const { return _area; }; virtual double getArea() const { return _area; };
/// Returns the length, area or volume of a 1D, 2D or 3D element
double getContent() const { return _area; };
/// Get dimension of the mesh element. /// Get dimension of the mesh element.
unsigned getDimension() const { return 2; }; unsigned getDimension() const { return 2; };
......
...@@ -72,6 +72,11 @@ public: ...@@ -72,6 +72,11 @@ public:
/// Get the element-vector for the mesh. /// Get the element-vector for the mesh.
const std::vector<Element*> getElements() const { return _elements; }; const std::vector<Element*> getElements() const { return _elements; };
/**
* Set the minimum and maximum length over the edges of the mesh.
* This should have been previously calcumlated using the Element::computeSqrEdgeLengthRange(min, max)
* function or by some other means.
*/
void setEdgeLengthRange(const double &min_length, const double &max_length); void setEdgeLengthRange(const double &min_length, const double &max_length);
protected: protected:
......
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