Newer
Older
/**
* Element.h
*
* Date: 2012/05/02
* Author: KR
*/
#ifndef ELEMENT_H_
#define ELEMENT_H_
#include <vector>
#include "MshEnums.h"
#include "Mesh.h"
namespace MeshLib {
class Node;
/**
* Virtual base class for mesh elements.
*/
class Element
{
Karsten Rink
committed
/* friend functions: */
friend void Mesh::setElementInformationForNodes();
friend void Mesh::addElement(Element*);
Karsten Rink
committed
const Node* getNode(unsigned i) const;
Node* const* getNodes() const { return _nodes; };
Karsten Rink
committed
virtual unsigned getDimension() const = 0;
/// Get the number of edges for this element.
Karsten Rink
committed
virtual unsigned getNEdges() const = 0;
/// Get the number of faces for this element.
Karsten Rink
committed
virtual unsigned getNFaces() const = 0;
/// Get the specified neighbor.
Karsten Rink
committed
const Element* getNeighbor(unsigned i) const;
/// Get the number of neighbors for this element.
Karsten Rink
committed
virtual unsigned getNNeighbors() const = 0;
Karsten Rink
committed
virtual unsigned getNNodes() const = 0;
/// Get the global index for the node with local index i.
Karsten Rink
committed
unsigned getNodeIndex(unsigned i) const;
/// Get the type of the mesh element (as a MshElemType-enum).
MshElemType::type getType() const { return _type; };
Karsten Rink
committed
unsigned getValue() const { return _value; };
bool hasNeighbor(Element* elem) const;
virtual ~Element();
protected:
/// Constructor for a generic mesh element containing an array of mesh nodes.
Karsten Rink
committed
Element(Node** nodes, MshElemType::type type, unsigned value = 0);
/// Constructor for a generic mesh element without an array of mesh nodes.
Karsten Rink
committed
Element(MshElemType::type type, unsigned value = 0);
MshElemType::type _type;
Karsten Rink
committed
unsigned _value;
private:
}; /* class */
} /* namespace */
#endif /* ELEMENT_H_ */