Changeset 5177 for issm/trunk/src/c/objects/Bamg/Geometry.cpp
- Timestamp:
- 08/12/10 09:43:45 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Bamg/Geometry.cpp
r5154 r5177 111 111 * where D is the longest side of the domain (direction x or y) 112 112 * so that (x-pmin.x)/D is in ]0 1[ 113 * 114 * coefIcoor = (2^30 -1)/D 113 115 */ 114 116 coefIcoor=(MaxICoor)/(Max(pmax.x-pmin.x,pmax.y-pmin.y)); … … 398 400 399 401 /*Methods*/ 400 /*FUNCTION Geometry::AfterRead (){{{1*/402 /*FUNCTION Geometry::AfterRead{{{1*/ 401 403 void Geometry::AfterRead(){ 402 404 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/AfterRead)*/ 403 405 404 long int verbose=0; 405 406 long i,j,k; 407 int jj; 408 long* head_v=new long[nbv]; 409 long* next_p=new long[2*nbe]; 410 float* eangle=new float[nbe]; 411 double eps=1e-20; 412 QuadTree quadtree; // build quadtree to find duplicates 413 BamgVertex* v0=vertices; 414 GeometricalVertex* v0g=(GeometricalVertex*) (void*)v0; 406 long i,j,k; 407 int jj; 408 long *head_v = new long[nbv]; 409 long *next_p = new long[2*nbe]; 410 float *eangle = new float[nbe]; 411 double eps = 1e-20; 412 QuadTree quadtree; // build quadtree to find duplicates 413 BamgVertex *v0 = vertices; 414 GeometricalVertex *v0g = (GeometricalVertex*) (void*)v0; 415 415 416 416 k=0; … … 424 424 All the coordinates are transformed to ]0,1[^2 425 425 then, the integer coordinates are computed using 426 the transformation ]0,1[^2 -> [0 2^ (30-1)[^2 for a quadtree of depth 30*/426 the transformation ]0,1[^2 -> [0 2^30-1[^2 for a quadtree of depth 30*/ 427 427 vertices[i].i=toI2(vertices[i].r); 428 428 429 / /find nearest vertex already present in the quadtree (NULL if empty)429 /*find nearest vertex already present in the quadtree (NULL if empty)*/ 430 430 BamgVertex* v=quadtree.NearestVertex(vertices[i].i.x,vertices[i].i.y); 431 431 432 / /if there is a vertex found that is to close to vertices[i] -> error433 if( v && Norme1(v->r - vertices[i] ) < eps ){434 printf("WARNING: two points of the geometry are very closed to each other\n");435 } 436 437 / /Add vertices[i] to the quadtree432 /*if there is a vertex found that is to close to vertices[i] -> error*/ 433 if( v && Norme1(v->r - vertices[i].r) < eps ){ 434 ISSMERROR("two points of the geometry are very closed to each other"); 435 } 436 437 /*Add vertices[i] to the quadtree*/ 438 438 quadtree.Add(vertices[i]); 439 }440 441 //if k>0, there are some duplicate vertices -> error442 if (k) {443 printf("number of distinct vertices= %i, over %i\n",nbv - k,nbv);444 printf("List of duplicate vertices:\n");445 ISSMERROR("See above");446 439 } 447 440 … … 767 760 nbv=0; 768 761 nbe=0; 769 quadtree= 0;770 curves= 0;771 edges= 0;772 vertices= 0;762 quadtree=NULL; 763 curves=NULL; 764 edges=NULL; 765 vertices=NULL; 773 766 nbsubdomains=0; 774 767 nbcurves=0; 775 subdomains= 0;768 subdomains=NULL; 776 769 MaxCornerAngle = 10*Pi/180; //default is 10 degres 777 770 } … … 941 934 /*FUNCTION Geometry::toI2{{{1*/ 942 935 I2 Geometry::toI2(const R2 & P) const { 943 return I2( (Icoor1) (coefIcoor*(P.x-pmin.x)) 944 ,(Icoor1) (coefIcoor*(P.y-pmin.y)) ); 936 /*coefIcoor is the coefficient used for integer coordinates: 937 * (x-pmin.x) 938 * Icoor x = (2^30 -1) ------------ 939 * D 940 * where D is the longest side of the domain (direction x or y) 941 * so that (x-pmin.x)/D is in ]0 1[ 942 * 943 * coefIcoor = (2^30 -1)/D 944 */ 945 return I2( (Icoor1) (coefIcoor*(P.x-pmin.x)) ,(Icoor1) (coefIcoor*(P.y-pmin.y)) ); 945 946 }/*}}}*/ 946 947 /*FUNCTION Geometry::UnMarkEdges{{{1*/
Note:
See TracChangeset
for help on using the changeset viewer.