Changeset 4997
- Timestamp:
- 08/05/10 11:33:17 (15 years ago)
- Location:
- issm/trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Bamg/Curve.h
r3913 r4997 13 13 class Curve { 14 14 public: 15 GeometricalEdge * 15 GeometricalEdge *be,*ee; // begin et end edge 16 16 int kb,ke; // begin vetex and end vertex 17 17 Curve* next; // next curve equi to this -
issm/trunk/src/c/objects/Bamg/Geometry.cpp
r3913 r4997 726 726 curves[NbOfCurves].ke=k1; 727 727 } 728 728 729 GeometricalVertex *b=(*e)(k1); 729 730 if (a == b || b->Required() ) break; … … 748 749 749 750 /*clean up*/ 750 delete [] next_p;751 delete [] head_v;752 delete [] eangle;751 delete [] next_p; 752 delete [] head_v; 753 delete [] eangle; 753 754 754 755 } … … 941 942 lge[tge]=ll+=Norme2(AA-V1); 942 943 // search the geometrical edge 943 if (s>1.0){ 944 ISSMERROR("s>1.0"); 945 } 944 ISSMASSERT(s<=1.0); 946 945 double ls= s*ll; 947 946 on =0; … … 951 950 i=bge; 952 951 while ( (l1=lge[i]) < ls ) { 953 if (i<0 || i>mxe){ 954 ISSMERROR("i<0 || i>mxe"); 955 } 952 ISSMASSERT(i>=0 && i<=mxe); 956 953 i++,s0=1-(s1=sensge[i]),l0=l1; 957 954 } -
issm/trunk/src/c/objects/Bamg/Triangles.cpp
r3913 r4997 2737 2737 GeometricalVertex *a,*b; 2738 2738 MeshVertex *va,*vb; 2739 GeometricalEdge * 2739 GeometricalEdge *e; 2740 2740 2741 2741 /*Get options*/ … … 2838 2838 2839 2839 //check that edges has been allocated 2840 if (!edges){ 2841 ISSMERROR("edges has not been allocated..."); 2842 } 2840 if (!edges) ISSMERROR("edges has not been allocated..."); 2843 2841 edges[nbe].v[0]=a->to; 2844 2842 edges[nbe].v[1]=b->to;; … … 2854 2852 /*If Edge is not required: on a curve*/ 2855 2853 else { 2856 for ( 2854 for (int kstep=0;kstep<=step;kstep++){ 2857 2855 //step=0, do nothing 2858 2856 //step=1, compute the length of the curve … … 3044 3042 3045 3043 /************************************************************************* 3046 // methode in 2 step 3047 // 1 - compute the number of new edge to allocate 3048 // 2 - construct the edge 3049 remark: 3050 in this part we suppose to have a background mesh with the same 3051 geometry 3052 3053 To construct the discretisation of the new mesh we have to 3054 rediscretize the boundary of background Mesh 3055 because we have only the pointeur from the background mesh to the geometry. 3056 We need the abcisse of the background mesh vertices on geometry 3057 so a vertex is 3058 0 on GeometricalVertex ; 3059 1 on GeometricalEdge + abcisse 3060 2 internal 3044 * method in 2 steps 3045 * 1 - compute the number of new edges to allocate 3046 * 2 - construct the edges 3047 * remark: 3048 * in this part we suppose to have a background mesh with the same geometry 3049 * 3050 * To construct the discretization of the new mesh we have to 3051 * rediscretize the boundary of background Mesh 3052 * because we have only the pointeur from the background mesh to the geometry. 3053 * We need the abcisse of the background mesh vertices on geometry 3054 * so a vertex is 3055 * 0 on GeometricalVertex ; 3056 * 1 on GeometricalEdge + abcisse 3057 * 2 internal 3061 3058 *************************************************************************/ 3062 3059 … … 3066 3063 3067 3064 //Initialize new mesh 3068 PreInit(inbvx);3065 this->PreInit(inbvx); 3069 3066 BTh.SetVertexFieldOn(); 3070 3067 int* bcurve = new int[Gh.NbOfCurves]; // 3071 3068 3072 // we have 2 ways to make the loop 3073 // 1) on the geometry 3074 // 2) on the background mesh 3075 // if you do the loop on geometry, we don't have the pointeur on background, 3076 // and if you do the loop in background we have the pointeur on geometry 3077 // so do the walk on background 3078 // long NbVerticesOnGeomVertex; 3079 // VertexOnGeom * VerticesOnGeomVertex; 3080 // long NbVerticesOnGeomEdge; 3081 // VertexOnGeom * VerticesOnGeomEdge; 3069 /* There are 2 ways to make the loop 3070 * 1) on the geometry 3071 * 2) on the background mesh 3072 * if you do the loop on geometry, we don't have the pointeur on background, 3073 * and if you do the loop in background we have the pointeur on geometry 3074 * so do the walk on background */ 3082 3075 3083 3076 NbVerticesOnGeomVertex=0; … … 3088 3081 int i; 3089 3082 for (i=0;i<Gh.nbv;i++) if (Gh[i].Required()) NbVerticesOnGeomVertex++; 3090 if( 3083 if(NbVerticesOnGeomVertex >= nbvx) { ISSMERROR("too many vertices on geometry: %i >= %i",NbVerticesOnGeomVertex,nbvx);} 3091 3084 3092 3085 VerticesOnGeomVertex = new VertexOnGeom[ NbVerticesOnGeomVertex]; 3093 3086 VertexOnBThVertex = new VertexOnVertex[NbVerticesOnGeomVertex]; 3094 3087 3095 //At this point there is NO vertex but vertices should behave been allocated by PreInit3088 //At this point there is NO vertex but vertices should have been allocated by PreInit 3096 3089 ISSMASSERT(vertices); 3097 3090 for (i=0;i<Gh.nbv;i++){ … … 3117 3110 ISSMASSERT(NbVertexOnBThVertex==NbVerticesOnGeomVertex); 3118 3111 3119 /*STEP 2: reseed bounda y edges*/3112 /*STEP 2: reseed boundary edges*/ 3120 3113 3121 3114 // find the begining of the curve in BTh … … 3123 3116 int bfind=0; 3124 3117 for (int i=0;i<Gh.NbOfCurves;i++) bcurve[i]=-1; 3118 3119 /*Loop over the backgrounf mesh BTh edges*/ 3125 3120 for (int iedge=0;iedge<BTh.nbe;iedge++){ 3126 3121 Edge &ei = BTh.edges[iedge]; 3127 for(int je=0;je<2;je++){ // for the 2 extremities 3128 3129 // If one of the vertex is required we are in a new curve 3122 3123 /*Loop over the 2 vertices of the current edge*/ 3124 for(int je=0;je<2;je++){ 3125 3126 /* If one of the vertex is required we are in a new curve*/ 3130 3127 if (ei[je].onGeometry->IsRequiredVertex()){ 3131 3128 3132 / /Get curve number3129 /*Get curve number*/ 3133 3130 int nc=ei.onGeometry->CurveNumber; 3134 3131 3132 //printf("Dealing with curve number %i\n",nc); 3133 //printf("edge on geometry is same as GhCurve? %s\n",(ei.onGeometry==Gh.curves[nc].be || ei.onGeometry==Gh.curves[nc].ee)?"yes":"no"); 3134 //if(ei.onGeometry==Gh.curves[nc].be || ei.onGeometry==Gh.curves[nc].ee){ 3135 // printf("Do we have the right extremity? curve first vertex -> %s\n",((GeometricalVertex *)*ei[je].onGeometry==&(*Gh.curves[nc].be)[Gh.curves[nc].kb])?"yes":"no"); 3136 // printf("Do we have the right extremity? curve last vertex -> %s\n",((GeometricalVertex *)*ei[je].onGeometry==&(*Gh.curves[nc].ee)[Gh.curves[nc].ke])?"yes":"no"); 3137 //} 3135 3138 //BUG FIX from original bamg 3136 / /Check that we are on the same edge and right extrimity3139 /*Check that we are on the same edge and right vertex (0 or 1) */ 3137 3140 if(ei.onGeometry==Gh.curves[nc].be && (GeometricalVertex *)*ei[je].onGeometry==&(*Gh.curves[nc].be)[Gh.curves[nc].kb]){ 3138 3141 bcurve[nc]=iedge*2+je; … … 3146 3149 } 3147 3150 } 3148 if (bfind!=Gh.NbOfCurves){ 3149 ISSMERROR("problem generating number of curves (Gh.NbOfCurves=%i bfind=%i)",Gh.NbOfCurves,bfind); 3150 } 3151 if (bfind!=Gh.NbOfCurves) ISSMERROR("problem generating number of curves (Gh.NbOfCurves=%i bfind=%i)",Gh.NbOfCurves,bfind); 3151 3152 3152 3153 // method in 2 + 1 step … … 3154 3155 // 1.0) recompute the length 3155 3156 // 1.1) compute the vertex 3157 3156 3158 long nbex=0,NbVerticesOnGeomEdgex=0; 3157 3159 for (int step=0; step <2;step++){ … … 3163 3165 double L=0; 3164 3166 3167 /*Go through all geometrical curve*/ 3165 3168 for (int icurve=0;icurve<Gh.NbOfCurves;icurve++){ 3166 3169 3170 /*Get edge and vertex (index) of background mesh on this curve*/ 3167 3171 iedge=bcurve[icurve]/2; 3168 3172 int jedge=bcurve[icurve]%2; 3169 if(!Gh.curves[icurve].master) continue; // we skip all equi curve 3173 3174 /*Skip if we are on a equi curve (duplicate)*/ 3175 if(!Gh.curves[icurve].master) continue; 3176 3177 /*Get edge of Bth with index iedge*/ 3170 3178 Edge &ei = BTh.edges[iedge]; 3171 // warning: ei.on->Mark() can be change in3172 // loop for(jedge=0;jedge<2;jedge++)3173 3179 3180 /*Initialize variables*/ 3174 3181 double Lstep=0,Lcurve=0; // step between two points (phase==1) 3175 3182 long NbCreatePointOnCurve=0;// Nb of new points on curve (phase==1) 3176 3183 3184 /*Do phase 0 to step*/ 3177 3185 for(int phase=0;phase<=step;phase++){ 3178 3186 3179 for(Curve * curve= Gh.curves+icurve;curve;curve= curve->next){ 3180 3187 /*Loop over all curves from icurve till the last curve*/ 3188 for(Curve *curve= Gh.curves+icurve;curve;curve= curve->next){ 3189 3190 /*Get index of current curve*/ 3181 3191 int icurveequi= Gh.Number(curve); 3182 3192 3183 if( phase==0 && icurveequi!=icurve) continue; 3193 /*For phase 0, check that we are at the begining of the curve only*/ 3194 if(phase==0 && icurveequi!=icurve) continue; 3184 3195 3185 3196 int k0=jedge,k1; -
issm/trunk/src/m/classes/public/bamg.m
r3994 r4997 233 233 234 234 %process geom 235 bamg_geometry=processgeometry(bamg_geometry,getfieldvalue(options,'tol',NaN),domain(1));235 %bamg_geometry=processgeometry(bamg_geometry,getfieldvalue(options,'tol',NaN),domain(1)); 236 236 237 237 elseif isstruct(md.bamg),
Note:
See TracChangeset
for help on using the changeset viewer.