Changeset 12946


Ignore:
Timestamp:
08/08/12 14:38:52 (13 years ago)
Author:
cborstad
Message:

CHG: merged trunk-jpl into branch through revision 12945

Location:
issm/branches/trunk-jpl-damage
Files:
9 deleted
113 edited
24 copied

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-jpl-damage

  • issm/branches/trunk-jpl-damage/configs/config-arm-linux.sh

    r12878 r12946  
    99        --without-modules \
    1010        --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
    11         --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install
     11        --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
     12    --disable-static
  • issm/branches/trunk-jpl-damage/configure.ac

    r12878 r12946  
    2121AM_SILENT_RULES([yes])           #Do not show compilation command by default
    2222AM_PROG_CC_C_O
    23 
    2423AM_PROG_AR
    25 AC_PROG_RANLIB
     24AC_PROG_RANLIB 
    2625
    2726# To produce shared libraries uncomment LT_INIT. In theory, Libtool can be initialized
    2827# even if all linking is static, since, if not shared libraries are to be produce, libtool
    2928# will act simply as a wrapper around AR and Ranlib.
    30 #
    3129#LT_INIT
    3230
    3331#Run issm_options.m4
    3432ISSM_OPTIONS
    35 
    36 #AM_PROG_AR must be placed after ISSM_OPTIONS
    3733
    3834#List all Makefiles
  • issm/branches/trunk-jpl-damage/etc/environment.sh

    r12878 r12946  
    278278export LD_RUN_PATH="$LD_RUN_PATH:$TCLX_DIR"
    279279
     280#TCL/TK
     281export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
     282export LD_RUN_PATH="$LD_RUN_PATH:/usr/local/lib"
    280283
    281284#ASPELL
  • issm/branches/trunk-jpl-damage/externalpackages/gsl/install-android.sh

    r12878 r12946  
    1010
    1111    #Download from ISSM server
    12     $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/gsl-1.15.tar.gz' 'gsl-1.15.tar.gz'
     12    $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/gsl-1.' 'gsl-1.15.tar.gz'
    1313
    1414    #Untar
     
    2828    ./configure \
    2929        --build="i386-apple-darwin10.8.0" \
    30         --host=$host_triplet\
    31             --prefix="$ISSM_DIR/externalpackages/gsl/install/"
     30        --host=$host_triplet \
     31            --prefix="$ISSM_DIR/externalpackages/gsl/install/" \
     32        --disable-static
    3233fi
    3334
  • issm/branches/trunk-jpl-damage/externalpackages/libtool/install.sh

    r12878 r12946  
    66
    77#Download from ISSM server
    8 $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' 'libtool'
     8$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool-2.4.2.tar.gz' 'libtool-2.4.2.tar.gz'
    99
    1010#Untar
    11 tar -zxvf  libtool[\w.-]*.tar.gz
    12 rm libtool[\w.-]*.tar.gz
    13 
     11tar -zxvf  libtool-2.4.2.tar.gz
     12rm libtool-2.4.2.tar.gz
    1413
    1514#Move libtool into src directory
    16 mv libtool[\w.-]* src
     15mv libtool-2.4.2 src
    1716
    1817#Compile libtool
  • issm/branches/trunk-jpl-damage/externalpackages/matplotlib/install-osx.sh

    r12258 r12946  
    22pythonversion=2.7
    33PYTHON=python${pythonversion}
     4
     5export GIT_SSL_NO_VERIFY=true
     6export CC="gcc -fPIC"
     7export CXX="g++ -fPIC"
     8export F77="gfortran -fPIC"
     9export FC="gfortran -fPIC"
     10export FFLAGS=-ff2c
     11
    412
    513git clone https://github.com/matplotlib/matplotlib
     
    715mkdir deps
    816cd src
     17exit
    918make -f make.osx PREFIX=$ISSM_DIR/externalpackages/matplotlib/deps PYVERSION=$pythonversion fetch deps mpl_install_std
    1019${PYTHON} -c "import matplotlib; print 'Installed matplotlib', matplotlib.__version__, matplotlib.__file__"
  • issm/branches/trunk-jpl-damage/externalpackages/matplotlib/install.sh

    r12143 r12946  
    11#/bin/bash
     2pythonversion=2.7
     3PYTHON=python${pythonversion}
     4
     5export GIT_SSL_NO_VERIFY=true
     6export CC="gcc -fPIC "
     7export CXX="g++ -fPIC -L$ISSM_DIR/externalpackages/tcl/install/lib"
     8export F77="gfortran -fPIC"
     9export FC="gfortran -fPIC"
     10export FFLAGS=-ff2c
     11
    212
    313git clone https://github.com/matplotlib/matplotlib
    414mv matplotlib src
    515cd src
    6 python setup.py build
    7 python setup.py install
     16python setup.py build 
     17python setup.py install 
  • issm/branches/trunk-jpl-damage/externalpackages/mpich2/install-1.4-linux64.sh

    r12258 r12946  
    3232fi
    3333make install
    34 
    35 #remove so files
    36 cd ../install/lib
    37 rm -rf *.so
  • issm/branches/trunk-jpl-damage/externalpackages/mpich2/install-1.4-macosx32.sh

    r12258 r12946  
    3535fi
    3636make install
    37 
    38 #remove so files
    39 cd ../install/lib
    40 rm -rf *.so
  • issm/branches/trunk-jpl-damage/externalpackages/mpich2/install-1.4-macosx64.sh

    r12258 r12946  
    3535fi
    3636make install
    37 
    38 #remove so files
    39 cd ../install/lib
    40 rm -rf *.so
  • issm/branches/trunk-jpl-damage/externalpackages/tcl/install.sh

    r12719 r12946  
    11#!/bin/bash
     2
     3sudochoice=0;
    24
    35#Some cleanup
     
    2022ver="8.4.12"
    2123
    22 cd src
    23 make -C ./macosx install INSTALL_ROOT="$ISSM_DIR/externalpackages/tcl/install"
     24cd src/unix
     25
     26#User mode:
     27if [[ $sudochoice == "0" ]];
     28then
     29        ./configure --prefix=$ISSM_DIR/externalpackages/tcl/install
     30        if [ -z $1 ]; then
     31                make
     32        else
     33                make -j $1
     34        fi
     35        make install
     36fi
     37
     38#sudo mode:
     39if [[ $sudochoice == "1" ]];
     40then
     41        sudo ./configure
     42        if [ -z $1 ]; then
     43                sudo make
     44        else
     45                sudo make -j $1
     46        fi
     47        sudo make install
     48fi
  • issm/branches/trunk-jpl-damage/externalpackages/triangle/install-android.sh

    r12878 r12946  
    11#!/bin/bash
    2 source $ANDROID_DIR/android_aux.sh
    32
    4 # use matlab?
    5 matlab=0
    6 
    7 # Some cleanup
     3#Some cleanup
    84rm -rf install triangle
    95mkdir install
    106
    11 # Download from ISSM server
     7#Download from ISSM server
    128$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/triangle.zip' 'triangle.zip'
    139
    14 # Untar
     10#Untar
    1511cd install
    1612cp ../triangle.zip ./
    1713unzip triangle.zip
    1814
    19 # copy new makefile
    20 cp ../configs//android/configure.make ./
     15#copy new makefile
     16cp ../configs/android/configure.make ./
    2117cp ../makefile ./
    2218
    23 # Patch triangle.c
    24 if [[ $matlab == "1" ]];then
    25         patch triangle.c ../triangle.c.patch.matlab
    26 else
    27         patch triangle.c ../triangle.c.patch.python
    28 fi
     19#Patch triangle.c
     20patch triangle.c ../triangle.c.patch
    2921
    30 # Compile triangle
    31 make -j $j
     22#Compile triangle
     23make
    3224
    33 # Patch triangle.h
     25#Patch triangle.h
    3426patch triangle.h ../triangle.h.patch
  • issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/Synchronize.sh

    r12878 r12946  
    1515cat c.vim | sed "/ISSM's objects begin/,/vim: ts=8/d" > temp
    1616echo "\"ISSM's objects begin" >> temp
    17 cat ../../../../../src/c/objects/objects.h  | grep "\.h" | sed -e "s/\// /g" -e "s/\.h\"//" | awk '{print  $(NF)}' | awk '{ printf "syn keyword cType " $1 "\n"}' >> temp
    18 echo "\"ISSM's objects end" >> temp
     17find ../../../../../src/c/classes -name "*.h" | sed -e "s/\// /g" -e "s/\.h//"| awk '{print  $(NF)}' | awk '{ printf "syn keyword cType " $1 "\n"}'>> temp
    1918cat c.vim | sed "1,/ISSM's objects end/d" >> temp
    2019
  • issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/c.vim

    r12878 r12946  
    411411
    412412"ISSM's objects begin
    413 syn keyword cType objects.h
    414 syn keyword cType Object
     413syn keyword cType AdjacentTriangle
     414syn keyword cType BamgGeom
     415syn keyword cType BamgMesh
     416syn keyword cType bamgobjects
     417syn keyword cType BamgOpts
     418syn keyword cType BamgQuadtree
     419syn keyword cType BamgVertex
     420syn keyword cType CrackedEdge
     421syn keyword cType Curve
     422syn keyword cType Direction
     423syn keyword cType DoubleAndInt
     424syn keyword cType Edge
     425syn keyword cType GeomEdge
     426syn keyword cType Geometry
     427syn keyword cType GeomSubDomain
     428syn keyword cType GeomVertex
     429syn keyword cType include
     430syn keyword cType ListofIntersectionTriangles
     431syn keyword cType macros
     432syn keyword cType Mesh
     433syn keyword cType Metric
     434syn keyword cType R2
     435syn keyword cType SetOfE4
     436syn keyword cType SubDomain
     437syn keyword cType Triangle
     438syn keyword cType typedefs
     439syn keyword cType VertexOnEdge
     440syn keyword cType VertexOnGeom
     441syn keyword cType VertexOnVertex
     442syn keyword cType classes
     443syn keyword cType DakotaPlugin
     444syn keyword cType DofIndexing
     445syn keyword cType FemModel
     446syn keyword cType gaussobjects
     447syn keyword cType GaussPenta
     448syn keyword cType GaussTria
    415449syn keyword cType Hook
    416 syn keyword cType DofIndexing
    417 syn keyword cType Vertex
    418 syn keyword cType Node
    419 syn keyword cType Segment
    420450syn keyword cType IoModel
    421 syn keyword cType Patch
    422 syn keyword cType Update
     451syn keyword cType ExponentialVariogram
     452syn keyword cType GaussianVariogram
     453syn keyword cType krigingobjects
     454syn keyword cType Observation
     455syn keyword cType PowerVariogram
     456syn keyword cType Quadtree
     457syn keyword cType SphericalVariogram
     458syn keyword cType Variogram
     459syn keyword cType ElementMatrix
     460syn keyword cType ElementVector
     461syn keyword cType Matrix
     462syn keyword cType matrixobjects
     463syn keyword cType Vector
    423464syn keyword cType Constraint
     465syn keyword cType SpcDynamic
    424466syn keyword cType SpcStatic
    425467syn keyword cType SpcTransient
    426 syn keyword cType SpcDynamic
    427 syn keyword cType GaussTria
    428 syn keyword cType GaussPenta
    429 syn keyword cType Load
    430 syn keyword cType Friction
    431 syn keyword cType Icefront
    432 syn keyword cType Numericalflux
    433 syn keyword cType Riftfront
    434 syn keyword cType Penpair
    435 syn keyword cType Pengrid
     468syn keyword cType Contour
     469syn keyword cType BoolElementResult
     470syn keyword cType DoubleElementResult
     471syn keyword cType ElementResult
     472syn keyword cType ElementResultLocal
     473syn keyword cType PentaP1ElementResult
     474syn keyword cType TriaP1ElementResult
    436475syn keyword cType Element
    437476syn keyword cType Penta
     
    441480syn keyword cType TriaHook
    442481syn keyword cType TriaRef
     482syn keyword cType BoolExternalResult
     483syn keyword cType DoubleExternalResult
     484syn keyword cType DoubleMatExternalResult
     485syn keyword cType DoubleVecExternalResult
     486syn keyword cType ExternalResult
     487syn keyword cType IntExternalResult
     488syn keyword cType PetscVecExternalResult
     489syn keyword cType StringExternalResult
     490syn keyword cType BoolInput
     491syn keyword cType ControlInput
     492syn keyword cType DatasetInput
     493syn keyword cType DoubleInput
     494syn keyword cType Input
     495syn keyword cType IntInput
     496syn keyword cType PentaP1Input
     497syn keyword cType TransientInput
     498syn keyword cType TriaP1Input
    443499syn keyword cType KML_Attribute
     500syn keyword cType KML_ColorStyle
    444501syn keyword cType KML_Comment
    445 syn keyword cType KML_ColorStyle
    446502syn keyword cType KML_Container
    447503syn keyword cType KML_Document
     
    459515syn keyword cType KML_Object
    460516syn keyword cType KML_Overlay
     517syn keyword cType KML_Placemark
    461518syn keyword cType KML_Point
    462 syn keyword cType KML_Placemark
    463519syn keyword cType KML_Polygon
    464520syn keyword cType KML_PolyStyle
     
    468524syn keyword cType KML_Unknown
    469525syn keyword cType KMLFileReadUtils
    470 syn keyword cType Option
    471 syn keyword cType OptionDouble
    472 syn keyword cType OptionLogical
    473 syn keyword cType OptionChar
    474 syn keyword cType OptionStruct
    475 syn keyword cType OptionCell
    476 syn keyword cType OptionUtilities
    477 syn keyword cType Input
    478 syn keyword cType BoolInput
    479 syn keyword cType DoubleInput
    480 syn keyword cType IntInput
    481 syn keyword cType PentaP1Input
    482 syn keyword cType TriaP1Input
    483 syn keyword cType ControlInput
    484 syn keyword cType DatasetInput
    485 syn keyword cType TransientInput
    486 syn keyword cType ElementResult
    487 syn keyword cType DoubleElementResult
    488 syn keyword cType TriaP1ElementResult
    489 syn keyword cType PentaP1ElementResult
    490 syn keyword cType BoolElementResult
    491 syn keyword cType ExternalResult
    492 syn keyword cType BoolExternalResult
    493 syn keyword cType DoubleExternalResult
    494 syn keyword cType DoubleVecExternalResult
    495 syn keyword cType DoubleMatExternalResult
    496 syn keyword cType IntExternalResult
    497 syn keyword cType PetscVecExternalResult
    498 syn keyword cType StringExternalResult
     526syn keyword cType Friction
     527syn keyword cType Icefront
     528syn keyword cType Load
     529syn keyword cType Numericalflux
     530syn keyword cType Pengrid
     531syn keyword cType Penpair
     532syn keyword cType Riftfront
    499533syn keyword cType Material
    500534syn keyword cType Matice
    501535syn keyword cType Matpar
    502 syn keyword cType ElementMatrix
    503 syn keyword cType ElementVector
    504 syn keyword cType Vector
    505 syn keyword cType Matrix
     536syn keyword cType Node
     537syn keyword cType Object
     538syn keyword cType objects
     539syn keyword cType Option
     540syn keyword cType OptionCell
     541syn keyword cType OptionChar
     542syn keyword cType OptionDouble
     543syn keyword cType OptionLogical
     544syn keyword cType OptionStruct
     545syn keyword cType OptionUtilities
    506546syn keyword cType BoolParam
     547syn keyword cType DoubleMatArrayParam
    507548syn keyword cType DoubleMatParam
     549syn keyword cType DoubleParam
    508550syn keyword cType DoubleTransientMatParam
    509 syn keyword cType DoubleMatArrayParam
    510 syn keyword cType DoubleParam
    511551syn keyword cType DoubleVecParam
     552syn keyword cType FileParam
     553syn keyword cType IntMatParam
    512554syn keyword cType IntParam
    513555syn keyword cType IntVecParam
    514 syn keyword cType IntMatParam
    515 syn keyword cType FileParam
     556syn keyword cType MatrixParam
    516557syn keyword cType Param
    517 syn keyword cType MatrixParam
    518 syn keyword cType VectorParam
    519558syn keyword cType StringArrayParam
    520559syn keyword cType StringParam
    521 syn keyword cType Contour
    522 syn keyword cType FemModel
     560syn keyword cType TransientParam
     561syn keyword cType VectorParam
     562syn keyword cType Segment
     563syn keyword cType Vertex
     564syn keyword cType objects
    523565syn keyword cType OptArgs
    524566syn keyword cType OptPars
  • issm/branches/trunk-jpl-damage/m4/issm_options.m4

    r12878 r12946  
    173173                MATLABINCL=-I"$MATLAB_ROOT/extern/include";
    174174               
    175                 dnl OS-dependent variables and checks
    176                 case "${host_os}" in
    177                         *linux*)
    178                                 if test "${host_cpu}" = "x86_64";
    179                                 then
    180                                         MEXLIB=-L"$MATLAB_ROOT/bin/glnxa64/ -lmex"
    181                                         MEXLINK="-pthread -shared -W2,--version-script,${MATLAB_ROOT}/extern/lib/glnxa64/mexFunction.map";
    182                                 else
    183                                         MEXLIB=-L"$MATLAB_ROOT/bin/glnx86/ -lmex"
    184                                         MEXLINK="-pthread -shared -W2,--version-script,${MATLAB_ROOT}/extern/lib/glnx86/mexFunction.map";
    185                                 fi
    186                                 MEXEXT=`$MATLAB_ROOT/bin/mexext`
    187                                 MEXEXT=".$MEXEXT"
    188                         ;;
    189                         *darwin*)
    190                                 dnl mex -v gives all the flags for compilation of mex files
    191                                 dnl if matlab version is 7.9 or more, we must use mexmaci64 (64 bits)
    192                                 MEXLINK="-O -Wl,-flat_namespace -undefined suppress -arch i386 -bundle -Wl,-exported_symbols_list,$MATLAB_ROOT/extern/lib/maci/mexFunction.map"
    193                                 MEXLIB=" -L$MATLAB_ROOT/bin/maci/ -lmx -lmex -lmat -lstdc++ -largeArrayDims"
    194                                 if test $MATLAB_MAJOR -ge 7; then
    195                                          if test $MATLAB_MINOR -ge 9; then
    196                                                   MEXLINK="-O -Wl,-flat_namespace -undefined suppress -bundle -Wl,-exported_symbols_list,$MATLAB_ROOT/extern/lib/maci64/mexFunction.map"
    197                                                          MEXLIB=" -L$MATLAB_ROOT/bin/maci64/ -lmx -lmex -lmat -lstdc++"
    198                                          fi
    199                                 fi
    200                                 MEXEXT=`$MATLAB_ROOT/bin/mexext`
    201                                 MEXEXT=".$MEXEXT"
    202                         ;;
    203                         *cygwin*)
    204                                 if  test $VENDOR = intel-win7-32; then
    205                                         MEXLIB="-dll -export:mexFunction -LIBPATH:\"$MATLAB_ROOT\extern\lib\win32\microsoft\" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  -NOLOGO -INCREMENTAL:NO -manifest"
    206                                 elif  test $VENDOR = intel-win7-64; then
    207                                         MEXLIB="-dll -export:mexFunction -LIBPATH:\"$MATLAB_ROOT\extern\lib\win64\microsoft\" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  -NOLOGO -INCREMENTAL:NO -manifest"
    208                                 fi
    209                                 MEXEXT=`$MATLAB_ROOT/bin/mexext.bat`
    210                                 MEXEXT=".$MEXEXT"
    211                         ;;
    212                 esac
     175                dnl 4. get MEXLIB MEXLINK and MEXEXT (experimental)
     176                MEXLINK=$(mex -v 2>&1 < /dev/null | grep LDFLAGS     | sed -e "s/         LDFLAGS            = //g")
     177                MEXLIB=$( mex -v 2>&1 < /dev/null | grep CXXLIBS     | sed -e "s/         CXXLIBS            = //g")
     178                MEXEXT=$( mex -v 2>&1 < /dev/null | grep LDEXTENSION | sed -e "s/         LDEXTENSION        = //g")
     179                dnl dnl OS-dependent variables and checks (old stuff)
     180                dnl case "${host_os}" in
     181                dnl     *linux*)
     182                dnl             if test "${host_cpu}" = "x86_64";
     183                dnl             then
     184                dnl                     MEXLIB="-Wl,-rpath-link,$MATLAB_ROOT/bin/glnxa64 -L$MATLAB_ROOT/bin/glnxa64/ -lmx -lmex -lmat -lm"
     185                dnl                     MEXLINK="-pthread -shared -W2,--version-script,${MATLAB_ROOT}/extern/lib/glnxa64/mexFunction.map";
     186                dnl             else
     187                dnl                     MEXLIB=-L"$MATLAB_ROOT/bin/glnx86/ -lmex"
     188                dnl                     MEXLINK="-pthread -shared -W2,--version-script,${MATLAB_ROOT}/extern/lib/glnx86/mexFunction.map";
     189                dnl             fi
     190                dnl             MEXEXT=`$MATLAB_ROOT/bin/mexext`
     191                dnl             MEXEXT=".$MEXEXT"
     192                dnl     ;;
     193                dnl     *darwin*)
     194                dnl             dnl mex -v gives all the flags for compilation of mex files
     195                dnl             dnl if matlab version is 7.9 or more, we must use mexmaci64 (64 bits)
     196                dnl             MEXLINK="-O -Wl,-flat_namespace -undefined suppress -arch i386 -bundle -Wl,-exported_symbols_list,$MATLAB_ROOT/extern/lib/maci/mexFunction.map"
     197                dnl             MEXLIB=" -L$MATLAB_ROOT/bin/maci/ -lmx -lmex -lmat -lstdc++ -largeArrayDims"
     198                dnl             if test $MATLAB_MAJOR -ge 7; then
     199                dnl                      if test $MATLAB_MINOR -ge 9; then
     200                dnl                               MEXLINK="-O -Wl,-flat_namespace -undefined suppress -bundle -Wl,-exported_symbols_list,$MATLAB_ROOT/extern/lib/maci64/mexFunction.map"
     201                dnl                                      MEXLIB=" -L$MATLAB_ROOT/bin/maci64/ -lmx -lmex -lmat -lstdc++"
     202                dnl                      fi
     203                dnl             fi
     204                dnl             MEXEXT=`$MATLAB_ROOT/bin/mexext`
     205                dnl             MEXEXT=".$MEXEXT"
     206                dnl     ;;
     207                dnl     *cygwin*)
     208                dnl             if  test $VENDOR = intel-win7-32; then
     209                dnl                     MEXLIB="-dll -export:mexFunction -LIBPATH:\"$MATLAB_ROOT\extern\lib\win32\microsoft\" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  -NOLOGO -INCREMENTAL:NO -manifest"
     210                dnl             elif  test $VENDOR = intel-win7-64; then
     211                dnl                     MEXLIB="-dll -export:mexFunction -LIBPATH:\"$MATLAB_ROOT\extern\lib\win64\microsoft\" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  -NOLOGO -INCREMENTAL:NO -manifest"
     212                dnl             fi
     213                dnl             MEXEXT=`$MATLAB_ROOT/bin/mexext.bat`
     214                dnl             MEXEXT=".$MEXEXT"
     215                dnl     ;;
     216                dnl esac
    213217           AC_MSG_RESULT(done)
    214218
     
    501505                HAVE_GSL=yes
    502506                GSLINCL="-I$GSL_ROOT/include"
    503                 GSLLIB="-dy -L$GSL_ROOT/lib/ -lgsl -lgslcblas -lm"
     507                GSLLIB="-dy -L$GSL_ROOT/lib -lgsl -lgslcblas -lm"
    504508
    505509                AC_DEFINE([_HAVE_GSL_],[1],[with gsl in ISSM src])
     
    671675                        PETSCLIB="-L$PETSC_ROOT/$PETSC_ARCH/lib -L$PETSC_ROOT/lib -L$PETSC_ROOT/lib/$PETSC_ARCH -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc  -lpetscsnes -lpetscts"
    672676                        else
    673                         PETSCLIB="-L$PETSC_ROOT/$PETSC_ARCH/lib -L$PETSC_ROOT/lib -L$PETSC_ROOT/lib/$PETSC_ARCH -lpetsc"
     677                        PETSCLIB="-L$PETSC_ROOT/$PETSC_ARCH/lib -L$PETSC_ROOT/lib -L$PETSC_ROOT/lib/$PETSC_ARCH -lpetsc -ldl"
    674678                        fi
    675679                        ;;
  • issm/branches/trunk-jpl-damage/scripts/DownloadExternalPackage.py

    r12878 r12946  
    11#!/usr/bin/env python
    22# -*- coding: ISO-8859-1 -*-
     3#
     4# TODO: Improve upon extension recognition by checking for mismatches in found targets
     5# and specified local file.
     6#
    37
    48import os,sys,re
     
    2125# End class myHTMLParser
    2226
    23 pivot = sys.argv[1].rfind("/")
    24 url = (sys.argv[1])[:pivot]
    25 localFile=sys.argv[2]
     27# Separates the URL into a directory and the file or pattern based on the
     28# last appearance of '/'.
     29if len(sys.argv) > 1:
     30    pivot = sys.argv[1].rfind("/")
     31    url = (sys.argv[1])[:pivot]
     32    pivot += 1
     33    find = (sys.argv[1])[pivot:]
     34else:
     35    print "******************************************************************************************************************************"
     36    print "* Invalid input!                                                                                                             *"
     37    print "*                                                                                                                            *"
     38    print "* Try: 'DownloadExternalPackage.py url [localFile]'                                                                          *"
     39    print "*                                                                                                                            *"
     40    print "* Where 'URL' is the URL with an explicit package name or the URL followed by the truncated package name. And 'localFile' is *"
     41    print "* the file name (including extension) that you would like to save as.                                                        *"
     42    print "*                                                                                                                            *"
     43    print "* Examples:                                                                                                                  *"
     44    print "*                                                                                                                            *"
     45    print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-2.3.2-p3.tar.gz' 'petsc-2.3.2-p3.tar.gz' *"
     46    print "*                                                                                                                            *"
     47    print "*     This is the old style and the safest way to download a package.                                                        *"
     48    print "*                                                                                                                            *"
     49    print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' 'libtool.tar.gz'                      *"
     50    print "*                                                                                                                            *"
     51    print "*     This is the new style. For packages like 'Libtool', which we never expect to be using multiple versions, this will     *"
     52    print "*     download the most recent version and save it as the generic 'libtool.tar.gz'.                                          *"
     53    print "*                                                                                                                            *"
     54    print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/gsl-1.' 'gsl-1.15.tar.gz'                      *"
     55    print "*                                                                                                                            *"
     56    print "*     This is the new style. This is a demonstration of how this script can be used to disambiguate a package name if there  *"
     57    print "*     are more than once package matching 'gsl-'.                                                                            *"
     58    print "*                                                                                                                            *"
     59    print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool'                                       *"
     60    print "*                                                                                                                            *"
     61    print "*     This is the new style. This will download a package with 'libtool' as a prefix and save it as its canonical name.      *"
     62    print "*                                                                                                                            *"
     63    print "*                                                                                                                            *"
     64    print "******************************************************************************************************************************"
    2665
    27 pivot += 1;
    28 find = (sys.argv[1])[pivot:];
     66if len(sys.argv) > 2:
     67    localFile=sys.argv[2]
     68    print "Downloaded file will saved as: " + localFile
     69else:
     70    localFile = None
     71    print "Downloaded file will saved with the same file name."
     72
     73
    2974print "Looking for " + find
     75
     76# As an extra precaution, if no extension is given for a particular package
     77# such as '.../libtool', then ensure that files found are of appropriate
     78# file extensions.
     79#
     80# WARNING: The external packages directory includes executable binaries with
     81# '.exe' extensions. As such, '.exe' is an acceptable suffix, but this is
     82# inherently dangerous since this script can be used to download from any
     83# valid website. Furthermore, if an individual attempts a "man-in-the-middle" 
     84# attack, then the user would be capable of downloading executables from
     85# an untrusted source.
    3086pattern = find + "[\w.-]*(\.tar\.gz|tar\.gz2|tgz|zip|exe)?"
    3187parser = MyHTMLParser(pattern)
    3288
     89# Creates a 'FancyURL' which allows the script to fail gracefully by catching
     90# HTTP error codes 30X and several 40X(where 'X' is a natural number).
    3391urlObject = FancyURLopener()
    3492obj = urlObject.open(url)
    3593parser.feed(obj.read())
    3694
     95# If a file pattern was used to describe the file that should be downloaded,
     96# then there is the potential for multiple file matches. Currently, the script
     97# will detect this ambiguity and print out all the matches, while informing
     98# the user that he must refine his search.
     99#
     100# TODO: Prompt the user to select from a list his/her preferred target.
    37101if len(parser.targets) > 1:
    38102    print "Could not resolve your download due to the number of hits."
     
    42106
    43107elif len(parser.targets) == 1:
     108    print "Found: " + parser.targets[0]
    44109    url += "/" + parser.targets[0]
    45     if os.path.exists(localFile):
    46         print "File "+ localFile +" already exists and will not be downloaded..."
    47     elif parser.targets[0] == localFile:
    48         urllib.urlretrieve(url, localFile)
    49         print "Found: " + parser.targets[0]
    50     elif parser.matcher.match(localFile) != "None":
    51         urllib.urlretrieve(url,parser.targets[0]);
    52         print "Found: " + parser.targets[0]
     110
     111    if localFile is None:
     112        if os.path.exists(parser.targets[0]):
     113            print "File " + parser.targets[0] + " already exists and will not be downloaded..."
     114        else:
     115            urllib.urlretrieve(url, parser.targets[0])
     116            print "File saved as: " + parser.targets[0]
    53117    else:
    54         urllib.urlretrieve(url, parser.targets[0]);
    55         print "WARNING: the file found \'" + parser.targets[0] + "\' does not match \'" + localFile + "\'"
    56         print "Ensure the downloaded version is suitable."
     118        if os.path.exists(localFile):
     119            print "File "+ localFile +" already exists and will not be downloaded..."
     120        else:
     121            if parser.targets[0] == localFile:
     122                print "File found and destination match."
     123            elif parser.matcher.match(localFile) != "None":
     124                print "File found matches destination pattern."
     125            else:
     126                print "WARNING: the file found \'" + parser.targets[0] + "\' does not match \'" + localFile + "\'"
     127                print "Ensure the downloaded version is suitable."
     128
     129            urllib.urlretrieve(url, localFile)
     130            print "File saved as: " + localFile
    57131
    58132else:
  • issm/branches/trunk-jpl-damage/src/c/Container/Observations.cpp

    r12878 r12946  
    379379        /*Solve the three linear systems*/
    380380#if _HAVE_GSL_
    381         SolverxGsl(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
    382         SolverxGsl(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
    383         SolverxGsl(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
     381        SolverxSeq(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
     382        SolverxSeq(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
     383        SolverxSeq(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
    384384#else
    385385        _error2_("GSL is required");
  • issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/EnumDefinitions.h

    r12917 r12946  
    405405        StressTensoryzEnum,
    406406        StressTensorzzEnum,
    407         IceVolumeEnum,
    408         TotalSmbEnum,
     407        IceVolumeEnum, //FIXME reposition
     408        TotalSmbEnum,  //FIXME reposition
     409        ThicknessAlongGradientEnum,
     410        ThicknessAcrossGradientEnum,
    409411        /*}}}*/
    410412        /*Element Interpolations{{{1*/
  • issm/branches/trunk-jpl-damage/src/c/Makefile.am

    r12878 r12946  
    77
    88#if SHARED
    9 #lib_LTLIBRARIES = libISSM.la libISSMCore.la libISSMOverload.la
     9#lib_LTLIBRARIES = libISSMCore.la libISSMOverload.la libISSM.la
    1010#endif
    1111if PYTHON
     
    461461                                          ./modules/ThicknessAbsGradientx/ThicknessAbsGradientx.cpp\
    462462                                          ./modules/ThicknessAbsGradientx/ThicknessAbsGradientx.h\
     463                                          ./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp\
     464                                          ./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h\
     465                                          ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp\
     466                                          ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h\
    463467                                          ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\
    464468                                          ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\
     
    10041008#if SHARED
    10051009#libISSM_la_SOURCES = solutions/issm.cpp
    1006 #libISSM_la_LIBADD = @LTLIBOBJS@
    1007 #libISSM_la_LDFLAGS = -prefer-pic
    1008 
     1010#libISSM_la_LIBADD = libISSMCore.la libISSMOverload.la
     1011#
    10091012#libISSMCore_la_SOURCES  = $(issm_sources)
     1013#libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB)
     1014#
    10101015#libISSMOverload_la_SOURCES = ./shared/String/stricmp.c
    10111016#endif
  • issm/branches/trunk-jpl-damage/src/c/classes/bamg/Mesh.cpp

    r12876 r12946  
    56445644        }
    56455645        /*}}}*/
    5646         /*FUNCTION CloseBoundaryEdgeV2{{{*/
    5647         AdjacentTriangle CloseBoundaryEdgeV2(I2 C,Triangle *t, double &a,double &b) {
    5648                 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/CloseBoundaryEdgeV2)*/
    5649                 // walk around the vertex
    5650                 // version 2 for remove the probleme if we fill the hole
    5651                 //int bug=1;
    5652                 //  Triangle *torigine = t;
    5653                 // restart:
    5654                 //   int dir=0;
    5655                 if (t->link != 0){
    5656                         _error2_("t->link != 0");
    5657                 }
    5658                 // to have a starting edges
    5659                 // try the 3 edge bourna-- in case of internal hole
    5660                 // and choice  the best
    5661                 //
    5662                 // the probleme is in case of  the fine and long internal hole
    5663                 // for exemple neart the training edge of a wing
    5664                 BamgVertex * s=0,*s1=0, *s0=0;
    5665                 Icoor2 imax = MaxICoor22;
    5666                 Icoor2 l0 = imax,l1 = imax;
    5667                 double dd2 =  imax;// infinity
    5668                 AdjacentTriangle er;
    5669                 int  cas=-2;
    5670                 for (int j=0;j<3;j++)
    5671                   {
    5672                         AdjacentTriangle ta=t->FindBoundaryEdge(j);
    5673                         if  (! (Triangle *) ta) continue;
    5674                         s0 = ta.EdgeVertex(0);
    5675                         s1 = ta.EdgeVertex(1);
    5676                         I2 A = * s0;
    5677                         I2 B = *ta.EdgeVertex(1);
    5678                         I2 AB = B-A,AC=C-A,BC=B-C;
    5679                         Icoor2  ACAC = (AC,AC), BCBC = (BC,BC);
    5680                         Icoor2  AB2  =   Norme2_2(AB); //  ||AB||^2
    5681                         Icoor2  ABAC  =   (AB,AC);         //  AB.AC|
    5682 
    5683                         double d2;
    5684                         if ( ABAC < 0 )   // DIST A
    5685                           {
    5686                                 if ( (d2=(double) ACAC)  <  dd2)
    5687                                   {
    5688                                         er = ta;
    5689                                         l0 = ACAC;
    5690                                         l1 = BCBC;
    5691                                         cas = 0;
    5692                                         s = s0;
    5693                                   }
    5694                           }
    5695                         else if (ABAC > AB2)  // DIST B
    5696                           {
    5697                                 if ( (d2=(double) BCBC)  <  dd2)
    5698                                   {
    5699                                         dd2 = d2;
    5700                                         er = Adj(ta); // other direction
    5701                                         l0 = BCBC;
    5702                                         l1 = ACAC;
    5703                                         cas = 1;
    5704                                         s = s1;
    5705                                   }
    5706                           }
    5707                         else  // DIST AB
    5708                           {
    5709 
    5710                                 double det_2 =  (double) Det(AB,AC);
    5711                                 det_2 *= det_2; // square of area*2 of triangle ABC
    5712                                 d2 = det_2/ (double) AB2; // hauteur^2 in C of of triangle ABC     
    5713 
    5714                                 if (d2 < dd2)
    5715                                   {
    5716                                         dd2 = d2;
    5717                                         er = ta;
    5718                                         l0 = (AC,AC);
    5719                                         l1 = (BC,BC);
    5720                                         s = 0;
    5721                                         cas = -1;
    5722                                         b = ((double) ABAC/(double) AB2);
    5723                                         a = 1 - b;
    5724                                   }
    5725                           }
    5726                   }
    5727                 if (cas ==-2){
    5728                         _error2_("cas==-2");
    5729                 }
    5730                 // l1 = ||C s1||  , l0 = ||C s0||
    5731                 // where s0,s1 are the vertex of the edge er
    5732 
    5733                 if ( s)
    5734                   {
    5735                         t=er;
    5736                         AdjacentTriangle edge(er);
    5737 
    5738                         int kkk=0; 
    5739                         int linkp = t->link == 0;
    5740 
    5741                         Triangle * tt=t=edge=Adj(Previous(edge));
    5742                         do  {  // loop over vertex s
    5743                                 kkk++;
    5744                                 if (edge.EdgeVertex(0)!=s && kkk>=10000){
    5745                                         _error2_("edge.EdgeVertex(0)!=s && kkk>=10000");
    5746                                 }
    5747 
    5748                                 int link = tt->link == 0;
    5749                                 if ((link + linkp) == 1)
    5750                                   { // a boundary edge
    5751                                         BamgVertex * st = edge.EdgeVertex(1);
    5752                                         I2 I=*st;
    5753                                         Icoor2  ll = Norme2_2 (C-I);
    5754                                         if (ll < l1) {  // the other vertex is neart
    5755                                                 s1=st;
    5756                                                 l1=ll;
    5757                                                 er = edge;
    5758                                                 if(ll<l0) { // change of direction --
    5759                                                         s1=s;
    5760                                                         l1=l0;
    5761                                                         s=st;
    5762                                                         l0=ll;
    5763                                                         t=tt;
    5764                                                         edge=Adj(edge);
    5765                                                         link=linkp;
    5766                                                         er = edge;
    5767                                                 }
    5768                                         }
    5769                                   }
    5770 
    5771                                 linkp=link;
    5772                                 edge=Adj(Previous(edge));
    5773                                 tt = edge;
    5774                         } while (t!=tt);
    5775 
    5776                         if (!(Triangle *) er){
    5777                                 _error2_("!(Triangle *) er");
    5778                         }
    5779                         I2 A((I2)*er.EdgeVertex(0));
    5780                         I2 B((I2)*er.EdgeVertex(1));
    5781                         I2 AB=B-A,AC=C-A,CB=B-C;
    5782                         double aa =  (double) (AB,AC);
    5783                         double bb =  (double) (AB,CB);
    5784                         if (aa<0)       a=1,b=0;
    5785                         else if(bb<0)   a=0,b=1;
    5786                         else 
    5787                           {
    5788                                 a  = bb/(aa+bb);
    5789                                 b  = aa/(aa+bb);
    5790                           }
    5791                   }
    5792                 return er;
    5793         }
    5794         /*}}}*/
    57955646/*FUNCTION ForceEdge{{{*/
    57965647int ForceEdge(BamgVertex &a, BamgVertex & b,AdjacentTriangle & taret)  {
  • issm/branches/trunk-jpl-damage/src/c/classes/bamg/Mesh.h

    r12821 r12946  
    154154        /*Intermediary*/
    155155        AdjacentTriangle CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ;
    156         AdjacentTriangle CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b);
    157156        void  swap(Triangle *t1,short a1,
    158157                                Triangle *t2,short a2,
  • issm/branches/trunk-jpl-damage/src/c/classes/bamg/macros.h

    r12877 r12946  
    2020        static const short PreviousVertex[3] = {2,0,1};
    2121        const  Icoor1 MaxICoor   = 1073741823; // 2^30-1 =111...111 (29 times one)
    22         const  Icoor2 MaxICoor22 = Icoor2(2)*Icoor2(MaxICoor)*Icoor2(MaxICoor) ;
    2322}
    2423
  • issm/branches/trunk-jpl-damage/src/c/classes/matrix/ElementMatrix.h

    r12832 r12946  
    1616class Node;
    1717class Matrix;
     18class Parameters;
    1819/*}}}*/
    1920
  • issm/branches/trunk-jpl-damage/src/c/classes/matrix/ElementVector.h

    r12832 r12946  
    1616class Node;
    1717class Vector;
     18class Parameters;
    1819/*}}}*/
    1920
  • issm/branches/trunk-jpl-damage/src/c/classes/matrix/Matrix.cpp

    r12860 r12946  
    2626Matrix::Matrix(){
    2727
    28         pmatrix=NULL;
     28        #ifdef _HAVE_PETSC_
     29        pmatrix=NULL;
     30        #endif
    2931        smatrix=NULL;
    3032
     
    3941Matrix::Matrix(int M,int N,int in_type){
    4042
    41         pmatrix=NULL;
     43        #ifdef _HAVE_PETSC_
     44        pmatrix=NULL;
     45        #endif
    4246        smatrix=NULL;
    4347        type=in_type;
     
    6064Matrix::Matrix(int M,int N,IssmDouble sparsity,int in_type){
    6165
    62         pmatrix=NULL;
     66        #ifdef _HAVE_PETSC_
     67        pmatrix=NULL;
     68        #endif
    6369        smatrix=NULL;
    6470        type=in_type;
     
    8086Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity,int in_type){
    8187
    82         pmatrix=NULL;
     88        #ifdef _HAVE_PETSC_
     89        pmatrix=NULL;
     90        #endif
    8391        smatrix=NULL;
    8492        type=in_type;
     
    101109Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode,int in_type){
    102110
    103         pmatrix=NULL;
     111        #ifdef _HAVE_PETSC_
     112        pmatrix=NULL;
     113        #endif
    104114        smatrix=NULL;
    105115        type=in_type;
  • issm/branches/trunk-jpl-damage/src/c/classes/matrix/Vector.cpp

    r12850 r12946  
    2525Vector::Vector(){
    2626
     27        #ifdef _HAVE_PETSC_
    2728        this->pvector=NULL;
     29        #endif
    2830        this->svector=NULL;
    2931       
     
    3840Vector::Vector(int M,bool fromlocalsize,int in_type){
    3941       
     42        #ifdef _HAVE_PETSC_
    4043        pvector=NULL;
     44        #endif
    4145        svector=NULL;
    4246        type=in_type;
     
    5761}
    5862/*}}}*/
     63#ifdef _HAVE_PETSC_
     64/*FUNCTION Vector::Vector(Vec petsc_vector){{{*/
     65Vector::Vector(Vec petsc_vector){
     66
     67        this->type=PetscVecType;
     68        this->svector=NULL;
     69        this->pvector=new PetscVec(petsc_vector);
     70
     71}
     72/*}}}*/
     73#endif
    5974/*FUNCTION Vector::Vector(IssmDouble* serial_vec,int M,int type){{{*/
    6075Vector::Vector(IssmDouble* serial_vec,int M,int in_type){
    6176
     77        #ifdef _HAVE_PETSC_
    6278        pvector=NULL;
     79        #endif
     80
    6381        svector=NULL;
    6482        type=in_type;
  • issm/branches/trunk-jpl-damage/src/c/classes/matrix/Vector.h

    r12850 r12946  
    3636                Vector(int M,bool fromlocalsize=false,int type=PetscVecType);
    3737                Vector(IssmDouble* serial_vec,int pM,int type=PetscVecType);
     38                #ifdef _HAVE_PETSC_
     39                Vector(Vec petsc_vector);
     40                #endif
    3841                ~Vector();
    3942                /*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Element.h

    r12832 r12946  
    105105                virtual IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index)=0;
    106106                virtual IssmDouble ThicknessAbsGradient(bool process_units,int weight_index)=0;
     107                virtual IssmDouble ThicknessAlongGradient(bool process_units,int weight_index)=0;
     108                virtual IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index)=0;
    107109                virtual IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index)=0;
    108110                virtual IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index)=0;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Penta.cpp

    r12832 r12946  
    687687/*FUNCTION Penta::Delta18oParameterization{{{*/
    688688void  Penta::Delta18oParameterization(void){
    689 
     689        /*Are we on the base? If not, return*/
     690        if(!IsOnBed()) return;
     691
     692        int        i;
    690693        IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
    691694        IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
    692695        IssmDouble PrecipitationsPresentday[NUMVERTICES][12];
     696        IssmDouble tmp[NUMVERTICES];
    693697        IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime;
    694698        IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime;
     
    699703
    700704        /*Recover present day temperature and precipitation*/
    701         Input*     input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum); _assert_(input);
    702         Input*     input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum); _assert_(input2);
     705        Input*     input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input);
     706        Input*     input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input2);
    703707        Input*     input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3);
    704708        GaussPenta* gauss=new GaussPenta();
     
    709713                        input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
    710714                        input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
    711                         monthlyprec[iv][month]=monthlyprec[iv][month]*yts; // convertion to m/yr
     715                        PrecipitationsPresentday[iv][month]=PrecipitationsPresentday[iv][month]/yts; // converion in m/sec
    712716                }
    713717        }
    714718
    715719        /*Recover delta18o and Delta18oSurface at present day, lgm and at time t*/
    716         this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime*yts);
    717         this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,(finaltime-21000)*yts);
    718         this->parameters->FindParam(&Delta18oTime,SurfaceforcingsDelta18oEnum,time*yts);
    719         this->parameters->FindParam(&Delta18oSurfacePresent,SurfaceforcingsDelta18oSurfaceEnum,finaltime*yts);
    720         this->parameters->FindParam(&Delta18oSurfaceLgm,SurfaceforcingsDelta18oSurfaceEnum,(finaltime-21000)*yts);
    721         this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time*yts);
     720        this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime);
     721        this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,finaltime-(21000*yts));
     722        this->parameters->FindParam(&Delta18oTime,SurfaceforcingsDelta18oEnum,time);
     723        this->parameters->FindParam(&Delta18oSurfacePresent,SurfaceforcingsDelta18oSurfaceEnum,finaltime);
     724        this->parameters->FindParam(&Delta18oSurfaceLgm,SurfaceforcingsDelta18oSurfaceEnum,finaltime-(21000*yts));
     725        this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time);
    722726
    723727        /*Compute the temperature and precipitation*/
     
    734738        TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
    735739        for (int imonth=0;imonth<12;imonth++) {
    736                 for(int iv=0;iv<NUMVERTICES;iv++) {
    737                         PentaP1Input* newmonthinput1 = new PentaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&monthlytemperatures[iv][imonth]);
    738                         NewTemperatureInput->AddTimeInput(newmonthinput1,imonth/12.*yts);
    739                         PentaP1Input* newmonthinput2 = new PentaP1Input(SurfaceforcingsPrecipitationEnum,&monthlyprec[iv][imonth]);
    740                         NewPrecipitationInput->AddTimeInput(newmonthinput2,imonth/12.*yts);
    741                 }
    742         }
     740                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
     741                PentaP1Input* newmonthinput1 = new PentaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0]);
     742                NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
     743
     744                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
     745                PentaP1Input* newmonthinput2 = new PentaP1Input(SurfaceforcingsPrecipitationEnum,&tmp[0]);
     746                NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
     747        }
     748
    743749        this->inputs->AddInput(NewTemperatureInput);
    744750        this->inputs->AddInput(NewPrecipitationInput);
     751
     752        this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,ElementEnum);
     753        this->InputExtrude(SurfaceforcingsPrecipitationEnum,ElementEnum);
    745754
    746755        /*clean-up*/
     
    15591568        }
    15601569        #endif
    1561 
    15621570}
    15631571/*}}}*/
     
    20092017                                name==QmuVxEnum ||
    20102018                                name==QmuVyEnum ||
     2019                                name==QmuVzEnum ||
    20112020                                name==QmuPressureEnum ||
    20122021                                name==QmuBedEnum ||
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Penta.h

    r12832 r12946  
    162162                IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index);
    163163                IssmDouble ThicknessAbsGradient(bool process_units,int weight_index);
     164                IssmDouble ThicknessAlongGradient( bool process_units,int weight_index){_error2_("not supported");};
     165                IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index){_error2_("not supported");};
    164166                void   InputControlUpdate(IssmDouble scalar,bool save_parameter);
    165167                #endif
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Tria.cpp

    r12897 r12946  
    915915        IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
    916916        IssmDouble PrecipitationsPresentday[NUMVERTICES][12];
    917         IssmDouble temp[NUMVERTICES];
     917        IssmDouble tmp[NUMVERTICES];
    918918        IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime;
    919919        IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime;
     
    961961        TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
    962962        for (int imonth=0;imonth<12;imonth++) {
    963                 for(i=0;i<NUMVERTICES;i++) temp[i]=TemperaturesPresentday[i][imonth];
    964                 TriaP1Input* newmonthinput1 = new TriaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&temp[0]);
    965                 //TriaP1Input* newmonthinput1 = new TriaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&monthlytemperatures[0][imonth]);
     963                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
     964                TriaP1Input* newmonthinput1 = new TriaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0]);
    966965                NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
    967                 for(i=0;i<NUMVERTICES;i++) temp[i]=monthlyprec[i][imonth];
    968                 TriaP1Input* newmonthinput2 = new TriaP1Input(SurfaceforcingsPrecipitationEnum,&temp[0]);
     966
     967                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
     968                TriaP1Input* newmonthinput2 = new TriaP1Input(SurfaceforcingsPrecipitationEnum,&tmp[0]);
    969969                NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
    970970        }
     971
    971972        this->inputs->AddInput(NewTemperatureInput);
    972973        this->inputs->AddInput(NewPrecipitationInput);
     
    21922193  rho_water=matpar->GetRhoFreshwater();
    21932194
    2194   //if(id==1) printf(" monthlytemperatures %f\n",monthlytemperatures[1][0]);
    2195   //if(id==1) printf("monthlyprec %f\n",monthlyprec[1][0]);
    2196 
    21972195   /*measure the surface mass balance*/
    21982196   for (int iv = 0; iv<NUMVERTICES; iv++){
     
    35343532                case ThicknessAbsMisfitEnum:
    35353533                case ThicknessAbsGradientEnum:
     3534                case ThicknessAlongGradientEnum:
     3535                case ThicknessAcrossGradientEnum:
    35363536                case SurfaceAbsVelMisfitEnum:
    35373537                case SurfaceRelVelMisfitEnum:
     
    44004400}
    44014401/*}}}*/
     4402/*FUNCTION Tria::ThicknessAlongGradient{{{*/
     4403IssmDouble Tria::ThicknessAlongGradient(bool process_units,int weight_index){
     4404
     4405        /* Intermediaries */
     4406        int         ig;
     4407        IssmDouble  Jelem = 0;
     4408        IssmDouble  weight;
     4409        IssmDouble  Jdet;
     4410        IssmDouble  xyz_list[NUMVERTICES][3];
     4411        IssmDouble  dp[NDOF2];
     4412        IssmDouble  vx,vy;
     4413        GaussTria  *gauss                    = NULL;
     4414
     4415        /*retrieve parameters and inputs*/
     4416
     4417        /*If on water, return 0: */
     4418        if(IsOnWater()) return 0;
     4419
     4420        /*Retrieve all inputs we will be needing: */
     4421        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     4422        Input* weights_input  = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
     4423        Input* thickness_input= inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
     4424        Input* vx_input       = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
     4425        Input* vy_input       = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
     4426
     4427        /* Start looping on the number of gaussian points: */
     4428        gauss=new GaussTria(2);
     4429        for (ig=gauss->begin();ig<gauss->end();ig++){
     4430
     4431                gauss->GaussPoint(ig);
     4432
     4433                /* Get Jacobian determinant: */
     4434                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
     4435
     4436                /*Get all parameters at gaussian point*/
     4437                weights_input->GetInputValue(&weight,gauss,weight_index);
     4438                thickness_input->GetInputDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
     4439                vx_input->GetInputValue(&vx,gauss);
     4440                vy_input->GetInputValue(&vy,gauss);
     4441
     4442                /*J = 1/2 ( vx*dH/dx + vy*dH/dy )^2 */
     4443                Jelem+=weight*1/2*(vx*dp[0] + vy*dp[1])*(vx*dp[0] + vy*dp[1])*Jdet*gauss->weight;
     4444        }
     4445
     4446        /*Clean up and return*/
     4447        delete gauss;
     4448        return Jelem;
     4449}
     4450/*}}}*/
     4451/*FUNCTION Tria::ThicknessAcrossGradient{{{*/
     4452IssmDouble Tria::ThicknessAcrossGradient(bool process_units,int weight_index){
     4453
     4454        /* Intermediaries */
     4455        int         ig;
     4456        IssmDouble  Jelem = 0;
     4457        IssmDouble  weight;
     4458        IssmDouble  Jdet;
     4459        IssmDouble  xyz_list[NUMVERTICES][3];
     4460        IssmDouble  dp[NDOF2];
     4461        IssmDouble  vx,vy;
     4462        GaussTria  *gauss                    = NULL;
     4463
     4464        /*retrieve parameters and inputs*/
     4465
     4466        /*If on water, return 0: */
     4467        if(IsOnWater()) return 0;
     4468
     4469        /*Retrieve all inputs we will be needing: */
     4470        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     4471        Input* weights_input  = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
     4472        Input* thickness_input= inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
     4473        Input* vx_input       = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
     4474        Input* vy_input       = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
     4475
     4476        /* Start looping on the number of gaussian points: */
     4477        gauss=new GaussTria(2);
     4478        for (ig=gauss->begin();ig<gauss->end();ig++){
     4479
     4480                gauss->GaussPoint(ig);
     4481
     4482                /* Get Jacobian determinant: */
     4483                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
     4484
     4485                /*Get all parameters at gaussian point*/
     4486                weights_input->GetInputValue(&weight,gauss,weight_index);
     4487                thickness_input->GetInputDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
     4488                vx_input->GetInputValue(&vx,gauss);
     4489                vy_input->GetInputValue(&vy,gauss);
     4490
     4491                /*J = 1/2 ( -vy*dH/dx + vx*dH/dy )^2 */
     4492                Jelem+=weight*1/2*(-vy*dp[0] + vx*dp[1])*(-vy*dp[0] + vx*dp[1])*Jdet*gauss->weight;
     4493        }
     4494
     4495        /*Clean up and return*/
     4496        delete gauss;
     4497        return Jelem;
     4498}
     4499/*}}}*/
    44024500/*FUNCTION Tria::ThicknessAbsMisfit {{{*/
    44034501IssmDouble Tria::ThicknessAbsMisfit(bool process_units,int weight_index){
     
    44534551        /*Intermediaries */
    44544552        int         i,ig,resp;
    4455         IssmDouble      Jdet;
    4456         IssmDouble      thickness,thicknessobs,weight;
    4457         int        *responses = NULL;
     4553        IssmDouble  Jdet;
     4554        IssmDouble  thickness,thicknessobs,weight;
    44584555        int         num_responses;
    4459         IssmDouble      xyz_list[NUMVERTICES][3];
    4460         IssmDouble      basis[3];
    4461         IssmDouble      dbasis[NDOF2][NUMVERTICES];
    4462         IssmDouble      dH[2];
    4463         GaussTria*  gauss=NULL;
     4556        IssmDouble  xyz_list[NUMVERTICES][3];
     4557        IssmDouble  basis[3];
     4558        IssmDouble  dbasis[NDOF2][NUMVERTICES];
     4559        IssmDouble  dH[2];
     4560        IssmDouble  v[2];
     4561        GaussTria *gauss     = NULL;
     4562        int       *responses = NULL;
    44644563
    44654564        /*Initialize Element vector*/
     
    44704569        this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum);
    44714570        this->parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum);
    4472         Input* thickness_input    = inputs->GetInput(ThicknessEnum);   _assert_(thickness_input);
    4473         Input* thicknessobs_input = inputs->GetInput(InversionThicknessObsEnum);_assert_(thicknessobs_input);
    4474         Input* weights_input      = inputs->GetInput(InversionCostFunctionsCoefficientsEnum);     _assert_(weights_input);
     4571        Input* thickness_input    = inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
     4572        Input* thicknessobs_input = inputs->GetInput(InversionThicknessObsEnum);              _assert_(thicknessobs_input);
     4573        Input* weights_input      = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
     4574        Input* vx_input           = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
     4575        Input* vy_input           = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
    44754576
    44764577        /* Start  looping on the number of gaussian points: */
     
    44994600                                for(i=0;i<numdof;i++) pe->values[i]+= - weight*dH[0]*dbasis[0][i]*Jdet*gauss->weight;
    45004601                                for(i=0;i<numdof;i++) pe->values[i]+= - weight*dH[1]*dbasis[1][i]*Jdet*gauss->weight;
     4602                                break;
     4603                        case ThicknessAlongGradientEnum:
     4604                                weights_input->GetInputValue(&weight, gauss,resp);
     4605                                vx_input->GetInputValue(&v[0],gauss);
     4606                                vy_input->GetInputValue(&v[1],gauss);
     4607                                for(i=0;i<numdof;i++) pe->values[i]+= - weight*(dH[0]*v[0]+dH[1]*v[1])*(dbasis[0][i]*v[0]+dbasis[1][i]*v[1])*Jdet*gauss->weight;
     4608                                break;
     4609                        case ThicknessAcrossGradientEnum:
     4610                                weights_input->GetInputValue(&weight, gauss,resp);
     4611                                vx_input->GetInputValue(&v[0],gauss);
     4612                                vy_input->GetInputValue(&v[1],gauss);
     4613                                for(i=0;i<numdof;i++) pe->values[i]+= - weight*(dH[0]*(-v[1])+dH[1]*v[0])*(dbasis[0][i]*(-v[1])+dbasis[1][i]*v[0])*Jdet*gauss->weight;
    45014614                                break;
    45024615                        default:
     
    46754788                                        /*Nothing in P vector*/
    46764789                                        break;
     4790                                case ThicknessAlongGradientEnum:
     4791                                        /*Nothing in P vector*/
     4792                                        break;
     4793                                case ThicknessAcrossGradientEnum:
     4794                                        /*Nothing in P vector*/
     4795                                        break;
    46774796                                case RheologyBbarAbsGradientEnum:
    46784797                                        /*Nothing in P vector*/
     
    48524971                                        /*Nothing in P vector*/
    48534972                                        break;
     4973                                case ThicknessAcrossGradientEnum:
     4974                                        /*Nothing in P vector*/
     4975                                        break;
     4976                                case ThicknessAlongGradientEnum:
     4977                                        /*Nothing in P vector*/
     4978                                        break;
    48544979                                case RheologyBbarAbsGradientEnum:
    48554980                                        /*Nothing in P vector*/
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Tria.h

    r12897 r12946  
    160160                IssmDouble ThicknessAbsMisfit(     bool process_units,int weight_index);
    161161                IssmDouble SurfaceAbsVelMisfit(    bool process_units,int weight_index);
    162                 IssmDouble ThicknessAbsGradient(bool process_units,int weight_index);
     162                IssmDouble ThicknessAbsGradient(   bool process_units,int weight_index);
     163                IssmDouble ThicknessAlongGradient( bool process_units,int weight_index);
     164                IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index);
    163165                IssmDouble SurfaceRelVelMisfit(    bool process_units,int weight_index);
    164166                IssmDouble SurfaceLogVelMisfit(    bool process_units,int weight_index);
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/Inputs/TransientInput.cpp

    r12832 r12946  
    282282        inputs->AddObject(input);
    283283
     284}
     285/*}}}*/
     286/*FUNCTION TransientInput::Extrude{{{*/
     287void TransientInput::Extrude(void){
     288
     289        for(int i=0;i<this->numtimesteps;i++){
     290                ((Input*)this->inputs->GetObjectByOffset(i))->Extrude();
     291        }
    284292}
    285293/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/Inputs/TransientInput.h

    r12705 r12946  
    7979                IssmDouble Min(void);
    8080                IssmDouble MinAbs(void);
    81                 void Extrude(void){_error2_("not supported yet");}
     81                void Extrude(void);
    8282                void VerticallyIntegrate(Input* thickness_forcing){_error2_("not supported yet");};
    8383                void GetVectorFromInputs(Vector* vector,int* doflist);
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KMLFileReadUtils.cpp

    r12835 r12946  
    2929        int     c;
    3030        int     ibuf=0,buflen=1024,bufblk=1024;
    31         char    *buffer=NULL,*bufferc=NULL;
    32 
    33         buffer=(char *) xmalloc(buflen*sizeof(char));
     31        char    *buffer=NULL,*bufferc=NULL,**pcom2=NULL;
     32
     33        buffer=xNew<char>(buflen);
    3434        buffer[0]='\0';
    3535
     
    5757                                        if (pncom && ppcom) {
    5858                                                (*pncom)++;
    59                                                 *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
     59                                                pcom2=xNew<char*>(*pncom);
     60                                                memcpy(pcom2,*ppcom,(*pncom-1)*sizeof(char*));
     61                                                xDelete<char*>(*ppcom);
     62                                                *ppcom=pcom2;
     63                                                pcom2=NULL;
     64//                                              *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
    6065                                                (*ppcom)[*pncom-1]=bufferc;
    6166                                        }
    6267                                        else
    63                                                 xfree((void**)&bufferc);
     68                                                xDelete<char>(bufferc);
    6469                                        inew=1;
    6570                                        continue;
     
    98103                                        if (pncom && ppcom) {
    99104                                                (*pncom)++;
    100                                                 *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
     105                                                pcom2=xNew<char*>(*pncom);
     106                                                memcpy(pcom2,*ppcom,(*pncom-1)*sizeof(char*));
     107                                                xDelete<char*>(*ppcom);
     108                                                *ppcom=pcom2;
     109                                                pcom2=NULL;
     110//                                              *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
    101111                                                (*ppcom)[*pncom-1]=bufferc;
    102112                                        }
    103113                                        else
    104                                                 xfree((void**)&bufferc);
     114                                                xDelete<char>(bufferc);
    105115                        }
    106116                        else {
     
    133143
    134144        if (!ibuf)
    135                 xfree((void**)&buffer);
     145                xDelete<char>(buffer);
    136146
    137147        return(buffer);
     
    149159        char*   buffer=NULL;
    150160
    151         buffer=(char *) xmalloc(buflen*sizeof(char));
     161        buffer=xNew<char>(buflen);
    152162        buffer[0]='\0';
    153163
     
    172182                                for (i=ibuf-1; i>=0; i--)
    173183                                        ungetc(buffer[i],fid);
    174                                 xfree((void**)&buffer);
     184                                xDelete<char>(buffer);
    175185                                return(buffer);
    176186                        }
     
    197207
    198208        if (!ibuf)
    199                 xfree((void**)&buffer);
     209                xDelete<char>(buffer);
    200210
    201211        return(buffer);
     
    209219/*  add the specified character to the token buffer  */
    210220
    211         char*   buffer=NULL;
     221        char*   buffer2=NULL;
    212222
    213223/*  check buffer length and realloc if necessary  */
     
    215225        if (*pibuf+2 > *pbuflen) {
    216226                *pbuflen+=bufblk;
    217                 *pbuffer=(char *) xrealloc(*pbuffer,*pbuflen*sizeof(char));
     227                buffer2=xNew<char>(*pbuflen);
     228                memcpy(buffer2,*pbuffer,(*pbuflen-bufblk)*sizeof(char));
     229                xDelete<char>(*pbuffer);
     230                *pbuffer=buffer2;
     231                buffer2=NULL;
     232//              *pbuffer=(char *) xrealloc(*pbuffer,*pbuflen*sizeof(char));
    218233        }
    219234
     
    248263/*  strtok modifies ktag, so work on copy  */
    249264
    250         ktagi=(char *) xmalloc((strlen(ktag)+1)*sizeof(char));
     265        ktagi=xNew<char>(strlen(ktag)+1);
    251266        memcpy(ktagi,ktag,(strlen(ktag)+1)*sizeof(char));
    252267
     
    258273        if (!pname) {
    259274                if (maxlen)
    260                         pname=(char *) xmalloc((maxlen       +1)*sizeof(char));
    261                 else
    262                         pname=(char *) xmalloc((strlen(ktokn)+1)*sizeof(char));
     275                        pname=xNew<char>(maxlen       +1);
     276                else
     277                        pname=xNew<char>(strlen(ktokn)+1);
    263278        }
    264279
     
    271286                memcpy(pname,ktokn,(strlen(ktokn)+1)*sizeof(char));
    272287
    273         xfree((void**)&ktagi);
     288        xDelete<char>(ktagi);
    274289
    275290        if (m)
     
    293308/*  strtok modifies ktag, so work on copy  */
    294309
    295         ktagi=(char *) xmalloc((strlen(ktag)+1)*sizeof(char));
     310        ktagi=xNew<char>(strlen(ktag)+1);
    296311        memcpy(ktagi,ktag,(strlen(ktag)+1)*sizeof(char));
    297312
     
    315330        }
    316331
    317         xfree((void**)&ktagi);
     332        xDelete<char>(ktagi);
    318333
    319334/*  check for xml declaration, dtd declaration, or solo tag  */
     
    343358
    344359        sscanf(kstr,"%d",pival);
    345         xfree((void**)&kstr);
     360        xDelete<char>(kstr);
    346361
    347362/*  get additional token and compare to closing tag  */
     
    355370                  {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");}
    356371                else
    357                         xfree((void**)&kstr);
     372                        xDelete<char>(kstr);
    358373
    359374//      _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pival << ".");
     
    377392        sscanf(kstr,"%d",&ival);
    378393        *pbval=(bool)ival;
    379         xfree((void**)&kstr);
     394        xDelete<char>(kstr);
    380395
    381396/*  get additional token and compare to closing tag  */
     
    389404                  {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");}
    390405                else
    391                         xfree((void**)&kstr);
     406                        xDelete<char>(kstr);
    392407
    393408//      _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << (*pbval ? "true" : "false") << ".");
     
    422437        if (!pstr) {
    423438                if (maxlen)
    424                         pstr=(char *) xmalloc((maxlen      +1)*sizeof(char));
    425                 else
    426                         pstr=(char *) xmalloc((strlen(kstr)+1)*sizeof(char));
     439                        pstr=xNew<char>(maxlen      +1);
     440                else
     441                        pstr=xNew<char>(strlen(kstr)+1);
    427442        }
    428443
     
    435450                memcpy(pstr,kstr,(strlen(kstr)+1)*sizeof(char));
    436451
    437         xfree((void**)&kstr);
     452        xDelete<char>(kstr);
    438453
    439454        if (m)
     
    450465                  {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");}
    451466                else
    452                         xfree((void**)&kstr);
     467                        xDelete<char>(kstr);
    453468
    454469//      _pprintLine_("KMLFileTokenParse -- " << ktag << "=\"" << pstr << "\".");
     
    472487
    473488        sscanf(kstr,"%g",pfval);
    474         xfree((void**)&kstr);
     489        xDelete<char>(kstr);
    475490
    476491/*  get additional token and compare to closing tag  */
     
    484499                  {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");}
    485500                else
    486                         xfree((void**)&kstr);
     501                        xDelete<char>(kstr);
    487502
    488503//      _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pfval << ".");
     
    506521
    507522        sscanf(kstr,"%lg",pdval);
    508         xfree((void**)&kstr);
     523        xDelete<char>(kstr);
    509524
    510525/*  get additional token and compare to closing tag  */
     
    518533                  {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");}
    519534                else
    520                         xfree((void**)&kstr);
     535                        xDelete<char>(kstr);
    521536
    522537//      _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pdval << ".");
     
    533548        char*   kstr;
    534549        char*   ktok;
     550        double* dval2=NULL;
    535551        char    delim[]={' ',',','\f','\n','\r','\t','\v','\0'};
    536552
     
    544560        if (!*pdval)
    545561                if (maxlen)
    546                         *pdval=(double *) xmalloc(maxlen              *sizeof(double));
    547                 else
    548                         *pdval=(double *) xmalloc(((strlen(kstr)+1)/2)*sizeof(double));
     562                        *pdval=xNew<IssmDouble>(maxlen            );
     563                else
     564                        *pdval=xNew<IssmDouble>((strlen(kstr)+1)/2);
    549565
    550566/*  loop through string to get all values  */
     
    558574                ktok=strtok(NULL,delim);
    559575        }
    560         xfree((void**)&kstr);
     576        xDelete<char>(kstr);
    561577
    562578        if (!maxlen)
    563                 *pdval=(double *) xrealloc(*pdval,(i+1)*sizeof(double));
     579                dval2=xNew<double>(i+1);
     580                memcpy(dval2,*pdval,(i+1)*sizeof(double));
     581                xDelete<double>(*pdval);
     582                *pdval=dval2;
     583                dval2=NULL;
     584//              *pdval=(double *) xrealloc(*pdval,(i+1)*sizeof(double));
    564585
    565586        if (m)
     
    576597                  {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");}
    577598                else
    578                         xfree((void**)&kstr);
     599                        xDelete<char>(kstr);
    579600
    580601//      _pprintLine_("KMLFileTokenParse -- " << ktag << "=...");
     
    586607/*}}}*/
    587608/*FUNCTION  KMLFileTokenParse {{{*/
    588 int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen,
     609int KMLFileTokenParse(double **pdval,int* m,int n,int maxlen,
    589610                                          char* ktag,
    590611                                          FILE* fid){
    591612
    592         int     i=0,j=-1;
     613        int     i=-1,j=-1;
    593614        char*   kstr;
    594615        char*   ktok;
     616        double* dval2=NULL;
    595617        char    delim[]={' ',',','\f','\n','\r','\t','\v','\0'};
    596618
     
    600622                                                        NULL,NULL)) ||
    601623                (kstr[0] == '<'))
    602                 _error2_("KMLFileTokenParse -- Missing double [m x 3] field for " << ktag << ".\n");
    603 
    604         if (!*pdval3)
     624                _error2_("KMLFileTokenParse -- Missing double [m x n] field for " << ktag << ".\n");
     625
     626        if (!*pdval)
    605627                if (maxlen)
    606                         *pdval3=(double (*)[3]) xmalloc((maxlen*3)          *sizeof(double));
    607                 else
    608                         *pdval3=(double (*)[3]) xmalloc(((strlen(kstr)+1)/2)*sizeof(double));
     628                        *pdval=xNew<IssmDouble>(maxlen*n          );
     629                else
     630                        *pdval=xNew<IssmDouble>((strlen(kstr)+1)/2);
    609631
    610632/*  loop through string to get all values  */
     
    612634        ktok=strtok(kstr,delim);
    613635        while (ktok) {
    614                 j++;
    615                 if (j == 3) {
    616                         i++;
    617                         j=0;
    618                         if (maxlen && (maxlen < i+1))
    619                                 _error2_("KMLFileTokenParse -- Double [m x 3] field too short for " << ktag << ".\n");
    620                 }
    621                 sscanf(ktok,"%lg",&((*pdval3)[i][j]));
     636                i++;
     637                if (maxlen && (maxlen*n < i+1))
     638                        _error2_("KMLFileTokenParse -- Double [m x n] field too short for " << ktag << ".\n");
     639                j=(j+1) % n;
     640                sscanf(ktok,"%lg",&((*pdval)[i]));
    622641                ktok=strtok(NULL,delim);
    623642        }
    624         xfree((void**)&kstr);
     643        xDelete<char>(kstr);
    625644
    626645        if (!maxlen)
    627                 *pdval3=(double (*)[3]) xrealloc(*pdval3,((i+1)*3)*sizeof(double));
     646                dval2=xNew<double>((i+1)*n);
     647                memcpy(dval2,*pdval,((i+1)*n)*sizeof(double));
     648                xDelete<double>(*pdval);
     649                *pdval=dval2;
     650                dval2=NULL;
     651//              *pdval=(double *) xrealloc(*pdval,((i+1)*n)*sizeof(double));
    628652
    629653        if (m)
    630                 *m=i+1;
    631 
    632         if (j != 2)
    633                 _pprintLine_("KMLFileTokenParse -- Double [m x 3] field for " << ktag << " does not have multiple of 3 values.");
     654                *m=((i+1)+(n-1))/n;
     655
     656        if ((i+1) % n)
     657                _pprintLine_("KMLFileTokenParse -- Double [m x n] field for " << ktag << " does not have multiple of n values.");
    634658
    635659/*  get additional token and compare to closing tag  */
     
    643667                  {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");}
    644668                else
    645                         xfree((void**)&kstr);
     669                        xDelete<char>(kstr);
    646670
    647671//      _pprintLine_("KMLFileTokenParse -- " << ktag << "=...");
    648672//      for (j=0; j<=i; j++)
    649 //              _pprintLine_("   [" << j << "][0-2]: " << (*pdval3)[j][0] << "g," << (*pdval3)[j][1] << "g," << (*pdval3)[j][2] << "g");
     673//              _pprintLine_("   [" << j << "]: " << (*pdval)[j] << "g");
    650674
    651675        return(0);
     
    671695                                 (!strncmp(&(kstr[2]),&(ktag[1]),(strcspn(ktag," >")-1)/sizeof(char)))) {
    672696                        _pprintLine_("KMLFileTagSkip -- closing tag " << kstr << ".");
    673                         xfree((void**)&kstr);
     697                        xDelete<char>(kstr);
    674698                        return(0);
    675699                }
     
    691715                }
    692716
    693                 xfree((void**)&kstr);
     717                xDelete<char>(kstr);
    694718        }
    695719
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KMLFileReadUtils.h

    r12832 r12946  
    4848                                          char* ktag,
    4949                                          FILE* fid);
    50 int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen,
     50int KMLFileTokenParse(double **pdval,int* m,int n,int maxlen,
    5151                                          char* ktag,
    5252                                          FILE* fid);
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Attribute.cpp

    r12835 r12946  
    3232KML_Attribute::~KML_Attribute(){
    3333
    34         if (name      ) xfree((void**)&name);
    35         if (value     ) xfree((void**)&value);
     34        if (name      ) xDelete<char>(name);
     35        if (value     ) xDelete<char>(value);
    3636
    3737}
     
    100100void  KML_Attribute::Alloc(const char* namei,const char* valuei){
    101101
    102         name =(char *) xmalloc((strlen(namei )+1)*sizeof(char));
     102        name =xNew<char>(strlen(namei )+1);
    103103        memcpy(name,namei,(strlen(namei)+1)*sizeof(char));
    104104
    105         value=(char *) xmalloc((strlen(valuei)+1)*sizeof(char));
     105        value=xNew<char>(strlen(valuei)+1);
    106106        memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char));
    107107
     
    121121
    122122        if (!value || !strlen(value)) {
    123                 *pvalueo=(char *) xmalloc((strlen(deflt)+1)*sizeof(char));
     123                *pvalueo=xNew<char>(strlen(deflt)+1);
    124124                memcpy(*pvalueo,deflt,(strlen(deflt)+1)*sizeof(char));
    125125        }
    126126        else {
    127                 *pvalueo=(char *) xmalloc((strlen(value)+1)*sizeof(char));
     127                *pvalueo=xNew<char>(strlen(value)+1);
    128128                memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char));
    129129        }
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Comment.cpp

    r12835 r12946  
    3131KML_Comment::~KML_Comment(){
    3232
    33         if (value     ) xfree((void**)&value);
     33        if (value     ) xDelete<char>(value);
    3434
    3535}
     
    9494void  KML_Comment::Alloc(const char* valuei){
    9595
    96         value=(char *) xmalloc((strlen(valuei)+1)*sizeof(char));
     96        value=xNew<char>(strlen(valuei)+1);
    9797        memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char));
    9898
     
    111111void  KML_Comment::Get(char** pvalueo){
    112112
    113         *pvalueo=(char *) xmalloc((strlen(value)+1)*sizeof(char));
     113        *pvalueo=xNew<char>(strlen(value)+1);
    114114        memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char));
    115115
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Container.cpp

    r12835 r12946  
    116116
    117117        if      (!strncmp(kstr,"</Container",11)) {
    118                 xfree((void**)&kstr);
     118                xDelete<char>(kstr);
    119119                return;
    120120        }
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Document.cpp

    r12835 r12946  
    102102                                                          &ncom,&pcom)) {
    103103                if      (!strncmp(kstri,"</Document",10)) {
    104                         xfree((void**)&kstri);
     104                        xDelete<char>(kstri);
    105105                        break;
    106106                }
     
    113113                        KML_Container::Read(fid,kstri);
    114114
    115                 xfree((void**)&kstri);
     115                xDelete<char>(kstri);
    116116        }
    117117
     
    119119
    120120        for (ncom; ncom>0; ncom--)
    121                 xfree((void**)&(pcom[ncom-1]));
    122         xfree((void**)&pcom);
     121                xDelete<char>(pcom[ncom-1]);
     122        xDelete<char*>(pcom);
    123123
    124124        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_File.cpp

    r12835 r12946  
    103103                                                          &ncom,&pcom)) {
    104104                if      (!strncmp(kstri,"</kml", 5)) {
    105                         xfree((void**)&kstri);
     105                        xDelete<char>(kstri);
    106106                        break;
    107107                }
     
    114114                        KML_Object::Read(fid,kstri);
    115115
    116                 xfree((void**)&kstri);
     116                xDelete<char>(kstri);
    117117        }
    118118
     
    120120
    121121        for (ncom; ncom>0; ncom--)
    122                 xfree((void**)&(pcom[ncom-1]));
    123         xfree((void**)&pcom);
     122                xDelete<char>(pcom[ncom-1]);
     123        xDelete<char*>(pcom);
    124124
    125125        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Folder.cpp

    r12835 r12946  
    102102                                                          &ncom,&pcom)) {
    103103                if      (!strncmp(kstri,"</Folder", 8)) {
    104                         xfree((void**)&kstri);
     104                        xDelete<char>(kstri);
    105105                        break;
    106106                }
     
    113113                        KML_Container::Read(fid,kstri);
    114114
    115                 xfree((void**)&kstri);
     115                xDelete<char>(kstri);
    116116        }
    117117
     
    119119
    120120        for (ncom; ncom>0; ncom--)
    121                 xfree((void**)&(pcom[ncom-1]));
    122         xfree((void**)&pcom);
     121                xDelete<char>(pcom[ncom-1]);
     122        xDelete<char*>(pcom);
    123123
    124124        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_GroundOverlay.cpp

    r12835 r12946  
    127127                                                          &ncom,&pcom)) {
    128128                if      (!strncmp(kstri,"</GroundOverlay",15)) {
    129                         xfree((void**)&kstri);
     129                        xDelete<char>(kstri);
    130130                        break;
    131131                }
     
    151151                        KML_Overlay::Read(fid,kstri);
    152152
    153                 xfree((void**)&kstri);
     153                xDelete<char>(kstri);
    154154        }
    155155
     
    157157
    158158        for (ncom; ncom>0; ncom--)
    159                 xfree((void**)&(pcom[ncom-1]));
    160         xfree((void**)&pcom);
     159                xDelete<char>(pcom[ncom-1]);
     160        xDelete<char*>(pcom);
    161161
    162162        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Icon.cpp

    r12835 r12946  
    141141                                                          &ncom,&pcom)) {
    142142                if      (!strncmp(kstri,"</Icon", 6)) {
    143                         xfree((void**)&kstri);
     143                        xDelete<char>(kstri);
    144144                        break;
    145145                }
     
    169169                        KML_Object::Read(fid,kstri);
    170170
    171                 xfree((void**)&kstri);
     171                xDelete<char>(kstri);
    172172        }
    173173
     
    175175
    176176        for (ncom; ncom>0; ncom--)
    177                 xfree((void**)&(pcom[ncom-1]));
    178         xfree((void**)&pcom);
     177                xDelete<char>(pcom[ncom-1]);
     178        xDelete<char*>(pcom);
    179179
    180180        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_LatLonBox.cpp

    r12835 r12946  
    117117                                                          &ncom,&pcom)) {
    118118                if      (!strncmp(kstri,"</LatLonBox",11)) {
    119                         xfree((void**)&kstri);
     119                        xDelete<char>(kstri);
    120120                        break;
    121121                }
     
    149149                        KML_Object::Read(fid,kstri);
    150150
    151                 xfree((void**)&kstri);
     151                xDelete<char>(kstri);
    152152        }
    153153
     
    155155
    156156        for (ncom; ncom>0; ncom--)
    157                 xfree((void**)&(pcom[ncom-1]));
    158         xfree((void**)&pcom);
     157                xDelete<char>(pcom[ncom-1]);
     158        xDelete<char*>(pcom);
    159159
    160160        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_LineString.cpp

    r12835 r12946  
    137137                                                          &ncom,&pcom)) {
    138138                if      (!strncmp(kstri,"</LineString",12)) {
    139                         xfree((void**)&kstri);
     139                        xDelete<char>(kstri);
    140140                        break;
    141141                }
     
    165165                        KML_Geometry::Read(fid,kstri);
    166166
    167                 xfree((void**)&kstri);
     167                xDelete<char>(kstri);
    168168        }
    169169
     
    171171
    172172        for (ncom; ncom>0; ncom--)
    173                 xfree((void**)&(pcom[ncom-1]));
    174         xfree((void**)&pcom);
     173                xDelete<char>(pcom[ncom-1]);
     174        xDelete<char*>(pcom);
    175175
    176176        return;
     
    186186/*  extract latitude and longitude into vectors  */
    187187
    188         lat=(double *) xmalloc(ncoord*sizeof(double));
    189         lon=(double *) xmalloc(ncoord*sizeof(double));
     188        lat=xNew<IssmDouble>(ncoord);
     189        lon=xNew<IssmDouble>(ncoord);
    190190        for (i=0; i<ncoord; i++) {
    191191                lon[i]=coords[3*i+0];
     
    195195/*  convert latitude and longitude to x and y  */
    196196
    197         x  =(double *) xmalloc(ncoord*sizeof(double));
    198         y  =(double *) xmalloc(ncoord*sizeof(double));
     197        x  =xNew<IssmDouble>(ncoord);
     198        y  =xNew<IssmDouble>(ncoord);
    199199        Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp);
    200200
     
    221221        fprintf(fid,"\n");
    222222
    223         xfree((void**)&y);
    224         xfree((void**)&x);
    225         xfree((void**)&lon);
    226         xfree((void**)&lat);
    227 
    228         return;
    229 }
    230 /*}}}*/
     223        xDelete<IssmDouble>(y);
     224        xDelete<IssmDouble>(x);
     225        xDelete<IssmDouble>(lon);
     226        xDelete<IssmDouble>(lat);
     227
     228        return;
     229}
     230/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_LineStyle.cpp

    r12835 r12946  
    109109                                                          &ncom,&pcom)) {
    110110                if      (!strncmp(kstri,"</LineStyle",11)) {
    111                         xfree((void**)&kstri);
     111                        xDelete<char>(kstri);
    112112                        break;
    113113                }
     
    125125                        KML_ColorStyle::Read(fid,kstri);
    126126
    127                 xfree((void**)&kstri);
     127                xDelete<char>(kstri);
    128128        }
    129129
     
    131131
    132132        for (ncom; ncom>0; ncom--)
    133                 xfree((void**)&(pcom[ncom-1]));
    134         xfree((void**)&pcom);
     133                xDelete<char>(pcom[ncom-1]);
     134        xDelete<char*>(pcom);
    135135
    136136        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_LinearRing.cpp

    r12835 r12946  
    150150                        KMLFileTokenParse(altmode,NULL,KML_LINEARRING_ALTMODE_LENGTH,kstri,fid);
    151151                else if (!strcmp(kstri,"<coordinates>"))
    152                         KMLFileTokenParse(&coords,&ncoord,0,kstri,fid);
     152                        KMLFileTokenParse(&coords,&ncoord,3,0,kstri,fid);
    153153                else if (!strncmp(kstri,"<",1))
    154154                        KML_Geometry::Read(fid,kstri);
     
    159159        this->AddCommnt(ncom,pcom);
    160160
    161         for(ncom;ncom>0;ncom--) xDelete<char>((pcom[ncom-1]));
     161        for(ncom; ncom>0; ncom--)
     162                xDelete<char>(pcom[ncom-1]);
    162163        xDelete<char*>(pcom);
    163164
     
    174175/*  extract latitude and longitude into vectors  */
    175176
    176         lat=xNew<double>(ncoord);
    177         lon=xNew<double>(ncoord);
     177        lat=xNew<IssmDouble>(ncoord);
     178        lon=xNew<IssmDouble>(ncoord);
    178179        for (i=0; i<ncoord; i++) {
    179180                lon[i]=coords[3*i+0];
     
    183184/*  convert latitude and longitude to x and y  */
    184185
    185         x  =xNew<double>(ncoord);
    186         y  =xNew<double>(ncoord);
     186        x  =xNew<IssmDouble>(ncoord);
     187        y  =xNew<IssmDouble>(ncoord);
    187188        Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp);
    188189
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_MultiGeometry.cpp

    r12835 r12946  
    136136                                                          &ncom,&pcom)) {
    137137                if      (!strncmp(kstri,"</MultiGeometry",15)) {
    138                         xfree((void**)&kstri);
     138                        xDelete<char>(kstri);
    139139                        break;
    140140                }
     
    177177                        KML_Geometry::Read(fid,kstri);
    178178
    179                 xfree((void**)&kstri);
     179                xDelete<char>(kstri);
    180180        }
    181181
     
    183183
    184184        for (ncom; ncom>0; ncom--)
    185                 xfree((void**)&(pcom[ncom-1]));
    186         xfree((void**)&pcom);
     185                xDelete<char>(pcom[ncom-1]);
     186        xDelete<char*>(pcom);
    187187
    188188        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Object.cpp

    r12835 r12946  
    304304                katt->Get(pvalue,deflt);
    305305        else {
    306                 *pvalue=(char *) xmalloc((strlen(deflt)+1)*sizeof(char));
     306                *pvalue=xNew<char>(strlen(deflt)+1);
    307307                memcpy(*pvalue,deflt,(strlen(deflt)+1)*sizeof(char));
    308308        }
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Overlay.cpp

    r12835 r12946  
    106106
    107107        if      (!strncmp(kstr,"</Overlay", 9)) {
    108                 xfree((void**)&kstr);
     108                xDelete<char>(kstr);
    109109                return;
    110110        }
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Placemark.cpp

    r12835 r12946  
    136136                                                          &ncom,&pcom)) {
    137137                if      (!strncmp(kstri,"</Placemark",11)) {
    138                         xfree((void**)&kstri);
     138                        xDelete<char>(kstri);
    139139                        break;
    140140                }
     
    177177                        KML_Feature::Read(fid,kstri);
    178178
    179                 xfree((void**)&kstri);
     179                xDelete<char>(kstri);
    180180        }
    181181
     
    183183
    184184        for (ncom; ncom>0; ncom--)
    185                 xfree((void**)&(pcom[ncom-1]));
    186         xfree((void**)&pcom);
     185                xDelete<char>(pcom[ncom-1]);
     186        xDelete<char*>(pcom);
    187187
    188188        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Point.cpp

    r12835 r12946  
    122122                                                          &ncom,&pcom)) {
    123123                if      (!strncmp(kstri,"</Point", 7)) {
    124                         xfree((void**)&kstri);
     124                        xDelete<char>(kstri);
    125125                        break;
    126126                }
     
    140140                        KML_Geometry::Read(fid,kstri);
    141141
    142                 xfree((void**)&kstri);
     142                xDelete<char>(kstri);
    143143        }
    144144
     
    146146
    147147        for (ncom; ncom>0; ncom--)
    148                 xfree((void**)&(pcom[ncom-1]));
    149         xfree((void**)&pcom);
     148                xDelete<char>(pcom[ncom-1]);
     149        xDelete<char*>(pcom);
    150150
    151151        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_PolyStyle.cpp

    r12835 r12946  
    113113                                                          &ncom,&pcom)) {
    114114                if      (!strncmp(kstri,"</PolyStyle",11)) {
    115                         xfree((void**)&kstri);
     115                        xDelete<char>(kstri);
    116116                        break;
    117117                }
     
    133133                        KML_ColorStyle::Read(fid,kstri);
    134134
    135                 xfree((void**)&kstri);
     135                xDelete<char>(kstri);
    136136        }
    137137
     
    139139
    140140        for (ncom; ncom>0; ncom--)
    141                 xfree((void**)&(pcom[ncom-1]));
    142         xfree((void**)&pcom);
     141                xDelete<char>(pcom[ncom-1]);
     142        xDelete<char*>(pcom);
    143143
    144144        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Polygon.cpp

    r12835 r12946  
    175175                                                          &ncom,&pcom)) {
    176176                if      (!strncmp(kstri,"</Polygon", 9)) {
    177                         xfree((void**)&kstri);
     177                        xDelete<char>(kstri);
    178178                        break;
    179179                }
     
    203203                                                                          &ncom,&pcom)) {
    204204                                if      (!strncmp(kstrj,"</outerBoundaryIs",17)) {
    205                                         xfree((void**)&kstrj);
     205                                        xDelete<char>(kstrj);
    206206                                        break;
    207207                                }
     
    220220                                        KML_Geometry::Read(fid,kstrj);
    221221
    222                                 xfree((void**)&kstrj);
     222                                xDelete<char>(kstrj);
    223223                        }
    224224
     
    230230                                                                          &ncom,&pcom)) {
    231231                                if      (!strncmp(kstrj,"</innerBoundaryIs",17)) {
    232                                         xfree((void**)&kstrj);
     232                                        xDelete<char>(kstrj);
    233233                                        break;
    234234                                }
     
    247247                                        KML_Geometry::Read(fid,kstrj);
    248248
    249                                 xfree((void**)&kstrj);
     249                                xDelete<char>(kstrj);
    250250                        }
    251251
     
    254254                        KML_Geometry::Read(fid,kstri);
    255255
    256                 xfree((void**)&kstri);
     256                xDelete<char>(kstri);
    257257        }
    258258
     
    260260
    261261        for (ncom; ncom>0; ncom--)
    262                 xfree((void**)&(pcom[ncom-1]));
    263         xfree((void**)&pcom);
     262                xDelete<char>(pcom[ncom-1]);
     263        xDelete<char*>(pcom);
    264264
    265265        return;
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Style.cpp

    r12835 r12946  
    3838        if (list) {
    3939//              delete list;
    40                 if (list      ) xfree((void**)&list);
    4140                list      =NULL;
    4241        }
    4342        if (balloon) {
    4443//              delete balloon;
    45                 if (balloon   ) xfree((void**)&balloon);
    4644                balloon   =NULL;
    4745        }
     
    5654        if (label) {
    5755//              delete label;
    58                 if (label     ) xfree((void**)&label);
    5956                label     =NULL;
    6057        }
    6158        if (icon) {
    6259//              delete icon;
    63                 if (icon      ) xfree((void**)&icon);
    6460                icon      =NULL;
    6561        }
     
    189185                                                          &ncom,&pcom)) {
    190186                if      (!strncmp(kstri,"</Style", 7)) {
    191                         xfree((void**)&kstri);
     187                        xDelete<char>(kstri);
    192188                        break;
    193189                }
     
    230226                        KML_StyleSelector::Read(fid,kstri);
    231227
    232                 xfree((void**)&kstri);
     228                xDelete<char>(kstri);
    233229        }
    234230
     
    236232
    237233        for (ncom; ncom>0; ncom--)
    238                 xfree((void**)&(pcom[ncom-1]));
    239         xfree((void**)&pcom);
    240 
    241         return;
    242 }
    243 /*}}}*/
     234                xDelete<char>(pcom[ncom-1]);
     235        xDelete<char*>(pcom);
     236
     237        return;
     238}
     239/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Unknown.cpp

    r12835 r12946  
    3232KML_Unknown::~KML_Unknown(){
    3333
    34         if (name      ) xfree((void**)&name);
    35         if (value     ) xfree((void**)&value);
     34        if (name      ) xDelete<char>(name);
     35        if (value     ) xDelete<char>(value);
    3636
    3737}
     
    7777
    7878        if (value     ) {
    79                 valuei=(char *) xmalloc((strlen(value)+1)*sizeof(char));
     79                valuei=xNew<char>(strlen(value)+1);
    8080                memcpy(valuei,value,(strlen(value)+1)*sizeof(char));
    8181       
     
    8787                if(flag) _pprintLine_("\"");
    8888
    89                 xfree((void**)&valuei);
     89                xDelete<char>(valuei);
    9090        }
    9191    else
     
    108108
    109109        if (value     ) {
    110                 valuei=(char *) xmalloc((strlen(value)+1)*sizeof(char));
     110                valuei=xNew<char>(strlen(value)+1);
    111111                memcpy(valuei,value,(strlen(value)+1)*sizeof(char));
    112112       
     
    117117                        fprintf(filout,"%s  %s\n",indent,vtoken);
    118118
    119                 xfree((void**)&valuei);
     119                xDelete<char>(valuei);
    120120        }
    121121
     
    131131
    132132        char*        kstri;
     133        char*        value2=NULL;
    133134        int          ncom=0;
    134135        char**       pcom=NULL;
     
    155156                                 !strncmp(&kstri[2],name,strlen(name))) {
    156157//                      _pprintLine_("KML_Unknown::Read -- closing name=" << name << ".");
    157                         xfree((void**)&kstri);
     158                        xDelete<char>(kstri);
    158159                        break;
    159160                }
     
    163164                else if (strncmp(kstri,"<",1)) {
    164165                        if (value) {
    165                                 value=(char *) xrealloc(value,(strlen(value)+1+strlen(kstri)+1)*sizeof(char));
     166                                value2=xNew<char>(strlen(value)+1+strlen(kstri)+1);
     167                                memcpy(value2,value,(strlen(value)+1)*sizeof(char));
     168                                xDelete<char>(value);
     169                                value=value2;
     170                                value2=NULL;
     171//                              value=(char *) xrealloc(value,(strlen(value)+1+strlen(kstri)+1)*sizeof(char));
    166172                                strcat(value,nl);
    167173                                strcat(value,kstri);
    168174                        }
    169175                        else {
    170                                 value=(char *) xmalloc((strlen(kstri)+1)*sizeof(char));
     176                                value=xNew<char>(strlen(kstri)+1);
    171177                                memcpy(value,kstri,(strlen(kstri)+1)*sizeof(char));
    172178                        }
     
    176182                        KML_Object::Read(fid,kstri);
    177183
    178                 xfree((void**)&kstri);
     184                xDelete<char>(kstri);
    179185        }
    180186
     
    182188
    183189        for (ncom; ncom>0; ncom--)
    184                 xfree((void**)&(pcom[ncom-1]));
    185         xfree((void**)&pcom);
     190                xDelete<char>(pcom[ncom-1]);
     191        xDelete<char*>(pcom);
    186192
    187193        return;
  • issm/branches/trunk-jpl-damage/src/c/modules/EnumToStringx/EnumToStringx.cpp

    r12917 r12946  
    398398                case IceVolumeEnum : return "IceVolume";
    399399                case TotalSmbEnum : return "TotalSmb";
     400                case ThicknessAlongGradientEnum : return "ThicknessAlongGradient";
     401                case ThicknessAcrossGradientEnum : return "ThicknessAcrossGradient";
    400402                case P0Enum : return "P0";
    401403                case P1Enum : return "P1";
  • issm/branches/trunk-jpl-damage/src/c/modules/Responsex/Responsex.cpp

    r12878 r12946  
    4141                case ThicknessAbsMisfitEnum:     ThicknessAbsMisfitx(      responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
    4242                case ThicknessAbsGradientEnum:   ThicknessAbsGradientx(    responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
     43                case ThicknessAlongGradientEnum:   ThicknessAlongGradientx(    responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
     44                case ThicknessAcrossGradientEnum:   ThicknessAcrossGradientx(    responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
    4345                case TotalSmbEnum:                                      TotalSmbx(                responses, elements,nodes, vertices, loads, materials, parameters,process_units); break;
    4446                case RheologyBbarAbsGradientEnum:RheologyBbarAbsGradientx( responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
  • issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.cpp

    r12878 r12946  
    3030
    3131        /*According to matrix type, use specific solvers: */
    32         if(Kff->type==PetscMatType){
    33                 PetscVec* uf0_vector = NULL;
    34                 PetscVec* df_vector  = NULL;
    35                 if(uf0) uf0_vector = uf0->pvector;
    36                 if(df)  df_vector  = df->pvector;
    37 
    38                 SolverxPetsc(&uf->pvector,Kff->pmatrix,pf->pvector,uf0_vector,df_vector,parameters);
     32        switch(Kff->type){
     33                #ifdef _HAVE_PETSC_
     34                case PetscMatType:{
     35                        PetscVec* uf0_vector = NULL;
     36                        PetscVec* df_vector  = NULL;
     37                        if(uf0) uf0_vector = uf0->pvector;
     38                        if(df)  df_vector  = df->pvector;
     39                        SolverxPetsc(&uf->pvector,Kff->pmatrix,pf->pvector,uf0_vector,df_vector,parameters);
     40                        break;}
     41                #endif
     42                case SeqMatType:{
     43                        SolverxSeq(&uf->svector,Kff->smatrix,pf->svector);
     44                        break;}
     45                default:
     46                          _error2_("Matrix type: " << Kff->type << " not supported yet!");
    3947        }
    40         else if(Kff->type==SeqMatType){
    41                 SolverxSeq(&uf->svector,Kff->smatrix,pf->svector);
    42         }
    43         else _error2_("Matrix type: " << Kff->type << " not supported yet!");
    4448
    4549        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/StringToEnumx/StringToEnumx.cpp

    r12917 r12946  
    408408              else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
    409409              else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
     410              else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
     411              else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
    410412              else if (strcmp(name,"P0")==0) return P0Enum;
    411413              else if (strcmp(name,"P1")==0) return P1Enum;
  • issm/branches/trunk-jpl-damage/src/c/modules/modules.h

    r12878 r12946  
    119119#include "./ThicknessAbsMisfitx/ThicknessAbsMisfitx.h"
    120120#include "./ThicknessAbsGradientx/ThicknessAbsGradientx.h"
     121#include "./ThicknessAlongGradientx/ThicknessAlongGradientx.h"
     122#include "./ThicknessAcrossGradientx/ThicknessAcrossGradientx.h"
    121123#include "./UpdateVertexPositionsx/UpdateVertexPositionsx.h"
    122124#include "./UpdateConstraintsx/UpdateConstraintsx.h"
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp

    r12878 r12946  
    1616  IssmDouble glacialindex; // used to vary present day temperature
    1717  int imonth=0;
    18   // printf("Delta18oTime %f\n",Delta18oTime);
    19   // printf("Delta18oPresent %f\n",Delta18oPresent);
    20   // printf("Delta18oLgm %f\n",Delta18oLgm);
    2118
    22   glacialindex = (Delta18oTime-Delta18oPresent-delta18oLapseRate*(Delta18oSurfaceTime-Delta18oSurfacePresent))
    23     /(Delta18oLgm-Delta18oPresent-delta18oLapseRate*(Delta18oSurfaceLgm-Delta18oSurfacePresent));
    24   // printf(" monthlytemperatureseeeeee %f\n",TemperaturesPresentday[1]);
    25   // printf(" monthlypreceeeeeeee %f\n",TemperaturesLgm[1]);
    26   // printf(" glacialindex %f\n",glacialindex);
     19  glacialindex = 0;//(Delta18oTime-Delta18oPresent-delta18oLapseRate*(Delta18oSurfaceTime-Delta18oSurfacePresent))
     20  //  /(Delta18oLgm-Delta18oPresent-delta18oLapseRate*(Delta18oSurfaceLgm-Delta18oSurfacePresent));
    2721
    2822  for (int imonth = 0; imonth<12; imonth++){ 
    29     monthlytemperaturestmp[imonth] = TemperaturesPresentday[imonth];//glacialindex*TemperaturesLgm[imonth] + (1-glacialindex)*TemperaturesPresentday[imonth];
     23    monthlytemperaturestmp[imonth] = glacialindex*TemperaturesLgm[imonth] + (1-glacialindex)*TemperaturesPresentday[imonth];
    3024    //monthlyprectmp[imonth] = 1.5*pow(2,((monthlytemperaturestmp[imonth]-273.15-0)/10)); //equation from rob's paper
    3125    monthlyprectmp[imonth] = PrecipitationsPresentday[imonth];
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/UnitConversion.cpp

    r12878 r12946  
    5151                case TimesteppingTimeStepEnum:               scale=1.0/yts;break; //yr
    5252                case TimeEnum:                               scale=1.0/yts;break; //yr
    53                 case HydrologyWaterVxEnum:                   scale=yts;break; //m/yr
    54                 case HydrologyWaterVyEnum:                   scale=yts;break; //m/yr
    55                 case VxEnum:                                 scale=yts;break; //m/yr
    56                 case InversionVxObsEnum:                     scale=yts;break; //m/yr
    57                 case VyEnum:                                 scale=yts;break; //m/yr
    58                 case InversionVyObsEnum:                     scale=yts;break; //m/yr
    59                 case VzEnum:                                 scale=yts;break; //m/yr
    60                 case InversionVzObsEnum:                     scale=yts;break; //m/yr
    61                 case VelEnum:                                scale=yts;break; //m/yr
    62                 case InversionVelObsEnum:                    scale=yts;break; //m/yr
    63                 case BalancethicknessThickeningRateEnum:     scale=yts;break; //m/yr
    64                 case BasalforcingsMeltingRateEnum:           scale=yts;break; //m/yr
    65                 case BasalforcingsMeltingRateCorrectionEnum: scale=yts;break; //m/yr
    66                 case SurfaceforcingsPrecipitationEnum:       scale=yts;break; //m/yr
    67                 case SurfaceforcingsMassBalanceEnum:         scale=yts;break; //m/yr
    68                 case SurfaceforcingsSmbPosMaxEnum:                              scale=yts;break; //m/yr
    69                 case SurfaceforcingsSmbPosMinEnum:                              scale=yts;break; //m/yr
    70                 case SurfaceforcingsAPosEnum:                                           scale=yts;break; //m/yr
    71                 case SurfaceforcingsBPosEnum:                                           scale=yts;break; //m/yr
    72                 case SurfaceforcingsANegEnum:                                           scale=yts;break; //m/yr
    73                 case SurfaceforcingsBNegEnum:                                           scale=yts;break; //m/yr
     53                case HydrologyWaterVxEnum:                   scale=yts;break;     //m/yr
     54                case HydrologyWaterVyEnum:                   scale=yts;break;     //m/yr
     55                case VxEnum:                                 scale=yts;break;     //m/yr
     56                case InversionVxObsEnum:                     scale=yts;break;     //m/yr
     57                case VyEnum:                                 scale=yts;break;     //m/yr
     58                case InversionVyObsEnum:                     scale=yts;break;     //m/yr
     59                case VzEnum:                                 scale=yts;break;     //m/yr
     60                case InversionVzObsEnum:                     scale=yts;break;     //m/yr
     61                case VelEnum:                                scale=yts;break;     //m/yr
     62                case InversionVelObsEnum:                    scale=yts;break;     //m/yr
     63                case BalancethicknessThickeningRateEnum:     scale=yts;break;     //m/yr
     64                case BasalforcingsMeltingRateEnum:           scale=yts;break;     //m/yr
     65                case BasalforcingsMeltingRateCorrectionEnum: scale=yts;break;     //m/yr
     66                case SurfaceforcingsPrecipitationEnum:       scale=yts;break;     //m/yr
     67                case SurfaceforcingsMassBalanceEnum:         scale=yts;break;     //m/yr
     68                case SurfaceforcingsSmbPosMaxEnum:                              scale=yts;break;     //m/yr
     69                case SurfaceforcingsSmbPosMinEnum:                              scale=yts;break;     //m/yr
     70                case SurfaceforcingsAPosEnum:                                           scale=yts;break;     //m/yr
     71                case SurfaceforcingsBPosEnum:                                           scale=yts;break;     //m/yr
     72                case SurfaceforcingsANegEnum:                                           scale=yts;break;     //m/yr
     73                case SurfaceforcingsBNegEnum:                                           scale=yts;break;     //m/yr
    7474                case MisfitEnum:                             scale=pow(yts,2);break; //(m/yr)^2
    7575                case MassFluxEnum:                           scale=pow((IssmDouble)10,-12)*yts;break; // (GigaTon/year)
  • issm/branches/trunk-jpl-damage/src/c/solutions/controltao_core.cpp

    r12878 r12946  
    2121typedef struct {
    2222        FemModel* femmodel;
     23        double*   J;
    2324} AppCtx;
    2425
     
    6970        GetVectorFromControlInputsx(&XL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound");
    7071        GetVectorFromControlInputsx(&XU,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"upperbound");
    71         TaoSetInitialVector(tao,X->vector);
    72         TaoSetVariableBounds(tao,XL->vector,XU->vector);
     72        TaoSetInitialVector(tao,X->pvector->vector);
     73        TaoSetVariableBounds(tao,XL->pvector->vector,XU->pvector->vector);
    7374        xdelete(&XL);
    7475        xdelete(&XU);
    7576
     77        user.J=(double*)xcalloc((maxiter+5),sizeof(double));
    7678        user.femmodel=femmodel;
    7779        TaoSetObjectiveAndGradientRoutine(tao,FormFunctionGradient,(void*)&user);
     
    8183        TaoSolve(tao);
    8284        TaoView(tao,PETSC_VIEWER_STDOUT_WORLD);
    83         TaoGetSolutionVector(tao,&X->vector);
     85        TaoGetSolutionVector(tao,&X->pvector->vector);
    8486        SetControlInputsFromVectorx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,X);
    8587        for(int i=0;i<num_controls;i++){
    8688                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,control_list[i]);
    8789        }
     90        femmodel->results->AddObject(new DoubleVecExternalResult(femmodel->results->Size()+1,JEnum,user.J,maxiter+3,1,0));
    8891
    8992        /*Finalize*/
     
    142145        /*Compute gradient*/
    143146        Gradjx(&gradient,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
    144         VecCopy(gradient->vector,G); xdelete(&gradient);
     147        VecCopy(gradient->pvector->vector,G); xdelete(&gradient);
    145148        VecScale(G,-1.);
    146149
     
    166169        if(its==0) _pprintLine_("-----------------------------------+-----------------------");
    167170        _pprintString_(setw(4)<<its<<"   "<<setw(12)<<setprecision(7)<<f<<"  "<<setw(12)<<setprecision(7)<<gnorm<<"  | ");
     171        user->J[its]=f;
    168172
    169173        /*Retrieve objective functions independently*/
  • issm/branches/trunk-jpl-damage/src/c/solutions/transient_core.cpp

    r12878 r12946  
    2424        /*parameters: */
    2525        IssmDouble starttime,finaltime,dt,yts;
    26         bool   isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy;
     26        bool   isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy,isdelta18o;
    2727        bool   save_results,dakota_analysis;
    2828        bool   time_adapt=false;
     
    5353        femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);
    5454        if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum);
     55        femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
    5556
    5657        /*initialize: */
     
    141142                        RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs);
    142143
     144                        if(isdelta18o){
     145                                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceforcingsMonthlytemperaturesEnum);
     146                                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceforcingsPrecipitationEnum);
     147                        }
     148
    143149                        if(VerboseSolution()) _pprintLine_("   saving temporary results");
    144150                        OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
  • issm/branches/trunk-jpl-damage/src/m/Makefile.am

    r12168 r12946  
    1111                                ./model/partition/*.m \
    1212                                ./model/solvers/*.m \
    13                                 ./planet/*.m \
    1413                                ./qmu/*.m \
    1514                                ./utils/*.m \
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/acenet.m

    r12878 r12946  
    1818                 time=10;
    1919                 % codepath='/usr/local/issm-r11321/bin'; % this one is for issm on acenet global
    20                  codepath='/home/klemorza/issm/bin'; % this one is for issm on my acenet directory
     20                 codepath='PATH'; % this one is for issm on my acenet directory
    2121                 executionpath='/home/klemorza/issm/execution';
    2222                 %}}}
     
    8686                                 compressstring = [compressstring ' ' filelist{i}];
    8787                         end
    88                          if cluster.interactive,
    89                                  compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
    90                          end
    9188                         system(compressstring);
    9289
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.py

    r12878 r12946  
    1414        GENERIC cluster class definition
    1515 
    16             Usage:
    17                cluster=generic('name','astrid','np',3);
    18                cluster=generic('name',oshostname(),'np',3,'login','username');
     16           Usage:
     17              cluster=generic('name','astrid','np',3);
     18              cluster=generic('name',oshostname(),'np',3,'login','username');
    1919        """
    2020
  • issm/branches/trunk-jpl-damage/src/m/classes/diagnostic.m

    r12878 r12946  
    7373                        md = checkfield(md,'diagnostic.spcvy','forcing',1);
    7474                        if md.mesh.dimension==3, md = checkfield(md,'diagnostic.spcvz','forcing',1); end
    75                         md = checkfield(md,'diagnostic.restol','size',[1 1],'>',0);
     75                        md = checkfield(md,'diagnostic.restol','size',[1 1],'>',0,'NaN',1);
    7676                        md = checkfield(md,'diagnostic.reltol','size',[1 1]);
    7777                        md = checkfield(md,'diagnostic.abstol','size',[1 1]);
  • issm/branches/trunk-jpl-damage/src/m/classes/mesh.m

    r12878 r12946  
    5757                function obj = setdefaultparameters(obj) % {{{
    5858
    59                         %the connectivity is the avergaded number of nodes linked to a
     59                        %the connectivity is the averaged number of nodes linked to a
    6060                        %given node through an edge. This connectivity is used to initially
    6161                        %allocate memory to the stiffness matrix. A value of 16 seems to
  • issm/branches/trunk-jpl-damage/src/m/classes/mesh.py

    r12168 r12946  
    11#module imports
     2import numpy
    23from fielddisplay import fielddisplay
     4from checkfield import *
     5from EnumDefinitions import *
     6from MatlabFuncs import *
    37
    48class mesh:
     
    6569                else:
    6670                        string="\n%s"%("      Elements and vertices:")
    67 
    6871                string="%s\n%s"%(string,fielddisplay(obj,"numberofelements","number of elements"))
    69                
    70 
    71 
    72 
    7372                string="%s\n%s"%(string,fielddisplay(obj,"numberofvertices","number of vertices"))
    7473                string="%s\n%s"%(string,fielddisplay(obj,"elements","index into (x,y,z), coordinates of the vertices"))
     
    8079
    8180                string="%s%s"%(string,"\n      Properties:")
    82                
    8381                string="%s\n%s"%(string,fielddisplay(obj,"dimension","mesh dimension (2d or 3d)"))
    8482                string="%s\n%s"%(string,fielddisplay(obj,"numberoflayers","number of extrusion layers"))
     
    9290                string="%s\n%s"%(string,fielddisplay(obj,"lowerelements","lower element list (NaN for element on the lower layer"))
    9391                string="%s\n%s"%(string,fielddisplay(obj,"vertexonboundary","vertices on the boundary of the domain flag list"))
    94                
    9592                string="%s\n%s"%(string,fielddisplay(obj,"segments","edges on domain boundary (vertex1 vertex2 element)"))
    9693                string="%s\n%s"%(string,fielddisplay(obj,"segmentmarkers","number associated to each segment"))
     
    10097
    10198                string="%s%s"%(string,"\n      Extracted model:")
    102 
    10399                string="%s\n%s"%(string,fielddisplay(obj,"extractedvertices","vertices extracted from the model"))
    104100                string="%s\n%s"%(string,fielddisplay(obj,"extractedelements","elements extracted from the model"))
     
    114110                # {{{setdefaultparameters
    115111               
    116                 #the connectivity is the avergaded number of nodes linked to a
     112                #the connectivity is the averaged number of nodes linked to a
    117113                #given node through an edge. This connectivity is used to initially
    118114                #allocate memory to the stiffness matrix. A value of 16 seems to
     
    124120        #}}}
    125121
     122        def checkconsistency(self,md,solution,analyses):    # {{{
     123
     124                md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
     125                md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
     126                md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
     127                md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',range(1,md.mesh.numberofvertices+1))
     128                if md.mesh.dimension==2:
     129                        md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements,3])
     130                else:
     131                        md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements,6])
     132                if any(numpy.logical_not(ismember(range(1,md.mesh.numberofvertices+1),md.mesh.elements))):
     133                        md = checkmessage(md,"orphan nodes have been found. Check the mesh outline")
     134                md = checkfield(md,'mesh.dimension','values',[2,3])
     135                md = checkfield(md,'mesh.numberoflayers','>=',0)
     136                md = checkfield(md,'mesh.numberofelements','>',0)
     137                md = checkfield(md,'mesh.numberofvertices','>',0)
     138                #no checks for numberofedges lat long and hemisphere
     139                md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements],'values',[0,1])
     140                md = checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements],'values',[0,1])
     141                md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices],'values',[0,1])
     142                md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices],'values',[0,1])
     143                if md.mesh.dimension==2:
     144                        md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message',"'mesh.average_vertex_connectivity' should be at least 9 in 2d")
     145                else:
     146                        md = checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message',"'mesh.average_vertex_connectivity' should be at least 24 in 3d")
     147                md = checkfield(md,'mesh.elementconnectivity','size',[md.mesh.numberofelements,3],'NaN',1)
     148
     149                #Solution specific checks
     150                if   solution==PrognosticSolutionEnum:
     151                        if md.prognostic.stabilization==3:
     152                                md = checkfield(md,'mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
     153                                md = checkfield(md,'mesh.edges','size',[float('NaN'),4])
     154                                md = checkfield(md,'mesh.edges[:,1:3]','>',0)
     155                elif solution==BalancethicknessSolutionEnum:
     156                        if md.balancethickness.stabilization==3:
     157                                md = checkfield(md,'mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
     158                                md = checkfield(md,'mesh.edges','size',[float('NaN'),4])
     159                                md = checkfield(md,'mesh.edges[:,1:3]','>',0)
     160                elif solution==TransientSolutionEnum:
     161                        if md.transient.isprognostic and md.prognostic.stabilization==3:
     162                                md = checkfield(md,'mesh.dimension','values',2,'message',"Discontinuous Galerkin only supported for 2d meshes")
     163                                md = checkfield(md,'mesh.edges','size',[float('NaN'),4])
     164                                md = checkfield(md,'mesh.edges[:,1:3]','>',0)
     165                elif solution==ThermalSolutionEnum:
     166                        md = checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes')
     167
     168                return md
     169        # }}}
     170
     171        def marshall(self,fid):    # {{{
     172                WriteData(fid,'object',self,'fieldname','x','format','DoubleMat','mattype',1)
     173                WriteData(fid,'object',self,'fieldname','y','format','DoubleMat','mattype',1)
     174                WriteData(fid,'object',self,'fieldname','z','format','DoubleMat','mattype',1)
     175                WriteData(fid,'object',self,'fieldname','elements','format','DoubleMat','mattype',2)
     176                WriteData(fid,'object',self,'fieldname','dimension','format','Integer')
     177                WriteData(fid,'object',self,'fieldname','numberoflayers','format','Integer')
     178                WriteData(fid,'object',self,'fieldname','numberofelements','format','Integer')
     179                WriteData(fid,'object',self,'fieldname','numberofvertices','format','Integer')
     180                WriteData(fid,'object',self,'fieldname','numberofedges','format','Integer')
     181                WriteData(fid,'object',self,'fieldname','elementonbed','format','BooleanMat','mattype',2)
     182                WriteData(fid,'object',self,'fieldname','elementonsurface','format','BooleanMat','mattype',2)
     183                WriteData(fid,'object',self,'fieldname','vertexonbed','format','BooleanMat','mattype',1)
     184                WriteData(fid,'object',self,'fieldname','vertexonsurface','format','BooleanMat','mattype',1)
     185                WriteData(fid,'object',self,'fieldname','lowerelements','format','DoubleMat','mattype',2)
     186                WriteData(fid,'object',self,'fieldname','upperelements','format','DoubleMat','mattype',2)
     187                WriteData(fid,'object',self,'fieldname','edges','format','DoubleMat','mattype',3)
     188                WriteData(fid,'object',self,'fieldname','elementconnectivity','format','DoubleMat','mattype',3)
     189                WriteData(fid,'object',self,'fieldname','average_vertex_connectivity','format','Integer')
     190                WriteData(fid,'object',self,'fieldname','elements2d','format','DoubleMat','mattype',3)
     191                WriteData(fid,'object',self,'fieldname','numberofvertices2d','format','Integer')
     192                WriteData(fid,'object',self,'fieldname','numberofelements2d','format','Integer')
     193        # }}}
     194
  • issm/branches/trunk-jpl-damage/src/m/classes/model/model.py

    r12878 r12946  
    3232from miscellaneous import miscellaneous
    3333from private import private
     34from EnumDefinitions import *
    3435#}}}
     36
    3537class model(object):
    3638        #properties
     
    5153
    5254                self.debug            = debug()
    53                 self.verbose          = verbose()
     55                self.verbose          = verbose('solution',True,'qmu',True,'control',True)
    5456                self.settings         = settings()
    5557                self.solver           = solver()
     58#               need EnumToString for these to work
     59#               if ismumps:
     60#                       md.solver.addoptions(DiagnosticVertAnalysisEnum(),mumpsoptions)
     61#               else:
     62#                       md.solver.addoptions(DiagnosticVertAnalysisEnum(),iluasmoptions)
    5663                self.cluster          = generic()
    5764
     
    7077                self.qmu              = qmu()
    7178
    72                 self.results          = [];
     79                self.results          = {}
    7380                self.radaroverlay     = radaroverlay()
    7481                self.miscellaneous    = miscellaneous()
    7582                self.private          = private()
    7683                #}}}
     84
    7785        def __repr__(obj):
    7886                # {{{ Display
     
    111119                string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("radaroverlay","[%s,%s]" % ("1x1",obj.radaroverlay.__class__.__name__),"radar image for plot overlay"))
    112120                string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("miscellaneous","[%s,%s]" % ("1x1",obj.miscellaneous.__class__.__name__),"miscellaneous fields"))
    113                 return string;
    114                  #}}}
     121                return string
     122        # }}}
     123
     124        def checkmessage(self,string):    # {{{
     125                print ("model not consistent: %s" % string)
     126                self.private.isconsistent=False
     127        # }}}
     128
  • issm/branches/trunk-jpl-damage/src/m/classes/pairoptions.py

    r12878 r12946  
    55        PAIROPTIONS class definition
    66 
    7             Usage:
    8                pairoptions=pairoptions();
    9                pairoptions=pairoptions('module',true,'solver',false);
     7           Usage:
     8              pairoptions=pairoptions();
     9              pairoptions=pairoptions('module',true,'solver',false);
    1010        """
    1111
  • issm/branches/trunk-jpl-damage/src/m/classes/private.m

    r12878 r12946  
    3131                        fielddisplay(obj,'isconsistent','is model self consistent');
    3232                        fielddisplay(obj,'runtimename','name of the run launched');
    33                         fielddisplay(obj,'bamg','structure with mesh properties construced if bamg is used to mesh the domain');
     33                        fielddisplay(obj,'bamg','structure with mesh properties constructed if bamg is used to mesh the domain');
    3434                        fielddisplay(obj,'solution','type of solution launched');
    3535
  • issm/branches/trunk-jpl-damage/src/m/classes/private.py

    r12168 r12946  
    66        def __init__(self):
    77                # {{{ Properties
    8                 self.runtimename = ''
    9                 self.bamg        = {}
    10                 self.solution    = '';
     8                self.isconsistent = True;
     9                self.runtimename  = ''
     10                self.bamg         = {}
     11                self.solution     = '';
    1112
    1213                #set defaults
     
    1718                # {{{ Display
    1819                string='   private parameters: do not change'
     20
     21                string="%s\n%s"%(string,fielddisplay(obj,'isconsistent','is model self consistent'))
    1922                string="%s\n%s"%(string,fielddisplay(obj,'runtimename','name of the run launched'))
    20                 string="%s\n%s"%(string,fielddisplay(obj,'bamg','structure with mesh properties construced if bamg is used to mesh the domain'))
     23                string="%s\n%s"%(string,fielddisplay(obj,'bamg','structure with mesh properties constructed if bamg is used to mesh the domain'))
    2124                string="%s\n%s"%(string,fielddisplay(obj,'solution','type of solution launched'))
    2225                return string
  • issm/branches/trunk-jpl-damage/src/m/classes/verbose.m

    r12878 r12946  
    4242                                case 1,
    4343                                        binary=varargin{1};
    44                                         if ischar(binary),
     44                                        if     ischar(binary),
    4545                                                if strcmpi(binary,'all'),
    4646                                                        binary=2^11-1; %all ones
     
    5151                                                        verbose=BinaryToVerbose(verbose,binary);
    5252                                                end
     53                                        elseif isnumeric(binary),
     54                                                verbose=BinaryToVerbose(verbose,binary);
    5355                                        end
    5456                                otherwise,
     
    8890
    8991                %BEGINBIN2VERB
    90                 if bitand(binary,1), verbose.mprocessor=true; else verbose.mprocessor=false; end
    91                 if bitand(binary,2), verbose.module=true; else verbose.module=false; end
    92                 if bitand(binary,4), verbose.solution=true; else verbose.solution=false; end
    93                 if bitand(binary,8), verbose.solver=true; else verbose.solver=false; end
    94                 if bitand(binary,16), verbose.convergence=true; else verbose.convergence=false; end
    95                 if bitand(binary,32), verbose.control=true; else verbose.control=false; end
    96                 if bitand(binary,64), verbose.qmu=true; else verbose.qmu=false; end
     92                verbose.mprocessor =logical(bitand(binary, 1));
     93                verbose.module     =logical(bitand(binary, 2));
     94                verbose.solution   =logical(bitand(binary, 4));
     95                verbose.solver     =logical(bitand(binary, 8));
     96                verbose.convergence=logical(bitand(binary,16));
     97                verbose.control    =logical(bitand(binary,32));
     98                verbose.qmu        =logical(bitand(binary,64));
    9799                %ENDBIN2VERB
    98100
  • issm/branches/trunk-jpl-damage/src/m/classes/verbose.py

    r12168 r12946  
    1 #module imports
    2 from fielddisplay import fielddisplay
     1from pairoptions import *
     2from MatlabFuncs import *
     3from WriteData import *
     4from EnumDefinitions import *
    35
    4 class verbose:
    5         #properties
    6         def __init__(self):
    7                 # {{{ Properties
     6class verbose(object):
     7        """
     8        VERBOSE class definition
     9
     10           Available verbosity levels:
     11              mprocessor  : model processing
     12              module      : modules
     13              solution    : solution sequence
     14              solver      : solver info (extensive)
     15              convergence : convergence criteria
     16              control     : control method
     17              qmu         : sensitivity analysis
     18
     19           Usage:
     20              verbose=verbose();
     21              verbose=verbose(3);
     22              verbose=verbose('001100');
     23              verbose=verbose('module',True,'solver',False);
     24
     25        WARNING: some parts of this file are Synchronized with src/c/shared/Numerics/Verbosity.h
     26                 Do not modify these sections. See src/c/shared/Numerics/README for more info
     27        """
     28
     29        def __init__(self,*args):    # {{{
     30                #BEGINFIELDS
    831                self.mprocessor  = False
    932                self.module      = False
     
    1336                self.control     = False
    1437                self.qmu         = False
    15                 #}}}
    16         def __repr__(obj):
    17                 # {{{ Display
    18                 string="%s%s%s\n\n"%("class '",obj.__class__.__name__,"'=")
    19                 string="%s%s\n"%(string,"   %15s : %s"%("mprocessor",obj.mprocessor))
    20                 string="%s%s\n"%(string,"   %15s : %s"%("module",obj.module))
    21                 string="%s%s\n"%(string,"   %15s : %s"%("solution",obj.solution))
    22                 string="%s%s\n"%(string,"   %15s : %s"%("solver",obj.solver))
    23                 string="%s%s\n"%(string,"   %15s : %s"%("convergence",obj.convergence))
    24                 string="%s%s\n"%(string,"   %15s : %s"%("control",obj.control))
    25                 string="%s%s\n"%(string,"   %15s : %s"%("qmu",obj.qmu))
    26                 return string
    27                 #}}}
     38                #ENDFIELDS
     39
     40                if not len(args):
     41                        #Don't do anything
     42                        pass
     43
     44                elif len(args) == 1:
     45                        binary=args[0]
     46                        if   isinstance(binary,str):
     47                                if strcmpi(binary,'all'):
     48                                        binary=2**11-1    #all ones
     49                                        self.BinaryToVerbose(binary)
     50                                        self.solver=False    #Do not use by default
     51                                else:
     52                                        binary=int(binary,2)
     53                                        self.BinaryToVerbose(binary)
     54                        elif isinstance(binary,(int,float)):
     55                                self.BinaryToVerbose(int(binary))
     56
     57                else:
     58                        #Use options to initialize object
     59                        self=pairoptions(*args).AssignObjectFields(self)
     60
     61                        #Cast to logicals
     62                        listproperties=vars(self)
     63                        for [fieldname,fieldvalue] in listproperties.iteritems():
     64                                if isinstance(fieldvalue,bool) or isinstance(fieldvalue,(int,float)):
     65                                        setattr(self,fieldname,bool(fieldvalue))
     66                                else:
     67                                        raise TypeError("verbose supported field values are logicals only (True or False)")
     68        # }}}
     69
     70        def VerboseToBinary(self):    # {{{
     71
     72                #BEGINVERB2BIN
     73                binary=0
     74                if self.mprocessor:
     75                        binary=binary |  1
     76                if self.module:
     77                        binary=binary |  2
     78                if self.solution:
     79                        binary=binary |  4
     80                if self.solver:
     81                        binary=binary |  8
     82                if self.convergence:
     83                        binary=binary | 16
     84                if self.control:
     85                        binary=binary | 32
     86                if self.qmu:
     87                        binary=binary | 64
     88                #ENDVERB2BIN
     89
     90                return binary
     91        # }}}
     92
     93        def BinaryToVerbose(self,binary):    # {{{
     94
     95                #BEGINBIN2VERB
     96                self.mprocessor =bool(binary &  1)
     97                self.module     =bool(binary &  2)
     98                self.solution   =bool(binary &  4)
     99                self.solver     =bool(binary &  8)
     100                self.convergence=bool(binary & 16)
     101                self.control    =bool(binary & 32)
     102                self.qmu        =bool(binary & 64)
     103                #ENDBIN2VERB
     104        # }}}
     105
     106        def checkconsistency(self,md,solution,analyses):    # {{{
     107                return md
     108        # }}}
     109
     110        def __repr__(self):    # {{{
     111                       
     112                #BEGINDISP
     113                s ="class '%s'  = \n" % type(self)
     114                s+="   %15s : %s\n" % ('mprocessor',self.mprocessor)
     115                s+="   %15s : %s\n" % ('module',self.module)
     116                s+="   %15s : %s\n" % ('solution',self.solution)
     117                s+="   %15s : %s\n" % ('solver',self.solver)
     118                s+="   %15s : %s\n" % ('convergence',self.convergence)
     119                s+="   %15s : %s\n" % ('control',self.control)
     120                s+="   %15s : %s\n" % ('qmu',self.qmu)
     121                #ENDDISP
     122
     123                return s
     124        # }}}
     125
     126        def marshall(self,fid):    # {{{
     127                        WriteData(fid,'data',VerboseToBinary(self),'enum',VerboseEnum,'format','Integer')
     128        # }}}
     129
  • issm/branches/trunk-jpl-damage/src/m/enum/EnumDefinitions.py

    r12917 r12946  
    38173817        return StringToEnum('TotalSmb')
    38183818
     3819def ThicknessAlongGradientEnum():
     3820        """
     3821        THICKNESSALONGGRADIENTENUM - Enum of ThicknessAlongGradient
     3822
     3823           Usage:
     3824              macro=ThicknessAlongGradientEnum()
     3825        """
     3826
     3827        return StringToEnum('ThicknessAlongGradient')
     3828
     3829def ThicknessAcrossGradientEnum():
     3830        """
     3831        THICKNESSACROSSGRADIENTENUM - Enum of ThicknessAcrossGradient
     3832
     3833           Usage:
     3834              macro=ThicknessAcrossGradientEnum()
     3835        """
     3836
     3837        return StringToEnum('ThicknessAcrossGradient')
     3838
    38193839def P0Enum():
    38203840        """
  • issm/branches/trunk-jpl-damage/src/m/enum/MaximumNumberOfEnums.m

    r12917 r12946  
    99%      macro=MaximumNumberOfEnums()
    1010
    11 macro=460;
     11macro=458;
  • issm/branches/trunk-jpl-damage/src/m/model/MatlabFuncs.py

    r12878 r12946  
     1def oshostname():
     2        import socket
     3
     4        return socket.gethostname().lower().split('.')[0]
     5
    16def strcmp(s1,s2):
    27
  • issm/branches/trunk-jpl-damage/src/m/model/MatlabProcessPatch.py

    r12878 r12946  
    33        PROCESSPATCH - create a structure from a patch
    44 
    5             Usage:
    6                Result=ProcessPatch(Result);
     5           Usage:
     6              Result=ProcessPatch(Result);
    77        """
    88
  • issm/branches/trunk-jpl-damage/src/m/model/WriteData.py

    r12878 r12946  
    88        WRITEDATA - write model field in binary file
    99 
    10             Usage:
    11                WriteData(fid,*args)
     10           Usage:
     11              WriteData(fid,varargin)
    1212        """
    1313
    1414        #process options
    15         options=pairoptions(args)
     15        options=pairoptions(*args)
    1616
    1717        #Get data properties
  • issm/branches/trunk-jpl-damage/src/m/model/addnote.py

    r12878 r12946  
    22        """
    33        ADDNOTE - add a note to the existing model notes field
    4          
    5             Usage:
    6                md=addnote(md,string);
    7          
    8             Example:
    9                md=addnote(md,'Pine Island, Geometry of 2007');
     4
     5           Usage:
     6              md=addnote(md,string);
     7
     8           Example:
     9              md=addnote(md,'Pine Island, Geometry of 2007');
    1010        """
    1111
  • issm/branches/trunk-jpl-damage/src/m/model/ismodelselfconsistent.py

    r12878 r12946  
     1from AnalysisConfiguration import *
     2
    13def ismodelselfconsistent(md):
    24        """
    35        ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem.
    46
    5             Usage:
    6                ismodelselfconsistent(md),
     7           Usage:
     8              ismodelselfconsistent(md),
    79        """
    810
    911        #initialize consistency as true
    10         md.private.isconsistent=true
     12        md.private.isconsistent=True
    1113
    1214        #Get solution and associated analyses
     
    1517
    1618        #Go through a model fields, check that it is a class, and call checkconsistency
    17         fields=vars('model')
    18         for field in fields:
     19        fields=vars(md)
     20        for field in fields.iterkeys():
    1921
    2022                #Some properties do not need to be checked
     
    2426                #Check that current field is an object
    2527                if not hasattr(getattr(md,field),'checkconsistency'):
    26                         md=checkmessage(md,"field '%s' is not an object." % field)
     28                        md.checkmessage("field '%s' is not an object." % field)
    2729
    2830                #Check consistency of the object
  • issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromcluster.py

    r12878 r12946  
    88        LOADRESULTSFROMCLUSTER - load results of solution sequence from cluster
    99 
    10             Usage:
    11                md=loadresultsfromcluster(md,runtimename);
     10           Usage:
     11              md=loadresultsfromcluster(md,runtimename);
    1212        """
    1313
  • issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromdisk.py

    r12878 r12946  
    55        LOADRESULTSFROMDISK - load results of solution sequence from disk file "filename"           
    66 
    7             Usage:
    8                md=loadresultsfromdisk(md=False,filename=False);
     7           Usage:
     8              md=loadresultsfromdisk(md=False,filename=False);
    99        """
    1010
  • issm/branches/trunk-jpl-damage/src/m/model/marshall.py

    r12878 r12946  
    55        MARSHALL - outputs a compatible binary file from @model md, for certain solution type.
    66
    7             The routine creates a compatible binary file from @model md
    8             This binary file will be used for parallel runs in JPL-package
     7           The routine creates a compatible binary file from @model md
     8           This binary file will be used for parallel runs in JPL-package
    99
    10             Usage:
    11                marshall(md)
     10           Usage:
     11              marshall(md)
    1212        """
    1313
     
    2121
    2222        #First, write MaximumNumberOfEnum to make sure that the Enums are synchronized
    23         WriteData(fid,'enum',MaximumNumberOfEnums(),'data',true,'format','Boolean')
     23        WriteData(fid,'enum',MaximumNumberOfEnums(),'data',True,'format','Boolean')
    2424
    2525        #Go through all model fields: check that it is a class and call checkconsistency
    2626        fields=vars(md)
    2727
    28         for field in fields.interkeys():
     28        for field in fields.iterkeys():
    2929
    3030                #Some properties do not need to be marshalled
  • issm/branches/trunk-jpl-damage/src/m/model/parameterization/parameterize.py

    r12878 r12946  
    66        """
    77        PARAMETERIZE - parameterize a model
    8          
    9             from a parameter python file, start filling in all the model fields that were not
    10             filled in by the mesh.py and mask.py model methods.
    11             Warning: the parameter file must be able to be run in Python
    12          
    13             Usage:
    14                md=parameterize(md,parametername)
    15          
    16             Example:
    17                md=parameterize(md,'Square.par');
     8
     9           from a parameter python file, start filling in all the model fields that were not
     10           filled in by the mesh.py and mask.py model methods.
     11           Warning: the parameter file must be able to be run in Python
     12
     13           Usage:
     14              md=parameterize(md,parametername)
     15
     16           Example:
     17              md=parameterize(md,'Square.par');
    1818        """
    1919
  • issm/branches/trunk-jpl-damage/src/m/model/parseresultsfromdisk.py

    r12878 r12946  
    77        """
    88        PARSERESULTSFROMDISK - ...
    9          
    10             Usage:
    11                results=parseresultsfromdisk(filename,iosplit)
     9
     10           Usage:
     11              results=parseresultsfromdisk(filename,iosplit)
    1212        """
    1313
  • issm/branches/trunk-jpl-damage/src/m/model/petscversion.py

    r12878 r12946  
    77        PETSCVERSION - recover petsc version number, inside config.h file
    88 
    9             Usage:
    10                 PETSC_VERSION=petscversion();
     9           Usage:
     10              PETSC_VERSION=petscversion();
    1111        """
    1212
  • issm/branches/trunk-jpl-damage/src/m/model/process_solve_options.py

    r12878 r12946  
    11import os
     2from EnumDefinitions import *
    23
    34def process_solve_options(options):
     
    56        DEFAULT_SOLVE_OPTIONS - set up default options for solve phase
    67 
    7             Usage:
    8                options=process_solve_options(options)
     8           Usage:
     9              options=process_solve_options(options)
    910 
    10             See also: SOLVE
     11           See also: SOLVE
    1112        """
    1213
     
    1516        #solution_type: check on this option, error out otherwise
    1617        solution_type=options.getfieldvalue('solution_type')
    17         if solution_type in (DiagnosticSolutionEnum,PrognosticSolutionEnum,ThermalSolutionEnum,\
     18        if not solution_type in (DiagnosticSolutionEnum,PrognosticSolutionEnum,ThermalSolutionEnum,\
    1819                        SteadystateSolutionEnum,TransientSolutionEnum,EnthalpySolutionEnum,\
    1920                        BalancethicknessSolutionEnum,BedSlopeSolutionEnum,SurfaceSlopeSolutionEnum,HydrologySolutionEnum,FlaimSolutionEnum):
     
    4243        outoptions['keep']=options.getfieldvalue('keep','y')
    4344        outoptions['latsgn']=options.getfieldvalue('latsgn',0)
    44         outoptions['cmap']=options.getfieldvalue('cmap',None)
     45        outoptions['cmap']=options.getfieldvalue('cmap',[])
    4546
    4647        return outoptions
  • issm/branches/trunk-jpl-damage/src/m/model/recover_areas.m

    r2968 r12946  
    1616        pattynflag  =FlagElements(md,getfieldvalue(options,'pattyn',''));
    1717        stokesflag  =FlagElements(md,getfieldvalue(options,'stokes',''));
    18         hutterflag  =FlagElements(md,getfieldvalue(options,'hutter',''));
    1918        filltype    =getfieldvalue(options,'fill','none');
    2019
  • issm/branches/trunk-jpl-damage/src/m/model/setflowequation.m

    r11005 r12946  
    3333[hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin{:});
    3434
    35 %Flag the elements that has not been flagged as filltype
     35%Flag the elements that have not been flagged as filltype
    3636if strcmpi(filltype,'hutter'),
    3737        hutterflag(find(~macayealflag & ~pattynflag))=1;
     
    5858if (md.mesh.dimension==2),
    5959        if any(stokesflag | pattynflag)
    60                 error('setflowequation error message: stokes and pattyn elements no allowed in 2d mesh, extrude it first')
     60                error('setflowequation error message: stokes and pattyn elements not allowed in 2d mesh, extrude it first')
    6161        end
    6262end
  • issm/branches/trunk-jpl-damage/src/m/model/solve.py

    r12878 r12946  
    22import os
    33import shutil
     4from pairoptions import *
     5from process_solve_options import *
     6from EnumDefinitions import *
     7from ismodelselfconsistent import *
    48
    59def solve(md,solutionenum,*args):
     
    711        SOLVE - apply solution sequence for this model
    812 
    9             Usage:
    10                md=solve(md,solutionenum,varargin)
    11                where varargin is a list of paired arguments of string OR enums
     13           Usage:
     14              md=solve(md,solutionenum,varargin)
     15              where varargin is a list of paired arguments of string OR enums
    1216 
    13             solution types available comprise:
    14                         - DiagnosticSolutionEnum
    15                         - PrognosticSolutionEnum
    16                         - ThermalSolutionEnum
    17                         - SteadystateSolutionEnum
    18                         - TransientSolutionEnum...
    19                         - BalancethicknessSolutionEnum
    20                         - BedSlopeSolutionEnum
    21                         - SurfaceSlopeSolutionEnum
    22                         - HydrologySolutionEnum
    23                         - FlaimSolutionEnum
     17           solution types available comprise:
     18                  - DiagnosticSolutionEnum
     19                  - PrognosticSolutionEnum
     20                  - ThermalSolutionEnum
     21                  - SteadystateSolutionEnum
     22                  - TransientSolutionEnum...
     23                  - BalancethicknessSolutionEnum
     24                  - BedSlopeSolutionEnum
     25                  - SurfaceSlopeSolutionEnum
     26                  - HydrologySolutionEnum
     27                  - FlaimSolutionEnum
    2428 
    2529           extra options:
    26                - loadonly : does not solve. only load results
     30              - loadonly : does not solve. only load results
    2731 
    28             Examples:
    29                md=solve(md,DiagnosticSolutionEnum);
     32           Examples:
     33              md=solve(md,DiagnosticSolutionEnum);
    3034        """
    3135
  • issm/branches/trunk-jpl-damage/src/m/model/solvers/iluasmoptions.m

    r12004 r12946  
    1010
    1111%default iluasm options
    12 iluasm.mat_type=getfieldvalue(options,'mat_type''','aij');
    13 iluasm.ksp_type=getfieldvalue(options,'ksp_type''','gmres');
    14 iluasm.pc_type=getfieldvalue(options,'pc_type''','asm');
    15 iluasm.sub_pc_type=getfieldvalue(options,'sub_pc_type''','ilu');
     12iluasm.mat_type=getfieldvalue(options,'mat_type','aij');
     13iluasm.ksp_type=getfieldvalue(options,'ksp_type','gmres');
     14iluasm.pc_type=getfieldvalue(options,'pc_type','asm');
     15iluasm.sub_pc_type=getfieldvalue(options,'sub_pc_type','ilu');
    1616iluasm.pc_asm_overlap=getfieldvalue(options,'pc_asm_overlap',5);
    1717iluasm.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
  • issm/branches/trunk-jpl-damage/src/m/model/waitonlock.py

    r12878 r12946  
    88        WAITONLOCK - wait for a file
    99 
    10             This routine will return when a file named 'filename' is written to disk.
    11             If the time limit given in input is exceeded, return 0
     10           This routine will return when a file named 'filename' is written to disk.
     11           If the time limit given in input is exceeded, return 0
    1212 
    13             Usage:
    14                flag=waitonlock(md,executionpath)
     13           Usage:
     14              flag=waitonlock(md,executionpath)
    1515        """
    1616
  • issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceSheetBC.m

    r11577 r12946  
    3434
    3535%Create zeros basal melting rate and surface mass balance if not specified
    36 if isnan(md.surfaceforcings.precipitation),
     36if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1) & (md.surfaceforcings.ispdd==0)),
    3737        md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
    3838        disp('      no surfaceforcings.precipitation specified: values set as zero');
    3939end
    40 if isnan(md.surfaceforcings.mass_balance),
     40if isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0),
    4141        md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
    4242        disp('      no surfaceforcings.mass_balance specified: values set as zero');
  • issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceShelfBC.m

    r11577 r12946  
    6565
    6666%Create zeros basalforcings and surfaceforcings
    67 if isnan(md.surfaceforcings.precipitation),
     67if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1) & (md.surfaceforcings.ispdd==0)),
    6868        md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
    6969        disp('      no surfaceforcings.precipitation specified: values set as zero');
    7070end
    71 if isnan(md.surfaceforcings.mass_balance),
    72         md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
    73         disp('      no surfaceforcings.mass_balance specified: values set as zero');
     71if isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0),
     72                md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
     73                disp('      no surfaceforcings.mass_balance specified: values set as zero');
    7474end
    7575if isnan(md.basalforcings.melting_rate),
  • issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceShelfBC.py

    r12878 r12946  
    55        """
    66        SETICESHELFBC - Create the boundary conditions for diagnostic and thermal models for a  Ice Shelf with Ice Front
    7          
    8             Neumann BC are used on the ice front (an ANRGUS contour around the ice front
    9             must be given in input)
    10             Dirichlet BC are used elsewhere for diagnostic
    11          
    12             Usage:
    13                md=SetIceShelfBC(md,varargin)
    14          
    15             Example:
    16                md=SetIceShelfBC(md);
    17                md=SetIceShelfBC(md,'Front.exp');
    18          
    19             See also: SETICESHEETBC, SETMARINEICESHEETBC
     7
     8           Neumann BC are used on the ice front (an ANRGUS contour around the ice front
     9           must be given in input)
     10           Dirichlet BC are used elsewhere for diagnostic
     11
     12           Usage:
     13              md=SetIceShelfBC(md,varargin)
     14
     15           Example:
     16              md=SetIceShelfBC(md);
     17              md=SetIceShelfBC(md,'Front.exp');
     18
     19           See also: SETICESHEETBC, SETMARINEICESHEETBC
    2020        """
    2121
  • issm/branches/trunk-jpl-damage/src/m/utils/BC/SetMarineIceSheetBC.m

    r11577 r12946  
    7676
    7777%Create zeros basalforcings and surfaceforcings
    78 if isnan(md.surfaceforcings.precipitation),
     78if (isnan(md.surfaceforcings.precipitation)& (md.surfaceforcings.ispdd==1) & (md.surfaceforcings.ispdd==0)),
    7979        md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
    8080        disp('      no surfaceforcings.precipitation specified: values set as zero');
    8181end
    82 if isnan(md.surfaceforcings.mass_balance),
     82if isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0),
    8383        md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
    8484        disp('      no surfaceforcings.mass_balance specified: values set as zero');
  • issm/branches/trunk-jpl-damage/src/m/utils/Cluster/parallelrange.py

    r12878 r12946  
    44        PARALLELRANGE - from a rank, and a number of processors, figure out a range, for parallel tasks.
    55 
    6             Usage:
    7                i1,i2=parallelrange(rank,numprocs,globalsize)
     6           Usage:
     7              i1,i2=parallelrange(rank,numprocs,globalsize)
    88        """
    99
  • issm/branches/trunk-jpl-damage/src/m/utils/Geometry/FlagElements.py

    r12168 r12946  
    1 from numpy import *
     1import numpy
     2import os
     3#from basinzoom import *
     4#from ContourToMesh import *
     5from MatlabFuncs import *
     6
    27def FlagElements(md,region):
    3 #FLAGELEMENTS - flag the elements in an region
    4 #
    5 #   The region can be given with an exp file, a list of elements.
    6 #
    7 #   Usage:
    8 #      flag=FlagElements(md,region);
    9 #
    10 #   Example:
    11 #      flag=FlagElements(md,'all');
    12 #      flag=FlagElements(md,'');
    13 #      flag=FlagElements(md,'Domain.exp');
    14 #      flag=FlagElements(md,'~Domain.exp');
    15 #      flag=FlagElements(md,md.mask.elementongroundedice);
     8        """
     9        FLAGELEMENTS - flag the elements in an region
    1610
    17         if isinstance(region,basestring):
    18                 if not(region):
    19                         flag=zeros(md.mesh.numberofelements,'bool')
    20                         invert=0;
    21                 elif region=='all':
    22                         flag=ones(md.mesh.numberofelements,'bool')
    23                         invert=0;
     11           The region can be given with an exp file, a list of elements.
     12
     13           Usage:
     14              flag=FlagElements(md,region);
     15
     16           Example:
     17              flag=FlagElements(md,'all');
     18              flag=FlagElements(md,'');
     19              flag=FlagElements(md,'Domain.exp');
     20              flag=FlagElements(md,'~Domain.exp');
     21              flag=FlagElements(md,md.mask.elementongroundedice);
     22        """
     23
     24        if   isinstance(region,str):
     25                if   not region:
     26                        flag=numpy.zeros(md.mesh.numberofelements,'bool')
     27                        invert=0
     28                elif strcmpi(region,'all'):
     29                        flag=numpy.ones(md.mesh.numberofelements,'bool')
     30                        invert=0
    2431                else:
    2532                        #make sure that we actually don't want the elements outside the domain outline!
    26                         if region[0]=='~':
     33                        if strcmpi(region[0],'~'):
    2734                                region=region[1:]
    28                                 invert=1;
     35                                invert=1
    2936                        else:
    30                                 invert=0;
    31                        
     37                                invert=0
     38
    3239                        #does the region domain outline exist or do we have to look for xlim,ylim in basinzoom?
    33                         if not os.path.isfile(region):
    34                                 [xlim,ylim]=basinzoom('basin',region);
    35                                 flag_nodes=double(md.mesh.x<xlim(2) & md.mesh.x>xlim(1) &  md.mesh.y<ylim(2) & md.mesh.y>ylim(1));
    36                                 flag=prod(flag_nodes(md.mesh.elements),2);
     40                        if not os.path.exists(region):
     41                                if len(region)>3 and not strcmp(region[-4:],'.exp'):
     42                                        raise IOError("Error: File 'region' not found!" % region)
     43                                xlim,ylim=basinzoom('basin',region)
     44                                flag_nodes=numpy.logical_and(numpy.logical_and(md.mesh.x<xlim[1],md.mesh.x>xlim[0]),numpy.logical_and(md.mesh.y<ylim[1],md.mesh.y>ylim[0])).astype(float)
     45                                flag=numpy.prod(flag_nodes[md.mesh.elements],axis=1)
    3746                        else:
    3847                                #ok, flag elements
    39                                 flag=ContourToMesh(md.mesh.elements[:,0:3],md.mesh.x,md.mesh.y,region,'element',1);
    40                
     48                                flag=ContourToMesh(md.mesh.elements[:,0:3],md.mesh.x,md.mesh.y,region,'element',1)
     49
    4150                if invert:
    42                         flag=~flag;
    43        
    44         elif isinstance(region,nparray):
    45                 if len(region)!=md.mesh.numberofelements:
    46                         print FlagElements.__doc__
    47                         print 'Flaglist for region must be of same size as number of elements in model'
    48                         return []
    49                 flag=region;
     51                        flag=numpy.logical_not(flag)
     52
     53        elif isinstance(region,numpy.nparray) or isinstance(region,bool):
     54                if not numpy.size(region,0)==md.mesh.numberofelements:
     55                        raise TypeError("Flaglist for region must be of same size as number of elements in model.")
     56                flag=region
     57
    5058        else:
    51                 print 'Invalid region option'
    52                 return []
     59                raise TypeError("Invalid region option")
    5360
    54         return flag;
     61        return flag
     62
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/ismumps.py

    r12878 r12946  
    77        ISMUMPS - figure out if MUMPS package was compiled with ISSM
    88 
    9             Usage:
    10                 flag=ismumps();
     9           Usage:
     10              flag=ismumps();
    1111        """
    1212
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/ispetsc.py

    r12878 r12946  
    77        ISPETSC - figure out if PETSC package was compiled with ISSM
    88 
    9             Usage:
    10                 flag=ispetsc();
     9           Usage:
     10              flag=ispetsc();
    1111        """
    1212
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpin.py

    r12878 r12946  
    1010        SCPIN get packages from host, using scp on unix, and pscp on windows
    1111 
    12             usage: scpin(host,packages,path)
    13  
    14  
     12           usage: scpin(host,packages,path)
    1513        """
    1614
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpout.py

    r12878 r12946  
    1010        SCPOUT send packages to a host, using scp on unix, and pscp on windows
    1111 
    12             usage: scpout(host,path,packages)
    13  
    14  
     12           usage: scpout(host,path,packages)
    1513        """
    1614
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/issmssh.py

    r12878 r12946  
    99        ISSMSSH - wrapper for OS independent ssh command.
    1010 
    11             usage:
    12                issmssh(host,command)
     11           usage:
     12              issmssh(host,command)
    1313        """
    1414
  • issm/branches/trunk-jpl-damage/src/m/utils/Shell/issmdir.py

    r12878 r12946  
    77        ISSMDIR - Get ISSM_DIR environment variable
    88 
    9             Usage:
    10                ISSM_DIR=issmdir()
     9           Usage:
     10              ISSM_DIR=issmdir()
    1111        """
    1212
  • issm/branches/trunk-jpl-damage/src/m/utils/consistency/checkfield.py

    r12878 r12946  
    88        CHECKFIELD - check field consistency
    99
    10             Used to check model consistency.
    11             Available options:
    12                - NaN: 1 if check that there is no NaN
    13                - size: [lines cols], NaN for non checked dimensions
    14                - >:  greater than provided value
    15                - >=: greater or equal to provided value
    16                - <:  smallerthan provided value
    17                - <=: smaller or equal to provided value
    18                - < vec:  smallerthan provided values on each vertex
    19                - forcing: 1 if check forcing consistency (size and time)
    20                - values: cell of strings or vector of acceptable values
    21                - numel: list of acceptable number of elements
    22                - cell: 1 if check that is cell
    23                - empty: 1 if check that non empty
    24                - message: overloaded error message
     10           Used to check model consistency.
     11           Available options:
     12              - NaN: 1 if check that there is no NaN
     13              - size: [lines cols], NaN for non checked dimensions
     14              - >:  greater than provided value
     15              - >=: greater or equal to provided value
     16              - <:  smallerthan provided value
     17              - <=: smaller or equal to provided value
     18              - < vec:  smallerthan provided values on each vertex
     19              - forcing: 1 if check forcing consistency (size and time)
     20              - values: cell of strings or vector of acceptable values
     21              - numel: list of acceptable number of elements
     22              - cell: 1 if check that is cell
     23              - empty: 1 if check that non empty
     24              - message: overloaded error message
    2525
    26             Usage:
    27                md = checkfield(md,fieldname,options);
     26           Usage:
     27              md = checkfield(md,fieldname,options);
    2828
    29             Example:
    30                md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
    31                md = checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
    32                md = checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
     29           Example:
     30              md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
     31              md = checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
     32              md = checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
    3333        """
    3434
     
    3737
    3838        #get field from model
    39         field=getattr(md,fieldname)
     39#       field=getattr(md,fieldname)
     40        exec("field=md.%s" % fieldname)
    4041
    4142        #check empty
    42         if 'empty' in options:
     43        if options.exist('empty'):
    4344                if not field:
    4445                        md = md.checkmessage(options.getfieldvalue('message',\
     
    4647
    4748        #Check size
    48         if 'size' in options:
     49        if options.exist('size'):
    4950                fieldsize=options.getfieldvalue('size')
    50                 if   numpy.isnan(fieldsize[0]):
    51                         if not numpy.size(field,1)==fieldsize[1]:
     51                if   len(fieldsize) == 1:
     52                        if (not numpy.size(field,0)==fieldsize[0]):
    5253                                md = md.checkmessage(options.getfieldvalue('message',\
    53                                         "field '%s' should have %d columns" % (fieldname,fieldsize[1])))
    54                 elif numpy.isnan(fieldsize[1]):
    55                         if not numpy.size(field,0)==fieldsize[0]:
    56                                 md = md.checkmessage(options.getfieldvalue('message',\
    57                                         "field '%s' should have %d lines" % (fieldname,fieldsize[0])))
    58                 else:
    59                         if (not numpy.size(field,0)==fieldsize[0]) or (not numpy.size(field,1)==fieldsize[1]):
    60                                 md = md.checkmessage(options.getfieldvalue('message',\
    61                                         "field '%s' size should be %d x %d" % (fieldname,fieldsize[0],fieldsize[1])))
     54                                        "field '%s' size should be %d" % (fieldname,fieldsize[0])))
     55                elif len(fieldsize) == 2:
     56                        if   numpy.isnan(fieldsize[0]):
     57                                if not numpy.size(field,1)==fieldsize[1]:
     58                                        md = md.checkmessage(options.getfieldvalue('message',\
     59                                                "field '%s' should have %d columns" % (fieldname,fieldsize[1])))
     60                        elif numpy.isnan(fieldsize[1]):
     61                                if not numpy.size(field,0)==fieldsize[0]:
     62                                        md = md.checkmessage(options.getfieldvalue('message',\
     63                                                "field '%s' should have %d lines" % (fieldname,fieldsize[0])))
     64                        else:
     65                                if (not numpy.size(field,0)==fieldsize[0]) or (not numpy.size(field,1)==fieldsize[1]):
     66                                        md = md.checkmessage(options.getfieldvalue('message',\
     67                                                "field '%s' size should be %d x %d" % (fieldname,fieldsize[0],fieldsize[1])))
    6268       
    6369        #Check numel
    64         if 'numel' in options:
     70        if options.exist('numel'):
    6571                fieldnumel=options.getfieldvalue('numel')
    6672                if not numpy.size(field) in fieldnumel:
     
    8894
    8995        #check values
    90         if 'values' in options:
     96        if options.exist('values'):
    9197                fieldvalues=options.getfieldvalue('values')
    9298                if False in ismember(field,fieldvalues):
     
    102108
    103109        #check greater
    104         if '>=' in options:
     110        if options.exist('>='):
    105111                lowerbound=options.getfieldvalue('>=')
    106112                if numpy.any(field<lowerbound):
    107113                        md = md.checkmessage(options.getfieldvalue('message',\
    108114                                "field '%s' should have values above %d" % (fieldname,lowerbound)))
    109         if '>' in options:
     115        if options.exist('>'):
    110116                lowerbound=options.getfieldvalue('>')
    111117                if numpy.any(field<=lowerbound):
     
    114120
    115121        #check smaller
    116         if '<=' in options:
     122        if options.exist('<='):
    117123                upperbound=options.getfieldvalue('<=')
    118124                if numpy.any(field>upperbound):
    119125                        md = md.checkmessage(options.getfieldvalue('message',\
    120126                                "field '%s' should have values below %d" % (fieldname,upperbound)))
    121         if '<' in options:
     127        if options.exist('<'):
    122128                upperbound=options.getfieldvalue('<')
    123129                if numpy.any(field>=upperbound):
  • issm/branches/trunk-jpl-damage/test/NightlyRun/IdToName.py

    r12878 r12946  
    6666                233 : 'SquareShelfTranP3dForcTemp',
    6767                234 : 'SquareShelfTranForceNeg2dDakotaSamp',
    68         235 : 'SquareShelfTranForceNeg2dDakotaLocal',
     68                235 : 'SquareShelfTranForceNeg2dDakotaLocal',
     69                236 : 'SquareShelfTranIspddIsdeltaM2d';
     70                237 : 'SquareShelfTranIspddIsdeltaM3d';
    6971                301 : 'SquareSheetConstrainedDiagM2d',
    7072                302 : 'SquareSheetConstrainedDiagH2d',
  • issm/branches/trunk-jpl-damage/test/NightlyRun/test101.py

    r12878 r12946  
    33from setmask import *
    44from parameterize import *
     5from setflowequation import *
     6from EnumDefinitions import *
     7from solve import *
     8from MatlabFuncs import *
    59
    610md=model()
     
    812md=setmask(md,'all','')
    913md=parameterize(md,'../Par/SquareShelfConstrained.py')
     14md=setflowequation(md,'macayeal','all')
     15md.cluster=generic('name',oshostname(),'np',3)
     16md.diagnostic.requested_outputs=StressTensorEnum
     17md=solve(md,DiagnosticSolutionEnum)
    1018
    1119#Fields and tolerances to track changes
Note: See TracChangeset for help on using the changeset viewer.