Skip to content
Snippets Groups Projects
Face.h 1.61 KiB
Newer Older
 * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.com)
Lars Bilke's avatar
Lars Bilke committed
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.com/LICENSE.txt
Lars Bilke's avatar
Lars Bilke committed
 *
 *
Lars Bilke's avatar
Lars Bilke committed
 * \file Face.h
Lars Bilke's avatar
Lars Bilke committed
 * Created on 2012-05-02 by Karsten Rink
 */

#ifndef FACE_H_
#define FACE_H_

#include "Element.h"

namespace MeshLib {

/**
 * Virtual base class for 2d mesh elements.
 */
class Face : public Element
{
public:
Karsten Rink's avatar
Karsten Rink committed
	/// 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; };

Karsten Rink's avatar
Karsten Rink committed
	/// Get dimension of the mesh element.
	unsigned getDimension() const { return 2; };
	/// Returns the face i of the element.
	const Element* getFace(unsigned i) const { return this->getEdge(i); };

	/// Get the number of nodes for face i.
Karsten Rink's avatar
Karsten Rink committed
	unsigned getNFaceNodes(unsigned i) const { (void)i; return 2; };
	/// 2D elements have no faces.
	unsigned getNFaces() const { return 0; };
	/// Returns the surface normal of a 2D element.
	void getSurfaceNormal(double normal[3]) const;
Karsten Rink's avatar
Karsten Rink committed
	/// Destructor
Karsten Rink's avatar
Karsten Rink committed
	/// Constructor for a generic mesh element containing an array of mesh nodes.
	Face(Node** nodes, MshElemType::type type, unsigned value = 0);
Karsten Rink's avatar
Karsten Rink committed
	/// Constructor for a generic mesh element without an array of mesh nodes.
	Face(MshElemType::type type, unsigned value = 0);
Karsten Rink's avatar
Karsten Rink committed
	/// Calculate the area of this 2d element.
Lars Bilke's avatar
Lars Bilke committed


}; /* class */

} /* namespace */

#endif /* FACE_H_ */