/usr/include/gmsh/GEdge.h is in libgmsh-dev 2.8.5+dfsg-1.1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | // Gmsh - Copyright (C) 1997-2014 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>.
#ifndef _GEDGE_H_
#define _GEDGE_H_
#include <list>
#include <string>
#include <vector>
#include <set>
#include <stdio.h>
#include "GmshMessage.h"
#include "GEntity.h"
#include "GVertex.h"
#include "SVector3.h"
#include "SPoint3.h"
#include "SPoint2.h"
class MElement;
class MLine;
class ExtrudeParams;
class GEdgeCompound;
class closestPointFinder;
// A model edge.
class GEdge : public GEntity {
private:
double _length;
bool _tooSmall;
closestPointFinder *_cp;
protected:
GVertex *v0, *v1;
// FIXME: normals need to be mutable at the moment, because thay can
// be created in const member functions
mutable std::map<MVertex*, SVector3, std::less<MVertex*> > _normals;
GEdgeCompound *compound; // this model edge belongs to a compound
std::list<GFace *> l_faces;
// for specific solid modelers that need to re-do the internal curve
// if a topological change ending points is done (gluing)
virtual void replaceEndingPointsInternals(GVertex *, GVertex *) {}
public:
GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1);
virtual ~GEdge();
// delete mesh data
virtual void deleteMesh();
// get the start/end vertices of the edge
GVertex *getBeginVertex() const { return v0; }
GVertex *getEndVertex() const { return v1; }
void reverse();
// add/delete a face bounded by this edge
void addFace(GFace *f);
void delFace(GFace *f);
// get the dimension of the edge (1)
virtual int dim() const { return 1; }
// set the visibility flag
virtual void setVisibility(char val, bool recursive=false);
// true if the edge is a seam for the given face.
virtual bool isSeam(const GFace *face) const { return false; }
// get the bounding box
virtual SBoundingBox3d bounds() const;
// get the oriented bounding box
virtual SOrientedBoundingBox getOBB();
// regions that are boundedby this entity
virtual std::list<GRegion*> regions() const;
// faces that this entity bounds
virtual std::list<GFace*> faces() const { return l_faces; }
// get the point for the given parameter location
virtual GPoint point(double p) const = 0;
// true if the edge contains the given parameter
virtual bool containsParam(double pt) const;
// get the position for the given parameter location
virtual SVector3 position(double p) const
{
GPoint gp = point(p);
return SVector3(gp.x(), gp.y(), gp.z());
}
// get first derivative of edge at the given parameter
virtual SVector3 firstDer(double par) const = 0;
// get second derivative of edge at the given parameter (default
// implentation using central differences)
virtual SVector3 secondDer(double par) const;
// get the curvature
virtual double curvature(double par) const;
// reparmaterize the point onto the given face
virtual SPoint2 reparamOnFace(const GFace *face, double epar, int dir) const;
// return the minimum number of segments used for meshing the edge
virtual int minimumMeshSegments() const { return 1; }
// return the minimum number of segments used for drawing the edge
virtual int minimumDrawSegments() const { return 1; }
// return a type-specific additional information string
virtual std::string getAdditionalInfoString();
// export in GEO format
virtual void writeGEO(FILE *fp);
// tell if the edge is a 3D edge (in opposition with a trimmed curve on a surface)
virtual bool is3D() const { return true; }
// get/set/compute the length of the model edge
inline double length() const { return _length; }
inline void setLength(const double l) { _length = l; }
double length(const double &u0, const double &u1, const int nbQuadPoints = 4);
// get the prescribed mesh size on the edge
virtual double prescribedMeshSizeAtVertex() const { return meshAttributes.meshSize; }
// true if start == end and no more than 2 segments
void setTooSmall(bool b) { _tooSmall = b; }
bool isMeshDegenerated() const
{
if (_tooSmall)
Msg::Debug("degenerated mesh on edge %d: too small", tag());
if (v0 == v1 && mesh_vertices.size() < 2)
Msg::Debug("degenerated mesh on edge %d: %d mesh vertices", tag(),
(int)mesh_vertices.size());
return _tooSmall || (v0 == v1 && mesh_vertices.size() < 2);
}
// number of types of elements
int getNumElementTypes() const { return 1; }
// get total/by-type number of elements in the mesh
unsigned int getNumMeshElements();
unsigned int getNumMeshParentElements();
void getNumMeshElements(unsigned *const c) const;
// get the start of the array of a type of element
MElement *const *getStartElementType(int type) const;
// get the element at the given index
MElement *getMeshElement(unsigned int index);
// reset the mesh attributes to default values
virtual void resetMeshAttributes();
// true if entity is periodic in the "dim" direction.
virtual bool periodic(int dim) const { return v0 == v1; }
std::map<MVertex*, SVector3, std::less<MVertex*> > &getNormals() { return _normals; }
// get bounds of parametric coordinate
virtual Range<double> parBounds(int i) const = 0;
inline double getLowerBound() const{ return parBounds(0).low();};
inline double getUpperBound() const{ return parBounds(0).high();};
// return the point on the face closest to the given point
virtual GPoint closestPoint(const SPoint3 &queryPoint, double ¶m) const;
// return the parmater location on the edge given a point in space
// that is on the edge
virtual double parFromPoint(const SPoint3 &P) const;
// compute the parameter U from a point XYZ
virtual bool XYZToU(const double X, const double Y, const double Z,
double &U, const double relax=0.5) const;
// compound
void setCompound(GEdgeCompound *gec) { compound = gec; }
GEdgeCompound *getCompound() const { return compound; }
// gluing
void replaceEndingPoints(GVertex *, GVertex *);
// relocate mesh vertices using parametric coordinates
void relocateMeshVertices();
struct {
char method;
double coeffTransfinite;
double meshSize;
int nbPointsTransfinite;
int typeTransfinite;
int minimumMeshSegments;
// the extrusion parameters (if any)
ExtrudeParams *extrude;
// reverse mesh orientation
bool reverseMesh;
} meshAttributes ;
struct {
mutable GEntity::MeshGenerationStatus status;
} meshStatistics;
std::vector<MLine*> lines;
void addLine(MLine *line){ lines.push_back(line); }
virtual void discretize(double tol, std::vector<SPoint3> &dpts, std::vector<double> &ts);
SPoint3 closestPoint (SPoint3 &p, double tolerance);
};
#endif
|