Ignore:
Timestamp:
05/16/11 15:50:34 (14 years ago)
Author:
Mathieu Morlighem
Message:

moved grids to nodes/vertices

File:
1 edited

Legend:

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

    r4526 r8306  
    3333        /*Domain outline variables: */
    3434        int      nprof;
    35         int*     profngrids=NULL;
     35        int*     profnvertices=NULL;
    3636        double** pprofx=NULL;
    3737        double** pprofy=NULL;
     
    4242        /*Rift outline variables: */
    4343        int      numrifts;
    44         int*     riftsnumgrids=NULL;
    45         double** riftsgridsx=NULL;
    46         double** riftsgridsy=NULL;
     44        int*     riftsnumvertices=NULL;
     45        double** riftsverticesx=NULL;
     46        double** riftsverticesy=NULL;
    4747
    4848        /* Triangle structures: */
     
    8686       
    8787        /*Start reading the domain outline file: */
    88         if(!DomainOutlineRead(&nprof,&profngrids,&pprofx,&pprofy,domainname)){
     88        if(!DomainOutlineRead(&nprof,&profnvertices,&pprofx,&pprofy,domainname)){
    8989                printf("%s%s%s\n",__FUNCT__," error message reading domain outline ",domainname);
    9090                mexErrMsgTxt(" ");
     
    9393        /*Read rifts file if present: */
    9494        if(riftname){
    95                 if(!DomainOutlineRead(&numrifts,&riftsnumgrids,&riftsgridsx,&riftsgridsy,riftname)){
     95                if(!DomainOutlineRead(&numrifts,&riftsnumvertices,&riftsverticesx,&riftsverticesy,riftname)){
    9696                        printf("%s%s%s\n",__FUNCT__," error message reading rifts outline ",riftname);
    9797                        mexErrMsgTxt(" ");
     
    102102        numberofpoints=0;
    103103        for (i=0;i<nprof;i++){
    104                 numberofpoints+=profngrids[i];
     104                numberofpoints+=profnvertices[i];
    105105        }
    106106        if (riftname){
    107107                for (i=0;i<numrifts;i++){
    108                         numberofpoints+=riftsnumgrids[i];
     108                        numberofpoints+=riftsnumvertices[i];
    109109                }
    110110        }
     
    118118                xprof=pprofx[i];
    119119                yprof=pprofy[i];
    120                 for (j=0;j<profngrids[i];j++){
     120                for (j=0;j<profnvertices[i];j++){
    121121                        in.pointlist[2*counter+0]=xprof[j];
    122122                        in.pointlist[2*counter+1]=yprof[j];
     
    126126        if(riftname){
    127127                for (i=0;i<numrifts;i++){
    128                         xprof=riftsgridsx[i];
    129                         yprof=riftsgridsy[i];
    130                         for (j=0;j<riftsnumgrids[i];j++){
     128                        xprof=riftsverticesx[i];
     129                        yprof=riftsverticesy[i];
     130                        for (j=0;j<riftsnumvertices[i];j++){
    131131                                in.pointlist[2*counter+0]=xprof[j];
    132132                                in.pointlist[2*counter+1]=yprof[j];
     
    149149
    150150        /*Build segments: */
    151         /*Figure out number of segments: holes and closed outlines have as many segments as grids,
    152          *for rifts, we have one less segment as we have grids*/
     151        /*Figure out number of segments: holes and closed outlines have as many segments as vertices,
     152         *for rifts, we have one less segment as we have vertices*/
    153153        in.numberofsegments=0;
    154154        for (i=0;i<nprof;i++){
    155                 in.numberofsegments+=profngrids[i];
     155                in.numberofsegments+=profnvertices[i];
    156156        }
    157157        if (riftname){
    158158                for (i=0;i<numrifts;i++){
    159                         in.numberofsegments+=riftsnumgrids[i]-1;
     159                        in.numberofsegments+=riftsnumvertices[i]-1;
    160160                }
    161161        }
     
    166166        backcounter=0;
    167167        for (i=0;i<nprof;i++){
    168                 for (j=0;j<(profngrids[i]-1);j++){
     168                for (j=0;j<(profnvertices[i]-1);j++){
    169169                        in.segmentlist[2*counter+0]=counter;
    170170                        in.segmentlist[2*counter+1]=counter+1;
     
    182182        if(riftname){
    183183                for (i=0;i<numrifts;i++){
    184                         for (j=0;j<(riftsnumgrids[i]-1);j++){
     184                        for (j=0;j<(riftsnumvertices[i]-1);j++){
    185185                                in.segmentlist[2*counter2+0]=counter;
    186186                                in.segmentlist[2*counter2+1]=counter+1;
     
    201201        in.holelist = (REAL *) mxMalloc(in.numberofholes * 2 * sizeof(REAL));
    202202        for (i=0;i<nprof-1;i++){
    203                 /*We are looking for a grid that lies inside the hole: */
    204                 GridInsideHole(&in.holelist[2*i+0],&in.holelist[2*i+1],profngrids[i+1],pprofx[i+1],pprofy[i+1]);
     203                /*We are looking for a vertex that lies inside the hole: */
     204                GridInsideHole(&in.holelist[2*i+0],&in.holelist[2*i+1],profnvertices[i+1],pprofx[i+1],pprofy[i+1]);
    205205        }
    206206
Note: See TracChangeset for help on using the changeset viewer.