Changeset 3312
- Timestamp:
- 03/22/10 10:06:44 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/Bamgx.cpp
r3301 r3312 43 43 /*If no mesh in input, generate one*/ 44 44 45 if(bamgmesh_in-> NumTriangles==0){45 if(bamgmesh_in->TrianglesSize[0]==0){ 46 46 /*Mesh generation {{{1*/ 47 47 -
issm/trunk/src/c/Bamgx/objects/Geometry.cpp
r3301 r3312 63 63 64 64 /*IO*/ 65 /*FUNCTION Geometry::WriteGeometry{{{1*/66 void Geometry::WriteGeometry(BamgGeom* bamggeom, BamgOpts* bamgopts){67 68 int verbose;69 int nbreq=0;70 int nbreqv=0;71 int nbtan=0;72 int nbcracked=0;73 int i,count;74 75 /*Get options*/76 verbose=bamgopts->verbose;77 78 /*Initialize output*/79 BamgGeomInit(bamggeom);80 81 //Vertices82 if(verbose>5) printf(" writing Vertices\n");83 bamggeom->NumVertices=nbv;84 if (nbv){85 bamggeom->Vertices=(double*)xmalloc(3*nbv*sizeof(double));86 for (i=0;i<nbv;i++){87 bamggeom->Vertices[i*3+0]=vertices[i].r.x;88 bamggeom->Vertices[i*3+1]=vertices[i].r.y;89 bamggeom->Vertices[i*3+2]=vertices[i].ref();90 91 //update counters92 if (vertices[i].Required()) nbreqv++;93 }94 }95 else{96 bamggeom->Vertices=NULL;97 }98 99 //Edges100 if(verbose>5) printf(" writing Edges\n");101 bamggeom->NumEdges=nbe;102 if (nbe){103 bamggeom->Edges=(double*)xmalloc(3*nbe*sizeof(double));104 for (i=0;i<nbe;i++){105 bamggeom->Edges[i*3+0]=Number(edges[i][0])+1; //back to Matlab indexing106 bamggeom->Edges[i*3+1]=Number(edges[i][1])+1; //back to Matlab indexing107 bamggeom->Edges[i*3+2]=(double)edges[i].ref;108 109 //update counters110 if (edges[i].Required()) nbreq++;111 if (edges[i].Cracked()){112 if (i<=Number(edges[i].link)) nbcracked++;113 }114 if (edges[i].TgA() && edges[i][0].Corner()) nbtan++;115 if (edges[i].TgB() && edges[i][1].Corner()) nbtan++;116 }117 }118 else{119 bamggeom->Edges=NULL;120 }121 122 //CrackedEdges123 if(verbose>5) printf(" writing CrackedEdges\n");124 bamggeom->NumCrackedEdges=nbcracked;125 if (nbcracked){126 bamggeom->CrackedEdges=(double*)xmalloc(2*nbcracked*sizeof(double));127 count=0;128 for (i=0;i<nbe;i++){129 if (edges[i].Cracked()){130 if (i<=Number(edges[i].link)){131 bamggeom->CrackedEdges[count*2+0]=i+1; //back to Matlab indexing132 bamggeom->CrackedEdges[count*2+1]=Number(edges[i].link)+1; //back to Matlab indexing133 count=count+1;134 }135 }136 }137 }138 else{139 bamggeom->CrackedEdges=NULL;140 }141 142 //RequiredEdges143 if(verbose>5) printf(" writing %i RequiredEdges\n",nbreq);144 bamggeom->NumRequiredEdges=nbreq;145 if (nbreq){146 bamggeom->RequiredEdges=(double*)xmalloc(1*nbreq*sizeof(double));147 count=0;148 for (i=0;i<nbe;i++){149 if (edges[i].Required()){150 bamggeom->RequiredEdges[count]=i+1; //back to Matlab indexing151 count=count+1;152 }153 }154 }155 else{156 bamggeom->RequiredEdges=NULL;157 }158 159 //No corners160 161 //RequiredVertices162 if(verbose>5) printf(" writing %i RequiredVertices\n",nbreqv);163 bamggeom->NumRequiredVertices=nbreqv;164 if (nbreqv){165 bamggeom->RequiredVertices=(double*)xmalloc(1*nbreqv*sizeof(double));166 count=0;167 for (i=0;i<nbv;i++){168 if (vertices[i].Required()){169 bamggeom->RequiredVertices[count]=i+1; //back to Matlab indexing170 count=count+1;171 }172 }173 }174 else{175 bamggeom->RequiredVertices=NULL;176 }177 178 //SubDomains179 if(verbose>5) printf(" writing SubDomains\n");180 bamggeom->NumSubDomains=NbSubDomains;181 if (NbSubDomains){182 bamggeom->SubDomains=(double*)xmalloc(4*NbSubDomains*sizeof(double));183 for (i=0;i<NbSubDomains;i++){184 bamggeom->SubDomains[4*i+0]=2;185 bamggeom->SubDomains[4*i+1]=Number(subdomains[i].edge)+1; //back to Matlab indexing186 bamggeom->SubDomains[4*i+2]=subdomains[i].sens;187 bamggeom->SubDomains[4*i+3]=subdomains[i].ref;188 }189 }190 else{191 bamggeom->SubDomains=NULL;192 }193 194 //TangentAtEdges195 if(verbose>5) printf(" writing TangentAtEdges\n");196 bamggeom->NumTangentAtEdges=nbtan;197 if (nbtan){198 bamggeom->TangentAtEdges=(double*)xmalloc(4*nbtan*sizeof(double));199 count=0;200 for (i=0;i<nbe;i++){201 if (edges[i].TgA() && edges[i][0].Corner()){202 bamggeom->TangentAtEdges[4*i+0]=i+1; //back to Matlab indexing203 bamggeom->TangentAtEdges[4*i+1]=1;204 bamggeom->TangentAtEdges[4*i+2]=edges[i].tg[0].x;205 bamggeom->TangentAtEdges[4*i+3]=edges[i].tg[0].y;206 }207 if (edges[i].TgB() && edges[i][1].Corner()){208 bamggeom->TangentAtEdges[4*i+0]=i+1; //back to Matlab indexing209 bamggeom->TangentAtEdges[4*i+1]=2;210 bamggeom->TangentAtEdges[4*i+2]=edges[i].tg[1].x;211 bamggeom->TangentAtEdges[4*i+3]=edges[i].tg[2].y;212 }213 count=count+1;214 }215 }216 else{217 bamggeom->TangentAtEdges=NULL;218 }219 }220 /*}}}1*/221 65 /*FUNCTION Geometry::ReadGeometry{{{1*/ 222 66 void Geometry::ReadGeometry(BamgGeom* bamggeom,BamgOpts* bamgopts){ … … 232 76 //initialize some variables 233 77 int Version=1,dim=2; 234 nbv=bamggeom-> NumVertices;235 nbe=bamggeom-> NumEdges;78 nbv=bamggeom->VerticesSize[0]; 79 nbe=bamggeom->EdgesSize[0]; 236 80 nbvx = nbv; 237 81 nbiv = nbv; … … 239 83 240 84 //some checks 241 if (bamggeom-> NumVertices<=0 || bamggeom->Vertices==NULL){85 if (bamggeom->Vertices==NULL){ 242 86 throw ErrorException(__FUNCT__,exprintf("the domain provided does not contain any vertex")); 243 87 } 244 if (bamggeom-> NumEdges<=0 || bamggeom->Edges==NULL){88 if (bamggeom->Edges==NULL){ 245 89 throw ErrorException(__FUNCT__,exprintf("the domain provided does not contain any edge")); 246 90 } … … 249 93 if (bamggeom->Vertices){ 250 94 if(verbose>5) printf(" processing Vertices\n"); 95 if (bamggeom->VerticesSize[1]!=3) throw ErrorException(__FUNCT__,exprintf("Vertices should have 3 columns")); 251 96 vertices = new GeometricalVertex[nbvx]; 252 97 for (i=0;i<nbv;i++) { … … 288 133 289 134 if(verbose>5) printf(" processing Edges\n"); 135 if (bamggeom->EdgesSize[1]!=3) throw ErrorException(__FUNCT__,exprintf("Edges should have 3 columns")); 290 136 edges = new GeometricalEdge[nbe]; 291 137 … … 339 185 if (bamggeom->CrackedEdges){ 340 186 if(verbose>5) printf(" processing CrackedEdges\n"); 341 for (i=0;i<bamggeom-> NumCrackedEdges;i++){187 for (i=0;i<bamggeom->CrackedEdgesSize[0];i++){ 342 188 throw ErrorException(__FUNCT__,exprintf("Not implemented yet")); 343 189 } … … 399 245 if (bamggeom->TangentAtEdges){ 400 246 if(verbose>5) printf(" processing TangentAtEdges"); 247 if (bamggeom->TangentAtEdgesSize[1]!=4) throw ErrorException(__FUNCT__,exprintf("TangentAtEdges should have 4 columns")); 401 248 int n,i,j,k; 402 249 R2 tg; 403 250 404 n=bamggeom-> NumTangentAtEdges;251 n=bamggeom->TangentAtEdgesSize[0]; 405 252 for (k=0;k<n;k++) { 406 253 i=(int)bamggeom->TangentAtEdges[k*4+0]-1; //for C indexing … … 421 268 if(bamggeom->Corners){ 422 269 if(verbose>5) printf(" processing Corners"); 423 n=bamggeom->NumCorners; 270 if (bamggeom->CornersSize[1]!=1) throw ErrorException(__FUNCT__,exprintf("Corners should have 1 column")); 271 n=bamggeom->CornersSize[0]; 424 272 for (i=0;i<n;i++) { 425 273 j=(int)bamggeom->Corners[i]-1; //for C indexing … … 437 285 if(bamggeom->RequiredVertices){ 438 286 if(verbose>5) printf(" processing RequiredVertices\n"); 439 n=bamggeom->NumRequiredVertices; 287 if (bamggeom->RequiredVerticesSize[1]!=1) throw ErrorException(__FUNCT__,exprintf("RequiredVertices should have 1 column")); 288 n=bamggeom->RequiredVerticesSize[0]; 440 289 for (i=0;i<n;i++) { 441 290 j=(int)bamggeom->RequiredVertices[i]-1; //for C indexing … … 452 301 if(bamggeom->RequiredEdges){ 453 302 if(verbose>5) printf(" processing RequiredEdges\n"); 454 n=bamggeom->NumRequiredEdges; 303 if (bamggeom->RequiredEdgesSize[1]!=1) throw ErrorException(__FUNCT__,exprintf("RequiredEdges should have 1 column")); 304 n=bamggeom->RequiredEdgesSize[0]; 455 305 for (i=0;i<n;i++) { 456 306 j=(int)bamggeom->RequiredEdges[i]-1; //for C indexing … … 469 319 long i0,i1,i2,i3; 470 320 if(verbose>5) printf(" processing SubDomains\n"); 471 NbSubDomains=bamggeom->NumSubDomains; 321 if (bamggeom->SubDomainsSize[1]!=4) throw ErrorException(__FUNCT__,exprintf("SubDomains should have 4 columns")); 322 NbSubDomains=bamggeom->SubDomainsSize[0]; 472 323 subdomains = new GeometricalSubDomain[NbSubDomains]; 473 324 for (i=0;i<NbSubDomains;i++) { … … 485 336 else{ 486 337 if(verbose>5) printf(" no SubDomains found\n"); 338 } 339 } 340 /*}}}1*/ 341 /*FUNCTION Geometry::WriteGeometry{{{1*/ 342 void Geometry::WriteGeometry(BamgGeom* bamggeom, BamgOpts* bamgopts){ 343 344 int verbose; 345 int nbreq=0; 346 int nbreqv=0; 347 int nbtan=0; 348 int nbcracked=0; 349 int i,count; 350 351 /*Get options*/ 352 verbose=bamgopts->verbose; 353 354 /*Initialize output*/ 355 BamgGeomInit(bamggeom); 356 357 //Vertices 358 if(verbose>5) printf(" writing Vertices\n"); 359 bamggeom->VerticesSize[0]=nbv; 360 bamggeom->VerticesSize[1]=3; 361 if (nbv){ 362 bamggeom->Vertices=(double*)xmalloc(3*nbv*sizeof(double)); 363 for (i=0;i<nbv;i++){ 364 bamggeom->Vertices[i*3+0]=vertices[i].r.x; 365 bamggeom->Vertices[i*3+1]=vertices[i].r.y; 366 bamggeom->Vertices[i*3+2]=vertices[i].ref(); 367 368 //update counters 369 if (vertices[i].Required()) nbreqv++; 370 } 371 } 372 else{ 373 bamggeom->Vertices=NULL; 374 } 375 376 //Edges 377 if(verbose>5) printf(" writing Edges\n"); 378 bamggeom->EdgesSize[0]=nbe; 379 bamggeom->EdgesSize[1]=3; 380 if (nbe){ 381 bamggeom->Edges=(double*)xmalloc(3*nbe*sizeof(double)); 382 for (i=0;i<nbe;i++){ 383 bamggeom->Edges[i*3+0]=Number(edges[i][0])+1; //back to Matlab indexing 384 bamggeom->Edges[i*3+1]=Number(edges[i][1])+1; //back to Matlab indexing 385 bamggeom->Edges[i*3+2]=(double)edges[i].ref; 386 387 //update counters 388 if (edges[i].Required()) nbreq++; 389 if (edges[i].Cracked()){ 390 if (i<=Number(edges[i].link)) nbcracked++; 391 } 392 if (edges[i].TgA() && edges[i][0].Corner()) nbtan++; 393 if (edges[i].TgB() && edges[i][1].Corner()) nbtan++; 394 } 395 } 396 else{ 397 bamggeom->Edges=NULL; 398 } 399 400 //CrackedEdges 401 if(verbose>5) printf(" writing CrackedEdges\n"); 402 bamggeom->CrackedEdgesSize[0]=nbcracked; 403 bamggeom->CrackedEdgesSize[1]=2; 404 if (nbcracked){ 405 bamggeom->CrackedEdges=(double*)xmalloc(2*nbcracked*sizeof(double)); 406 count=0; 407 for (i=0;i<nbe;i++){ 408 if (edges[i].Cracked()){ 409 if (i<=Number(edges[i].link)){ 410 bamggeom->CrackedEdges[count*2+0]=i+1; //back to Matlab indexing 411 bamggeom->CrackedEdges[count*2+1]=Number(edges[i].link)+1; //back to Matlab indexing 412 count=count+1; 413 } 414 } 415 } 416 } 417 else{ 418 bamggeom->CrackedEdges=NULL; 419 } 420 421 //RequiredEdges 422 if(verbose>5) printf(" writing %i RequiredEdges\n",nbreq); 423 bamggeom->RequiredEdgesSize[0]=nbreq; 424 bamggeom->RequiredEdgesSize[1]=1; 425 if (nbreq){ 426 bamggeom->RequiredEdges=(double*)xmalloc(1*nbreq*sizeof(double)); 427 count=0; 428 for (i=0;i<nbe;i++){ 429 if (edges[i].Required()){ 430 bamggeom->RequiredEdges[count]=i+1; //back to Matlab indexing 431 count=count+1; 432 } 433 } 434 } 435 else{ 436 bamggeom->RequiredEdges=NULL; 437 } 438 439 //No corners 440 441 //RequiredVertices 442 if(verbose>5) printf(" writing %i RequiredVertices\n",nbreqv); 443 bamggeom->RequiredVerticesSize[0]=nbreqv; 444 bamggeom->RequiredVerticesSize[1]=1; 445 if (nbreqv){ 446 bamggeom->RequiredVertices=(double*)xmalloc(1*nbreqv*sizeof(double)); 447 count=0; 448 for (i=0;i<nbv;i++){ 449 if (vertices[i].Required()){ 450 bamggeom->RequiredVertices[count]=i+1; //back to Matlab indexing 451 count=count+1; 452 } 453 } 454 } 455 else{ 456 bamggeom->RequiredVertices=NULL; 457 } 458 459 //SubDomains 460 if(verbose>5) printf(" writing SubDomains\n"); 461 bamggeom->SubDomainsSize[0]=NbSubDomains; 462 bamggeom->SubDomainsSize[1]=4; 463 if (NbSubDomains){ 464 bamggeom->SubDomains=(double*)xmalloc(4*NbSubDomains*sizeof(double)); 465 for (i=0;i<NbSubDomains;i++){ 466 bamggeom->SubDomains[4*i+0]=2; 467 bamggeom->SubDomains[4*i+1]=Number(subdomains[i].edge)+1; //back to Matlab indexing 468 bamggeom->SubDomains[4*i+2]=subdomains[i].sens; 469 bamggeom->SubDomains[4*i+3]=subdomains[i].ref; 470 } 471 } 472 else{ 473 bamggeom->SubDomains=NULL; 474 } 475 476 //TangentAtEdges 477 if(verbose>5) printf(" writing TangentAtEdges\n"); 478 bamggeom->TangentAtEdgesSize[0]=nbtan; 479 bamggeom->TangentAtEdgesSize[1]=4; 480 if (nbtan){ 481 bamggeom->TangentAtEdges=(double*)xmalloc(4*nbtan*sizeof(double)); 482 count=0; 483 for (i=0;i<nbe;i++){ 484 if (edges[i].TgA() && edges[i][0].Corner()){ 485 bamggeom->TangentAtEdges[4*i+0]=i+1; //back to Matlab indexing 486 bamggeom->TangentAtEdges[4*i+1]=1; 487 bamggeom->TangentAtEdges[4*i+2]=edges[i].tg[0].x; 488 bamggeom->TangentAtEdges[4*i+3]=edges[i].tg[0].y; 489 } 490 if (edges[i].TgB() && edges[i][1].Corner()){ 491 bamggeom->TangentAtEdges[4*i+0]=i+1; //back to Matlab indexing 492 bamggeom->TangentAtEdges[4*i+1]=2; 493 bamggeom->TangentAtEdges[4*i+2]=edges[i].tg[1].x; 494 bamggeom->TangentAtEdges[4*i+3]=edges[i].tg[2].y; 495 } 496 count=count+1; 497 } 498 } 499 else{ 500 bamggeom->TangentAtEdges=NULL; 487 501 } 488 502 } -
issm/trunk/src/c/Bamgx/objects/Triangles.cpp
r3311 r3312 24 24 25 25 /*Read Geometry if provided*/ 26 if(bamggeom-> NumEdges>0) {26 if(bamggeom->Edges) { 27 27 Gh.ReadGeometry(bamggeom,bamgopts); 28 28 Gh.AfterRead(); … … 33 33 34 34 /*Build Geometry if not provided*/ 35 if(bamggeom-> NumEdges==0) {35 if(bamggeom->Edges==NULL) { 36 36 /*Recreate geometry if needed*/ 37 37 printf("WARNING: mesh present but no geometry found. Reconstructing...\n"); … … 314 314 verbose=bamgopts->verbose; 315 315 316 nbv=bamgmesh-> NumVertices;316 nbv=bamgmesh->VerticesSize[0]; 317 317 nbvx=nbv; 318 nbt=bamgmesh-> NumTriangles;318 nbt=bamgmesh->TrianglesSize[0]; 319 319 nbiv=nbvx; 320 320 … … 363 363 long i1,i2,i3,i4,iref; 364 364 triangles =new Triangle[nbt]; 365 for (i=0;i<bamgmesh-> NumQuadrilaterals;i++){365 for (i=0;i<bamgmesh->QuadrilateralsSize[0];i++){ 366 366 //divide the quad into two triangles 367 367 Triangle & t1 = triangles[2*i]; 368 368 Triangle & t2 = triangles[2*i+1]; 369 i1=(long)bamgmesh->Quadrilaterals[i* 4+0]-1; //for C indexing370 i2=(long)bamgmesh->Quadrilaterals[i* 4+1]-1; //for C indexing371 i3=(long)bamgmesh->Quadrilaterals[i* 4+2]-1; //for C indexing372 i4=(long)bamgmesh->Quadrilaterals[i* 4+3]-1; //for C indexing369 i1=(long)bamgmesh->Quadrilaterals[i*5+0]-1; //for C indexing 370 i2=(long)bamgmesh->Quadrilaterals[i*5+1]-1; //for C indexing 371 i3=(long)bamgmesh->Quadrilaterals[i*5+2]-1; //for C indexing 372 i4=(long)bamgmesh->Quadrilaterals[i*5+3]-1; //for C indexing 373 373 t1=Triangle(this,i1,i2,i3); 374 374 t2=Triangle(this,i3,i4,i1); 375 t1.color= 1; //reference = 1 for all triangles since it has not been specified376 t2.color= 1; //reference = 1 for all triangles since it has not been specified375 t1.color=(long)bamgmesh->Quadrilaterals[i*5+4]; 376 t2.color=(long)bamgmesh->Quadrilaterals[i*5+4]; 377 377 t1.SetHidden(OppositeEdge[1]); // two times because the adj was not created 378 378 t2.SetHidden(OppositeEdge[1]); … … 386 386 if(bamgmesh->VerticesOnGeometricEdge){ 387 387 if(verbose>5) printf(" processing VerticesOnGeometricEdge\n"); 388 NbVerticesOnGeomEdge=bamgmesh-> NumVerticesOnGeometricEdge;388 NbVerticesOnGeomEdge=bamgmesh->VerticesOnGeometricEdgeSize[0]; 389 389 VerticesOnGeomEdge= new VertexOnGeom[NbVerticesOnGeomEdge] ; 390 390 for (i=0;i<NbVerticesOnGeomEdge;i++){ … … 402 402 403 403 //VerticesOnGeometricVertex 404 if(bamgmesh-> NumVerticesOnGeometricVertex){404 if(bamgmesh->VerticesOnGeometricVertexSize[0]){ 405 405 if(verbose>5) printf(" processing VerticesOnGeometricVertex\n"); 406 NbVerticesOnGeomVertex=bamgmesh-> NumVerticesOnGeometricVertex;406 NbVerticesOnGeomVertex=bamgmesh->VerticesOnGeometricVertexSize[0]; 407 407 VerticesOnGeomVertex = new VertexOnGeom[NbVerticesOnGeomVertex] ; 408 408 for (i=0;i<NbVerticesOnGeomVertex;i++){ … … 423 423 424 424 if(verbose>5) printf(" processing Edges\n"); 425 nbe=bamgmesh-> NumEdges;425 nbe=bamgmesh->EdgesSize[0]; 426 426 edges= new Edge[nbe]; 427 427 //initialize length of each edge (used to provided metric) … … 486 486 if(bamgmesh->CrackedEdges){ 487 487 if(verbose>5) printf(" processing CrackedEdges\n"); 488 NbCrackedEdges=bamgmesh-> NumCrackedEdges;488 NbCrackedEdges=bamgmesh->CrackedEdgesSize[0]; 489 489 CrackedEdges=new CrackedEdge[NbCrackedEdges]; 490 printf("NbCrackedEdges = %i\n",bamgmesh->NumCrackedEdges);491 490 for (i=0;i<NbCrackedEdges;i++){ 492 491 //CrackedEdges[i].a.edge=bamgmesh->CrackedEdges[i*2+0]-1; //C indexing … … 503 502 if(verbose>5) printf(" processing EdgesOnGeometricEdge\n"); 504 503 int i1,i2,i,j; 505 i2=bamgmesh-> NumEdgesOnGeometricEdge;504 i2=bamgmesh->EdgesOnGeometricEdgeSize[0]; 506 505 for (i1=0;i1<i2;i1++) { 507 506 i=(int)bamgmesh->EdgesOnGeometricEdge[i1*2+0]-1; //C indexing … … 535 534 long i3,head,sens; 536 535 if(verbose>5) printf(" processing SubDomains\n"); 537 NbSubDomains=bamgmesh-> NumSubDomains;536 NbSubDomains=bamgmesh->SubDomainsSize[0]; 538 537 subdomains = new SubDomain [ NbSubDomains ]; 539 538 for (i=0;i<NbSubDomains;i++) { … … 569 568 //Vertices 570 569 if(verbose>5) printf(" writing Vertices\n"); 571 bamgmesh->NumVertices=nbv; 570 bamgmesh->VerticesSize[0]=nbv; 571 bamgmesh->VerticesSize[1]=3; 572 572 if (nbv){ 573 573 bamgmesh->Vertices=(double*)xmalloc(3*nbv*sizeof(double)); … … 584 584 //Edges 585 585 if(verbose>5) printf(" writing Edges\n"); 586 bamgmesh->NumEdges=nbe; 586 bamgmesh->EdgesSize[0]=nbe; 587 bamgmesh->EdgesSize[1]=3; 587 588 int NumSegments=0; 588 589 if (nbe){ … … 603 604 //Element Connectivity 604 605 if(verbose>5) printf(" writing Element connectivity\n"); 605 bamgmesh->NumElementConnectivity=nbt-NbOutT; 606 bamgmesh->ElementConnectivitySize[0]=nbt-NbOutT; 607 bamgmesh->ElementConnectivitySize[1]=3; 606 608 bamgmesh->ElementConnectivity=(double*)xmalloc(3*(nbt-NbOutT)*sizeof(double)); 607 609 for (i=0;i<3*(nbt-NbOutT);i++) bamgmesh->ElementConnectivity[i]=NAN; … … 650 652 } 651 653 //Build output 652 bamgmesh->NumNodalElementConnectivity=max; 654 bamgmesh->NodalElementConnectivitySize[0]=nbv; 655 bamgmesh->NodalElementConnectivitySize[1]=max; 653 656 bamgmesh->NodalElementConnectivity=(double*)xmalloc(max*nbv*sizeof(double)); 654 657 for (i=0;i<max*nbv;i++) bamgmesh->NodalElementConnectivity[i]=NAN; … … 665 668 666 669 //Build Unique edges 667 if(verbose>5) printf(" writing alledges\n");670 if(verbose>5) printf(" writing element edges\n"); 668 671 SetOfEdges4* edge4=new SetOfEdges4(nbt*3,nbv); 669 672 double* elemedge=new double[3*nbt]; … … 690 693 } 691 694 } 692 bamgmesh->NumAllEdges=edge4->nb(); 693 bamgmesh->AllEdges=(double*)xmalloc(4*edge4->nb()*sizeof(double)); 695 bamgmesh->ElementEdgesSize[0]=edge4->nb(); 696 bamgmesh->ElementEdgesSize[1]=4; 697 bamgmesh->ElementEdges=(double*)xmalloc(4*edge4->nb()*sizeof(double)); 694 698 for (i=0;i<edge4->nb();i++){ 695 bamgmesh-> AllEdges[i*4+0]=edge4->i(i)+1;// back to M indexing696 bamgmesh-> AllEdges[i*4+1]=edge4->j(i)+1;// back to M indexing697 bamgmesh-> AllEdges[i*4+2]=elemedge[2*i+0]+1; // back to M indexing698 bamgmesh-> AllEdges[i*4+3]=elemedge[2*i+1]+1; // back to M indexing699 bamgmesh->ElementEdges[i*4+0]=edge4->i(i)+1;// back to M indexing 700 bamgmesh->ElementEdges[i*4+1]=edge4->j(i)+1;// back to M indexing 701 bamgmesh->ElementEdges[i*4+2]=elemedge[2*i+0]+1; // back to M indexing 702 bamgmesh->ElementEdges[i*4+3]=elemedge[2*i+1]+1; // back to M indexing 699 703 } 700 704 //clean up … … 703 707 704 708 //Segments 705 bamgmesh->NumSegments=0;706 709 if(verbose>5) printf(" writing Segments\n"); 707 bamgmesh->NumSegments=NumSegments; 710 bamgmesh->SegmentsSize[0]=NumSegments; 711 bamgmesh->SegmentsSize[1]=4; 708 712 bamgmesh->Segments=(double*)xmalloc(4*NumSegments*sizeof(double)); 709 713 num=0; … … 750 754 //CrackedEdges 751 755 if(verbose>5) printf(" writing CrackedEdges\n"); 752 bamgmesh->NumCrackedEdges=NbCrackedEdges; 756 bamgmesh->CrackedEdgesSize[0]=NbCrackedEdges; 757 bamgmesh->CrackedEdgesSize[1]=2; 753 758 if (NbCrackedEdges){ 754 759 bamgmesh->CrackedEdges=(double*)xmalloc(2*NbCrackedEdges*sizeof(double)); … … 766 771 k=nbInT-NbOfQuad*2; 767 772 num=0; 768 bamgmesh->NumTriangles=k; 773 bamgmesh->TrianglesSize[0]=k; 774 bamgmesh->TrianglesSize[1]=4; 769 775 if (k){ 770 776 bamgmesh->Triangles=(double*)xmalloc(4*k*sizeof(double)); … … 787 793 //Quadrilaterals 788 794 if(verbose>5) printf(" writing Quadrilaterals\n"); 789 bamgmesh->NumQuadrilaterals=NbOfQuad; 795 bamgmesh->QuadrilateralsSize[0]=NbOfQuad; 796 bamgmesh->QuadrilateralsSize[1]=5; 790 797 if (NbOfQuad){ 791 798 bamgmesh->Quadrilaterals=(double*)xmalloc(5*NbOfQuad*sizeof(double)); … … 810 817 //SubDomains 811 818 if(verbose>5) printf(" writing SubDomains\n"); 812 bamgmesh->NumSubDomains=NbSubDomains; 819 bamgmesh->SubDomainsSize[0]=NbSubDomains; 820 bamgmesh->SubDomainsSize[1]=4; 813 821 if (NbSubDomains){ 814 822 bamgmesh->SubDomains=(double*)xmalloc(4*NbSubDomains*sizeof(double)); … … 826 834 //SubDomainsFromGeom 827 835 if(verbose>5) printf(" writing SubDomainsFromGeom\n"); 828 bamgmesh->NumSubDomainsFromGeom=Gh.NbSubDomains; 836 bamgmesh->SubDomainsFromGeomSize[0]=Gh.NbSubDomains; 837 bamgmesh->SubDomainsFromGeomSize[1]=4; 829 838 if (Gh.NbSubDomains){ 830 839 bamgmesh->SubDomainsFromGeom=(double*)xmalloc(4*Gh.NbSubDomains*sizeof(double)); … … 842 851 //VerticesOnGeomVertex 843 852 if(verbose>5) printf(" writing VerticesOnGeometricVertex\n"); 844 bamgmesh->NumVerticesOnGeometricVertex=NbVerticesOnGeomVertex; 853 bamgmesh->VerticesOnGeometricVertexSize[0]=NbVerticesOnGeomVertex; 854 bamgmesh->VerticesOnGeometricVertexSize[1]=2; 845 855 if (NbVerticesOnGeomVertex){ 846 856 bamgmesh->VerticesOnGeometricVertex=(double*)xmalloc(2*NbVerticesOnGeomVertex*sizeof(double)); … … 858 868 //VertexOnGeometricEdge 859 869 if(verbose>5) printf(" writing VerticesOnGeometricEdge\n"); 860 bamgmesh->NumVerticesOnGeometricEdge=NbVerticesOnGeomEdge; 870 bamgmesh->VerticesOnGeometricEdgeSize[0]=NbVerticesOnGeomEdge; 871 bamgmesh->VerticesOnGeometricEdgeSize[1]=3; 861 872 if (NbVerticesOnGeomEdge){ 862 873 bamgmesh->VerticesOnGeometricEdge=(double*)xmalloc(3*NbVerticesOnGeomEdge*sizeof(double)); … … 881 892 if (edges[i].onGeometry) k=k+1; 882 893 } 883 bamgmesh->NumEdgesOnGeometricEdge=k; 894 bamgmesh->EdgesOnGeometricEdgeSize[0]=k; 895 bamgmesh->EdgesOnGeometricEdgeSize[1]=2; 884 896 if (k){ 885 897 bamgmesh->EdgesOnGeometricEdge=(double*)xmalloc(2*(int)k*sizeof(double)); -
issm/trunk/src/c/objects/BamgGeom.cpp
r3311 r3312 4 4 void BamgGeomInit(BamgGeom* bamggeom){ 5 5 6 bamggeom->NumVertices=0; 7 bamggeom->Vertices=NULL; 8 bamggeom->NumEdges=0; 9 bamggeom->Edges=NULL; 6 bamggeom->VerticesSize[0]=0, bamggeom->VerticesSize[1]=0; bamggeom->Vertices=NULL; 7 bamggeom->EdgesSize[0]=0, bamggeom->EdgesSize[1]=0; bamggeom->Edges=NULL; 10 8 bamggeom->hVertices=NULL; 11 9 bamggeom->MetricVertices=NULL; 12 10 bamggeom->h1h2VpVertices=NULL; 13 bamggeom->NumTangentAtEdges=0; 14 bamggeom->TangentAtEdges=NULL; 15 bamggeom->NumCorners=0; 16 bamggeom->Corners=NULL; 17 bamggeom->NumRequiredVertices=0; 18 bamggeom->RequiredVertices=NULL; 19 bamggeom->NumRequiredEdges=0; 20 bamggeom->RequiredEdges=NULL; 21 bamggeom->NumCrackedEdges=0; 22 bamggeom->CrackedEdges=NULL; 23 bamggeom->NumSubDomains=0; 24 bamggeom->SubDomains=NULL; 11 bamggeom->TangentAtEdgesSize[0]=0, bamggeom->TangentAtEdgesSize[1]=0; bamggeom->TangentAtEdges=NULL; 12 bamggeom->CornersSize[0]=0, bamggeom->CornersSize[1]=0; bamggeom->Corners=NULL; 13 bamggeom->RequiredVerticesSize[0]=0, bamggeom->RequiredVerticesSize[1]=0; bamggeom->RequiredVertices=NULL; 14 bamggeom->RequiredEdgesSize[0]=0, bamggeom->RequiredEdgesSize[1]=0; bamggeom->RequiredEdges=NULL; 15 bamggeom->CrackedEdgesSize[0]=0, bamggeom->CrackedEdgesSize[1]=0; bamggeom->CrackedEdges=NULL; 16 bamggeom->SubDomainsSize[0]=0, bamggeom->SubDomainsSize[1]=0; bamggeom->SubDomains=NULL; 25 17 26 18 } … … 52 44 53 45 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 54 mxSetM(pfield, 3);55 mxSetN(pfield,bamggeom-> NumVertices);46 mxSetM(pfield,bamggeom->VerticesSize[1]); 47 mxSetN(pfield,bamggeom->VerticesSize[0]); 56 48 mxSetPr(pfield,bamggeom->Vertices); 57 49 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 59 51 60 52 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 61 mxSetM(pfield, 3);62 mxSetN(pfield,bamggeom-> NumEdges);53 mxSetM(pfield,bamggeom->EdgesSize[1]); 54 mxSetN(pfield,bamggeom->EdgesSize[0]); 63 55 mxSetPr(pfield,bamggeom->Edges); 64 56 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 66 58 67 59 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 68 mxSetM(pfield, 4);69 mxSetN(pfield,bamggeom-> NumTangentAtEdges);60 mxSetM(pfield,bamggeom->TangentAtEdgesSize[1]); 61 mxSetN(pfield,bamggeom->TangentAtEdgesSize[0]); 70 62 mxSetPr(pfield,bamggeom->TangentAtEdges); 71 63 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 73 65 74 66 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 75 mxSetM(pfield, 1);76 mxSetN(pfield,bamggeom-> NumRequiredVertices);67 mxSetM(pfield,bamggeom->RequiredVerticesSize[1]); 68 mxSetN(pfield,bamggeom->RequiredVerticesSize[0]); 77 69 mxSetPr(pfield,bamggeom->RequiredVertices); 78 70 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 80 72 81 73 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 82 mxSetM(pfield, 1);83 mxSetN(pfield,bamggeom-> NumRequiredEdges);74 mxSetM(pfield,bamggeom->RequiredEdgesSize[1]); 75 mxSetN(pfield,bamggeom->RequiredEdgesSize[0]); 84 76 mxSetPr(pfield,bamggeom->RequiredEdges); 85 77 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 87 79 88 80 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 89 mxSetM(pfield, 2);90 mxSetN(pfield,bamggeom-> NumCrackedEdges);81 mxSetM(pfield,bamggeom->CrackedEdgesSize[1]); 82 mxSetN(pfield,bamggeom->CrackedEdgesSize[0]); 91 83 mxSetPr(pfield,bamggeom->CrackedEdges); 92 84 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 94 86 95 87 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 96 mxSetM(pfield, 4);97 mxSetN(pfield,bamggeom-> NumSubDomains);88 mxSetM(pfield,bamggeom->SubDomainsSize[1]); 89 mxSetN(pfield,bamggeom->SubDomainsSize[0]); 98 90 mxSetPr(pfield,bamggeom->SubDomains); 99 91 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose -
issm/trunk/src/c/objects/BamgGeom.h
r3309 r3312 7 7 struct BamgGeom{ 8 8 9 int NumVertices;9 int VerticesSize[2]; 10 10 double* Vertices; 11 11 12 int NumEdges;12 int EdgesSize[2]; 13 13 double* Edges; 14 14 … … 17 17 double* h1h2VpVertices; 18 18 19 int NumTangentAtEdges;19 int TangentAtEdgesSize[2]; 20 20 double* TangentAtEdges; 21 21 22 int NumCorners;22 int CornersSize[2]; 23 23 double* Corners; 24 24 25 int NumRequiredVertices;25 int RequiredVerticesSize[2]; 26 26 double* RequiredVertices; 27 27 28 int NumRequiredEdges;28 int RequiredEdgesSize[2]; 29 29 double* RequiredEdges; 30 30 31 int NumCrackedEdges;31 int CrackedEdgesSize[2]; 32 32 double* CrackedEdges; 33 33 34 int NumSubDomains;34 int SubDomainsSize[2]; 35 35 double* SubDomains; 36 36 }; -
issm/trunk/src/c/objects/BamgMesh.cpp
r3311 r3312 4 4 void BamgMeshInit(BamgMesh* bamgmesh){ 5 5 6 bamgmesh->NumTriangles=0; 7 bamgmesh->Triangles=NULL; 8 bamgmesh->NumVertices=0; 9 bamgmesh->Vertices=NULL; 10 bamgmesh->NumEdges=0; 11 bamgmesh->Edges=NULL; 12 bamgmesh->NumAllEdges=0; 13 bamgmesh->AllEdges=NULL; 14 bamgmesh->NumSegments=0; 15 bamgmesh->Segments=NULL; 16 bamgmesh->SegmentsMarkers=NULL; 17 bamgmesh->NumCrackedEdges=0; 18 bamgmesh->CrackedEdges=NULL; 19 bamgmesh->NumQuadrilaterals=0; 20 bamgmesh->Quadrilaterals=NULL; 21 bamgmesh->NumVerticesOnGeometricVertex=0; 22 bamgmesh->VerticesOnGeometricVertex=NULL; 23 bamgmesh->NumVerticesOnGeometricEdge=0; 24 bamgmesh->VerticesOnGeometricEdge=NULL; 25 bamgmesh->NumEdgesOnGeometricEdge=0; 26 bamgmesh->EdgesOnGeometricEdge=NULL; 27 bamgmesh->NumSubDomains=0; 28 bamgmesh->SubDomains=NULL; 29 bamgmesh->NumSubDomainsFromGeom=0; 30 bamgmesh->SubDomainsFromGeom=NULL; 6 bamgmesh->TrianglesSize[0]=0, bamgmesh->TrianglesSize[1]=0; bamgmesh->Triangles=NULL; 7 bamgmesh->VerticesSize[0]=0, bamgmesh->VerticesSize[1]=0; bamgmesh->Vertices=NULL; 8 bamgmesh->EdgesSize[0]=0, bamgmesh->EdgesSize[1]=0; bamgmesh->Edges=NULL; 9 bamgmesh->ElementEdgesSize[0]=0, bamgmesh->ElementEdgesSize[1]=0; bamgmesh->ElementEdges=NULL; 10 bamgmesh->SegmentsSize[0]=0, bamgmesh->SegmentsSize[1]=0; bamgmesh->Segments=NULL; 11 bamgmesh->CrackedEdgesSize[0]=0, bamgmesh->CrackedEdgesSize[1]=0; bamgmesh->CrackedEdges=NULL; 12 bamgmesh->QuadrilateralsSize[0]=0,bamgmesh->QuadrilateralsSize[1]=0; bamgmesh->Quadrilaterals=NULL; 13 bamgmesh->VerticesOnGeometricVertexSize[0]=0, bamgmesh->VerticesOnGeometricVertexSize[1]=0;bamgmesh->VerticesOnGeometricVertex=NULL; 14 bamgmesh->VerticesOnGeometricEdgeSize[0]=0, bamgmesh->VerticesOnGeometricEdgeSize[1]=0; bamgmesh->VerticesOnGeometricEdge=NULL; 15 bamgmesh->EdgesOnGeometricEdgeSize[0]=0, bamgmesh->EdgesOnGeometricEdgeSize[1]=0; bamgmesh->EdgesOnGeometricEdge=NULL; 16 bamgmesh->SubDomainsSize[0]=0, bamgmesh->SubDomainsSize[1]=0; bamgmesh->SubDomains=NULL; 17 bamgmesh->SubDomainsFromGeomSize[0]=0, bamgmesh->SubDomainsFromGeomSize[1]=0; bamgmesh->SubDomainsFromGeom=NULL; 31 18 bamgmesh->hVertices=NULL; 32 bamgmesh->NumElementConnectivity=0; 33 bamgmesh->ElementConnectivity=NULL; 34 bamgmesh->NumNodalConnectivity=0; 35 bamgmesh->NodalConnectivity=NULL; 36 bamgmesh->NumNodalElementConnectivity=0; 37 bamgmesh->NodalElementConnectivity=NULL; 19 bamgmesh->ElementConnectivitySize[0]=0, bamgmesh->ElementConnectivitySize[1]=0; bamgmesh->ElementConnectivity=NULL; 20 bamgmesh->NodalConnectivitySize[0]=0, bamgmesh->NodalConnectivitySize[1]=0; bamgmesh->NodalConnectivity=NULL; 21 bamgmesh->NodalElementConnectivitySize[0]=0, bamgmesh->NodalElementConnectivitySize[1]=0; bamgmesh->NodalElementConnectivity=NULL; 38 22 39 23 } … … 54 38 mwSize dimensions[2]={1,1}; 55 39 56 fnames[0] 57 fnames[1] 58 fnames[2] 59 fnames[3] 60 fnames[4] 40 fnames[0] = "Triangles"; 41 fnames[1] = "Vertices"; 42 fnames[2] = "Edges"; 43 fnames[3] = "Segments"; 44 fnames[4] = "AllEdges"; 61 45 fnames[5] = "CrackedEdges"; 62 46 fnames[6] = "Quadrilaterals"; … … 72 56 bamgmesh_mat=mxCreateStructArray(ndim,dimensions,numfields,fnames); 73 57 74 mxSetField(bamgmesh_mat,0,"NumTriangles",mxCreateDoubleScalar(bamgmesh->NumTriangles));75 76 58 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 77 mxSetM(pfield, 4);78 mxSetN(pfield,bamgmesh-> NumTriangles);59 mxSetM(pfield,bamgmesh->TrianglesSize[1]); 60 mxSetN(pfield,bamgmesh->TrianglesSize[0]); 79 61 mxSetPr(pfield,bamgmesh->Triangles); 80 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); //transpose62 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); 81 63 mxSetField(bamgmesh_mat,0,"Triangles",pfield2); 82 64 83 65 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 84 mxSetM(pfield, 3);85 mxSetN(pfield,bamgmesh-> NumVertices);66 mxSetM(pfield,bamgmesh->VerticesSize[1]); 67 mxSetN(pfield,bamgmesh->VerticesSize[0]); 86 68 mxSetPr(pfield,bamgmesh->Vertices); 87 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); //transpose69 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); 88 70 mxSetField(bamgmesh_mat,0,"Vertices",pfield2); 89 71 90 72 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 91 mxSetM(pfield, 3);92 mxSetN(pfield,bamgmesh-> NumEdges);73 mxSetM(pfield,bamgmesh->EdgesSize[1]); 74 mxSetN(pfield,bamgmesh->EdgesSize[0]); 93 75 mxSetPr(pfield,bamgmesh->Edges); 94 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); //transpose76 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); 95 77 mxSetField(bamgmesh_mat,0,"Edges",pfield2); 96 78 97 79 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 98 mxSetM(pfield, 4);99 mxSetN(pfield,bamgmesh-> NumSegments);80 mxSetM(pfield,bamgmesh->SegmentsSize[1]); 81 mxSetN(pfield,bamgmesh->SegmentsSize[0]); 100 82 mxSetPr(pfield,bamgmesh->Segments); 101 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); //transpose83 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); 102 84 mxSetField(bamgmesh_mat,0,"Segments",pfield2); 103 85 104 86 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 105 mxSetM(pfield, 4);106 mxSetN(pfield,bamgmesh-> NumAllEdges);107 mxSetPr(pfield,bamgmesh-> AllEdges);108 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); //transpose87 mxSetM(pfield,bamgmesh->ElementEdgesSize[1]); 88 mxSetN(pfield,bamgmesh->ElementEdgesSize[0]); 89 mxSetPr(pfield,bamgmesh->ElementEdges); 90 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); 109 91 mxSetField(bamgmesh_mat,0,"AllEdges",pfield2); 110 92 111 93 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 112 mxSetM(pfield, 2);113 mxSetN(pfield,bamgmesh-> NumCrackedEdges);94 mxSetM(pfield,bamgmesh->CrackedEdgesSize[1]); 95 mxSetN(pfield,bamgmesh->CrackedEdgesSize[0]); 114 96 mxSetPr(pfield,bamgmesh->CrackedEdges); 115 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); //transpose97 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); 116 98 mxSetField(bamgmesh_mat,0,"CrackedEdges",pfield2); 117 99 118 100 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 119 mxSetM(pfield, 5);120 mxSetN(pfield,bamgmesh-> NumQuadrilaterals);101 mxSetM(pfield,bamgmesh->QuadrilateralsSize[1]); 102 mxSetN(pfield,bamgmesh->QuadrilateralsSize[0]); 121 103 mxSetPr(pfield,bamgmesh->Quadrilaterals); 122 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); //transpose104 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose"); 123 105 mxSetField(bamgmesh_mat,0,"Quadrilaterals",pfield2); 124 106 125 107 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 126 mxSetM(pfield, 2);127 mxSetN(pfield,bamgmesh-> NumVerticesOnGeometricVertex);108 mxSetM(pfield,bamgmesh->VerticesOnGeometricVertexSize[1]); 109 mxSetN(pfield,bamgmesh->VerticesOnGeometricVertexSize[0]); 128 110 mxSetPr(pfield,bamgmesh->VerticesOnGeometricVertex); 129 111 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 131 113 132 114 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 133 mxSetM(pfield, 3);134 mxSetN(pfield,bamgmesh-> NumVerticesOnGeometricEdge);115 mxSetM(pfield,bamgmesh->VerticesOnGeometricEdgeSize[1]); 116 mxSetN(pfield,bamgmesh->VerticesOnGeometricEdgeSize[0]); 135 117 mxSetPr(pfield,bamgmesh->VerticesOnGeometricEdge); 136 118 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 138 120 139 121 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 140 mxSetM(pfield, 2);141 mxSetN(pfield,bamgmesh-> NumEdgesOnGeometricEdge);122 mxSetM(pfield,bamgmesh->EdgesOnGeometricEdgeSize[1]); 123 mxSetN(pfield,bamgmesh->EdgesOnGeometricEdgeSize[0]); 142 124 mxSetPr(pfield,bamgmesh->EdgesOnGeometricEdge); 143 125 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 145 127 146 128 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 147 mxSetM(pfield, 4);148 mxSetN(pfield,bamgmesh-> NumSubDomains);129 mxSetM(pfield,bamgmesh->SubDomainsSize[1]); 130 mxSetN(pfield,bamgmesh->SubDomainsSize[0]); 149 131 mxSetPr(pfield,bamgmesh->SubDomains); 150 132 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 152 134 153 135 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 154 mxSetM(pfield, 4);155 mxSetN(pfield,bamgmesh-> NumSubDomainsFromGeom);136 mxSetM(pfield,bamgmesh->SubDomainsFromGeomSize[1]); 137 mxSetN(pfield,bamgmesh->SubDomainsFromGeomSize[0]); 156 138 mxSetPr(pfield,bamgmesh->SubDomainsFromGeom); 157 139 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 159 141 160 142 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 161 mxSetM(pfield, 3);162 mxSetN(pfield,bamgmesh-> NumElementConnectivity);143 mxSetM(pfield,bamgmesh->ElementConnectivitySize[1]); 144 mxSetN(pfield,bamgmesh->ElementConnectivitySize[0]); 163 145 mxSetPr(pfield,bamgmesh->ElementConnectivity); 164 146 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 166 148 167 149 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 168 mxSetM(pfield, 2);169 mxSetN(pfield,bamgmesh->N umNodalConnectivity);150 mxSetM(pfield,bamgmesh->NodalConnectivitySize[1]); 151 mxSetN(pfield,bamgmesh->NodalConnectivitySize[0]); 170 152 mxSetPr(pfield,bamgmesh->NodalConnectivity); 171 153 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose … … 173 155 174 156 pfield=mxCreateDoubleMatrix(0,0,mxREAL); 175 mxSetM(pfield,bamgmesh->N umNodalElementConnectivity);176 mxSetN(pfield,bamgmesh->N umVertices);157 mxSetM(pfield,bamgmesh->NodalElementConnectivitySize[1]); 158 mxSetN(pfield,bamgmesh->NodalElementConnectivitySize[0]); 177 159 mxSetPr(pfield,bamgmesh->NodalElementConnectivity); 178 160 mexCallMATLAB(1,&pfield2,1,&pfield,"transpose");//transpose -
issm/trunk/src/c/objects/BamgMesh.h
r3309 r3312 7 7 struct BamgMesh{ 8 8 9 int NumTriangles;9 int TrianglesSize[2]; 10 10 double* Triangles; 11 11 12 int NumVertices;12 int VerticesSize[2]; 13 13 double* Vertices; 14 14 15 int NumEdges;15 int EdgesSize[2]; 16 16 double* Edges; 17 17 18 int NumAllEdges;19 double* AllEdges;18 int ElementEdgesSize[2]; 19 double* ElementEdges; 20 20 21 int NumSegments;21 int SegmentsSize[2]; 22 22 double* Segments; 23 double* SegmentsMarkers;24 23 25 int NumCrackedEdges;24 int CrackedEdgesSize[2]; 26 25 double* CrackedEdges; 27 26 28 int NumQuadrilaterals;27 int QuadrilateralsSize[2]; 29 28 double* Quadrilaterals; 30 29 31 int NumVerticesOnGeometricVertex;30 int VerticesOnGeometricVertexSize[2]; 32 31 double* VerticesOnGeometricVertex; 33 32 34 int NumVerticesOnGeometricEdge;33 int VerticesOnGeometricEdgeSize[2]; 35 34 double* VerticesOnGeometricEdge; 36 35 37 int NumEdgesOnGeometricEdge;36 int EdgesOnGeometricEdgeSize[2]; 38 37 double* EdgesOnGeometricEdge; 39 38 40 int NumSubDomains;39 int SubDomainsSize[2]; 41 40 double* SubDomains; 42 41 43 int NumSubDomainsFromGeom;42 int SubDomainsFromGeomSize[2]; 44 43 double* SubDomainsFromGeom; 45 44 46 45 double* hVertices; 47 46 48 int NumElementConnectivity;47 int ElementConnectivitySize[2]; 49 48 double* ElementConnectivity; 50 49 51 int N umNodalConnectivity;50 int NodalConnectivitySize[2]; 52 51 double* NodalConnectivity; 53 52 54 int N umNodalElementConnectivity;53 int NodalElementConnectivitySize[2]; 55 54 double* NodalElementConnectivity; 56 55 };
Note:
See TracChangeset
for help on using the changeset viewer.