Changeset 3299
- Timestamp:
- 03/18/10 08:54:02 (15 years ago)
- Location:
- issm/trunk/src/c/Bamgx/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/objects/Geometry.cpp
r3279 r3299 141 141 142 142 //RequiredEdges 143 if(verbose>5) printf(" writing RequiredEdges\n");143 if(verbose>5) printf(" writing %i RequiredEdges\n",nbreq); 144 144 bamggeom->NumRequiredEdges=nbreq; 145 145 if (nbreq){ … … 160 160 161 161 //RequiredVertices 162 if(verbose>5) printf(" writing RequiredVertices\n");162 if(verbose>5) printf(" writing %i RequiredVertices\n",nbreqv); 163 163 bamggeom->NumRequiredVertices=nbreqv; 164 164 if (nbreqv){ 165 165 bamggeom->RequiredVertices=(double*)xmalloc(1*nbreqv*sizeof(double)); 166 166 count=0; 167 for (i=0;i<nb e;i++){167 for (i=0;i<nbv;i++){ 168 168 if (vertices[i].Required()){ 169 169 bamggeom->RequiredVertices[count]=i+1; //back to Matlab indexing … … 296 296 for (i=0;i<nbe;i++){ 297 297 298 //printf("%i th edge of geometry: [%i %i]\n",i+1,(int)bamggeom->Edges[i*3+0],(int)bamggeom->Edges[i*3+1]); 298 299 i1=(int)bamggeom->Edges[i*3+0]-1; //-1 for C indexing 299 300 i2=(int)bamggeom->Edges[i*3+1]-1; //-1 for C indexing … … 789 790 GeometricalEdge *e = & ei; 790 791 GeometricalVertex *a=(*e)(k0); // begin 791 if(curves) 792 if(curves){ 792 793 curves[NbOfCurves].be=e; 793 794 curves[NbOfCurves].kb=k0; … … 814 815 } 815 816 } 816 if (nbgem==0 || nbe==0){ 817 throw ErrorException(__FUNCT__,exprintf("nbgem==0 || nbe==0")); 818 } 819 if(step==0) { 817 assert(nbgem && nbe); 818 if(step==0){ 820 819 curves = new Curve[NbOfCurves]; 821 820 } -
issm/trunk/src/c/Bamgx/objects/Geometry.h
r3280 r3299 22 22 namespace bamg { 23 23 24 /*CLASS: Geometry{{{1*/25 24 class Geometry { 26 25 … … 75 74 void WriteGeometry(BamgGeom* bamggeom, BamgOpts* bamgopts); 76 75 }; 77 /*}}}1*/78 76 79 77 } -
issm/trunk/src/c/Bamgx/objects/Triangles.cpp
r3279 r3299 2681 2681 } 2682 2682 2683 //check that edges is empty2683 //check that edges has been allocated 2684 2684 if (edges){ 2685 2685 throw ErrorException(__FUNCT__,exprintf("edges is empty")); 2686 2686 } 2687 2687 2688 // 2 step 2689 // step=0 to compute the number of edges + alloc at end 2690 // step=1 to construct the edges 2688 /* Now we are going to create the first edges corresponding 2689 * to the one present in the geometry provided. 2690 * We proceed in 2 steps 2691 * -step 1: we count all the edges 2692 * we allocate the number of edges at the end of step 1 2693 * -step 2: the edges are created */ 2691 2694 for (int step=0;step<2;step++){ 2692 2695 … … 2696 2699 long NbVerticesOnGeomEdge0=NbVerticesOnGeomEdge; 2697 2700 Gh.UnMarkEdges(); 2698 NbOfCurves =0;2701 NbOfCurves=0; 2699 2702 2700 2703 //go through the edges of the geometry … … 2704 2707 GeometricalEdge &ei=Gh.edges[i]; 2705 2708 2706 // a good curve (not dup)2709 // a good curve (not a duplicate) 2707 2710 if (!ei.Dup()){ 2708 2711 2709 2712 for(int j=0;j<2;j++) { 2710 2713 2711 if (!ei.Mark() && ei[j].Required()) { 2712 // warning ei.Mark() can be change in loop for(j=0;j<2;j++) 2713 long nbvend=0; 2714 /*The first time, no edge is marked but this might change during the loop*/ 2715 if (!ei.Mark() && ei[j].Required()){ 2716 2717 long nbvend=0; 2714 2718 Edge* PreviousNewEdge=NULL; 2715 2719 2716 //do not create points if required2717 2720 lstep = -1; 2721 2722 /*If Edge is required*/ 2718 2723 if(ei.Required()){ 2724 //do not create internal points if required (take it as is) 2719 2725 if (j==0){ 2720 2726 if(step==0) nbe++; … … 2739 2745 } 2740 2746 2741 / /if not required: on curve2747 /*If Edge is not required: on a curve*/ 2742 2748 else { 2743 for ( int kstep=0;kstep<= step;kstep++){ 2744 //step=0, nohing 2745 //step=1, 2746 //step=2 2747 // 1 compute the length of the curve 2748 // 2 create the points and edge 2749 for ( int kstep=0;kstep<=step;kstep++){ 2750 //step=0, do nothing 2751 //step=1, compute the length of the curve 2752 //step=2 create the points and edge 2749 2753 PreviousNewEdge=0; 2750 2754 NbNewPoints=0; … … 2758 2762 // i = edge number, j=[0;1] vertex number in edge 2759 2763 2760 k=j; // k = vertex number in edge 2761 e=&ei; // e = addressof current edge2764 k=j; // k = vertex number in edge (0 or 1) 2765 e=&ei; // e = reference of current edge 2762 2766 a=ei(k)->The(); // a = pointer toward the kth vertex of the current edge 2763 va = a->to; // va = pointer toward vertex of ???2764 e->SetMark(); // Mark e 2767 va = a->to; // va = pointer toward vertex associated 2768 e->SetMark(); // Mark edge 2765 2769 2766 2770 //if SameGeo We have go to the background geometry … … 2768 2772 for(;;){ 2769 2773 k = 1-k; 2770 b = (*e)(k)->The(); 2771 AB 2774 b = (*e)(k)->The();// b = pointer toward the other vertex of the current edge 2775 AB= b->r - a->r; // AB = vector of the current edge 2772 2776 Metric MA = background ? BTh.MetricAt(a->r) :a->m ; //Get metric associated to A 2773 2777 Metric MB = background ? BTh.MetricAt(b->r) :b->m ; //Get metric associated to B … … 2811 2815 2812 2816 //Now, create corresponding points 2813 //s = lstep2814 2817 while (lcurve<=s && s <= lcurveb && nbv < nbvend){ 2815 2818 … … 2846 2849 edges[nbe].v[0]=va; 2847 2850 edges[nbe].v[1]=vb; 2848 edges[nbe].ref = 2851 edges[nbe].ref =e->ref; 2849 2852 edges[nbe].onGeometry = e; 2850 2853 edges[nbe].adj[0] = PreviousNewEdge; … … 2887 2890 else nbe += NbEdgeCurve; 2888 2891 } // end on curve --- 2889 } // if (edges[i][j].Corner())2892 } 2890 2893 } 2891 2894 } … … 3023 3026 Edge &ei = BTh.edges[iedge]; 3024 3027 for(int je=0;je<2;je++){ // for the 2 extremities 3025 if (!ei.onGeometry->Mark() && ei[je].onGeometry->IsRequiredVertex() ){ 3026 // a begin of curve 3028 3029 // If one of the vertex is required we are in a new curve 3030 if (ei[je].onGeometry->IsRequiredVertex()){ 3031 3032 //Get curve number 3027 3033 int nc=ei.onGeometry->CurveNumber; 3028 if(ei.onGeometry==Gh.curves[nc].be && 3029 (GeometricalVertex *) *ei[je].onGeometry == &(*Gh.curves[nc].be)[Gh.curves[nc].kb] // same extremity 3034 3035 //BUG FIX from original bamg 3036 if( 3037 (ei.onGeometry==Gh.curves[nc].be || ei.onGeometry==Gh.curves[nc].ee) && //Check that we are on the right edge 3038 (GeometricalVertex *) *ei[je].onGeometry == &(*Gh.curves[nc].be)[Gh.curves[nc].kb] //Check that we are on the right extremity 3030 3039 ){ 3040 if( (GeometricalVertex *) *ei[je].onGeometry == &(*Gh.curves[nc].be)[Gh.curves[nc].kb]){ 3031 3041 bcurve[nc]=iedge*2+je; 3032 3042 bfind++; … … 3035 3045 } 3036 3046 } 3037 assert(bfind==Gh.NbOfCurves); 3047 if (bfind!=Gh.NbOfCurves){ 3048 throw ErrorException(__FUNCT__,exprintf("problem generating number of curves (Gh.NbOfCurves=%i bfind=%i)",Gh.NbOfCurves,bfind)); 3049 } 3038 3050 3039 3051 // method in 2 + 1 step -
issm/trunk/src/c/Bamgx/objects/Vertex.h
r3280 r3299 30 30 short vint; // the vertex number in triangle; varies between 0 and 2 in t 31 31 union { 32 Triangle* t; // one triangle which is containing the vertex32 Triangle* t; // one triangle which is containing the vertex 33 33 long color; 34 Vertex* to; // use in geometry Vertex to now the Mesh Vertex associed34 Vertex* to; // used in geometry Vertex to know the Mesh Vertex associated 35 35 VertexOnGeom* onGeometry; // if vint == 8; // set with Triangles::SetVertexFieldOn() 36 36 Vertex* onBackgroundVertex;// if vint == 16 on Background vertex Triangles::SetVertexFieldOnBTh()
Note:
See TracChangeset
for help on using the changeset viewer.