Changeset 19467


Ignore:
Timestamp:
07/30/15 09:31:05 (10 years ago)
Author:
Mathieu Morlighem
Message:

BUG: better handling of P0 interpolation if outside of mesh

File:
1 edited

Legend:

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

    r18453 r19467  
    134134                }
    135135                else{
    136                         for (j=0;j<N_data;j++){
    137                                 if (it<0 || it>=nels_data){
    138                                         _error_("Triangle number " << it << " not in [0 " << nels_data << "], report bug to developers");
     136                        /*For the P0 implementation*/
     137                        /*If we fall outside of the convex or outside of the mesh, return NaN*/
     138                        if(tb.det<0 || reft[it]<0){
     139                                data_interp[i*N_data+j]=-9999;
     140                        }
     141                        else{
     142                                if(it<0 || it>=nels_data){
     143                                        _error_("Triangle number " << it << " not in [0 " << nels_data
     144                                                                << "], report bug to developers (interpolation point: " <<x_interp[i]<<" "<<y_interp[i]<<")");
    139145                                }
    140                                 data_interp[i*N_data+j]=data[N_data*it+j];
     146                                for (j=0;j<N_data;j++){
     147
     148                                        data_interp[i*N_data+j]=data[N_data*it+j];
     149                                }
    141150                        }
    142151                }
Note: See TracChangeset for help on using the changeset viewer.