Ignore:
Timestamp:
03/08/10 14:48:38 (15 years ago)
Author:
Mathieu Morlighem
Message:

now mesh in and mesh_out are 2 different objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/mex/Bamg/Bamg.cpp

    r3214 r3218  
    99        int   noerr=1;
    1010        int   i;
    11         int   nods=0; //to be removed
    1211        int   lines,cols;
    1312        BamgOpts bamgopts;
    14         BamgMesh bamgmesh;
    15         BamgGeom bamggeom;
     13        BamgMesh bamgmesh_in,bamgmesh_out;
     14        BamgGeom bamggeom_in,bamggeom_out;
    1615
    1716        /*Boot module: */
     
    2221
    2322        /*create bamg geometry input*/
    24         BamgGeomInit(&bamggeom);
    25         FetchData(&bamggeom.NumVertices,mxGetField(BAMGGEOMETRY,0,"NumVertices"));
    26         FetchData(&bamggeom.Vertices,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Vertices"));
    27         FetchData(&bamggeom.NumEdges,mxGetField(BAMGGEOMETRY,0,"NumEdges"));
    28         FetchData(&bamggeom.Edges,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Edges"));
    29         FetchData(&bamggeom.hVertices,&lines,&cols,mxGetField(BAMGGEOMETRY,0,"hVertices"));
    30         FetchData(&bamggeom.NumCrackedEdges,mxGetField(BAMGGEOMETRY,0,"NumCrackedEdges"));
    31         FetchData(&bamggeom.CrackedEdges,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"CrackedEdges"));
    32         FetchData(&bamggeom.NumSubDomains,mxGetField(BAMGGEOMETRY,0,"NumSubDomains"));
    33         FetchData(&bamggeom.SubDomains,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"SubDomains"));
    34         if (bamggeom.hVertices && (cols!=1 || lines!=bamggeom.NumVertices)){throw ErrorException(__FUNCT__,exprintf("the size of 'hVertices' should be [%i %i]",bamggeom.NumVertices,1));}
     23        BamgGeomInit(&bamggeom_in);
     24        FetchData(&bamggeom_in.NumVertices,mxGetField(BAMGGEOMETRY,0,"NumVertices"));
     25        FetchData(&bamggeom_in.Vertices,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Vertices"));
     26        FetchData(&bamggeom_in.NumEdges,mxGetField(BAMGGEOMETRY,0,"NumEdges"));
     27        FetchData(&bamggeom_in.Edges,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"Edges"));
     28        FetchData(&bamggeom_in.hVertices,&lines,&cols,mxGetField(BAMGGEOMETRY,0,"hVertices"));
     29        FetchData(&bamggeom_in.NumCrackedEdges,mxGetField(BAMGGEOMETRY,0,"NumCrackedEdges"));
     30        FetchData(&bamggeom_in.CrackedEdges,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"CrackedEdges"));
     31        FetchData(&bamggeom_in.NumSubDomains,mxGetField(BAMGGEOMETRY,0,"NumSubDomains"));
     32        FetchData(&bamggeom_in.SubDomains,NULL,NULL,mxGetField(BAMGGEOMETRY,0,"SubDomains"));
     33        if (bamggeom_in.hVertices && (cols!=1 || lines!=bamggeom_in.NumVertices)){throw ErrorException(__FUNCT__,exprintf("the size of 'hVertices' should be [%i %i]",bamggeom_in.NumVertices,1));}
    3534
    3635        /*create bamg mesh input*/
    37         BamgMeshInit(&bamgmesh);
    38         FetchData(&bamgmesh.NumVertices,mxGetField(BAMGMESH,0,"NumVertices"));
    39         FetchData(&bamgmesh.Vertices,NULL,NULL,mxGetField(BAMGMESH,0,"Vertices"));
    40         FetchData(&bamgmesh.NumTriangles,mxGetField(BAMGMESH,0,"NumTriangles"));
    41         FetchData(&bamgmesh.Triangles,NULL,NULL,mxGetField(BAMGMESH,0,"Triangles"));
    42         FetchData(&bamgmesh.hVertices,&lines,&cols,mxGetField(BAMGMESH,0,"hVertices"));
    43         FetchData(&bamgmesh.NumCrackedEdges,mxGetField(BAMGMESH,0,"NumCrackedEdges"));
    44         FetchData(&bamgmesh.CrackedEdges,NULL,NULL,mxGetField(BAMGMESH,0,"CrackedEdges"));
    45         if (bamgmesh.hVertices && (cols!=1 || lines!=bamgmesh.NumVertices)){throw ErrorException(__FUNCT__,exprintf("the size of 'hVertices' should be [%i %i]",bamgmesh.NumVertices,1));}
     36        BamgMeshInit(&bamgmesh_in);
     37        FetchData(&bamgmesh_in.NumVertices,mxGetField(BAMGMESH,0,"NumVertices"));
     38        FetchData(&bamgmesh_in.Vertices,NULL,NULL,mxGetField(BAMGMESH,0,"Vertices"));
     39        FetchData(&bamgmesh_in.NumTriangles,mxGetField(BAMGMESH,0,"NumTriangles"));
     40        FetchData(&bamgmesh_in.Triangles,NULL,NULL,mxGetField(BAMGMESH,0,"Triangles"));
     41        FetchData(&bamgmesh_in.hVertices,&lines,&cols,mxGetField(BAMGMESH,0,"hVertices"));
     42        FetchData(&bamgmesh_in.NumCrackedEdges,mxGetField(BAMGMESH,0,"NumCrackedEdges"));
     43        FetchData(&bamgmesh_in.CrackedEdges,NULL,NULL,mxGetField(BAMGMESH,0,"CrackedEdges"));
     44        if (bamgmesh_in.hVertices && (cols!=1 || lines!=bamgmesh_in.NumVertices)){throw ErrorException(__FUNCT__,exprintf("the size of 'hVertices' should be [%i %i]",bamgmesh_in.NumVertices,1));}
    4645
    4746        /*create bamg options input*/
     
    6867        FetchData(&bamgopts.MaximalAngleOfCorner,mxGetField(BAMGOPTIONS,0,"MaximalAngleOfCorner"));
    6968        FetchData(&bamgopts.metric,&lines,&cols,mxGetField(BAMGOPTIONS,0,"metric"));
    70         if (bamgopts.metric && (cols!=3 || lines!=bamgmesh.NumVertices)){throw ErrorException(__FUNCT__,exprintf("the size of 'metric' should be [%i %i]",bamgmesh.NumVertices,3));}
     69        if (bamgopts.metric && (cols!=3 || lines!=bamgmesh_in.NumVertices)){throw ErrorException(__FUNCT__,exprintf("the size of 'metric' should be [%i %i]",bamgmesh_in.NumVertices,3));}
    7170        FetchData(&bamgopts.field,&lines,&bamgopts.numfields,mxGetField(BAMGOPTIONS,0,"field"));
    72         if (bamgopts.field && lines!=bamgmesh.NumVertices){throw ErrorException(__FUNCT__,exprintf("the size of 'field' should be [%i %i]",bamgmesh.NumVertices,bamgopts.numfields));}
     71        if (bamgopts.field && lines!=bamgmesh_in.NumVertices){throw ErrorException(__FUNCT__,exprintf("the size of 'field' should be [%i %i]",bamgmesh_in.NumVertices,bamgopts.numfields));}
    7372        FetchData(&bamgopts.err,NULL,&cols,mxGetField(BAMGOPTIONS,0,"err"));
    7473        if (bamgopts.numfields!=0 && cols!=bamgopts.numfields){throw ErrorException(__FUNCT__,exprintf("the size of 'err' should be the same as 'field'"));}
     
    7675
    7776        /*!Generate internal degree of freedom numbers: */
    78         nods=bamgmesh.NumVertices;
    79         Bamgx(&bamgmesh,&bamggeom,&bamgopts);
     77        Bamgx(&bamgmesh_out,&bamggeom_out,&bamgmesh_in,&bamggeom_in,&bamgopts);
    8078
    8179        /*write output datasets: */
    82         WriteData(TRIANGLESOUT,bamgmesh.Triangles,bamgmesh.NumTriangles,4);
    83         WriteData(VERTICESOUT,bamgmesh.Vertices,bamgmesh.NumVertices,3);
    84         WriteData(SEGMENTSOUT,bamgmesh.Segments,bamgmesh.NumSegments,3);
    85         WriteData(SEGMENTSMARKERSOUT,bamgmesh.SegmentsMarkers,bamgmesh.NumSegments,1);
    86         WriteData(METRICOUT,bamgopts.metric,nods,3);
     80        WriteData(TRIANGLESOUT,bamgmesh_out.Triangles,bamgmesh_out.NumTriangles,4);
     81        WriteData(VERTICESOUT,bamgmesh_out.Vertices,bamgmesh_out.NumVertices,3);
     82        WriteData(SEGMENTSOUT,bamgmesh_out.Segments,bamgmesh_out.NumSegments,3);
     83        WriteData(SEGMENTSMARKERSOUT,bamgmesh_out.SegmentsMarkers,bamgmesh_out.NumSegments,1);
     84        WriteData(METRICOUT,bamgopts.metric,bamgmesh_in.NumVertices,3);
    8785
    8886        /*Free ressources: */
Note: See TracChangeset for help on using the changeset viewer.