~ubuntu-branches/ubuntu/intrepid/gmsh/intrepid

« back to all changes in this revision

Viewing changes to Geo/GEdge.h

  • Committer: Bazaar Package Importer
  • Author(s): Emmet Hikory
  • Date: 2007-05-07 10:01:37 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070507100137-6j0rzz1ucbn0m2jt
Tags: 2.0.7-1ubuntu1
* Merged with Debian unstable.  Remaining Ubuntu changes:
  - Add .desktop file
  - Add icon
* Added XSBC-Original-Maintainer
* Removed Application Category from gmsh.desktop
* Link against GLU (fixes FTBFS)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _GEDGE_H_
 
2
#define _GEDGE_H_
 
3
 
 
4
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 
5
//
 
6
// This program is free software; you can redistribute it and/or modify
 
7
// it under the terms of the GNU General Public License as published by
 
8
// the Free Software Foundation; either version 2 of the License, or
 
9
// (at your option) any later version.
 
10
//
 
11
// This program is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
// GNU General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU General Public License
 
17
// along with this program; if not, write to the Free Software
 
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
19
// USA.
 
20
// 
 
21
// Please report all bugs and problems to <gmsh@geuz.org>.
 
22
 
 
23
#include "GEntity.h"
 
24
#include "GVertex.h"
 
25
#include "SVector3.h"
 
26
#include "SPoint3.h"
 
27
#include "SPoint2.h"
 
28
#include "MElement.h"
 
29
#include "ExtrudeParams.h"
 
30
 
 
31
// A model edge.
 
32
class GEdge : public GEntity {
 
33
 protected:
 
34
  GVertex *v0, *v1;
 
35
  std::list<GFace *> l_faces;
 
36
  double _length;
 
37
 
 
38
 public:
 
39
  GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1);
 
40
  virtual ~GEdge();
 
41
 
 
42
  GVertex *getBeginVertex() const { return v0; }
 
43
  GVertex *getEndVertex() const { return v1; }
 
44
 
 
45
  void addFace(GFace *f);
 
46
  void delFace(GFace *f);
 
47
 
 
48
  virtual int dim() const {return 1;}
 
49
  virtual bool periodic(int dim=0) const = 0;
 
50
  virtual bool continuous(int dim=0) const = 0;
 
51
  virtual void setVisibility(char val, bool recursive=false);
 
52
 
 
53
  /** True if the edge is a seam for the given face. */
 
54
  virtual int isSeam(GFace *face) const {return 0;}
 
55
 
 
56
  // The bounding box
 
57
  SBoundingBox3d bounds() const;
 
58
 
 
59
  // Faces that bound this entity or that this entity bounds.
 
60
  virtual std::list<GFace*> faces() const{return l_faces;}
 
61
 
 
62
  // Get the parameter location for a point in space on the edge.
 
63
  virtual double parFromPoint(const SPoint3 &) const = 0;
 
64
 
 
65
  // Get the point for the given parameter location.
 
66
  virtual GPoint point(double p) const = 0;
 
67
 
 
68
  // Get the closest point on the edge to the given point.
 
69
  virtual GPoint closestPoint(const SPoint3 & queryPoint) =0;
 
70
 
 
71
  // True if the edge contains the given parameter.
 
72
  virtual int containsParam(double pt) const = 0;
 
73
 
 
74
  // Get first derivative of edge at the given parameter.
 
75
  virtual SVector3 firstDer(double par) const = 0;
 
76
 
 
77
  // Get second derivative of edge at the given parameter.
 
78
  // Default implentation using central differences
 
79
  virtual SVector3 secondDer(double par) const ;
 
80
  virtual double curvature (double par) const;  
 
81
 
 
82
  // Reparmaterize the point onto the given face.
 
83
  virtual SPoint2 reparamOnFace(GFace *face, double epar,int dir) const ;
 
84
 
 
85
  // Recompute the mesh partitions defined on this edge.
 
86
  void recomputeMeshPartitions();
 
87
 
 
88
  // Delete the mesh partitions defined on this edge.
 
89
  void deleteMeshPartitions();
 
90
 
 
91
  // Returns the minimum number of segments used for meshing the edge
 
92
  virtual int minimumMeshSegments() const {return 1;}
 
93
 
 
94
  // Returns the minimum number of segments used for drawing the edge
 
95
  virtual int minimumDrawSegments() const {return 1;}
 
96
 
 
97
  // Returns a type-specific additional information string
 
98
  virtual std::string getAdditionalInfoString();
 
99
 
 
100
  // tells if the edge is a 3D edge (in opposition with a trimmed curve on a surface)
 
101
  virtual bool is3D() const {return true;}
 
102
 
 
103
  // the length of the model edge
 
104
  inline double length() const {return _length;}
 
105
  inline void setLength(const double l) {_length = l;}
 
106
 
 
107
  // one can impose the mesh size at an edge
 
108
  virtual double prescribedMeshSizeAtVertex() const {return meshAttributes.meshSize;}
 
109
 
 
110
  // Resets the mesh attributes to default values
 
111
  virtual void resetMeshAttributes();
 
112
 
 
113
  struct {
 
114
    char   Method;
 
115
    double coeffTransfinite;
 
116
    double meshSize;
 
117
    int    nbPointsTransfinite;
 
118
    int    typeTransfinite;
 
119
    // the extrusion parameters (if any)
 
120
    ExtrudeParams *extrude;
 
121
  } meshAttributes ;
 
122
 
 
123
  std::vector<MLine*> lines;
 
124
};
 
125
 
 
126
#endif