Changeset 2785
- Timestamp:
- 01/08/10 08:23:17 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Bamgx/Bamgx.cpp
r2781 r2785 34 34 35 35 /*output: */ 36 double* elementsout=NULL;37 double* xout=NULL;38 double* yout=NULL;39 int nelout, nodsout;36 double* VerticesOut=NULL; 37 double* TrianglesOut=NULL; 38 int NumVerticesOut; 39 int NumTrianglesOut; 40 40 41 41 /*Bamg options*/ … … 111 111 rBBeqMBB = !strcmp(rBB,fMBB); 112 112 113 if(bamgmesh-> numberofelements==0){113 if(bamgmesh->NumTriangles==0){ 114 114 /*Mesh generation {{{1*/ 115 115 if (verbosity>0) printf("Construction of a mesh from a given geometry\n"); 116 if (verbosity>1) printf(" Processing geometry...\n"); 116 117 Geometry Gh(bamggeom,bamgargs); 117 118 hmin = Max(hmin,Gh.MinimalHmin()); … … 119 120 120 121 //build metric if not given in input 122 if (verbosity>1) printf(" Generating Metric...\n"); 121 123 for(i=0;i<Gh.nbv;i++) 122 124 { … … 129 131 130 132 //generate mesh 133 if (verbosity>1) printf(" Generating Mesh...\n"); 131 134 Triangles Th(maxnbv,Gh); 132 135 if(splitcorners) Th.SplitInternalEdgeWithBorderVertices(); … … 136 139 137 140 //Build output 138 nelout=Th.nbt-Th.NbOutT; //number of triangles - number of external triangles139 nodsout=Th.nbv;140 141 xout=(double*)xmalloc(nodsout*sizeof(double));142 yout=(double*)xmalloc(nodsout*sizeof(double));143 for (i=0;i<nodsout;i++){144 xout[i]=Th.vertices[i].r.x;145 yout[i]=Th.vertices[i].r.y;146 } 147 148 elementsout=(double*)xmalloc(3*nelout*sizeof(double));141 if (verbosity>1) printf(" Processing Output...\n"); 142 NumVerticesOut=Th.nbv; 143 VerticesOut=(double*)xmalloc(3*NumVerticesOut*sizeof(double)); 144 for (i=0;i<NumVerticesOut;i++){ 145 VerticesOut[i*3+0]=Th.vertices[i].r.x; 146 VerticesOut[i*3+1]=Th.vertices[i].r.y; 147 VerticesOut[i*3+2]=Th.vertices[i].ReferenceNumber; 148 } 149 150 NumTrianglesOut=Th.nbt-Th.NbOutT; //number of triangles - number of external triangles 151 TrianglesOut=(double*)xmalloc(4*NumTrianglesOut*sizeof(double)); 149 152 num=0; 150 153 for(i=0;i<Th.nbt;i++){ … … 152 155 if (t.link){ 153 156 //write the element only if it is part of the mesh (no boundary element) 154 elementsout[3*num+0]=Th.Number(t[0])+1; 155 elementsout[3*num+1]=Th.Number(t[1])+1; 156 elementsout[3*num+2]=Th.Number(t[2])+1; 157 TrianglesOut[4*num+0]=Th.Number(t[0])+1; 158 TrianglesOut[4*num+1]=Th.Number(t[1])+1; 159 TrianglesOut[4*num+2]=Th.Number(t[2])+1; 160 TrianglesOut[4*num+3]=t.color; 157 161 num=num+1; 158 162 } … … 166 170 167 171 /*Read background mesh from simple delaunay triangulation: */ 172 if (verbosity>1) printf(" Processing initial mesh...\n"); 168 173 Triangles BTh(bamgmesh,bamgargs); // read the background mesh 169 174 … … 378 383 379 384 //Build output 380 nelout=Th.nbt-Th.NbOutT; //number of triangles - number of external triangles 381 nodsout=Th.nbv; 382 383 xout=(double*)xmalloc(nodsout*sizeof(double)); 384 yout=(double*)xmalloc(nodsout*sizeof(double)); 385 for (i=0;i<nodsout;i++){ 386 xout[i]=Th.vertices[i].r.x; 387 yout[i]=Th.vertices[i].r.y; 385 NumVerticesOut=Th.nbv; 386 VerticesOut=(double*)xmalloc(3*NumVerticesOut*sizeof(double)); 387 for (i=0;i<NumVerticesOut;i++){ 388 VerticesOut[i*3+0]=Th.vertices[i].r.x; 389 VerticesOut[i*3+1]=Th.vertices[i].r.y; 390 VerticesOut[i*3+2]=Th.vertices[i].ReferenceNumber; 388 391 } 389 392 390 elementsout=(double*)xmalloc(3*nelout*sizeof(double)); 393 NumTrianglesOut=Th.nbt-Th.NbOutT; //number of triangles - number of external triangles 394 TrianglesOut=(double*)xmalloc(4*NumTrianglesOut*sizeof(double)); 391 395 num=0; 392 396 for(i=0;i<Th.nbt;i++){ … … 394 398 if (t.link){ 395 399 //write the element only if it is part of the mesh (no boundary element) 396 elementsout[3*num+0]=Th.Number(t[0])+1; 397 elementsout[3*num+1]=Th.Number(t[1])+1; 398 elementsout[3*num+2]=Th.Number(t[2])+1; 400 TrianglesOut[4*num+0]=Th.Number(t[0])+1; 401 TrianglesOut[4*num+1]=Th.Number(t[1])+1; 402 TrianglesOut[4*num+2]=Th.Number(t[2])+1; 403 TrianglesOut[4*num+3]=t.color; 399 404 num=num+1; 400 405 } … … 408 413 409 414 /*Assign output pointers*/ 410 bamgmesh->numberofelements=nelout; 411 bamgmesh->numberofnodes=nodsout; 412 xfree((void**)&bamgmesh->index); 413 bamgmesh->index=elementsout; 414 xfree((void**)&bamgmesh->x); 415 bamgmesh->x=xout; 416 xfree((void**)&bamgmesh->y); 417 bamgmesh->y=yout; 415 bamgmesh->NumTriangles=NumTrianglesOut; 416 xfree((void**)&bamgmesh->Triangles); 417 bamgmesh->Triangles=TrianglesOut; 418 419 bamgmesh->NumVertices=NumVerticesOut; 420 xfree((void**)&bamgmesh->Vertices); 421 bamgmesh->Vertices=VerticesOut; 418 422 419 423 /*No error return*/ 424 if (verbosity>1) printf(" Exiting Bamg.\n"); 420 425 return noerr; 421 426 -
issm/trunk/src/c/Bamgx/MeshRead.cpp
r2783 r2785 52 52 verbose=bamgargs->verbose; 53 53 54 nbv=bamgmesh-> numberofnodes;54 nbv=bamgmesh->NumVertices; 55 55 nbvx=nbv; 56 nbt=bamgmesh-> numberofelements;56 nbt=bamgmesh->NumTriangles; 57 57 nbiv=nbvx; 58 58 59 59 //Vertices 60 if(bamgmesh-> x){61 if(verbose>3) printf(" Reading Vertices\n");60 if(bamgmesh->Vertices){ 61 if(verbose>3) printf(" processing Vertices\n"); 62 62 63 63 vertices=(Vertex*)xmalloc(nbv*sizeof(Vertex)); … … 65 65 66 66 for (i=0;i<nbv;i++){ 67 vertices[i].r.x=bamgmesh-> x[i];68 vertices[i].r.y=bamgmesh-> y[i];67 vertices[i].r.x=bamgmesh->Vertices[i*3+0]; 68 vertices[i].r.y=bamgmesh->Vertices[i*3+1]; 69 69 vertices[i].ReferenceNumber=1; 70 70 vertices[i].DirOfSearch =NoDirOfSearch; 71 71 vertices[i].m=M1; 72 vertices[i].color =0;72 vertices[i].color=bamgmesh->Vertices[i*3+2]; 73 73 } 74 74 nbtx=2*nbvx-2; // for filling The Holes and quadrilaterals … … 79 79 80 80 //Triangles 81 if(bamgmesh-> index){82 if(verbose>3) printf(" Reading index\n");81 if(bamgmesh->Triangles){ 82 if(verbose>3) printf(" processing Triangles\n"); 83 83 triangles =new Triangle[nbt]; 84 for (i=0;i< bamgmesh->numberofelements;i++){84 for (i=0;i<nbt;i++){ 85 85 Triangle & t = triangles[i]; 86 i1=(Int4)bamgmesh-> index[i*3+0]-1; //for C indexing87 i2=(Int4)bamgmesh-> index[i*3+1]-1; //for C indexing88 i3=(Int4)bamgmesh-> index[i*3+2]-1; //for C indexing86 i1=(Int4)bamgmesh->Triangles[i*4+0]-1; //for C indexing 87 i2=(Int4)bamgmesh->Triangles[i*4+1]-1; //for C indexing 88 i3=(Int4)bamgmesh->Triangles[i*4+2]-1; //for C indexing 89 89 t=Triangle(this,i1,i2,i3); 90 t.color= 1; //reference = 1 for all triangles since it has not been specified90 t.color=(Int4)bamgmesh->Triangles[i*4+3]; 91 91 } 92 92 } … … 97 97 //Quadrilaterals 98 98 if(bamgmesh->Quadrilaterals){ 99 if(verbose>3) printf(" Reading Quadrilaterals\n");99 if(verbose>3) printf(" processing Quadrilaterals\n"); 100 100 Int4 i1,i2,i3,i4,iref; 101 101 triangles =new Triangle[nbt]; … … 116 116 } 117 117 else{ 118 if(verbose>3) printf(" No Quadrilaterals found\n");118 if(verbose>3) printf(" no Quadrilaterals found\n"); 119 119 } 120 120 121 121 //hVertices 122 122 if(bamgmesh->hVertices){ 123 if(verbose>3) printf(" Reading hVertices\n");123 if(verbose>3) printf(" processing hVertices\n"); 124 124 hvertices=1; 125 125 for (i=0;i< nbv;i++){ … … 128 128 } 129 129 else{ 130 if(verbose>3) printf(" No hVertices found\n");130 if(verbose>3) printf(" no hVertices found\n"); 131 131 } 132 132 133 133 //VertexOnGeometricEdge 134 134 if(bamgmesh->VertexOnGeometricEdge){ 135 if(verbose>3) printf(" Reading VertexOnGeometricEdge\n");135 if(verbose>3) printf(" processing VertexOnGeometricEdge\n"); 136 136 NbVerticesOnGeomEdge=bamgmesh->NumVertexOnGeometricEdge; 137 137 VerticesOnGeomEdge= new VertexOnGeom[NbVerticesOnGeomEdge] ; … … 147 147 } 148 148 else{ 149 if(verbose>3) printf(" No VertexOnGeometricEdge found\n");149 if(verbose>3) printf(" no VertexOnGeometricEdge found\n"); 150 150 } 151 151 … … 156 156 Real4 *len =0; 157 157 158 if(verbose>3) printf(" Reading Edges\n");158 if(verbose>3) printf(" processing Edges\n"); 159 159 nbe=bamgmesh->NumEdges; 160 160 edges = new Edge[nbe]; … … 219 219 } 220 220 else{ 221 if(verbose>3) printf(" No Edges found\n");221 if(verbose>3) printf(" no Edges found\n"); 222 222 } 223 223 224 224 //EdgeOnGeometricEdge 225 225 if(bamgmesh->EdgeOnGeometricEdge){ 226 if(verbose>3) printf(" Reading EdgeOnGeometricEdge\n");226 if(verbose>3) printf(" processing EdgeOnGeometricEdge\n"); 227 227 int i1,i2,i,j; 228 228 i2=bamgmesh->NumEdgeOnGeometricEdge; … … 237 237 } 238 238 else{ 239 if(verbose>3) printf(" No EdgeOnGeometricEdge found\n");239 if(verbose>3) printf(" no EdgeOnGeometricEdge found\n"); 240 240 } 241 241 … … 243 243 if(bamgmesh->SubDomain){ 244 244 Int4 i3,head,sens; 245 if(verbose>3) printf(" Reading SubDomain\n");245 if(verbose>3) printf(" processing SubDomain\n"); 246 246 NbSubDomains=bamgmesh->NumSubDomain; 247 247 subdomains = new SubDomain [ NbSubDomains ]; … … 256 256 } 257 257 else{ 258 if(verbose>3) printf(" No SubDomain found\n");258 if(verbose>3) printf(" no SubDomain found\n"); 259 259 } 260 260 … … 1181 1181 1182 1182 //some checks 1183 if(verbose>3) printf("Enter ReadGeometry\n");1184 1183 if (bamggeom->NumVertices<=0 || bamggeom->Vertices==NULL){ 1185 1184 throw ErrorException(__FUNCT__,exprintf("the domain provided does not contain any vertex")); … … 1191 1190 //Vertices 1192 1191 if (bamggeom->Vertices){ 1193 if(verbose>3) printf(" Reading Vertices\n");1192 if(verbose>3) printf(" processing Vertices\n"); 1194 1193 vertices = new GeometricalVertex[nbvx]; 1195 1194 for (i=0;i<nbv;i++) { … … 1228 1227 Real4 *len =0; 1229 1228 1230 if(verbose>3) printf(" Reading Edges\n");1229 if(verbose>3) printf(" processing Edges\n"); 1231 1230 edges = new GeometricalEdge[nbe]; 1232 1231 … … 1276 1275 //hVertices 1277 1276 if(bamggeom->hVertices){ 1278 if(verbose>3) printf(" Reading hVertices\n");1277 if(verbose>3) printf(" processing hVertices\n"); 1279 1278 for (i=0;i< nbv;i++){ 1280 1279 vertices[i].m=Metric((Real4)bamggeom->hVertices[i]); … … 1282 1281 } 1283 1282 else{ 1284 if(verbose>3) printf(" No hVertices found\n");1283 if(verbose>3) printf(" no hVertices found\n"); 1285 1284 } 1286 1285 1287 1286 //MetricVertices 1288 1287 if(bamggeom->MetricVertices){ 1289 if(verbose>3) printf(" Reading MetricVertices\n");1288 if(verbose>3) printf(" processing MetricVertices\n"); 1290 1289 hvertices=1; 1291 1290 for (i=0;i< nbv;i++) { … … 1294 1293 } 1295 1294 else{ 1296 if(verbose>3) printf(" No MetricVertices found\n");1295 if(verbose>3) printf(" no MetricVertices found\n"); 1297 1296 } 1298 1297 1299 1298 //h1h2VpVertices 1300 1299 if(bamggeom->h1h2VpVertices){ 1301 if(verbose>3) printf(" Reading h1h2VpVertices\n");1300 if(verbose>3) printf(" processing h1h2VpVertices\n"); 1302 1301 Real4 h1,h2,v1,v2; 1303 1302 hvertices =1; … … 1311 1310 } 1312 1311 else{ 1313 if(verbose>3) printf(" No h1h2VpVertices found\n");1312 if(verbose>3) printf(" no h1h2VpVertices found\n"); 1314 1313 } 1315 1314 1316 1315 //MaximalAngleOfCorner 1317 1316 if (bamggeom->MaximalAngleOfCorner){ 1318 if(verbose>3) printf(" Reading MaximalAngleOfCorner\n");1317 if(verbose>3) printf(" processing MaximalAngleOfCorner\n"); 1319 1318 MaximalAngleOfCorner=bamggeom->MaximalAngleOfCorner*Pi/180; 1320 1319 } 1321 1320 else{ 1322 if(verbose>3) printf(" No MaximalAngleOfCorner found\n");1321 if(verbose>3) printf(" no MaximalAngleOfCorner found\n"); 1323 1322 } 1324 1323 1325 1324 //TangentAtEdges 1326 1325 if (bamggeom->TangentAtEdges){ 1327 if(verbose>3) printf(" Reading TangentAtEdges");1326 if(verbose>3) printf(" processing TangentAtEdges"); 1328 1327 int n,i,j,k; 1329 1328 R2 tg; … … 1342 1341 } 1343 1342 else{ 1344 if(verbose>3) printf(" No TangentAtEdges found\n");1343 if(verbose>3) printf(" no TangentAtEdges found\n"); 1345 1344 } 1346 1345 1347 1346 //Corners 1348 1347 if(bamggeom->Corners){ 1349 if(verbose>3) printf(" Reading Corners");1348 if(verbose>3) printf(" processing Corners"); 1350 1349 n=bamggeom->NumCorners; 1351 1350 for (i=0;i<n;i++) { … … 1358 1357 } 1359 1358 else{ 1360 if(verbose>3) printf(" No Corners found\n");1359 if(verbose>3) printf(" no Corners found\n"); 1361 1360 } 1362 1361 1363 1362 //RequiredVertices 1364 1363 if(bamggeom->RequiredVertices){ 1365 if(verbose>3) printf(" Reading RequiredVertices");1364 if(verbose>3) printf(" processing RequiredVertices"); 1366 1365 n=bamggeom->NumRequiredVertices; 1367 1366 for (i=0;i<n;i++) { … … 1373 1372 } 1374 1373 else{ 1375 if(verbose>3) printf(" No RequiredVertices found\n");1374 if(verbose>3) printf(" no RequiredVertices found\n"); 1376 1375 } 1377 1376 1378 1377 //RequiredEdges 1379 1378 if(bamggeom->RequiredEdges){ 1380 if(verbose>3) printf(" Reading RequiredEdges");1379 if(verbose>3) printf(" processing RequiredEdges"); 1381 1380 n=bamggeom->NumRequiredEdges; 1382 1381 for (i=0;i<n;i++) { … … 1388 1387 } 1389 1388 else{ 1390 if(verbose>3) printf(" No RequiredEdges found\n");1389 if(verbose>3) printf(" no RequiredEdges found\n"); 1391 1390 } 1392 1391 … … 1394 1393 if(bamggeom->SubDomain){ 1395 1394 Int4 i0,i1,i2,i3; 1396 if(verbose>3) printf(" Reading SubDomain\n");1395 if(verbose>3) printf(" processing SubDomain\n"); 1397 1396 NbSubDomains=bamggeom->NumSubDomain; 1398 1397 subdomains = new GeometricalSubDomain[NbSubDomains]; … … 1410 1409 } 1411 1410 else{ 1412 if(verbose>3) printf(" No SubDomain found\n");1411 if(verbose>3) printf(" no SubDomain found\n"); 1413 1412 } 1414 1413 } -
issm/trunk/src/c/objects/BamgMesh.h
r2771 r2785 8 8 struct BamgMesh{ 9 9 10 int numberofelements; 11 int numberofnodes; 12 double* x; 13 double* y; 14 double* index; 10 int NumTriangles; 11 double* Triangles; 15 12 13 int NumVertices; 14 double* Vertices; 15 16 int NumEdges; 17 double* Edges; 18 19 int NumQuadrilaterals; 20 double* Quadrilaterals; 21 22 int NumVertexOnGeometricEdge; 23 double* VertexOnGeometricEdge; 24 25 int NumEdgeOnGeometricEdge; 26 double* EdgeOnGeometricEdge; 27 28 int NumSubDomain; 29 double* SubDomain; 30 31 double* hVertices; 16 32 }; 17 33 #endif -
issm/trunk/src/m/classes/public/bamg.m
r2781 r2785 51 51 52 52 % Bamg Mesh parameters {{{1 53 bamg_mesh. numberofelements=0;54 bamg_mesh. numberofnodes=0;55 bamg_mesh. x=[];56 bamg_mesh. y=[];53 bamg_mesh.NumVertices=0; 54 bamg_mesh.Vertices=[]; 55 bamg_mesh.NumTriangles=0; 56 bamg_mesh.Triangles=[]; 57 57 bamg_mesh.index=zeros(0,3); 58 58 if (~exist(options,'domain') & md.numberofgrids~=0 & strcmpi(md.type,'2d')), 59 bamg_mesh.numberofelements=md.numberofelements; 60 bamg_mesh.numberofnodes=md.numberofgrids; 61 bamg_mesh.x=md.x; 62 bamg_mesh.y=md.y; 63 bamg_mesh.index=md.elements; 59 bamg_mesh.NumVertices=md.numberofgrids; 60 bamg_mesh.Vertices=[md.x md.y ones(md.numberofgrids,1)]; 61 bamg_mesh.NumTriangles=md.numberofelements; 62 bamg_mesh.Triangles=[md.elements ones(md.numberofgrids,1)]; 64 63 end 65 64 %}}} … … 78 77 79 78 %call Bamg 80 [ elements,x,y]=Bamg(bamg_mesh,bamg_geometry,bamg_options);79 [triangles vertices]=Bamg(bamg_mesh,bamg_geometry,bamg_options); 81 80 82 81 % plug results onto model 83 md.x= x;84 md.y= y;85 md.elements= elements;82 md.x=vertices(:,1); 83 md.y=vertices(:,2); 84 md.elements=triangles(:,1:3); 86 85 87 86 %Fill in rest of fields: -
issm/trunk/src/mex/Bamg/Bamg.cpp
r2781 r2785 14 14 15 15 /*Mesh inputs*/ 16 int numberofnodes; 17 int numberofelements; 18 double* x; 19 double* y; 20 double* index; 16 int NumVerticesMesh; 17 double* VerticesMesh=NULL; 18 int NumTrianglesMesh; 19 double* TrianglesMesh=NULL; 21 20 22 21 /*Geom inputs: */ 23 int NumVertices ;24 double* Vertices =NULL;25 int NumEdges ;26 double* Edges =NULL;27 double* hVertices =NULL;22 int NumVerticesGeom; 23 double* VerticesGeom=NULL; 24 int NumEdgesGeom; 25 double* EdgesGeom=NULL; 26 double* hVerticesGeom=NULL; 28 27 double MaximalAngleOfCorner; 29 int NumSubDomain ;30 double* SubDomain =NULL;28 int NumSubDomainGeom; 29 double* SubDomainGeom=NULL; 31 30 32 31 /*Options inputs*/ … … 44 43 45 44 /*create bamg geometry input*/ 46 FetchData(&NumVertices,mxGetField(BAMGGEOMETRY,0,"NumVertices")); 47 bamggeom.NumVertices=NumVertices; 48 FetchData(&Vertices,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Vertices")); 49 bamggeom.Vertices=Vertices; 50 FetchData(&NumEdges,mxGetField(BAMGGEOMETRY,0,"NumEdges")); 51 bamggeom.NumEdges=NumEdges; 52 FetchData(&Edges,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Edges")); 53 bamggeom.Edges=Edges; 54 FetchData(&hVertices,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"hVertices")); 55 bamggeom.hVertices=hVertices; 56 bamggeom.Edges=Edges; 45 FetchData(&NumVerticesGeom,mxGetField(BAMGGEOMETRY,0,"NumVertices")); 46 bamggeom.NumVertices=NumVerticesGeom; 47 FetchData(&VerticesGeom,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Vertices")); 48 bamggeom.Vertices=VerticesGeom; 49 FetchData(&NumEdgesGeom,mxGetField(BAMGGEOMETRY,0,"NumEdges")); 50 bamggeom.NumEdges=NumEdgesGeom; 51 FetchData(&EdgesGeom,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Edges")); 52 bamggeom.Edges=EdgesGeom; 53 FetchData(&hVerticesGeom,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"hVertices")); 54 bamggeom.hVertices=hVerticesGeom; 57 55 bamggeom.MetricVertices=NULL; 58 56 bamggeom.h1h2VpVertices=NULL; … … 67 65 bamggeom.NumRequiredEdges=0; 68 66 bamggeom.RequiredEdges=NULL; 69 FetchData(&NumSubDomain ,mxGetField(BAMGGEOMETRY,0,"NumSubDomain"));70 bamggeom.NumSubDomain=NumSubDomain ;71 FetchData(&SubDomain ,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"SubDomain"));72 bamggeom.SubDomain=SubDomain ;67 FetchData(&NumSubDomainGeom,mxGetField(BAMGGEOMETRY,0,"NumSubDomain")); 68 bamggeom.NumSubDomain=NumSubDomainGeom; 69 FetchData(&SubDomainGeom,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"SubDomain")); 70 bamggeom.SubDomain=SubDomainGeom; 73 71 74 72 /*create bamg mesh input*/ 75 FetchData(&numberofnodes,mxGetField(BAMGMESH,0,"numberofnodes")); 76 bamgmesh.numberofnodes=numberofnodes; 77 FetchData(&numberofelements,mxGetField(BAMGMESH,0,"numberofelements")); 78 bamgmesh.numberofelements=numberofelements; 79 FetchData(&x,NULL,NULL,mxGetField(BAMGMESH,0,"x")); 80 bamgmesh.x=x; 81 FetchData(&y,NULL,NULL,mxGetField(BAMGMESH,0,"y")); 82 bamgmesh.y=y; 83 FetchData(&index,NULL,NULL,mxGetField(BAMGMESH,0,"index")); 84 bamgmesh.index=index; 73 FetchData(&NumVerticesMesh,mxGetField(BAMGMESH,0,"NumVertices")); 74 bamgmesh.NumVertices=NumVerticesMesh; 75 FetchData(&VerticesMesh,NULL,NULL,mxGetField(BAMGMESH,0,"Vertices")); 76 bamgmesh.Vertices=VerticesMesh; 77 FetchData(&NumTrianglesMesh,mxGetField(BAMGMESH,0,"NumVertices")); 78 bamgmesh.NumTriangles=NumTrianglesMesh; 79 FetchData(&TrianglesMesh,NULL,NULL,mxGetField(BAMGMESH,0,"Vertices")); 80 bamgmesh.Triangles=TrianglesMesh; 81 bamgmesh.hVertices=NULL; 82 bamgmesh.NumQuadrilaterals=0; 83 bamgmesh.Quadrilaterals=NULL; 84 bamgmesh.NumVertexOnGeometricEdge=0; 85 bamgmesh.VertexOnGeometricEdge=NULL; 86 bamgmesh.NumEdgeOnGeometricEdge=0; 87 bamgmesh.EdgeOnGeometricEdge=NULL; 88 bamgmesh.NumEdges=0; 89 bamgmesh.Edges=NULL; 90 bamgmesh.NumSubDomain=0; 91 bamgmesh.SubDomain=NULL; 85 92 86 93 /*create bamg options input*/ … … 108 115 109 116 /*write output datasets: */ 110 WriteData(ELEMENTSOUT,bamgmesh.index,bamgmesh.numberofelements,3); 111 WriteData(XOUT,bamgmesh.x,bamgmesh.numberofnodes); 112 WriteData(YOUT,bamgmesh.y,bamgmesh.numberofnodes); 117 WriteData(TRIANGLESOUT,bamgmesh.Triangles,bamgmesh.NumTriangles,4); 118 WriteData(VERTICESOUT,bamgmesh.Vertices,bamgmesh.NumVertices,3); 113 119 114 120 /*Free ressources: */ 115 xfree((void**)&Vertices); 116 xfree((void**)&Edges); 117 xfree((void**)&hVertices); 118 xfree((void**)&SubDomain); 121 xfree((void**)&VerticesGeom); 122 xfree((void**)&EdgesGeom); 123 xfree((void**)&hVerticesGeom); 124 xfree((void**)&SubDomainGeom); 125 xfree((void**)&TrianglesMesh); 126 xfree((void**)&VerticesMesh); 119 127 120 128 /*end module: */ -
issm/trunk/src/mex/Bamg/Bamg.h
r2780 r2785 23 23 24 24 /* serial output macros: */ 25 #define ELEMENTSOUT (mxArray**)&plhs[0] 26 #define XOUT (mxArray**)&plhs[1] 27 #define YOUT (mxArray**)&plhs[2] 25 #define TRIANGLESOUT (mxArray**)&plhs[0] 26 #define VERTICESOUT (mxArray**)&plhs[1] 28 27 29 28 /* serial arg counts: */ 30 29 #undef NLHS 31 #define NLHS 330 #define NLHS 2 32 31 #undef NRHS 33 32 #define NRHS 3
Note:
See TracChangeset
for help on using the changeset viewer.