source: issm/trunk/src/c/bamg/Triangle.h@ 15396

Last change on this file since 15396 was 15066, checked in by Eric.Larour, 12 years ago

CHG: cutting links between bamg and classes even more.

File size: 2.5 KB
Line 
1#ifndef _TRIANGLE_H_
2#define _TRIANGLE_H_
3
4#include "./include.h"
5#include "AdjacentTriangle.h"
6
7namespace bamg {
8
9 class Mesh;
10 class BamgVertex;
11 class Triangle;
12
13 class Triangle {
14
15 friend class AdjacentTriangle;
16
17 private:
18 BamgVertex *vertices[3]; // 3 vertices if t is triangle, t[i] allowed by access function, (*t)[i] if pointer
19 Triangle *adj[3]; // 3 pointers toward the adjacent triangles
20 short AdjEdgeIndex[3]; // edge id in the adjacent triangles. The edge number 1 is the edge number AdjEdgeIndex[1] in the Adjacent triangle 1
21
22 public:
23 Icoor2 det; //Integer determinant (twice its area)
24 union {
25 Triangle *link;
26 long color;
27 };
28
29 //Constructors/Destructors
30 Triangle();
31 Triangle(Mesh *Th,long i,long j,long k);
32 Triangle(BamgVertex *v0,BamgVertex *v1,BamgVertex *v2);
33
34 //Operators
35 const BamgVertex & operator[](int i) const {return *vertices[i];};
36 BamgVertex & operator[](int i) {return *vertices[i];};
37 const BamgVertex * operator()(int i) const {return vertices[i];};
38 BamgVertex * & operator()(int i) {return vertices[i];};
39
40 //Methods
41 void Echo();
42 double Anisotropy() const;
43 double Length() const;
44 int swap(short a1,int=0);
45 long Optim(short a,int =0);
46 int Locked(int a)const;
47 int Hidden(int a)const;
48 int GetAllflag(int a);
49 void SetAllFlag(int a,int f);
50 double QualityQuad(int a,int option=1) const;
51 short NuEdgeTriangleAdj(int i) const;
52 AdjacentTriangle FindBoundaryEdge(int i) const;
53 AdjacentTriangle Adj(int i) const;
54 Triangle *TriangleAdj(int i) const;
55 Triangle *Quadrangle(BamgVertex *& v0,BamgVertex *& v1,BamgVertex *& v2,BamgVertex *& v3) const;
56 void Renumbering(Triangle *tb,Triangle *te, long *renu);
57 void Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu);
58 void SetAdjAdj(short a);
59 void SetAdj2(short a,Triangle *t,short aat);
60 void SetSingleVertexToTriangleConnectivity();
61 void SetHidden(int a);
62 void SetLocked(int a);
63 void SetMarkUnSwap(int a);
64 void SetUnMarkUnSwap(int a);
65 void SetDet();
66
67 //Inline methods
68 double qualite() ;
69 void Set(const Triangle &,const Mesh &,Mesh &);
70 int In(BamgVertex *v) const { return vertices[0]==v || vertices[1]==v || vertices[2]==v ;}
71
72 };
73
74}
75#endif
Note: See TracBrowser for help on using the repository browser.