Changeset 5146
- Timestamp:
- 08/11/10 09:23:47 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Makefile.am
r5120 r5146 63 63 ./objects/Bamg/SubDomain.h\ 64 64 ./objects/Bamg/SubDomain.cpp\ 65 ./objects/Bamg/ TriangleAdjacent.h\66 ./objects/Bamg/ TriangleAdjacent.cpp\65 ./objects/Bamg/AdjacentTriangle.h\ 66 ./objects/Bamg/AdjacentTriangle.cpp\ 67 67 ./objects/Bamg/Triangle.cpp\ 68 68 ./objects/Bamg/Triangle.h\ … … 599 599 ./objects/Bamg/SubDomain.h\ 600 600 ./objects/Bamg/SubDomain.cpp\ 601 ./objects/Bamg/ TriangleAdjacent.h\602 ./objects/Bamg/ TriangleAdjacent.cpp\601 ./objects/Bamg/AdjacentTriangle.h\ 602 ./objects/Bamg/AdjacentTriangle.cpp\ 603 603 ./objects/Bamg/Triangle.cpp\ 604 604 ./objects/Bamg/Triangle.h\ -
issm/trunk/src/c/modules/Bamgx/Bamgx.cpp
r5124 r5146 184 184 //display info 185 185 if(verbosity>0) { 186 if (Th.nbt-Th. NbOutT-Th.NbOfQuad*2){187 printf(" new number of triangles = %i\n",(Th.nbt-Th. NbOutT-Th.NbOfQuad*2));186 if (Th.nbt-Th.nbtout-Th.NbOfQuad*2){ 187 printf(" new number of triangles = %i\n",(Th.nbt-Th.nbtout-Th.NbOfQuad*2)); 188 188 } 189 189 if (Th.NbOfQuad ){ -
issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
r5124 r5146 103 103 else { 104 104 //Get closest adjacent triangle (inside the mesh) 105 TriangleAdjacentta=CloseBoundaryEdge(I,&tb,aa,bb).Adj();105 AdjacentTriangle ta=CloseBoundaryEdge(I,&tb,aa,bb).Adj(); 106 106 int k=ta; 107 107 Triangle &tc=*(Triangle*)ta; -
issm/trunk/src/c/objects/Bamg/GeometricalEdge.h
r5143 r5146 19 19 GeometricalEdge *Adj[2]; 20 20 int DirAdj[2]; 21 int flag;21 int type; 22 22 23 23 //Operators … … 30 30 double R1tg(double theta,R2 &t) const ; // 1/radius of curvature + tangente 31 31 int Tg(int i) const{return i==0 ? TgA() : TgB();} 32 int Cracked() const{return flag& 1;}33 int TgA()const{return flag& 4; }34 int TgB()const {return flag& 8;}35 int Mark()const {return flag& 16;}36 int Required() {return flag& 64;}37 void SetCracked() { flag|= 1;}38 void SetTgA() { flag|=4; }39 void SetTgB() { flag|=8; }40 void SetMark() { flag|=16;}41 void SetUnMark() { flag&= 1007 /* 1023-16*/;}42 void SetRequired() { flag|= 64; }32 int Cracked() const{return type & 1;} 33 int TgA()const{return type & 4; } 34 int TgB()const {return type & 8;} 35 int Mark()const {return type & 16;} 36 int Required() {return type & 64;} 37 void SetCracked() { type |= 1;} 38 void SetTgA() { type |=4; } 39 void SetTgB() { type |=8; } 40 void SetMark() { type |=16;} 41 void SetUnMark() { type &= 1007 /* 1023-16*/;} 42 void SetRequired() { type |= 64; } 43 43 void Set(const GeometricalEdge & rec,const Geometry & Th ,Geometry & ThNew); 44 44 }; -
issm/trunk/src/c/objects/Bamg/Geometry.cpp
r5143 r5146 152 152 edges[i].DirAdj[0] = edges[i].DirAdj[1] = -1; 153 153 edges[i].Adj[0] = edges[i].Adj[1] = NULL; 154 edges[i]. flag= 0;154 edges[i].type = 0; 155 155 156 156 //Cracked? … … 586 586 } 587 587 // if the ref a changing then is SetRequired(); 588 if (edges[i1]. flag != edges[i2].flag|| edges[i1].Required()){588 if (edges[i1].type != edges[i2].type || edges[i1].Required()){ 589 589 vertices[i].SetRequired(); 590 590 } -
issm/trunk/src/c/objects/Bamg/Mesh.cpp
r5143 r5146 165 165 Init(maxnbv_in);// to make the allocation 166 166 // copy of triangles 167 nt=Th.nt;168 167 nbv = Th.nbv; 169 168 nbt = Th.nbt; 170 169 nbe = Th.nbe; 171 170 NbSubDomains = Th.NbSubDomains; 172 NbOutT = Th.NbOutT;171 nbtout = Th.nbtout; 173 172 NbOfQuad = Th.NbOfQuad ; 174 173 NbOfSwapTriangle =0; … … 284 283 vertices[i].color=0; 285 284 } 286 nbtx=2*maxnbv-2; // for filling The Holes and quadrilaterals285 maxnbt=2*maxnbv-2; // for filling The Holes and quadrilaterals 287 286 288 287 //Triangles 289 288 if (verbose) printf("Reading triangles (%i)\n",nbt); 290 triangles =new Triangle[ nbtx]; //we cannot allocate only nbt triangles since289 triangles =new Triangle[maxnbt]; //we cannot allocate only nbt triangles since 291 290 //other triangles will be added for each edge 292 291 for (i=0;i<nbt;i++){ … … 336 335 vertices[i].color=0; 337 336 } 338 nbtx=2*maxnbv-2; // for filling The Holes and quadrilaterals337 maxnbt=2*maxnbv-2; // for filling The Holes and quadrilaterals 339 338 } 340 339 else{ … … 345 344 if(bamgmesh->Triangles){ 346 345 if(verbose>5) printf(" processing Triangles\n"); 347 triangles =new Triangle[ nbtx]; //we cannot allocate only nbt triangles since346 triangles =new Triangle[maxnbt]; //we cannot allocate only nbt triangles since 348 347 //other triangles will be added for each edge 349 348 for (i=0;i<nbt;i++){ … … 825 824 /*Element Connectivity*/ 826 825 if(verbose>5) printf(" writing Element connectivity\n"); 827 bamgmesh->ElementConnectivitySize[0]=nbt- NbOutT;826 bamgmesh->ElementConnectivitySize[0]=nbt-nbtout; 828 827 bamgmesh->ElementConnectivitySize[1]=3; 829 bamgmesh->ElementConnectivity=(double*)xmalloc(3*(nbt- NbOutT)*sizeof(double));830 for (i=0;i<3*(nbt- NbOutT);i++) bamgmesh->ElementConnectivity[i]=NAN;828 bamgmesh->ElementConnectivity=(double*)xmalloc(3*(nbt-nbtout)*sizeof(double)); 829 for (i=0;i<3*(nbt-nbtout);i++) bamgmesh->ElementConnectivity[i]=NAN; 831 830 num=0; 832 831 for (i=0;i<nbt;i++){ … … 835 834 k=Number(triangles[i].TriangleAdj(j)); 836 835 if (reft[k]>=0){ 837 ISSMASSERT(3*num+j<3*(nbt- NbOutT));836 ISSMASSERT(3*num+j<3*(nbt-nbtout)); 838 837 bamgmesh->ElementConnectivity[3*num+j]=k+1; // back to Matlab indexing 839 838 } … … 1167 1166 tt[2]= &triangles[nbt++]; 1168 1167 1169 if (nbt> nbtx) {1168 if (nbt>maxnbt) { 1170 1169 ISSMERROR("Not ebough triangles"); 1171 1170 } … … 1628 1627 Gh.edges[i].v[1] = Gh.vertices + j1; 1629 1628 1630 Gh.edges[i]. flag= 0;1629 Gh.edges[i].type = 0; 1631 1630 1632 1631 Gh.edges[i].tg[0]=R2(); … … 2433 2432 // supression de tous les sous domaine infini <=> contient le sommet NULL 2434 2433 it =0; 2435 NbOutT= 0;2434 nbtout = 0; 2436 2435 while (it<nbt) { 2437 2436 if (triangles[it].link) … … 2442 2441 NbSubDomTot --; 2443 2442 t=&triangles[it]; 2444 NbOutT--; // on fait un coup de trop.2443 nbtout--; // on fait un coup de trop. 2445 2444 while (t){ 2446 NbOutT++;2445 nbtout++; 2447 2446 t1=t; 2448 2447 t=t->link; … … 2452 2451 } 2453 2452 it++;} // end while (it<nbt) 2454 if (nbt == NbOutT|| !NbSubDomTot) {2453 if (nbt == nbtout || !NbSubDomTot) { 2455 2454 ISSMERROR("The boundary is not close: all triangles are outside"); 2456 2455 } … … 2525 2524 t= subdomains[i].head; 2526 2525 while (t){ 2527 NbOutT++;2526 nbtout++; 2528 2527 t1=t; 2529 2528 t=t->link; … … 2622 2621 for (it=0;it<nbt;it++) 2623 2622 if ( mark[it] ==-1 ) 2624 NbOutT++,triangles[it].link =0;2623 nbtout++,triangles[it].link =0; 2625 2624 delete [] GeometricalEdgetoEdge; 2626 2625 delete [] mark; 2627 2626 2628 2627 } 2629 NbOutT=0;2628 nbtout=0; 2630 2629 for (it=0;it<nbt;it++) 2631 if(!triangles[it].link) NbOutT++;2630 if(!triangles[it].link) nbtout++; 2632 2631 } 2633 2632 /*}}}1*/ … … 2646 2645 nbt=0; 2647 2646 NbOfQuad = 0; 2648 nbtx=2*maxnbv_in-2;2647 maxnbt=2*maxnbv_in-2; 2649 2648 NbSubDomains=0; 2650 2649 NbVertexOnBThVertex=0; … … 2664 2663 ordre=new (BamgVertex* [maxnbv]); 2665 2664 ISSMASSERT(ordre); 2666 triangles=new Triangle[ nbtx];2665 triangles=new Triangle[maxnbt]; 2667 2666 ISSMASSERT(triangles); 2668 2667 } … … 2671 2670 ordre=NULL; 2672 2671 triangles=NULL; 2673 nbtx=0;2672 maxnbt=0; 2674 2673 } 2675 2674 … … 2993 2992 if (verbose>2){ 2994 2993 printf(" number of quadrilaterals = %i\n",NbOfQuad); 2995 printf(" number of triangles = %i\n",nbt- NbOutT- NbOfQuad*2);2996 printf(" number of outside triangles = %i\n", NbOutT);2994 printf(" number of triangles = %i\n",nbt-nbtout- NbOfQuad*2); 2995 printf(" number of outside triangles = %i\n",nbtout); 2997 2996 } 2998 2997 delete [] qq; … … 3099 3098 long Headt=0; 3100 3099 long next_t; 3101 long* first_np_or_next_t=new long[ nbtx];3100 long* first_np_or_next_t=new long[maxnbt]; 3102 3101 Triangle* t=NULL; 3103 3102 … … 3458 3457 Triangle* savetriangles=triangles; 3459 3458 long savenbt=nbt; 3460 long save nbtx=nbtx;3459 long savemaxnbt=maxnbt; 3461 3460 SubDomain* savesubdomains=subdomains; 3462 3461 subdomains=0; … … 3467 3466 3468 3467 nbt=2; 3469 nbtx= Nbtriafillhole;3468 maxnbt= Nbtriafillhole; 3470 3469 3471 3470 //Find a vertex that is not aligned with vertices 0 and 1 … … 3571 3570 } 3572 3571 } 3573 ISSMASSERT(savenbt+NbTfillHoll<=save nbtx);3572 ISSMASSERT(savenbt+NbTfillHoll<=savemaxnbt); 3574 3573 3575 3574 // copy of the outside triangles in saveMesh … … 3601 3600 // restore triangles; 3602 3601 nbt=savenbt; 3603 nbtx=savenbtx;3602 maxnbt=savemaxnbt; 3604 3603 delete [] triangles; 3605 3604 delete [] subdomains; … … 3711 3710 } 3712 3711 delete [] renu; 3713 nt = nbt - NbOutT;3714 3712 3715 3713 } … … 3870 3868 int nt=0; 3871 3869 for (int it=0;it<nbt;it++) 3872 if ( triangles[it].link) 3873 { 3874 nt++; 3870 if ( triangles[it].link){ 3875 3871 Triangle &K=triangles[it]; 3876 3872 double area3= Area2((R2) K[0],(R2) K[1],(R2) K[2])/6.; … … 4113 4109 long nbvold = nbv; 4114 4110 long nbtold = nbt; 4115 long NbOutTold = NbOutT;4111 long nbtoutold = nbtout; 4116 4112 long NbEdgeOnGeom=0; 4117 4113 long i; 4118 4114 4119 nbt = nbt - NbOutT; // remove all the the ouside triangles4115 nbt = nbt - nbtout; // remove all the the ouside triangles 4120 4116 long nbtsave = nbt; 4121 4117 Triangle * lastT = triangles + nbt; … … 4535 4531 4536 4532 ret = 2; 4537 if (nbt>= nbtx) goto Error; // bug4533 if (nbt>= maxnbt) goto Error; // bug 4538 4534 if (nbv>= maxnbv) goto Error; // bug 4539 4535 // generation of the new triangles … … 4571 4567 if (verbose>2){ 4572 4568 printf(" number of quadrilaterals = %i\n",NbOfQuad); 4573 printf(" number of triangles = %i\n",nbt- NbOutT- NbOfQuad*2);4574 printf(" number of outside triangles = %i\n", NbOutT);4569 printf(" number of triangles = %i\n",nbt-nbtout- NbOfQuad*2); 4570 printf(" number of outside triangles = %i\n",nbtout); 4575 4571 } 4576 4572 … … 4580 4576 nbv = nbvold; 4581 4577 nbt = nbtold; 4582 NbOutT = NbOutTold;4578 nbtout = nbtoutold; 4583 4579 // cleaning memory --- 4584 4580 delete newedges; -
issm/trunk/src/c/objects/Bamg/Mesh.h
r5143 r5146 34 34 SubDomain *subdomains; 35 35 long NbRef; // counter of ref on the this class if 0 we can delete 36 long maxnbv, nbtx; // nombre max de sommets , de triangles37 long n t,nbv,nbt,nbe; // nb of legal triangles, nb of vertex, of triangles, of edges with reference,36 long maxnbv,maxnbt; // nombre max de sommets , de triangles 37 long nbv,nbt,nbe; // nb of vertices, of triangles, of edges 38 38 long NbOfQuad; // nb of quadrangle 39 39 long NbSubDomains; 40 long NbOutT; // Nb of oudeside triangle40 long nbtout; // Nb of oudeside triangle 41 41 long NbOfTriangleSearchFind; 42 42 long NbOfSwapTriangle;
Note:
See TracChangeset
for help on using the changeset viewer.