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

« back to all changes in this revision

Viewing changes to Mesh/BDS.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
 
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 
1
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
2
2
//
3
3
// This program is free software; you can redistribute it and/or modify
4
4
// it under the terms of the GNU General Public License as published by
22
22
// points may know the normals to the surface they are classified on
23
23
// default values are 0,0,1
24
24
 
25
 
#ifdef HAVE_ANN_
26
 
#include "ANN/ANN.h"
27
 
#endif
28
25
#include <string>
29
26
#include <set>
30
27
#include <map>
32
29
#include <algorithm>
33
30
#include <list>
34
31
#include <math.h>
 
32
#include "GFace.h"
35
33
#include "Views.h"
36
34
 
37
 
class BDS_Tet;
38
35
class BDS_Edge;
39
 
class BDS_Triangle;
 
36
class BDS_Face;
40
37
class BDS_Mesh;
41
38
class BDS_Point;
42
39
class BDS_Vector;
 
40
class GFace;
 
41
class GEdge;
 
42
class GVertex;
43
43
 
44
44
void vector_triangle(BDS_Point *p1, BDS_Point *p2, BDS_Point *p3, double c[3]); 
45
45
void normal_triangle(BDS_Point *p1, BDS_Point *p2, BDS_Point *p3, double c[3]); 
46
46
double surface_triangle(BDS_Point *p1, BDS_Point *p2, BDS_Point *p3); 
 
47
double surface_triangle_param(BDS_Point *p1, BDS_Point *p2, BDS_Point *p3); 
47
48
double quality_triangle(BDS_Point *p1, BDS_Point *p2, BDS_Point *p3);
48
49
 
49
 
class BDS_Metric
50
 
{
51
 
public:
52
 
  const double target,_min,_max,treshold, beta;
53
 
  const double nb_elements_per_radius_of_curvature;
54
 
  BDS_Metric(double _target , double _mmin, double _mmax, double _b, double cc, double _tres = 0.7) 
55
 
    : target(_target),_min(_mmin),_max(_mmax),treshold(_tres),beta(_b),nb_elements_per_radius_of_curvature(cc)
56
 
  {}
57
 
  inline double update_target_length(double _target, double old_target_length) const
58
 
  {
59
 
    if(_target <= _min) return _min;
60
 
    if(_target >= _max && old_target_length > _max) return _max;
61
 
    if(old_target_length > _target)return _target ;
62
 
    return old_target_length;
63
 
  }
64
 
  inline double target_length(double x, double y, double z) const
65
 
  {
66
 
    return target;
67
 
  }
68
 
};
69
 
 
70
 
class BDS_Surface
71
 
{
72
 
public :
73
 
  virtual ~BDS_Surface(){}
74
 
  virtual double signedDistanceTo(double x, double y, double z) const = 0;
75
 
  virtual void projection(double xa, double ya, double za,
76
 
                          double &x, double &y, double &z) const =0;
77
 
  virtual std::string nameOf() const = 0;
78
 
  virtual BDS_Vector Gradient(double x, double y, double z) const = 0;
79
 
  virtual double normalCurv(double x, double y, double z) const = 0;
80
 
};
81
 
 
82
 
 
83
50
class BDS_GeomEntity
84
51
{
85
52
public:
86
 
  int nbK;
 
53
 
87
54
  int classif_tag;
88
55
  int classif_degree;
89
 
  
90
 
#ifdef HAVE_ANN_
91
 
  ANNpointArray           dataPts;                                // data points
92
 
  ANNpoint                queryPt;                                // query point
93
 
  ANNidxArray             nnIdx;                                  // near neighbor indices
94
 
  ANNdistArray            dists;                                  // near neighbor distances
95
 
  ANNkd_tree*             kdTree;                                 // search structure
96
 
  std::vector<BDS_Edge *> sE;
97
 
  std::vector<double> sR;
98
 
#endif
99
 
  std::list<BDS_Triangle *> t;
100
 
  std::list<BDS_Edge *>     e;
101
 
  BDS_Point   *p;
102
 
  BDS_Surface *surf;
103
 
  void getClosestTriangles(double x, double y, double z, 
104
 
                           std::list<BDS_Triangle*> &l , 
105
 
                           double &radius,
106
 
                           double &X, double &Y, double &Z);
107
 
  inline bool operator < (const BDS_GeomEntity & other) const
 
56
    inline bool operator < (const BDS_GeomEntity & other) const
108
57
  {
109
58
    if(classif_degree < other.classif_degree)return true;
110
59
    if(classif_degree > other.classif_degree)return false;
112
61
    return false;
113
62
  }
114
63
  BDS_GeomEntity(int a, int b)  
115
 
    : classif_tag(a),classif_degree(b),p(0),surf(0)
 
64
    : classif_tag(a),classif_degree(b)
116
65
  {
117
 
    nbK=1;
118
 
#ifdef HAVE_ANN_
119
 
    kdTree = 0;
120
 
#endif
121
66
  }
122
67
  ~BDS_GeomEntity()  
123
68
  {
124
 
#ifdef HAVE_ANN_
125
 
        if (kdTree)
126
 
          {
127
 
            annDeallocPts(dataPts);
128
 
            delete [] nnIdx;                                                    // clean things up
129
 
            delete [] dists;        
130
 
            delete kdTree;
131
 
          }
132
 
#endif
133
69
  }
134
70
};
135
71
 
136
 
void print_face(BDS_Triangle *t);
 
72
void print_face(BDS_Face *t);
137
73
 
138
74
class BDS_Vector
139
75
{
204
140
    double ag = atan2(sina,cosa);
205
141
    return ag;
206
142
  }
 
143
  double angle_deg(const  BDS_Vector &v) const
 
144
  {
 
145
    return angle(v) * 180 / M_PI;
 
146
  }
207
147
  double operator * (const  BDS_Vector &v) const
208
148
  {
209
149
    return (x*v.x+y*v.y+z*v.z);
217
157
  static double t;
218
158
};
219
159
 
220
 
class BDS_Pos
221
 
{
222
 
public:
223
 
  double X,Y,Z;    
224
 
  BDS_Pos(const double &x,const double &y, const double & z)
225
 
    : X(x),Y(y),Z(z)
226
 
  {
227
 
  }
228
 
};
229
 
 
230
 
class BDS_Point : public BDS_Pos
231
 
{
232
 
public:
 
160
class BDS_Point 
 
161
{
 
162
  double _lc;
 
163
public:
 
164
  double X,Y,Z; // Real COORDINATES
 
165
  double u,v;   // Parametric COORDINATES
 
166
  bool config_modified;
233
167
  int iD;
234
 
  double radius_of_curvature;
235
168
  BDS_GeomEntity *g;
236
169
  std::list<BDS_Edge*> edges;
237
 
  
238
 
  BDS_Vector N() const;
 
170
 
 
171
  // just a transition
 
172
  double & radius () {return _lc;}
 
173
  double & lc     () {return _lc;}
239
174
  
240
175
  inline bool operator < (const BDS_Point & other) const
241
176
  {
253
188
      ++it;
254
189
    }
255
190
  }
256
 
  double min_edge_length();
257
 
  void getTriangles(std::list<BDS_Triangle *> &t) const;        
258
 
  void compute_curvature();
 
191
  void getTriangles(std::list<BDS_Face *> &t) const;    
259
192
  BDS_Point(int id, double x=0, double y=0, double z=0)
260
 
    : BDS_Pos(x,y,z),iD(id),radius_of_curvature(1.e22),g(0)
 
193
    : _lc(1.e22),X(x),Y(y),Z(z),u(0),v(0),config_modified(true),iD(id),g(0)
261
194
  {         
262
195
  }
263
196
};
264
197
 
265
198
class BDS_Edge
266
199
{
267
 
  std::vector <BDS_Triangle *> _faces;
 
200
  double _length;
 
201
  std::vector <BDS_Face *> _faces;
268
202
public:
269
203
  bool deleted;
270
 
  int status;
271
 
  int partition;
272
 
  double target_length;
273
204
  BDS_Point *p1,*p2;
274
205
  BDS_GeomEntity *g;
275
 
  inline BDS_Triangle* faces(int i) const
 
206
  inline BDS_Face* faces(int i) const
276
207
  {
277
208
    return _faces [i];
278
209
  }
279
210
  inline double length() const
280
211
  {
281
 
    return sqrt((p1->X-p2->X)*(p1->X-p2->X)+(p1->Y-p2->Y)*(p1->Y-p2->Y)+(p1->Z-p2->Z)*(p1->Z-p2->Z));
 
212
    return _length;
282
213
  }
283
214
  inline int numfaces() const 
284
215
  {
285
216
    return _faces.size();
286
217
  }
 
218
  int numTriangles() const ;
287
219
  inline BDS_Point * commonvertex(const BDS_Edge *other) const
288
220
  {
289
221
    if(p1 == other->p1 || p1 == other->p2) return p1;
296
228
    if(p2 == p) return p1;
297
229
    return 0;
298
230
  }
299
 
  inline void addface(BDS_Triangle *f)
 
231
  inline void addface(BDS_Face *f)
300
232
  {
301
233
    _faces.push_back(f);
302
234
  }
307
239
    if(*other.p2 < *p2) return true;
308
240
    return false;
309
241
  }
310
 
  inline BDS_Triangle * otherFace(const BDS_Triangle *f) const
 
242
  inline BDS_Face * otherFace(const BDS_Face *f) const
311
243
  {
312
244
    if(numfaces()!=2) throw;
313
245
    if(f == _faces[0]) return _faces[1];
314
246
    if(f == _faces[1]) return _faces[0];
315
247
    throw;
316
248
  }
317
 
  inline void del(BDS_Triangle *t)
 
249
  inline void del(BDS_Face *t)
318
250
  {
319
 
    _faces.erase(std::remove_if(_faces.begin(),_faces.end() , std::bind2nd(std::equal_to<BDS_Triangle*>(), t)) , 
 
251
    _faces.erase(std::remove_if(_faces.begin(),_faces.end() , std::bind2nd(std::equal_to<BDS_Face*>(), t)) , 
320
252
                 _faces.end());
321
253
  }
322
254
  
323
 
  inline void oppositeof(BDS_Point * oface[2]) const; 
 
255
  void oppositeof(BDS_Point * oface[2]) const; 
324
256
  
 
257
  void update ()
 
258
  {
 
259
    _length = sqrt((p1->X-p2->X)*(p1->X-p2->X)+(p1->Y-p2->Y)*(p1->Y-p2->Y)+(p1->Z-p2->Z)*(p1->Z-p2->Z));
 
260
  }
 
261
 
325
262
  BDS_Edge(BDS_Point *A, BDS_Point *B)
326
 
    : deleted(false), status(0),partition(0),target_length(1.0),g(0)
 
263
    : deleted(false),g(0)
327
264
  {         
328
265
    if(*A < *B){
329
266
      p1=A;
335
272
    }
336
273
    p1->edges.push_back(this);
337
274
    p2->edges.push_back(this);
 
275
    update();
338
276
  }
339
277
};
340
278
 
341
 
class BDS_Triangle
 
279
 
 
280
class BDS_Face
342
281
{
343
282
public:
344
283
  bool deleted;
345
 
  int status;
346
 
  int partition;
347
 
  BDS_Tet  *t1,*t2;
348
 
  BDS_Edge *e1,*e2,*e3;
349
 
  BDS_Vector NORMAL;
350
 
  double surface;
351
 
  inline BDS_Vector N() const {return NORMAL;}
352
 
  inline double S() const {return surface;}
 
284
  BDS_Edge *e1,*e2,*e3,*e4;
353
285
  BDS_GeomEntity *g;
354
 
  
355
 
  inline double inscribed_radius() const
356
 
  {
357
 
    double l1 = e1->length();
358
 
    double l2 = e2->length();
359
 
    double l3 = e3->length();
360
 
    return (2 * S() / (l1+l2+l3));
361
 
  }
362
 
  
363
 
  inline BDS_Tet * opposite_tet(BDS_Tet *t)
364
 
  {
365
 
    if(t == t1)return t2;
366
 
    if(t == t2)return t1;
367
 
    throw;
368
 
  }
369
 
  
370
 
  inline int numtets() const 
371
 
  {
372
 
    return ((t1!=0) + (t2 !=0));
373
 
  }
374
 
  
375
 
  inline BDS_Vector cog() const
376
 
  {
377
 
    BDS_Point *n[3];
378
 
    getNodes(n);
379
 
    return BDS_Vector((n[0]->X+n[1]->X+n[2]->X)/3.,
380
 
                      (n[0]->Y+n[1]->Y+n[2]->Y)/3.,
381
 
                      (n[0]->Z+n[1]->Z+n[2]->Z)/3.);
382
 
  }
383
 
  
384
 
  inline void _update()
385
 
  { 
386
 
    BDS_Point *pts[3];
387
 
    getNodes(pts);
388
 
    double c[3];
389
 
    vector_triangle(pts[0],pts[1],pts[2],c);
390
 
    surface = 0.5 * sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2]);
391
 
    NORMAL.x = 2*c[0]/surface;
392
 
    NORMAL.y = 2*c[1]/surface;
393
 
    NORMAL.z = 2*c[2]/surface;
394
 
  }
395
 
  
396
 
  inline void getNodes(BDS_Point *n[3]) const
397
 
  {
398
 
    n[0] = e1->commonvertex(e3);
399
 
    n[1] = e1->commonvertex(e2);
400
 
    n[2] = e2->commonvertex(e3);
401
 
  }
402
 
  
403
 
  inline BDS_Vector N_on_the_fly() const 
404
 
  {
405
 
    double nn[3];
406
 
    BDS_Point *pp[3];
407
 
    getNodes(pp);
408
 
    normal_triangle(pp[0], pp[1], pp[2],nn);
409
 
    return BDS_Vector(nn[0],nn[1],nn[2]);
410
 
  }
411
 
  
412
 
  inline void addtet(BDS_Tet *t)
413
 
  {
414
 
    if(!t1) t1 = t;
415
 
    else if(!t2) t2 = t;
416
 
    else throw;
417
 
  }
418
 
  
419
 
  inline void del(BDS_Tet *t)
420
 
  {
421
 
    if(t == t1){
422
 
      t1 = t2;
423
 
      t2 = 0;
424
 
    }
425
 
    else if(t == t2){
426
 
      t2 = 0;
427
 
    }
 
286
  inline int numEdges () const {return e4?4:3;}
 
287
  inline void getNodes(BDS_Point *n[4]) const
 
288
  {
 
289
    if (!e4)
 
290
      {
 
291
        n[0] = e1->commonvertex(e3);
 
292
        n[1] = e1->commonvertex(e2);
 
293
        n[2] = e2->commonvertex(e3);
 
294
        n[3] = 0;
 
295
      }
428
296
    else
429
 
      throw;
 
297
      {
 
298
        n[0] = e1->commonvertex(e4);
 
299
        n[1] = e1->commonvertex(e2);
 
300
        n[2] = e2->commonvertex(e3);
 
301
        n[3] = e3->commonvertex(e4);
 
302
      }
430
303
  }
431
304
  
432
 
  BDS_Triangle(BDS_Edge *A, BDS_Edge *B, BDS_Edge *C)
433
 
    : deleted(false) , status(0), partition(0),t1(0),t2(0),e1(A),e2(B),e3(C),g(0)
 
305
  BDS_Face(BDS_Edge *A, BDS_Edge *B, BDS_Edge *C,BDS_Edge *D = 0)
 
306
    : deleted(false) ,e1(A),e2(B),e3(C),e4(D),g(0)
434
307
  {     
435
308
    e1->addface(this);
436
309
    e2->addface(this);
437
310
    e3->addface(this);
438
 
    _update();
439
 
  }
440
 
};
441
 
 
442
 
class BDS_Tet
443
 
{
444
 
public:
445
 
  bool deleted;
446
 
  int status;
447
 
  int partition;
448
 
  BDS_Triangle  *f1,*f2,*f3,*f4;
449
 
  double volume;
450
 
  inline double V() const {return volume;}
451
 
  BDS_GeomEntity *g;
452
 
  
453
 
  inline BDS_Vector cog() const
454
 
  {
455
 
    BDS_Point *n[4];
456
 
    getNodes(n);
457
 
    return BDS_Vector((n[0]->X+n[1]->X+n[2]->X+n[3]->X)/4.,
458
 
                      (n[0]->Y+n[1]->Y+n[2]->Y+n[3]->Y)/4.,
459
 
                      (n[0]->Z+n[1]->Z+n[2]->Z+n[3]->Z)/4.);
460
 
  }
461
 
  
462
 
  inline void _update()
463
 
  { 
464
 
  }
465
 
  
466
 
  inline void getNodes(BDS_Point *n[4]) const
467
 
  {
468
 
    BDS_Point *o[3];
469
 
    f1->getNodes(n);
470
 
    f2->getNodes(o);      
471
 
    n[3] = 0; //for stupid gcc warning
472
 
    if(o[0] != n[0] && o[0] != n[1] &&o[0] != n[2])n[3] = o[0];
473
 
    if(o[1] != n[0] && o[1] != n[1] &&o[1] != n[2])n[3] = o[1];
474
 
    if(o[2] != n[0] && o[2] != n[1] &&o[2] != n[2])n[3] = o[2];
475
 
  }
476
 
  
477
 
  BDS_Tet(BDS_Triangle *A, BDS_Triangle *B, BDS_Triangle *C, BDS_Triangle *D)
478
 
    : deleted(false) , status(0), partition(0),f1(A),f2(B),f3(C),f4(D),g(0)
479
 
  {     
480
 
    f1->addtet(this);
481
 
    f2->addtet(this);
482
 
    f3->addtet(this);
483
 
    f4->addtet(this);
484
 
    _update();
485
 
  }
486
 
};
487
 
 
488
 
 
489
 
class BDS_Plane : public  BDS_Surface
490
 
{
491
 
  double a,b,c,d;
492
 
public :
493
 
  BDS_Plane(const double &A, const double &B, const double &C)
494
 
    : a(A),b(B),c(C)
495
 
  {
496
 
  }
497
 
  virtual double signedDistanceTo(double x, double y, double z) const {return a*x + b*y + c*z + 1;}
498
 
  virtual void projection(double xa, double ya, double za,
499
 
                          double &x, double &y, double &z) const 
500
 
  {
501
 
    double k = - (a * xa +  b * ya +  c * za + 1) / (a * a + b * b + c * c); 
502
 
    x = xa + k * a;
503
 
    y = ya + k * b;
504
 
    z = za + k * c;
505
 
  }
506
 
  virtual std::string nameOf() const {return std::string("Plane");}
507
 
  virtual BDS_Vector Gradient(double x, double y, double z) const
508
 
  {
509
 
    return BDS_Vector(a , b , c);
510
 
  } 
511
 
  virtual double normalCurv(double x, double y, double z) const
512
 
  {
513
 
    return 1.e-22;
514
 
  }
515
 
};
516
 
 
517
 
class BDS_Quadric : public  BDS_Surface
518
 
{
519
 
public :
520
 
  double a,b,c,d,e,f,g,h,i;
521
 
  BDS_Quadric(double A,double B,double C, double D, double E, double F, double G, double H, double I)
522
 
    : a(A),b(B),c(C),d(D),e(E),f(F),g(G),h(H),i(I)
523
 
  {
524
 
  }
525
 
  
526
 
  virtual BDS_Vector Gradient(double x, double y, double z) const 
527
 
  {
528
 
    return BDS_Vector(2 * (a * x + d * y + e * z) + g ,
529
 
                      2 * (d * x + b * y + f * z) + h ,
530
 
                      2 * (e * x + f * y + c * z) + i);
531
 
  }
532
 
  
533
 
  virtual double normalCurv(double x, double y, double z) const;
534
 
  
535
 
  virtual double signedDistanceTo(double x, double y, double z) const {
536
 
    const double q = 
537
 
      a * x * x +  
538
 
      b * y * y +  
539
 
      c * z * z +  
540
 
      2 * d * x * y + 
541
 
      2 * e * x * z + 
542
 
      2 * f * y * z +
543
 
      g *  x +
544
 
      h *  y +
545
 
      i *  z - 1.0;
546
 
    return q;
547
 
  }
548
 
  virtual void projection(double xa, double ya, double za,
549
 
                          double &x, double &y, double &z) const ;
550
 
  virtual std::string nameOf() const {return std::string("Quadric");}
551
 
};
 
311
    if(e4)e4->addface(this);
 
312
  }
 
313
};
 
314
 
552
315
 
553
316
class GeomLessThan
554
317
{
592
355
  }
593
356
};
594
357
 
 
358
 
 
359
class BDS_SwapEdgeTest
 
360
{
 
361
 public:
 
362
  virtual bool operator() (BDS_Point *p1,BDS_Point *p2,
 
363
                           BDS_Point *q1,BDS_Point *q2) const = 0; 
 
364
  virtual ~BDS_SwapEdgeTest(){}
 
365
};
 
366
 
 
367
class BDS_SwapEdgeTestParametric : public BDS_SwapEdgeTest
 
368
{
 
369
 public:
 
370
  virtual bool operator() (BDS_Point *p1,BDS_Point *p2,
 
371
                           BDS_Point *q1,BDS_Point *q2) const ; 
 
372
  virtual ~BDS_SwapEdgeTestParametric(){}
 
373
};
 
374
 
595
375
class BDS_Mesh 
596
376
{    
 
377
public:
597
378
  int MAXPOINTNUMBER,SNAP_SUCCESS,SNAP_FAILURE;
598
 
  
599
 
public:
600
379
  double Min[3],Max[3],LC;
601
 
  
602
 
  void projection(double &x, double &y, double &z);
603
 
  
604
 
  BDS_Mesh(int _MAXX = 0) :  MAXPOINTNUMBER(_MAXX){}
 
380
  double scalingU, scalingV;
 
381
  BDS_Mesh(int _MAXX = 0) :  MAXPOINTNUMBER(_MAXX),scalingU(1),scalingV(1){}
 
382
  void load(GVertex   *gv); // load in BDS all the meshes of the vertex 
 
383
  void load(GEdge     *ge); // load in BDS all the meshes of the edge 
 
384
  void load(GFace     *gf); // load in BDS all the meshes of the surface 
605
385
  virtual ~BDS_Mesh();
606
386
  BDS_Mesh(const BDS_Mesh &other);
607
387
  std::set<BDS_GeomEntity*,GeomLessThan> geom; 
608
388
  std::set<BDS_Point*,PointLessThan>     points; 
609
389
  std::list<BDS_Edge*>      edges; 
610
 
  std::list<BDS_Triangle*>   triangles; 
611
 
  std::list<BDS_Tet*>        tets; 
 
390
  std::list<BDS_Face*>   triangles; 
 
391
  // Points
612
392
  BDS_Point * add_point(int num , double x, double y,double z);
 
393
  BDS_Point * add_point(int num , double u, double v , GFace *gf);
 
394
  void del_point(BDS_Point *p);
 
395
  BDS_Point *find_point(int num);
 
396
  // Edges
613
397
  BDS_Edge  * add_edge(int p1, int p2);
614
 
  void del_point(BDS_Point *p);
615
398
  void del_edge(BDS_Edge *e);
616
 
  BDS_Triangle *add_triangle(int p1, int p2, int p3); 
617
 
  BDS_Triangle *add_triangle(BDS_Edge *e1,BDS_Edge *e2,BDS_Edge *e3);
618
 
  BDS_Tet *add_tet(int p1, int p2, int p3,int p4);
619
 
  void del_triangle(BDS_Triangle *t);
 
399
  BDS_Edge  *find_edge(int p1, int p2);
 
400
  BDS_Edge  *find_edge(BDS_Point *p1, BDS_Point *p2, BDS_Face *t)const;
 
401
  // Triangles & Quadrangles
 
402
  BDS_Face *add_triangle(int p1, int p2, int p3); 
 
403
  BDS_Face *add_quadrangle(int p1, int p2, int p3,int p4); 
 
404
  BDS_Face *add_triangle(BDS_Edge *e1,BDS_Edge *e2,BDS_Edge *e3);
 
405
  BDS_Face *add_quadrangle(BDS_Edge *e1,BDS_Edge *e2,BDS_Edge *e3,BDS_Edge *e4);
 
406
  void del_face(BDS_Face *t);
 
407
  BDS_Face  *find_triangle(BDS_Edge *e1,BDS_Edge *e2,BDS_Edge *e3);
 
408
  BDS_Face  *find_quadrangle(BDS_Edge *e1,BDS_Edge *e2,BDS_Edge *e3,BDS_Edge *e4);
 
409
  // Geom entities
620
410
  void add_geom(int degree, int tag);
621
 
  BDS_Point *find_point(int num);
622
 
  BDS_Edge  *find_edge(int p1, int p2);
623
 
  BDS_Triangle  *find_triangle(BDS_Edge *e1,BDS_Edge *e2,BDS_Edge *e3);
624
 
  BDS_Edge  *find_edge(BDS_Point *p1, BDS_Point *p2, BDS_Triangle *t)const;
625
411
  BDS_GeomEntity *get_geom(int p1, int p2);
626
 
  bool swap_edge(BDS_Edge *);
627
 
  bool collapse_edge(BDS_Edge *, BDS_Point*, const double eps);
 
412
  // 2D operators
 
413
  BDS_Edge *recover_edge(int p1, int p2);
 
414
  bool swap_edge(BDS_Edge *, const BDS_SwapEdgeTest &theTest);
 
415
  bool collapse_edge_parametric(BDS_Edge *, BDS_Point*);
628
416
  void snap_point(BDS_Point* , BDS_Mesh *geom = 0);
629
417
  bool smooth_point(BDS_Point* , BDS_Mesh *geom = 0);
630
 
  bool smooth_point_b(BDS_Point*); 
 
418
  bool smooth_point_parametric(BDS_Point * p, GFace *gf);
631
419
  bool move_point(BDS_Point *p , double X, double Y, double Z);
632
 
  bool split_edge(BDS_Edge *, double coord, BDS_Mesh *geom = 0);
633
 
  void classify(double angle, int nb = -1); 
634
 
  void color_plane_surf(double eps , int nb);
635
 
  void reverseEngineerCAD() ;
636
 
  void createSearchStructures() ;
637
 
  int adapt_mesh(const BDS_Metric & ,bool smooth = false,BDS_Mesh *geom = 0); 
638
 
  void compute_metric_edge_lengths(const BDS_Metric & metric);
 
420
  void split_edge(BDS_Edge *, BDS_Point *);
 
421
  bool edge_constraint    ( BDS_Point *p1, BDS_Point *p2 );
 
422
  bool recombine_edge    ( BDS_Edge *e );
 
423
  // Global operators
639
424
  void cleanup();
640
 
  bool extractVolumes();
 
425
  void recombineIntoQuads (const double angle, GFace *gf);
641
426
  // io's 
642
 
  // STL
643
 
  bool read_stl(const char *filename, const double tolerance);
644
 
  // INRIA MESH
645
 
  bool read_mesh(const char *filename);
646
 
  bool read_vrml(const char *filename);
647
 
  void save_gmsh_format(const char *filename);
648
427
  bool import_view(Post_View *view, const double tolerance);
649
 
  void applyOptimizationPatterns();
650
428
};
651
429
 
652
 
bool project_point_on_a_list_of_triangles(BDS_Point *p , const std::list<BDS_Triangle*> &t,
653
 
                                          double &X, double &Y, double &Z);        
 
430
void outputScalarField(std::list < BDS_Face * >t, const char *fn, int param);
 
431
void recur_tag(BDS_Face * t, BDS_GeomEntity * g);