Newer
Older
// Gmsh - Copyright (C) 1997-2015 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <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;
// gives the number of the master entity in periodic mesh, gives _tag
GEntity* _meshMaster;
// 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;
// corresponding principal vertices
std::map<GVertex*,GVertex*> vertexCounterparts;
// the physical entitites (if any) that contain this entity
std::vector<int> physicals;
VertexArray *va_lines, *va_triangles;
Paul-Emile Bernard
committed
GenericModel,
Conic,
Parabola,
Hyperbola,
TrimmedCurve,
OffsetCurve,
Plane,
Nurb,
Cylinder,
Sphere,
Cone,
Torus,

Jean-François Remacle
committed
BSplineSurface,
BezierSurface,
SurfaceOfRevolution,
Gauthier Becker
committed
DiscreteVolume,
PartitionCurve,

Christophe Geuzaine
committed
enum MeshGenerationStatus {

Christophe Geuzaine
committed
FAILED
};
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",
Gauthier Becker
committed
"Discrete volume",
"Partition vertex",
"Partition curve",
"Partition surface"
unsigned int type = (unsigned int)geomType();
if(type >= sizeof(name) / sizeof(name[0]))
return "Undefined";
GEntity(GModel *m,int t);
// 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*>(); }
// for python, temporary solution while iterator are not binded
std::list<GRegion*> r = regions(); // NOTE : two-line to dont create two different lists with diff pointers
return std::vector<GRegion*> (r.begin(), r.end());
}
std::vector<GFace*> bindingsGetFaces() {
std::list<GFace*> f = faces();
return std::vector<GFace*> (f.begin(), f.end());
}
std::vector<GEdge*> bindingsGetEdges() {
std::list<GEdge*> e = edges();
return std::vector<GEdge*> (e.begin(), e.end());
}
std::vector<GVertex*> bindingsGetVertices() {
std::list<GVertex*> v = vertices();
return std::vector<GVertex*> (v.begin(), v.end());
}
virtual GeomType geomType() const { return Unknown; }
// true if parametric space is continuous in the "dim" direction.
virtual double period(int dim) const { return 0.0; }
// true if there are parametric degeneracies in the "dim" direction.
// does the entity have a parametrization?
virtual bool haveParametrization(){ return true; }
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; }
Paul-Emile Bernard
committed
// get the native id (int) of the particular representation
virtual int getNativeInt() const { return 0; }
// returns the master entity (for mesh)
GEntity* meshMaster() const;
void setMeshMaster(GEntity*,const std::vector<double>&);
virtual SBoundingBox3d bounds() const { return SBoundingBox3d(); }

Jean-François Remacle
committed
// get the oriented bounding box
virtual SOrientedBoundingBox getOBB() {return SOrientedBoundingBox(); }
Gauthier Becker
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 unsigned int getNumMeshParentElements() { 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 (int)mesh_vertices.size(); }
MVertex *getMeshVertex(unsigned int index) { return mesh_vertices[index]; }

Christophe Geuzaine
committed
// add a MeshVertex
void addMeshVertex(MVertex *v) { mesh_vertices.push_back(v);}

Christophe Geuzaine
committed
// relocate mesh vertices using their parametric coordinates
virtual void relocateMeshVertices(){}
GVertex *cast2Vertex();
GEdge *cast2Edge();
GFace *cast2Face();
GRegion *cast2Region();
std::vector<double> affineTransform;
std::map<MVertex*,MVertex*> correspondingVertices;
public:
bool operator()(const GEntity *ent1, const GEntity *ent2) const
{
return ent1->tag() < ent2->tag();
}
};