Changeset 19768


Ignore:
Timestamp:
11/19/15 20:01:24 (9 years ago)
Author:
Eric.Larour
Message:

CHG: new EnumToString and StringToEnum javascript modules. New array operations.
Finished translating setflowequation javascript routine. Finished parameterization file
SquareShelfConstrained.js. Starting solve.js routine.

Location:
issm/trunk-jpl
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/array/arrayoperations.js

    r19753 r19768  
    2121        return sum;
    2222} //}}}
     23function ArrayXPY(){ //{{{
     24    if (arguments.length<2)throw Error("ArrayXPY error message: sum has to be for at least two arrays!");
     25
     26        //check internal consistency of arrays provided!:
     27        var firstarray=arguments[0];
     28        var firstsize=firstarray.length;
     29       
     30        for(var a=1;a<arguments.length;a++){
     31                var array=arguments[a];
     32                if(array.length!=firstsize)throw Error("ArrayXPY error message: arrays provided as arguments are not of the same length!");
     33        }
     34
     35        //do the sum:
     36        var sum=NewArrayFill(firstsize,0);
     37        for(var a=0;a<arguments.length;a++){
     38                var array=arguments[a];
     39                for(var i=0;i<array.length;i++){
     40                        sum[i]+=array[i];
     41                }
     42        }
     43        return sum;
     44
     45} //}}}
     46function ArrayOr(){ //{{{
     47    if (arguments.length<2)throw Error("ArrayOr error message: sum has to be for at least two arrays!");
     48
     49        //check internal consistency of arrays provided!:
     50        var firstarray=arguments[0];
     51        var firstsize=firstarray.length;
     52       
     53        for(var a=1;a<arguments.length;a++){
     54                var array=arguments[a];
     55                if(array.length!=firstsize)throw Error("ArrayOr error message: arrays provided as arguments are not of the same length!");
     56        }
     57
     58        //do the or:
     59        var or=NewArrayFill(firstsize,0);
     60        for(var a=0;a<arguments.length;a++){
     61                var array=arguments[a];
     62                for(var i=0;i<array.length;i++){
     63                        or[i] = or[i] | array[i];
     64                }
     65        }
     66        return or;
     67
     68} //}}}
    2369function ArrayMin2D(array){ //{{{
    2470       
     
    99145        return 0;
    100146} //}}}
     147function ArrayAnyEqual(array,value) { //{{{
     148
     149        for(var i=0;i<array.length;i++){
     150                if (array[i]==value)return 1;
     151        }
     152        return 0;
     153} //}}}
    101154function ArrayAnyBelowOrEqual(array,value) { //{{{
    102155
     
    110163        for(var i=0;i<array.length;i++){
    111164                if (array[i]<value)return 1;
     165        }
     166        return 0;
     167} //}}}
     168function ArrayAnyAboveOrEqual(array,value) { //{{{
     169
     170        for(var i=0;i<array.length;i++){
     171                if (array[i]>=value)return 1;
     172        }
     173        return 0;
     174} //}}}
     175function ArrayAnyAboveStrict(array,value) { //{{{
     176
     177        for(var i=0;i<array.length;i++){
     178                if (array[i]>value)return 1;
    112179        }
    113180        return 0;
  • issm/trunk-jpl/src/wrappers/EnumToString/EnumToString.h

    r15106 r19768  
    4040#endif
    4141
     42#ifdef _HAVE_JAVASCRIPT_MODULES_
     43/* serial input macros: */
     44#define ENUMIN enumin
     45/* serial output macros: */
     46#define NAME pstring
     47#define WRAPPER(modulename) extern "C" { int  EnumToStringModule(char** pstring, int enumin)
     48#endif
     49
     50
    4251/* serial arg counts: */
    4352#undef NLHS
  • issm/trunk-jpl/src/wrappers/StringToEnum/StringToEnum.h

    r15106 r19768  
    4040#endif
    4141
     42#ifdef _HAVE_JAVASCRIPT_MODULES_
     43/* serial input macros: */
     44#define NAME string
     45/* serial output macros: */
     46#define ENUMOUT penum
     47#define WRAPPER(modulename) extern "C" { int  StringToEnumModule(double* penum, char* string)
     48#endif
     49
    4250/* serial arg counts: */
    4351#undef NLHS
  • issm/trunk-jpl/src/wrappers/javascript/Makefile.am

    r19753 r19768  
    1212                           ../ElementConnectivity/ElementConnectivity.js\
    1313                           ../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.js\
    14                            ../IssmConfig/IssmConfig.js
     14                           ../IssmConfig/IssmConfig.js\
     15                           ../EnumToString/EnumToString.js\
     16                           ../StringToEnum/StringToEnum.js
    1517       
    1618#javascript io{{{
     
    7981                                         ../ElementConnectivity/ElementConnectivity.cpp\
    8082                                         ../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp\
    81                                          ../IssmConfig/IssmConfig.cpp
     83                                         ../IssmConfig/IssmConfig.cpp\
     84                                         ../EnumToString/EnumToString.cpp\
     85                                         ../StringToEnum/StringToEnum.cpp
    8286
    83 IssmModule_CXXFLAGS= -fPIC -D_DO_NOT_LOAD_GLOBALS_ --memory-init-file 0 $(AM_CXXFLAGS) $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) -s EXPORTED_FUNCTIONS="['_TriMeshModule','_NodeConnectivityModule','_ElementConnectivityModule','_InterpFromMeshToMesh2dModule','_IssmConfigModule']"  -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1
     87IssmModule_CXXFLAGS= -fPIC -D_DO_NOT_LOAD_GLOBALS_ --memory-init-file 0 $(AM_CXXFLAGS) $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) -s EXPORTED_FUNCTIONS="['_TriMeshModule','_NodeConnectivityModule','_ElementConnectivityModule','_InterpFromMeshToMesh2dModule','_IssmConfigModule','_EnumToStringModule','_StringToEnumModule']"  -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1
    8488IssmModule_LDADD = ${deps} $(TRIANGLELIB)
    8589#}}}
  • issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp

    r19753 r19768  
    2222}
    2323/*}}}*/
     24/*FUNCTION FetchData(int* pinteger,int integer){{{*/
     25void FetchData(int* pinteger,int integer){
     26       
     27        *pinteger = integer;
     28}
     29/*}}}*/
    2430/*FUNCTION FetchData(double* pscalar,double scalar){{{*/
    2531void FetchData(double* pscalar,double scalar){
    2632       
    2733        *pscalar = scalar;
    28 }
    29 /*}}}*/
    30 /*FUNCTION FetchData(double* pscalar,double scalar){{{*/
    31 void FetchData(int* pinteger,int integer){
    32        
    33         *pinteger = integer;
    3434}
    3535/*}}}*/
  • issm/trunk-jpl/src/wrappers/javascript/io/javascriptio.h

    r19753 r19768  
    3636void FetchData(Contours** pcontours,double* x, double* y, int nods);
    3737void FetchData(Options** poptions,int NRHS, int nrhs, const char* optionname, double optionvalue);
     38void FetchData(int* pinteger,int integer);
    3839
    3940/*Print*/
  • issm/trunk-jpl/test/Exp/Square.js

    r19702 r19768  
    33// Points Count  Value
    44var square={}
    5 square["nods"]=5;
     5square[0]={};
     6square[0]["nods"]=5;
    67// X pos Y pos
    7 square["x"]=[0,1000000,1000000,0,0];
    8 square["y"]=[0, 0, 1000000,  1000000, 0];
     8square[0]["x"]=[0,1000000,1000000,0,0];
     9square[0]["y"]=[0, 0, 1000000,  1000000, 0];
  • issm/trunk-jpl/test/Par/SquareShelfConstrained.js

    r19753 r19768  
    5252        //Numerical parameters
    5353        md.stressbalance.viscosity_overshoot=0.0;
    54         return;
    5554        md.masstransport.stabilization=1;
    5655        md.thermal.stabilization=1;
    57         md.verbose=verbose(0);
     56        md.verbose=new verbose(0);
    5857        md.settings.waitonlock=30;
    5958        md.stressbalance.restol=0.05;
     
    6564
    6665        //Deal with boundary conditions:
    67         md=SetIceShelfBC(md);
     66        SetIceShelfBC(md);
    6867
    6968        //Change name so that no tests have the same name
    70         //A=dbstack;
    71         //if (length(A)>2), md.miscellaneous.name=A(3).file(1:end-2); end
    72 
     69        md.miscellaneous.name='test101';
    7370}
Note: See TracChangeset for help on using the changeset viewer.