Newer
Older
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
// Please report all bugs and problems to <gmsh@geuz.org>.
#include <list>
#include <vector>
#include <string>
#include "Range.h"
#include "SPoint3.h"
class GVertex;
class GEdge;
class GFace;
class GRegion;
// The visibility and the selection flag
char _visible, _selection;
// Flag storing if all mesh elements are visible
char _allElementsVisible;
// The color of the entity (ignored if set to transparent blue)
unsigned int _color;
// All known native model types
enum ModelType {
UnknownModel,
GmshModel,
FourierModel,
OpenCascadeModel
};
// All known entity types
enum GeomType {
Conic,
Parabola,
Hyperbola,
TrimmedCurve,
OffsetCurve,
Plane,
Nurb,
Cylinder,
Sphere,
Cone,
Torus,

Jean-François Remacle
committed
BSplineSurface,
// Returns a string describing the entity type
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";
// Regions that bound this entity or that this entity bounds.
// Faces that bound this entity or that this entity bounds.
// Edges that bound this entity or that this entity bounds.
/// Underlying geometric representation of this entity.
// True if parametric space is continuous in the "dim" direction.
// True if entity is periodic in the "dim" direction.
// True if there are parametric degeneracies in the "dim" direction.
// Parametric bounds of the entity in the "i" direction.
// True if the entity contains the given point to within tolerance.
virtual ModelType getNativeType() const { return UnknownModel; }
// Get the native pointer of the particular representation
virtual void setVisibility(char val, bool recursive=false){ _visible = val; }
// Get the selection flag
virtual char getSelection(){ return _selection; }
// Set the selection flag
virtual void setSelection(char val){ _selection = val; }
// Get the color
virtual unsigned int getColor(){ return _color; }
// Set the color
virtual void setColor(unsigned color){ _color = color; }
// Returns true if we should use this color to represent the entity
virtual bool useColor();
// Returns an information string for the entity
// Returns a type-specific additional information string
virtual std::string getAdditionalInfoString() { return std::string(""); }
// Resets the mesh attributes to default values
virtual void resetMeshAttributes() { return; }
// Gets the number of mesh elements in the entity
virtual unsigned int getNumMeshElements() { throw; }
// Gets the element at the given index
virtual MElement *getMeshElement(unsigned int index) { throw; }
// Get/set all mesh element visibility flag
bool getAllElementsVisible(){ return _allElementsVisible ? true : false; }
void setAllElementsVisible(bool val){ _allElementsVisible = val ? 1 : 0; }
// The mesh vertices uniquely owned by the entity
std::vector<MVertex*> mesh_vertices;
// The physical entitites (if any) that contain this entity
std::vector<int> physicals;
public:
bool operator()(const GEntity *ent1, const GEntity *ent2) const
{
return ent1->tag() < ent2->tag();
}
};