Changeset 2796
- Timestamp:
- 01/12/10 11:11:25 (15 years ago)
- Location:
- issm/trunk/src/c/Bamgx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/Bamgx.cpp
r2794 r2796 109 109 110 110 //Build output 111 if (verbosity>1) printf(" Write Mesh...\n"); 111 112 Th.WriteBamgMesh(bamgmesh,bamgopts); 113 if (verbosity>1) printf(" Write Geometry...\n"); 114 Gh.WriteGeometry(bamggeom,bamgopts); 112 115 /*}}}*/ 113 116 } … … 164 167 165 168 //Build output 169 if (verbosity>1) printf(" Write Mesh...\n"); 166 170 Th.WriteBamgMesh(bamgmesh,bamgopts); 171 if (verbosity>1) printf(" Write Geometry...\n"); 172 Th.Gh.WriteGeometry(bamggeom,bamgopts); 167 173 168 174 /*clean up*/ -
issm/trunk/src/c/Bamgx/Mesh2.h
r2795 r2796 990 990 Int4 Number(const GeometricalEdge * t) const { return t - edges;} 991 991 Int4 Number(const Curve * c) const { return c - curves;} 992 992 993 993 void UnMarkEdges() { 994 995 996 GeometricalEdge * ProjectOnCurve(const Edge & ,Real8,Vertex &,VertexOnGeom &) const ;994 for (Int4 i=0;i<nbe;i++) edges[i].SetUnMark();} 995 996 GeometricalEdge * ProjectOnCurve(const Edge & ,Real8,Vertex &,VertexOnGeom &) const ; 997 997 GeometricalEdge * Contening(const R2 P, GeometricalEdge * start) const; 998 friend std::ostream& operator <<(std::ostream& f, const Geometry & Gh); 999 void Write(const char * filename); 1000 1001 #ifdef DEBUG 1002 void inline Check(); 1003 #endif 1004 #ifdef DRAWING 1005 void Draw() const ; 1006 void InitDraw() const ; 1007 #endif 998 friend std::ostream& operator <<(std::ostream& f, const Geometry & Gh); 999 void Write(const char * filename); 1000 void WriteGeometry(BamgGeom* bamggeom, BamgOpts* bamgopts); 1008 1001 1009 1002 }; // End Class Geometry -
issm/trunk/src/c/Bamgx/MeshWrite.cpp
r2795 r2796 230 230 f << *this; 231 231 } 232 } 233 234 void Geometry::WriteGeometry(BamgGeom* bamggeom, BamgOpts* bamgopts){ 235 236 int verbose; 237 int nbreq=0; 238 int nbreqv=0; 239 int nbtan=0; 240 int nbcracked=0; 241 int i,count; 242 243 verbose=bamgopts->verbose; 244 245 //Vertices 246 if(verbose>3) printf(" writing Vertices\n"); 247 bamggeom->NumVertices=nbv; 248 xfree((void**)&bamggeom->Vertices); 249 if (nbv){ 250 bamggeom->Vertices=(double*)xmalloc(3*nbv*sizeof(double)); 251 for (i=0;i<nbv;i++){ 252 bamggeom->Vertices[i*3+0]=vertices[i].r.x; 253 bamggeom->Vertices[i*3+1]=vertices[i].r.y; 254 bamggeom->Vertices[i*3+2]=vertices[i].ref(); 255 256 //update counters 257 if (vertices[i].Required()) nbreqv++; 258 } 259 } 260 else{ 261 bamggeom->Vertices=NULL; 262 } 263 264 //Edges 265 if(verbose>3) printf(" writing Edges\n"); 266 bamggeom->NumEdges=nbe; 267 xfree((void**)&bamggeom->Edges); 268 if (nbe){ 269 bamggeom->Edges=(double*)xmalloc(3*nbe*sizeof(double)); 270 for (i=0;i<nbe;i++){ 271 bamggeom->Edges[i*3+0]=Number(edges[i][0])+1; //back to Matlab indexing 272 bamggeom->Edges[i*3+1]=Number(edges[i][1])+1; //back to Matlab indexing 273 //bamggeom->Edges[i*3+2]=(double)edges[i].ref(); //TEST does not compile??? 274 bamggeom->Edges[i*3+2]=1; //TEST for now 275 276 //update counters 277 if (edges[i].Required()) nbreq++; 278 if (edges[i].Cracked()){ 279 if (i<=Number(edges[i].link)) nbcracked++; 280 } 281 if (edges[i].TgA() && edges[i][0].Corner()) nbtan++; 282 if (edges[i].TgB() && edges[i][1].Corner()) nbtan++; 283 } 284 } 285 else{ 286 bamggeom->Edges=NULL; 287 } 288 289 //CrackedEdges 290 if(verbose>3) printf(" writing CrackedEdges\n"); 291 bamggeom->NumCrackedEdges=nbcracked; 292 xfree((void**)&bamggeom->CrackedEdges); 293 if (nbcracked){ 294 bamggeom->CrackedEdges=(double*)xmalloc(2*nbcracked*sizeof(double)); 295 count=0; 296 for (i=0;i<nbe;i++){ 297 if (edges[i].Cracked()){ 298 if (i<=Number(edges[i].link)){ 299 bamggeom->CrackedEdges[count*2+0]=i+1; //back to Matlab indexing 300 bamggeom->CrackedEdges[count*2+1]=Number(edges[i].link)+1; //back to Matlab indexing 301 count=count+1; 302 } 303 } 304 } 305 } 306 else{ 307 bamggeom->CrackedEdges=NULL; 308 } 309 310 //RequiredEdges 311 if(verbose>3) printf(" writing RequiredEdges\n"); 312 bamggeom->NumRequiredEdges=nbreq; 313 xfree((void**)&bamggeom->RequiredEdges); 314 if (nbreq){ 315 bamggeom->RequiredEdges=(double*)xmalloc(1*nbreq*sizeof(double)); 316 count=0; 317 for (i=0;i<nbe;i++){ 318 if (edges[i].Required()){ 319 bamggeom->RequiredEdges[count]=i+1; //back to Matlab indexing 320 count=count+1; 321 } 322 } 323 } 324 else{ 325 bamggeom->RequiredEdges=NULL; 326 } 327 328 //No corners 329 330 //RequiredVertices 331 if(verbose>3) printf(" writing RequiredVertices\n"); 332 bamggeom->NumRequiredVertices=nbreqv; 333 xfree((void**)&bamggeom->RequiredVertices); 334 if (nbreqv){ 335 bamggeom->RequiredVertices=(double*)xmalloc(1*nbreqv*sizeof(double)); 336 count=0; 337 for (i=0;i<nbe;i++){ 338 if (vertices[i].Required()){ 339 bamggeom->RequiredVertices[count]=i+1; //back to Matlab indexing 340 count=count+1; 341 } 342 } 343 } 344 else{ 345 bamggeom->RequiredVertices=NULL; 346 } 347 348 //SubDomains 349 if(verbose>3) printf(" writing SubDomains\n"); 350 bamggeom->NumSubDomains=NbSubDomains; 351 xfree((void**)&bamggeom->SubDomains); 352 if (NbSubDomains){ 353 bamggeom->SubDomains=(double*)xmalloc(4*NbSubDomains*sizeof(double)); 354 for (i=0;i<NbSubDomains;i++){ 355 bamggeom->SubDomains[4*i+0]=2; 356 bamggeom->SubDomains[4*i+1]=Number(subdomains[i].edge)+1; //back to Matlab indexing 357 bamggeom->SubDomains[4*i+2]=subdomains[i].sens; 358 bamggeom->SubDomains[4*i+3]=subdomains[i].ref; 359 } 360 } 361 else{ 362 bamggeom->SubDomains=NULL; 363 } 364 365 //TangentAtEdges 366 if(verbose>3) printf(" writing TangentAtEdges\n"); 367 bamggeom->NumTangentAtEdges=nbtan; 368 xfree((void**)&bamggeom->TangentAtEdges); 369 if (nbtan){ 370 bamggeom->TangentAtEdges=(double*)xmalloc(4*nbtan*sizeof(double)); 371 count=0; 372 for (i=0;i<nbe;i++){ 373 if (edges[i].TgA() && edges[i][0].Corner()){ 374 bamggeom->TangentAtEdges[4*i+0]=i+1; //back to Matlab indexing 375 bamggeom->TangentAtEdges[4*i+1]=1; 376 bamggeom->TangentAtEdges[4*i+2]=edges[i].tg[0].x; 377 bamggeom->TangentAtEdges[4*i+3]=edges[i].tg[0].y; 378 } 379 if (edges[i].TgB() && edges[i][1].Corner()){ 380 bamggeom->TangentAtEdges[4*i+0]=i+1; //back to Matlab indexing 381 bamggeom->TangentAtEdges[4*i+1]=2; 382 bamggeom->TangentAtEdges[4*i+2]=edges[i].tg[1].x; 383 bamggeom->TangentAtEdges[4*i+3]=edges[i].tg[2].y; 384 } 385 count=count+1; 386 } 387 } 388 else{ 389 bamggeom->TangentAtEdges=NULL; 390 } 232 391 } 233 392
Note:
See TracChangeset
for help on using the changeset viewer.