Changeset 22673


Ignore:
Timestamp:
04/04/18 10:45:49 (7 years ago)
Author:
jdquinn
Message:

CHG: Changes to InterpFromGridToMesh header and JS wrapper.

Location:
issm/trunk-jpl/src/wrappers/InterpFromGridToMesh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.h

    r14996 r22673  
    5151#endif
    5252
     53#ifdef _HAVE_JAVASCRIPT_MODULES_
     54/* serial input macros: */
     55#define XHANDLE       xIn,nodsIn,1
     56#define YHANDLE       yIn,nodsIn,1
     57#define DATAHANDLE    dataIn,nodsIn,1
     58#define XMESHHANDLE   xMeshIn,nodsIn,1
     59#define YMESHHANDLE   yMeshIn,nodsIn,1
     60#define DEFAULTHANDLE defaultValueIn
     61#define INTERPENUM    interpTypeIn
     62/* serial output macros: */
     63#define DATAMESH pdataMesh,NULL
     64#define WRAPPER(modulename) extern "C" { int InterpFromGridToMeshModule(double** pdataMesh, double* xIn, double* yIn, double* dataIn, double* xMeshIn, double* yMeshIn, double defaultValue, int nodsIn, char* interpTypeIn)
     65#endif
     66
    5367/* serial arg counts: */
    5468#undef NLHS
  • TabularUnified issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.js

    r22663 r22673  
    55 *
    66 * Usage:
    7  *      var data_mesh=InterpFromGridToMesh(xIn,yIn,dataIn,xMeshIn,yMeshIn,defaultValue);\
     7 *      var data_mesh=InterpFromGridToMesh(xIn,yIn,dataIn,xMeshIn,yMeshIn,defaultValue,interpType);\
    88 *
    99 *      xIn,yIn                                         : coordinates of matrix data. (x and y must be in increasing order)
    1010 *      dataIn                                          : matrix holding the data to be interpolated onto the mesh
    1111 *      xMeshIn,yMeshIn                         : coordinates of the points onto which we interpolate
    12  *      defaultValue (optional)         : default value if no data is found (holes)
     12 *      defaultValue                            : default value if no data is found (holes)
     13 *      interpType (optional)           : interpolation type
    1314 *      dataMesh                                        : array of mesh interpolated data
    1415 */
    15 function InterpFromGridToMesh(xIn,yIn,dataIn,xMeshIn,yMeshIn,defaultValueIn) {
     16function InterpFromGridToMesh(xIn,yIn,dataIn,xMeshIn,yMeshIn,defaultValue) {
    1617        /*
    1718                Variables
     
    2425        var ddataHeap           = {};
    2526        var ddataPtr            = {};
    26         var defaultValue        = 0; // Default value for defaultValue :)
    2727        var dx                          = {};
    2828        var dxHeap                      = {};
     
    3737        var dyMeshPtr           = {};
    3838        var dyPtr                       = {};
     39        var interpType          = '';
    3940        var ndata                       = {};
    4041        var nods                        = 0;
     
    5051        //}}}
    5152       
    52        
    53         /*
    54                 Retrieve default value
    55         */
    56         //{{{
    57         if (arguments.length === 6) {
    58                 var defaultValue = arguments[5];
    59         }
    60         //}}}
    61        
    62        
     53
    6354        /*
    6455                Dynamic allocations
     
    109100       
    110101        /*
     102                Retrieve interpolation type
     103        */
     104        //{{{
     105        if (arguments.length === 7) {
     106                interpType = arguments[6];
     107        } else {
     108                interpType = 'bilinear';
     109        }
     110        //}}}
     111       
     112        /*
    111113                Output
    112114        */
    113         dataMeshPtr = Module._malloc(4);
     115        pdataMesh = Module._malloc(4);
    114116        //}}}
    115117       
     
    125127                'number',
    126128                [
    127                         'number',
    128                         'number',
    129                         'number',
    130                         'number',
    131                         'number',
    132                         'number',
    133                         'number'
     129                        'number', // output : pdataMesh
     130                        'number', // input      : x
     131                        'number', // input      : y
     132                        'number', // input      : data
     133                        'number', // input      : xMesh
     134                        'number', // input      : yMesh
     135                        'number', // input      : defaultValue
     136                        'number', // input      : nods
     137                        'string', // input      : interpType
    134138                ]
    135139        );
     
    141145        */
    142146        //{{{
    143         InterpFromGrid2MeshModule(
    144                 dataMeshPtr,
     147        InterpFromGridToMeshModule(
     148                pdataMesh,
    145149                x,
    146150                y,
     
    148152                xMesh,
    149153                yMesh,
    150                 nods,
    151                 defaultValue
     154                defaultValue,
     155                nods,
     156                interpType
    152157        );
    153158        //}}}
Note: See TracChangeset for help on using the changeset viewer.