Changeset 3242
- Timestamp:
- 03/10/10 09:13:02 (15 years ago)
- Location:
- issm/trunk/src/c/Bamgx
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/BamgObjects.h
r3239 r3242 49 49 inline void Adj(GeometricalEdge * & on,int &i) 50 50 {int j=i;i=on->DirAdj[i];on=on->Adj[j];} 51 inline Real4qualite(const Vertex &va,const Vertex &vb,const Vertex &vc)52 { 53 Real4ret;51 inline double qualite(const Vertex &va,const Vertex &vb,const Vertex &vc) 52 { 53 double ret; 54 54 I2 ia=va,ib=vb,ic=vc; 55 55 I2 ab=ib-ia,bc=ic-ib,ac=ic-ia; … … 204 204 link=NULL;}; 205 205 } 206 inline Real4Triangle::qualite()206 inline double Triangle::qualite() 207 207 { 208 208 return det < 0 ? -1 : bamg::qualite(*TriaVertices[0],*TriaVertices[1],*TriaVertices[2]); … … 338 338 TriangleAdjacent CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ; 339 339 TriangleAdjacent CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b); 340 void swap(Triangle *t1, Int1a1,341 Triangle *t2, Int1a2,340 void swap(Triangle *t1,short a1, 341 Triangle *t2,short a2, 342 342 Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2); 343 343 int SwapForForcingEdge(Vertex * & pva ,Vertex * & pvb , -
issm/trunk/src/c/Bamgx/Bamgx.cpp
r3233 r3242 135 135 for (i=0;i<BTh.nbv;i++){ 136 136 if (!isnan(bamgmesh_in->hVertices[i])){ 137 BTh[i].m=Metric(( Real4)bamgmesh_in->hVertices[i]);137 BTh[i].m=Metric((float)bamgmesh_in->hVertices[i]); 138 138 } 139 139 } -
issm/trunk/src/c/Bamgx/meshtype.h
r3241 r3242 17 17 18 18 //typedefs 19 typedef float Real4;20 19 typedef double Real8; 21 typedef short Int1;22 typedef short Int2;23 20 typedef long Int4; 24 21 typedef int Icoor1; … … 29 26 #endif 30 27 typedef P2<Icoor1,Icoor2> I2; 31 typedef P2xP2< Int2,Int4> I2xI2;28 typedef P2xP2<short,Int4> I2xI2; 32 29 typedef P2<Real8,Real8> R2; 33 typedef P2< Real4,Real8> R2xR2;30 typedef P2<double,Real8> R2xR2; 34 31 35 32 //Some parameters … … 39 36 const int IsVertexOnVertex = 16; 40 37 const int IsVertexOnEdge = 32; 41 static const Int2VerticesOfTriangularEdge[3][2] = {{1,2},{2,0},{0,1}};42 static const Int2EdgesVertexTriangle[3][2] = {{1,2},{2,0},{0,1}};43 static const Int2OppositeVertex[3] = {0,1,2};44 static const Int2OppositeEdge[3] = {0,1,2};45 static const Int2NextEdge[3] = {1,2,0};46 static const Int2PreviousEdge[3] = {2,0,1};47 static const Int2NextVertex[3] = {1,2,0};48 static const Int2PreviousVertex[3] = {2,0,1};38 static const short VerticesOfTriangularEdge[3][2] = {{1,2},{2,0},{0,1}}; 39 static const short EdgesVertexTriangle[3][2] = {{1,2},{2,0},{0,1}}; 40 static const short OppositeVertex[3] = {0,1,2}; 41 static const short OppositeEdge[3] = {0,1,2}; 42 static const short NextEdge[3] = {1,2,0}; 43 static const short PreviousEdge[3] = {2,0,1}; 44 static const short NextVertex[3] = {1,2,0}; 45 static const short PreviousVertex[3] = {2,0,1}; 49 46 #if LONG_BIT > 63 50 47 const Icoor1 MaxICoor = 1073741823; // 2^30-1 =111...111 (29 times) … … 129 126 inline int BinaryRand(){ 130 127 #ifdef RAND_MAX 128 /*RAND_MAX is defined by stdlib.h and is usually 32767*/ 131 129 const long HalfRandMax = RAND_MAX/2; 132 130 return rand() < HalfRandMax; 133 131 #else 134 return rand() & 16384; //2^14 (for sun because RAND_MAX is not def in stdlib.h) 132 /*For sun machines, RAND_MAX is not defined, use 2^24*/ 133 return rand() & 16384; 135 134 #endif 136 135 } -
issm/trunk/src/c/Bamgx/objects/Geometry.cpp
r3233 r3242 282 282 if (bamggeom->Edges){ 283 283 R2 zero2(0,0); 284 Real4* len=NULL;284 double* len=NULL; 285 285 286 286 if(verbose>5) printf(" processing Edges\n"); … … 289 289 //if hvertices==0, initialize len (length of each edge) 290 290 if (!hvertices) { 291 len = new Real4[nbv];291 len = new double[nbv]; 292 292 for(i=0;i<nbv;i++) len[i]=0; 293 293 } … … 325 325 for (i=0;i<nbv;i++) 326 326 if (vertices[i].color > 0) 327 vertices[i].m=Metric(len[i] /( Real4) vertices[i].color);327 vertices[i].m=Metric(len[i] /(double) vertices[i].color); 328 328 else 329 329 vertices[i].m=Metric(Hmin); … … 350 350 if(verbose>5) printf(" processing hVertices\n"); 351 351 for (i=0;i< nbv;i++){ 352 vertices[i].m=Metric(( Real4)bamggeom->hVertices[i]);352 vertices[i].m=Metric((double)bamggeom->hVertices[i]); 353 353 } 354 354 } … … 362 362 hvertices=1; 363 363 for (i=0;i< nbv;i++) { 364 vertices[i].m = Metric(( Real4)bamggeom->MetricVertices[i*3+0],(Real4)bamggeom->MetricVertices[i*3+1],(Real4)bamggeom->MetricVertices[i*3+2]);364 vertices[i].m = Metric((double)bamggeom->MetricVertices[i*3+0],(double)bamggeom->MetricVertices[i*3+1],(double)bamggeom->MetricVertices[i*3+2]); 365 365 } 366 366 } … … 372 372 if(bamggeom->h1h2VpVertices){ 373 373 if(verbose>5) printf(" processing h1h2VpVertices\n"); 374 Real4h1,h2,v1,v2;374 double h1,h2,v1,v2; 375 375 hvertices =1; 376 376 for (i=0;i< nbv;i++) { 377 h1=( Real4)bamggeom->MetricVertices[i*4+0];378 h2=( Real4)bamggeom->MetricVertices[i*4+1];379 v1=( Real4)bamggeom->MetricVertices[i*4+2];380 v2=( Real4)bamggeom->MetricVertices[i*4+3];377 h1=(double)bamggeom->MetricVertices[i*4+0]; 378 h2=(double)bamggeom->MetricVertices[i*4+1]; 379 v1=(double)bamggeom->MetricVertices[i*4+2]; 380 v2=(double)bamggeom->MetricVertices[i*4+3]; 381 381 vertices[i].m = Metric(MatVVP2x2(1/(h1*h1),1/(h2*h2),D2(v1,v2))); 382 382 } -
issm/trunk/src/c/Bamgx/objects/ListofIntersectionTriangles.cpp
r3234 r3242 197 197 deti = dt[i]; 198 198 detj = dt[j]; 199 Real4dij = detj-deti;199 double dij = detj-deti; 200 200 ba[i] = detj/dij; 201 201 ba[j] = -deti/dij; -
issm/trunk/src/c/Bamgx/objects/Metric.h
r3232 r3242 39 39 R2 Orthogonal(const I2 x){return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y);} 40 40 int IntersectWith(const Metric M2); 41 inline void Box( Real4 &hx,Real4&hy) const ;41 inline void Box(double &hx,double &hy) const ; 42 42 //operators 43 43 Metric operator*(Real8 c) const {Real8 c2=c*c;return Metric(a11*c2,a21*c2,a22*c2);} … … 116 116 a22=v00*M.lambda2+v11*M.lambda1; 117 117 } 118 inline void Metric::Box( Real4 &hx,Real4&hy) const {118 inline void Metric::Box(double &hx,double &hy) const { 119 119 Real8 d= a11*a22-a21*a21; 120 120 hx = sqrt(a22/d); -
issm/trunk/src/c/Bamgx/objects/Triangle.cpp
r3234 r3242 92 92 /*}}}*/ 93 93 /*FUNCTION Triangle::Optim{{{1*/ 94 Int4 Triangle::Optim( Int2i,int koption) {94 Int4 Triangle::Optim(short i,int koption) { 95 95 // turn around (positive direction) 96 96 Triangle *t=this; … … 123 123 /*}}}1*/ 124 124 /*FUNCTION Triangle::swap{{{1*/ 125 int Triangle::swap( Int2a,int koption){125 int Triangle::swap(short a,int koption){ 126 126 if(a/4 !=0) return 0;// arete lock or MarkUnSwap 127 127 128 128 register Triangle *t1=this,*t2=TriaAdjTriangles[a];// les 2 triangles adjacent 129 register Int1a1=a,a2=TriaAdjSharedEdge[a];// les 2 numero de l arete dans les 2 triangles129 register short a1=a,a2=TriaAdjSharedEdge[a];// les 2 numero de l arete dans les 2 triangles 130 130 if(a2/4 !=0) return 0; // arete lock or MarkUnSwap 131 131 -
issm/trunk/src/c/Bamgx/objects/Triangle.h
r3232 r3242 23 23 Vertex* TriaVertices[3]; // 3 vertices if t is triangle, t[i] allowed by access function, (*t)[i] if pointer 24 24 Triangle* TriaAdjTriangles[3]; // 3 pointers toward the adjacent triangles 25 Int1TriaAdjSharedEdge[3]; // number of the edges in the adjacent triangles the edge number 1 is the edge number TriaAdjSharedEdge[1] in the Adjacent triangle 125 short TriaAdjSharedEdge[3]; // number of the edges in the adjacent triangles the edge number 1 is the edge number TriaAdjSharedEdge[1] in the Adjacent triangle 1 26 26 27 27 public: … … 45 45 //Methods 46 46 void Echo(); 47 int swap( Int2a1,int=0);48 Int4 Optim( Int2a,int =0);47 int swap(short a1,int=0); 48 Int4 Optim(short a,int =0); 49 49 int Locked(int a)const { return TriaAdjSharedEdge[a]&4;} 50 50 int Hidden(int a)const { return TriaAdjSharedEdge[a]&16;} … … 53 53 void SetAllFlag(int a,int f){TriaAdjSharedEdge[a] = (TriaAdjSharedEdge[a] &3) + (1020 & f);} 54 54 double QualityQuad(int a,int option=1) const; 55 Int1NuEdgeTriangleAdj(int i) const {return TriaAdjSharedEdge[i&3]&3;} // Number of the adjacent edge in adj tria55 short NuEdgeTriangleAdj(int i) const {return TriaAdjSharedEdge[i&3]&3;} // Number of the adjacent edge in adj tria 56 56 TriangleAdjacent FindBoundaryEdge(int i) const; 57 57 TriangleAdjacent Adj(int i) const {return TriangleAdjacent(TriaAdjTriangles[i],TriaAdjSharedEdge[i]&3);}; … … 69 69 if (TriaVertices[2] >=vb && TriaVertices[2] <ve) TriaVertices[2] = vb + renu[TriaVertices[2]-vb]; 70 70 } 71 void SetAdjAdj( Int1a){71 void SetAdjAdj(short a){ 72 72 a &= 3; 73 73 register Triangle *tt=TriaAdjTriangles[a]; 74 74 TriaAdjSharedEdge [a] &= 55; // remove MarkUnSwap 75 register Int1aatt = TriaAdjSharedEdge[a] & 3;75 register short aatt = TriaAdjSharedEdge[a] & 3; 76 76 if(tt){ 77 77 tt->TriaAdjTriangles[aatt]=this; 78 78 tt->TriaAdjSharedEdge[aatt]=a + (TriaAdjSharedEdge[a] & 60 ) ;}// Copy all the mark 79 79 } 80 void SetAdj2( Int1 a,Triangle *t,Int1aat){80 void SetAdj2(short a,Triangle *t,short aat){ 81 81 TriaAdjTriangles[a]=t; //the adjacent triangle to the edge a is t 82 82 TriaAdjSharedEdge[a]=aat; //position of the edge in the adjacent triangle … … 126 126 127 127 //Inline methods 128 inline Real4qualite() ;128 inline double qualite() ; 129 129 inline void Set(const Triangle &,const Triangles &,Triangles &); 130 130 inline int In(Vertex *v) const { return TriaVertices[0]==v || TriaVertices[1]==v || TriaVertices[2]==v ;} -
issm/trunk/src/c/Bamgx/objects/Triangles.cpp
r3241 r3242 369 369 for (i=0;i< nbv;i++){ 370 370 if (!isnan(bamgmesh->hVertices[i])){ 371 vertices[i].m=Metric(( Real4)bamgmesh->hVertices[i]);371 vertices[i].m=Metric((double)bamgmesh->hVertices[i]); 372 372 } 373 373 } … … 399 399 int i1,i2; 400 400 R2 zero2(0,0); 401 Real4*len =0;401 double *len =0; 402 402 403 403 if(verbose>5) printf(" processing Edges\n"); … … 406 406 407 407 if (!hvertices) { 408 len = new Real4[nbv];408 len = new double[nbv]; 409 409 for(i=0;i<nbv;i++) 410 410 len[i]=0; … … 434 434 for (i=0;i<nbv;i++) 435 435 if (vertices[i].color > 0) 436 vertices[i].m= Metric(len[i] /( Real4) vertices[i].color);436 vertices[i].m= Metric(len[i] /(double) vertices[i].color); 437 437 else 438 438 vertices[i].m= Metric(Hmin); … … 1467 1467 1468 1468 //initialize len as 0 1469 Real4 * len = new Real4[Gh.nbv];1469 double * len = new double[Gh.nbv]; 1470 1470 for(i=0;i<Gh.nbv;i++) len[i]=0; 1471 1471 … … 1519 1519 for (i=0;i<Gh.nbv;i++){ 1520 1520 if (Gh.vertices[i].color > 0) 1521 Gh.vertices[i].m= Metric(len[i] /( Real4) Gh.vertices[i].color);1521 Gh.vertices[i].m= Metric(len[i] /(double) Gh.vertices[i].color); 1522 1522 else 1523 1523 Gh.vertices[i].m= Metric(hmin); … … 3715 3715 vi.i=toI2(vi.r); 3716 3716 vi.r=toR2(vi.i); 3717 Real4hx,hy;3717 double hx,hy; 3718 3718 vi.m.Box(hx,hy); 3719 3719 Icoor1 hi=(Icoor1) (hx*coefIcoor),hj=(Icoor1) (hy*coefIcoor); … … 5361 5361 /*Intermediary*/ 5362 5362 /*FUNCTION swap{{{1*/ 5363 void swap(Triangle *t1, Int1 a1, Triangle *t2,Int1a2, Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2){5363 void swap(Triangle *t1,short a1, Triangle *t2,short a2, Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2){ 5364 5364 // -------------------------------------------------------------- 5365 // Int1a2=aa[a];// les 2 numero de l arete dans les 2 triangles5365 // short a2=aa[a];// les 2 numero de l arete dans les 2 triangles 5366 5366 // 5367 5367 // sb sb … … 5631 5631 TriangleAdjacent tt2 = Adj(tt1); 5632 5632 Triangle *t1=tt1,*t2=tt2;// les 2 triangles adjacent 5633 Int1a1=tt1,a2=tt2;// les 2 numero de l arete dans les 2 triangles5633 short a1=tt1,a2=tt2;// les 2 numero de l arete dans les 2 triangles 5634 5634 if ( a1<0 || a1>=3 ){ 5635 5635 throw ErrorException(__FUNCT__,exprintf("a1<0 || a1>=3")); -
issm/trunk/src/c/Bamgx/objects/Vertex.h
r3236 r3242 27 27 Int4 ReferenceNumber; 28 28 Direction DirOfSearch; 29 Int1vint; // the vertex number in triangle; varies between 0 and 2 in t29 short vint; // the vertex number in triangle; varies between 0 and 2 in t 30 30 union { 31 31 Triangle* t; // one triangle which is containing the vertex
Note:
See TracChangeset
for help on using the changeset viewer.