Newer
Older
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#include "Range.h"
#include "SPoint3.h"

Jean-François Remacle
committed
#include "SOrientedBoundingBox.h"
class GVertex;
class GEdge;
class GFace;
class GRegion;
// the color of the entity (ignored if set to transparent blue)

Jean-François Remacle
committed
protected:
SOrientedBoundingBox *_obb;
public: // these will become protected at some point
std::vector<MVertex*> mesh_vertices;
// the physical entitites (if any) that contain this entity
std::vector<int> physicals;
VertexArray *va_lines, *va_triangles;
enum ModelType {
UnknownModel,
GmshModel,
FourierModel,
OpenCascadeModel
};
Conic,
Parabola,
Hyperbola,
TrimmedCurve,
OffsetCurve,
Plane,
Nurb,
Cylinder,
Sphere,
Cone,
Torus,

Jean-François Remacle
committed
BSplineSurface,
virtual std::string getTypeString()
{
"Conic",
"Parabola",
"Hyperbola",
"TrimmedCurve",
"OffsetCurve",
"Plane",
"Nurb",
"Cylinder",
"Sphere",
"Cone",
"Torus",

Jean-François Remacle
committed
"BSpline surface",
"Bezier surface",
"Surface of Revolution",
unsigned int type = (unsigned int)geomType();
if(type >= sizeof(name) / sizeof(name[0]))
return "Undefined";
// delete the vertex arrays, used to to draw the mesh efficiently
virtual int dim() const { return -1; }
// regions that bound this entity or that this entity bounds.
virtual std::list<GRegion*> regions() const { return std::list<GRegion*>(); }
// faces that bound this entity or that this entity bounds.
virtual std::list<GFace*> faces() const { return std::list<GFace*>(); }
// edges that bound this entity or that this entity bounds.
virtual std::list<GEdge*> edges() const { return std::list<GEdge*>(); }
virtual std::list<GVertex*> vertices() const { return std::list<GVertex*>(); }
virtual GeomType geomType() const { return Unknown; }
// true if parametric space is continuous in the "dim" direction.
// true if there are parametric degeneracies in the "dim" direction.
virtual Range<double> parBounds(int i) const { return Range<double>(0., 0.); }
// true if the entity contains the given point to within tolerance.
virtual bool containsPoint(const SPoint3 &pt) const { return false; }
virtual ModelType getNativeType() const { return UnknownModel; }
// get the native pointer of the particular representation
virtual void *getNativePtr() const { return 0; }
virtual SBoundingBox3d bounds() const { return SBoundingBox3d(); }

Jean-François Remacle
committed
// get the oriented bounding box
virtual SOrientedBoundingBox getOBB() {return SOrientedBoundingBox(); }

Jean-François Remacle
committed
virtual void setVisibility(char val, bool recursive=false){ _visible = val; }
virtual char getSelection(){ return _selection; }
virtual void setSelection(char val){ _selection = val; }
virtual unsigned int getColor(){ return _color; }
virtual void setColor(unsigned color){ _color = color; }
// return true if we should use this color to represent the entity
virtual std::string getAdditionalInfoString() { return std::string(""); }
// number of types of elements
virtual int getNumElementTypes() const { return 0; }
// get the number of mesh elements (total and by type) in the entity
virtual unsigned int getNumMeshElements() { return 0; }
virtual void getNumMeshElements(unsigned *const c) const { };
// get the start of the array of a type of element
virtual MElement *const *getStartElementType(int type) const { return 0; }
virtual MElement *getMeshElement(unsigned int index) { return 0; }
bool getAllElementsVisible(){ return _allElementsVisible ? true : false; }
void setAllElementsVisible(bool val){ _allElementsVisible = val ? 1 : 0; }
unsigned int getNumMeshVertices() { return mesh_vertices.size(); }
MVertex *getMeshVertex(unsigned int index) { return mesh_vertices[index]; }
public:
bool operator()(const GEntity *ent1, const GEntity *ent2) const
{
return ent1->tag() < ent2->tag();
}
};