Changeset 28008


Ignore:
Timestamp:
11/14/23 13:46:21 (16 months ago)
Author:
jdquinn
Message:

CHG: Fixes for JavaScript I/O; cleanup

Location:
issm/trunk-jpl/src/wrappers
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp

    r24304 r28008  
    1 /*\file FetchData.cpp:
     1/* \file FetchJavascriptData.cpp:
    22 * \brief: general I/O interface to fetch data in javascript
    33 */
     
    2222}
    2323/*}}}*/
     24/*FUNCTION FetchData(double* pscalar, double scalar){{{*/
     25void FetchData(double* pscalar, double scalar){
     26        *pscalar=scalar;
     27}
     28/*}}}*/
    2429/*FUNCTION FetchData(int* pinteger, int integer){{{*/
    2530void FetchData(int* pinteger, int integer){
     
    2732}
    2833/*}}}*/
    29 /*FUNCTION FetchData(double* pscalar, double scalar){{{*/
    30 void FetchData(double* pscalar, double scalar){
    31         *pscalar=scalar;
    32 }
    33 /*}}}*/
    3434/*FUNCTION FetchData(double **pvector, double* vectorin, int nods){{{*/
    3535void FetchData(double** pvector, double* vectorin, int nods){
     
    4949        *pvector=vector;
    5050        *pnods=nods;
     51}
     52/*}}}*/
     53/*FUNCTION FetchData(double **pmatrix, int* pM, int* matrix, int M, int N){{{*/
     54void FetchData(double **pmatrix, int* pM, int* matrixin, int M, int N){
     55        double*  outmatrix=NULL;
     56        int      outmatrix_rows;
     57
     58        if(M == 0 || N == 0){
     59                /*Nothing to pick up. Just initialize matrix pointer to NULL: */
     60                outmatrix_rows=0;
     61                outmatrix=NULL;
     62        }
     63        else if (pmatrix && matrixin){
     64                outmatrix_rows=M;
     65                outmatrix=xNew<IssmPDouble>(M*N);
     66                for(int i=0;i<M*N;i++){outmatrix[i]=(IssmPDouble)matrixin[i];}
     67        }
     68
     69        /*Assign output pointers:*/
     70        *pmatrix=outmatrix;
     71        if (pM){*pM=outmatrix_rows;}
    5172}
    5273/*}}}*/
     
    6283                outmatrix=NULL;
    6384        }
    64     else if (pmatrix && matrixin){
     85        else if (pmatrix && matrixin){
    6586                outmatrix_rows=M;
    6687                outmatrix_cols=N;
     
    7394        if (pM){*pM=outmatrix_rows;}
    7495        if (pN){*pN=outmatrix_cols;}
     96}
     97/*}}}*/
     98/*FUNCTION FetchData(double **pmatrix, int* pM, double* matrix, int M, int N){{{*/
     99void FetchData(double **pmatrix, int* pM, double* matrixin, int M, int N){
     100        double*  outmatrix=NULL;
     101        int      outmatrix_rows;
     102
     103        if(M == 0 || N == 0){
     104                /*Nothing to pick up. Just initialize matrix pointer to NULL: */
     105                outmatrix_rows=0;
     106                outmatrix=NULL;
     107        }
     108        else if (pmatrix && matrixin){
     109                outmatrix_rows=M;
     110                outmatrix=xNew<IssmPDouble>(M*N); xMemCpy<IssmPDouble>(outmatrix,matrixin,M*N);
     111        }
     112
     113        /*Assign output pointers:*/
     114        *pmatrix=outmatrix;
     115        if (pM){*pM=outmatrix_rows;}
    75116}
    76117/*}}}*/
     
    86127                outmatrix=NULL;
    87128        }
    88     else if (pmatrix && matrixin){
     129        else if (pmatrix && matrixin){
    89130                outmatrix_rows=M;
    90131                outmatrix_cols=N;
     
    96137        if (pM){*pM=outmatrix_rows;}
    97138        if (pN){*pN=outmatrix_cols;}
     139}
     140/*}}}*/
     141/*FUNCTION FetchData(int **pmatrix, int* pM, int* matrix, int M, int N){{{*/
     142void FetchData(int **pmatrix, int* pM, int* matrixin, int M, int N){
     143        int*     outmatrix=NULL;
     144        int      outmatrix_rows;
     145
     146        if(M == 0 || N == 0){
     147                /*Nothing to pick up. Just initialize matrix pointer to NULL: */
     148                outmatrix_rows=0;
     149                outmatrix=NULL;
     150        }
     151        else if (pmatrix && matrixin){
     152                outmatrix_rows=M;
     153                outmatrix=xNew<int>(M*N); xMemCpy<int>(outmatrix,matrixin,M*N);
     154        }
     155
     156        /*Assign output pointers:*/
     157        *pmatrix=outmatrix;
     158        if (pM){*pM=outmatrix_rows;}
    98159}
    99160/*}}}*/
     
    109170                outmatrix=NULL;
    110171        }
    111     else if (pmatrix && matrixin){
     172        else if (pmatrix && matrixin){
    112173                outmatrix_rows=M;
    113174                outmatrix_cols=N;
     
    187248        BamgOpts *bamgopts      = new BamgOpts();
    188249
    189     /*Parameters*/
    190     bamgopts->anisomax      = anisomax;
    191     bamgopts->coeff             = coeff;
    192     bamgopts->cutoff            = cutoff;
    193     bamgopts->errg              = errg;
    194     bamgopts->gradation     = gradation;
    195     bamgopts->Hessiantype       = Hessiantype;
    196     bamgopts->maxnbv        = maxnbv;
    197     bamgopts->maxsubdiv     = maxsubdiv;
    198     bamgopts->Metrictype        = Metrictype;
    199     bamgopts->nbjacobi      = nbjacobi;
    200     bamgopts->nbsmooth      = nbsmooth;
    201     bamgopts->omega             = omega;
    202     bamgopts->power             = power;
    203     bamgopts->verbose       = verbose;
    204 
    205     /*Flags*/
    206     bamgopts->Crack             = Crack;
    207     bamgopts->KeepVertices      = KeepVertices;
    208     bamgopts->splitcorners      = splitcorners;
    209 
    210     /*Metric related*/
    211     bamgopts->hmin              = hmin;
    212     bamgopts->hmax              = hmax;
     250        /*Parameters*/
     251        bamgopts->anisomax          = anisomax;
     252        bamgopts->coeff         = coeff;
     253        bamgopts->cutoff        = cutoff;
     254        bamgopts->errg          = errg;
     255        bamgopts->gradation         = gradation;
     256        bamgopts->Hessiantype   = Hessiantype;
     257        bamgopts->maxnbv            = maxnbv;
     258        bamgopts->maxsubdiv         = maxsubdiv;
     259        bamgopts->Metrictype    = Metrictype;
     260        bamgopts->nbjacobi          = nbjacobi;
     261        bamgopts->nbsmooth          = nbsmooth;
     262        bamgopts->omega         = omega;
     263        bamgopts->power         = power;
     264        bamgopts->verbose           = verbose;
     265
     266        /*Flags*/
     267        bamgopts->Crack         = Crack;
     268        bamgopts->KeepVertices  = KeepVertices;
     269        bamgopts->splitcorners  = splitcorners;
     270
     271        /*Metric related*/
     272        bamgopts->hmin          = hmin;
     273        bamgopts->hmax          = hmax;
    213274        FetchData(&bamgopts->hminVertices, &bamgopts->hminVerticesSize[0], &bamgopts->hminVerticesSize[1], hminVertices, hminVerticesSize[0], hminVerticesSize[1]);
    214275        FetchData(&bamgopts->hmaxVertices, &bamgopts->hmaxVerticesSize[0], &bamgopts->hmaxVerticesSize[1], hmaxVertices, hmaxVerticesSize[0], hmaxVerticesSize[1]);
  • issm/trunk-jpl/src/wrappers/javascript/io/WriteJavascriptData.cpp

    r22896 r28008  
    1 /* \file WriteData.c:
    2  * \brief: general interface for writing data
     1/* \file WriteJavascriptData.cpp:
     2 * \brief: general I/O interface to fetch data in javascript
    33 */
    44
  • issm/trunk-jpl/src/wrappers/javascript/io/javascriptio.h

    r24295 r28008  
    1 /*\file matlabio.h
    2  *\brief: I/O for ISSM in matlab mode
     1/*\file javascriptio.h
     2 *s\brief: I/O for ISSM in javascript mode
    33 */
    44
     
    3232
    3333void FetchData(char** pstring, char* stringin);
    34 void FetchData(double* pscalar,double scalar);
     34void FetchData(double* pscalar, double scalar);
    3535void FetchData(int* pinteger,int integer);
    3636void FetchData(double** pvector, double* vectorin, int nods);
    3737void FetchData(double** pvector, int* pnods, double* vectorin, int nods);
    38 void FetchData(double **pmatrix, int* pM, int* pN, int* matrixin, int M, int N);
    39 void FetchData(double **pmatrix, int* pM, int* pN, double* matrixin, int M, int N);
    40 void FetchData(int **pmatrix, int* pM, int* pN, int* matrixin, int M, int N);
     38void FetchData(double** pmatrix, int* pM, int* matrixin, int M, int N);
     39void FetchData(double** pmatrix, int* pM, int* pN, int* matrixin, int M, int N);
     40void FetchData(double** pmatrix, int* pM, double* matrixin, int M, int N);
     41void FetchData(double** pmatrix, int* pM, int* pN, double* matrixin, int M, int N);
     42void FetchData(int** pmatrix, int* pM, int* matrixin, int M, int N);
     43void FetchData(int** pmatrix, int* pM, int* pN, int* matrixin, int M, int N);
    4144void FetchData(Contours** pcontours,double* x, double* y, int nods);
    4245void FetchData(BamgGeom** pbamggeom, int* VerticesSize, double* Vertices, int* EdgesSize, double* Edges, int* CornersSize, double* Corners, int* RequiredVerticesSize, double* RequiredVertices, int* RequiredEdgesSize, double* RequiredEdges, int* CrackedEdgesSize, double* CrackedEdges, int* SubDomainsSize, double* SubDomains);
  • issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp

    r27707 r28008  
    1 /*\file FetchData.cpp:
    2  * \brief: general I/O interface to fetch data in matlab
     1/*\file FetchMatlabData.cpp:
     2 *\brief: general I/O interface to fetch data in matlab
    33 */
    44
  • issm/trunk-jpl/src/wrappers/matlab/io/WriteMatlabData.cpp

    r27796 r28008  
    1 /* \file WriteData.c:
    2  * \brief: general interface for writing data
     1/*\file WriteMatlabData.c:
     2 *\brief: general I/O interface to write data in matlab
    33 */
    44
  • issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp

    r27528 r28008  
    1 /*\file FetchData.cpp:
    2  * \brief: general I/O interface to fetch data in python
     1/*\file FetchPythonData.cpp:
     2 *\brief: general I/O interface to fetch data in python
    33 */
    44
  • issm/trunk-jpl/src/wrappers/python/io/WritePythonData.cpp

    r23708 r28008  
    1 /* \file WriteData.c:
    2  * \brief: general interface for writing data
     1/*\file WritePythonData.cpp:
     2 *\brief: general I/O interface to write data in matlab
    33 */
    44
Note: See TracChangeset for help on using the changeset viewer.