Ignore:
Timestamp:
07/17/17 21:18:32 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG: working on bamg amr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp

    r21792 r21802  
    2424        R2     r;
    2525        I2     I;
    26         int    i,j;
     26        int    i,j,k;
    2727        int    it;
    2828        int    i0,i1,i2;
     
    6464                if(y_data[i]<ymin) ymin=y_data[i];
    6565                if(y_data[i]>ymax) ymax=y_data[i];
     66        }
     67
     68        /*Create Single vertex to element connectivity*/
     69        int* connectivity = xNew<int>(nods_data);
     70        for(i=0;i<nels_data;i++){
     71                for(j=0;j<3;j++){
     72                        k = index_data[i*3+j]-1;
     73                        _assert_(k>=0 & k<nods_data);
     74                        connectivity[k]=i;
     75                }
    6676        }
    6777
     
    137147                        /*If we fall outside of the convex or outside of the mesh, return NaN*/
    138148                        if(tb.det<0 || reft[it]<0){
    139                                 for (j=0;j<N_data;j++){
    140                                         data_interp[i*N_data+j]=NAN;
    141                                 }
     149                                _assert_(i0>=0 & i0<nods_data);
     150                                it=connectivity[i0]; //or i1 or i2
     151                                _assert_(it>=0 && it<nels_data);
     152                                for(j=0;j<N_data;j++) data_interp[i*N_data+j]=data[N_data*it+j];
    142153                        }
    143154                        else{
     155                                /*Inside the mesh!*/
    144156                                if(it<0 || it>=nels_data){
    145157                                        _error_("Triangle number " << it << " not in [0 " << nels_data
    146158                                                                << "], report bug to developers (interpolation point: " <<x_interp[i]<<" "<<y_interp[i]<<")");
    147159                                }
    148                                 for (j=0;j<N_data;j++){
    149 
    150                                         data_interp[i*N_data+j]=data[N_data*it+j];
    151                                 }
     160                                for (j=0;j<N_data;j++) data_interp[i*N_data+j]=data[N_data*it+j];
    152161                        }
    153162                }
     
    158167        delete Th;
    159168        xDelete<long>(reft);
     169        xDelete<int>(connectivity);
    160170        *pdata_interp=data_interp;
    161171        return 1;
Note: See TracChangeset for help on using the changeset viewer.