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 {
class Cell : public Element
{
public:
/// Get the volume of this 3d element.
virtual double getVolume() const { return _volume; };
/// Returns the length, area or volume of a 1D, 2D or 3D element
double getContent() const { return _volume; };
/// Get dimension of the mesh element.
unsigned getDimension() const { return 3; };
/// Get the volume of this 3d element.
virtual double getVolume() const { return _volume; };
/// Destructor
virtual ~Cell();
......
......@@ -38,6 +38,9 @@ public:
/// Destructor
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.
const Element* getEdge(unsigned i) const { (void)i; return NULL; };
......
......@@ -30,6 +30,9 @@ public:
/// Compute the minimum and maximum squared edge length for this element
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.
const Node* getNode(unsigned i) const;
......
......@@ -21,6 +21,9 @@ public:
/// Get the area of this 2d element.
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.
unsigned getDimension() const { return 2; };
......
......@@ -72,6 +72,11 @@ public:
/// Get the element-vector for the mesh.
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);
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