Changeset 12946
- Timestamp:
- 08/08/12 14:38:52 (13 years ago)
- Location:
- issm/branches/trunk-jpl-damage
- Files:
-
- 9 deleted
- 113 edited
- 24 copied
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-jpl-damage
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 12881-12896,12898-12900,12902-12916,12920-12935,12937-12945
- Property svn:mergeinfo changed
-
issm/branches/trunk-jpl-damage/configs/config-arm-linux.sh
r12878 r12946 9 9 --without-modules \ 10 10 --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 21 21 AM_SILENT_RULES([yes]) #Do not show compilation command by default 22 22 AM_PROG_CC_C_O 23 24 23 AM_PROG_AR 25 AC_PROG_RANLIB 24 AC_PROG_RANLIB 26 25 27 26 # To produce shared libraries uncomment LT_INIT. In theory, Libtool can be initialized 28 27 # even if all linking is static, since, if not shared libraries are to be produce, libtool 29 28 # will act simply as a wrapper around AR and Ranlib. 30 #31 29 #LT_INIT 32 30 33 31 #Run issm_options.m4 34 32 ISSM_OPTIONS 35 36 #AM_PROG_AR must be placed after ISSM_OPTIONS37 33 38 34 #List all Makefiles -
issm/branches/trunk-jpl-damage/etc/environment.sh
r12878 r12946 278 278 export LD_RUN_PATH="$LD_RUN_PATH:$TCLX_DIR" 279 279 280 #TCL/TK 281 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" 282 export LD_RUN_PATH="$LD_RUN_PATH:/usr/local/lib" 280 283 281 284 #ASPELL -
issm/branches/trunk-jpl-damage/externalpackages/gsl/install-android.sh
r12878 r12946 10 10 11 11 #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' 13 13 14 14 #Untar … … 28 28 ./configure \ 29 29 --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 32 33 fi 33 34 -
issm/branches/trunk-jpl-damage/externalpackages/libtool/install.sh
r12878 r12946 6 6 7 7 #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' 9 9 10 10 #Untar 11 tar -zxvf libtool[\w.-]*.tar.gz 12 rm libtool[\w.-]*.tar.gz 13 11 tar -zxvf libtool-2.4.2.tar.gz 12 rm libtool-2.4.2.tar.gz 14 13 15 14 #Move libtool into src directory 16 mv libtool [\w.-]*src15 mv libtool-2.4.2 src 17 16 18 17 #Compile libtool -
issm/branches/trunk-jpl-damage/externalpackages/matplotlib/install-osx.sh
r12258 r12946 2 2 pythonversion=2.7 3 3 PYTHON=python${pythonversion} 4 5 export GIT_SSL_NO_VERIFY=true 6 export CC="gcc -fPIC" 7 export CXX="g++ -fPIC" 8 export F77="gfortran -fPIC" 9 export FC="gfortran -fPIC" 10 export FFLAGS=-ff2c 11 4 12 5 13 git clone https://github.com/matplotlib/matplotlib … … 7 15 mkdir deps 8 16 cd src 17 exit 9 18 make -f make.osx PREFIX=$ISSM_DIR/externalpackages/matplotlib/deps PYVERSION=$pythonversion fetch deps mpl_install_std 10 19 ${PYTHON} -c "import matplotlib; print 'Installed matplotlib', matplotlib.__version__, matplotlib.__file__" -
issm/branches/trunk-jpl-damage/externalpackages/matplotlib/install.sh
r12143 r12946 1 1 #/bin/bash 2 pythonversion=2.7 3 PYTHON=python${pythonversion} 4 5 export GIT_SSL_NO_VERIFY=true 6 export CC="gcc -fPIC " 7 export CXX="g++ -fPIC -L$ISSM_DIR/externalpackages/tcl/install/lib" 8 export F77="gfortran -fPIC" 9 export FC="gfortran -fPIC" 10 export FFLAGS=-ff2c 11 2 12 3 13 git clone https://github.com/matplotlib/matplotlib 4 14 mv matplotlib src 5 15 cd src 6 python setup.py build 7 python setup.py install 16 python setup.py build 17 python setup.py install -
issm/branches/trunk-jpl-damage/externalpackages/mpich2/install-1.4-linux64.sh
r12258 r12946 32 32 fi 33 33 make install 34 35 #remove so files36 cd ../install/lib37 rm -rf *.so -
issm/branches/trunk-jpl-damage/externalpackages/mpich2/install-1.4-macosx32.sh
r12258 r12946 35 35 fi 36 36 make install 37 38 #remove so files39 cd ../install/lib40 rm -rf *.so -
issm/branches/trunk-jpl-damage/externalpackages/mpich2/install-1.4-macosx64.sh
r12258 r12946 35 35 fi 36 36 make install 37 38 #remove so files39 cd ../install/lib40 rm -rf *.so -
issm/branches/trunk-jpl-damage/externalpackages/tcl/install.sh
r12719 r12946 1 1 #!/bin/bash 2 3 sudochoice=0; 2 4 3 5 #Some cleanup … … 20 22 ver="8.4.12" 21 23 22 cd src 23 make -C ./macosx install INSTALL_ROOT="$ISSM_DIR/externalpackages/tcl/install" 24 cd src/unix 25 26 #User mode: 27 if [[ $sudochoice == "0" ]]; 28 then 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 36 fi 37 38 #sudo mode: 39 if [[ $sudochoice == "1" ]]; 40 then 41 sudo ./configure 42 if [ -z $1 ]; then 43 sudo make 44 else 45 sudo make -j $1 46 fi 47 sudo make install 48 fi -
issm/branches/trunk-jpl-damage/externalpackages/triangle/install-android.sh
r12878 r12946 1 1 #!/bin/bash 2 source $ANDROID_DIR/android_aux.sh3 2 4 # use matlab? 5 matlab=0 6 7 # Some cleanup 3 #Some cleanup 8 4 rm -rf install triangle 9 5 mkdir install 10 6 11 # 7 #Download from ISSM server 12 8 $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/triangle.zip' 'triangle.zip' 13 9 14 # 10 #Untar 15 11 cd install 16 12 cp ../triangle.zip ./ 17 13 unzip triangle.zip 18 14 19 # 20 cp ../configs/ /android/configure.make ./15 #copy new makefile 16 cp ../configs/android/configure.make ./ 21 17 cp ../makefile ./ 22 18 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 20 patch triangle.c ../triangle.c.patch 29 21 30 # 31 make -j $j22 #Compile triangle 23 make 32 24 33 # 25 #Patch triangle.h 34 26 patch triangle.h ../triangle.h.patch -
issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/Synchronize.sh
r12878 r12946 15 15 cat c.vim | sed "/ISSM's objects begin/,/vim: ts=8/d" > temp 16 16 echo "\"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 17 find ../../../../../src/c/classes -name "*.h" | sed -e "s/\// /g" -e "s/\.h//"| awk '{print $(NF)}' | awk '{ printf "syn keyword cType " $1 "\n"}'>> temp 19 18 cat c.vim | sed "1,/ISSM's objects end/d" >> temp 20 19 -
issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/c.vim
r12878 r12946 411 411 412 412 "ISSM's objects begin 413 syn keyword cType objects.h 414 syn keyword cType Object 413 syn keyword cType AdjacentTriangle 414 syn keyword cType BamgGeom 415 syn keyword cType BamgMesh 416 syn keyword cType bamgobjects 417 syn keyword cType BamgOpts 418 syn keyword cType BamgQuadtree 419 syn keyword cType BamgVertex 420 syn keyword cType CrackedEdge 421 syn keyword cType Curve 422 syn keyword cType Direction 423 syn keyword cType DoubleAndInt 424 syn keyword cType Edge 425 syn keyword cType GeomEdge 426 syn keyword cType Geometry 427 syn keyword cType GeomSubDomain 428 syn keyword cType GeomVertex 429 syn keyword cType include 430 syn keyword cType ListofIntersectionTriangles 431 syn keyword cType macros 432 syn keyword cType Mesh 433 syn keyword cType Metric 434 syn keyword cType R2 435 syn keyword cType SetOfE4 436 syn keyword cType SubDomain 437 syn keyword cType Triangle 438 syn keyword cType typedefs 439 syn keyword cType VertexOnEdge 440 syn keyword cType VertexOnGeom 441 syn keyword cType VertexOnVertex 442 syn keyword cType classes 443 syn keyword cType DakotaPlugin 444 syn keyword cType DofIndexing 445 syn keyword cType FemModel 446 syn keyword cType gaussobjects 447 syn keyword cType GaussPenta 448 syn keyword cType GaussTria 415 449 syn keyword cType Hook 416 syn keyword cType DofIndexing417 syn keyword cType Vertex418 syn keyword cType Node419 syn keyword cType Segment420 450 syn keyword cType IoModel 421 syn keyword cType Patch 422 syn keyword cType Update 451 syn keyword cType ExponentialVariogram 452 syn keyword cType GaussianVariogram 453 syn keyword cType krigingobjects 454 syn keyword cType Observation 455 syn keyword cType PowerVariogram 456 syn keyword cType Quadtree 457 syn keyword cType SphericalVariogram 458 syn keyword cType Variogram 459 syn keyword cType ElementMatrix 460 syn keyword cType ElementVector 461 syn keyword cType Matrix 462 syn keyword cType matrixobjects 463 syn keyword cType Vector 423 464 syn keyword cType Constraint 465 syn keyword cType SpcDynamic 424 466 syn keyword cType SpcStatic 425 467 syn 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 468 syn keyword cType Contour 469 syn keyword cType BoolElementResult 470 syn keyword cType DoubleElementResult 471 syn keyword cType ElementResult 472 syn keyword cType ElementResultLocal 473 syn keyword cType PentaP1ElementResult 474 syn keyword cType TriaP1ElementResult 436 475 syn keyword cType Element 437 476 syn keyword cType Penta … … 441 480 syn keyword cType TriaHook 442 481 syn keyword cType TriaRef 482 syn keyword cType BoolExternalResult 483 syn keyword cType DoubleExternalResult 484 syn keyword cType DoubleMatExternalResult 485 syn keyword cType DoubleVecExternalResult 486 syn keyword cType ExternalResult 487 syn keyword cType IntExternalResult 488 syn keyword cType PetscVecExternalResult 489 syn keyword cType StringExternalResult 490 syn keyword cType BoolInput 491 syn keyword cType ControlInput 492 syn keyword cType DatasetInput 493 syn keyword cType DoubleInput 494 syn keyword cType Input 495 syn keyword cType IntInput 496 syn keyword cType PentaP1Input 497 syn keyword cType TransientInput 498 syn keyword cType TriaP1Input 443 499 syn keyword cType KML_Attribute 500 syn keyword cType KML_ColorStyle 444 501 syn keyword cType KML_Comment 445 syn keyword cType KML_ColorStyle446 502 syn keyword cType KML_Container 447 503 syn keyword cType KML_Document … … 459 515 syn keyword cType KML_Object 460 516 syn keyword cType KML_Overlay 517 syn keyword cType KML_Placemark 461 518 syn keyword cType KML_Point 462 syn keyword cType KML_Placemark463 519 syn keyword cType KML_Polygon 464 520 syn keyword cType KML_PolyStyle … … 468 524 syn keyword cType KML_Unknown 469 525 syn 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 526 syn keyword cType Friction 527 syn keyword cType Icefront 528 syn keyword cType Load 529 syn keyword cType Numericalflux 530 syn keyword cType Pengrid 531 syn keyword cType Penpair 532 syn keyword cType Riftfront 499 533 syn keyword cType Material 500 534 syn keyword cType Matice 501 535 syn keyword cType Matpar 502 syn keyword cType ElementMatrix 503 syn keyword cType ElementVector 504 syn keyword cType Vector 505 syn keyword cType Matrix 536 syn keyword cType Node 537 syn keyword cType Object 538 syn keyword cType objects 539 syn keyword cType Option 540 syn keyword cType OptionCell 541 syn keyword cType OptionChar 542 syn keyword cType OptionDouble 543 syn keyword cType OptionLogical 544 syn keyword cType OptionStruct 545 syn keyword cType OptionUtilities 506 546 syn keyword cType BoolParam 547 syn keyword cType DoubleMatArrayParam 507 548 syn keyword cType DoubleMatParam 549 syn keyword cType DoubleParam 508 550 syn keyword cType DoubleTransientMatParam 509 syn keyword cType DoubleMatArrayParam510 syn keyword cType DoubleParam511 551 syn keyword cType DoubleVecParam 552 syn keyword cType FileParam 553 syn keyword cType IntMatParam 512 554 syn keyword cType IntParam 513 555 syn keyword cType IntVecParam 514 syn keyword cType IntMatParam 515 syn keyword cType FileParam 556 syn keyword cType MatrixParam 516 557 syn keyword cType Param 517 syn keyword cType MatrixParam518 syn keyword cType VectorParam519 558 syn keyword cType StringArrayParam 520 559 syn keyword cType StringParam 521 syn keyword cType Contour 522 syn keyword cType FemModel 560 syn keyword cType TransientParam 561 syn keyword cType VectorParam 562 syn keyword cType Segment 563 syn keyword cType Vertex 564 syn keyword cType objects 523 565 syn keyword cType OptArgs 524 566 syn keyword cType OptPars -
issm/branches/trunk-jpl-damage/m4/issm_options.m4
r12878 r12946 173 173 MATLABINCL=-I"$MATLAB_ROOT/extern/include"; 174 174 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 213 217 AC_MSG_RESULT(done) 214 218 … … 501 505 HAVE_GSL=yes 502 506 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" 504 508 505 509 AC_DEFINE([_HAVE_GSL_],[1],[with gsl in ISSM src]) … … 671 675 PETSCLIB="-L$PETSC_ROOT/$PETSC_ARCH/lib -L$PETSC_ROOT/lib -L$PETSC_ROOT/lib/$PETSC_ARCH -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc -lpetscsnes -lpetscts" 672 676 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" 674 678 fi 675 679 ;; -
issm/branches/trunk-jpl-damage/scripts/DownloadExternalPackage.py
r12878 r12946 1 1 #!/usr/bin/env python 2 2 # -*- coding: ISO-8859-1 -*- 3 # 4 # TODO: Improve upon extension recognition by checking for mismatches in found targets 5 # and specified local file. 6 # 3 7 4 8 import os,sys,re … … 21 25 # End class myHTMLParser 22 26 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 '/'. 29 if 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:] 34 else: 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 "******************************************************************************************************************************" 26 65 27 pivot += 1; 28 find = (sys.argv[1])[pivot:]; 66 if len(sys.argv) > 2: 67 localFile=sys.argv[2] 68 print "Downloaded file will saved as: " + localFile 69 else: 70 localFile = None 71 print "Downloaded file will saved with the same file name." 72 73 29 74 print "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. 30 86 pattern = find + "[\w.-]*(\.tar\.gz|tar\.gz2|tgz|zip|exe)?" 31 87 parser = MyHTMLParser(pattern) 32 88 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). 33 91 urlObject = FancyURLopener() 34 92 obj = urlObject.open(url) 35 93 parser.feed(obj.read()) 36 94 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. 37 101 if len(parser.targets) > 1: 38 102 print "Could not resolve your download due to the number of hits." … … 42 106 43 107 elif len(parser.targets) == 1: 108 print "Found: " + parser.targets[0] 44 109 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] 53 117 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 57 131 58 132 else: -
issm/branches/trunk-jpl-damage/src/c/Container/Observations.cpp
r12878 r12946 379 379 /*Solve the three linear systems*/ 380 380 #if _HAVE_GSL_ 381 Solverx Gsl(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0382 Solverx Gsl(&Ginv1, Gamma,ones,n_obs); // Gamma^-1 ones383 Solverx Gsl(&GinvZ, Gamma,obs,n_obs); // Gamma^-1 Z381 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 384 384 #else 385 385 _error2_("GSL is required"); -
issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/EnumDefinitions.h
r12917 r12946 405 405 StressTensoryzEnum, 406 406 StressTensorzzEnum, 407 IceVolumeEnum, 408 TotalSmbEnum, 407 IceVolumeEnum, //FIXME reposition 408 TotalSmbEnum, //FIXME reposition 409 ThicknessAlongGradientEnum, 410 ThicknessAcrossGradientEnum, 409 411 /*}}}*/ 410 412 /*Element Interpolations{{{1*/ -
issm/branches/trunk-jpl-damage/src/c/Makefile.am
r12878 r12946 7 7 8 8 #if SHARED 9 #lib_LTLIBRARIES = libISSM .la libISSMCore.la libISSMOverload.la9 #lib_LTLIBRARIES = libISSMCore.la libISSMOverload.la libISSM.la 10 10 #endif 11 11 if PYTHON … … 461 461 ./modules/ThicknessAbsGradientx/ThicknessAbsGradientx.cpp\ 462 462 ./modules/ThicknessAbsGradientx/ThicknessAbsGradientx.h\ 463 ./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp\ 464 ./modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h\ 465 ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp\ 466 ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h\ 463 467 ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\ 464 468 ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\ … … 1004 1008 #if SHARED 1005 1009 #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 # 1009 1012 #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 # 1010 1015 #libISSMOverload_la_SOURCES = ./shared/String/stricmp.c 1011 1016 #endif -
issm/branches/trunk-jpl-damage/src/c/classes/bamg/Mesh.cpp
r12876 r12946 5644 5644 } 5645 5645 /*}}}*/ 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 vertex5650 // version 2 for remove the probleme if we fill the hole5651 //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 edges5659 // try the 3 edge bourna-- in case of internal hole5660 // and choice the best5661 //5662 // the probleme is in case of the fine and long internal hole5663 // for exemple neart the training edge of a wing5664 BamgVertex * s=0,*s1=0, *s0=0;5665 Icoor2 imax = MaxICoor22;5666 Icoor2 l0 = imax,l1 = imax;5667 double dd2 = imax;// infinity5668 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||^25681 Icoor2 ABAC = (AB,AC); // AB.AC|5682 5683 double d2;5684 if ( ABAC < 0 ) // DIST A5685 {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 B5696 {5697 if ( (d2=(double) BCBC) < dd2)5698 {5699 dd2 = d2;5700 er = Adj(ta); // other direction5701 l0 = BCBC;5702 l1 = ACAC;5703 cas = 1;5704 s = s1;5705 }5706 }5707 else // DIST AB5708 {5709 5710 double det_2 = (double) Det(AB,AC);5711 det_2 *= det_2; // square of area*2 of triangle ABC5712 d2 = det_2/ (double) AB2; // hauteur^2 in C of of triangle ABC5713 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 er5732 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 s5743 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 edge5751 BamgVertex * st = edge.EdgeVertex(1);5752 I2 I=*st;5753 Icoor2 ll = Norme2_2 (C-I);5754 if (ll < l1) { // the other vertex is neart5755 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 else5787 {5788 a = bb/(aa+bb);5789 b = aa/(aa+bb);5790 }5791 }5792 return er;5793 }5794 /*}}}*/5795 5646 /*FUNCTION ForceEdge{{{*/ 5796 5647 int ForceEdge(BamgVertex &a, BamgVertex & b,AdjacentTriangle & taret) { -
issm/branches/trunk-jpl-damage/src/c/classes/bamg/Mesh.h
r12821 r12946 154 154 /*Intermediary*/ 155 155 AdjacentTriangle CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ; 156 AdjacentTriangle CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b);157 156 void swap(Triangle *t1,short a1, 158 157 Triangle *t2,short a2, -
issm/branches/trunk-jpl-damage/src/c/classes/bamg/macros.h
r12877 r12946 20 20 static const short PreviousVertex[3] = {2,0,1}; 21 21 const Icoor1 MaxICoor = 1073741823; // 2^30-1 =111...111 (29 times one) 22 const Icoor2 MaxICoor22 = Icoor2(2)*Icoor2(MaxICoor)*Icoor2(MaxICoor) ;23 22 } 24 23 -
issm/branches/trunk-jpl-damage/src/c/classes/matrix/ElementMatrix.h
r12832 r12946 16 16 class Node; 17 17 class Matrix; 18 class Parameters; 18 19 /*}}}*/ 19 20 -
issm/branches/trunk-jpl-damage/src/c/classes/matrix/ElementVector.h
r12832 r12946 16 16 class Node; 17 17 class Vector; 18 class Parameters; 18 19 /*}}}*/ 19 20 -
issm/branches/trunk-jpl-damage/src/c/classes/matrix/Matrix.cpp
r12860 r12946 26 26 Matrix::Matrix(){ 27 27 28 pmatrix=NULL; 28 #ifdef _HAVE_PETSC_ 29 pmatrix=NULL; 30 #endif 29 31 smatrix=NULL; 30 32 … … 39 41 Matrix::Matrix(int M,int N,int in_type){ 40 42 41 pmatrix=NULL; 43 #ifdef _HAVE_PETSC_ 44 pmatrix=NULL; 45 #endif 42 46 smatrix=NULL; 43 47 type=in_type; … … 60 64 Matrix::Matrix(int M,int N,IssmDouble sparsity,int in_type){ 61 65 62 pmatrix=NULL; 66 #ifdef _HAVE_PETSC_ 67 pmatrix=NULL; 68 #endif 63 69 smatrix=NULL; 64 70 type=in_type; … … 80 86 Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity,int in_type){ 81 87 82 pmatrix=NULL; 88 #ifdef _HAVE_PETSC_ 89 pmatrix=NULL; 90 #endif 83 91 smatrix=NULL; 84 92 type=in_type; … … 101 109 Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode,int in_type){ 102 110 103 pmatrix=NULL; 111 #ifdef _HAVE_PETSC_ 112 pmatrix=NULL; 113 #endif 104 114 smatrix=NULL; 105 115 type=in_type; -
issm/branches/trunk-jpl-damage/src/c/classes/matrix/Vector.cpp
r12850 r12946 25 25 Vector::Vector(){ 26 26 27 #ifdef _HAVE_PETSC_ 27 28 this->pvector=NULL; 29 #endif 28 30 this->svector=NULL; 29 31 … … 38 40 Vector::Vector(int M,bool fromlocalsize,int in_type){ 39 41 42 #ifdef _HAVE_PETSC_ 40 43 pvector=NULL; 44 #endif 41 45 svector=NULL; 42 46 type=in_type; … … 57 61 } 58 62 /*}}}*/ 63 #ifdef _HAVE_PETSC_ 64 /*FUNCTION Vector::Vector(Vec petsc_vector){{{*/ 65 Vector::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 59 74 /*FUNCTION Vector::Vector(IssmDouble* serial_vec,int M,int type){{{*/ 60 75 Vector::Vector(IssmDouble* serial_vec,int M,int in_type){ 61 76 77 #ifdef _HAVE_PETSC_ 62 78 pvector=NULL; 79 #endif 80 63 81 svector=NULL; 64 82 type=in_type; -
issm/branches/trunk-jpl-damage/src/c/classes/matrix/Vector.h
r12850 r12946 36 36 Vector(int M,bool fromlocalsize=false,int type=PetscVecType); 37 37 Vector(IssmDouble* serial_vec,int pM,int type=PetscVecType); 38 #ifdef _HAVE_PETSC_ 39 Vector(Vec petsc_vector); 40 #endif 38 41 ~Vector(); 39 42 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Element.h
r12832 r12946 105 105 virtual IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index)=0; 106 106 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; 107 109 virtual IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index)=0; 108 110 virtual IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index)=0; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Penta.cpp
r12832 r12946 687 687 /*FUNCTION Penta::Delta18oParameterization{{{*/ 688 688 void Penta::Delta18oParameterization(void){ 689 689 /*Are we on the base? If not, return*/ 690 if(!IsOnBed()) return; 691 692 int i; 690 693 IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12]; 691 694 IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12]; 692 695 IssmDouble PrecipitationsPresentday[NUMVERTICES][12]; 696 IssmDouble tmp[NUMVERTICES]; 693 697 IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime; 694 698 IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime; … … 699 703 700 704 /*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); 703 707 Input* input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3); 704 708 GaussPenta* gauss=new GaussPenta(); … … 709 713 input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts); 710 714 input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts); 711 monthlyprec[iv][month]=monthlyprec[iv][month]*yts; // convertion to m/yr715 PrecipitationsPresentday[iv][month]=PrecipitationsPresentday[iv][month]/yts; // converion in m/sec 712 716 } 713 717 } 714 718 715 719 /*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); 722 726 723 727 /*Compute the temperature and precipitation*/ … … 734 738 TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum); 735 739 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 743 749 this->inputs->AddInput(NewTemperatureInput); 744 750 this->inputs->AddInput(NewPrecipitationInput); 751 752 this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,ElementEnum); 753 this->InputExtrude(SurfaceforcingsPrecipitationEnum,ElementEnum); 745 754 746 755 /*clean-up*/ … … 1559 1568 } 1560 1569 #endif 1561 1562 1570 } 1563 1571 /*}}}*/ … … 2009 2017 name==QmuVxEnum || 2010 2018 name==QmuVyEnum || 2019 name==QmuVzEnum || 2011 2020 name==QmuPressureEnum || 2012 2021 name==QmuBedEnum || -
issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Penta.h
r12832 r12946 162 162 IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index); 163 163 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");}; 164 166 void InputControlUpdate(IssmDouble scalar,bool save_parameter); 165 167 #endif -
issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Tria.cpp
r12897 r12946 915 915 IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12]; 916 916 IssmDouble PrecipitationsPresentday[NUMVERTICES][12]; 917 IssmDouble t emp[NUMVERTICES];917 IssmDouble tmp[NUMVERTICES]; 918 918 IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime; 919 919 IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime; … … 961 961 TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum); 962 962 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]); 966 965 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]); 969 969 NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts); 970 970 } 971 971 972 this->inputs->AddInput(NewTemperatureInput); 972 973 this->inputs->AddInput(NewPrecipitationInput); … … 2192 2193 rho_water=matpar->GetRhoFreshwater(); 2193 2194 2194 //if(id==1) printf(" monthlytemperatures %f\n",monthlytemperatures[1][0]);2195 //if(id==1) printf("monthlyprec %f\n",monthlyprec[1][0]);2196 2197 2195 /*measure the surface mass balance*/ 2198 2196 for (int iv = 0; iv<NUMVERTICES; iv++){ … … 3534 3532 case ThicknessAbsMisfitEnum: 3535 3533 case ThicknessAbsGradientEnum: 3534 case ThicknessAlongGradientEnum: 3535 case ThicknessAcrossGradientEnum: 3536 3536 case SurfaceAbsVelMisfitEnum: 3537 3537 case SurfaceRelVelMisfitEnum: … … 4400 4400 } 4401 4401 /*}}}*/ 4402 /*FUNCTION Tria::ThicknessAlongGradient{{{*/ 4403 IssmDouble 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{{{*/ 4452 IssmDouble 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 /*}}}*/ 4402 4500 /*FUNCTION Tria::ThicknessAbsMisfit {{{*/ 4403 4501 IssmDouble Tria::ThicknessAbsMisfit(bool process_units,int weight_index){ … … 4453 4551 /*Intermediaries */ 4454 4552 int i,ig,resp; 4455 IssmDouble Jdet; 4456 IssmDouble thickness,thicknessobs,weight; 4457 int *responses = NULL; 4553 IssmDouble Jdet; 4554 IssmDouble thickness,thicknessobs,weight; 4458 4555 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; 4464 4563 4465 4564 /*Initialize Element vector*/ … … 4470 4569 this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum); 4471 4570 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); 4475 4576 4476 4577 /* Start looping on the number of gaussian points: */ … … 4499 4600 for(i=0;i<numdof;i++) pe->values[i]+= - weight*dH[0]*dbasis[0][i]*Jdet*gauss->weight; 4500 4601 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; 4501 4614 break; 4502 4615 default: … … 4675 4788 /*Nothing in P vector*/ 4676 4789 break; 4790 case ThicknessAlongGradientEnum: 4791 /*Nothing in P vector*/ 4792 break; 4793 case ThicknessAcrossGradientEnum: 4794 /*Nothing in P vector*/ 4795 break; 4677 4796 case RheologyBbarAbsGradientEnum: 4678 4797 /*Nothing in P vector*/ … … 4852 4971 /*Nothing in P vector*/ 4853 4972 break; 4973 case ThicknessAcrossGradientEnum: 4974 /*Nothing in P vector*/ 4975 break; 4976 case ThicknessAlongGradientEnum: 4977 /*Nothing in P vector*/ 4978 break; 4854 4979 case RheologyBbarAbsGradientEnum: 4855 4980 /*Nothing in P vector*/ -
issm/branches/trunk-jpl-damage/src/c/classes/objects/Elements/Tria.h
r12897 r12946 160 160 IssmDouble ThicknessAbsMisfit( bool process_units,int weight_index); 161 161 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); 163 165 IssmDouble SurfaceRelVelMisfit( bool process_units,int weight_index); 164 166 IssmDouble SurfaceLogVelMisfit( bool process_units,int weight_index); -
issm/branches/trunk-jpl-damage/src/c/classes/objects/Inputs/TransientInput.cpp
r12832 r12946 282 282 inputs->AddObject(input); 283 283 284 } 285 /*}}}*/ 286 /*FUNCTION TransientInput::Extrude{{{*/ 287 void TransientInput::Extrude(void){ 288 289 for(int i=0;i<this->numtimesteps;i++){ 290 ((Input*)this->inputs->GetObjectByOffset(i))->Extrude(); 291 } 284 292 } 285 293 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/classes/objects/Inputs/TransientInput.h
r12705 r12946 79 79 IssmDouble Min(void); 80 80 IssmDouble MinAbs(void); 81 void Extrude(void) {_error2_("not supported yet");}81 void Extrude(void); 82 82 void VerticallyIntegrate(Input* thickness_forcing){_error2_("not supported yet");}; 83 83 void GetVectorFromInputs(Vector* vector,int* doflist); -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KMLFileReadUtils.cpp
r12835 r12946 29 29 int c; 30 30 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); 34 34 buffer[0]='\0'; 35 35 … … 57 57 if (pncom && ppcom) { 58 58 (*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*)); 60 65 (*ppcom)[*pncom-1]=bufferc; 61 66 } 62 67 else 63 x free((void**)&bufferc);68 xDelete<char>(bufferc); 64 69 inew=1; 65 70 continue; … … 98 103 if (pncom && ppcom) { 99 104 (*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*)); 101 111 (*ppcom)[*pncom-1]=bufferc; 102 112 } 103 113 else 104 x free((void**)&bufferc);114 xDelete<char>(bufferc); 105 115 } 106 116 else { … … 133 143 134 144 if (!ibuf) 135 x free((void**)&buffer);145 xDelete<char>(buffer); 136 146 137 147 return(buffer); … … 149 159 char* buffer=NULL; 150 160 151 buffer= (char *) xmalloc(buflen*sizeof(char));161 buffer=xNew<char>(buflen); 152 162 buffer[0]='\0'; 153 163 … … 172 182 for (i=ibuf-1; i>=0; i--) 173 183 ungetc(buffer[i],fid); 174 x free((void**)&buffer);184 xDelete<char>(buffer); 175 185 return(buffer); 176 186 } … … 197 207 198 208 if (!ibuf) 199 x free((void**)&buffer);209 xDelete<char>(buffer); 200 210 201 211 return(buffer); … … 209 219 /* add the specified character to the token buffer */ 210 220 211 char* buffer =NULL;221 char* buffer2=NULL; 212 222 213 223 /* check buffer length and realloc if necessary */ … … 215 225 if (*pibuf+2 > *pbuflen) { 216 226 *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)); 218 233 } 219 234 … … 248 263 /* strtok modifies ktag, so work on copy */ 249 264 250 ktagi= (char *) xmalloc((strlen(ktag)+1)*sizeof(char));265 ktagi=xNew<char>(strlen(ktag)+1); 251 266 memcpy(ktagi,ktag,(strlen(ktag)+1)*sizeof(char)); 252 267 … … 258 273 if (!pname) { 259 274 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); 263 278 } 264 279 … … 271 286 memcpy(pname,ktokn,(strlen(ktokn)+1)*sizeof(char)); 272 287 273 x free((void**)&ktagi);288 xDelete<char>(ktagi); 274 289 275 290 if (m) … … 293 308 /* strtok modifies ktag, so work on copy */ 294 309 295 ktagi= (char *) xmalloc((strlen(ktag)+1)*sizeof(char));310 ktagi=xNew<char>(strlen(ktag)+1); 296 311 memcpy(ktagi,ktag,(strlen(ktag)+1)*sizeof(char)); 297 312 … … 315 330 } 316 331 317 x free((void**)&ktagi);332 xDelete<char>(ktagi); 318 333 319 334 /* check for xml declaration, dtd declaration, or solo tag */ … … 343 358 344 359 sscanf(kstr,"%d",pival); 345 x free((void**)&kstr);360 xDelete<char>(kstr); 346 361 347 362 /* get additional token and compare to closing tag */ … … 355 370 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 356 371 else 357 x free((void**)&kstr);372 xDelete<char>(kstr); 358 373 359 374 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pival << "."); … … 377 392 sscanf(kstr,"%d",&ival); 378 393 *pbval=(bool)ival; 379 x free((void**)&kstr);394 xDelete<char>(kstr); 380 395 381 396 /* get additional token and compare to closing tag */ … … 389 404 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 390 405 else 391 x free((void**)&kstr);406 xDelete<char>(kstr); 392 407 393 408 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << (*pbval ? "true" : "false") << "."); … … 422 437 if (!pstr) { 423 438 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); 427 442 } 428 443 … … 435 450 memcpy(pstr,kstr,(strlen(kstr)+1)*sizeof(char)); 436 451 437 x free((void**)&kstr);452 xDelete<char>(kstr); 438 453 439 454 if (m) … … 450 465 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 451 466 else 452 x free((void**)&kstr);467 xDelete<char>(kstr); 453 468 454 469 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=\"" << pstr << "\"."); … … 472 487 473 488 sscanf(kstr,"%g",pfval); 474 x free((void**)&kstr);489 xDelete<char>(kstr); 475 490 476 491 /* get additional token and compare to closing tag */ … … 484 499 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 485 500 else 486 x free((void**)&kstr);501 xDelete<char>(kstr); 487 502 488 503 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pfval << "."); … … 506 521 507 522 sscanf(kstr,"%lg",pdval); 508 x free((void**)&kstr);523 xDelete<char>(kstr); 509 524 510 525 /* get additional token and compare to closing tag */ … … 518 533 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 519 534 else 520 x free((void**)&kstr);535 xDelete<char>(kstr); 521 536 522 537 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pdval << "."); … … 533 548 char* kstr; 534 549 char* ktok; 550 double* dval2=NULL; 535 551 char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; 536 552 … … 544 560 if (!*pdval) 545 561 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); 549 565 550 566 /* loop through string to get all values */ … … 558 574 ktok=strtok(NULL,delim); 559 575 } 560 x free((void**)&kstr);576 xDelete<char>(kstr); 561 577 562 578 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)); 564 585 565 586 if (m) … … 576 597 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 577 598 else 578 x free((void**)&kstr);599 xDelete<char>(kstr); 579 600 580 601 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); … … 586 607 /*}}}*/ 587 608 /*FUNCTION KMLFileTokenParse {{{*/ 588 int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen,609 int KMLFileTokenParse(double **pdval,int* m,int n,int maxlen, 589 610 char* ktag, 590 611 FILE* fid){ 591 612 592 int i= 0,j=-1;613 int i=-1,j=-1; 593 614 char* kstr; 594 615 char* ktok; 616 double* dval2=NULL; 595 617 char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; 596 618 … … 600 622 NULL,NULL)) || 601 623 (kstr[0] == '<')) 602 _error2_("KMLFileTokenParse -- Missing double [m x 3] field for " << ktag << ".\n");603 604 if (!*pdval 3)624 _error2_("KMLFileTokenParse -- Missing double [m x n] field for " << ktag << ".\n"); 625 626 if (!*pdval) 605 627 if (maxlen) 606 *pdval 3=(double (*)[3]) xmalloc((maxlen*3) *sizeof(double));607 else 608 *pdval 3=(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); 609 631 610 632 /* loop through string to get all values */ … … 612 634 ktok=strtok(kstr,delim); 613 635 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])); 622 641 ktok=strtok(NULL,delim); 623 642 } 624 x free((void**)&kstr);643 xDelete<char>(kstr); 625 644 626 645 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)); 628 652 629 653 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 3values.");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."); 634 658 635 659 /* get additional token and compare to closing tag */ … … 643 667 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 644 668 else 645 x free((void**)&kstr);669 xDelete<char>(kstr); 646 670 647 671 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); 648 672 // 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"); 650 674 651 675 return(0); … … 671 695 (!strncmp(&(kstr[2]),&(ktag[1]),(strcspn(ktag," >")-1)/sizeof(char)))) { 672 696 _pprintLine_("KMLFileTagSkip -- closing tag " << kstr << "."); 673 x free((void**)&kstr);697 xDelete<char>(kstr); 674 698 return(0); 675 699 } … … 691 715 } 692 716 693 x free((void**)&kstr);717 xDelete<char>(kstr); 694 718 } 695 719 -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KMLFileReadUtils.h
r12832 r12946 48 48 char* ktag, 49 49 FILE* fid); 50 int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen,50 int KMLFileTokenParse(double **pdval,int* m,int n,int maxlen, 51 51 char* ktag, 52 52 FILE* fid); -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Attribute.cpp
r12835 r12946 32 32 KML_Attribute::~KML_Attribute(){ 33 33 34 if (name ) x free((void**)&name);35 if (value ) x free((void**)&value);34 if (name ) xDelete<char>(name); 35 if (value ) xDelete<char>(value); 36 36 37 37 } … … 100 100 void KML_Attribute::Alloc(const char* namei,const char* valuei){ 101 101 102 name = (char *) xmalloc((strlen(namei )+1)*sizeof(char));102 name =xNew<char>(strlen(namei )+1); 103 103 memcpy(name,namei,(strlen(namei)+1)*sizeof(char)); 104 104 105 value= (char *) xmalloc((strlen(valuei)+1)*sizeof(char));105 value=xNew<char>(strlen(valuei)+1); 106 106 memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char)); 107 107 … … 121 121 122 122 if (!value || !strlen(value)) { 123 *pvalueo= (char *) xmalloc((strlen(deflt)+1)*sizeof(char));123 *pvalueo=xNew<char>(strlen(deflt)+1); 124 124 memcpy(*pvalueo,deflt,(strlen(deflt)+1)*sizeof(char)); 125 125 } 126 126 else { 127 *pvalueo= (char *) xmalloc((strlen(value)+1)*sizeof(char));127 *pvalueo=xNew<char>(strlen(value)+1); 128 128 memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char)); 129 129 } -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Comment.cpp
r12835 r12946 31 31 KML_Comment::~KML_Comment(){ 32 32 33 if (value ) x free((void**)&value);33 if (value ) xDelete<char>(value); 34 34 35 35 } … … 94 94 void KML_Comment::Alloc(const char* valuei){ 95 95 96 value= (char *) xmalloc((strlen(valuei)+1)*sizeof(char));96 value=xNew<char>(strlen(valuei)+1); 97 97 memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char)); 98 98 … … 111 111 void KML_Comment::Get(char** pvalueo){ 112 112 113 *pvalueo= (char *) xmalloc((strlen(value)+1)*sizeof(char));113 *pvalueo=xNew<char>(strlen(value)+1); 114 114 memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char)); 115 115 -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Container.cpp
r12835 r12946 116 116 117 117 if (!strncmp(kstr,"</Container",11)) { 118 x free((void**)&kstr);118 xDelete<char>(kstr); 119 119 return; 120 120 } -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Document.cpp
r12835 r12946 102 102 &ncom,&pcom)) { 103 103 if (!strncmp(kstri,"</Document",10)) { 104 x free((void**)&kstri);104 xDelete<char>(kstri); 105 105 break; 106 106 } … … 113 113 KML_Container::Read(fid,kstri); 114 114 115 x free((void**)&kstri);115 xDelete<char>(kstri); 116 116 } 117 117 … … 119 119 120 120 for (ncom; ncom>0; ncom--) 121 x free((void**)&(pcom[ncom-1]));122 x free((void**)&pcom);121 xDelete<char>(pcom[ncom-1]); 122 xDelete<char*>(pcom); 123 123 124 124 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_File.cpp
r12835 r12946 103 103 &ncom,&pcom)) { 104 104 if (!strncmp(kstri,"</kml", 5)) { 105 x free((void**)&kstri);105 xDelete<char>(kstri); 106 106 break; 107 107 } … … 114 114 KML_Object::Read(fid,kstri); 115 115 116 x free((void**)&kstri);116 xDelete<char>(kstri); 117 117 } 118 118 … … 120 120 121 121 for (ncom; ncom>0; ncom--) 122 x free((void**)&(pcom[ncom-1]));123 x free((void**)&pcom);122 xDelete<char>(pcom[ncom-1]); 123 xDelete<char*>(pcom); 124 124 125 125 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Folder.cpp
r12835 r12946 102 102 &ncom,&pcom)) { 103 103 if (!strncmp(kstri,"</Folder", 8)) { 104 x free((void**)&kstri);104 xDelete<char>(kstri); 105 105 break; 106 106 } … … 113 113 KML_Container::Read(fid,kstri); 114 114 115 x free((void**)&kstri);115 xDelete<char>(kstri); 116 116 } 117 117 … … 119 119 120 120 for (ncom; ncom>0; ncom--) 121 x free((void**)&(pcom[ncom-1]));122 x free((void**)&pcom);121 xDelete<char>(pcom[ncom-1]); 122 xDelete<char*>(pcom); 123 123 124 124 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_GroundOverlay.cpp
r12835 r12946 127 127 &ncom,&pcom)) { 128 128 if (!strncmp(kstri,"</GroundOverlay",15)) { 129 x free((void**)&kstri);129 xDelete<char>(kstri); 130 130 break; 131 131 } … … 151 151 KML_Overlay::Read(fid,kstri); 152 152 153 x free((void**)&kstri);153 xDelete<char>(kstri); 154 154 } 155 155 … … 157 157 158 158 for (ncom; ncom>0; ncom--) 159 x free((void**)&(pcom[ncom-1]));160 x free((void**)&pcom);159 xDelete<char>(pcom[ncom-1]); 160 xDelete<char*>(pcom); 161 161 162 162 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Icon.cpp
r12835 r12946 141 141 &ncom,&pcom)) { 142 142 if (!strncmp(kstri,"</Icon", 6)) { 143 x free((void**)&kstri);143 xDelete<char>(kstri); 144 144 break; 145 145 } … … 169 169 KML_Object::Read(fid,kstri); 170 170 171 x free((void**)&kstri);171 xDelete<char>(kstri); 172 172 } 173 173 … … 175 175 176 176 for (ncom; ncom>0; ncom--) 177 x free((void**)&(pcom[ncom-1]));178 x free((void**)&pcom);177 xDelete<char>(pcom[ncom-1]); 178 xDelete<char*>(pcom); 179 179 180 180 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_LatLonBox.cpp
r12835 r12946 117 117 &ncom,&pcom)) { 118 118 if (!strncmp(kstri,"</LatLonBox",11)) { 119 x free((void**)&kstri);119 xDelete<char>(kstri); 120 120 break; 121 121 } … … 149 149 KML_Object::Read(fid,kstri); 150 150 151 x free((void**)&kstri);151 xDelete<char>(kstri); 152 152 } 153 153 … … 155 155 156 156 for (ncom; ncom>0; ncom--) 157 x free((void**)&(pcom[ncom-1]));158 x free((void**)&pcom);157 xDelete<char>(pcom[ncom-1]); 158 xDelete<char*>(pcom); 159 159 160 160 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_LineString.cpp
r12835 r12946 137 137 &ncom,&pcom)) { 138 138 if (!strncmp(kstri,"</LineString",12)) { 139 x free((void**)&kstri);139 xDelete<char>(kstri); 140 140 break; 141 141 } … … 165 165 KML_Geometry::Read(fid,kstri); 166 166 167 x free((void**)&kstri);167 xDelete<char>(kstri); 168 168 } 169 169 … … 171 171 172 172 for (ncom; ncom>0; ncom--) 173 x free((void**)&(pcom[ncom-1]));174 x free((void**)&pcom);173 xDelete<char>(pcom[ncom-1]); 174 xDelete<char*>(pcom); 175 175 176 176 return; … … 186 186 /* extract latitude and longitude into vectors */ 187 187 188 lat= (double *) xmalloc(ncoord*sizeof(double));189 lon= (double *) xmalloc(ncoord*sizeof(double));188 lat=xNew<IssmDouble>(ncoord); 189 lon=xNew<IssmDouble>(ncoord); 190 190 for (i=0; i<ncoord; i++) { 191 191 lon[i]=coords[3*i+0]; … … 195 195 /* convert latitude and longitude to x and y */ 196 196 197 x = (double *) xmalloc(ncoord*sizeof(double));198 y = (double *) xmalloc(ncoord*sizeof(double));197 x =xNew<IssmDouble>(ncoord); 198 y =xNew<IssmDouble>(ncoord); 199 199 Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 200 200 … … 221 221 fprintf(fid,"\n"); 222 222 223 x free((void**)&y);224 x free((void**)&x);225 x free((void**)&lon);226 x free((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 109 109 &ncom,&pcom)) { 110 110 if (!strncmp(kstri,"</LineStyle",11)) { 111 x free((void**)&kstri);111 xDelete<char>(kstri); 112 112 break; 113 113 } … … 125 125 KML_ColorStyle::Read(fid,kstri); 126 126 127 x free((void**)&kstri);127 xDelete<char>(kstri); 128 128 } 129 129 … … 131 131 132 132 for (ncom; ncom>0; ncom--) 133 x free((void**)&(pcom[ncom-1]));134 x free((void**)&pcom);133 xDelete<char>(pcom[ncom-1]); 134 xDelete<char*>(pcom); 135 135 136 136 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_LinearRing.cpp
r12835 r12946 150 150 KMLFileTokenParse(altmode,NULL,KML_LINEARRING_ALTMODE_LENGTH,kstri,fid); 151 151 else if (!strcmp(kstri,"<coordinates>")) 152 KMLFileTokenParse(&coords,&ncoord, 0,kstri,fid);152 KMLFileTokenParse(&coords,&ncoord,3,0,kstri,fid); 153 153 else if (!strncmp(kstri,"<",1)) 154 154 KML_Geometry::Read(fid,kstri); … … 159 159 this->AddCommnt(ncom,pcom); 160 160 161 for(ncom;ncom>0;ncom--) xDelete<char>((pcom[ncom-1])); 161 for(ncom; ncom>0; ncom--) 162 xDelete<char>(pcom[ncom-1]); 162 163 xDelete<char*>(pcom); 163 164 … … 174 175 /* extract latitude and longitude into vectors */ 175 176 176 lat=xNew< double>(ncoord);177 lon=xNew< double>(ncoord);177 lat=xNew<IssmDouble>(ncoord); 178 lon=xNew<IssmDouble>(ncoord); 178 179 for (i=0; i<ncoord; i++) { 179 180 lon[i]=coords[3*i+0]; … … 183 184 /* convert latitude and longitude to x and y */ 184 185 185 x =xNew< double>(ncoord);186 y =xNew< double>(ncoord);186 x =xNew<IssmDouble>(ncoord); 187 y =xNew<IssmDouble>(ncoord); 187 188 Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 188 189 -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_MultiGeometry.cpp
r12835 r12946 136 136 &ncom,&pcom)) { 137 137 if (!strncmp(kstri,"</MultiGeometry",15)) { 138 x free((void**)&kstri);138 xDelete<char>(kstri); 139 139 break; 140 140 } … … 177 177 KML_Geometry::Read(fid,kstri); 178 178 179 x free((void**)&kstri);179 xDelete<char>(kstri); 180 180 } 181 181 … … 183 183 184 184 for (ncom; ncom>0; ncom--) 185 x free((void**)&(pcom[ncom-1]));186 x free((void**)&pcom);185 xDelete<char>(pcom[ncom-1]); 186 xDelete<char*>(pcom); 187 187 188 188 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Object.cpp
r12835 r12946 304 304 katt->Get(pvalue,deflt); 305 305 else { 306 *pvalue= (char *) xmalloc((strlen(deflt)+1)*sizeof(char));306 *pvalue=xNew<char>(strlen(deflt)+1); 307 307 memcpy(*pvalue,deflt,(strlen(deflt)+1)*sizeof(char)); 308 308 } -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Overlay.cpp
r12835 r12946 106 106 107 107 if (!strncmp(kstr,"</Overlay", 9)) { 108 x free((void**)&kstr);108 xDelete<char>(kstr); 109 109 return; 110 110 } -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Placemark.cpp
r12835 r12946 136 136 &ncom,&pcom)) { 137 137 if (!strncmp(kstri,"</Placemark",11)) { 138 x free((void**)&kstri);138 xDelete<char>(kstri); 139 139 break; 140 140 } … … 177 177 KML_Feature::Read(fid,kstri); 178 178 179 x free((void**)&kstri);179 xDelete<char>(kstri); 180 180 } 181 181 … … 183 183 184 184 for (ncom; ncom>0; ncom--) 185 x free((void**)&(pcom[ncom-1]));186 x free((void**)&pcom);185 xDelete<char>(pcom[ncom-1]); 186 xDelete<char*>(pcom); 187 187 188 188 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Point.cpp
r12835 r12946 122 122 &ncom,&pcom)) { 123 123 if (!strncmp(kstri,"</Point", 7)) { 124 x free((void**)&kstri);124 xDelete<char>(kstri); 125 125 break; 126 126 } … … 140 140 KML_Geometry::Read(fid,kstri); 141 141 142 x free((void**)&kstri);142 xDelete<char>(kstri); 143 143 } 144 144 … … 146 146 147 147 for (ncom; ncom>0; ncom--) 148 x free((void**)&(pcom[ncom-1]));149 x free((void**)&pcom);148 xDelete<char>(pcom[ncom-1]); 149 xDelete<char*>(pcom); 150 150 151 151 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_PolyStyle.cpp
r12835 r12946 113 113 &ncom,&pcom)) { 114 114 if (!strncmp(kstri,"</PolyStyle",11)) { 115 x free((void**)&kstri);115 xDelete<char>(kstri); 116 116 break; 117 117 } … … 133 133 KML_ColorStyle::Read(fid,kstri); 134 134 135 x free((void**)&kstri);135 xDelete<char>(kstri); 136 136 } 137 137 … … 139 139 140 140 for (ncom; ncom>0; ncom--) 141 x free((void**)&(pcom[ncom-1]));142 x free((void**)&pcom);141 xDelete<char>(pcom[ncom-1]); 142 xDelete<char*>(pcom); 143 143 144 144 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Polygon.cpp
r12835 r12946 175 175 &ncom,&pcom)) { 176 176 if (!strncmp(kstri,"</Polygon", 9)) { 177 x free((void**)&kstri);177 xDelete<char>(kstri); 178 178 break; 179 179 } … … 203 203 &ncom,&pcom)) { 204 204 if (!strncmp(kstrj,"</outerBoundaryIs",17)) { 205 x free((void**)&kstrj);205 xDelete<char>(kstrj); 206 206 break; 207 207 } … … 220 220 KML_Geometry::Read(fid,kstrj); 221 221 222 x free((void**)&kstrj);222 xDelete<char>(kstrj); 223 223 } 224 224 … … 230 230 &ncom,&pcom)) { 231 231 if (!strncmp(kstrj,"</innerBoundaryIs",17)) { 232 x free((void**)&kstrj);232 xDelete<char>(kstrj); 233 233 break; 234 234 } … … 247 247 KML_Geometry::Read(fid,kstrj); 248 248 249 x free((void**)&kstrj);249 xDelete<char>(kstrj); 250 250 } 251 251 … … 254 254 KML_Geometry::Read(fid,kstri); 255 255 256 x free((void**)&kstri);256 xDelete<char>(kstri); 257 257 } 258 258 … … 260 260 261 261 for (ncom; ncom>0; ncom--) 262 x free((void**)&(pcom[ncom-1]));263 x free((void**)&pcom);262 xDelete<char>(pcom[ncom-1]); 263 xDelete<char*>(pcom); 264 264 265 265 return; -
issm/branches/trunk-jpl-damage/src/c/classes/objects/KML/KML_Style.cpp
r12835 r12946 38 38 if (list) { 39 39 // delete list; 40 if (list ) xfree((void**)&list);41 40 list =NULL; 42 41 } 43 42 if (balloon) { 44 43 // delete balloon; 45 if (balloon ) xfree((void**)&balloon);46 44 balloon =NULL; 47 45 } … … 56 54 if (label) { 57 55 // delete label; 58 if (label ) xfree((void**)&label);59 56 label =NULL; 60 57 } 61 58 if (icon) { 62 59 // delete icon; 63 if (icon ) xfree((void**)&icon);64 60 icon =NULL; 65 61 } … … 189 185 &ncom,&pcom)) { 190 186 if (!strncmp(kstri,"</Style", 7)) { 191 x free((void**)&kstri);187 xDelete<char>(kstri); 192 188 break; 193 189 } … … 230 226 KML_StyleSelector::Read(fid,kstri); 231 227 232 x free((void**)&kstri);228 xDelete<char>(kstri); 233 229 } 234 230 … … 236 232 237 233 for (ncom; ncom>0; ncom--) 238 x free((void**)&(pcom[ncom-1]));239 x free((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 32 32 KML_Unknown::~KML_Unknown(){ 33 33 34 if (name ) x free((void**)&name);35 if (value ) x free((void**)&value);34 if (name ) xDelete<char>(name); 35 if (value ) xDelete<char>(value); 36 36 37 37 } … … 77 77 78 78 if (value ) { 79 valuei= (char *) xmalloc((strlen(value)+1)*sizeof(char));79 valuei=xNew<char>(strlen(value)+1); 80 80 memcpy(valuei,value,(strlen(value)+1)*sizeof(char)); 81 81 … … 87 87 if(flag) _pprintLine_("\""); 88 88 89 x free((void**)&valuei);89 xDelete<char>(valuei); 90 90 } 91 91 else … … 108 108 109 109 if (value ) { 110 valuei= (char *) xmalloc((strlen(value)+1)*sizeof(char));110 valuei=xNew<char>(strlen(value)+1); 111 111 memcpy(valuei,value,(strlen(value)+1)*sizeof(char)); 112 112 … … 117 117 fprintf(filout,"%s %s\n",indent,vtoken); 118 118 119 x free((void**)&valuei);119 xDelete<char>(valuei); 120 120 } 121 121 … … 131 131 132 132 char* kstri; 133 char* value2=NULL; 133 134 int ncom=0; 134 135 char** pcom=NULL; … … 155 156 !strncmp(&kstri[2],name,strlen(name))) { 156 157 // _pprintLine_("KML_Unknown::Read -- closing name=" << name << "."); 157 x free((void**)&kstri);158 xDelete<char>(kstri); 158 159 break; 159 160 } … … 163 164 else if (strncmp(kstri,"<",1)) { 164 165 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)); 166 172 strcat(value,nl); 167 173 strcat(value,kstri); 168 174 } 169 175 else { 170 value= (char *) xmalloc((strlen(kstri)+1)*sizeof(char));176 value=xNew<char>(strlen(kstri)+1); 171 177 memcpy(value,kstri,(strlen(kstri)+1)*sizeof(char)); 172 178 } … … 176 182 KML_Object::Read(fid,kstri); 177 183 178 x free((void**)&kstri);184 xDelete<char>(kstri); 179 185 } 180 186 … … 182 188 183 189 for (ncom; ncom>0; ncom--) 184 x free((void**)&(pcom[ncom-1]));185 x free((void**)&pcom);190 xDelete<char>(pcom[ncom-1]); 191 xDelete<char*>(pcom); 186 192 187 193 return; -
issm/branches/trunk-jpl-damage/src/c/modules/EnumToStringx/EnumToStringx.cpp
r12917 r12946 398 398 case IceVolumeEnum : return "IceVolume"; 399 399 case TotalSmbEnum : return "TotalSmb"; 400 case ThicknessAlongGradientEnum : return "ThicknessAlongGradient"; 401 case ThicknessAcrossGradientEnum : return "ThicknessAcrossGradient"; 400 402 case P0Enum : return "P0"; 401 403 case P1Enum : return "P1"; -
issm/branches/trunk-jpl-damage/src/c/modules/Responsex/Responsex.cpp
r12878 r12946 41 41 case ThicknessAbsMisfitEnum: ThicknessAbsMisfitx( responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; 42 42 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; 43 45 case TotalSmbEnum: TotalSmbx( responses, elements,nodes, vertices, loads, materials, parameters,process_units); break; 44 46 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 30 30 31 31 /*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!"); 39 47 } 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!");44 48 45 49 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/StringToEnumx/StringToEnumx.cpp
r12917 r12946 408 408 else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum; 409 409 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; 410 412 else if (strcmp(name,"P0")==0) return P0Enum; 411 413 else if (strcmp(name,"P1")==0) return P1Enum; -
issm/branches/trunk-jpl-damage/src/c/modules/modules.h
r12878 r12946 119 119 #include "./ThicknessAbsMisfitx/ThicknessAbsMisfitx.h" 120 120 #include "./ThicknessAbsGradientx/ThicknessAbsGradientx.h" 121 #include "./ThicknessAlongGradientx/ThicknessAlongGradientx.h" 122 #include "./ThicknessAcrossGradientx/ThicknessAcrossGradientx.h" 121 123 #include "./UpdateVertexPositionsx/UpdateVertexPositionsx.h" 122 124 #include "./UpdateConstraintsx/UpdateConstraintsx.h" -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp
r12878 r12946 16 16 IssmDouble glacialindex; // used to vary present day temperature 17 17 int imonth=0; 18 // printf("Delta18oTime %f\n",Delta18oTime);19 // printf("Delta18oPresent %f\n",Delta18oPresent);20 // printf("Delta18oLgm %f\n",Delta18oLgm);21 18 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)); 27 21 28 22 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]; 30 24 //monthlyprectmp[imonth] = 1.5*pow(2,((monthlytemperaturestmp[imonth]-273.15-0)/10)); //equation from rob's paper 31 25 monthlyprectmp[imonth] = PrecipitationsPresentday[imonth]; -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/UnitConversion.cpp
r12878 r12946 51 51 case TimesteppingTimeStepEnum: scale=1.0/yts;break; //yr 52 52 case TimeEnum: scale=1.0/yts;break; //yr 53 case HydrologyWaterVxEnum: scale=yts;break; //m/yr54 case HydrologyWaterVyEnum: scale=yts;break; //m/yr55 case VxEnum: scale=yts;break; //m/yr56 case InversionVxObsEnum: scale=yts;break; //m/yr57 case VyEnum: scale=yts;break; //m/yr58 case InversionVyObsEnum: scale=yts;break; //m/yr59 case VzEnum: scale=yts;break; //m/yr60 case InversionVzObsEnum: scale=yts;break; //m/yr61 case VelEnum: scale=yts;break; //m/yr62 case InversionVelObsEnum: scale=yts;break; //m/yr63 case BalancethicknessThickeningRateEnum: scale=yts;break; //m/yr64 case BasalforcingsMeltingRateEnum: scale=yts;break; //m/yr65 case BasalforcingsMeltingRateCorrectionEnum: scale=yts;break; //m/yr66 case SurfaceforcingsPrecipitationEnum: scale=yts;break; //m/yr67 case SurfaceforcingsMassBalanceEnum: scale=yts;break; //m/yr68 case SurfaceforcingsSmbPosMaxEnum: scale=yts;break; //m/yr69 case SurfaceforcingsSmbPosMinEnum: scale=yts;break; //m/yr70 case SurfaceforcingsAPosEnum: scale=yts;break; //m/yr71 case SurfaceforcingsBPosEnum: scale=yts;break; //m/yr72 case SurfaceforcingsANegEnum: scale=yts;break; //m/yr73 case SurfaceforcingsBNegEnum: scale=yts;break; //m/yr53 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 74 74 case MisfitEnum: scale=pow(yts,2);break; //(m/yr)^2 75 75 case MassFluxEnum: scale=pow((IssmDouble)10,-12)*yts;break; // (GigaTon/year) -
issm/branches/trunk-jpl-damage/src/c/solutions/controltao_core.cpp
r12878 r12946 21 21 typedef struct { 22 22 FemModel* femmodel; 23 double* J; 23 24 } AppCtx; 24 25 … … 69 70 GetVectorFromControlInputsx(&XL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound"); 70 71 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); 73 74 xdelete(&XL); 74 75 xdelete(&XU); 75 76 77 user.J=(double*)xcalloc((maxiter+5),sizeof(double)); 76 78 user.femmodel=femmodel; 77 79 TaoSetObjectiveAndGradientRoutine(tao,FormFunctionGradient,(void*)&user); … … 81 83 TaoSolve(tao); 82 84 TaoView(tao,PETSC_VIEWER_STDOUT_WORLD); 83 TaoGetSolutionVector(tao,&X-> vector);85 TaoGetSolutionVector(tao,&X->pvector->vector); 84 86 SetControlInputsFromVectorx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,X); 85 87 for(int i=0;i<num_controls;i++){ 86 88 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,control_list[i]); 87 89 } 90 femmodel->results->AddObject(new DoubleVecExternalResult(femmodel->results->Size()+1,JEnum,user.J,maxiter+3,1,0)); 88 91 89 92 /*Finalize*/ … … 142 145 /*Compute gradient*/ 143 146 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); 145 148 VecScale(G,-1.); 146 149 … … 166 169 if(its==0) _pprintLine_("-----------------------------------+-----------------------"); 167 170 _pprintString_(setw(4)<<its<<" "<<setw(12)<<setprecision(7)<<f<<" "<<setw(12)<<setprecision(7)<<gnorm<<" | "); 171 user->J[its]=f; 168 172 169 173 /*Retrieve objective functions independently*/ -
issm/branches/trunk-jpl-damage/src/c/solutions/transient_core.cpp
r12878 r12946 24 24 /*parameters: */ 25 25 IssmDouble starttime,finaltime,dt,yts; 26 bool isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy ;26 bool isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy,isdelta18o; 27 27 bool save_results,dakota_analysis; 28 28 bool time_adapt=false; … … 53 53 femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum); 54 54 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum); 55 femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum); 55 56 56 57 /*initialize: */ … … 141 142 RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs); 142 143 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 143 149 if(VerboseSolution()) _pprintLine_(" saving temporary results"); 144 150 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 11 11 ./model/partition/*.m \ 12 12 ./model/solvers/*.m \ 13 ./planet/*.m \14 13 ./qmu/*.m \ 15 14 ./utils/*.m \ -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/acenet.m
r12878 r12946 18 18 time=10; 19 19 % 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 directory20 codepath='PATH'; % this one is for issm on my acenet directory 21 21 executionpath='/home/klemorza/issm/execution'; 22 22 %}}} … … 86 86 compressstring = [compressstring ' ' filelist{i}]; 87 87 end 88 if cluster.interactive,89 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];90 end91 88 system(compressstring); 92 89 -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.py
r12878 r12946 14 14 GENERIC cluster class definition 15 15 16 17 18 16 Usage: 17 cluster=generic('name','astrid','np',3); 18 cluster=generic('name',oshostname(),'np',3,'login','username'); 19 19 """ 20 20 -
issm/branches/trunk-jpl-damage/src/m/classes/diagnostic.m
r12878 r12946 73 73 md = checkfield(md,'diagnostic.spcvy','forcing',1); 74 74 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); 76 76 md = checkfield(md,'diagnostic.reltol','size',[1 1]); 77 77 md = checkfield(md,'diagnostic.abstol','size',[1 1]); -
issm/branches/trunk-jpl-damage/src/m/classes/mesh.m
r12878 r12946 57 57 function obj = setdefaultparameters(obj) % {{{ 58 58 59 %the connectivity is the aver gaded number of nodes linked to a59 %the connectivity is the averaged number of nodes linked to a 60 60 %given node through an edge. This connectivity is used to initially 61 61 %allocate memory to the stiffness matrix. A value of 16 seems to -
issm/branches/trunk-jpl-damage/src/m/classes/mesh.py
r12168 r12946 1 1 #module imports 2 import numpy 2 3 from fielddisplay import fielddisplay 4 from checkfield import * 5 from EnumDefinitions import * 6 from MatlabFuncs import * 3 7 4 8 class mesh: … … 65 69 else: 66 70 string="\n%s"%(" Elements and vertices:") 67 68 71 string="%s\n%s"%(string,fielddisplay(obj,"numberofelements","number of elements")) 69 70 71 72 73 72 string="%s\n%s"%(string,fielddisplay(obj,"numberofvertices","number of vertices")) 74 73 string="%s\n%s"%(string,fielddisplay(obj,"elements","index into (x,y,z), coordinates of the vertices")) … … 80 79 81 80 string="%s%s"%(string,"\n Properties:") 82 83 81 string="%s\n%s"%(string,fielddisplay(obj,"dimension","mesh dimension (2d or 3d)")) 84 82 string="%s\n%s"%(string,fielddisplay(obj,"numberoflayers","number of extrusion layers")) … … 92 90 string="%s\n%s"%(string,fielddisplay(obj,"lowerelements","lower element list (NaN for element on the lower layer")) 93 91 string="%s\n%s"%(string,fielddisplay(obj,"vertexonboundary","vertices on the boundary of the domain flag list")) 94 95 92 string="%s\n%s"%(string,fielddisplay(obj,"segments","edges on domain boundary (vertex1 vertex2 element)")) 96 93 string="%s\n%s"%(string,fielddisplay(obj,"segmentmarkers","number associated to each segment")) … … 100 97 101 98 string="%s%s"%(string,"\n Extracted model:") 102 103 99 string="%s\n%s"%(string,fielddisplay(obj,"extractedvertices","vertices extracted from the model")) 104 100 string="%s\n%s"%(string,fielddisplay(obj,"extractedelements","elements extracted from the model")) … … 114 110 # {{{setdefaultparameters 115 111 116 #the connectivity is the aver gaded number of nodes linked to a112 #the connectivity is the averaged number of nodes linked to a 117 113 #given node through an edge. This connectivity is used to initially 118 114 #allocate memory to the stiffness matrix. A value of 16 seems to … … 124 120 #}}} 125 121 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 32 32 from miscellaneous import miscellaneous 33 33 from private import private 34 from EnumDefinitions import * 34 35 #}}} 36 35 37 class model(object): 36 38 #properties … … 51 53 52 54 self.debug = debug() 53 self.verbose = verbose( )55 self.verbose = verbose('solution',True,'qmu',True,'control',True) 54 56 self.settings = settings() 55 57 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) 56 63 self.cluster = generic() 57 64 … … 70 77 self.qmu = qmu() 71 78 72 self.results = [];79 self.results = {} 73 80 self.radaroverlay = radaroverlay() 74 81 self.miscellaneous = miscellaneous() 75 82 self.private = private() 76 83 #}}} 84 77 85 def __repr__(obj): 78 86 # {{{ Display … … 111 119 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("radaroverlay","[%s,%s]" % ("1x1",obj.radaroverlay.__class__.__name__),"radar image for plot overlay")) 112 120 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 5 5 PAIROPTIONS class definition 6 6 7 8 9 7 Usage: 8 pairoptions=pairoptions(); 9 pairoptions=pairoptions('module',true,'solver',false); 10 10 """ 11 11 -
issm/branches/trunk-jpl-damage/src/m/classes/private.m
r12878 r12946 31 31 fielddisplay(obj,'isconsistent','is model self consistent'); 32 32 fielddisplay(obj,'runtimename','name of the run launched'); 33 fielddisplay(obj,'bamg','structure with mesh properties construc ed 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'); 34 34 fielddisplay(obj,'solution','type of solution launched'); 35 35 -
issm/branches/trunk-jpl-damage/src/m/classes/private.py
r12168 r12946 6 6 def __init__(self): 7 7 # {{{ Properties 8 self.runtimename = '' 9 self.bamg = {} 10 self.solution = ''; 8 self.isconsistent = True; 9 self.runtimename = '' 10 self.bamg = {} 11 self.solution = ''; 11 12 12 13 #set defaults … … 17 18 # {{{ Display 18 19 string=' private parameters: do not change' 20 21 string="%s\n%s"%(string,fielddisplay(obj,'isconsistent','is model self consistent')) 19 22 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 construc ed 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')) 21 24 string="%s\n%s"%(string,fielddisplay(obj,'solution','type of solution launched')) 22 25 return string -
issm/branches/trunk-jpl-damage/src/m/classes/verbose.m
r12878 r12946 42 42 case 1, 43 43 binary=varargin{1}; 44 if ischar(binary),44 if ischar(binary), 45 45 if strcmpi(binary,'all'), 46 46 binary=2^11-1; %all ones … … 51 51 verbose=BinaryToVerbose(verbose,binary); 52 52 end 53 elseif isnumeric(binary), 54 verbose=BinaryToVerbose(verbose,binary); 53 55 end 54 56 otherwise, … … 88 90 89 91 %BEGINBIN2VERB 90 if bitand(binary,1), verbose.mprocessor=true; else verbose.mprocessor=false; end91 if bitand(binary,2), verbose.module=true; else verbose.module=false; end92 if bitand(binary,4), verbose.solution=true; else verbose.solution=false; end93 if bitand(binary,8), verbose.solver=true; else verbose.solver=false; end94 if bitand(binary,16), verbose.convergence=true; else verbose.convergence=false; end95 if bitand(binary,32), verbose.control=true; else verbose.control=false; end96 if bitand(binary,64), verbose.qmu=true; else verbose.qmu=false; end92 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)); 97 99 %ENDBIN2VERB 98 100 -
issm/branches/trunk-jpl-damage/src/m/classes/verbose.py
r12168 r12946 1 #module imports 2 from fielddisplay import fielddisplay 1 from pairoptions import * 2 from MatlabFuncs import * 3 from WriteData import * 4 from EnumDefinitions import * 3 5 4 class verbose: 5 #properties 6 def __init__(self): 7 # {{{ Properties 6 class 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 8 31 self.mprocessor = False 9 32 self.module = False … … 13 36 self.control = False 14 37 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 3817 3817 return StringToEnum('TotalSmb') 3818 3818 3819 def ThicknessAlongGradientEnum(): 3820 """ 3821 THICKNESSALONGGRADIENTENUM - Enum of ThicknessAlongGradient 3822 3823 Usage: 3824 macro=ThicknessAlongGradientEnum() 3825 """ 3826 3827 return StringToEnum('ThicknessAlongGradient') 3828 3829 def ThicknessAcrossGradientEnum(): 3830 """ 3831 THICKNESSACROSSGRADIENTENUM - Enum of ThicknessAcrossGradient 3832 3833 Usage: 3834 macro=ThicknessAcrossGradientEnum() 3835 """ 3836 3837 return StringToEnum('ThicknessAcrossGradient') 3838 3819 3839 def P0Enum(): 3820 3840 """ -
issm/branches/trunk-jpl-damage/src/m/enum/MaximumNumberOfEnums.m
r12917 r12946 9 9 % macro=MaximumNumberOfEnums() 10 10 11 macro=4 60;11 macro=458; -
issm/branches/trunk-jpl-damage/src/m/model/MatlabFuncs.py
r12878 r12946 1 def oshostname(): 2 import socket 3 4 return socket.gethostname().lower().split('.')[0] 5 1 6 def strcmp(s1,s2): 2 7 -
issm/branches/trunk-jpl-damage/src/m/model/MatlabProcessPatch.py
r12878 r12946 3 3 PROCESSPATCH - create a structure from a patch 4 4 5 6 5 Usage: 6 Result=ProcessPatch(Result); 7 7 """ 8 8 -
issm/branches/trunk-jpl-damage/src/m/model/WriteData.py
r12878 r12946 8 8 WRITEDATA - write model field in binary file 9 9 10 11 WriteData(fid,*args)10 Usage: 11 WriteData(fid,varargin) 12 12 """ 13 13 14 14 #process options 15 options=pairoptions( args)15 options=pairoptions(*args) 16 16 17 17 #Get data properties -
issm/branches/trunk-jpl-damage/src/m/model/addnote.py
r12878 r12946 2 2 """ 3 3 ADDNOTE - add a note to the existing model notes field 4 5 6 7 8 9 4 5 Usage: 6 md=addnote(md,string); 7 8 Example: 9 md=addnote(md,'Pine Island, Geometry of 2007'); 10 10 """ 11 11 -
issm/branches/trunk-jpl-damage/src/m/model/ismodelselfconsistent.py
r12878 r12946 1 from AnalysisConfiguration import * 2 1 3 def ismodelselfconsistent(md): 2 4 """ 3 5 ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem. 4 6 5 6 7 Usage: 8 ismodelselfconsistent(md), 7 9 """ 8 10 9 11 #initialize consistency as true 10 md.private.isconsistent= true12 md.private.isconsistent=True 11 13 12 14 #Get solution and associated analyses … … 15 17 16 18 #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(): 19 21 20 22 #Some properties do not need to be checked … … 24 26 #Check that current field is an object 25 27 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) 27 29 28 30 #Check consistency of the object -
issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromcluster.py
r12878 r12946 8 8 LOADRESULTSFROMCLUSTER - load results of solution sequence from cluster 9 9 10 11 10 Usage: 11 md=loadresultsfromcluster(md,runtimename); 12 12 """ 13 13 -
issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromdisk.py
r12878 r12946 5 5 LOADRESULTSFROMDISK - load results of solution sequence from disk file "filename" 6 6 7 8 7 Usage: 8 md=loadresultsfromdisk(md=False,filename=False); 9 9 """ 10 10 -
issm/branches/trunk-jpl-damage/src/m/model/marshall.py
r12878 r12946 5 5 MARSHALL - outputs a compatible binary file from @model md, for certain solution type. 6 6 7 8 7 The routine creates a compatible binary file from @model md 8 This binary file will be used for parallel runs in JPL-package 9 9 10 11 10 Usage: 11 marshall(md) 12 12 """ 13 13 … … 21 21 22 22 #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') 24 24 25 25 #Go through all model fields: check that it is a class and call checkconsistency 26 26 fields=vars(md) 27 27 28 for field in fields.i nterkeys():28 for field in fields.iterkeys(): 29 29 30 30 #Some properties do not need to be marshalled -
issm/branches/trunk-jpl-damage/src/m/model/parameterization/parameterize.py
r12878 r12946 6 6 """ 7 7 PARAMETERIZE - parameterize a model 8 9 10 11 12 13 14 15 16 17 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'); 18 18 """ 19 19 -
issm/branches/trunk-jpl-damage/src/m/model/parseresultsfromdisk.py
r12878 r12946 7 7 """ 8 8 PARSERESULTSFROMDISK - ... 9 10 11 9 10 Usage: 11 results=parseresultsfromdisk(filename,iosplit) 12 12 """ 13 13 -
issm/branches/trunk-jpl-damage/src/m/model/petscversion.py
r12878 r12946 7 7 PETSCVERSION - recover petsc version number, inside config.h file 8 8 9 10 9 Usage: 10 PETSC_VERSION=petscversion(); 11 11 """ 12 12 -
issm/branches/trunk-jpl-damage/src/m/model/process_solve_options.py
r12878 r12946 1 1 import os 2 from EnumDefinitions import * 2 3 3 4 def process_solve_options(options): … … 5 6 DEFAULT_SOLVE_OPTIONS - set up default options for solve phase 6 7 7 8 8 Usage: 9 options=process_solve_options(options) 9 10 10 11 See also: SOLVE 11 12 """ 12 13 … … 15 16 #solution_type: check on this option, error out otherwise 16 17 solution_type=options.getfieldvalue('solution_type') 17 if solution_type in (DiagnosticSolutionEnum,PrognosticSolutionEnum,ThermalSolutionEnum,\18 if not solution_type in (DiagnosticSolutionEnum,PrognosticSolutionEnum,ThermalSolutionEnum,\ 18 19 SteadystateSolutionEnum,TransientSolutionEnum,EnthalpySolutionEnum,\ 19 20 BalancethicknessSolutionEnum,BedSlopeSolutionEnum,SurfaceSlopeSolutionEnum,HydrologySolutionEnum,FlaimSolutionEnum): … … 42 43 outoptions['keep']=options.getfieldvalue('keep','y') 43 44 outoptions['latsgn']=options.getfieldvalue('latsgn',0) 44 outoptions['cmap']=options.getfieldvalue('cmap', None)45 outoptions['cmap']=options.getfieldvalue('cmap',[]) 45 46 46 47 return outoptions -
issm/branches/trunk-jpl-damage/src/m/model/recover_areas.m
r2968 r12946 16 16 pattynflag =FlagElements(md,getfieldvalue(options,'pattyn','')); 17 17 stokesflag =FlagElements(md,getfieldvalue(options,'stokes','')); 18 hutterflag =FlagElements(md,getfieldvalue(options,'hutter',''));19 18 filltype =getfieldvalue(options,'fill','none'); 20 19 -
issm/branches/trunk-jpl-damage/src/m/model/setflowequation.m
r11005 r12946 33 33 [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin{:}); 34 34 35 %Flag the elements that ha snot been flagged as filltype35 %Flag the elements that have not been flagged as filltype 36 36 if strcmpi(filltype,'hutter'), 37 37 hutterflag(find(~macayealflag & ~pattynflag))=1; … … 58 58 if (md.mesh.dimension==2), 59 59 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') 61 61 end 62 62 end -
issm/branches/trunk-jpl-damage/src/m/model/solve.py
r12878 r12946 2 2 import os 3 3 import shutil 4 from pairoptions import * 5 from process_solve_options import * 6 from EnumDefinitions import * 7 from ismodelselfconsistent import * 4 8 5 9 def solve(md,solutionenum,*args): … … 7 11 SOLVE - apply solution sequence for this model 8 12 9 10 11 13 Usage: 14 md=solve(md,solutionenum,varargin) 15 where varargin is a list of paired arguments of string OR enums 12 16 13 14 15 16 17 18 19 20 21 22 23 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 24 28 25 29 extra options: 26 30 - loadonly : does not solve. only load results 27 31 28 29 32 Examples: 33 md=solve(md,DiagnosticSolutionEnum); 30 34 """ 31 35 -
issm/branches/trunk-jpl-damage/src/m/model/solvers/iluasmoptions.m
r12004 r12946 10 10 11 11 %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');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'); 16 16 iluasm.pc_asm_overlap=getfieldvalue(options,'pc_asm_overlap',5); 17 17 iluasm.ksp_max_it=getfieldvalue(options,'ksp_max_it',100); -
issm/branches/trunk-jpl-damage/src/m/model/waitonlock.py
r12878 r12946 8 8 WAITONLOCK - wait for a file 9 9 10 11 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 12 12 13 14 13 Usage: 14 flag=waitonlock(md,executionpath) 15 15 """ 16 16 -
issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceSheetBC.m
r11577 r12946 34 34 35 35 %Create zeros basal melting rate and surface mass balance if not specified 36 if isnan(md.surfaceforcings.precipitation),36 if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1) & (md.surfaceforcings.ispdd==0)), 37 37 md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1); 38 38 disp(' no surfaceforcings.precipitation specified: values set as zero'); 39 39 end 40 if isnan(md.surfaceforcings.mass_balance) ,40 if isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0), 41 41 md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1); 42 42 disp(' no surfaceforcings.mass_balance specified: values set as zero'); -
issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceShelfBC.m
r11577 r12946 65 65 66 66 %Create zeros basalforcings and surfaceforcings 67 if isnan(md.surfaceforcings.precipitation),67 if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1) & (md.surfaceforcings.ispdd==0)), 68 68 md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1); 69 69 disp(' no surfaceforcings.precipitation specified: values set as zero'); 70 70 end 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');71 if 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'); 74 74 end 75 75 if isnan(md.basalforcings.melting_rate), -
issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceShelfBC.py
r12878 r12946 5 5 """ 6 6 SETICESHELFBC - Create the boundary conditions for diagnostic and thermal models for a Ice Shelf with Ice Front 7 8 9 10 11 12 13 14 15 16 17 18 19 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 20 20 """ 21 21 -
issm/branches/trunk-jpl-damage/src/m/utils/BC/SetMarineIceSheetBC.m
r11577 r12946 76 76 77 77 %Create zeros basalforcings and surfaceforcings 78 if isnan(md.surfaceforcings.precipitation),78 if (isnan(md.surfaceforcings.precipitation)& (md.surfaceforcings.ispdd==1) & (md.surfaceforcings.ispdd==0)), 79 79 md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1); 80 80 disp(' no surfaceforcings.precipitation specified: values set as zero'); 81 81 end 82 if isnan(md.surfaceforcings.mass_balance) ,82 if isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0), 83 83 md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1); 84 84 disp(' no surfaceforcings.mass_balance specified: values set as zero'); -
issm/branches/trunk-jpl-damage/src/m/utils/Cluster/parallelrange.py
r12878 r12946 4 4 PARALLELRANGE - from a rank, and a number of processors, figure out a range, for parallel tasks. 5 5 6 7 6 Usage: 7 i1,i2=parallelrange(rank,numprocs,globalsize) 8 8 """ 9 9 -
issm/branches/trunk-jpl-damage/src/m/utils/Geometry/FlagElements.py
r12168 r12946 1 from numpy import * 1 import numpy 2 import os 3 #from basinzoom import * 4 #from ContourToMesh import * 5 from MatlabFuncs import * 6 2 7 def 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 16 10 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 24 31 else: 25 32 #make sure that we actually don't want the elements outside the domain outline! 26 if region[0]=='~':33 if strcmpi(region[0],'~'): 27 34 region=region[1:] 28 invert=1 ;35 invert=1 29 36 else: 30 invert=0 ;31 37 invert=0 38 32 39 #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) 37 46 else: 38 47 #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 41 50 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 50 58 else: 51 print 'Invalid region option' 52 return [] 59 raise TypeError("Invalid region option") 53 60 54 return flag; 61 return flag 62 -
issm/branches/trunk-jpl-damage/src/m/utils/OS/ismumps.py
r12878 r12946 7 7 ISMUMPS - figure out if MUMPS package was compiled with ISSM 8 8 9 10 9 Usage: 10 flag=ismumps(); 11 11 """ 12 12 -
issm/branches/trunk-jpl-damage/src/m/utils/OS/ispetsc.py
r12878 r12946 7 7 ISPETSC - figure out if PETSC package was compiled with ISSM 8 8 9 10 9 Usage: 10 flag=ispetsc(); 11 11 """ 12 12 -
issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpin.py
r12878 r12946 10 10 SCPIN get packages from host, using scp on unix, and pscp on windows 11 11 12 usage: scpin(host,packages,path) 13 14 12 usage: scpin(host,packages,path) 15 13 """ 16 14 -
issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpout.py
r12878 r12946 10 10 SCPOUT send packages to a host, using scp on unix, and pscp on windows 11 11 12 usage: scpout(host,path,packages) 13 14 12 usage: scpout(host,path,packages) 15 13 """ 16 14 -
issm/branches/trunk-jpl-damage/src/m/utils/OS/issmssh.py
r12878 r12946 9 9 ISSMSSH - wrapper for OS independent ssh command. 10 10 11 12 11 usage: 12 issmssh(host,command) 13 13 """ 14 14 -
issm/branches/trunk-jpl-damage/src/m/utils/Shell/issmdir.py
r12878 r12946 7 7 ISSMDIR - Get ISSM_DIR environment variable 8 8 9 10 9 Usage: 10 ISSM_DIR=issmdir() 11 11 """ 12 12 -
issm/branches/trunk-jpl-damage/src/m/utils/consistency/checkfield.py
r12878 r12946 8 8 CHECKFIELD - check field consistency 9 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 25 25 26 27 26 Usage: 27 md = checkfield(md,fieldname,options); 28 28 29 30 31 32 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]); 33 33 """ 34 34 … … 37 37 38 38 #get field from model 39 field=getattr(md,fieldname) 39 # field=getattr(md,fieldname) 40 exec("field=md.%s" % fieldname) 40 41 41 42 #check empty 42 if 'empty' in options:43 if options.exist('empty'): 43 44 if not field: 44 45 md = md.checkmessage(options.getfieldvalue('message',\ … … 46 47 47 48 #Check size 48 if 'size' in options:49 if options.exist('size'): 49 50 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]): 52 53 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]))) 62 68 63 69 #Check numel 64 if 'numel' in options:70 if options.exist('numel'): 65 71 fieldnumel=options.getfieldvalue('numel') 66 72 if not numpy.size(field) in fieldnumel: … … 88 94 89 95 #check values 90 if 'values' in options:96 if options.exist('values'): 91 97 fieldvalues=options.getfieldvalue('values') 92 98 if False in ismember(field,fieldvalues): … … 102 108 103 109 #check greater 104 if '>=' in options:110 if options.exist('>='): 105 111 lowerbound=options.getfieldvalue('>=') 106 112 if numpy.any(field<lowerbound): 107 113 md = md.checkmessage(options.getfieldvalue('message',\ 108 114 "field '%s' should have values above %d" % (fieldname,lowerbound))) 109 if '>' in options:115 if options.exist('>'): 110 116 lowerbound=options.getfieldvalue('>') 111 117 if numpy.any(field<=lowerbound): … … 114 120 115 121 #check smaller 116 if '<=' in options:122 if options.exist('<='): 117 123 upperbound=options.getfieldvalue('<=') 118 124 if numpy.any(field>upperbound): 119 125 md = md.checkmessage(options.getfieldvalue('message',\ 120 126 "field '%s' should have values below %d" % (fieldname,upperbound))) 121 if '<' in options:127 if options.exist('<'): 122 128 upperbound=options.getfieldvalue('<') 123 129 if numpy.any(field>=upperbound): -
issm/branches/trunk-jpl-damage/test/NightlyRun/IdToName.py
r12878 r12946 66 66 233 : 'SquareShelfTranP3dForcTemp', 67 67 234 : 'SquareShelfTranForceNeg2dDakotaSamp', 68 235 : 'SquareShelfTranForceNeg2dDakotaLocal', 68 235 : 'SquareShelfTranForceNeg2dDakotaLocal', 69 236 : 'SquareShelfTranIspddIsdeltaM2d'; 70 237 : 'SquareShelfTranIspddIsdeltaM3d'; 69 71 301 : 'SquareSheetConstrainedDiagM2d', 70 72 302 : 'SquareSheetConstrainedDiagH2d', -
issm/branches/trunk-jpl-damage/test/NightlyRun/test101.py
r12878 r12946 3 3 from setmask import * 4 4 from parameterize import * 5 from setflowequation import * 6 from EnumDefinitions import * 7 from solve import * 8 from MatlabFuncs import * 5 9 6 10 md=model() … … 8 12 md=setmask(md,'all','') 9 13 md=parameterize(md,'../Par/SquareShelfConstrained.py') 14 md=setflowequation(md,'macayeal','all') 15 md.cluster=generic('name',oshostname(),'np',3) 16 md.diagnostic.requested_outputs=StressTensorEnum 17 md=solve(md,DiagnosticSolutionEnum) 10 18 11 19 #Fields and tolerances to track changes
Note:
See TracChangeset
for help on using the changeset viewer.