Changeset 12878


Ignore:
Timestamp:
08/02/12 17:13:12 (13 years ago)
Author:
cborstad
Message:

merged trunk-jpl into trunk-jpl-damage through revision 12877

Location:
issm/branches/trunk-jpl-damage
Files:
243 deleted
770 edited
273 copied

Legend:

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

  • issm/branches/trunk-jpl-damage/Makefile.am

    r12004 r12878  
    1 EXTRA_DIST = reconf  scripts test m4 examples cron etc doc packages contributors.txt
     1EXTRA_DIST = reconf scripts test m4 examples cron etc doc packages contributors.txt
    22SUBDIRS = src bin
    33bin_SCRIPTS=config.h startup.m README.rtf
  • issm/branches/trunk-jpl-damage/README

    r11577 r12878  
    2222------------------------------------------------------------------------------
    2323
    24 Website: ttp://issm.jpl.nasa.gov/ for additional information.
     24Website: http://issm.jpl.nasa.gov/ for additional information.
    2525
    2626------------------------------------------------------------------------------
  • issm/branches/trunk-jpl-damage/bin

    • Property svn:ignore
      •  

        old new  
         1*.exe
        12*.mexa64
        23*.mexw64
  • issm/branches/trunk-jpl-damage/configs/config-arm-linux.sh

    r12258 r12878  
    33./configure \
    44        --prefix=$ISSM_DIR \
    5     --host="arm-linux" \
     5    --build="i386-apple-darwin10.8.0" \
     6    --host="arm-linux-androideabi" \
     7    --enable-shared \
     8    --without-fortran \
    69        --without-modules \
    7     CC=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-gcc \
    8     GCC=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-gcc \
    9     CXX=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-g++ \
    10         --with-vendor=arm-linux \
    11         --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
    12         --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install\
    13     --without-fortran-lib
     10        --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
     11        --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install
  • issm/branches/trunk-jpl-damage/configs/config-greenplanet.sh

    r12168 r12878  
    1 #!/bin/csh
     1#!/bin/sh
    22
    33#PETSc 3.2
     
    1010 --with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
    1111 --with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \
     12 --with-tao-dir=$ISSM_DIR/externalpackages/tao/install \
    1213 --with-mpi-include="/sopt/mpi/openmpi-1.5.4_psm/intel/include/" \
    1314 --with-mpi-lib="-L/sopt/mpi/openmpi-1.5.4_psm/intel/lib/ -lmpi -lmpi_f77" \
  • issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-ad.sh

    r12168 r12878  
    11#!/bin/sh
    22
    3 #petsc 3.2
    4 #mpich 1.4
    5 
    63./configure \
    7         --with-serial=no\
    84        --prefix=$ISSM_DIR \
    9         --with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
    10         --with-mpi-include=$ISSM_DIR/externalpackages/mpich2/install/include  \
    11         --with-mpi-lib=" $ISSM_DIR/externalpackages/mpich2/install/lib/libpmpich.a $ISSM_DIR/externalpackages/mpich2/install/lib/libmpich.a $ISSM_DIR/externalpackages/mpich2/install/lib/libmpl.a " \
    12         --without-blas-lapack-dir \
    13         --with-chaco-dir=$ISSM_DIR/externalpackages/chaco/install \
    14         --with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
    15         --with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
    16         --with-math-lib="/usr/lib/libm.dylib" \
    17         --with-graphics-lib="/usr/X11/lib/libX11.dylib" \
    18         --with-cxxoptflags=" -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -mmacosx-version-min=10.5  -O3 -DNDEBUG -w "\
    19         --with-adic2-dir=$ISSM_DIR/externalpackages/adic/install/ \
    20         --with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install/ \
    21         --with-numthreads=8 \
     5        --without-modules\
    226        --without-thermal \
    237        --without-control \
     
    3115        --without-transient \
    3216        --without-3d \
    33         --without-groundingline
    34  
    35 #--without-prognostic \
    36 #--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install  \
    37 #--with-petsc-arch=$ISSM_ARCH \
    38 #--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
    39 #--with-plapack-lib="-L$ISSM_DIR/externalpackages/petsc/install/ -lPLAPACK" \
    40 #--with-plapack-include="-I$ISSM_DIR/externalpackages/petsc/install/include/ " \
    41 #--with-blacs-dir=$ISSM_DIR/externalpackages/petsc/install/ \
    42 #--with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
    43 #--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
     17        --without-groundingline \
     18        --without-kriging  \
     19        --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install
     20        #--with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install\
  • issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-python.sh

    r12168 r12878  
    44#mpich 1.4
    55
     6pythonversion=2.7
     7
    68./configure \
    79        --prefix=$ISSM_DIR \
    810        --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
    911        --with-python-dir=$ISSM_DIR/externalpackages/python/install\
    10         --with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy\
     12        --with-python-version=$pythonversion \
     13        --with-python-numpy-dir=$ISSM_DIR/externalpackages/python/install/lib/python$pythonversion/site-packages/numpy/core/include/numpy\
    1114        --with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
    1215        --with-mpi-include=$ISSM_DIR/externalpackages/mpich2/install/include  \
  • issm/branches/trunk-jpl-damage/configs/config-macosx64-larour.sh

    r12168 r12878  
    2424        --with-blacs-dir=$ISSM_DIR/externalpackages/petsc/install/ \
    2525        --with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/ \
    26         --with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/
    27         #--with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install \
     26        --with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/ \
     27        --with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install
  • issm/branches/trunk-jpl-damage/configure.ac

    r12258 r12878  
    22
    33#AUTOCONF
    4 AC_INIT([ISSM],[4.1],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
     4AC_INIT([ISSM],[4.2.1],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
    55AC_CONFIG_AUX_DIR([./aux-config])         #Put config files in aux-config
    66AC_CONFIG_MACRO_DIR([m4])                 #m4 macros are located in m4
     
    1010AC_PROG_CPP
    1111AC_PROG_CXX([cccl cl icl g++])
    12 #AC_PROG_F77([ifort g77 gfortran])
     12AC_PROG_F77([ifort g77 gfortran])
    1313#Libraries and linking
    14 AC_PROG_RANLIB
    1514AC_F77_LIBRARY_LDFLAGS
    1615AC_PATH_XTRA      #figure out X library and include paths
     
    2322AM_PROG_CC_C_O
    2423
    25 ##LIBTOOL?
    26 #AC_PROG_LIBTOOL
     24AM_PROG_AR
     25AC_PROG_RANLIB
     26
     27# To produce shared libraries uncomment LT_INIT. In theory, Libtool can be initialized
     28# even if all linking is static, since, if not shared libraries are to be produce, libtool
     29# will act simply as a wrapper around AR and Ranlib.
     30#
    2731#LT_INIT
    2832
     
    3135
    3236#AM_PROG_AR must be placed after ISSM_OPTIONS
    33 AM_PROG_AR
    3437
    3538#List all Makefiles
  • issm/branches/trunk-jpl-damage/etc/environment.csh

    r12168 r12878  
    127127setenv VALGRIND_DIR {$VALGRIND_DIR}
    128128setenv PATH {$PATH}:{$VALGRIND_DIR}
     129
     130#MERCURIAL
     131#setenv PYTHONPATH {$PYTHONPATH}:{$MERCURIAL_DIR}/mercurial/pure/
     132setenv PYTHONPATH {$MERCURIAL_DIR}/mercurial/pure/
     133setenv PATH {$PATH}:{$MERCURIAL_DIR}
     134
     135#GSL
     136setenv GSL_DIR {$GSL_DIR}
     137setenv LD_LIBRARY_PATH {$LD_LIBRARY_PATH}:{$GSL_DIR}/lib
     138
     139#CMAKE
     140setenv PATH {$PATH}:{$CMAKE_DIR}/bin
  • issm/branches/trunk-jpl-damage/etc/environment.sh

    r12258 r12878  
    3939#PETSC
    4040export PETSC_DIR
    41 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PETSC_DIR/lib/$ISSM_ARCH"
     41export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PETSC_DIR/lib/$ISSM_ARCH:$PETSC_DIR/lib"
    4242export LD_RUN_PATH="$LD_RUN_PATH:$PETSC_DIR/lib/$ISSM_ARCH"
    4343
     
    262262export PATH="$PYTHON_DIR/bin:$PATH"
    263263export PYTHONPATH="$PYTHONPATH:$ISSM_DIR/src/modules/python"
    264 export LD_LIBRARY_PATH=$ISSM_DIR/src/modules/python:$LD_LIBRARY_PATH
     264export LD_LIBRARY_PATH=$ISSM_DIR/src/modules/python:$ISSM_DIR/externalpackages/python/install/lib:$LD_LIBRARY_PATH
    265265export PYTHONSTARTUP
    266266
     
    270270#GIT
    271271export PATH="$PATH:$GIT_DIR/install/bin"
     272
     273#NCVIEW
     274export PATH="$PATH:$NCVIEW_DIR/install"
     275
     276#TCLX
     277export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TCLX_DIR"
     278export LD_RUN_PATH="$LD_RUN_PATH:$TCLX_DIR"
     279
     280
     281#ASPELL
     282export PATH="$ASPELL_DIR/install/bin:$PATH"
     283
     284
     285#ESMF
     286export ESMF_DIR=$ISSM_DIR/externalpackages/esmf/esmf
     287export ESMF_COMPILER=gfortran
     288export ESMF_COMM=mpich2
     289
     290#HDF5
     291export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$HDF5_DIR/lib"
     292export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HDF5_DIR/lib"
     293export LIBRARY_PATH="$LIBRARY_PATH:$HDF5_DIR/lib"
     294export C_INCLUDE_PATH="$C_INCLUDE_PATH:$HDF5_DIR/include"
     295
  • issm/branches/trunk-jpl-damage/etc/environment_variables.csh

    r12168 r12878  
    8181set SSH_DIR={$ISSM_DIR}/externalpackages/ssh
    8282
     83#mercurial
     84set MERCURIAL_DIR={$ISSM_DIR}/externalpackages/mercurial/install
     85
    8386#valgrind
    8487set VALGRIND_DIR={$ISSM_DIR}/externalpackages/valgrind/install/bin
     88
     89#gsl
     90set GSL_DIR={$ISSM_DIR}/externalpackages/gsl/install
     91
     92#cmake
     93set CMAKE_DIR={$ISSM_DIR}/externalpackages/cmake/install
  • issm/branches/trunk-jpl-damage/etc/environment_variables.sh

    r12258 r12878  
    182182ANDROID_SDK_DIR="$ANDROID_DIR/android-sdk/install-sdk"
    183183
    184 #android-ant
    185 ANDROID_ANT_DIR="$ANDROID_DIR/android-sdk/install-ant"
    186 
    187184#gsl
    188185GSL_DIR="$ISSM_DIR/externalpackages/gsl/install"
     
    192189
    193190#PYTHON
     191PYTHON_VER=2.7
    194192PYTHON_DIR="$ISSM_DIR/externalpackages/python/install"
    195193PYTHONSTARTUP="$ISSM_DIR/startup.py"
     
    201199#GIT
    202200GIT_DIR="$ISSM_DIR/externalpackages/git"
     201
     202#NCVIEW
     203NCVIEW_DIR="$ISSM_DIR/externalpackages/ncview"
     204
     205#TCLX
     206TCLX_DIR="$ISSM_DIR/externalpackages/tclx/install/lib/tclx8.4"
     207
     208#ASPELL
     209ASPELL_DIR="$ISSM_DIR/externalpackages/aspell/"
     210
     211#HDF5
     212export HDF5_DIR=$ISSM_DIR/externalpackages/hdf5/install
  • issm/branches/trunk-jpl-damage/externalpackages

    • Property svn:ignore
      •  

        old new  
        11MITgcm
        22OpenAD
         3ivins
  • issm/branches/trunk-jpl-damage/externalpackages/adolc

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install*
        23src
  • issm/branches/trunk-jpl-damage/externalpackages/adolc/install.sh

    r12258 r12878  
    2222cd src
    2323
     24export CC=gcc
     25export CXX=g++
     26export CFLAGS="-arch x86_64"
     27export CXXFLAGS="-arch x86_64"
     28
    2429./configure \
    2530        --prefix=$ISSM_DIR/externalpackages/adolc/install \
  • issm/branches/trunk-jpl-damage/externalpackages/autoconf

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install
        23src
  • issm/branches/trunk-jpl-damage/externalpackages/automake

    • Property svn:ignore
      •  

        old new  
        22src
        33.ignore.txt
         4*.gz
  • issm/branches/trunk-jpl-damage/externalpackages/blas

    • Property svn:ignore set to
      src
      install
      *.tgz
  • issm/branches/trunk-jpl-damage/externalpackages/dakota

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install
        23src
  • issm/branches/trunk-jpl-damage/externalpackages/export_fig/export_fig.m

    r12004 r12878  
    1616%   export_fig ... -<colorspace>
    1717%   export_fig ... -append
     18%   export_fig ... -bookmark
    1819%   export_fig(..., handle)
    1920%
     
    120121%             exists, the figure is to be appended as a new page, instead
    121122%             of being overwritten (default).
     123%   -bookmark - option to indicate that a bookmark with the name of the
     124%               figure is to be created in the output file (pdf only).
    122125%   handle - The handle of the figure or axes (can be an array of handles
    123126%            of several axes, but these must be in the same figure) to be
     
    159162% 14/03/12: Fix bug in fixing the axes limits (thanks to Tobias Lamour for
    160163%           reporting it).
     164% 02/05/12: Incorporate patch of Petr Nechaev (many thanks), enabling
     165%           bookmarking of figures in pdf files.
     166% 09/05/12: Incorporate patch of Arcelia Arrieta (many thanks), to keep
     167%           tick marks fixed.
    161168
    162169function [im alpha] = export_fig(varargin)
     
    194201Hlims = findall(fig, 'Type', 'axes');
    195202if ~cls
    196     % Record the old axes limit modes
     203    % Record the old axes limit and tick modes
    197204    Xlims = make_cell(get(Hlims, 'XLimMode'));
    198205    Ylims = make_cell(get(Hlims, 'YLimMode'));
    199206    Zlims = make_cell(get(Hlims, 'ZLimMode'));
    200 end
    201 % Set all axes limit modes to manual, so the limits can't change
    202 set(Hlims, 'XLimMode', 'manual', 'YLimMode', 'manual', 'ZLimMode', 'manual');
     207    Xtick = make_cell(get(Hlims, 'XTickMode'));
     208    Ytick = make_cell(get(Hlims, 'YTickMode'));
     209    Ztick = make_cell(get(Hlims, 'ZTickMode'));
     210end
     211% Set all axes limit and tick modes to manual, so the limits and ticks can't change
     212set(Hlims, 'XLimMode', 'manual', 'YLimMode', 'manual', 'ZLimMode', 'manual', 'XTickMode', 'manual', 'YTickMode', 'manual', 'ZTickMode', 'manual');
    203213% Set to print exactly what is there
    204214set(fig, 'InvertHardcopy', 'off');
     
    403413            eps_remove_background(tmp_nam);
    404414        end
     415        % Add a bookmark to the PDF if desired
     416        if options.bookmark
     417            fig_nam = get(fig, 'Name');
     418            if isempty(fig_nam)
     419                warning('export_fig:EmptyBookmark', 'Bookmark requested for figure with no name. Bookmark will be empty.');
     420            end
     421            add_bookmark(tmp_nam, fig_nam);
     422        end
    405423        % Generate a pdf
    406424        eps2pdf(tmp_nam, pdf_nam, 1, options.append, options.colourspace==2, options.quality);
     
    435453    % Reset the hardcopy mode
    436454    set(fig, 'InvertHardcopy', old_mode);
    437     % Reset the axes limit modes
     455    % Reset the axes limit and tick modes
    438456    for a = 1:numel(Hlims)
    439         set(Hlims(a), 'XLimMode', Xlims{a}, 'YLimMode', Ylims{a}, 'ZLimMode', Zlims{a});
     457        set(Hlims(a), 'XLimMode', Xlims{a}, 'YLimMode', Ylims{a}, 'ZLimMode', Zlims{a}, 'XTickMode', Xtick{a}, 'YTickMode', Ytick{a}, 'ZTickMode', Ztick{a});
    440458    end
    441459end
     
    462480                 'aa_factor', 3, ...
    463481                 'magnify', 1, ...
     482                 'bookmark', false, ...
    464483                 'quality', []);
    465484native = false; % Set resolution to native of an image
     
    504523                case 'append'
    505524                    options.append = true;
     525                case 'bookmark'
     526                    options.bookmark = true;
    506527                case 'native'
    507528                    native = true;
     
    743764% Helper function
    744765function A = make_cell(A)
    745  if ~iscell(A)
    746      A = {A};
    747  end
    748  
     766if ~iscell(A)
     767    A = {A};
     768end
     769return
     770
     771function add_bookmark(fname, bookmark_text)
     772% Adds a bookmark to the temporary EPS file after %%EndPageSetup
     773% Read in the file
     774fh = fopen(fname, 'r');
     775if fh == -1
     776    error('File %s not found.', fname);
     777end
     778try
     779    fstrm = fread(fh, '*char')';
     780catch ex
     781    fclose(fh);
     782    rethrow(ex);
     783end
     784fclose(fh);
     785
     786% Include standard pdfmark prolog to maximize compatibility
     787fstrm = strrep(fstrm, '%%BeginProlog', sprintf('%%%%BeginProlog\n/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse'));
     788% Add page bookmark
     789fstrm = strrep(fstrm, '%%EndPageSetup', sprintf('%%%%EndPageSetup\n[ /Title (%s) /OUT pdfmark',bookmark_text));
     790
     791% Write out the updated file
     792fh = fopen(fname, 'w');
     793if fh == -1
     794    error('Unable to open %s for writing.', fname);
     795end
     796try
     797    fwrite(fh, fstrm, 'char*1');
     798catch ex
     799    fclose(fh);
     800    rethrow(ex);
     801end
     802fclose(fh);
     803return
  • issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2array.m

    r12004 r12878  
    4141% 27/1/2012 Bug fix affecting painters rendering tall figures. Thanks to
    4242% Ken Campbell for reporting it.
     43
     44% 3/4/2012 Bug fix to median input. Thanks to Andy Matthews for reporting
     45% it.
    4346
    4447function [A bcol] = print2array(fig, res, renderer)
     
    119122            end
    120123        end
    121         bcol = median([reshape(A(:,[l r],:), [], size(A, 3)); reshape(A([t b],:,:), [], size(A, 3))], 1);
     124        bcol = uint8(median(single([reshape(A(:,[l r],:), [], size(A, 3)); reshape(A([t b],:,:), [], size(A, 3))]), 1));
    122125        for c = 1:size(A, 3)
    123126            A(:,[1:l-1, r+1:end],c) = bcol(c);
  • issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2eps.m

    r12004 r12878  
    4545% alias can lead to another font being swapped in.
    4646
     47% 10/4/2012 Make the font swapping case insensitive.
     48
    4749function print2eps(name, fig, varargin)
    4850options = {'-depsc2'};
     
    5759end
    5860% Find all the used fonts in the figure
    59 fonts = get(findall(fig, '-property', 'FontName'), 'FontName');
     61font_handles = findall(fig, '-property', 'FontName');
     62fonts = get(font_handles, 'FontName');
    6063if ~iscell(fonts)
    6164    fonts = {fonts};
    6265end
    63 fonts = unique(fonts);
    6466% Map supported font aliases onto the correct name
     67fontsl = lower(fonts);
    6568for a = 1:numel(fonts)
    66     f = lower(fonts{a});
     69    f = fontsl{a};
    6770    f(f==' ') = [];
    6871    switch f
    6972        case {'times', 'timesnewroman', 'times-roman'}
    70             fonts{a} = 'Times-Roman';
     73            fontsl{a} = 'times-roman';
    7174        case {'arial', 'helvetica'}
    72             fonts{a} = 'Helvetica';
     75            fontsl{a} = 'helvetica';
    7376        case {'newcenturyschoolbook', 'newcenturyschlbk'}
    74             fonts{a} = 'NewCenturySchlbk';
     77            fontsl{a} = 'newcenturyschlbk';
    7578        otherwise
    7679    end
    7780end
     81fontslu = unique(fontsl);
    7882% Determine the font swap table
    7983matlab_fonts = {'Helvetica', 'Times-Roman', 'Palatino', 'Bookman', 'Helvetica-Narrow', 'Symbol', ...
    8084                'AvantGarde', 'NewCenturySchlbk', 'Courier', 'ZapfChancery', 'ZapfDingbats'};
    81 require_swap = find(~ismember(fonts, matlab_fonts));
    82 unused_fonts = find(~ismember(matlab_fonts, fonts));
    83 font_swap = min(numel(require_swap), numel(unused_fonts));
    84 font_swap = [reshape(matlab_fonts(unused_fonts(1:font_swap)), 1, font_swap); reshape(fonts(require_swap(1:font_swap)), 1, font_swap)];
     85matlab_fontsl = lower(matlab_fonts);
     86require_swap = find(~ismember(fontslu, matlab_fontsl));
     87unused_fonts = find(~ismember(matlab_fontsl, fontslu));
     88font_swap = cell(3, 0);
     89for a = 1:min(numel(require_swap), numel(unused_fonts))
     90    ind = find(strcmp(fontslu{require_swap(a)}, fontsl));
     91    n = numel(ind);
     92    font_swap(1,end+1:end+n) = reshape(mat2cell(font_handles(ind), ones(n, 1)), 1, []);
     93    font_swap(2,end-n+1:end) = matlab_fonts(unused_fonts(a));
     94    font_swap(3,end-n+1:end) = reshape(fonts(ind), 1, []);
     95end
    8596% Swap the fonts
    8697for a = 1:size(font_swap, 2)
    87     set(findall(fig, 'FontName', font_swap{2,a}), 'FontName', font_swap{1,a});
     98    set(font_swap{1,a}, 'FontName', font_swap{2,a});
    8899end
    89100% Set paper size
     
    114125    % Reset the font names in the figure
    115126    for a = 1:size(font_swap, 2)
    116         set(findall(fig, 'FontName', font_swap{1,a}), 'FontName', font_swap{2,a});
     127        set(font_swap{1,a}, 'FontName', font_swap{3,a});
    117128    end
    118129    % Replace the font names in the eps file
     130    font_swap = font_swap(2:3,:);
    119131    try
    120132        swap_fonts(name, font_swap{:});
  • issm/branches/trunk-jpl-damage/externalpackages/gdal

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install*
        23src
  • issm/branches/trunk-jpl-damage/externalpackages/gdal/install.sh

    r12258 r12878  
    2222        --prefix="$ISSM_DIR/externalpackages/gdal/install" \
    2323        --without-python \
     24        --without-png \
    2425        --with-netcdf=no \
    2526        --with-jasper=no \
  • issm/branches/trunk-jpl-damage/externalpackages/git

    • Property svn:ignore set to
      install
      src
      *.gz
  • issm/branches/trunk-jpl-damage/externalpackages/gsl

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install
        23src
  • issm/branches/trunk-jpl-damage/externalpackages/ipython

    • Property svn:ignore
      •  

        old new  
         1src
        12src-*
         3*.gz
        24install
  • issm/branches/trunk-jpl-damage/externalpackages/ipython/install.sh

    r12258 r12878  
    33#Some cleanup
    44rm -rf src
    5 rm -rf install
    65rm -rf ipython-0.12
    7 mkdir src install
     6mkdir src
    87
    98#Download from ISSM server
  • issm/branches/trunk-jpl-damage/externalpackages/lapack

    • Property svn:ignore set to
      *.tgz
      install
      src
  • issm/branches/trunk-jpl-damage/externalpackages/lapack/configs/linux64/make.inc

    r12239 r12878  
    1616OPTS     = -fPIC -O2
    1717DRVOPTS  = $(OPTS)
    18 NOOPT    = -O0
     18NOOPT    = -fPIC -O0
    1919LOADER   = gfortran
    2020LOADOPTS =
  • issm/branches/trunk-jpl-damage/externalpackages/libtool

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install
        23src
  • issm/branches/trunk-jpl-damage/externalpackages/libtool/install.sh

    r12258 r12878  
    22
    33#Some cleanup
    4 rm -rf install libtool-2.2.6b src
     4rm -rf install libtool[\w.- ]* src
    55mkdir install
    66
    77#Download from ISSM server
    8 $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool-2.2.6b.tar.gz' 'libtool-2.2.6b.tar.gz'
     8$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' 'libtool'
    99
    1010#Untar
    11 tar -zxvf  libtool-2.2.6b.tar.gz
     11tar -zxvf  libtool[\w.-]*.tar.gz
     12rm libtool[\w.-]*.tar.gz
     13
    1214
    1315#Move libtool into src directory
    14 mv libtool-2.2.6b src
     16mv libtool[\w.-]* src
    1517
    1618#Compile libtool
  • issm/branches/trunk-jpl-damage/externalpackages/matlab/install.sh

    r12168 r12878  
    66#Select or create a new simlink
    77ln -s /usr/local/pkgs/matlab-7.6/ install
     8#ln -s /discover/vis/mathworks/matlab_r2011b/ install
    89#ln -s /usr/local/matlab704/ install
    910#ln -s /usr/local/matlab711/ install
     
    1516#ln -s /Applications/MATLAB_R2010a.app/ install
    1617#ln -s /Applications/MATLAB_R2012a.app/ install
     18#ln -s /Applications/MATLAB_R2011a.app/ install
    1719#ln -s /Applications/MATLAB*.app/ install
  • issm/branches/trunk-jpl-damage/externalpackages/mpich2

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install
        23src
  • issm/branches/trunk-jpl-damage/externalpackages/ncview

    • Property svn:ignore set to
      *.gz
      udunits.tar
      install
      genoverlay
      README
  • issm/branches/trunk-jpl-damage/externalpackages/ncview/install.sh

    r12258 r12878  
    1818cd install
    1919./configure \
    20         --prefix "$ISSM_DIR/externalpackages/ncview/install" \
     20        --prefix="$ISSM_DIR/externalpackages/ncview/install" \
    2121        --x-libraries=/usr/X11/lib/ \
    2222        --x-includes=/usr/X11/include/ \
  • issm/branches/trunk-jpl-damage/externalpackages/netcdf

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12install
         3install-*
         4src
  • issm/branches/trunk-jpl-damage/externalpackages/nose

    • Property svn:ignore
      •  

        old new  
         1*.gz
        12py3k
         3src
        24src-*
  • issm/branches/trunk-jpl-damage/externalpackages/octave

    • Property svn:ignore set to
      *.gz
      install
      src
  • issm/branches/trunk-jpl-damage/externalpackages/octave/install.sh

    r12260 r12878  
    22
    33#Some cleanup
    4 version=3.6.1
    5 rm -rf src install octave-$version octave-$version.tar.gz
     4rm -rf src install octave-3.6.2
    65mkdir install src
    76
    87#Download from ISSM server
    9 $ISSM_DIR/scripts/DownloadExternalPackage.py "http://issm.jpl.nasa.gov/files/externalpackages/octave-$version.tar.gz" "octave-$version.tar.gz"
     8$ISSM_DIR/scripts/DownloadExternalPackage.py "http://issm.jpl.nasa.gov/files/externalpackages/octave-3.6.2.tar.gz" "octave-3.6.2.tar.gz"
    109
    1110#Untar
    12 tar -zxvf  octave-$version.tar.gz
     11tar -zxvf  octave-3.6.2.tar.gz
    1312
    1413#Move octave into install directory
    15 mv octave-$version/* src
    16 rm -rf octave-$version
     14mv octave-3.6.2/* src
     15rm -rf octave-3.6.2
    1716
    1817#install
    1918cd src
     19./configure \
     20 --prefix=$ISSM_DIR/externalpackages/octave/install \
     21 --disable-readline
    2022
    21 exit
    22 make
    23 
    24 #Compile
    25 cd ../install
    26 mkdir lib
    27 cd lib
    28 cp ../../src/*.a .
    29 ln -s octave_LINUX.a octave.a
    30 ln -s octave_LINUX.a liboctave.a
     23if [ -z $NUMCPUS ];
     24then
     25        make
     26        make install
     27else
     28        make -j $NUMCPUS
     29        make -j $NUMCPUS install
     30fi
  • issm/branches/trunk-jpl-damage/externalpackages/pcre

    • Property svn:ignore set to
      install
      *.gz
  • issm/branches/trunk-jpl-damage/externalpackages/petsc

    • Property svn:ignore
      •  

        old new  
         1*.tgz
         2*.gz
        13install
        24install-3.1
  • issm/branches/trunk-jpl-damage/externalpackages/petsc/install-3.2-linux64.sh

    r12258 r12878  
    2222        --PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
    2323        --with-debugging=0 \
    24         --with-shared-libraries=0 \
     24        --with-shared-libraries=1 \
    2525        --download-mumps=yes \
    2626        --download-scalapack=yes \
  • issm/branches/trunk-jpl-damage/externalpackages/python

    • Property svn:ignore
      •  

        old new  
         1install-*
        12install
         3install-python*
        24src
        35*.tgz
  • issm/branches/trunk-jpl-damage/externalpackages/scipy/README

    r12258 r12878  
    1 You will find instructions on scipy at:
     1For OSX 10.7 (Lion), the instructions here can be followed:
    22http://www.scipy.org/Installing_SciPy/Mac_OS_X
     3
     4For OSX 10.6 (Snow Leopard), the scipy folks recommend gcc and g++ version 4.0.
     5However, ISSM needs the gfortran version recommended in $ISSM_DIR/externalpackages/gfortran.
     6On the webpage listed above, make sure the "export CC" and "export CXX" commands point to the
     7binaries associated with this gfortran version (likely in /usr/local/gfortran/bin by default).
     8Once this gfortran is installed, the install script in this directory for Snow Leopard should
     9work.
  • issm/branches/trunk-jpl-damage/externalpackages/scipy/install-linux64.sh

    r12258 r12878  
    11#!/bin/bash
     2PYVERSION=2.7
     3PYTHON=python${PYVERSION}
    24
    35#1: install numpy
     
    2527        python setup.py build
    2628        python setup.py install
     29        cd ..
     30        ${PYTHON} -c "import numpy; print 'Installed NumPy', numpy.__version__"
     31        ${PYTHON} -c "import numpy; numpy.test()"
    2732
    2833       
     
    4247        python setup.py build
    4348        python setup.py install
     49        cd ..
     50        ${PYTHON} -c "import scipy; print 'Installed SciPy', scipy.__version__"
     51        ${PYTHON} -c "import scipy; scipy.test()"
    4452
    4553elif [[ $install == "3" ]];then
  • issm/branches/trunk-jpl-damage/externalpackages/scipy/install-macosx-snowleopard.sh

    r12258 r12878  
    88install=2
    99
    10 export CC=/usr/bin/gcc-4.0
    11 export CXX=/usr/bin/g++-4.0
     10# gfortran 4.6 (see ISSM_DIR/externalpackages/gfortran) is necessary for ISSM compilation.
     11# On OSX 10.6, this recommended version gets installed in /usr/local/gfortran
     12export CC=/usr/local/gfortran/bin/gcc
     13export CXX=/usr/local/gfortran/bin/g++
    1214
    1315if [[ $install == "1" ]];then
     
    2224        cd ..
    2325        ${PYTHON} -c "import numpy; print 'Installed NumPy', numpy.__version__"
     26        ${PYTHON} -c "import numpy; numpy.test()"
    2427       
    2528elif [[ $install == "2" ]];then
     
    3437        cd ..
    3538        ${PYTHON} -c "import scipy; print 'Installed SciPy', scipy.__version__"
     39        ${PYTHON} -c "import scipy; scipy.test()"
    3640
    3741elif [[ $install == "3" ]];then
  • issm/branches/trunk-jpl-damage/externalpackages/triangle

    • Property svn:ignore
      •  

        old new  
         1*.zip
        12install
        23install-matlab
  • issm/branches/trunk-jpl-damage/externalpackages/triangle/install-macosx64.sh

    r12258 r12878  
    11#!/bin/bash
    2 
    3 #use matlab?
    4 matlab=0
    5 
    62
    73#Some cleanup
     
    2218
    2319#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
     20patch triangle.c ../triangle.c.patch
    2921
    3022#Compile triangle
  • issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch

    r1 r12878  
    55>  * double precision activation in exactinit(); The rest is not changed.
    66>  * We also created the ice_makefile to compile Triangle into a library. */
    7 > #include <mat.h>
    8 > #include <matrix.h>
     7> /* #include <mat.h>
     8> #include <matrix.h> */
    99> #define ANSI_DECLARATORS
    1010> #define NO_TIMER
     
    134134<   memptr = (VOID *) malloc((unsigned int) size);
    135135---
    136 >   memptr = (VOID *) mxMalloc((unsigned int) size);
    137 >   //memptr = (VOID *) malloc((unsigned int) size);
     136>   //memptr = (VOID *) mxMalloc((unsigned int) size);
     137>   memptr = (VOID *) malloc((unsigned int) size);
    1381381447c1543,1544
    139139<   free(memptr);
    140140---
    141 >   //free(memptr);
    142 >   mxFree(memptr);
     141>   free(memptr);
     142>   //mxFree(memptr);
    1431433665,3670c3762,3767
    144144< void printtriangle(struct mesh *m, struct behavior *b, struct otri *t)
  • issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/Synchronize.sh

    r9403 r12878  
    66cat c.vim | sed "/ISSM's Enums begin/,/vim: ts=8/d" > temp
    77echo "\"ISSM's Enums begin" >> temp
    8 cat ../../../../../src/c/EnumDefinitions/EnumDefinitions.h | grep -e "[0-9]Enum," -e "[Aa-Zz]Enum," | grep -v StringToEnum | sed -e "s/,//g" | awk '{ printf "syn keyword cConstant " $1 "\n"}' >> temp
     8cat ../../../../../src/c/EnumDefinitions/EnumDefinitions.h | grep -e "[0-9]Enum," -e "[aA-zZ]Enum," | grep -v StringToEnum | sed -e "s/,//g" | awk '{ printf "syn keyword cConstant " $1 "\n"}' >> temp
    99echo "\"ISSM's Enums end" >> temp
    1010cat c.vim | sed "1,/ISSM's Enums end/d" >> temp
  • issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/c.vim

    r12258 r12878  
    404404"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    405405"ISSM containers:
    406 syn keyword     cType           Constraints DataSet Elements Inputs Loads Materials Nodes Parameters Results Vertices
     406syn keyword     cType           Constraints DataSet Elements Inputs Loads Materials Nodes Parameters Results Vertices Options
    407407"Petsc
    408 syn keyword     cType           Vec Mat
     408syn keyword     cType           Vec Mat SeqVec SeqMat
    409409"other ISSM's syntax
    410 syn keyword     cType           mxArray ErrorException
     410syn keyword     cType           mxArray ErrorException QuadtreeBox IssmDouble IssmPDouble
    411411
    412412"ISSM's objects begin
     
    545545syn keyword cType Mesh
    546546syn keyword cType Geometry
    547 syn keyword cType QuadTree
     547syn keyword cType BamgQuadtree
    548548syn keyword cType SetOfE4
    549549syn keyword cType Variogram
     
    551551syn keyword cType ExponentialVariogram
    552552syn keyword cType SphericalVariogram
     553syn keyword cType PowerVariogram
    553554syn keyword cType Quadtree
    554555syn keyword cType Observation
     
    649650syn keyword cConstant MaterialsRhoIceEnum
    650651syn keyword cConstant MaterialsRhoWaterEnum
     652syn keyword cConstant MaterialsRhoFreshwaterEnum
    651653syn keyword cConstant MaterialsMuWaterEnum
    652654syn keyword cConstant MaterialsThermalExchangeVelocityEnum
     
    694696syn keyword cConstant SettingsResultsAsPatchesEnum
    695697syn keyword cConstant SettingsWaitonlockEnum
    696 syn keyword cConstant DebugPetscProfilingEnum
    697 syn keyword cConstant PetscProfilingCurrentMemEnum
    698 syn keyword cConstant PetscProfilingCurrentFlopsEnum
    699 syn keyword cConstant PetscProfilingSolutionTimeEnum
     698syn keyword cConstant SurfaceforcingsDelta18oEnum
     699syn keyword cConstant SurfaceforcingsDelta18oTemperaturesPresentdayEnum
     700syn keyword cConstant SurfaceforcingsDelta18oTemperaturesLgmEnum
     701syn keyword cConstant SurfaceforcingsDelta18oSurfaceEnum
     702syn keyword cConstant SurfaceforcingsIsdelta18oEnum
     703syn keyword cConstant SurfaceforcingsPrecipitationsPresentdayEnum
     704syn keyword cConstant DebugProfilingEnum
     705syn keyword cConstant ProfilingCurrentMemEnum
     706syn keyword cConstant ProfilingCurrentFlopsEnum
     707syn keyword cConstant ProfilingSolutionTimeEnum
     708syn keyword cConstant MaxIterationConvergenceFlagEnum
    700709syn keyword cConstant SteadystateMaxiterEnum
    701710syn keyword cConstant SteadystateNumRequestedOutputsEnum
     
    796805syn keyword cConstant IntParamEnum
    797806syn keyword cConstant IntVecParamEnum
     807syn keyword cConstant TransientParamEnum
    798808syn keyword cConstant MacAyeal2dIceFrontEnum
    799809syn keyword cConstant MacAyeal3dIceFrontEnum
     
    915925syn keyword cConstant StressTensorzzEnum
    916926syn keyword cConstant IceVolumeEnum
     927syn keyword cConstant TotalSmbEnum
    917928syn keyword cConstant P0Enum
    918929syn keyword cConstant P1Enum
  • issm/branches/trunk-jpl-damage/m4/issm_options.m4

    r12258 r12878  
    1212                AC_DEFINE([_ISSM_DEBUG_],[1],[Macro to enable debugging in ISSM])
    1313        fi
    14         dnl }}}
     14
     15        dnl }}}
     16    dnl shared build {{{
     17    AC_ARG_ENABLE([shared],                                                dnl feature
     18        AS_HELP_STRING([--enable-shared], [produce libISSM.so.0]),         dnl help string
     19        [enable_shared=$enableval],                                        dnl action if given
     20        [enable_shared=no])                                                dnl action if not given
     21    AM_CONDITIONAL([SHARED], [test $enable_shared = yes])
     22    dnl }}}
     23
    1524        dnl Modules build {{{
    1625        AC_ARG_WITH([modules],
     
    6069                        export CFLAGS=" -D_INTEL_LINUX_"
    6170                        export CXXFLAGS=" -D_INTEL_LINUX_"
     71                elif test $VENDOR = intel-discover; then
     72                        export CC=icc
     73                        export CXX=icpc
     74                        export CXXFLAGS=" -O3 -D_INTEL_LINUX_ "
     75                        export CFLAGS=" -O3 -D_INTEL_LINUX_ "
    6276                elif test $VENDOR = intel-pleiades; then
    6377                        export CC=icc
     
    6579                        export CXXFLAGS=" -O3 -xS -D_INTEL_LINUX_ "
    6680                        export CFLAGS=" -O3 -xS -D_INTEL_LINUX_ "
    67                 elif test $VENDOR = arm-linux; then
    68                         export CC=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-gcc
    69                         export GCC=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-gcc
    70                         export CXX=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-g++
    71                         export AR=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-ar
    72                         export RANLIB=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-ranlib
    7381        else
    7482                AC_MSG_ERROR([unknow compiler vendor!])
     
    308316        AC_MSG_RESULT($HAVE_BOOST)
    309317        dnl }}}
    310         dnl python-version{{{
    311         AC_ARG_WITH([python-version],
    312           AS_HELP_STRING([--with-python-version = PYTHONVERSION],[python version.]),
    313           [PYTHONVERSION=$withval],[PYTHONVERSION=""])
    314         AC_MSG_CHECKING(for python version)
    315 
    316         HAVE_PYTHON3="no"
    317 
    318         dnl recover major:
    319         PYTHON_MAJOR=${PYTHONVERSION%.*}
    320 
    321         if test x$PYTHON_MAJOR = x3; then
    322                 dnl are we running python 3?
    323                 HAVE_PYTHON3="yes"
    324         fi
    325         AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
    326 
    327         AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
    328         AC_MSG_RESULT($PYTHON_MAJOR)
    329         dnl }}}
    330318        dnl python{{{
    331319        AC_ARG_WITH([python-dir],
     
    336324        if test -d "$PYTHON_ROOT"; then
    337325                dnl defaults
     326                HAVE_PYTHON3="no"
    338327                HAVE_PYTHON=yes
     328               
     329                AC_ARG_WITH([python-version],
     330                  AS_HELP_STRING([--with-python-version = PYTHONVERSION],[python version.]),
     331                  [PYTHONVERSION=$withval],[PYTHONVERSION=""])
     332                AC_MSG_CHECKING(for python version)
     333
     334                dnl recover major:
     335                PYTHON_MAJOR=${PYTHONVERSION%.*}
     336
     337                if test x$PYTHON_MAJOR = x3; then
     338                        dnl are we running python 3?
     339                        HAVE_PYTHON3="yes"
     340                fi
     341                AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
     342                AC_MSG_RESULT($PYTHON_MAJOR)
     343
    339344                PYTHONINCL=-I$PYTHON_ROOT/include
    340345                PYTHONLIB="-L$PYTHON_ROOT/lib -lpython$PYTHONVERSION"
    341346                PYTHONEXT=.so
    342                 PYTHONLINK="-dynamiclib"
     347
     348                case "${host_os}" in
     349                        *cygwin*)
     350                        PYTHONLINK="-shared"
     351                        ;;
     352                        *linux*)
     353                        PYTHONLINK="-shared"
     354                        ;;
     355                        *darwin*)
     356                        PYTHONLINK="-dynamiclib"
     357                        ;;
     358                esac
    343359
    344360                AC_DEFINE([_HAVE_PYTHON_],[1],[with Python in ISSM src])
     
    352368        fi
    353369        AM_CONDITIONAL([PYTHON], [test x$HAVE_PYTHON = xyes])
     370        AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
    354371        AC_MSG_RESULT($HAVE_PYTHON)
     372
    355373        dnl }}}
    356374        dnl python-numpy{{{
     
    429447                        dnl defaults
    430448                        HAVE_ADOLC=yes
    431                         ADOLCINCL="-I$ADOLC_ROOT/include/adolc -I$ADOLC_ROOT/include"
     449                        ADOLCINCL="-I$ADOLC_ROOT/include"
    432450                        ADOLCLIB="-L$ADOLC_ROOT/lib64 -ladolc"
    433451
     
    483501                HAVE_GSL=yes
    484502                GSLINCL="-I$GSL_ROOT/include"
    485                 GSLLIB="-L$GSL_ROOT/lib/ -lgsl -lgslcblas -lm"
     503                GSLLIB="-dy -L$GSL_ROOT/lib/ -lgsl -lgslcblas -lm"
    486504
    487505                AC_DEFINE([_HAVE_GSL_],[1],[with gsl in ISSM src])
     
    523541          [METIS_ROOT=$withval],[METIS_ROOT=""])
    524542
     543   AC_MSG_CHECKING(for metis headers and libraries in $METIS_ROOT)
     544
    525545        if test -d "$METIS_ROOT"; then
    526 
    527                 AC_MSG_CHECKING(for metis headers and libraries in $METIS_ROOT)
    528546
    529547                dnl first figure out version of metis: does the VERSION file exist?
     
    579597        fi
    580598        AM_CONDITIONAL([METIS], [test x$HAVE_METIS = xyes])
     599        AC_MSG_RESULT($HAVE_METIS)
    581600        dnl }}}
    582601        dnl mpi{{{
     
    746765                dnl defaults
    747766                HAVE_SCALAPACK=yes
    748                 SCALAPACKLIB=-L"$SCALAPACK_ROOT/ -lscalapack"
     767                if test x$VENDOR = xintel-discover; then
     768                 SCALAPACKLIB=-L"$SCALAPACK_ROOT/ -lmkl_scalapack_lp64"
     769                else
     770                 SCALAPACKLIB=-L"$SCALAPACK_ROOT/ -lscalapack"
     771                fi
    749772
    750773                AC_DEFINE([_HAVE_SCALAPACK_],[1],[with Scalapack in ISSM src])
     
    766789                HAVE_BLASLAPACK=yes
    767790                BLASLAPACKINCL=""
    768                
     791       
     792                if test x$VENDOR = xintel-discover; then
     793                 BLASLAPACKLIB=-L"$BLASLAPACK_ROOT -lmkl_lapack -lmkl -lguide -lpthread"
     794                else
    769795                dnl: branch on whether we are running on windows or linux.
    770796                case "${host_os}" in
     
    779805                        ;;
    780806                esac
     807                fi
    781808
    782809                AC_DEFINE([_HAVE_BLASLAPACK_],[1],[with blas lapack in ISSM src])
     
    853880                MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps  -lpord "
    854881                else
     882                dnl MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps  -lmumps_common -lpord -lparmetis -lzmumps"
    855883                MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps  -lmumps_common -lpord -lparmetis"
    856884                fi
     
    875903                HAVE_BLACS=yes
    876904                BLACSINCL=""
    877                 BLACSLIB=-L"$BLACS_ROOT/ -lblacs"
     905                if test x$VENDOR = xintel-discover; then
     906                 BLACSLIB=-L"$BLACS_ROOT/ -lmkl_blacs_intelmpi_lp64"
     907                else
     908                 BLACSLIB=-L"$BLACS_ROOT/ -lblacs"
     909                fi
    878910       
    879911                AC_DEFINE([_HAVE_BLACS_],[1],[with Blacs in ISSM src])
     
    896928                HAVE_HYPRE=yes
    897929                HYPREINCL=""
    898                 HYPRELIB=-L"$HYPRE_ROOT/ -lHYPRE"
     930                HYPRELIB=-L"$HYPRE_ROOT/lib -lHYPRE"
    899931       
    900932                AC_DEFINE([_HAVE_HYPRE_],[1],[with Blacs in ISSM src])
     
    906938        AC_MSG_RESULT($HAVE_HYPRE)
    907939        dnl }}}
     940        dnl prometheus{{{
     941                AC_ARG_WITH([prometheus-dir],
     942                                        AS_HELP_STRING([--with-prometheus-dir=DIR],[prometheus root directory]),
     943                                        [PROMETHEUS_ROOT=$withval],[PROMETHEUS_ROOT=""])
     944
     945                  AC_MSG_CHECKING(for prometheus headers and libraries in $PROMETHEUS_ROOT)
     946                  if test -d "$PROMETHEUS_ROOT"; then
     947
     948                        dnl defaults
     949                          HAVE_PROMETHEUS=yes
     950                          PROMETHEUSINCL=-I"$PROMETHEUS_ROOT/include"
     951                          PROMETHEUSLIB=-L"$PROMETHEUS_ROOT/lib -lpromfei -lprometheus -lparmetis"
     952
     953                          AC_DEFINE([_HAVE_PROMETHEUS_],[1],[with Prometheus in ISSM src])
     954                          AC_SUBST([PROMETHEUSINCL])
     955                          AC_SUBST([PROMETHEUSLIB])
     956                  else
     957                                HAVE_PROMETHEUS=no
     958                        fi
     959                        AC_MSG_RESULT($HAVE_PROMETHEUS)
     960                dnl }}}
     961dnl spai{{{
     962        AC_ARG_WITH([spai-dir],
     963                                AS_HELP_STRING([--with-spai-dir=DIR],[spai root directory]),
     964                                [SPAI_ROOT=$withval],[SPAI_ROOT=""])
     965
     966          AC_MSG_CHECKING(for spai headers and libraries in $SPAI_ROOT)
     967          if test -d "$SPAI_ROOT"; then
     968
     969                dnl defaults
     970                  HAVE_SPAI=yes
     971                  SPAIINCL=-I"$SPAI_ROOT/include"
     972                  SPAILIB=-L"$SPAI_ROOT/lib -lspai"
     973
     974                  AC_DEFINE([_HAVE_SPAI_],[1],[with Spai in ISSM src])
     975                  AC_SUBST([SPAIINCL])
     976                  AC_SUBST([SPAILIB])
     977          else
     978                HAVE_SPAI=no
     979                  fi
     980                  AC_MSG_RESULT($HAVE_SPAI)
     981                  dnl }}}
     982dnl superlu{{{
     983        AC_ARG_WITH([superlu-dir],
     984                                AS_HELP_STRING([--with-superlu-dir=DIR],[superlu root directory]),
     985                                [SUPERLU_ROOT=$withval],[SUPERLU_ROOT=""])
     986
     987          AC_MSG_CHECKING(for superlu headers and libraries in $SUPERLU_ROOT)
     988          if test -d "$SUPERLU_ROOT"; then
     989
     990                dnl defaults
     991                  HAVE_SUPERLU=yes
     992                  SUPERLUINCL=-I"$SUPERLU_ROOT/include"
     993                  SUPERLULIB=-L"$SUPERLU_ROOT/lib -lsuperlu_4.3"
     994
     995                  AC_DEFINE([_HAVE_SUPERLU_],[1],[with Superlu in ISSM src])
     996                  AC_SUBST([SUPERLUINCL])
     997                  AC_SUBST([SUPERLULIB])
     998          else
     999                HAVE_SUPERLU=no
     1000                  fi
     1001                  AC_MSG_RESULT($HAVE_SUPERLU)
     1002                  dnl }}}
     1003dnl spooles{{{
     1004        AC_ARG_WITH([spooles-dir],
     1005                                AS_HELP_STRING([--with-spooles-dir=DIR],[spooles root directory]),
     1006                                [SPOOLES_ROOT=$withval],[SPOOLES_ROOT=""])
     1007
     1008          AC_MSG_CHECKING(for spooles headers and libraries in $SPOOLES_ROOT)
     1009          if test -d "$SPOOLES_ROOT"; then
     1010
     1011                dnl defaults
     1012                  HAVE_SPOOLES=yes
     1013                  SPOOLESINCL=-I"$SPOOLES_ROOT/include"
     1014                  SPOOLESLIB=-L"$SPOOLES_ROOT/lib -lspooles"
     1015
     1016                  AC_DEFINE([_HAVE_SPOOLES_],[1],[with Spooles in ISSM src])
     1017                  AC_SUBST([SPOOLESINCL])
     1018                  AC_SUBST([SPOOLESLIB])
     1019          else
     1020                HAVE_SPOOLES=no
     1021                  fi
     1022                  AC_MSG_RESULT($HAVE_SPOOLES)
     1023                  dnl }}}
     1024dnl pastix{{{
     1025        AC_ARG_WITH([pastix-dir],
     1026                                AS_HELP_STRING([--with-pastix-dir=DIR],[pastix root directory]),
     1027                                [PASTIX_ROOT=$withval],[PASTIX_ROOT=""])
     1028
     1029          AC_MSG_CHECKING(for pastix headers and libraries in $PASTIX_ROOT)
     1030          if test -d "$PASTIX_ROOT"; then
     1031
     1032                dnl defaults
     1033                  HAVE_PASTIX=yes
     1034                  PASTIXINCL=-I"$PASTIX_ROOT/include"
     1035                  PASTIXLIB=-L"$PASTIX_ROOT/lib -lpastix_XXbit_mpi_smp_nobubble_int32_simple_real_scotch_i686_pc_linux -lptscotch -lptscotcherr -lpastix"
     1036
     1037                  AC_DEFINE([_HAVE_PASTIX_],[1],[with Pastix in ISSM src])
     1038                  AC_SUBST([PASTIXINCL])
     1039                  AC_SUBST([PASTIXLIB])
     1040          else
     1041                HAVE_PASTIX=no
     1042                  fi
     1043                  AC_MSG_RESULT($HAVE_PASTIX)
     1044                  dnl }}}
    9081045        dnl ml{{{
    9091046        AC_ARG_WITH([ml-dir],
     
    9441081        dnl }}}
    9451082        dnl fortran{{{
    946         dnl fortran library  option
    947         AC_MSG_CHECKING(for fortran library)
    948         AC_ARG_WITH([fortran-lib],
    949           AS_HELP_STRING([--with-fortran-lib = options],[fortran options, for ex: "/usr/lib/gfortran.a]),
    950                 [FORTRAN_LIB=$withval],[FORTRAN_LIB=""])
    951 
    952         dnl check that --with-fortran-lib may have been provided
    953         HAVE_FORTRAN=no
    954         if test -n "$FORTRAN_LIB" ; then
    955         if test x$FORTRAN_LIB = xno; then
    956             HAVE_FORTRAN=NO
    957         else
    958             HAVE_FORTRAN=yes
    959             FORTRANLIB="$FORTRAN_LIB"
    960 
    961             AC_DEFINE([_HAVE_FORTRAN_],[1],[with FORTRAN in ISSM src])
    962             AC_SUBST([FORTRANLIB])
    963         fi
    964         fi
    965         AM_CONDITIONAL([FORTRAN], [test x$HAVE_FORTRAN = xyes])
    966         AC_MSG_RESULT(done)
     1083        AC_ARG_WITH([fortran],
     1084                AS_HELP_STRING([--with-fortran = YES], [do we compile fortran code (default is yes)]),
     1085                [FORTRAN=$withval],[FORTRAN=yes])
     1086        AC_MSG_CHECKING(for fortran compilation)
     1087        if test "x$FORTRAN" = "xyes"; then
     1088                dnl defaults
     1089                HAVE_FORTRAN=yes
     1090
     1091                AC_DEFINE([_HAVE_FORTRAN_],[1],[with fortran capability])
     1092        else
     1093                HAVE_FORTRAN=no
     1094        fi
     1095        AM_CONDITIONAL([FORTRAN], [test x$FORTRAN = xyes])
     1096        AC_MSG_RESULT($FORTRAN)
     1097
     1098        if test "x$FORTRAN" = "xyes"; then
     1099                dnl fortran library  option
     1100                AC_MSG_CHECKING(for fortran library)
     1101                AC_ARG_WITH([fortran-lib],
     1102                  AS_HELP_STRING([--with-fortran-lib = options],[fortran options, for ex: "/usr/lib/gfortran.a]),
     1103                        [FORTRAN_LIB=$withval],[FORTRAN_LIB=""])
     1104
     1105                dnl check that --with-fortran-lib may have been provided
     1106                if test -n "$FORTRAN_LIB" ; then
     1107                        FORTRANLIB="$FORTRAN_LIB"
     1108                        AC_DEFINE([_HAVE_FORTRAN_],[1],[with FORTRAN in ISSM src])
     1109                        AC_SUBST([FORTRANLIB])
     1110                fi
     1111                AC_MSG_RESULT(done)
     1112        fi
    9671113        dnl }}}
    9681114        dnl graphics{{{
     
    9811127        fi
    9821128        AC_MSG_RESULT(done)
     1129        dnl }}}
     1130
     1131        dnl Capabilities
     1132        dnl with-kriging{{{
     1133        AC_ARG_WITH([kriging],
     1134                AS_HELP_STRING([--with-kriging = YES],[compile with kriging capabilities (default is yes)]),
     1135                [KRIGING=$withval],[KRIGING=yes])
     1136        AC_MSG_CHECKING(for kriging capability compilation)
     1137
     1138        if test "x$KRIGING" = "xyes"; then
     1139                HAVE_KRIGING=yes
     1140                AC_DEFINE([_HAVE_KRIGING_],[1],[with kriging capability])
     1141        else
     1142                HAVE_KRIGING=no
     1143        fi
     1144        AM_CONDITIONAL([KRIGING], [test x$HAVE_KRIGING = xyes])
     1145        AC_MSG_RESULT($HAVE_KRIGING)
    9831146        dnl }}}
    9841147        dnl with-steadystate{{{
     
    13011464        AC_MSG_RESULT($USE_64BIT_INDICES)
    13021465        dnl }}}
     1466        dnl circular-dependency{{{
     1467        AC_ARG_WITH([circular-dependency],
     1468          AS_HELP_STRING([--with-circular-dependency = bool],[do we look for circular dependencies, default "yes", ex: --with-circular-dependency="no"]),
     1469          [CIRCULAR_DEPENDENCIES=$withval],[CIRCULAR_DEPENDENCIES=yes])
     1470        AC_MSG_CHECKING(for circular dependencies)
     1471        AM_CONDITIONAL([CIRCULAR_DEPENDENCIES], [test x$CIRCULAR_DEPENDENCIES = xyes])
     1472        AC_MSG_RESULT($CIRCULAR_DEPENDENCIES)
     1473
     1474        dnl }}}
    13031475])
  • issm/branches/trunk-jpl-damage/m4/libtool.m4

    r11114 r12878  
    22#
    33#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
    4 #                 2006, 2007, 2008 Free Software Foundation, Inc.
     4#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     5#                 Foundation, Inc.
    56#   Written by Gordon Matzigkeit, 1996
    67#
     
    1112m4_define([_LT_COPYING], [dnl
    1213#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
    13 #                 2006, 2007, 2008 Free Software Foundation, Inc.
     14#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     15#                 Foundation, Inc.
    1416#   Written by Gordon Matzigkeit, 1996
    1517#
     
    3840])
    3941
    40 # serial 56 LT_INIT
     42# serial 57 LT_INIT
    4143
    4244
     
    6769AC_DEFUN([LT_INIT],
    6870[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
     71AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
    6972AC_BEFORE([$0], [LT_LANG])dnl
    7073AC_BEFORE([$0], [LT_OUTPUT])dnl
     
    8285AC_REQUIRE([LTOBSOLETE_VERSION])dnl
    8386m4_require([_LT_PROG_LTMAIN])dnl
     87
     88_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
    8489
    8590dnl Parse OPTIONS
     
    119124  esac
    120125done
    121 cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
     126cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
    122127])
    123128
     
    139144[AC_REQUIRE([AC_CANONICAL_HOST])dnl
    140145AC_REQUIRE([AC_CANONICAL_BUILD])dnl
     146AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
     147AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
     148
     149_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
     150dnl
    141151_LT_DECL([], [host_alias], [0], [The host system])dnl
    142152_LT_DECL([], [host], [0])dnl
     
    161171m4_require([_LT_FILEUTILS_DEFAULTS])dnl
    162172m4_require([_LT_CHECK_SHELL_FEATURES])dnl
     173m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
    163174m4_require([_LT_CMD_RELOAD])dnl
    164175m4_require([_LT_CHECK_MAGIC_METHOD])dnl
     176m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
    165177m4_require([_LT_CMD_OLD_ARCHIVE])dnl
    166178m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
     179m4_require([_LT_WITH_SYSROOT])dnl
    167180
    168181_LT_CONFIG_LIBTOOL_INIT([
     
    180193
    181194m4_require([_LT_TAG_COMPILER])dnl
    182 _LT_PROG_ECHO_BACKSLASH
    183195
    184196case $host_os in
     
    194206esac
    195207
    196 # Sed substitution that helps us do robust quoting.  It backslashifies
    197 # metacharacters that are still active within double-quoted strings.
    198 sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
    199 
    200 # Same as above, but do not quote variable references.
    201 double_quote_subst='s/\([["`\\]]\)/\\\1/g'
    202 
    203 # Sed substitution to delay expansion of an escaped shell variable in a
    204 # double_quote_subst'ed string.
    205 delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
    206 
    207 # Sed substitution to delay expansion of an escaped single quote.
    208 delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
    209 
    210 # Sed substitution to avoid accidental globbing in evaled expressions
    211 no_glob_subst='s/\*/\\\*/g'
    212 
    213208# Global variables:
    214209ofile=libtool
     
    250245])# _LT_SETUP
    251246
     247
     248# _LT_PREPARE_SED_QUOTE_VARS
     249# --------------------------
     250# Define a few sed substitution that help us do robust quoting.
     251m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
     252[# Backslashify metacharacters that are still active within
     253# double-quoted strings.
     254sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
     255
     256# Same as above, but do not quote variable references.
     257double_quote_subst='s/\([["`\\]]\)/\\\1/g'
     258
     259# Sed substitution to delay expansion of an escaped shell variable in a
     260# double_quote_subst'ed string.
     261delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
     262
     263# Sed substitution to delay expansion of an escaped single quote.
     264delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
     265
     266# Sed substitution to avoid accidental globbing in evaled expressions
     267no_glob_subst='s/\*/\\\*/g'
     268])
    252269
    253270# _LT_PROG_LTMAIN
     
    409426# must have a single quote delimited value for this to work.
    410427m4_define([_LT_CONFIG_STATUS_DECLARE],
    411 [$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
     428[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
    412429
    413430
     
    419436# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
    420437#
    421 #    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
     438#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
    422439m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
    423440[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
     
    518535compiler='$compiler_DEFAULT'
    519536
     537# A function that is used when there is no print builtin or printf.
     538func_fallback_echo ()
     539{
     540  eval 'cat <<_LTECHO_EOF
     541\$[]1
     542_LTECHO_EOF'
     543}
     544
    520545# Quote evaled strings.
    521546for var in lt_decl_all_varnames([[ \
    522547]], lt_decl_quote_varnames); do
    523     case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     548    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
    524549    *[[\\\\\\\`\\"\\\$]]*)
    525       eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
     550      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
    526551      ;;
    527552    *)
     
    534559for var in lt_decl_all_varnames([[ \
    535560]], lt_decl_dquote_varnames); do
    536     case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     561    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
    537562    *[[\\\\\\\`\\"\\\$]]*)
    538       eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
     563      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
    539564      ;;
    540565    *)
     
    544569done
    545570
    546 # Fix-up fallback echo if it was mangled by the above quoting rules.
    547 case \$lt_ECHO in
    548 *'\\\[$]0 --fallback-echo"')dnl "
    549   lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
    550   ;;
    551 esac
    552 
    553571_LT_OUTPUT_LIBTOOL_INIT
    554572])
    555573
     574# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
     575# ------------------------------------
     576# Generate a child script FILE with all initialization necessary to
     577# reuse the environment learned by the parent script, and make the
     578# file executable.  If COMMENT is supplied, it is inserted after the
     579# `#!' sequence but before initialization text begins.  After this
     580# macro, additional text can be appended to FILE to form the body of
     581# the child script.  The macro ends with non-zero status if the
     582# file could not be fully written (such as if the disk is full).
     583m4_ifdef([AS_INIT_GENERATED],
     584[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
     585[m4_defun([_LT_GENERATED_FILE_INIT],
     586[m4_require([AS_PREPARE])]dnl
     587[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
     588[lt_write_fail=0
     589cat >$1 <<_ASEOF || lt_write_fail=1
     590#! $SHELL
     591# Generated by $as_me.
     592$2
     593SHELL=\${CONFIG_SHELL-$SHELL}
     594export SHELL
     595_ASEOF
     596cat >>$1 <<\_ASEOF || lt_write_fail=1
     597AS_SHELL_SANITIZE
     598_AS_PREPARE
     599exec AS_MESSAGE_FD>&1
     600_ASEOF
     601test $lt_write_fail = 0 && chmod +x $1[]dnl
     602m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
    556603
    557604# LT_OUTPUT
     
    563610[: ${CONFIG_LT=./config.lt}
    564611AC_MSG_NOTICE([creating $CONFIG_LT])
    565 cat >"$CONFIG_LT" <<_LTEOF
    566 #! $SHELL
    567 # Generated by $as_me.
    568 # Run this file to recreate a libtool stub with the current configuration.
    569 
     612_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
     613[# Run this file to recreate a libtool stub with the current configuration.])
     614
     615cat >>"$CONFIG_LT" <<\_LTEOF
    570616lt_cl_silent=false
    571 SHELL=\${CONFIG_SHELL-$SHELL}
    572 _LTEOF
    573 
    574 cat >>"$CONFIG_LT" <<\_LTEOF
    575 AS_SHELL_SANITIZE
    576 _AS_PREPARE
    577 
    578 exec AS_MESSAGE_FD>&1
    579617exec AS_MESSAGE_LOG_FD>>config.log
    580618{
     
    602640configured by $[0], generated by m4_PACKAGE_STRING.
    603641
    604 Copyright (C) 2008 Free Software Foundation, Inc.
     642Copyright (C) 2011 Free Software Foundation, Inc.
    605643This config.lt script is free software; the Free Software Foundation
    606644gives unlimited permision to copy, distribute and modify it."
     
    647685# open by configure.  Here we exec the FD to /dev/null, effectively closing
    648686# config.log, so it can be properly (re)opened and appended to by config.lt.
    649 if test "$no_create" != yes; then
    650   lt_cl_success=:
    651   test "$silent" = yes &&
    652     lt_config_lt_args="$lt_config_lt_args --quiet"
    653   exec AS_MESSAGE_LOG_FD>/dev/null
    654   $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
    655   exec AS_MESSAGE_LOG_FD>>config.log
    656   $lt_cl_success || AS_EXIT(1)
    657 fi
     687lt_cl_success=:
     688test "$silent" = yes &&
     689  lt_config_lt_args="$lt_config_lt_args --quiet"
     690exec AS_MESSAGE_LOG_FD>/dev/null
     691$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
     692exec AS_MESSAGE_LOG_FD>>config.log
     693$lt_cl_success || AS_EXIT(1)
    658694])# LT_OUTPUT
    659695
     
    718754  # text mode, it properly converts lines to CR/LF.  This bash problem
    719755  # is reportedly fixed, but why not run on old versions too?
    720   sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
    721     || (rm -f "$cfgfile"; exit 1)
    722 
    723   _LT_PROG_XSI_SHELLFNS
    724 
    725   sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
    726     || (rm -f "$cfgfile"; exit 1)
    727 
    728   mv -f "$cfgfile" "$ofile" ||
     756  sed '$q' "$ltmain" >> "$cfgfile" \
     757     || (rm -f "$cfgfile"; exit 1)
     758
     759  _LT_PROG_REPLACE_SHELLFNS
     760
     761   mv -f "$cfgfile" "$ofile" ||
    729762    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
    730763  chmod +x "$ofile"
     
    771804  [C],                  [_LT_LANG(C)],
    772805  [C++],                [_LT_LANG(CXX)],
     806  [Go],                 [_LT_LANG(GO)],
    773807  [Java],               [_LT_LANG(GCJ)],
    774808  [Fortran 77],         [_LT_LANG(F77)],
     
    790824  _LT_LANG_$1_CONFIG($1)])dnl
    791825])# _LT_LANG
     826
     827
     828m4_ifndef([AC_PROG_GO], [
     829############################################################
     830# NOTE: This macro has been submitted for inclusion into   #
     831#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
     832#  a released version of Autoconf we should remove this    #
     833#  macro and use it instead.                               #
     834############################################################
     835m4_defun([AC_PROG_GO],
     836[AC_LANG_PUSH(Go)dnl
     837AC_ARG_VAR([GOC],     [Go compiler command])dnl
     838AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
     839_AC_ARG_VAR_LDFLAGS()dnl
     840AC_CHECK_TOOL(GOC, gccgo)
     841if test -z "$GOC"; then
     842  if test -n "$ac_tool_prefix"; then
     843    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
     844  fi
     845fi
     846if test -z "$GOC"; then
     847  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
     848fi
     849])#m4_defun
     850])#m4_ifndef
    792851
    793852
     
    822881        [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
    823882
     883AC_PROVIDE_IFELSE([AC_PROG_GO],
     884  [LT_LANG(GO)],
     885  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
     886
    824887AC_PROVIDE_IFELSE([LT_PROG_RC],
    825888  [LT_LANG(RC)],
     
    832895AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
    833896AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
     897AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
    834898dnl aclocal-1.4 backwards compatibility:
    835899dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
     
    837901dnl AC_DEFUN([AC_LIBTOOL_FC], [])
    838902dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
     903dnl AC_DEFUN([AC_LIBTOOL_RC], [])
    839904
    840905
     
    922987          -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
    923988        _lt_result=$?
    924         if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
     989        # If there is a non-empty error log, and "single_module"
     990        # appears in it, assume the flag caused a linker warning
     991        if test -s conftest.err && $GREP single_module conftest.err; then
     992          cat conftest.err >&AS_MESSAGE_LOG_FD
     993        # Otherwise, if the output was created with a 0 exit code from
     994        # the compiler, it worked.
     995        elif test -f libconftest.dylib && test $_lt_result -eq 0; then
    925996          lt_cv_apple_cc_single_mod=yes
    926997        else
     
    9301001        rm -f conftest.*
    9311002      fi])
     1003
    9321004    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
    9331005      [lt_cv_ld_exported_symbols_list],
     
    9401012        [lt_cv_ld_exported_symbols_list=no])
    9411013        LDFLAGS="$save_LDFLAGS"
     1014    ])
     1015
     1016    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
     1017      [lt_cv_ld_force_load=no
     1018      cat > conftest.c << _LT_EOF
     1019int forced_loaded() { return 2;}
     1020_LT_EOF
     1021      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
     1022      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
     1023      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
     1024      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
     1025      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
     1026      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
     1027      cat > conftest.c << _LT_EOF
     1028int main() { return 0;}
     1029_LT_EOF
     1030      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
     1031      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
     1032      _lt_result=$?
     1033      if test -s conftest.err && $GREP force_load conftest.err; then
     1034        cat conftest.err >&AS_MESSAGE_LOG_FD
     1035      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
     1036        lt_cv_ld_force_load=yes
     1037      else
     1038        cat conftest.err >&AS_MESSAGE_LOG_FD
     1039      fi
     1040        rm -f conftest.err libconftest.a conftest conftest.c
     1041        rm -rf conftest.dSYM
    9421042    ])
    9431043    case $host_os in
     
    9681068      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
    9691069    fi
    970     if test "$DSYMUTIL" != ":"; then
     1070    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
    9711071      _lt_dsymutil='~$DSYMUTIL $lib || :'
    9721072    else
     
    9781078
    9791079
    980 # _LT_DARWIN_LINKER_FEATURES
    981 # --------------------------
     1080# _LT_DARWIN_LINKER_FEATURES([TAG])
     1081# ---------------------------------
    9821082# Checks for linker and compiler features on darwin
    9831083m4_defun([_LT_DARWIN_LINKER_FEATURES],
     
    9881088  _LT_TAGVAR(hardcode_automatic, $1)=yes
    9891089  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
    990   _LT_TAGVAR(whole_archive_flag_spec, $1)=''
     1090  if test "$lt_cv_ld_force_load" = "yes"; then
     1091    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
     1092    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
     1093                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
     1094  else
     1095    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
     1096  fi
    9911097  _LT_TAGVAR(link_all_deplibs, $1)=yes
    9921098  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
     
    9961102  esac
    9971103  if test "$_lt_dar_can_shared" = "yes"; then
    998     output_verbose_link_cmd=echo
     1104    output_verbose_link_cmd=func_echo_all
    9991105    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
    10001106    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     
    10121118])
    10131119
    1014 # _LT_SYS_MODULE_PATH_AIX
    1015 # -----------------------
     1120# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
     1121# ----------------------------------
    10161122# Links a minimal program and checks the executable
    10171123# for the system default hardcoded library path. In most cases,
     
    10201126# If we don't find anything, use the default library path according
    10211127# to the aix ld manual.
     1128# Store the results from the different compilers for each TAGNAME.
     1129# Allow to override them for all tags through lt_cv_aix_libpath.
    10221130m4_defun([_LT_SYS_MODULE_PATH_AIX],
    10231131[m4_require([_LT_DECL_SED])dnl
    1024 AC_LINK_IFELSE(AC_LANG_PROGRAM,[
    1025 lt_aix_libpath_sed='
    1026     /Import File Strings/,/^$/ {
    1027         /^0/ {
    1028             s/^0  *\(.*\)$/\1/
    1029             p
    1030         }
    1031     }'
    1032 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
    1033 # Check for a 64-bit object if we didn't find anything.
    1034 if test -z "$aix_libpath"; then
    1035   aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
    1036 fi],[])
    1037 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
     1132if test "${lt_cv_aix_libpath+set}" = set; then
     1133  aix_libpath=$lt_cv_aix_libpath
     1134else
     1135  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
     1136  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
     1137  lt_aix_libpath_sed='[
     1138      /Import File Strings/,/^$/ {
     1139          /^0/ {
     1140              s/^0  *\([^ ]*\) *$/\1/
     1141              p
     1142          }
     1143      }]'
     1144  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
     1145  # Check for a 64-bit object if we didn't find anything.
     1146  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
     1147    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
     1148  fi],[])
     1149  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
     1150    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
     1151  fi
     1152  ])
     1153  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
     1154fi
    10381155])# _LT_SYS_MODULE_PATH_AIX
    10391156
     
    10421159# -------------------
    10431160m4_define([_LT_SHELL_INIT],
    1044 [ifdef([AC_DIVERSION_NOTICE],
    1045              [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
    1046          [AC_DIVERT_PUSH(NOTICE)])
    1047 $1
    1048 AC_DIVERT_POP
    1049 ])# _LT_SHELL_INIT
     1161[m4_divert_text([M4SH-INIT], [$1
     1162])])# _LT_SHELL_INIT
     1163
    10501164
    10511165
    10521166# _LT_PROG_ECHO_BACKSLASH
    10531167# -----------------------
    1054 # Add some code to the start of the generated configure script which
    1055 # will find an echo command which doesn't interpret backslashes.
     1168# Find how we can fake an echo command that does not interpret backslash.
     1169# In particular, with Autoconf 2.60 or later we add some code to the start
     1170# of the generated configure script which will find a shell with a builtin
     1171# printf (which we can use as an echo command).
    10561172m4_defun([_LT_PROG_ECHO_BACKSLASH],
    1057 [_LT_SHELL_INIT([
    1058 # Check that we are running under the correct shell.
    1059 SHELL=${CONFIG_SHELL-/bin/sh}
    1060 
    1061 case X$lt_ECHO in
    1062 X*--fallback-echo)
    1063   # Remove one level of quotation (which was required for Make).
    1064   ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
    1065   ;;
     1173[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
     1174ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
     1175ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
     1176
     1177AC_MSG_CHECKING([how to print strings])
     1178# Test print first, because it will be a builtin if present.
     1179if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
     1180   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
     1181  ECHO='print -r --'
     1182elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
     1183  ECHO='printf %s\n'
     1184else
     1185  # Use this function as a fallback that always works.
     1186  func_fallback_echo ()
     1187  {
     1188    eval 'cat <<_LTECHO_EOF
     1189$[]1
     1190_LTECHO_EOF'
     1191  }
     1192  ECHO='func_fallback_echo'
     1193fi
     1194
     1195# func_echo_all arg...
     1196# Invoke $ECHO with all args, space-separated.
     1197func_echo_all ()
     1198{
     1199    $ECHO "$*"
     1200}
     1201
     1202case "$ECHO" in
     1203  printf*) AC_MSG_RESULT([printf]) ;;
     1204  print*) AC_MSG_RESULT([print -r]) ;;
     1205  *) AC_MSG_RESULT([cat]) ;;
    10661206esac
    10671207
    1068 ECHO=${lt_ECHO-echo}
    1069 if test "X[$]1" = X--no-reexec; then
    1070   # Discard the --no-reexec flag, and continue.
    1071   shift
    1072 elif test "X[$]1" = X--fallback-echo; then
    1073   # Avoid inline document here, it may be left over
    1074   :
    1075 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
    1076   # Yippee, $ECHO works!
    1077   :
    1078 else
    1079   # Restart under the correct shell.
    1080   exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
    1081 fi
    1082 
    1083 if test "X[$]1" = X--fallback-echo; then
    1084   # used as fallback echo
    1085   shift
    1086   cat <<_LT_EOF
    1087 [$]*
    1088 _LT_EOF
    1089   exit 0
    1090 fi
    1091 
    1092 # The HP-UX ksh and POSIX shell print the target directory to stdout
    1093 # if CDPATH is set.
    1094 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
    1095 
    1096 if test -z "$lt_ECHO"; then
    1097   if test "X${echo_test_string+set}" != Xset; then
    1098     # find a string as large as possible, as long as the shell can cope with it
    1099     for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
    1100       # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
    1101       if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
    1102          { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
    1103       then
    1104         break
    1105       fi
    1106     done
    1107   fi
    1108 
    1109   if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
    1110      echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
    1111      test "X$echo_testing_string" = "X$echo_test_string"; then
    1112     :
    1113   else
    1114     # The Solaris, AIX, and Digital Unix default echo programs unquote
    1115     # backslashes.  This makes it impossible to quote backslashes using
    1116     #   echo "$something" | sed 's/\\/\\\\/g'
    1117     #
    1118     # So, first we look for a working echo in the user's PATH.
    1119 
    1120     lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    1121     for dir in $PATH /usr/ucb; do
    1122       IFS="$lt_save_ifs"
    1123       if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
    1124          test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
    1125          echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
    1126          test "X$echo_testing_string" = "X$echo_test_string"; then
    1127         ECHO="$dir/echo"
    1128         break
    1129       fi
    1130     done
    1131     IFS="$lt_save_ifs"
    1132 
    1133     if test "X$ECHO" = Xecho; then
    1134       # We didn't find a better echo, so look for alternatives.
    1135       if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
    1136          echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
    1137          test "X$echo_testing_string" = "X$echo_test_string"; then
    1138         # This shell has a builtin print -r that does the trick.
    1139         ECHO='print -r'
    1140       elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
    1141            test "X$CONFIG_SHELL" != X/bin/ksh; then
    1142         # If we have ksh, try running configure again with it.
    1143         ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
    1144         export ORIGINAL_CONFIG_SHELL
    1145         CONFIG_SHELL=/bin/ksh
    1146         export CONFIG_SHELL
    1147         exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
    1148       else
    1149         # Try using printf.
    1150         ECHO='printf %s\n'
    1151         if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
    1152            echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
    1153            test "X$echo_testing_string" = "X$echo_test_string"; then
    1154           # Cool, printf works
    1155           :
    1156         elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
    1157              test "X$echo_testing_string" = 'X\t' &&
    1158              echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
    1159              test "X$echo_testing_string" = "X$echo_test_string"; then
    1160           CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
    1161           export CONFIG_SHELL
    1162           SHELL="$CONFIG_SHELL"
    1163           export SHELL
    1164           ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
    1165         elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
    1166              test "X$echo_testing_string" = 'X\t' &&
    1167              echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
    1168              test "X$echo_testing_string" = "X$echo_test_string"; then
    1169           ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
    1170         else
    1171           # maybe with a smaller string...
    1172           prev=:
    1173 
    1174           for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
    1175             if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
    1176             then
    1177               break
    1178             fi
    1179             prev="$cmd"
    1180           done
    1181 
    1182           if test "$prev" != 'sed 50q "[$]0"'; then
    1183             echo_test_string=`eval $prev`
    1184             export echo_test_string
    1185             exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
    1186           else
    1187             # Oops.  We lost completely, so just stick with echo.
    1188             ECHO=echo
    1189           fi
    1190         fi
    1191       fi
    1192     fi
    1193   fi
    1194 fi
    1195 
    1196 # Copy echo and quote the copy suitably for passing to libtool from
    1197 # the Makefile, instead of quoting the original, which is used later.
    1198 lt_ECHO=$ECHO
    1199 if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
    1200    lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
    1201 fi
    1202 
    1203 AC_SUBST(lt_ECHO)
    1204 ])
     1208m4_ifdef([_AS_DETECT_SUGGESTED],
     1209[_AS_DETECT_SUGGESTED([
     1210  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
     1211    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
     1212    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
     1213    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
     1214    PATH=/empty FPATH=/empty; export PATH FPATH
     1215    test "X`printf %s $ECHO`" = "X$ECHO" \
     1216      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
     1217
    12051218_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
    1206 _LT_DECL([], [ECHO], [1],
    1207     [An echo program that does not interpret backslashes])
     1219_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
    12081220])# _LT_PROG_ECHO_BACKSLASH
    12091221
     1222
     1223# _LT_WITH_SYSROOT
     1224# ----------------
     1225AC_DEFUN([_LT_WITH_SYSROOT],
     1226[AC_MSG_CHECKING([for sysroot])
     1227AC_ARG_WITH([sysroot],
     1228[  --with-sysroot[=DIR] Search for dependent libraries within DIR
     1229                        (or the compiler's sysroot if not specified).],
     1230[], [with_sysroot=no])
     1231
     1232dnl lt_sysroot will always be passed unquoted.  We quote it here
     1233dnl in case the user passed a directory name.
     1234lt_sysroot=
     1235case ${with_sysroot} in #(
     1236 yes)
     1237   if test "$GCC" = yes; then
     1238     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
     1239   fi
     1240   ;; #(
     1241 /*)
     1242   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
     1243   ;; #(
     1244 no|'')
     1245   ;; #(
     1246 *)
     1247   AC_MSG_RESULT([${with_sysroot}])
     1248   AC_MSG_ERROR([The sysroot must be an absolute path.])
     1249   ;;
     1250esac
     1251
     1252 AC_MSG_RESULT([${lt_sysroot:-no}])
     1253_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
     1254[dependent libraries, and in which our libraries should be installed.])])
    12101255
    12111256# _LT_ENABLE_LOCK
     
    12371282*-*-irix6*)
    12381283  # Find out which ABI we are using.
    1239   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
     1284  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
    12401285  if AC_TRY_EVAL(ac_compile); then
    12411286    if test "$lt_cv_prog_gnu_ld" = yes; then
     
    13301375  fi
    13311376  ;;
    1332 sparc*-*solaris*)
     1377*-*solaris*)
    13331378  # Find out which ABI we are using.
    13341379  echo 'int i;' > conftest.$ac_ext
     
    13371382    *64-bit*)
    13381383      case $lt_cv_prog_gnu_ld in
    1339       yes*) LD="${LD-ld} -m elf64_sparc" ;;
     1384      yes*)
     1385        case $host in
     1386        i?86-*-solaris*)
     1387          LD="${LD-ld} -m elf_x86_64"
     1388          ;;
     1389        sparc*-*-solaris*)
     1390          LD="${LD-ld} -m elf64_sparc"
     1391          ;;
     1392        esac
     1393        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
     1394        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
     1395          LD="${LD-ld}_sol2"
     1396        fi
     1397        ;;
    13401398      *)
    13411399        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
     
    13551413
    13561414
     1415# _LT_PROG_AR
     1416# -----------
     1417m4_defun([_LT_PROG_AR],
     1418[AC_CHECK_TOOLS(AR, [ar], false)
     1419: ${AR=ar}
     1420: ${AR_FLAGS=cru}
     1421_LT_DECL([], [AR], [1], [The archiver])
     1422_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
     1423
     1424AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
     1425  [lt_cv_ar_at_file=no
     1426   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
     1427     [echo conftest.$ac_objext > conftest.lst
     1428      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
     1429      AC_TRY_EVAL([lt_ar_try])
     1430      if test "$ac_status" -eq 0; then
     1431        # Ensure the archiver fails upon bogus file names.
     1432        rm -f conftest.$ac_objext libconftest.a
     1433        AC_TRY_EVAL([lt_ar_try])
     1434        if test "$ac_status" -ne 0; then
     1435          lt_cv_ar_at_file=@
     1436        fi
     1437      fi
     1438      rm -f conftest.* libconftest.a
     1439     ])
     1440  ])
     1441
     1442if test "x$lt_cv_ar_at_file" = xno; then
     1443  archiver_list_spec=
     1444else
     1445  archiver_list_spec=$lt_cv_ar_at_file
     1446fi
     1447_LT_DECL([], [archiver_list_spec], [1],
     1448  [How to feed a file listing to the archiver])
     1449])# _LT_PROG_AR
     1450
     1451
    13571452# _LT_CMD_OLD_ARCHIVE
    13581453# -------------------
    13591454m4_defun([_LT_CMD_OLD_ARCHIVE],
    1360 [AC_CHECK_TOOL(AR, ar, false)
    1361 test -z "$AR" && AR=ar
    1362 test -z "$AR_FLAGS" && AR_FLAGS=cru
    1363 _LT_DECL([], [AR], [1], [The archiver])
    1364 _LT_DECL([], [AR_FLAGS], [1])
     1455[_LT_PROG_AR
    13651456
    13661457AC_CHECK_TOOL(STRIP, strip, :)
     
    13811472  case $host_os in
    13821473  openbsd*)
    1383     old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
     1474    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
    13841475    ;;
    13851476  *)
    1386     old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
     1477    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
    13871478    ;;
    13881479  esac
    1389   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
     1480  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
    13901481fi
     1482
     1483case $host_os in
     1484  darwin*)
     1485    lock_old_archive_extraction=yes ;;
     1486  *)
     1487    lock_old_archive_extraction=no ;;
     1488esac
    13911489_LT_DECL([], [old_postinstall_cmds], [2])
    13921490_LT_DECL([], [old_postuninstall_cmds], [2])
    13931491_LT_TAGDECL([], [old_archive_cmds], [2],
    13941492    [Commands used to build an old-style archive])
     1493_LT_DECL([], [lock_old_archive_extraction], [0],
     1494    [Whether to use a lock for old archive extraction])
    13951495])# _LT_CMD_OLD_ARCHIVE
    13961496
     
    14171517   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    14181518   -e 's:$: $lt_compiler_flag:'`
    1419    (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
     1519   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    14201520   (eval "$lt_compile" 2>conftest.err)
    14211521   ac_status=$?
    14221522   cat conftest.err >&AS_MESSAGE_LOG_FD
    1423    echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
     1523   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    14241524   if (exit $ac_status) && test -s "$ac_outfile"; then
    14251525     # The compiler can only warn and ignore the option if not recognized
    14261526     # So say no if there are warnings other than the usual output.
    1427      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
     1527     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
    14281528     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
    14291529     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
     
    14651565       # Append any errors to the config.log.
    14661566       cat conftest.err 1>&AS_MESSAGE_LOG_FD
    1467        $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
     1567       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
    14681568       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
    14691569       if diff conftest.exp conftest.er2 >/dev/null; then
     
    15251625    # Instead, let's just punt: use the minimum linelength reported by
    15261626    # all of the supported platforms: 8192 (on NT/2K/XP).
     1627    lt_cv_sys_max_cmd_len=8192;
     1628    ;;
     1629
     1630  mint*)
     1631    # On MiNT this can take a long time and run out of memory.
    15271632    lt_cv_sys_max_cmd_len=8192;
    15281633    ;;
     
    15511656    # We know the value 262144 and hardcode it with a safety zone (like BSD)
    15521657    lt_cv_sys_max_cmd_len=196608
     1658    ;;
     1659
     1660  os2*)
     1661    # The test takes a long time on OS/2.
     1662    lt_cv_sys_max_cmd_len=8192
    15531663    ;;
    15541664
     
    15921702      # maximum length that is only half of the actual maximum length, but
    15931703      # we can't tell.
    1594       while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
    1595                  = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
     1704      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
     1705                 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
    15961706              test $i != 17 # 1/2 MB should be enough
    15971707      do
     
    16441754  lt_status=$lt_dlunknown
    16451755  cat > conftest.$ac_ext <<_LT_EOF
    1646 [#line __oline__ "configure"
     1756[#line $LINENO "configure"
    16471757#include "confdefs.h"
    16481758
     
    16851795#endif
    16861796
    1687 void fnord() { int i=42;}
     1797/* When -fvisbility=hidden is used, assume the code has been annotated
     1798   correspondingly for the symbols needed.  */
     1799#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
     1800int fnord () __attribute__((visibility("default")));
     1801#endif
     1802
     1803int fnord () { return 42; }
    16881804int main ()
    16891805{
     
    16941810    {
    16951811      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
    1696       else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
     1812      else
     1813        {
     1814          if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
     1815          else puts (dlerror ());
     1816        }
    16971817      /* dlclose (self); */
    16981818    }
     
    18701990   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    18711991   -e 's:$: $lt_compiler_flag:'`
    1872    (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
     1992   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    18731993   (eval "$lt_compile" 2>out/conftest.err)
    18741994   ac_status=$?
    18751995   cat out/conftest.err >&AS_MESSAGE_LOG_FD
    1876    echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
     1996   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    18771997   if (exit $ac_status) && test -s out/conftest2.$ac_objext
    18781998   then
    18791999     # The compiler can only warn and ignore the option if not recognized
    18802000     # So say no if there are warnings
    1881      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
     2001     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
    18822002     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
    18832003     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
     
    20382158m4_require([_LT_DECL_OBJDUMP])dnl
    20392159m4_require([_LT_DECL_SED])dnl
     2160m4_require([_LT_CHECK_SHELL_FEATURES])dnl
    20402161AC_MSG_CHECKING([dynamic linker characteristics])
    20412162m4_if([$1],
     
    20462167    *) lt_awk_arg="/^libraries:/" ;;
    20472168  esac
    2048   lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
    2049   if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
     2169  case $host_os in
     2170    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
     2171    *) lt_sed_strip_eq="s,=/,/,g" ;;
     2172  esac
     2173  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
     2174  case $lt_search_path_spec in
     2175  *\;*)
    20502176    # if the path contains ";" then we assume it to be the separator
    20512177    # otherwise default to the standard path separator (i.e. ":") - it is
    20522178    # assumed that no part of a normal pathname contains ";" but that should
    20532179    # okay in the real world where ";" in dirpaths is itself problematic.
    2054     lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
    2055   else
    2056     lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
    2057   fi
     2180    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
     2181    ;;
     2182  *)
     2183    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
     2184    ;;
     2185  esac
    20582186  # Ok, now we have the path, separated by spaces, we can step through it
    20592187  # and add multilib dir if necessary.
     
    20682196    fi
    20692197  done
    2070   lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
     2198  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
    20712199BEGIN {RS=" "; FS="/|\n";} {
    20722200  lt_foo="";
     
    20882216  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
    20892217}'`
    2090   sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
     2218  # AWK program above erroneously prepends '/' to C:/dos/paths
     2219  # for these hosts.
     2220  case $host_os in
     2221    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
     2222      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
     2223  esac
     2224  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
    20912225else
    20922226  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
     
    21142248case $host_os in
    21152249aix3*)
    2116   version_type=linux
     2250  version_type=linux # correct to gnu/linux during the next big refactor
    21172251  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
    21182252  shlibpath_var=LIBPATH
     
    21232257
    21242258aix[[4-9]]*)
    2125   version_type=linux
     2259  version_type=linux # correct to gnu/linux during the next big refactor
    21262260  need_lib_prefix=no
    21272261  need_version=no
     
    21762310    library_names_spec='$libname.ixlibrary $libname.a'
    21772311    # Create ${libname}_ixlibrary.a entries in /sys/libs.
    2178     finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     2312    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
    21792313    ;;
    21802314  esac
     
    21882322
    21892323bsdi[[45]]*)
    2190   version_type=linux
     2324  version_type=linux # correct to gnu/linux during the next big refactor
    21912325  need_version=no
    21922326  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
     
    22072341  need_lib_prefix=no
    22082342
    2209   case $GCC,$host_os in
    2210   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     2343  case $GCC,$cc_basename in
     2344  yes,*)
     2345    # gcc
    22112346    library_names_spec='$libname.dll.a'
    22122347    # DLL is installed to $(libdir)/../bin by postinstall_cmds
     
    22292364      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
    22302365      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
    2231       sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
     2366m4_if([$1], [],[
     2367      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
    22322368      ;;
    22332369    mingw* | cegcc*)
    22342370      # MinGW DLLs use traditional 'lib' prefix
    22352371      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
    2236       sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
    2237       if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
    2238         # It is most probably a Windows format PATH printed by
    2239         # mingw gcc, but we are running on Cygwin. Gcc prints its search
    2240         # path with ; separators, and with drive letters. We can handle the
    2241         # drive letters (cygwin fileutils understands them), so leave them,
    2242         # especially as we might pass files found there to a mingw objdump,
    2243         # which wouldn't understand a cygwinified path. Ahh.
    2244         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
    2245       else
    2246         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
    2247       fi
    22482372      ;;
    22492373    pw32*)
     
    22522376      ;;
    22532377    esac
     2378    dynamic_linker='Win32 ld.exe'
    22542379    ;;
    22552380
     2381  *,cl*)
     2382    # Native MSVC
     2383    libname_spec='$name'
     2384    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
     2385    library_names_spec='${libname}.dll.lib'
     2386
     2387    case $build_os in
     2388    mingw*)
     2389      sys_lib_search_path_spec=
     2390      lt_save_ifs=$IFS
     2391      IFS=';'
     2392      for lt_path in $LIB
     2393      do
     2394        IFS=$lt_save_ifs
     2395        # Let DOS variable expansion print the short 8.3 style file name.
     2396        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
     2397        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
     2398      done
     2399      IFS=$lt_save_ifs
     2400      # Convert to MSYS style.
     2401      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
     2402      ;;
     2403    cygwin*)
     2404      # Convert to unix form, then to dos form, then back to unix form
     2405      # but this time dos style (no spaces!) so that the unix form looks
     2406      # like /cygdrive/c/PROGRA~1:/cygdr...
     2407      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
     2408      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
     2409      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
     2410      ;;
     2411    *)
     2412      sys_lib_search_path_spec="$LIB"
     2413      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
     2414        # It is most probably a Windows format PATH.
     2415        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
     2416      else
     2417        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
     2418      fi
     2419      # FIXME: find the short name or the path components, as spaces are
     2420      # common. (e.g. "Program Files" -> "PROGRA~1")
     2421      ;;
     2422    esac
     2423
     2424    # DLL is installed to $(libdir)/../bin by postinstall_cmds
     2425    postinstall_cmds='base_file=`basename \${file}`~
     2426      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
     2427      dldir=$destdir/`dirname \$dlpath`~
     2428      test -d \$dldir || mkdir -p \$dldir~
     2429      $install_prog $dir/$dlname \$dldir/$dlname'
     2430    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
     2431      dlpath=$dir/\$dldll~
     2432       $RM \$dlpath'
     2433    shlibpath_overrides_runpath=yes
     2434    dynamic_linker='Win32 link.exe'
     2435    ;;
     2436
    22562437  *)
     2438    # Assume MSVC wrapper
    22572439    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
     2440    dynamic_linker='Win32 ld.exe'
    22582441    ;;
    22592442  esac
    2260   dynamic_linker='Win32 ld.exe'
    22612443  # FIXME: first we should search . and the directory the executable is in
    22622444  shlibpath_var=PATH
     
    22792461
    22802462dgux*)
    2281   version_type=linux
     2463  version_type=linux # correct to gnu/linux during the next big refactor
    22822464  need_lib_prefix=no
    22832465  need_version=no
     
    22852467  soname_spec='${libname}${release}${shared_ext}$major'
    22862468  shlibpath_var=LD_LIBRARY_PATH
    2287   ;;
    2288 
    2289 freebsd1*)
    2290   dynamic_linker=no
    22912469  ;;
    22922470
     
    22982476  else
    22992477    case $host_os in
    2300     freebsd[[123]]*) objformat=aout ;;
     2478    freebsd[[23]].*) objformat=aout ;;
    23012479    *) objformat=elf ;;
    23022480    esac
     
    23162494  shlibpath_var=LD_LIBRARY_PATH
    23172495  case $host_os in
    2318   freebsd2*)
     2496  freebsd2.*)
    23192497    shlibpath_overrides_runpath=yes
    23202498    ;;
     
    23362514
    23372515gnu*)
    2338   version_type=linux
     2516  version_type=linux # correct to gnu/linux during the next big refactor
    23392517  need_lib_prefix=no
    23402518  need_version=no
     
    23422520  soname_spec='${libname}${release}${shared_ext}$major'
    23432521  shlibpath_var=LD_LIBRARY_PATH
     2522  shlibpath_overrides_runpath=no
     2523  hardcode_into_libs=yes
     2524  ;;
     2525
     2526haiku*)
     2527  version_type=linux # correct to gnu/linux during the next big refactor
     2528  need_lib_prefix=no
     2529  need_version=no
     2530  dynamic_linker="$host_os runtime_loader"
     2531  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
     2532  soname_spec='${libname}${release}${shared_ext}$major'
     2533  shlibpath_var=LIBRARY_PATH
     2534  shlibpath_overrides_runpath=yes
     2535  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
    23442536  hardcode_into_libs=yes
    23452537  ;;
     
    23872579    ;;
    23882580  esac
    2389   # HP-UX runs *really* slowly unless shared libraries are mode 555.
     2581  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
    23902582  postinstall_cmds='chmod 555 $lib'
     2583  # or fails outright, so override atomically:
     2584  install_override_mode=555
    23912585  ;;
    23922586
    23932587interix[[3-9]]*)
    2394   version_type=linux
     2588  version_type=linux # correct to gnu/linux during the next big refactor
    23952589  need_lib_prefix=no
    23962590  need_version=no
     
    24082602    *)
    24092603        if test "$lt_cv_prog_gnu_ld" = yes; then
    2410                 version_type=linux
     2604                version_type=linux # correct to gnu/linux during the next big refactor
    24112605        else
    24122606                version_type=irix
     
    24452639  ;;
    24462640
    2447 # This must be Linux ELF.
    2448 linux* | k*bsd*-gnu)
    2449   version_type=linux
     2641# This must be glibc/ELF.
     2642linux* | k*bsd*-gnu | kopensolaris*-gnu)
     2643  version_type=linux # correct to gnu/linux during the next big refactor
    24502644  need_lib_prefix=no
    24512645  need_version=no
     
    24552649  shlibpath_var=LD_LIBRARY_PATH
    24562650  shlibpath_overrides_runpath=no
     2651
    24572652  # Some binutils ld are patched to set DT_RUNPATH
    2458   save_LDFLAGS=$LDFLAGS
    2459   save_libdir=$libdir
    2460   eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
    2461        LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
    2462   AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
    2463     [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
    2464        [shlibpath_overrides_runpath=yes])])
    2465   LDFLAGS=$save_LDFLAGS
    2466   libdir=$save_libdir
     2653  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
     2654    [lt_cv_shlibpath_overrides_runpath=no
     2655    save_LDFLAGS=$LDFLAGS
     2656    save_libdir=$libdir
     2657    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
     2658         LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
     2659    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
     2660      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
     2661         [lt_cv_shlibpath_overrides_runpath=yes])])
     2662    LDFLAGS=$save_LDFLAGS
     2663    libdir=$save_libdir
     2664    ])
     2665  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
    24672666
    24682667  # This implies no fast_install, which is unacceptable.
     
    24732672  # Append ld.so.conf contents to the search path
    24742673  if test -f /etc/ld.so.conf; then
    2475     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[   ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     2674    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[   ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
    24762675    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
    24772676  fi
     
    25052704
    25062705newsos6)
    2507   version_type=linux
     2706  version_type=linux # correct to gnu/linux during the next big refactor
    25082707  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
    25092708  shlibpath_var=LD_LIBRARY_PATH
     
    25742773
    25752774solaris*)
    2576   version_type=linux
     2775  version_type=linux # correct to gnu/linux during the next big refactor
    25772776  need_lib_prefix=no
    25782777  need_version=no
     
    25992798
    26002799sysv4 | sysv4.3*)
    2601   version_type=linux
     2800  version_type=linux # correct to gnu/linux during the next big refactor
    26022801  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
    26032802  soname_spec='${libname}${release}${shared_ext}$major'
     
    26232822sysv4*MP*)
    26242823  if test -d /usr/nec ;then
    2625     version_type=linux
     2824    version_type=linux # correct to gnu/linux during the next big refactor
    26262825    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
    26272826    soname_spec='$libname${shared_ext}.$major'
     
    26542853tpf*)
    26552854  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
    2656   version_type=linux
     2855  version_type=linux # correct to gnu/linux during the next big refactor
    26572856  need_lib_prefix=no
    26582857  need_version=no
     
    26642863
    26652864uts4*)
    2666   version_type=linux
     2865  version_type=linux # correct to gnu/linux during the next big refactor
    26672866  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
    26682867  soname_spec='${libname}${release}${shared_ext}$major'
     
    27062905_LT_DECL([], [soname_spec], [1],
    27072906    [[The coded name of the library, if different from the real name]])
     2907_LT_DECL([], [install_override_mode], [1],
     2908    [Permission mode override for installation of shared libraries])
    27082909_LT_DECL([], [postinstall_cmds], [2],
    27092910    [Command to use after installation of a shared archive])
     
    28183019m4_require([_LT_DECL_SED])dnl
    28193020m4_require([_LT_DECL_EGREP])dnl
     3021m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
    28203022
    28213023AC_ARG_WITH([gnu-ld],
     
    29393141reload_cmds='$LD$reload_flag -o $output$reload_objs'
    29403142case $host_os in
     3143  cygwin* | mingw* | pw32* | cegcc*)
     3144    if test "$GCC" != yes; then
     3145      reload_cmds=false
     3146    fi
     3147    ;;
    29413148  darwin*)
    29423149    if test "$GCC" = yes; then
     
    29473154    ;;
    29483155esac
    2949 _LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
    2950 _LT_DECL([], [reload_cmds], [2])dnl
     3156_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
     3157_LT_TAGDECL([], [reload_cmds], [2])dnl
    29513158])# _LT_CMD_RELOAD
    29523159
     
    30003207  # func_win32_libid shell function, so use a weaker test based on 'objdump',
    30013208  # unless we find 'file', for example because we are cross-compiling.
    3002   if ( file / ) >/dev/null 2>&1; then
     3209  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
     3210  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
    30033211    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
    30043212    lt_cv_file_magic_cmd='func_win32_libid'
    30053213  else
    3006     lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
     3214    # Keep this pattern in sync with the one in func_win32_libid.
     3215    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
    30073216    lt_cv_file_magic_cmd='$OBJDUMP -f'
    30083217  fi
    30093218  ;;
    30103219
    3011 cegcc)
     3220cegcc*)
    30123221  # use the weaker test based on 'objdump'. See mingw*.
    30133222  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
     
    30393248  ;;
    30403249
     3250haiku*)
     3251  lt_cv_deplibs_check_method=pass_all
     3252  ;;
     3253
    30413254hpux10.20* | hpux11*)
    30423255  lt_cv_file_magic_cmd=/usr/bin/file
     
    30473260    ;;
    30483261  hppa*64*)
    3049     [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
     3262    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
    30503263    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
    30513264    ;;
    30523265  *)
    3053     lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
     3266    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
    30543267    lt_cv_file_magic_test_file=/usr/lib/libc.sl
    30553268    ;;
     
    30723285  ;;
    30733286
    3074 # This must be Linux ELF.
    3075 linux* | k*bsd*-gnu)
     3287# This must be glibc/ELF.
     3288linux* | k*bsd*-gnu | kopensolaris*-gnu)
    30763289  lt_cv_deplibs_check_method=pass_all
    30773290  ;;
     
    31513364esac
    31523365])
     3366
     3367file_magic_glob=
     3368want_nocaseglob=no
     3369if test "$build" = "$host"; then
     3370  case $host_os in
     3371  mingw* | pw32*)
     3372    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
     3373      want_nocaseglob=yes
     3374    else
     3375      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
     3376    fi
     3377    ;;
     3378  esac
     3379fi
     3380
    31533381file_magic_cmd=$lt_cv_file_magic_cmd
    31543382deplibs_check_method=$lt_cv_deplibs_check_method
     
    31583386    [Method to check whether dependent libraries are shared objects])
    31593387_LT_DECL([], [file_magic_cmd], [1],
    3160     [Command to use when deplibs_check_method == "file_magic"])
     3388    [Command to use when deplibs_check_method = "file_magic"])
     3389_LT_DECL([], [file_magic_glob], [1],
     3390    [How to find potential files when deplibs_check_method = "file_magic"])
     3391_LT_DECL([], [want_nocaseglob], [1],
     3392    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
    31613393])# _LT_CHECK_MAGIC_METHOD
    31623394
     
    32153447else
    32163448  # Didn't find any BSD compatible name lister, look for dumpbin.
    3217   AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
     3449  if test -n "$DUMPBIN"; then :
     3450    # Let the user override the test.
     3451  else
     3452    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
     3453    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
     3454    *COFF*)
     3455      DUMPBIN="$DUMPBIN -symbols"
     3456      ;;
     3457    *)
     3458      DUMPBIN=:
     3459      ;;
     3460    esac
     3461  fi
    32183462  AC_SUBST([DUMPBIN])
    32193463  if test "$DUMPBIN" != ":"; then
     
    32283472  [lt_cv_nm_interface="BSD nm"
    32293473  echo "int some_variable = 0;" > conftest.$ac_ext
    3230   (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
     3474  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
    32313475  (eval "$ac_compile" 2>conftest.err)
    32323476  cat conftest.err >&AS_MESSAGE_LOG_FD
    3233   (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
     3477  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
    32343478  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
    32353479  cat conftest.err >&AS_MESSAGE_LOG_FD
    3236   (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
     3480  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
    32373481  cat conftest.out >&AS_MESSAGE_LOG_FD
    32383482  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     
    32483492dnl AC_DEFUN([AM_PROG_NM], [])
    32493493dnl AC_DEFUN([AC_PROG_NM], [])
     3494
     3495# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
     3496# --------------------------------
     3497# how to determine the name of the shared library
     3498# associated with a specific link library.
     3499#  -- PORTME fill in with the dynamic library characteristics
     3500m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
     3501[m4_require([_LT_DECL_EGREP])
     3502m4_require([_LT_DECL_OBJDUMP])
     3503m4_require([_LT_DECL_DLLTOOL])
     3504AC_CACHE_CHECK([how to associate runtime and link libraries],
     3505lt_cv_sharedlib_from_linklib_cmd,
     3506[lt_cv_sharedlib_from_linklib_cmd='unknown'
     3507
     3508case $host_os in
     3509cygwin* | mingw* | pw32* | cegcc*)
     3510  # two different shell functions defined in ltmain.sh
     3511  # decide which to use based on capabilities of $DLLTOOL
     3512  case `$DLLTOOL --help 2>&1` in
     3513  *--identify-strict*)
     3514    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
     3515    ;;
     3516  *)
     3517    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
     3518    ;;
     3519  esac
     3520  ;;
     3521*)
     3522  # fallback: assume linklib IS sharedlib
     3523  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
     3524  ;;
     3525esac
     3526])
     3527sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
     3528test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
     3529
     3530_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
     3531    [Command to associate shared and link libraries])
     3532])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
     3533
     3534
     3535# _LT_PATH_MANIFEST_TOOL
     3536# ----------------------
     3537# locate the manifest tool
     3538m4_defun([_LT_PATH_MANIFEST_TOOL],
     3539[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
     3540test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
     3541AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
     3542  [lt_cv_path_mainfest_tool=no
     3543  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
     3544  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
     3545  cat conftest.err >&AS_MESSAGE_LOG_FD
     3546  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
     3547    lt_cv_path_mainfest_tool=yes
     3548  fi
     3549  rm -f conftest*])
     3550if test "x$lt_cv_path_mainfest_tool" != xyes; then
     3551  MANIFEST_TOOL=:
     3552fi
     3553_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
     3554])# _LT_PATH_MANIFEST_TOOL
    32503555
    32513556
     
    32573562LIBM=
    32583563case $host in
    3259 *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
     3564*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
    32603565  # These system don't have libm, or don't need it
    32613566  ;;
     
    32853590
    32863591if test "$GCC" = yes; then
    3287   _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
     3592  case $cc_basename in
     3593  nvcc*)
     3594    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
     3595  *)
     3596    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
     3597  esac
    32883598
    32893599  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
     
    33023612[AC_REQUIRE([AC_CANONICAL_HOST])dnl
    33033613AC_REQUIRE([AC_PROG_CC])dnl
     3614AC_REQUIRE([AC_PROG_AWK])dnl
    33043615AC_REQUIRE([LT_PATH_NM])dnl
    33053616AC_REQUIRE([LT_PATH_LD])dnl
     
    33693680
    33703681# Transform an extracted symbol line into symbol name and symbol address
    3371 lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
    3372 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
     3682lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
     3683lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
    33733684
    33743685# Handle CRLF in mingw tool chain
     
    33943705    lt_cv_sys_global_symbol_pipe="$AWK ['"\
    33953706"     {last_section=section; section=\$ 3};"\
     3707"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
    33963708"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
    33973709"     \$ 0!~/External *\|/{next};"\
     
    34063718    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[     ]]\($symcode$symcode*\)[[       ]][[    ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
    34073719  fi
     3720  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
    34083721
    34093722  # Check to see that the pipe works correctly.
     
    34273740    # Now try to grab the symbols.
    34283741    nlist=conftest.nm
    3429     if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
     3742    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
    34303743      # Try sorting and uniquifying the output.
    34313744      if sort "$nlist" | uniq > "$nlist"T; then
     
    34393752        if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
    34403753          cat <<_LT_EOF > conftest.$ac_ext
     3754/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
     3755#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
     3756/* DATA imports from DLLs on WIN32 con't be const, because runtime
     3757   relocations are performed -- see ld's documentation on pseudo-relocs.  */
     3758# define LT@&t@_DLSYM_CONST
     3759#elif defined(__osf__)
     3760/* This system does not cope well with relocations in const data.  */
     3761# define LT@&t@_DLSYM_CONST
     3762#else
     3763# define LT@&t@_DLSYM_CONST const
     3764#endif
     3765
    34413766#ifdef __cplusplus
    34423767extern "C" {
     
    34503775
    34513776/* The mapping between symbol names and symbols.  */
    3452 const struct {
     3777LT@&t@_DLSYM_CONST struct {
    34533778  const char *name;
    34543779  void       *address;
     
    34763801          # Now try linking the two files.
    34773802          mv conftest.$ac_objext conftstm.$ac_objext
    3478           lt_save_LIBS="$LIBS"
    3479           lt_save_CFLAGS="$CFLAGS"
     3803          lt_globsym_save_LIBS=$LIBS
     3804          lt_globsym_save_CFLAGS=$CFLAGS
    34803805          LIBS="conftstm.$ac_objext"
    34813806          CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
     
    34833808            pipe_works=yes
    34843809          fi
    3485           LIBS="$lt_save_LIBS"
    3486           CFLAGS="$lt_save_CFLAGS"
     3810          LIBS=$lt_globsym_save_LIBS
     3811          CFLAGS=$lt_globsym_save_CFLAGS
    34873812        else
    34883813          echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
     
    35173842fi
    35183843
     3844# Response file support.
     3845if test "$lt_cv_nm_interface" = "MS dumpbin"; then
     3846  nm_file_list_spec='@'
     3847elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
     3848  nm_file_list_spec='@'
     3849fi
     3850
    35193851_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
    35203852    [Take the output of nm and produce a listing of raw symbols and C names])
     
    35273859    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
    35283860    [Transform the output of nm in a C name address pair when lib prefix is needed])
     3861_LT_DECL([], [nm_file_list_spec], [1],
     3862    [Specify filename containing input files for $NM])
    35293863]) # _LT_CMD_GLOBAL_SYMBOLS
    35303864
     
    35383872_LT_TAGVAR(lt_prog_compiler_static, $1)=
    35393873
    3540 AC_MSG_CHECKING([for $compiler option to produce PIC])
    35413874m4_if([$1], [CXX], [
    35423875  # C++ specific cases for pic, static, wl, etc.
     
    35883921      # DJGPP does not support shared libraries at all
    35893922      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
     3923      ;;
     3924    haiku*)
     3925      # PIC is the default for Haiku.
     3926      # The "-static" flag exists, but is broken.
     3927      _LT_TAGVAR(lt_prog_compiler_static, $1)=
    35903928      ;;
    35913929    interix[[3-9]]*)
     
    36373975          ;;
    36383976        esac
     3977        ;;
     3978      mingw* | cygwin* | os2* | pw32* | cegcc*)
     3979        # This hack is so that the source file can tell whether it is being
     3980        # built for inclusion in a dll (and should export symbols for example).
     3981        m4_if([$1], [GCJ], [],
     3982          [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
    36393983        ;;
    36403984      dgux*)
     
    36944038        esac
    36954039        ;;
    3696       linux* | k*bsd*-gnu)
     4040      linux* | k*bsd*-gnu | kopensolaris*-gnu)
    36974041        case $cc_basename in
    36984042          KCC*)
     
    37274071            _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
    37284072            ;;
    3729           xlc* | xlC*)
    3730             # IBM XL 8.0 on PPC
     4073          xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
     4074            # IBM XL 8.0, 9.0 on PPC and BlueGene
    37314075            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
    37324076            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
     
    37904134      solaris*)
    37914135        case $cc_basename in
    3792           CC*)
     4136          CC* | sunCC*)
    37934137            # Sun C++ 4.2, 5.x and Centerline C++
    37944138            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
     
    38944238      ;;
    38954239
     4240    haiku*)
     4241      # PIC is the default for Haiku.
     4242      # The "-static" flag exists, but is broken.
     4243      _LT_TAGVAR(lt_prog_compiler_static, $1)=
     4244      ;;
     4245
    38964246    hpux*)
    38974247      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
     
    39344284    *)
    39354285      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
     4286      ;;
     4287    esac
     4288
     4289    case $cc_basename in
     4290    nvcc*) # Cuda Compiler Driver 2.2
     4291      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
     4292      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
     4293        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
     4294      fi
    39364295      ;;
    39374296    esac
     
    39784337      ;;
    39794338
    3980     linux* | k*bsd*-gnu)
     4339    linux* | k*bsd*-gnu | kopensolaris*-gnu)
    39814340      case $cc_basename in
    39824341      # old Intel for x86_64 which still supported -KPIC.
     
    39994358        _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
    40004359        ;;
    4001       pgcc* | pgf77* | pgf90* | pgf95*)
     4360      nagfor*)
     4361        # NAG Fortran compiler
     4362        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
     4363        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
     4364        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
     4365        ;;
     4366      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
    40024367        # Portland Group compilers (*not* the Pentium gcc compiler,
    40034368        # which looks to be a dead project)
     
    40114376        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
    40124377        ;;
    4013       xl*)
    4014         # IBM XL C 8.0/Fortran 10.1 on PPC
     4378      xl* | bgxl* | bgf* | mpixl*)
     4379        # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
    40154380        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
    40164381        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
     
    40194384      *)
    40204385        case `$CC -V 2>&1 | sed 5q` in
     4386        *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
     4387          # Sun Fortran 8.3 passes all unrecognized flags to the linker
     4388          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
     4389          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
     4390          _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
     4391          ;;
     4392        *Sun\ F* | *Sun*Fortran*)
     4393          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
     4394          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
     4395          _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
     4396          ;;
    40214397        *Sun\ C*)
    40224398          # Sun C 5.9
     
    40254401          _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
    40264402          ;;
    4027         *Sun\ F*)
    4028           # Sun Fortran 8.3 passes all unrecognized flags to the linker
    4029           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
     4403        *Intel*\ [[CF]]*Compiler*)
     4404          _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
     4405          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
     4406          _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
     4407          ;;
     4408        *Portland\ Group*)
     4409          _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
     4410          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
    40304411          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
    4031           _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
    40324412          ;;
    40334413        esac
     
    40614441      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
    40624442      case $cc_basename in
    4063       f77* | f90* | f95*)
     4443      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
    40644444        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
    40654445      *)
     
    41184498    ;;
    41194499esac
    4120 AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
    4121 _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
    4122         [How to pass a linker flag through the compiler])
     4500
     4501AC_CACHE_CHECK([for $compiler option to produce PIC],
     4502  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
     4503  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
     4504_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
    41234505
    41244506#
     
    41394521        [Additional compiler flags for building library objects])
    41404522
     4523_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
     4524        [How to pass a linker flag through the compiler])
    41414525#
    41424526# Check to make sure the static flag actually works.
     
    41594543[AC_REQUIRE([LT_PATH_LD])dnl
    41604544AC_REQUIRE([LT_PATH_NM])dnl
     4545m4_require([_LT_PATH_MANIFEST_TOOL])dnl
    41614546m4_require([_LT_FILEUTILS_DEFAULTS])dnl
    41624547m4_require([_LT_DECL_EGREP])dnl
     
    41674552m4_if([$1], [CXX], [
    41684553  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
     4554  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
    41694555  case $host_os in
    41704556  aix[[4-9]]*)
    41714557    # If we're using GNU nm, then we don't want the "-C" option.
    41724558    # -C means demangle to AIX nm, but means don't demangle with GNU nm
     4559    # Also, AIX nm treats weak defined symbols like other global defined
     4560    # symbols, whereas GNU nm marks them as "W".
    41734561    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
    4174       _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     4562      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
    41754563    else
    41764564      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     
    41794567  pw32*)
    41804568    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
    4181   ;;
     4569    ;;
    41824570  cygwin* | mingw* | cegcc*)
    4183     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
    4184   ;;
     4571    case $cc_basename in
     4572    cl*)
     4573      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
     4574      ;;
     4575    *)
     4576      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
     4577      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
     4578      ;;
     4579    esac
     4580    ;;
    41854581  *)
    41864582    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
    4187   ;;
     4583    ;;
    41884584  esac
    4189   _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
    41904585], [
    41914586  runpath_var=
     
    42024597  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
    42034598  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
    4204   _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
    42054599  _LT_TAGVAR(hardcode_libdir_separator, $1)=
    42064600  _LT_TAGVAR(hardcode_minus_L, $1)=no
     
    42504644
    42514645  _LT_TAGVAR(ld_shlibs, $1)=yes
     4646
     4647  # On some targets, GNU ld is compatible enough with the native linker
     4648  # that we're better off using the native interface for both.
     4649  lt_use_gnu_ld_interface=no
    42524650  if test "$with_gnu_ld" = yes; then
     4651    case $host_os in
     4652      aix*)
     4653        # The AIX port of GNU ld has always aspired to compatibility
     4654        # with the native linker.  However, as the warning in the GNU ld
     4655        # block says, versions before 2.19.5* couldn't really create working
     4656        # shared libraries, regardless of the interface used.
     4657        case `$LD -v 2>&1` in
     4658          *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
     4659          *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
     4660          *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
     4661          *)
     4662            lt_use_gnu_ld_interface=yes
     4663            ;;
     4664        esac
     4665        ;;
     4666      *)
     4667        lt_use_gnu_ld_interface=yes
     4668        ;;
     4669    esac
     4670  fi
     4671
     4672  if test "$lt_use_gnu_ld_interface" = yes; then
    42534673    # If archive_cmds runs LD, not CC, wlarc should be empty
    42544674    wlarc='${wl}'
     
    42684688    supports_anon_versioning=no
    42694689    case `$LD -v 2>&1` in
     4690      *GNU\ gold*) supports_anon_versioning=yes ;;
    42704691      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
    42714692      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
     
    42834704        cat <<_LT_EOF 1>&2
    42844705
    4285 *** Warning: the GNU linker, at least up to release 2.9.1, is reported
     4706*** Warning: the GNU linker, at least up to release 2.19, is reported
    42864707*** to be unable to reliably create shared libraries on AIX.
    42874708*** Therefore, libtool is disabling shared libraries support.  If you
    4288 *** really care for shared libraries, you may want to modify your PATH
    4289 *** so that a non-GNU linker is found, and then restart.
     4709*** really care for shared libraries, you may want to install binutils
     4710*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
     4711*** You will then need to restart the configuration process.
    42904712
    42914713_LT_EOF
     
    43234745      # as there is no search path for DLLs.
    43244746      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
     4747      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
    43254748      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
    43264749      _LT_TAGVAR(always_export_symbols, $1)=no
    43274750      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
    4328       _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
     4751      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
     4752      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
    43294753
    43304754      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
     
    43444768      ;;
    43454769
     4770    haiku*)
     4771      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     4772      _LT_TAGVAR(link_all_deplibs, $1)=yes
     4773      ;;
     4774
    43464775    interix[[3-9]]*)
    43474776      _LT_TAGVAR(hardcode_direct, $1)=no
     
    43594788      ;;
    43604789
    4361     gnu* | linux* | tpf* | k*bsd*-gnu)
     4790    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
    43624791      tmp_diet=no
    43634792      if test "$host_os" = linux-dietlibc; then
     
    43694798         && test "$tmp_diet" = no
    43704799      then
    4371         tmp_addflag=
     4800        tmp_addflag=' $pic_flag'
    43724801        tmp_sharedflag='-shared'
    43734802        case $cc_basename,$host_cpu in
    43744803        pgcc*)                          # Portland Group C compiler
    4375           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
     4804          _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
    43764805          tmp_addflag=' $pic_flag'
    43774806          ;;
    4378         pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
    4379           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
     4807        pgf77* | pgf90* | pgf95* | pgfortran*)
     4808                                        # Portland Group f77 and f90 compilers
     4809          _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
    43804810          tmp_addflag=' $pic_flag -Mnomain' ;;
    43814811        ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
     
    43884818          _LT_TAGVAR(whole_archive_flag_spec, $1)=
    43894819          tmp_sharedflag='--shared' ;;
    4390         xl[[cC]]*)                      # IBM XL C 8.0 on PPC (deal with xlf below)
     4820        xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
    43914821          tmp_sharedflag='-qmkshrobj'
    43924822          tmp_addflag= ;;
     4823        nvcc*)  # Cuda Compiler Driver 2.2
     4824          _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
     4825          _LT_TAGVAR(compiler_needs_object, $1)=yes
     4826          ;;
    43934827        esac
    43944828        case `$CC -V 2>&1 | sed 5q` in
    43954829        *Sun\ C*)                       # Sun C 5.9
    4396           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
     4830          _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
    43974831          _LT_TAGVAR(compiler_needs_object, $1)=yes
    43984832          tmp_sharedflag='-G' ;;
     
    44104844
    44114845        case $cc_basename in
    4412         xlf*)
     4846        xlf* | bgf* | bgxlf* | mpixlf*)
    44134847          # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
    44144848          _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
    4415           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
    4416           _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
    4417           _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
     4849          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
     4850          _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
    44184851          if test "x$supports_anon_versioning" = xyes; then
    44194852            _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
    44204853              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
    44214854              echo "local: *; };" >> $output_objdir/$libname.ver~
    4422               $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
     4855              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
    44234856          fi
    44244857          ;;
     
    44344867        wlarc=
    44354868      else
    4436         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
    4437         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     4869        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     4870        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
    44384871      fi
    44394872      ;;
     
    44534886_LT_EOF
    44544887      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
    4455         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
    4456         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     4888        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     4889        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
    44574890      else
    44584891        _LT_TAGVAR(ld_shlibs, $1)=no
     
    45004933    *)
    45014934      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
    4502         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
    4503         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     4935        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     4936        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
    45044937      else
    45054938        _LT_TAGVAR(ld_shlibs, $1)=no
     
    45414974        # If we're using GNU nm, then we don't want the "-C" option.
    45424975        # -C means demangle to AIX nm, but means don't demangle with GNU nm
     4976        # Also, AIX nm treats weak defined symbols like other global
     4977        # defined symbols, whereas GNU nm marks them as "W".
    45434978        if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
    4544           _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     4979          _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
    45454980        else
    45464981          _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     
    46295064        # Determine the default libpath from the value encoded in an
    46305065        # empty executable.
    4631         _LT_SYS_MODULE_PATH_AIX
     5066        _LT_SYS_MODULE_PATH_AIX([$1])
    46325067        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
    4633         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
     5068        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
    46345069      else
    46355070        if test "$host_cpu" = ia64; then
     
    46405075         # Determine the default libpath from the value encoded in an
    46415076         # empty executable.
    4642          _LT_SYS_MODULE_PATH_AIX
     5077         _LT_SYS_MODULE_PATH_AIX([$1])
    46435078         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
    46445079          # Warning - without using the other run time loading flags,
     
    46465081          _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
    46475082          _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
    4648           # Exported symbols can be pulled into shared objects from archives
    4649           _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
     5083          if test "$with_gnu_ld" = yes; then
     5084            # We only use this code for GNU lds that support --whole-archive.
     5085            _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
     5086          else
     5087            # Exported symbols can be pulled into shared objects from archives
     5088            _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
     5089          fi
    46505090          _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
    46515091          # This is similar to how AIX traditionally builds its shared libraries.
     
    46795119      # hardcode_libdir_flag_spec is actually meaningless, as there is
    46805120      # no search path for DLLs.
    4681       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
    4682       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
    4683       # Tell ltmain to make .lib files, not .a files.
    4684       libext=lib
    4685       # Tell ltmain to make .dll files, not .so files.
    4686       shrext_cmds=".dll"
    4687       # FIXME: Setting linknames here is a bad hack.
    4688       _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
    4689       # The linker will automatically build a .lib file if we build a DLL.
    4690       _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
    4691       # FIXME: Should let the user specify the lib program.
    4692       _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
    4693       _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
    4694       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
     5121      case $cc_basename in
     5122      cl*)
     5123        # Native MSVC
     5124        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
     5125        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
     5126        _LT_TAGVAR(always_export_symbols, $1)=yes
     5127        _LT_TAGVAR(file_list_spec, $1)='@'
     5128        # Tell ltmain to make .lib files, not .a files.
     5129        libext=lib
     5130        # Tell ltmain to make .dll files, not .so files.
     5131        shrext_cmds=".dll"
     5132        # FIXME: Setting linknames here is a bad hack.
     5133        _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
     5134        _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
     5135            sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
     5136          else
     5137            sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
     5138          fi~
     5139          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
     5140          linknames='
     5141        # The linker will not automatically build a static lib if we build a DLL.
     5142        # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
     5143        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
     5144        _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
     5145        _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
     5146        # Don't use ranlib
     5147        _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
     5148        _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
     5149          lt_tool_outputfile="@TOOL_OUTPUT@"~
     5150          case $lt_outputfile in
     5151            *.exe|*.EXE) ;;
     5152            *)
     5153              lt_outputfile="$lt_outputfile.exe"
     5154              lt_tool_outputfile="$lt_tool_outputfile.exe"
     5155              ;;
     5156          esac~
     5157          if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
     5158            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
     5159            $RM "$lt_outputfile.manifest";
     5160          fi'
     5161        ;;
     5162      *)
     5163        # Assume MSVC wrapper
     5164        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
     5165        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
     5166        # Tell ltmain to make .lib files, not .a files.
     5167        libext=lib
     5168        # Tell ltmain to make .dll files, not .so files.
     5169        shrext_cmds=".dll"
     5170        # FIXME: Setting linknames here is a bad hack.
     5171        _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
     5172        # The linker will automatically build a .lib file if we build a DLL.
     5173        _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
     5174        # FIXME: Should let the user specify the lib program.
     5175        _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
     5176        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
     5177        ;;
     5178      esac
    46955179      ;;
    46965180
     
    47035187      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
    47045188      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
    4705       ;;
    4706 
    4707     freebsd1*)
    4708       _LT_TAGVAR(ld_shlibs, $1)=no
    47095189      ;;
    47105190
     
    47215201
    47225202    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
    4723     freebsd2*)
     5203    freebsd2.*)
    47245204      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
    47255205      _LT_TAGVAR(hardcode_direct, $1)=yes
     
    47305210    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
    47315211    freebsd* | dragonfly*)
    4732       _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
     5212      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
    47335213      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
    47345214      _LT_TAGVAR(hardcode_direct, $1)=yes
     
    47385218    hpux9*)
    47395219      if test "$GCC" = yes; then
    4740         _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
     5220        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
    47415221      else
    47425222        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
     
    47535233
    47545234    hpux10*)
    4755       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
    4756         _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
     5235      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
     5236        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
    47575237      else
    47585238        _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
     
    47605240      if test "$with_gnu_ld" = no; then
    47615241        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
    4762         _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
    47635242        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
    47645243        _LT_TAGVAR(hardcode_direct, $1)=yes
     
    47725251
    47735252    hpux11*)
    4774       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
     5253      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
    47755254        case $host_cpu in
    47765255        hppa*64*)
     
    47785257          ;;
    47795258        ia64*)
    4780           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
     5259          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
    47815260          ;;
    47825261        *)
    4783           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
     5262          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
    47845263          ;;
    47855264        esac
     
    47935272          ;;
    47945273        *)
    4795           _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
     5274        m4_if($1, [], [
     5275          # Older versions of the 11.00 compiler do not understand -b yet
     5276          # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
     5277          _LT_LINKER_OPTION([if $CC understands -b],
     5278            _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
     5279            [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
     5280            [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
     5281          [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
    47965282          ;;
    47975283        esac
     
    48215307    irix5* | irix6* | nonstopux*)
    48225308      if test "$GCC" = yes; then
    4823         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     5309        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
    48245310        # Try to use the -exported_symbol ld option, if it does not
    48255311        # work, assume that -exports_file does not work either and
    48265312        # implicitly export all symbols.
    4827         save_LDFLAGS="$LDFLAGS"
    4828         LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
    4829         AC_LINK_IFELSE(int foo(void) {},
    4830           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
    4831         )
    4832         LDFLAGS="$save_LDFLAGS"
     5313        # This should be the same for all languages, so no per-tag cache variable.
     5314        AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
     5315          [lt_cv_irix_exported_symbol],
     5316          [save_LDFLAGS="$LDFLAGS"
     5317           LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
     5318           AC_LINK_IFELSE(
     5319             [AC_LANG_SOURCE(
     5320                [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
     5321                              [C++], [[int foo (void) { return 0; }]],
     5322                              [Fortran 77], [[
     5323      subroutine foo
     5324      end]],
     5325                              [Fortran], [[
     5326      subroutine foo
     5327      end]])])],
     5328              [lt_cv_irix_exported_symbol=yes],
     5329              [lt_cv_irix_exported_symbol=no])
     5330           LDFLAGS="$save_LDFLAGS"])
     5331        if test "$lt_cv_irix_exported_symbol" = yes; then
     5332          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
     5333        fi
    48335334      else
    4834         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
    4835         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
     5335        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
     5336        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
    48365337      fi
    48375338      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
     
    48955396      _LT_TAGVAR(hardcode_minus_L, $1)=yes
    48965397      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
    4897       _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
     5398      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
    48985399      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
    48995400      ;;
     
    49025403      if test "$GCC" = yes; then
    49035404        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
    4904         _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     5405        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
    49055406      else
    49065407        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
    4907         _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
     5408        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
    49085409      fi
    49095410      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
     
    49155416      if test "$GCC" = yes; then
    49165417        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
    4917         _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     5418        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
    49185419        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
    49195420      else
    49205421        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
    4921         _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
     5422        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
    49225423        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
    4923         $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
     5424        $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
    49245425
    49255426        # Both c and cxx compiler support -rpath directly
     
    49345435      if test "$GCC" = yes; then
    49355436        wlarc='${wl}'
    4936         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
     5437        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
    49375438        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
    4938           $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
     5439          $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
    49395440      else
    49405441        case `$CC -V 2>&1` in
     
    51125613      # systems, -lgcc has to come before -lc. If gcc already passes -lc
    51135614      # to ld, don't add -lc before -lgcc.
    5114       AC_MSG_CHECKING([whether -lc should be explicitly linked in])
    5115       $RM conftest*
    5116       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    5117 
    5118       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
    5119         soname=conftest
    5120         lib=conftest
    5121         libobjs=conftest.$ac_objext
    5122         deplibs=
    5123         wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
    5124         pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
    5125         compiler_flags=-v
    5126         linker_flags=-v
    5127         verstring=
    5128         output_objdir=.
    5129         libname=conftest
    5130         lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
    5131         _LT_TAGVAR(allow_undefined_flag, $1)=
    5132         if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
    5133         then
    5134           _LT_TAGVAR(archive_cmds_need_lc, $1)=no
    5135         else
    5136           _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
    5137         fi
    5138         _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
    5139       else
    5140         cat conftest.err 1>&5
    5141       fi
    5142       $RM conftest*
    5143       AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
     5615      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
     5616        [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
     5617        [$RM conftest*
     5618        echo "$lt_simple_compile_test_code" > conftest.$ac_ext
     5619
     5620        if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
     5621          soname=conftest
     5622          lib=conftest
     5623          libobjs=conftest.$ac_objext
     5624          deplibs=
     5625          wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
     5626          pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
     5627          compiler_flags=-v
     5628          linker_flags=-v
     5629          verstring=
     5630          output_objdir=.
     5631          libname=conftest
     5632          lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
     5633          _LT_TAGVAR(allow_undefined_flag, $1)=
     5634          if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
     5635          then
     5636            lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
     5637          else
     5638            lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
     5639          fi
     5640          _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
     5641        else
     5642          cat conftest.err 1>&5
     5643        fi
     5644        $RM conftest*
     5645        ])
     5646      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
    51445647      ;;
    51455648    esac
     
    51785681    [Flag to hardcode $libdir into a binary during linking.
    51795682    This must work even if $libdir does not exist])
    5180 _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
    5181     [[If ld is used when linking, flag to hardcode $libdir into a binary
    5182     during linking.  This must work even if $libdir does not exist]])
    51835683_LT_TAGDECL([], [hardcode_libdir_separator], [1],
    51845684    [Whether we need a single "-rpath" flag with a separated argument])
     
    52065706_LT_TAGDECL([], [link_all_deplibs], [0],
    52075707    [Whether libtool must link a program against all its dependency libraries])
    5208 _LT_TAGDECL([], [fix_srcfile_path], [1],
    5209     [Fix the shell variable $srcfile for the compiler])
    52105708_LT_TAGDECL([], [always_export_symbols], [0],
    52115709    [Set to "yes" if exported symbols are required])
     
    52185716_LT_TAGDECL([], [prelink_cmds], [2],
    52195717    [Commands necessary for linking programs (against libraries) with templates])
     5718_LT_TAGDECL([], [postlink_cmds], [2],
     5719    [Commands necessary for finishing linking programs])
    52205720_LT_TAGDECL([], [file_list_spec], [1],
    52215721    [Specify filename containing input files])
     
    53115811
    53125812
    5313 # _LT_PROG_CXX
    5314 # ------------
    5315 # Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
    5316 # compiler, we have our own version here.
    5317 m4_defun([_LT_PROG_CXX],
    5318 [
    5319 pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
    5320 AC_PROG_CXX
     5813# _LT_LANG_CXX_CONFIG([TAG])
     5814# --------------------------
     5815# Ensure that the configuration variables for a C++ compiler are suitably
     5816# defined.  These variables are subsequently used by _LT_CONFIG to write
     5817# the compiler configuration to `libtool'.
     5818m4_defun([_LT_LANG_CXX_CONFIG],
     5819[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
     5820m4_require([_LT_DECL_EGREP])dnl
     5821m4_require([_LT_PATH_MANIFEST_TOOL])dnl
    53215822if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
    53225823    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
     
    53265827  _lt_caught_CXX_error=yes
    53275828fi
    5328 popdef([AC_MSG_ERROR])
    5329 ])# _LT_PROG_CXX
    5330 
    5331 dnl aclocal-1.4 backwards compatibility:
    5332 dnl AC_DEFUN([_LT_PROG_CXX], [])
    5333 
    5334 
    5335 # _LT_LANG_CXX_CONFIG([TAG])
    5336 # --------------------------
    5337 # Ensure that the configuration variables for a C++ compiler are suitably
    5338 # defined.  These variables are subsequently used by _LT_CONFIG to write
    5339 # the compiler configuration to `libtool'.
    5340 m4_defun([_LT_LANG_CXX_CONFIG],
    5341 [AC_REQUIRE([_LT_PROG_CXX])dnl
    5342 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
    5343 m4_require([_LT_DECL_EGREP])dnl
    53445829
    53455830AC_LANG_PUSH(C++)
     
    53535838_LT_TAGVAR(hardcode_direct_absolute, $1)=no
    53545839_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
    5355 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
    53565840_LT_TAGVAR(hardcode_libdir_separator, $1)=
    53575841_LT_TAGVAR(hardcode_minus_L, $1)=no
     
    53635847_LT_TAGVAR(link_all_deplibs, $1)=unknown
    53645848_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
     5849_LT_TAGVAR(reload_flag, $1)=$reload_flag
     5850_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
    53655851_LT_TAGVAR(no_undefined_flag, $1)=
    53665852_LT_TAGVAR(whole_archive_flag_spec, $1)=
     
    53945880  # Allow CC to be a program name with arguments.
    53955881  lt_save_CC=$CC
     5882  lt_save_CFLAGS=$CFLAGS
    53965883  lt_save_LD=$LD
    53975884  lt_save_GCC=$GCC
     
    54115898  test -z "${LDCXX+set}" || LD=$LDCXX
    54125899  CC=${CXX-"c++"}
     5900  CFLAGS=$CXXFLAGS
    54135901  compiler=$CC
    54145902  _LT_TAGVAR(compiler, $1)=$CC
     
    54325920      # archiving commands below assume that GNU ld is being used.
    54335921      if test "$with_gnu_ld" = yes; then
    5434         _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
    5435         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
     5922        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
     5923        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
    54365924
    54375925        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
     
    54655953      # what "hidden" libraries, object files and flags are used when
    54665954      # linking a shared library.
    5467       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
     5955      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    54685956
    54695957    else
     
    55746062          # Determine the default libpath from the value encoded in an empty
    55756063          # executable.
    5576           _LT_SYS_MODULE_PATH_AIX
     6064          _LT_SYS_MODULE_PATH_AIX([$1])
    55776065          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
    55786066
    5579           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
     6067          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
    55806068        else
    55816069          if test "$host_cpu" = ia64; then
     
    55866074            # Determine the default libpath from the value encoded in an
    55876075            # empty executable.
    5588             _LT_SYS_MODULE_PATH_AIX
     6076            _LT_SYS_MODULE_PATH_AIX([$1])
    55896077            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
    55906078            # Warning - without using the other run time loading flags,
     
    55926080            _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
    55936081            _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
    5594             # Exported symbols can be pulled into shared objects from archives
    5595             _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
     6082            if test "$with_gnu_ld" = yes; then
     6083              # We only use this code for GNU lds that support --whole-archive.
     6084              _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
     6085            else
     6086              # Exported symbols can be pulled into shared objects from archives
     6087              _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
     6088            fi
    55966089            _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
    55976090            # This is similar to how AIX traditionally builds its shared
     
    56236116
    56246117      cygwin* | mingw* | pw32* | cegcc*)
    5625         # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
    5626         # as there is no search path for DLLs.
    5627         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
    5628         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
    5629         _LT_TAGVAR(always_export_symbols, $1)=no
    5630         _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
    5631 
    5632         if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
    5633           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
    5634           # If the export-symbols file already is a .def file (1st line
    5635           # is EXPORTS), use it as is; otherwise, prepend...
    5636           _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
    5637             cp $export_symbols $output_objdir/$soname.def;
    5638           else
    5639             echo EXPORTS > $output_objdir/$soname.def;
    5640             cat $export_symbols >> $output_objdir/$soname.def;
    5641           fi~
    5642           $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
    5643         else
    5644           _LT_TAGVAR(ld_shlibs, $1)=no
    5645         fi
    5646         ;;
     6118        case $GXX,$cc_basename in
     6119        ,cl* | no,cl*)
     6120          # Native MSVC
     6121          # hardcode_libdir_flag_spec is actually meaningless, as there is
     6122          # no search path for DLLs.
     6123          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
     6124          _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
     6125          _LT_TAGVAR(always_export_symbols, $1)=yes
     6126          _LT_TAGVAR(file_list_spec, $1)='@'
     6127          # Tell ltmain to make .lib files, not .a files.
     6128          libext=lib
     6129          # Tell ltmain to make .dll files, not .so files.
     6130          shrext_cmds=".dll"
     6131          # FIXME: Setting linknames here is a bad hack.
     6132          _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
     6133          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
     6134              $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
     6135            else
     6136              $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
     6137            fi~
     6138            $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
     6139            linknames='
     6140          # The linker will not automatically build a static lib if we build a DLL.
     6141          # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
     6142          _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
     6143          # Don't use ranlib
     6144          _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
     6145          _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
     6146            lt_tool_outputfile="@TOOL_OUTPUT@"~
     6147            case $lt_outputfile in
     6148              *.exe|*.EXE) ;;
     6149              *)
     6150                lt_outputfile="$lt_outputfile.exe"
     6151                lt_tool_outputfile="$lt_tool_outputfile.exe"
     6152                ;;
     6153            esac~
     6154            func_to_tool_file "$lt_outputfile"~
     6155            if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
     6156              $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
     6157              $RM "$lt_outputfile.manifest";
     6158            fi'
     6159          ;;
     6160        *)
     6161          # g++
     6162          # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
     6163          # as there is no search path for DLLs.
     6164          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
     6165          _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
     6166          _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
     6167          _LT_TAGVAR(always_export_symbols, $1)=no
     6168          _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
     6169
     6170          if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
     6171            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
     6172            # If the export-symbols file already is a .def file (1st line
     6173            # is EXPORTS), use it as is; otherwise, prepend...
     6174            _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
     6175              cp $export_symbols $output_objdir/$soname.def;
     6176            else
     6177              echo EXPORTS > $output_objdir/$soname.def;
     6178              cat $export_symbols >> $output_objdir/$soname.def;
     6179            fi~
     6180            $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
     6181          else
     6182            _LT_TAGVAR(ld_shlibs, $1)=no
     6183          fi
     6184          ;;
     6185        esac
     6186        ;;
    56476187      darwin* | rhapsody*)
    56486188        _LT_DARWIN_LINKER_FEATURES($1)
     
    56676207        ;;
    56686208
    5669       freebsd[[12]]*)
     6209      freebsd2.*)
    56706210        # C++ shared libraries reported to be fairly broken before
    56716211        # switch to ELF
     
    56846224
    56856225      gnu*)
     6226        ;;
     6227
     6228      haiku*)
     6229        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
     6230        _LT_TAGVAR(link_all_deplibs, $1)=yes
    56866231        ;;
    56876232
     
    57106255            # from the output so that they don't get included in the library
    57116256            # dependencies.
    5712             output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
     6257            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
    57136258            ;;
    57146259          *)
    57156260            if test "$GXX" = yes; then
    5716               _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
     6261              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
    57176262            else
    57186263              # FIXME: insert proper C++ library support
     
    57756320            # from the output so that they don't get included in the library
    57766321            # dependencies.
    5777             output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
     6322            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
    57786323            ;;
    57796324          *)
     
    57856330                    ;;
    57866331                  ia64*)
    5787                     _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     6332                    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
    57886333                    ;;
    57896334                  *)
    5790                     _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
     6335                    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
    57916336                    ;;
    57926337                esac
     
    58186363          CC*)
    58196364            # SGI C++
    5820             _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
     6365            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
    58216366
    58226367            # Archives containing C++ object files must be created using
     
    58296374            if test "$GXX" = yes; then
    58306375              if test "$with_gnu_ld" = no; then
    5831                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     6376                _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
    58326377              else
    5833                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
     6378                _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
    58346379              fi
    58356380            fi
     
    58426387        ;;
    58436388
    5844       linux* | k*bsd*-gnu)
     6389      linux* | k*bsd*-gnu | kopensolaris*-gnu)
    58456390        case $cc_basename in
    58466391          KCC*)
     
    58606405            # from the output so that they don't get included in the library
    58616406            # dependencies.
    5862             output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
     6407            output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
    58636408
    58646409            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
     
    58976442            # Portland Group C++ compiler
    58986443            case `$CC -V` in
    5899             *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
     6444            *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
    59006445              _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
    59016446                rm -rf $tpldir~
    59026447                $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
    5903                 compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
     6448                compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
    59046449              _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
    59056450                rm -rf $tpldir~
    59066451                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
    5907                 $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
     6452                $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
    59086453                $RANLIB $oldlib'
    59096454              _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
    59106455                rm -rf $tpldir~
    59116456                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
    5912                 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
     6457                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
    59136458              _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
    59146459                rm -rf $tpldir~
    59156460                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
    5916                 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
     6461                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
    59176462              ;;
    5918             *) # Version 6 will use weak symbols
     6463            *) # Version 6 and above use weak symbols
    59196464              _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
    59206465              _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
     
    59246469            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
    59256470            _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
    5926             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
     6471            _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
    59276472            ;;
    59286473          cxx*)
     
    59436488            # from the output so that they don't get included in the library
    59446489            # dependencies.
    5945             output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
     6490            output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
    59466491            ;;
    5947           xl*)
     6492          xl* | mpixl* | bgxl*)
    59486493            # IBM XL 8.0 on PPC, with GNU ld
    59496494            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
     
    59656510              _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
    59666511              _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
    5967               _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
     6512              _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
    59686513              _LT_TAGVAR(compiler_needs_object, $1)=yes
    59696514
     
    59716516              # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
    59726517              # would be better.
    5973               output_verbose_link_cmd='echo'
     6518              output_verbose_link_cmd='func_echo_all'
    59746519
    59756520              # Archives containing C++ object files must be created using
     
    60406585            _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
    60416586          fi
    6042           output_verbose_link_cmd=echo
     6587          output_verbose_link_cmd=func_echo_all
    60436588        else
    60446589          _LT_TAGVAR(ld_shlibs, $1)=no
     
    60756620              osf3*)
    60766621                _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
    6077                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
     6622                _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
    60786623                _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
    60796624                ;;
    60806625              *)
    60816626                _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
    6082                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
     6627                _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
    60836628                _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
    60846629                  echo "-hidden">> $lib.exp~
    6085                   $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
     6630                  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
    60866631                  $RM $lib.exp'
    60876632                _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
     
    60996644            # from the output so that they don't get included in the library
    61006645            # dependencies.
    6101             output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
     6646            output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
    61026647            ;;
    61036648          *)
     
    61066651              case $host in
    61076652                osf3*)
    6108                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     6653                  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
    61096654                  ;;
    61106655                *)
    6111                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
     6656                  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
    61126657                  ;;
    61136658              esac
     
    61196664              # what "hidden" libraries, object files and flags are used when
    61206665              # linking a shared library.
    6121               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
     6666              output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    61226667
    61236668            else
     
    61556700      solaris*)
    61566701        case $cc_basename in
    6157           CC*)
     6702          CC* | sunCC*)
    61586703            # Sun C++ 4.2, 5.x and Centerline C++
    61596704            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
     
    61766721            _LT_TAGVAR(link_all_deplibs, $1)=yes
    61776722
    6178             output_verbose_link_cmd='echo'
     6723            output_verbose_link_cmd='func_echo_all'
    61796724
    61806725            # Archives containing C++ object files must be created using
     
    61966741              _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
    61976742              if $CC --version | $GREP -v '^2\.7' > /dev/null; then
    6198                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
     6743                _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
    61996744                _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
    6200                   $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
     6745                  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
    62016746
    62026747                # Commands to make compiler produce verbose output that lists
    62036748                # what "hidden" libraries, object files and flags are used when
    62046749                # linking a shared library.
    6205                 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
     6750                output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    62066751              else
    62076752                # g++ 2.7 appears to require `-G' NOT `-shared' on this
     
    62146759                # what "hidden" libraries, object files and flags are used when
    62156760                # linking a shared library.
    6216                 output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
     6761                output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    62176762              fi
    62186763
     
    62686813            _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
    62696814            _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
     6815            _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
     6816              '"$_LT_TAGVAR(old_archive_cmds, $1)"
     6817            _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
     6818              '"$_LT_TAGVAR(reload_cmds, $1)"
    62706819            ;;
    62716820          *)
     
    63236872
    63246873  CC=$lt_save_CC
     6874  CFLAGS=$lt_save_CFLAGS
    63256875  LDCXX=$LD
    63266876  LD=$lt_save_LD
     
    63376887
    63386888
     6889# _LT_FUNC_STRIPNAME_CNF
     6890# ----------------------
     6891# func_stripname_cnf prefix suffix name
     6892# strip PREFIX and SUFFIX off of NAME.
     6893# PREFIX and SUFFIX must not contain globbing or regex special
     6894# characters, hashes, percent signs, but SUFFIX may contain a leading
     6895# dot (in which case that matches only a dot).
     6896#
     6897# This function is identical to the (non-XSI) version of func_stripname,
     6898# except this one can be used by m4 code that may be executed by configure,
     6899# rather than the libtool script.
     6900m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
     6901AC_REQUIRE([_LT_DECL_SED])
     6902AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
     6903func_stripname_cnf ()
     6904{
     6905  case ${2} in
     6906  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
     6907  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
     6908  esac
     6909} # func_stripname_cnf
     6910])# _LT_FUNC_STRIPNAME_CNF
     6911
    63396912# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
    63406913# ---------------------------------
     
    63456918m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
    63466919[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
     6920AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
    63476921# Dependencies to place before and after the object being linked:
    63486922_LT_TAGVAR(predep_objects, $1)=
     
    63946968};
    63956969_LT_EOF
     6970], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
     6971package foo
     6972func foo() {
     6973}
     6974_LT_EOF
    63966975])
     6976
     6977_lt_libdeps_save_CFLAGS=$CFLAGS
     6978case "$CC $CFLAGS " in #(
     6979*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
     6980*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
     6981*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
     6982esac
     6983
    63976984dnl Parse the compiler output and extract the necessary
    63986985dnl objects, libraries and library flags.
     
    64066993
    64076994  for p in `eval "$output_verbose_link_cmd"`; do
    6408     case $p in
     6995    case ${prev}${p} in
    64096996
    64106997    -L* | -R* | -l*)
     
    64157002         prev=$p
    64167003         continue
    6417        else
    6418          prev=
    64197004       fi
    64207005
     7006       # Expand the sysroot to ease extracting the directories later.
     7007       if test -z "$prev"; then
     7008         case $p in
     7009         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
     7010         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
     7011         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
     7012         esac
     7013       fi
     7014       case $p in
     7015       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
     7016       esac
    64217017       if test "$pre_test_object_deps_done" = no; then
    6422          case $p in
    6423          -L* | -R*)
     7018         case ${prev} in
     7019         -L | -R)
    64247020           # Internal compiler library paths should come after those
    64257021           # provided the user.  The postdeps already come after the
     
    64417037         fi
    64427038       fi
     7039       prev=
    64437040       ;;
    64447041
     7042    *.lto.$objext) ;; # Ignore GCC LTO objects
    64457043    *.$objext)
    64467044       # This assumes that the test object file only shows up
     
    64787076
    64797077$RM -f confest.$objext
     7078CFLAGS=$_lt_libdeps_save_CFLAGS
    64807079
    64817080# PORTME: override above test on systems where it is broken
     
    65147113solaris*)
    65157114  case $cc_basename in
    6516   CC*)
     7115  CC* | sunCC*)
    65177116    # The more standards-conforming stlport4 library is
    65187117    # incompatible with the Cstd library. Avoid specifying
     
    65587157
    65597158
    6560 # _LT_PROG_F77
    6561 # ------------
    6562 # Since AC_PROG_F77 is broken, in that it returns the empty string
    6563 # if there is no fortran compiler, we have our own version here.
    6564 m4_defun([_LT_PROG_F77],
    6565 [
    6566 pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
    6567 AC_PROG_F77
    6568 if test -z "$F77" || test "X$F77" = "Xno"; then
    6569   _lt_disable_F77=yes
    6570 fi
    6571 popdef([AC_MSG_ERROR])
    6572 ])# _LT_PROG_F77
    6573 
    6574 dnl aclocal-1.4 backwards compatibility:
    6575 dnl AC_DEFUN([_LT_PROG_F77], [])
    6576 
    6577 
    65787159# _LT_LANG_F77_CONFIG([TAG])
    65797160# --------------------------
     
    65827163# to write the compiler configuration to `libtool'.
    65837164m4_defun([_LT_LANG_F77_CONFIG],
    6584 [AC_REQUIRE([_LT_PROG_F77])dnl
    6585 AC_LANG_PUSH(Fortran 77)
     7165[AC_LANG_PUSH(Fortran 77)
     7166if test -z "$F77" || test "X$F77" = "Xno"; then
     7167  _lt_disable_F77=yes
     7168fi
    65867169
    65877170_LT_TAGVAR(archive_cmds_need_lc, $1)=no
     
    65937176_LT_TAGVAR(hardcode_direct_absolute, $1)=no
    65947177_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
    6595 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
    65967178_LT_TAGVAR(hardcode_libdir_separator, $1)=
    65977179_LT_TAGVAR(hardcode_minus_L, $1)=no
     
    66027184_LT_TAGVAR(link_all_deplibs, $1)=unknown
    66037185_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
     7186_LT_TAGVAR(reload_flag, $1)=$reload_flag
     7187_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
    66047188_LT_TAGVAR(no_undefined_flag, $1)=
    66057189_LT_TAGVAR(whole_archive_flag_spec, $1)=
     
    66417225  lt_save_CC="$CC"
    66427226  lt_save_GCC=$GCC
     7227  lt_save_CFLAGS=$CFLAGS
    66437228  CC=${F77-"f77"}
     7229  CFLAGS=$FFLAGS
    66447230  compiler=$CC
    66457231  _LT_TAGVAR(compiler, $1)=$CC
     
    66957281  GCC=$lt_save_GCC
    66967282  CC="$lt_save_CC"
     7283  CFLAGS="$lt_save_CFLAGS"
    66977284fi # test "$_lt_disable_F77" != yes
    66987285
    66997286AC_LANG_POP
    67007287])# _LT_LANG_F77_CONFIG
    6701 
    6702 
    6703 # _LT_PROG_FC
    6704 # -----------
    6705 # Since AC_PROG_FC is broken, in that it returns the empty string
    6706 # if there is no fortran compiler, we have our own version here.
    6707 m4_defun([_LT_PROG_FC],
    6708 [
    6709 pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
    6710 AC_PROG_FC
    6711 if test -z "$FC" || test "X$FC" = "Xno"; then
    6712   _lt_disable_FC=yes
    6713 fi
    6714 popdef([AC_MSG_ERROR])
    6715 ])# _LT_PROG_FC
    6716 
    6717 dnl aclocal-1.4 backwards compatibility:
    6718 dnl AC_DEFUN([_LT_PROG_FC], [])
    67197288
    67207289
     
    67257294# to write the compiler configuration to `libtool'.
    67267295m4_defun([_LT_LANG_FC_CONFIG],
    6727 [AC_REQUIRE([_LT_PROG_FC])dnl
    6728 AC_LANG_PUSH(Fortran)
     7296[AC_LANG_PUSH(Fortran)
     7297
     7298if test -z "$FC" || test "X$FC" = "Xno"; then
     7299  _lt_disable_FC=yes
     7300fi
    67297301
    67307302_LT_TAGVAR(archive_cmds_need_lc, $1)=no
     
    67367308_LT_TAGVAR(hardcode_direct_absolute, $1)=no
    67377309_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
    6738 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
    67397310_LT_TAGVAR(hardcode_libdir_separator, $1)=
    67407311_LT_TAGVAR(hardcode_minus_L, $1)=no
     
    67457316_LT_TAGVAR(link_all_deplibs, $1)=unknown
    67467317_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
     7318_LT_TAGVAR(reload_flag, $1)=$reload_flag
     7319_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
    67477320_LT_TAGVAR(no_undefined_flag, $1)=
    67487321_LT_TAGVAR(whole_archive_flag_spec, $1)=
     
    67847357  lt_save_CC="$CC"
    67857358  lt_save_GCC=$GCC
     7359  lt_save_CFLAGS=$CFLAGS
    67867360  CC=${FC-"f95"}
     7361  CFLAGS=$FCFLAGS
    67877362  compiler=$CC
    67887363  GCC=$ac_cv_fc_compiler_gnu
     
    68407415
    68417416  GCC=$lt_save_GCC
    6842   CC="$lt_save_CC"
     7417  CC=$lt_save_CC
     7418  CFLAGS=$lt_save_CFLAGS
    68437419fi # test "$_lt_disable_FC" != yes
    68447420
     
    68777453
    68787454# Allow CC to be a program name with arguments.
    6879 lt_save_CC="$CC"
     7455lt_save_CC=$CC
     7456lt_save_CFLAGS=$CFLAGS
    68807457lt_save_GCC=$GCC
    68817458GCC=yes
    68827459CC=${GCJ-"gcj"}
     7460CFLAGS=$GCJFLAGS
    68837461compiler=$CC
    68847462_LT_TAGVAR(compiler, $1)=$CC
     
    68907468
    68917469_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
     7470_LT_TAGVAR(reload_flag, $1)=$reload_flag
     7471_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
    68927472
    68937473## CAVEAT EMPTOR:
     
    69097489
    69107490GCC=$lt_save_GCC
    6911 CC="$lt_save_CC"
     7491CC=$lt_save_CC
     7492CFLAGS=$lt_save_CFLAGS
    69127493])# _LT_LANG_GCJ_CONFIG
     7494
     7495
     7496# _LT_LANG_GO_CONFIG([TAG])
     7497# --------------------------
     7498# Ensure that the configuration variables for the GNU Go compiler
     7499# are suitably defined.  These variables are subsequently used by _LT_CONFIG
     7500# to write the compiler configuration to `libtool'.
     7501m4_defun([_LT_LANG_GO_CONFIG],
     7502[AC_REQUIRE([LT_PROG_GO])dnl
     7503AC_LANG_SAVE
     7504
     7505# Source file extension for Go test sources.
     7506ac_ext=go
     7507
     7508# Object file extension for compiled Go test sources.
     7509objext=o
     7510_LT_TAGVAR(objext, $1)=$objext
     7511
     7512# Code to be used in simple compile tests
     7513lt_simple_compile_test_code="package main; func main() { }"
     7514
     7515# Code to be used in simple link tests
     7516lt_simple_link_test_code='package main; func main() { }'
     7517
     7518# ltmain only uses $CC for tagged configurations so make sure $CC is set.
     7519_LT_TAG_COMPILER
     7520
     7521# save warnings/boilerplate of simple test code
     7522_LT_COMPILER_BOILERPLATE
     7523_LT_LINKER_BOILERPLATE
     7524
     7525# Allow CC to be a program name with arguments.
     7526lt_save_CC=$CC
     7527lt_save_CFLAGS=$CFLAGS
     7528lt_save_GCC=$GCC
     7529GCC=yes
     7530CC=${GOC-"gccgo"}
     7531CFLAGS=$GOFLAGS
     7532compiler=$CC
     7533_LT_TAGVAR(compiler, $1)=$CC
     7534_LT_TAGVAR(LD, $1)="$LD"
     7535_LT_CC_BASENAME([$compiler])
     7536
     7537# Go did not exist at the time GCC didn't implicitly link libc in.
     7538_LT_TAGVAR(archive_cmds_need_lc, $1)=no
     7539
     7540_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
     7541_LT_TAGVAR(reload_flag, $1)=$reload_flag
     7542_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
     7543
     7544## CAVEAT EMPTOR:
     7545## There is no encapsulation within the following macros, do not change
     7546## the running order or otherwise move them around unless you know exactly
     7547## what you are doing...
     7548if test -n "$compiler"; then
     7549  _LT_COMPILER_NO_RTTI($1)
     7550  _LT_COMPILER_PIC($1)
     7551  _LT_COMPILER_C_O($1)
     7552  _LT_COMPILER_FILE_LOCKS($1)
     7553  _LT_LINKER_SHLIBS($1)
     7554  _LT_LINKER_HARDCODE_LIBPATH($1)
     7555
     7556  _LT_CONFIG($1)
     7557fi
     7558
     7559AC_LANG_RESTORE
     7560
     7561GCC=$lt_save_GCC
     7562CC=$lt_save_CC
     7563CFLAGS=$lt_save_CFLAGS
     7564])# _LT_LANG_GO_CONFIG
    69137565
    69147566
     
    69447596# Allow CC to be a program name with arguments.
    69457597lt_save_CC="$CC"
     7598lt_save_CFLAGS=$CFLAGS
    69467599lt_save_GCC=$GCC
    69477600GCC=
    69487601CC=${RC-"windres"}
     7602CFLAGS=
    69497603compiler=$CC
    69507604_LT_TAGVAR(compiler, $1)=$CC
     
    69597613GCC=$lt_save_GCC
    69607614AC_LANG_RESTORE
    6961 CC="$lt_save_CC"
     7615CC=$lt_save_CC
     7616CFLAGS=$lt_save_CFLAGS
    69627617])# _LT_LANG_RC_CONFIG
    69637618
     
    69777632dnl aclocal-1.4 backwards compatibility:
    69787633dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
     7634
     7635
     7636# LT_PROG_GO
     7637# ----------
     7638AC_DEFUN([LT_PROG_GO],
     7639[AC_CHECK_TOOL(GOC, gccgo,)
     7640])
    69797641
    69807642
     
    70187680])
    70197681
     7682# _LT_DECL_DLLTOOL
     7683# ----------------
     7684# Ensure DLLTOOL variable is set.
     7685m4_defun([_LT_DECL_DLLTOOL],
     7686[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
     7687test -z "$DLLTOOL" && DLLTOOL=dlltool
     7688_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
     7689AC_SUBST([DLLTOOL])
     7690])
    70207691
    70217692# _LT_DECL_SED
     
    71117782xsi_shell=no
    71127783( _lt_dummy="a/b/c"
    7113   test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
    7114       = c,a/b,, \
     7784  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
     7785      = c,a/b,b/c, \
    71157786    && eval 'test $(( 1 + 1 )) -eq 2 \
    71167787    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
     
    71517822
    71527823
    7153 # _LT_PROG_XSI_SHELLFNS
    7154 # ---------------------
    7155 # Bourne and XSI compatible variants of some useful shell functions.
    7156 m4_defun([_LT_PROG_XSI_SHELLFNS],
    7157 [case $xsi_shell in
    7158   yes)
    7159     cat << \_LT_EOF >> "$cfgfile"
    7160 
    7161 # func_dirname file append nondir_replacement
    7162 # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
    7163 # otherwise set result to NONDIR_REPLACEMENT.
    7164 func_dirname ()
    7165 {
    7166   case ${1} in
    7167     */*) func_dirname_result="${1%/*}${2}" ;;
    7168     *  ) func_dirname_result="${3}" ;;
    7169   esac
    7170 }
    7171 
    7172 # func_basename file
    7173 func_basename ()
    7174 {
    7175   func_basename_result="${1##*/}"
    7176 }
    7177 
    7178 # func_dirname_and_basename file append nondir_replacement
    7179 # perform func_basename and func_dirname in a single function
    7180 # call:
    7181 #   dirname:  Compute the dirname of FILE.  If nonempty,
    7182 #             add APPEND to the result, otherwise set result
    7183 #             to NONDIR_REPLACEMENT.
    7184 #             value returned in "$func_dirname_result"
    7185 #   basename: Compute filename of FILE.
    7186 #             value retuned in "$func_basename_result"
    7187 # Implementation must be kept synchronized with func_dirname
    7188 # and func_basename. For efficiency, we do not delegate to
    7189 # those functions but instead duplicate the functionality here.
    7190 func_dirname_and_basename ()
    7191 {
    7192   case ${1} in
    7193     */*) func_dirname_result="${1%/*}${2}" ;;
    7194     *  ) func_dirname_result="${3}" ;;
    7195   esac
    7196   func_basename_result="${1##*/}"
    7197 }
    7198 
    7199 # func_stripname prefix suffix name
    7200 # strip PREFIX and SUFFIX off of NAME.
    7201 # PREFIX and SUFFIX must not contain globbing or regex special
    7202 # characters, hashes, percent signs, but SUFFIX may contain a leading
    7203 # dot (in which case that matches only a dot).
    7204 func_stripname ()
    7205 {
    7206   # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
    7207   # positional parameters, so assign one to ordinary parameter first.
    7208   func_stripname_result=${3}
    7209   func_stripname_result=${func_stripname_result#"${1}"}
    7210   func_stripname_result=${func_stripname_result%"${2}"}
    7211 }
    7212 
    7213 # func_opt_split
    7214 func_opt_split ()
    7215 {
    7216   func_opt_split_opt=${1%%=*}
    7217   func_opt_split_arg=${1#*=}
    7218 }
    7219 
    7220 # func_lo2o object
    7221 func_lo2o ()
    7222 {
    7223   case ${1} in
    7224     *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
    7225     *)    func_lo2o_result=${1} ;;
    7226   esac
    7227 }
    7228 
    7229 # func_xform libobj-or-source
    7230 func_xform ()
    7231 {
    7232   func_xform_result=${1%.*}.lo
    7233 }
    7234 
    7235 # func_arith arithmetic-term...
    7236 func_arith ()
    7237 {
    7238   func_arith_result=$(( $[*] ))
    7239 }
    7240 
    7241 # func_len string
    7242 # STRING may not start with a hyphen.
    7243 func_len ()
    7244 {
    7245   func_len_result=${#1}
    7246 }
    7247 
    7248 _LT_EOF
     7824# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
     7825# ------------------------------------------------------
     7826# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
     7827# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
     7828m4_defun([_LT_PROG_FUNCTION_REPLACE],
     7829[dnl {
     7830sed -e '/^$1 ()$/,/^} # $1 /c\
     7831$1 ()\
     7832{\
     7833m4_bpatsubsts([$2], [$], [\\], [^\([     ]\)], [\\\1])
     7834} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
     7835  && mv -f "$cfgfile.tmp" "$cfgfile" \
     7836    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
     7837test 0 -eq $? || _lt_function_replace_fail=:
     7838])
     7839
     7840
     7841# _LT_PROG_REPLACE_SHELLFNS
     7842# -------------------------
     7843# Replace existing portable implementations of several shell functions with
     7844# equivalent extended shell implementations where those features are available..
     7845m4_defun([_LT_PROG_REPLACE_SHELLFNS],
     7846[if test x"$xsi_shell" = xyes; then
     7847  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
     7848    case ${1} in
     7849      */*) func_dirname_result="${1%/*}${2}" ;;
     7850      *  ) func_dirname_result="${3}" ;;
     7851    esac])
     7852
     7853  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
     7854    func_basename_result="${1##*/}"])
     7855
     7856  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
     7857    case ${1} in
     7858      */*) func_dirname_result="${1%/*}${2}" ;;
     7859      *  ) func_dirname_result="${3}" ;;
     7860    esac
     7861    func_basename_result="${1##*/}"])
     7862
     7863  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
     7864    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
     7865    # positional parameters, so assign one to ordinary parameter first.
     7866    func_stripname_result=${3}
     7867    func_stripname_result=${func_stripname_result#"${1}"}
     7868    func_stripname_result=${func_stripname_result%"${2}"}])
     7869
     7870  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
     7871    func_split_long_opt_name=${1%%=*}
     7872    func_split_long_opt_arg=${1#*=}])
     7873
     7874  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
     7875    func_split_short_opt_arg=${1#??}
     7876    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
     7877
     7878  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
     7879    case ${1} in
     7880      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
     7881      *)    func_lo2o_result=${1} ;;
     7882    esac])
     7883
     7884  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
     7885
     7886  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
     7887
     7888  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
     7889fi
     7890
     7891if test x"$lt_shell_append" = xyes; then
     7892  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
     7893
     7894  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
     7895    func_quote_for_eval "${2}"
     7896dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
     7897    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
     7898
     7899  # Save a `func_append' function call where possible by direct use of '+='
     7900  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
     7901    && mv -f "$cfgfile.tmp" "$cfgfile" \
     7902      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
     7903  test 0 -eq $? || _lt_function_replace_fail=:
     7904else
     7905  # Save a `func_append' function call even when '+=' is not available
     7906  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
     7907    && mv -f "$cfgfile.tmp" "$cfgfile" \
     7908      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
     7909  test 0 -eq $? || _lt_function_replace_fail=:
     7910fi
     7911
     7912if test x"$_lt_function_replace_fail" = x":"; then
     7913  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
     7914fi
     7915])
     7916
     7917# _LT_PATH_CONVERSION_FUNCTIONS
     7918# -----------------------------
     7919# Determine which file name conversion functions should be used by
     7920# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
     7921# for certain cross-compile configurations and native mingw.
     7922m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
     7923[AC_REQUIRE([AC_CANONICAL_HOST])dnl
     7924AC_REQUIRE([AC_CANONICAL_BUILD])dnl
     7925AC_MSG_CHECKING([how to convert $build file names to $host format])
     7926AC_CACHE_VAL(lt_cv_to_host_file_cmd,
     7927[case $host in
     7928  *-*-mingw* )
     7929    case $build in
     7930      *-*-mingw* ) # actually msys
     7931        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
     7932        ;;
     7933      *-*-cygwin* )
     7934        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
     7935        ;;
     7936      * ) # otherwise, assume *nix
     7937        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
     7938        ;;
     7939    esac
    72497940    ;;
    7250   *) # Bourne compatible functions.
    7251     cat << \_LT_EOF >> "$cfgfile"
    7252 
    7253 # func_dirname file append nondir_replacement
    7254 # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
    7255 # otherwise set result to NONDIR_REPLACEMENT.
    7256 func_dirname ()
    7257 {
    7258   # Extract subdirectory from the argument.
    7259   func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
    7260   if test "X$func_dirname_result" = "X${1}"; then
    7261     func_dirname_result="${3}"
    7262   else
    7263     func_dirname_result="$func_dirname_result${2}"
    7264   fi
    7265 }
    7266 
    7267 # func_basename file
    7268 func_basename ()
    7269 {
    7270   func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
    7271 }
    7272 
    7273 dnl func_dirname_and_basename
    7274 dnl A portable version of this function is already defined in general.m4sh
    7275 dnl so there is no need for it here.
    7276 
    7277 # func_stripname prefix suffix name
    7278 # strip PREFIX and SUFFIX off of NAME.
    7279 # PREFIX and SUFFIX must not contain globbing or regex special
    7280 # characters, hashes, percent signs, but SUFFIX may contain a leading
    7281 # dot (in which case that matches only a dot).
    7282 # func_strip_suffix prefix name
    7283 func_stripname ()
    7284 {
    7285   case ${2} in
    7286     .*) func_stripname_result=`$ECHO "X${3}" \
    7287            | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
    7288     *)  func_stripname_result=`$ECHO "X${3}" \
    7289            | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
    7290   esac
    7291 }
    7292 
    7293 # sed scripts:
    7294 my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
    7295 my_sed_long_arg='1s/^-[[^=]]*=//'
    7296 
    7297 # func_opt_split
    7298 func_opt_split ()
    7299 {
    7300   func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
    7301   func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
    7302 }
    7303 
    7304 # func_lo2o object
    7305 func_lo2o ()
    7306 {
    7307   func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
    7308 }
    7309 
    7310 # func_xform libobj-or-source
    7311 func_xform ()
    7312 {
    7313   func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
    7314 }
    7315 
    7316 # func_arith arithmetic-term...
    7317 func_arith ()
    7318 {
    7319   func_arith_result=`expr "$[@]"`
    7320 }
    7321 
    7322 # func_len string
    7323 # STRING may not start with a hyphen.
    7324 func_len ()
    7325 {
    7326   func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
    7327 }
    7328 
    7329 _LT_EOF
     7941  *-*-cygwin* )
     7942    case $build in
     7943      *-*-mingw* ) # actually msys
     7944        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
     7945        ;;
     7946      *-*-cygwin* )
     7947        lt_cv_to_host_file_cmd=func_convert_file_noop
     7948        ;;
     7949      * ) # otherwise, assume *nix
     7950        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
     7951        ;;
     7952    esac
     7953    ;;
     7954  * ) # unhandled hosts (and "normal" native builds)
     7955    lt_cv_to_host_file_cmd=func_convert_file_noop
     7956    ;;
    73307957esac
    7331 
    7332 case $lt_shell_append in
    7333   yes)
    7334     cat << \_LT_EOF >> "$cfgfile"
    7335 
    7336 # func_append var value
    7337 # Append VALUE to the end of shell variable VAR.
    7338 func_append ()
    7339 {
    7340   eval "$[1]+=\$[2]"
    7341 }
    7342 _LT_EOF
     7958])
     7959to_host_file_cmd=$lt_cv_to_host_file_cmd
     7960AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
     7961_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
     7962         [0], [convert $build file names to $host format])dnl
     7963
     7964AC_MSG_CHECKING([how to convert $build file names to toolchain format])
     7965AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
     7966[#assume ordinary cross tools, or native build.
     7967lt_cv_to_tool_file_cmd=func_convert_file_noop
     7968case $host in
     7969  *-*-mingw* )
     7970    case $build in
     7971      *-*-mingw* ) # actually msys
     7972        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
     7973        ;;
     7974    esac
    73437975    ;;
    7344   *)
    7345     cat << \_LT_EOF >> "$cfgfile"
    7346 
    7347 # func_append var value
    7348 # Append VALUE to the end of shell variable VAR.
    7349 func_append ()
    7350 {
    7351   eval "$[1]=\$$[1]\$[2]"
    7352 }
    7353 
    7354 _LT_EOF
    7355     ;;
    7356   esac
     7976esac
    73577977])
     7978to_tool_file_cmd=$lt_cv_to_tool_file_cmd
     7979AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
     7980_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
     7981         [0], [convert $build files to toolchain format])dnl
     7982])# _LT_PATH_CONVERSION_FUNCTIONS
  • issm/branches/trunk-jpl-damage/m4/ltoptions.m4

    r11114 r12878  
    11# Helper functions for option handling.                    -*- Autoconf -*-
    22#
    3 #   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
     3#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
     4#   Inc.
    45#   Written by Gary V. Vaughan, 2004
    56#
     
    89# modifications, as long as this notice is preserved.
    910
    10 # serial 6 ltoptions.m4
     11# serial 7 ltoptions.m4
    1112
    1213# This is to help aclocal find these macros, as it can't see m4_define.
     
    126127
    127128case $host in
    128 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
     129*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
    129130  AC_CHECK_TOOL(AS, as, false)
    130131  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
     
    134135
    135136test -z "$AS" && AS=as
    136 _LT_DECL([], [AS],      [0], [Assembler program])dnl
     137_LT_DECL([], [AS],      [1], [Assembler program])dnl
    137138
    138139test -z "$DLLTOOL" && DLLTOOL=dlltool
    139 _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
     140_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
    140141
    141142test -z "$OBJDUMP" && OBJDUMP=objdump
    142 _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
     143_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
    143144])# win32-dll
    144145
     
    326327m4_define([_LT_WITH_PIC],
    327328[AC_ARG_WITH([pic],
    328     [AS_HELP_STRING([--with-pic],
     329    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
    329330        [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
    330     [pic_mode="$withval"],
     331    [lt_p=${PACKAGE-default}
     332    case $withval in
     333    yes|no) pic_mode=$withval ;;
     334    *)
     335      pic_mode=default
     336      # Look at the argument we got.  We use all the common list separators.
     337      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
     338      for lt_pkg in $withval; do
     339        IFS="$lt_save_ifs"
     340        if test "X$lt_pkg" = "X$lt_p"; then
     341          pic_mode=yes
     342        fi
     343      done
     344      IFS="$lt_save_ifs"
     345      ;;
     346    esac],
    331347    [pic_mode=default])
    332348
  • issm/branches/trunk-jpl-damage/m4/ltversion.m4

    r11114 r12878  
    88# modifications, as long as this notice is preserved.
    99
    10 # Generated from ltversion.in.
     10# @configure_input@
    1111
    12 # serial 3017 ltversion.m4
     12# serial 3337 ltversion.m4
    1313# This file is part of GNU Libtool
    1414
    15 m4_define([LT_PACKAGE_VERSION], [2.2.6b])
    16 m4_define([LT_PACKAGE_REVISION], [1.3017])
     15m4_define([LT_PACKAGE_VERSION], [2.4.2])
     16m4_define([LT_PACKAGE_REVISION], [1.3337])
    1717
    1818AC_DEFUN([LTVERSION_VERSION],
    19 [macro_version='2.2.6b'
    20 macro_revision='1.3017'
     19[macro_version='2.4.2'
     20macro_revision='1.3337'
    2121_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
    2222_LT_DECL(, macro_revision, 0)
  • issm/branches/trunk-jpl-damage/m4/lt~obsolete.m4

    r11114 r12878  
    11# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
    22#
    3 #   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
     3#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
    44#   Written by Scott James Remnant, 2004.
    55#
     
    88# modifications, as long as this notice is preserved.
    99
    10 # serial 4 lt~obsolete.m4
     10# serial 5 lt~obsolete.m4
    1111
    1212# These exist entirely to fool aclocal when bootstrapping libtool.
     
    7878m4_ifndef([_LT_AC_LANG_F77],            [AC_DEFUN([_LT_AC_LANG_F77])])
    7979m4_ifndef([_LT_AC_LANG_GCJ],            [AC_DEFUN([_LT_AC_LANG_GCJ])])
    80 m4_ifndef([AC_LIBTOOL_RC],              [AC_DEFUN([AC_LIBTOOL_RC])])
    8180m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],   [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
    8281m4_ifndef([_LT_AC_LANG_C_CONFIG],       [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
     
    9190m4_ifndef([AC_LIBTOOL_CONFIG],          [AC_DEFUN([AC_LIBTOOL_CONFIG])])
    9291m4_ifndef([_LT_AC_FILE_LTDLL_C],        [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
     92m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
     93m4_ifndef([_LT_AC_PROG_CXXCPP],         [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
     94m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
     95m4_ifndef([_LT_PROG_ECHO_BACKSLASH],    [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
     96m4_ifndef([_LT_PROG_F77],               [AC_DEFUN([_LT_PROG_F77])])
     97m4_ifndef([_LT_PROG_FC],                [AC_DEFUN([_LT_PROG_FC])])
     98m4_ifndef([_LT_PROG_CXX],               [AC_DEFUN([_LT_PROG_CXX])])
  • issm/branches/trunk-jpl-damage/scripts/DownloadExternalPackage.py

    r12258 r12878  
    22# -*- coding: ISO-8859-1 -*-
    33
    4 import os,sys
     4import os,sys,re
    55import urllib
     6from HTMLParser import HTMLParser
     7from urllib import FancyURLopener
    68
    7 #Check inputs
    8 if(len(sys.argv)!=3): raise NameError('usage: ./DownloadExternalPackage.py URL localfile')
     9# Start class myHTMLParser
     10class MyHTMLParser(HTMLParser):
    911
    10 url=sys.argv[1];
     12    def __init__(self, pattern):
     13        HTMLParser.__init__(self)
     14        self.matcher = re.compile(pattern)
     15        self.targets = []
     16
     17    def handle_starttag(self, tag, attrs):
     18        for i in attrs:
     19            if "href" == i[0] and str(self.matcher.match(i[1])) != "None":
     20                self.targets.append(i[1])
     21# End class myHTMLParser
     22
     23pivot = sys.argv[1].rfind("/")
     24url = (sys.argv[1])[:pivot]
    1125localFile=sys.argv[2]
    1226
    13 #Remove file if it already exists
    14 if os.path.exists(localFile):
    15         print "File "+ localFile +" already exists and will not be downloaded..."
    16         sys.exit()
     27pivot += 1;
     28find = (sys.argv[1])[pivot:];
     29print "Looking for " + find
     30pattern = find + "[\w.-]*(\.tar\.gz|tar\.gz2|tgz|zip|exe)?"
     31parser = MyHTMLParser(pattern)
    1732
    18 #Try to download from url
    19 httpfail=-1
    20 try:
    21         print "Fetching %s" % localFile
    22         urllib.urlretrieve(url,localFile)
    23         httpfail=0
    24 except Exception, e:
    25         httpfail=1
     33urlObject = FancyURLopener()
     34obj = urlObject.open(url)
     35parser.feed(obj.read())
    2636
    27 #Error message in case it failed
    28 if (httpfail):
    29         failureMessage = '''
    30 ===========================================================================
    31 Unable to download package %s from: %s
    32 * If URL specified manually - perhaps there is a typo?
    33 * If your network is disconnected - please reconnect
    34 * Alternatively, you can download the above URL manually
    35 ===========================================================================
    36 ''' % (localFile,url)
    37         raise RuntimeError(failureMessage)
     37if len(parser.targets) > 1:
     38    print "Could not resolve your download due to the number of hits."
     39    print "Refine your search."
     40    for i in parser.targets:
     41        print i
     42
     43elif len(parser.targets) == 1:
     44    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]
     53    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."
     57
     58else:
     59    print "No matches found!"
     60
     61obj.close()
  • issm/branches/trunk-jpl-damage/scripts/automakererun.sh

    r12168 r12878  
    33#  archive.
    44
     5# As it turns out, the autoreconf script provided by Autotools
     6# encompasses the functionality of this script. As such, the
     7# following two lines will replace the remainder of the script.
     8# If all goes well, then the script will be shortened in the future.
    59
    6  ACLOCAL="$ISSM_DIR/externalpackages/automake/install/bin/aclocal"
    7 AUTOCONF="$ISSM_DIR/externalpackages/autoconf/install/bin/autoconf"
    8 AUTOHEAD="$ISSM_DIR/externalpackages/autoconf/install/bin/autoheader"
    9 AUTOMAKE="$ISSM_DIR/externalpackages/automake/install/bin/automake"
    10 
    11 echo "removing config.cach"
    12 rm -rf config.cach
    13 rm -rf aclocal.m4
    14 
    15 if [ ! -f "$ACLOCAL" ]
    16 then echo "issm aclocal not found, calling default aclocal"
    17         aclocal -I m4
    18 else echo "Calling aclocal"
    19         $ACLOCAL -I m4
    20 fi
    21 
    22 if [ ! -f "$AUTOCONF" ]
    23 then echo "issm autoconf not found, calling default aclocal"
    24         autoconf
    25 else echo "Calling autoconf"
    26         $AUTOCONF
    27 fi
    28 
    29 if [ ! -f "$AUTOHEAD" ]
    30 then echo "issm autoheader not found, calling default aclocal"
    31         autoheader
    32 else echo "Calling autoheader"
    33         $AUTOHEAD
    34 fi
    35 
    36 if [ ! -f "$AUTOMAKE" ]
    37 then echo "issm automake  not found, calling default aclocal"
    38         automake
    39 else echo "Calling automake "
    40         $AUTOMAKE -a
    41 fi
     10cd $ISSM_DIR
     11autoreconf -iv -I m4
  • issm/branches/trunk-jpl-damage/scripts/getloc.sh

    r12168 r12878  
    11#!/bin/bash
    22#get number of lines of code
    3 cloc-1.55.pl $ISSM_DIR/src $ISSM_DIR/m4 --exclude-dir=.svn --exclude-ext=exp --exclude-lang=make --out=temp
     3cloc-1.55.pl $ISSM_DIR/src $ISSM_DIR/m4 --exclude-dir=.svn --exclude-dir=ad  --exclude-dir=android --exclude-ext=exp --exclude-lang=make --out=temp
    44cat temp
    55./cloc2html.py
  • issm/branches/trunk-jpl-damage/scripts/report.sh

    r12168 r12878  
    1919#Process matlab_log.log
    2020cat matlab_log.log        | egrep 'ERROR|SUCCESS|FAILURE' | grep -v "PETSC" | sed -e "s/>/\&gt;/g" | sed -e "s/</\&lt;/g" > matlab.log
     21cat matlab.log        | grep -v "SUCCESS" > matlab_short.log
    2122cat matlab_log.log        | grep "PETSC" | sed -e "s/>/\&gt;/g" | sed -e "s/</\&lt;/g" > petscerror.log
    2223NUM_TOT=`wc -l matlab.log | awk '{print $1}'`
     
    4849BODY_FONTL=`echo $BODY_FONT | sed -e "s/style=\"/style=\"text-align:left; /g"`
    4950
    50 #create some variables
    51 if [ $(ls -1 $ISSM_DIR/bin | wc -l) -le 20 ];
    52 then
     51#Did installation work?
     52if [ $(ls -1 $ISSM_DIR/bin | wc -l) -le 20 ]; then
    5353        IS_INSTALL=0
    5454else
    5555        IS_INSTALL=1
     56fi
     57
     58#display table ONLY if installation worked and there has been at leat one FAILURE or ERROR
     59IS_TABLE=0
     60if [ $IS_INSTALL -eq 1 ]; then
     61        if [ $NUM_TOT -gt 1 ]; then
     62                if [ $NUM_SUC -ne $NUM_TOT  ]; then
     63                        IS_TABLE=1
     64                fi
     65        fi
    5666fi
    5767
     
    96106
    97107#update status
    98 if [ $IS_INSTALL -eq 1 ]
    99 then
    100         if [ $CRASH -eq 0 ]
     108if [ $IS_INSTALL -eq 1 ];
     109then
     110        if [ $CRASH -eq 0 ];
    101111        then
    102112                cat summary.html | sed -e "s/STATUS/<span style=\"color:#008000\">all test desks have been run<\/span>/g" > summary2.html
     
    110120
    111121#report table
    112 if [ $IS_INSTALL -eq 1 ];
     122if [ $IS_TABLE -eq 1 ];
    113123then
    114124        cat << END > content.html
     
    122132<th $(echo $BODY_FONT)>Field checked</th>
    123133</tr>
    124 $(cat matlab.log | while read line
     134$(cat matlab_short.log | while read line
    125135  do
    126136          echo "<tr>"
     
    137147                  echo $line | awk -v FONTC="$FONTC" -v FONTL="$FONTL" '
    138148                  { printf("<td %s id=FAILURE>%s</td>\n<td %s>%s</td>\n<td %s>%s</td>\n<td %s>%s</td>\n<td %s>%s</td>\n\n",FONTL,$1,FONTC,$3,FONTC,$6,FONTL,$9,FONTL,$11);}
    139                           ';
    140 
    141                   else
     149                  ';
     150
     151          else
    142152
    143153                  #SUCCESS
     
    146156                          FONTC=$(echo "$BODY_FONTC bgcolor=#ddffdd")
    147157                          FONTL=$(echo "$BODY_FONTL bgcolor=#ddffdd")
     158                          #do not write anything
    148159                  #ERROR
    149160                  else
    150161                          FONTC=$(echo "$BODY_FONTC bgcolor=#ffdddd id=ERROR")
    151162                          FONTL=$(echo "$BODY_FONTL bgcolor=#ffdddd")
     163                          echo $line | awk -v FONTC="$FONTC" -v FONTL="$FONTL" '
     164                          { printf("<td %s>%s</td>\n<td %s>%s%s%s</td>\n<td %s>%s</td>\n<td %s>%s</td>\n<td %s>%s</td>\n\n",FONTL,$1,FONTL,$3,$4,$5,FONTC,$8,FONTL,$11,FONTL,$13);}
     165                          ';
    152166                  fi
    153167
    154 
    155                   echo $line | awk -v FONTC="$FONTC" -v FONTL="$FONTL" '
    156                   { printf("<td %s>%s</td>\n<td %s>%s%s%s</td>\n<td %s>%s</td>\n<td %s>%s</td>\n<td %s>%s</td>\n\n",FONTL,$1,FONTL,$3,$4,$5,FONTC,$8,FONTL,$11,FONTL,$13);}
    157                           ';
    158168          fi
    159 
    160169          echo "</tr>"
    161 
    162170  done
    163171          )
  • issm/branches/trunk-jpl-damage/src/Makefile.am

    r12168 r12878  
    1 EXTRA_DIST =  perl  pro
    2 SUBDIRS = c modules m  py
     1EXTRA_DIST =  perl  pro  py
     2SUBDIRS = c modules m
  • issm/branches/trunk-jpl-damage/src/ad/todo

    r11120 r12878  
    2929amatrix will be used in adolc. pmatrix will be used in Petsc routines. Matrix will
    3030have routines to map one into the other.
     31
     32
     33Ad:
     34Eric:
     35Create ISSM namespace.
     36Make Matrix Assembly one homogeneous block.
     37Make Validation suite for Jean for his prognostic capabilities.
     38Jean:
     39typedef all double to ISSM_DOUBLE
     40
     41Create an alloc layer with template functions for new and delete.
     42Check that the new code  is modular --without-kml, options are up to date.
     43
     44Replace memcpy, realloc with x layers.  Replace all calls to malloc and free in the code.
  • issm/branches/trunk-jpl-damage/src/c/Container/Constraints.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Constraints::Constraints(){{{1*/
     27/*FUNCTION Constraints::Constraints(){{{*/
    2828Constraints::Constraints(){
    2929        enum_type=ConstraintsEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Constraints::~Constraints(){{{1*/
     33/*FUNCTION Constraints::~Constraints(){{{*/
    3434Constraints::~Constraints(){
    3535        return;
     
    3838
    3939/*Numerics: */
    40 /*FUNCTION Constraints::NumberOfConstraints{{{1*/
     40/*FUNCTION Constraints::NumberOfConstraints{{{*/
    4141int Constraints::NumberOfConstraints(void){
    4242
  • issm/branches/trunk-jpl-damage/src/c/Container/Constraints.h

    r10522 r12878  
    2121        public:
    2222
    23                 /*constructors, destructors: {{{1*/
     23                /*constructors, destructors: {{{*/
    2424                Constraints();
    2525                ~Constraints();
    2626                /*}}}*/
    27                 /*numerics: {{{1*/
     27                /*numerics: {{{*/
    2828                int   NumberOfConstraints(void);
    2929                /*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/Container/Container.h

    r7737 r12878  
    66#define  _CONTAINER_CONTAINER_H_
    77
     8#include "../include/include.h"
    89#include "./DataSet.h"
    910#include "./Constraints.h"
     
    1718#include "./Results.h"
    1819#include "./Vertices.h"
     20#include "./Observations.h"
    1921
    2022#endif //ifndef _CONTAINER_H_
  • issm/branches/trunk-jpl-damage/src/c/Container/DataSet.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    1111#endif
    1212
     13#include <cstring>
    1314#include <vector>
    1415#include <functional>
     
    1718
    1819#include "./DataSet.h"
    19 #include "../objects/objects.h"
     20#include "../classes/objects/objects.h"
    2021#include "../shared/shared.h"
    2122#include "../io/io.h"
     
    2728
    2829/*Constructors/Destructors*/
    29 /*FUNCTION DataSet::DataSet(){{{1*/
     30/*FUNCTION DataSet::DataSet(){{{*/
    3031DataSet::DataSet(){
    3132       
     
    3637}
    3738/*}}}*/
    38 /*FUNCTION DataSet::DataSet(int dataset_enum){{{1*/
     39/*FUNCTION DataSet::DataSet(int dataset_enum){{{*/
    3940DataSet::DataSet(int dataset_enum){
    4041        enum_type=dataset_enum;
     
    4647}
    4748/*}}}*/
    48 /*FUNCTION DataSet::Copy{{{1*/
     49/*FUNCTION DataSet::Copy{{{*/
    4950DataSet*   DataSet::Copy(void){
    5051
     
    5859        copy->presorted=presorted;
    5960        if(sorted_ids){
    60                 copy->sorted_ids=(int*)xmalloc(objects.size()*sizeof(int));
    61                 memcpy(copy->sorted_ids,sorted_ids,objects.size()*sizeof(int));
     61                copy->sorted_ids=xNew<int>(objects.size());
     62                xMemCpy<int>(copy->sorted_ids,sorted_ids,objects.size());
    6263        }
    6364        if(id_offsets){
    64                 copy->id_offsets=(int*)xmalloc(objects.size()*sizeof(int));
    65                 memcpy(copy->id_offsets,id_offsets,objects.size()*sizeof(int));
     65                copy->id_offsets=xNew<int>(objects.size());
     66                xMemCpy<int>(copy->id_offsets,id_offsets,objects.size());
    6667        }
    6768
     
    7677}
    7778/*}}}*/
    78 /*FUNCTION DataSet::~DataSet{{{1*/
     79/*FUNCTION DataSet::~DataSet{{{*/
    7980DataSet::~DataSet(){
    8081        clear();
    81         xfree((void**)&sorted_ids);
    82         xfree((void**)&id_offsets);
     82        xDelete<int>(sorted_ids);
     83        xDelete<int>(id_offsets);
    8384}
    8485/*}}}*/
    8586
    8687/*Specific methods*/
    87 /*FUNCTION DataSet::AddObject{{{1*/
     88/*FUNCTION DataSet::AddObject{{{*/
    8889int  DataSet::AddObject(Object* object){
    8990
     
    9394}
    9495/*}}}*/
    95 /*FUNCTION DataSet::clear{{{1*/
     96/*FUNCTION DataSet::clear{{{*/
    9697void  DataSet::clear(){
    9798
     
    111112}
    112113/*}}}*/
    113 /*FUNCTION DataSet::DeleteObject{{{1*/
     114/*FUNCTION DataSet::DeleteObject{{{*/
    114115int  DataSet::DeleteObject(Object* object){
    115116
     
    126127}
    127128/*}}}*/
    128 /*FUNCTION DataSet::DeepEcho{{{1*/
     129/*FUNCTION DataSet::DeepEcho{{{*/
    129130void DataSet::DeepEcho(){
    130131
     
    132133        vector<Object*>::iterator object;
    133134
    134         if(this==NULL)_error_(" trying to echo a NULL dataset");
    135 
    136         _printf_(true,"DataSet echo: %i objects\n",objects.size());
     135        if(this==NULL)_error2_("trying to echo a NULL dataset");
     136
     137        _pprintLine_("DataSet echo: " << objects.size() << " objects");
    137138
    138139        for ( object=objects.begin() ; object < objects.end(); object++ ){
     
    144145}
    145146/*}}}*/
    146 /*FUNCTION DataSet::Echo{{{1*/
     147/*FUNCTION DataSet::Echo{{{*/
    147148void DataSet::Echo(){
    148149
    149150        vector<Object*>::iterator object;
    150151
    151         if(this==NULL)_error_(" trying to echo a NULL dataset");
    152 
    153         _printf_(true,"DataSet echo: %i objects\n",objects.size());
     152        if(this==NULL)_error2_("trying to echo a NULL dataset");
     153
     154        _pprintLine_("DataSet echo: " << objects.size() << " objects");
    154155
    155156        for ( object=objects.begin() ; object < objects.end(); object++ ){
     
    162163}
    163164/*}}}*/
    164 /*FUNCTION DataSet::GetEnum(){{{1*/
     165/*FUNCTION DataSet::GetEnum(){{{*/
    165166int  DataSet::GetEnum(){
    166167        return enum_type;
    167168}
    168169/*}}}*/
    169 /*FUNCTION DataSet::GetEnum(int offset){{{1*/
     170/*FUNCTION DataSet::GetEnum(int offset){{{*/
    170171int   DataSet::GetEnum(int offset){
    171172
     
    174175}
    175176/*}}}*/
    176 /*FUNCTION DataSet::GetObjectByOffset{{{1*/
     177/*FUNCTION DataSet::GetObjectByOffset{{{*/
    177178Object* DataSet::GetObjectByOffset(int offset){
    178179
     
    185186}
    186187/*}}}*/
    187 /*FUNCTION DataSet::GetObjectById{{{1*/
     188/*FUNCTION DataSet::GetObjectById{{{*/
    188189Object* DataSet::GetObjectById(int* poffset,int eid){
    189190
     
    193194
    194195        _assert_(this);
    195         if(!sorted)_error_(" trying to binary search on a non-sorted dataset!");
     196        if(!sorted)_error2_("trying to binary search on a non-sorted dataset!");
    196197
    197198        /*Carry out a binary search on the sorted_ids: */
    198199        if(!binary_search(&id_offset,eid, sorted_ids,objects.size())){
    199                 _error_("could not find object with id %i in DataSet %s",eid,EnumToStringx(enum_type));
     200                _error2_("could not find object with id " << eid << " in DataSet " << EnumToStringx(enum_type));
    200201        }
    201202
     
    210211}
    211212/*}}}*/
    212 /*FUNCTION DataSet::Presort{{{1*/
     213/*FUNCTION DataSet::Presort{{{*/
    213214void DataSet::Presort(){
    214215
     
    220221
    221222                /*Delete existing ids*/
    222                 xfree((void**)&sorted_ids);
    223                 xfree((void**)&id_offsets);
     223                xDelete<int>(sorted_ids);
     224                xDelete<int>(id_offsets);
    224225
    225226                /*Allocate new ids*/
    226                 sorted_ids=(int*)xmalloc(objects.size()*sizeof(int));
    227                 id_offsets=(int*)xmalloc(objects.size()*sizeof(int));
     227                sorted_ids=xNew<int>(objects.size());
     228                id_offsets=xNew<int>(objects.size());
    228229
    229230                /*Build id_offsets and sorted_ids*/
     
    238239}
    239240/*}}}*/
    240 /*FUNCTION DataSet::SetSorting{{{1*/
     241/*FUNCTION DataSet::SetSorting{{{*/
    241242void DataSet::SetSorting(int* in_sorted_ids,int* in_id_offsets){
    242243
     
    246247}
    247248/*}}}*/
    248 /*FUNCTION DataSet::Size{{{1*/
     249/*FUNCTION DataSet::Size{{{*/
    249250int  DataSet::Size(void){
    250251        _assert_(this!=NULL);
     
    253254}
    254255/*}}}*/
    255 /*FUNCTION DataSet::Sort{{{1*/
     256/*FUNCTION DataSet::Sort{{{*/
    256257void DataSet::Sort(){
    257258
    258259        /*Only sort if we are not already sorted: */
    259260        if(!sorted){
    260                 _error_(" not implemented yet!");
    261         }
    262 }
    263 /*}}}*/
     261                _error2_("not implemented yet!");
     262        }
     263}
     264/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/Container/DataSet.h

    r12168 r12878  
    77
    88#include <vector>
    9 #include "../objects/Object.h"
     9#include "../classes/objects/Object.h"
    1010#include "../toolkits/toolkits.h"
    1111#include "../EnumDefinitions/EnumDefinitions.h"
    1212
    1313/*forward declarations */
    14 
    1514class Elements;
    1615class Loads;
     
    3938                int*            id_offsets;
    4039
    41                 /*constructors, destructors: {{{1*/
     40                /*constructors, destructors: {{{*/
    4241                DataSet();
    4342                DataSet(int enum_type);
    4443                ~DataSet();
    4544                /*}}}*/
    46                 /*management: {{{1*/
     45                /*management: {{{*/
    4746                int   GetEnum();
    4847                int   GetEnum(int offset);
  • issm/branches/trunk-jpl-damage/src/c/Container/Elements.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Elements::Elements(){{{1*/
     27/*FUNCTION Elements::Elements(){{{*/
    2828Elements::Elements(){
    2929        enum_type=MeshElementsEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Elements::~Elements(){{{1*/
     33/*FUNCTION Elements::~Elements(){{{*/
    3434Elements::~Elements(){
    3535        return;
     
    3838
    3939/*Object management*/
    40 /*FUNCTION Elements::Configure{{{1*/
     40/*FUNCTION Elements::Configure{{{*/
    4141void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    4242
     
    5353}
    5454/*}}}*/
    55 /*FUNCTION Elements::ProcessResultsUnits{{{1*/
     55/*FUNCTION Elements::ProcessResultsUnits{{{*/
    5656void Elements::ProcessResultsUnits(void){
    5757
     
    6363}
    6464/*}}}*/
    65 /*FUNCTION Elements::DeleteResults{{{1*/
     65/*FUNCTION Elements::DeleteResults{{{*/
    6666void Elements::DeleteResults(void){
    6767       
     
    7272}
    7373/*}}}*/
    74 /*FUNCTION Elements::ResultsToPatch{{{1*/
     74/*FUNCTION Elements::ResultsToPatch{{{*/
    7575Patch* Elements::ResultsToPatch(void){
    7676
     
    148148}
    149149/*}}}*/
    150 /*FUNCTION Elements::SetCurrentConfiguration{{{1*/
     150/*FUNCTION Elements::SetCurrentConfiguration{{{*/
    151151void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    152152
     
    163163}
    164164/*}}}*/
    165 /*FUNCTION Elements::ToResults{{{1*/
     165/*FUNCTION Elements::ToResults{{{*/
    166166void Elements::ToResults(Results* results,Parameters* parameters){
    167167
     
    173173        int    *resultssizes  = NULL;
    174174        int    *resultssteps  = NULL;
    175         double *resultstimes = NULL;
    176         double *vector_serial= NULL;
     175        IssmDouble *resultstimes = NULL;
     176        IssmDouble *vector_serial= NULL;
    177177        Vector*     vector       = NULL;
    178178        bool   io_gather;
     
    203203                /*see what the first element of this partition has in stock (this is common to all partitions)*/
    204204                if(my_rank==minrank){
    205                         if(this->Size()==0) _error_("Cannot write results because there is no element??");
     205                        if(this->Size()==0) _error2_("Cannot write results because there is no element??");
    206206                        Element* element=(Element*)this->GetObjectByOffset(0);
    207207                        element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults);
     
    215215                #ifdef _HAVE_MPI_
    216216                if(my_rank!=minrank){
    217                         resultsenums=(int*)xmalloc(numberofresults*sizeof(int));
    218                         resultssizes=(int*)xmalloc(numberofresults*sizeof(int));
    219                         resultstimes=(double*)xmalloc(numberofresults*sizeof(double));
    220                         resultssteps=(int*)xmalloc(numberofresults*sizeof(int));
     217                        resultsenums=xNew<int>(numberofresults);
     218                        resultssizes=xNew<int>(numberofresults);
     219                        resultstimes=xNew<IssmDouble>(numberofresults);
     220                        resultssteps=xNew<int>(numberofresults);
    221221                }
    222222                MPI_Bcast(resultsenums,numberofresults,MPI_INT,minrank,MPI_COMM_WORLD);
     
    232232                        if(resultssizes[i]==P1Enum)      vectorsize=numberofvertices;
    233233                        else if(resultssizes[i]==P0Enum) vectorsize=numberofelements;
    234                         else _error_("Unkown result size: %s",EnumToStringx(resultssizes[i]));
     234                        else _error2_("Unkown result size: " << EnumToStringx(resultssizes[i]));
    235235                        vector=new Vector(vectorsize);
    236236
    237237                        for(int j=0;j<this->Size();j++){
    238238                                Element* element=(Element*)this->GetObjectByOffset(j);
    239                                 element->GetVectorFromResults(vector,i,resultssizes[i]);
     239                                element->GetVectorFromResults(vector,i,resultsenums[i],resultssizes[i]);
    240240                        }
    241241                        vector->Assemble();
     
    250250                        /*clean up*/
    251251                        xdelete(&vector);
    252                         xfree((void**)&vector_serial);
     252                        xDelete<IssmDouble>(vector_serial);
    253253                }
    254254        }
     
    269269
    270270        /*Free ressources:*/
    271         xfree((void**)&resultsenums);
    272         xfree((void**)&resultssizes);
    273         xfree((void**)&resultstimes);
    274         xfree((void**)&resultssteps);
     271        xDelete<int>(resultsenums);
     272        xDelete<int>(resultssizes);
     273        xDelete<int>(resultssteps);
     274        xDelete<IssmDouble>(resultstimes);
    275275        delete patch;
    276276}
    277277/*}}}*/
    278 /*FUNCTION Elements::NumberOfElements{{{1*/
     278/*FUNCTION Elements::NumberOfElements{{{*/
    279279int Elements::NumberOfElements(void){
    280280
     
    292292}
    293293/*}}}*/
    294 /*FUNCTION Elements::InputCopy{{{1*/
     294/*FUNCTION Elements::InputCopy{{{*/
    295295void Elements::InputDuplicate(int input_enum,int output_enum){
    296296
  • issm/branches/trunk-jpl-damage/src/c/Container/Elements.h

    r10989 r12878  
    1616class Inputs;
    1717
    18 
    1918class Elements: public DataSet{
    2019
    2120        public:
    2221
    23                 /*constructors, destructors: {{{1*/
     22                /*constructors, destructors: {{{*/
    2423                Elements();
    2524                ~Elements();
    2625                /*}}}*/
    27                 /*numerics: {{{1*/
     26                /*numerics: {{{*/
    2827                void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2928                void DeleteResults(void);
  • issm/branches/trunk-jpl-damage/src/c/Container/Inputs.cpp

    r10522 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Inputs::Inputs(){{{1*/
     27/*FUNCTION Inputs::Inputs(){{{*/
    2828Inputs::Inputs(){
    2929        return;
    3030}
    3131/*}}}*/
    32 /*FUNCTION Inputs::~Inputs(){{{1*/
     32/*FUNCTION Inputs::~Inputs(){{{*/
    3333Inputs::~Inputs(){
    3434        return;
     
    3737
    3838/*Object management*/
    39 /*FUNCTION Inputs::GetInputValue(bool* pvalue,int enum-type){{{1*/
     39/*FUNCTION Inputs::GetInputValue(bool* pvalue,int enum-type){{{*/
    4040void Inputs::GetInputValue(bool* pvalue,int enum_type){
    4141
     
    5757                /*we could not find an input with the correct enum type. No defaults values were provided,
    5858                 * error out: */
    59                 _error_("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));
     59                _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")");
    6060        }
    6161
     
    6565}
    6666/*}}}*/
    67 /*FUNCTION Inputs::GetInputValue(int* pvalue,int enum-type){{{1*/
     67/*FUNCTION Inputs::GetInputValue(int* pvalue,int enum-type){{{*/
    6868void Inputs::GetInputValue(int* pvalue,int enum_type){
    6969
     
    8585                /*we could not find an input with the correct enum type. No defaults values were provided,
    8686                 * error out: */
    87                 _error_("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));
     87                _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")");
    8888        }
    8989
     
    9393}
    9494/*}}}*/
    95 /*FUNCTION Inputs::GetInputValue(double* pvalue,int enum-type){{{1*/
    96 void Inputs::GetInputValue(double* pvalue,int enum_type){
     95/*FUNCTION Inputs::GetInputValue(IssmDouble* pvalue,int enum-type){{{*/
     96void Inputs::GetInputValue(IssmDouble* pvalue,int enum_type){
    9797
    9898        vector<Object*>::iterator object;
     
    113113                /*we could not find an input with the correct enum type. No defaults values were provided,
    114114                 * error out: */
    115                 _error_("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));
     115                _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")");
    116116        }
    117117
     
    121121}
    122122/*}}}*/
    123 /*FUNCTION Inputs::GetInputAverage{{{1*/
    124 void Inputs::GetInputAverage(double* pvalue,int enum_type){
     123/*FUNCTION Inputs::GetInputAverage{{{*/
     124void Inputs::GetInputAverage(IssmDouble* pvalue,int enum_type){
    125125
    126126        vector<Object*>::iterator object;
     
    141141                /*we could not find an input with the correct enum type. No defaults values were provided,
    142142                 * error out: */
    143                 _error_("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));
     143                _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")");
    144144        }
    145145
     
    149149}
    150150/*}}}*/
    151 /*FUNCTION Inputs::AddInput{{{1*/
     151/*FUNCTION Inputs::AddInput{{{*/
    152152int  Inputs::AddInput(Input* in_input){
    153153
     
    175175}
    176176/*}}}*/
    177 /*FUNCTION Inputs::ChangeEnum{{{1*/
     177/*FUNCTION Inputs::ChangeEnum{{{*/
    178178void  Inputs::ChangeEnum(int oldenumtype,int newenumtype){
    179179
     
    205205}
    206206/*}}}*/
    207 /*FUNCTION Inputs::ConstrainMin{{{1*/
    208 void  Inputs::ConstrainMin(int constrain_enum, double minimum){
     207/*FUNCTION Inputs::ConstrainMin{{{*/
     208void  Inputs::ConstrainMin(int constrain_enum, IssmDouble minimum){
    209209           
    210210        Input* constrain_input=NULL;
     
    213213
    214214        /*some checks: */
    215         if(!constrain_input) _error_(" input %s could not be found!",EnumToStringx(constrain_enum));
     215        if(!constrain_input) _error2_("input " << EnumToStringx(constrain_enum) << " could not be found!");
    216216
    217217        /*Apply ContrainMin: */
     
    219219}
    220220/*}}}*/
    221 /*FUNCTION Inputs::InfinityNorm{{{1*/
    222 double Inputs::InfinityNorm(int enumtype){
    223 
    224         /*Output*/
    225         double norm;
     221/*FUNCTION Inputs::InfinityNorm{{{*/
     222IssmDouble Inputs::InfinityNorm(int enumtype){
     223
     224        /*Output*/
     225        IssmDouble norm;
    226226
    227227        /*Get input*/
     
    240240}
    241241/*}}}*/
    242 /*FUNCTION Inputs::Max{{{1*/
    243 double Inputs::Max(int enumtype){
    244 
    245         /*Output*/
    246         double max;
     242/*FUNCTION Inputs::Max{{{*/
     243IssmDouble Inputs::Max(int enumtype){
     244
     245        /*Output*/
     246        IssmDouble max;
    247247
    248248        /*Get input*/
     
    254254        }
    255255        else{
    256                 _error_("Input %s not found",EnumToStringx(enumtype));
     256                _error2_("Input " << EnumToStringx(enumtype) << " not found");
    257257        }
    258258
     
    261261}
    262262/*}}}*/
    263 /*FUNCTION Inputs::MaxAbs{{{1*/
    264 double Inputs::MaxAbs(int enumtype){
    265 
    266         /*Output*/
    267         double max;
     263/*FUNCTION Inputs::MaxAbs{{{*/
     264IssmDouble Inputs::MaxAbs(int enumtype){
     265
     266        /*Output*/
     267        IssmDouble max;
    268268
    269269        /*Get input*/
     
    275275        }
    276276        else{
    277                 _error_("Input %s not found",EnumToStringx(enumtype));
     277                _error2_("Input " << EnumToStringx(enumtype) << " not found");
    278278        }
    279279
     
    282282}
    283283/*}}}*/
    284 /*FUNCTION Inputs::Min{{{1*/
    285 double Inputs::Min(int enumtype){
    286 
    287         /*Output*/
    288         double min;
     284/*FUNCTION Inputs::Min{{{*/
     285IssmDouble Inputs::Min(int enumtype){
     286
     287        /*Output*/
     288        IssmDouble min;
    289289
    290290        /*Get input*/
     
    296296        }
    297297        else{
    298                 _error_("Input %s not found",EnumToStringx(enumtype));
     298                _error2_("Input " << EnumToStringx(enumtype) << " not found");
    299299        }
    300300
     
    303303}
    304304/*}}}*/
    305 /*FUNCTION Inputs::MinAbs{{{1*/
    306 double Inputs::MinAbs(int enumtype){
    307 
    308         /*Output*/
    309         double min;
     305/*FUNCTION Inputs::MinAbs{{{*/
     306IssmDouble Inputs::MinAbs(int enumtype){
     307
     308        /*Output*/
     309        IssmDouble min;
    310310
    311311        /*Get input*/
     
    317317        }
    318318        else{
    319                 _error_("Input %s not found",EnumToStringx(enumtype));
     319                _error2_("Input " << EnumToStringx(enumtype) << " not found");
    320320        }
    321321
     
    324324}
    325325/*}}}*/
    326 /*FUNCTION Inputs::GetInput{{{1*/
     326/*FUNCTION Inputs::GetInput{{{*/
    327327Input* Inputs::GetInput(int enum_name){
    328328
     
    341341}
    342342/*}}}*/
    343 /*FUNCTION Inputs::DeleteInput{{{1*/
     343/*FUNCTION Inputs::DeleteInput{{{*/
    344344int  Inputs::DeleteInput(int enum_type){
    345345
     
    361361}
    362362/*}}}*/
    363 /*FUNCTION Inputs::DuplicateInput{{{1*/
     363/*FUNCTION Inputs::DuplicateInput{{{*/
    364364void  Inputs::DuplicateInput(int original_enum,int new_enum){
    365365
     
    369369        /*Make a copy of the original input: */
    370370        original=(Input*)this->GetInput(original_enum);
    371         if(!original)_error_("could not find input with enum: %s",EnumToStringx(original_enum));
     371        if(!original)_error2_("could not find input with enum: " << EnumToStringx(original_enum));
    372372        copy=(Input*)original->copy();
    373373
     
    379379}
    380380/*}}}*/
    381 /*FUNCTION Inputs::SpawnTriaInputs{{{1*/
     381/*FUNCTION Inputs::SpawnTriaInputs{{{*/
    382382Inputs* Inputs::SpawnTriaInputs(int* indices){
    383383
     
    405405}
    406406/*}}}*/
    407 /*FUNCTION Inputs::AXPY{{{1*/
    408 void  Inputs::AXPY(int MeshYEnum, double scalar, int MeshXEnum){
     407/*FUNCTION Inputs::AXPY{{{*/
     408void  Inputs::AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum){
    409409           
    410410        Input* xinput=NULL;
     
    416416
    417417        /*some checks: */
    418         if(!xinput) _error_(" input %s could not be found!",EnumToStringx(MeshXEnum));
    419         if(!yinput) _error_(" input %s could not be found!",EnumToStringx(MeshYEnum));
     418        if(!xinput) _error2_("input " << EnumToStringx(MeshXEnum) << " could not be found!");
     419        if(!yinput) _error2_("input " << EnumToStringx(MeshYEnum) << " could not be found!");
    420420
    421421        /*Apply AXPY: */
     
    423423}
    424424/*}}}*/
    425 /*FUNCTION Inputs::Configure{{{1*/
     425/*FUNCTION Inputs::Configure{{{*/
    426426void Inputs::Configure(Parameters* parameters){
    427427
  • issm/branches/trunk-jpl-damage/src/c/Container/Inputs.h

    r10522 r12878  
    2323        public:
    2424
    25                 /*constructors, destructors: {{{1*/
     25                /*constructors, destructors: {{{*/
    2626                Inputs();
    2727                ~Inputs();
    2828
    2929                /*}}}*/
    30                 /*numerics: {{{1*/
     30                /*numerics: {{{*/
    3131                int     AddInput(Input* in_input);
    3232                void    ChangeEnum(int enumtype,int new_enumtype);
    33                 void    ConstrainMin(int constrain_enum, double minimum);
     33                void    ConstrainMin(int constrain_enum, IssmDouble minimum);
    3434                int     DeleteInput(int enum_type);
    3535                void    DuplicateInput(int original_enum,int new_enum);
    3636                Input*  GetInput(int enum_name);
    3737                Inputs* SpawnTriaInputs(int* indices);
    38                 void    AXPY(int MeshYEnum, double scalar, int MeshXEnum);
    39                 double  InfinityNorm(int enumtype);
    40                 double  Max(int enumtype);
    41                 double  MaxAbs(int enumtype);
    42                 double  Min(int enumtype);
    43                 double  MinAbs(int enumtype);
     38                void    AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum);
     39                IssmDouble  InfinityNorm(int enumtype);
     40                IssmDouble  Max(int enumtype);
     41                IssmDouble  MaxAbs(int enumtype);
     42                IssmDouble  Min(int enumtype);
     43                IssmDouble  MinAbs(int enumtype);
    4444               
    45                 void GetInputAverage(double* pvalue, int enum_type);
     45                void GetInputAverage(IssmDouble* pvalue, int enum_type);
    4646                void GetInputValue(bool* pvalue,int enum_type);
    4747                void GetInputValue(int* pvalue,int enum_type);
    48                 void GetInputValue(double* pvalue,int enum_type);
     48                void GetInputValue(IssmDouble* pvalue,int enum_type);
    4949
    5050                void Configure(Parameters* parameters);
  • issm/branches/trunk-jpl-damage/src/c/Container/Loads.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Loads::Loads(){{{1*/
     27/*FUNCTION Loads::Loads(){{{*/
    2828Loads::Loads(){
    2929        enum_type=LoadsEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Loads::~Loads(){{{1*/
     33/*FUNCTION Loads::~Loads(){{{*/
    3434Loads::~Loads(){
    3535        return;
     
    3838
    3939/*Numerics:*/
    40 /*FUNCTION Loads::Configure{{{1*/
     40/*FUNCTION Loads::Configure{{{*/
    4141void Loads::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    4242
     
    5353}
    5454/*}}}*/
    55 /*FUNCTION Loads::NumberOfLoads{{{1*/
     55/*FUNCTION Loads::NumberOfLoads{{{*/
    5656int Loads::NumberOfLoads(void){
    5757
     
    7474}
    7575/*}}}*/
    76 /*FUNCTION Loads::SetCurrentConfiguration{{{1*/
     76/*FUNCTION Loads::SetCurrentConfiguration{{{*/
    7777void Loads::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    7878
  • issm/branches/trunk-jpl-damage/src/c/Container/Loads.h

    r10522 r12878  
    2020        public:
    2121
    22                 /*constructors, destructors: {{{1*/
     22                /*constructors, destructors: {{{*/
    2323                Loads();
    2424                ~Loads();
    2525                /*}}}*/
    26                 /*numerics: {{{1*/
     26                /*numerics: {{{*/
    2727                void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2828                int   NumberOfLoads(void);
  • issm/branches/trunk-jpl-damage/src/c/Container/Materials.cpp

    r10522 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Materials::Materials(){{{1*/
     27/*FUNCTION Materials::Materials(){{{*/
    2828Materials::Materials(){
    2929        enum_type=MaterialsEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Materials::~Materials(){{{1*/
     33/*FUNCTION Materials::~Materials(){{{*/
    3434Materials::~Materials(){
    3535        return;
     
    3838
    3939/*Object management*/
    40 /*FUNCTION Materials::Configure{{{1*/
     40/*FUNCTION Materials::Configure{{{*/
    4141void Materials::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    4242
  • issm/branches/trunk-jpl-damage/src/c/Container/Materials.h

    r10522 r12878  
    1919        public:
    2020
    21                 /*constructors, destructors: {{{1*/
     21                /*constructors, destructors: {{{*/
    2222                Materials();
    2323                ~Materials();
    2424                /*}}}*/
    25                 /*numerics: {{{1*/
     25                /*numerics: {{{*/
    2626                void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2727                /*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/Container/Nodes.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Nodes::Nodes(){{{1*/
     27/*FUNCTION Nodes::Nodes(){{{*/
    2828Nodes::Nodes(){
    2929        enum_type=NodesEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Nodes::~Nodes(){{{1*/
     33/*FUNCTION Nodes::~Nodes(){{{*/
    3434Nodes::~Nodes(){
    3535        return;
     
    3838
    3939/*Numerics*/
    40 /*FUNCTION Nodes::Configure{{{1*/
     40/*FUNCTION Nodes::Configure{{{*/
    4141void Nodes::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    4242
     
    5353}
    5454/*}}}*/
    55 /*FUNCTION Nodes::DistributeDofs{{{1*/
     55/*FUNCTION Nodes::DistributeDofs{{{*/
    5656void  Nodes::DistributeDofs(int analysis_type,int setenum){
    5757
     
    8484         * cpus by the total last dofs of the previus cpu, starting from 0.
    8585         * First: get number of dofs for each cpu*/
    86         alldofcount=(int*)xmalloc(num_procs*sizeof(int));
     86        alldofcount=xNew<int>(num_procs);
    8787        #ifdef _HAVE_MPI_
    8888        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD);
     
    113113        numnodes=this->NumberOfNodes(analysis_type);
    114114        if(numnodes*maxdofspernode){
    115                 truedofs=   (int*)xcalloc(numnodes*maxdofspernode,sizeof(int)); //initialize to 0, so that we can pick up the max
    116                 alltruedofs=(int*)xcalloc(numnodes*maxdofspernode,sizeof(int));
     115                truedofs=   xNewZeroInit<int>(numnodes*maxdofspernode); //initialize to 0, so that we can pick up the max
     116                alltruedofs=xNewZeroInit<int>(numnodes*maxdofspernode);
    117117        }
    118118
     
    139139
    140140        /* Free ressources: */
    141         xfree((void**)&alldofcount);
    142         xfree((void**)&truedofs);
    143         xfree((void**)&alltruedofs);
    144 }
    145 /*}}}*/
    146 /*FUNCTION Nodes::FlagClones{{{1*/
     141        xDelete<int>(alldofcount);
     142        xDelete<int>(truedofs);
     143        xDelete<int>(alltruedofs);
     144}
     145/*}}}*/
     146/*FUNCTION Nodes::FlagClones{{{*/
    147147void  Nodes::FlagClones(int analysis_type){
    148148
     
    158158
    159159        /*Allocate ranks: */
    160         ranks=(int*)xmalloc(numnodes*sizeof(int));
    161         minranks=(int*)xmalloc(numnodes*sizeof(int));
     160        ranks=xNew<int>(numnodes);
     161        minranks=xNew<int>(numnodes);
    162162
    163163        for(i=0;i<numnodes;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit.
     
    190190
    191191        /*Free ressources: */
    192         xfree((void**)&ranks);
    193         xfree((void**)&minranks);
    194 
    195 }
    196 /*}}}*/
    197 /*FUNCTION Nodes::MaxNumDofs{{{1*/
     192        xDelete<int>(ranks);
     193        xDelete<int>(minranks);
     194
     195}
     196/*}}}*/
     197/*FUNCTION Nodes::MaxNumDofs{{{*/
    198198int   Nodes::MaxNumDofs(int analysis_type,int setenum){
    199199
     
    225225}
    226226/*}}}*/
    227 /*FUNCTION Nodes::NumberOfDofs{{{1*/
     227/*FUNCTION Nodes::NumberOfDofs{{{*/
    228228int   Nodes::NumberOfDofs(int analysis_type,int setenum){
    229229
     
    259259}
    260260/*}}}*/
    261 /*FUNCTION Nodes::NumberOfNodes(){{{1*/
     261/*FUNCTION Nodes::NumberOfNodes(){{{*/
    262262int Nodes::NumberOfNodes(void){
    263263
     
    287287}
    288288/*}}}*/
    289 /*FUNCTION Nodes::NumberOfNodes(analysis){{{1*/
     289/*FUNCTION Nodes::NumberOfNodes(analysis){{{*/
    290290int Nodes::NumberOfNodes(int analysis_type){
    291291
     
    326326}
    327327/*}}}*/
    328 /*FUNCTION Nodes::Ranks{{{1*/
     328/*FUNCTION Nodes::Ranks{{{*/
    329329void   Nodes::Ranks(int* ranks,int analysis_type){
    330330
     
    352352}
    353353/*}}}*/
    354 /*FUNCTION Nodes::SetCurrentConfiguration{{{1*/
     354/*FUNCTION Nodes::SetCurrentConfiguration{{{*/
    355355void Nodes::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
    356356
  • issm/branches/trunk-jpl-damage/src/c/Container/Nodes.h

    r10522 r12878  
    1313        public:
    1414
    15                 /*constructors, destructors: {{{1*/
     15                /*constructors, destructors: {{{*/
    1616                Nodes();
    1717                ~Nodes();
    1818                /*}}}*/
    19                 /*numerics: {{{1*/
     19                /*numerics: {{{*/
    2020                void  Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2121                void  DistributeDofs(int analysis_type,int SETENUM);
  • issm/branches/trunk-jpl-damage/src/c/Container/Observations.cpp

    r12280 r12878  
    2020#include "../shared/shared.h"
    2121#include "../include/include.h"
     22#include "../modules/modules.h"
    2223#include "../EnumDefinitions/EnumDefinitions.h"
     24#include "../io/io.h"
    2325
    2426using namespace std;
     
    3234}
    3335/*}}}*/
    34 /*FUNCTION Observations::Observations(double* observations_list,double* x,double* y,int n,Options* options){{{*/
    35 Observations::Observations(double* observations_list,double* x,double* y,int n,Options* options){
     36/*FUNCTION Observations::Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options){{{*/
     37Observations::Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options){
    3638
    3739        /*Intermediaries*/
    38         int          i,maxdepth,level,counter;
     40        int          i,j,maxdepth,level,counter,index;
    3941        int          xi,yi;
    40         double       xmin,xmax,ymin,ymax;
    41         double       offset,minlength;
     42        IssmDouble       xmin,xmax,ymin,ymax;
     43        IssmDouble       offset,minlength,minspacing,mintrimming,maxtrimming;
    4244        Observation *observation = NULL;
    4345
     
    5254        offset=0.05*(ymax-ymin); ymin-=offset; ymax+=offset;
    5355
     56        /*Get trimming limits*/
     57        options->Get(&mintrimming,"mintrimming",-1.e+21);
     58        options->Get(&maxtrimming,"maxtrimming",+1.e+21);
     59        options->Get(&minspacing,"minspacing",0.01);
     60        if(minspacing<=0) _error2_("minspacing must > 0");
     61
    5462        /*Get Minimum box size*/
    5563        if(options->GetOption("boxlength")){
    5664                options->Get(&minlength,"boxlength");
    57                 if(minlength<=0)_error_("boxlength should be a positive number");
     65                if(minlength<=0)_error2_("boxlength should be a positive number");
    5866                maxdepth=int(log(max(xmax-xmin,ymax-ymin)/minlength +1)/log(2.0));
    5967        }
    6068        else{
    6169                maxdepth = 30;
    62                 minlength=max(xmax-xmin,ymax-ymin)/double((1L<<maxdepth)-1);
     70                minlength=max(xmax-xmin,ymax-ymin)/IssmDouble((1L<<maxdepth)-1);
    6371        }
    6472
    6573        /*Initialize Quadtree*/
    66         printf("Generating quadtree with a maximum box size %g (depth=%i)... ",minlength,maxdepth);
     74        _pprintString_("Generating quadtree with a maximum box size " << minlength << " (depth=" << maxdepth << ")... ");
    6775        this->quadtree = new Quadtree(xmin,xmax,ymin,ymax,maxdepth);
    6876
     
    7078        counter = 0;
    7179        for(i=0;i<n;i++){
     80
     81                /*First check limits*/
     82                if(observations_list[i]>maxtrimming) continue;
     83                if(observations_list[i]<mintrimming) continue;
     84
     85                /*First check that this observation is not too close from another one*/
     86                this->quadtree->ClosestObs(&index,x[i],y[i]);
     87                if(index>=0){
     88                        observation=(Observation*)this->GetObjectByOffset(index);
     89                        if(pow(observation->x-x[i],2)+pow(observation->y-y[i],2) < minspacing) continue;
     90                }
     91
    7292                this->quadtree->IntergerCoordinates(&xi,&yi,x[i],y[i]);
    7393                this->quadtree->QuadtreeDepth2(&level,xi,yi);
     
    82102                }
    83103        }
    84         printf("done\n");
     104        _pprintLine_("done");
     105        _pprintLine_("Initial number of observations: " << n);
     106        _pprintLine_("  Final number of observations: " << this->quadtree->NbObs);
    85107}
    86108/*}}}*/
     
    93115
    94116/*Methods*/
    95 /*FUNCTION Observations::ObservationList{{{*/
    96 void Observations::ObservationList(double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double range){
     117/*FUNCTION Observations::ClosestObservation{{{*/
     118void Observations::ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius){
    97119
    98120        /*Output and Intermediaries*/
     121        bool         stop;
    99122        int          nobs,i,index;
    100         double      *x            = NULL;
    101         double      *y            = NULL;
    102         double      *obs          = NULL;
     123        IssmDouble       h2,hmin2,radius2;
     124        int         *indices      = NULL;
    103125        Observation *observation  = NULL;
     126
     127        /*If radius is not provided or is 0, return all observations*/
     128        if(radius==0) radius=this->quadtree->root->length;
     129
     130        /*Compute radius square*/
     131        radius2 = radius*radius;
     132
     133        /*Find all observations that are in radius*/
     134        this->quadtree->RangeSearch(&indices,&nobs,x_interp,y_interp,radius);
     135        for (i=0;i<nobs;i++){
     136                observation=(Observation*)this->GetObjectByOffset(indices[i]);
     137                h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp);
     138
     139                if(i==0){
     140                        hmin2 = h2;
     141                        index = i;
     142                }
     143                else{
     144                        if(h2<hmin2){
     145                                hmin2 = h2;
     146                                index = i;
     147                        }
     148                }
     149        } 
     150
     151        /*Assign output pointer*/
     152        if(!nobs){
     153                *px=UNDEF;
     154                *py=UNDEF;
     155                *pobs=UNDEF;
     156        }
     157        else{
     158                observation=(Observation*)this->GetObjectByOffset(indices[index]);
     159                *px=observation->x;
     160                *py=observation->y;
     161                *pobs=observation->value;
     162        }
     163        xDelete<int>(indices);
     164
     165}/*}}}*/
     166/*FUNCTION Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata){{{*/
     167void Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata){
     168
     169        /*Output and Intermediaries*/
     170        bool         stop;
     171        int          nobs,tempnobs,i,j,k,n,counter;
     172        IssmDouble       h2,radius2;
    104173        int         *indices      = NULL;
    105 
    106         /*Treat range*/
    107         if(range==0){
    108                 range=this->quadtree->root->length;
    109         }
    110 
    111         /*Find all observations that are in range*/
    112         this->quadtree->RangeSearch(&indices,&nobs,x_interp,y_interp,range);
    113 
    114         if(nobs==0){
    115                 /*No observation found, double range*/
    116                 //printf("No observation found within range, doubling range\n");
    117                 xfree((void**)&indices);
    118                 this->ObservationList(&x,&y,&obs,&nobs,x_interp,y_interp,range*2);
    119         }
    120         else{
    121                 //if(nobs>1000) printf("Taking more than 1000 observations\n");
     174        int         *tempindices  = NULL;
     175        IssmDouble      *dists        = NULL;
     176        IssmDouble      *x            = NULL;
     177        IssmDouble      *y            = NULL;
     178        IssmDouble      *obs          = NULL;
     179        Observation *observation  = NULL;
     180
     181        /*If radius is not provided or is 0, return all observations*/
     182        if(radius==0) radius=this->quadtree->root->length;
     183
     184        /*Compute radius square*/
     185        radius2 = radius*radius;
     186
     187        /*Find all observations that are in radius*/
     188        this->quadtree->RangeSearch(&tempindices,&tempnobs,x_interp,y_interp,radius);
     189        if(tempnobs){
     190                indices = xNew<int>(tempnobs);
     191                dists   = xNew<IssmDouble>(tempnobs);
     192        }
     193        nobs = 0;
     194        for (i=0;i<tempnobs;i++){
     195                observation=(Observation*)this->GetObjectByOffset(tempindices[i]);
     196                h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp);
     197
     198                if(nobs==maxdata && h2>radius2) continue;
     199                if(nobs<=maxdata){
     200                        indices[nobs]   = tempindices[i];
     201                        dists[nobs]     = h2;
     202                        nobs++;
     203                }
     204                if(nobs==1) continue;
     205
     206                /*Sort all dists up to now*/
     207                n=nobs-1;
     208                stop = false;
     209                for(k=0;k<n-1;k++){
     210                        if(h2<dists[k]){
     211                                counter=1;
     212                                for(int jj=k;jj<n;jj++){
     213                                        j  = n-counter;
     214                                        dists[j+1]   = dists[j];
     215                                        indices[j+1] = indices[j];
     216                                        counter++;
     217                                }
     218                                dists[k]   = h2;
     219                                indices[k] = tempindices[i];
     220                                stop = true;
     221                                break;
     222                        }
     223                        if(stop) break;
     224                }
     225        } 
     226        xDelete<IssmDouble>(dists);
     227        xDelete<int>(tempindices);
     228
     229        if(nobs){
    122230                /*Allocate vectors*/
    123                 x   = (double*)xmalloc(nobs*sizeof(double));
    124                 y   = (double*)xmalloc(nobs*sizeof(double));
    125                 obs = (double*)xmalloc(nobs*sizeof(double));
     231                x   = xNew<IssmDouble>(nobs);
     232                y   = xNew<IssmDouble>(nobs);
     233                obs = xNew<IssmDouble>(nobs);
    126234
    127235                /*Loop over all observations and fill in x, y and obs*/
     
    133241
    134242        /*Assign output pointer*/
    135         xfree((void**)&indices);
     243        xDelete<int>(indices);
    136244        *px=x;
    137245        *py=y;
     
    139247        *pnobs=nobs;
    140248}/*}}}*/
     249/*FUNCTION Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs){{{*/
     250void Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs){
     251
     252        /*Output and Intermediaries*/
     253        int          nobs;
     254        IssmDouble      *x            = NULL;
     255        IssmDouble      *y            = NULL;
     256        IssmDouble      *obs          = NULL;
     257        Observation *observation  = NULL;
     258
     259        nobs = this->Size();
     260
     261        if(nobs){
     262                x   = xNew<IssmDouble>(nobs);
     263                y   = xNew<IssmDouble>(nobs);
     264                obs = xNew<IssmDouble>(nobs);
     265                for(int i=0;i<this->Size();i++){
     266                        observation=(Observation*)this->GetObjectByOffset(i);
     267                        observation->WriteXYObs(&x[i],&y[i],&obs[i]);
     268                }
     269        }
     270
     271        /*Assign output pointer*/
     272        *px=x;
     273        *py=y;
     274        *pobs=obs;
     275        *pnobs=nobs;
     276}/*}}}*/
     277/*FUNCTION Observations::InterpolationIDW{{{*/
     278void Observations::InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power){
     279
     280        /*Intermediaries*/
     281        int    i,n_obs;
     282        IssmDouble prediction;
     283        IssmDouble numerator,denominator,h,weight;
     284        IssmDouble *x   = NULL;
     285        IssmDouble *y   = NULL;
     286        IssmDouble *obs = NULL;
     287
     288        /*Some checks*/
     289        _assert_(maxdata>0);
     290        _assert_(pprediction);
     291        _assert_(power>0);
     292
     293        /*If radius is not provided or is 0, return all observations*/
     294        if(radius==0) radius=this->quadtree->root->length;
     295
     296        /*Get list of observations for current point*/
     297        this->ObservationList(&x,&y,&obs,&n_obs,x_interp,y_interp,radius,maxdata);
     298
     299        /*If we have less observations than mindata, return UNDEF*/
     300        if(n_obs<mindata){
     301                prediction = UNDEF;
     302        }
     303        else{
     304                numerator   = 0.;
     305                denominator = 0.;
     306                for(i=0;i<n_obs;i++){
     307                        h = sqrt( (x[i]-x_interp)*(x[i]-x_interp) + (y[i]-y_interp)*(y[i]-y_interp));
     308                        if (h<0.0000001){
     309                                numerator   = obs[i];
     310                                denominator = 1.;
     311                                break;
     312                        }
     313                        weight = 1./pow(h,power);
     314                        numerator   += weight*obs[i];
     315                        denominator += weight;
     316                }
     317                prediction = numerator/denominator;
     318        }
     319
     320        /*clean-up*/
     321        *pprediction = prediction;
     322        xDelete<IssmDouble>(x);
     323        xDelete<IssmDouble>(y);
     324        xDelete<IssmDouble>(obs);
     325}/*}}}*/
     326/*FUNCTION Observations::InterpolationKriging{{{*/
     327void Observations::InterpolationKriging(IssmDouble *pprediction,IssmDouble *perror,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,Variogram* variogram){
     328
     329        /*Intermediaries*/
     330        int           i,j,n_obs;
     331        IssmDouble        prediction,error;
     332        IssmDouble        numerator,denominator,ratio;
     333        IssmDouble       *x            = NULL;
     334        IssmDouble       *y            = NULL;
     335        IssmDouble       *obs          = NULL;
     336        IssmDouble       *Gamma        = NULL;
     337        IssmDouble       *GinvG0       = NULL;
     338        IssmDouble       *Ginv1        = NULL;
     339        IssmDouble       *GinvZ        = NULL;
     340        IssmDouble       *gamma0       = NULL;
     341        IssmDouble       *ones         = NULL;
     342
     343        /*Some checks*/
     344        _assert_(mindata>0 && maxdata>0);
     345        _assert_(pprediction && perror);
     346
     347        /*If radius is not provided or is 0, return all observations*/
     348        if(radius==0) radius=this->quadtree->root->length;
     349
     350        /*Get list of observations for current point*/
     351        this->ObservationList(&x,&y,&obs,&n_obs,x_interp,y_interp,radius,maxdata);
     352
     353        /*If we have less observations than mindata, return UNDEF*/
     354        if(n_obs<mindata){
     355                *pprediction = -999.0;
     356                *perror      = -999.0;
     357                return;
     358        }
     359
     360        /*Allocate intermediary matrix and vectors*/
     361        Gamma  = xNew<IssmDouble>(n_obs*n_obs);
     362        gamma0 = xNew<IssmDouble>(n_obs);
     363        ones   = xNew<IssmDouble>(n_obs);
     364
     365        /*First: Create semivariogram matrix for observations*/
     366        for(i=0;i<n_obs;i++){
     367                for(j=0;j<=i;j++){
     368                        //Gamma[i*n_obs+j] = variogram->SemiVariogram(x[i]-x[j],y[i]-y[j]);
     369                        Gamma[i*n_obs+j] = variogram->Covariance(x[i]-x[j],y[i]-y[j]);
     370                        Gamma[j*n_obs+i] = Gamma[i*n_obs+j];
     371                }
     372        }
     373        for(i=0;i<n_obs;i++) ones[i]=1;
     374
     375        /*Get semivariogram vector associated to this location*/
     376        //for(i=0;i<n_obs;i++) gamma0[i] = variogram->SemiVariogram(x[i]-x_interp,y[i]-y_interp);
     377        for(i=0;i<n_obs;i++) gamma0[i] = variogram->Covariance(x[i]-x_interp,y[i]-y_interp);
     378
     379        /*Solve the three linear systems*/
     380#if _HAVE_GSL_
     381        SolverxGsl(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
     382        SolverxGsl(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
     383        SolverxGsl(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
     384#else
     385        _error2_("GSL is required");
     386#endif
     387
     388        /*Prepare predictor*/
     389        numerator=-1.; denominator=0.;
     390        for(i=0;i<n_obs;i++) numerator  +=GinvG0[i];
     391        for(i=0;i<n_obs;i++) denominator+=Ginv1[i];
     392        ratio=numerator/denominator;
     393
     394        prediction = 0.;
     395        error      = - numerator*numerator/denominator;
     396        for(i=0;i<n_obs;i++) prediction += (gamma0[i]-ratio)*GinvZ[i];
     397        for(i=0;i<n_obs;i++) error += gamma0[i]*GinvG0[i];
     398
     399        /*clean-up*/
     400        *pprediction = prediction;
     401        *perror = error;
     402        xDelete<IssmDouble>(x);
     403        xDelete<IssmDouble>(y);
     404        xDelete<IssmDouble>(obs);
     405        xDelete<IssmDouble>(Gamma);
     406        xDelete<IssmDouble>(gamma0);
     407        xDelete<IssmDouble>(ones);
     408        xDelete<IssmDouble>(GinvG0);
     409        xDelete<IssmDouble>(Ginv1);
     410        xDelete<IssmDouble>(GinvZ);
     411
     412}/*}}}*/
     413/*FUNCTION Observations::InterpolationNearestNeighbor{{{*/
     414void Observations::InterpolationNearestNeighbor(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius){
     415
     416        /*Intermediaries*/
     417        IssmDouble        x,y,obs;
     418
     419        /*Get clostest observation*/
     420        this->ClosestObservation(&x,&y,&obs,x_interp,y_interp,radius);
     421
     422        /*Assign output pointer*/
     423        *pprediction = obs;
     424}/*}}}*/
    141425/*FUNCTION Observations::QuadtreeColoring{{{*/
    142 void Observations::QuadtreeColoring(double* A,double *x,double *y,int n){
     426void Observations::QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n){
    143427
    144428        int xi,yi,level;
     
    147431                this->quadtree->IntergerCoordinates(&xi,&yi,x[i],y[i]);
    148432                this->quadtree->QuadtreeDepth(&level,xi,yi);
    149                 A[i]=(double)level;
     433                A[i]=(IssmDouble)level;
    150434        }
    151435
    152436}/*}}}*/
    153437/*FUNCTION Observations::Variomap{{{*/
    154 void Observations::Variomap(double* gamma,double *x,int n){
     438void Observations::Variomap(IssmDouble* gamma,IssmDouble *x,int n){
    155439
    156440        /*Output and Intermediaries*/
    157         int          nobs,i,j,k;
    158         double       range;
     441        int          i,j,k;
     442        IssmDouble       distance;
    159443        Observation *observation1 = NULL;
    160444        Observation *observation2 = NULL;
    161         int         *indices      = NULL;
    162 
    163         int *counter= (int*)xmalloc(n*sizeof(int));
    164         for(j=0;j<n;j++) counter[j] = 0;
     445
     446        IssmDouble *counter = xNew<IssmDouble>(n);
     447        for(j=0;j<n;j++) counter[j] = 0.0;
    165448        for(j=0;j<n;j++) gamma[j]   = 0.0;
    166449
     
    168451                observation1=(Observation*)this->GetObjectByOffset(i);
    169452
    170                 for(j=0;j<n;j++){
    171                         range=x[j]; _assert_(range>=0.);
    172 
    173                         /*Find all observations that are in range*/
    174                         this->quadtree->RangeSearch(&indices,&nobs,observation1->x,observation1->y,range);
    175 
    176                         for (k=0;k<nobs;k++){
    177                                 observation2 = (Observation*)this->GetObjectByOffset(indices[k]);
    178                                 gamma[j]    += 1./2.*pow(observation1->value - observation2->value,2.);
    179                         }
    180 
    181                         counter[j] += nobs;
    182                         xfree((void**)&indices);
     453                for(j=i+1;j<this->Size();j++){
     454                        observation2=(Observation*)this->GetObjectByOffset(j);
     455
     456                        distance=sqrt(pow(observation1->x - observation2->x,2.) + pow(observation1->y - observation2->y,2.));
     457                        if(distance>x[n-1]) continue;
     458
     459                        int index = int(distance/(x[1]-x[0]));
     460                        if(index>n-1) index = n-1;
     461                        if(index<0)   index = 0;
     462
     463                        gamma[index]   += 1./2.*pow(observation1->value - observation2->value,2.);
     464                        counter[index] += 1.;
    183465                }
    184466        }
    185467
    186468        /*Normalize semivariogram*/
    187         for(j=0;j<n;j++){
    188                 if(counter[j]) gamma[j] = gamma[j]/double(counter[j]);
     469        gamma[0]=0.;
     470        for(k=0;k<n;k++){
     471                if(counter[k]) gamma[k] = gamma[k]/counter[k];
    189472        }
    190473
    191474        /*Assign output pointer*/
    192         xfree((void**)&counter);
    193 }/*}}}*/
     475        xDelete<IssmDouble>(counter);
     476}/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/Container/Observations.h

    r12258 r12878  
    66#define  _CONTAINER_OBSERVATIONS_H_
    77
    8 class Obsevration;
     8#include "../include/include.h"
     9
    910class Quadtree;
     11class Variogram;
    1012class Options;
    1113
     
    1921                /*constructors, destructors*/
    2022                Observations();
    21                 Observations(double* observations_list,double* x,double* y,int n,Options* options);
     23                Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options);
    2224                ~Observations();
    2325
    2426                /*Methods*/
    25                 void ObservationList(double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double range);
    26                 void QuadtreeColoring(double* A,double *x,double *y,int n);
    27                 void Variomap(double* gamma,double *x,int n);
     27                void ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius);
     28                void InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power);
     29                void InterpolationKriging(IssmDouble *pprediction,IssmDouble *perror,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,Variogram* variogram);
     30                void InterpolationNearestNeighbor(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius);
     31                void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs);
     32                void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata);
     33                void QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n);
     34                void Variomap(IssmDouble* gamma,IssmDouble *x,int n);
    2835
    2936};
  • issm/branches/trunk-jpl-damage/src/c/Container/Options.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    1313#include <vector>
    1414#include <algorithm>
     15#include <cstring>
    1516
    1617#include "./DataSet.h"
     
    2425
    2526/*Object constructors and destructor*/
    26 /*FUNCTION Options::Options(){{{1*/
     27/*FUNCTION Options::Options(){{{*/
    2728Options::Options(){
    2829        return;
    2930}
    3031/*}}}*/
    31 /*FUNCTION Options::~Options(){{{1*/
     32/*FUNCTION Options::~Options(){{{*/
    3233Options::~Options(){
    3334        return;
     
    3637
    3738/*Object management*/
    38 /*FUNCTION Options::AddOption{{{1*/
     39/*FUNCTION Options::AddOption{{{*/
    3940int  Options::AddOption(Option* in_option){
    4041
     
    4647
    4748        /*Also, check the option name*/
    48         if(!in_option->name) _error_("input option has an empty name");
    49         if(strchr(in_option->name,'.')) _error_("Option \"%s\" has a protected character \".\"",in_option->name);
    50         if(strchr(in_option->name,'[')) _error_("Option \"%s\" has a protected character \"[\"",in_option->name);
    51         if(strchr(in_option->name,']')) _error_("Option \"%s\" has a protected character \"]\"",in_option->name);
     49        if(!in_option->name) _error2_("input option has an empty name");
     50        if(strchr(in_option->name,'.')) _error2_("Option \"" << in_option->name << "\" has a protected character \".\"");
     51        if(strchr(in_option->name,'[')) _error2_("Option \"" << in_option->name << "\" has a protected character \"[\"");
     52        if(strchr(in_option->name,']')) _error2_("Option \"" << in_option->name << "\" has a protected character \"]\"");
    5253
    5354        /*Finally, check that no option of the same name already exists in the dataset*/
     
    5657                option=(Option*)(*object);
    5758                if (!strcmp(option->name,in_option->name)){
    58                         _error_("Options \"%s\" found multiple times",in_option->name);
     59                        _error2_("Options \"" << in_option->name << "\" found multiple times");
    5960                        break;
    6061                }
     
    6768}
    6869/*}}}*/
    69 /*FUNCTION Options::Get(double* pvalue, char* name){{{1*/
    70 void Options::Get(double* pvalue,const char* name){
    71 
    72         vector<Object*>::iterator object;
    73         Option* option=NULL;
    74 
    75         /*Get option*/
    76         option=GetOption(name);
    77 
    78         /*If the pointer is not NULL, the option has been found*/
    79         if(option){
    80                 option->Get(pvalue);
    81         }
    82         /*Else, the Option does not exist, no default provided*/
    83         else{
    84                 _error_("option of name \"%s\" not found, and no default value has been provided",name);
    85         }
    86 }
    87 /*}}}*/
    88 /*FUNCTION Options::Get(double* pvalue, char* name,double default_value){{{1*/
    89 void Options::Get(double* pvalue,const char* name,double default_value){
     70/*FUNCTION Options::Get(int* pvalue, char* name){{{*/
     71void Options::Get(int* pvalue,const char* name){
     72
     73        vector<Object*>::iterator object;
     74        Option* option=NULL;
     75
     76        /*Get option*/
     77        option=GetOption(name);
     78
     79        /*If the pointer is not NULL, the option has been found*/
     80        if(option){
     81                option->Get(pvalue);
     82        }
     83        /*Else, the Option does not exist, no default provided*/
     84        else{
     85                _error2_("option of name \"" << name << "\" not found, and no default value has been provided");
     86        }
     87}
     88/*}}}*/
     89/*FUNCTION Options::Get(int* pvalue, char* name,int default_value){{{*/
     90void Options::Get(int* pvalue,const char* name,int default_value){
    9091
    9192        vector<Object*>::iterator object;
     
    105106}
    106107/*}}}*/
    107 /*FUNCTION Options::Get(bool* pvalue, char* name){{{1*/
     108/*FUNCTION Options::Get(IssmDouble* pvalue, char* name){{{*/
     109void Options::Get(IssmDouble* pvalue,const char* name){
     110
     111        vector<Object*>::iterator object;
     112        Option* option=NULL;
     113
     114        /*Get option*/
     115        option=GetOption(name);
     116
     117        /*If the pointer is not NULL, the option has been found*/
     118        if(option){
     119                option->Get(pvalue);
     120        }
     121        /*Else, the Option does not exist, no default provided*/
     122        else{
     123                _error2_("option of name \"" << name << "\" not found, and no default value has been provided");
     124        }
     125}
     126/*}}}*/
     127/*FUNCTION Options::Get(IssmDouble* pvalue, char* name,IssmDouble default_value){{{*/
     128void Options::Get(IssmDouble* pvalue,const char* name,IssmDouble default_value){
     129
     130        vector<Object*>::iterator object;
     131        Option* option=NULL;
     132
     133        /*Get option*/
     134        option=GetOption(name);
     135
     136        /*If the pointer is not NULL, the option has been found*/
     137        if(option){
     138                option->Get(pvalue);
     139        }
     140        /*Else, the Option does not exist, a default is provided here*/
     141        else{
     142                *pvalue=default_value;
     143        }
     144}
     145/*}}}*/
     146/*FUNCTION Options::Get(bool* pvalue, char* name){{{*/
    108147void Options::Get(bool* pvalue,const char* name){
    109148
     
    120159        /*Else, the Option does not exist, no default provided*/
    121160        else{
    122                 _error_("option of name \"%s\" not found, and no default value has been provided",name);
    123         }
    124 }
    125 /*}}}*/
    126 /*FUNCTION Options::Get(bool* pvalue, char* name,bool default_value){{{1*/
     161                _error2_("option of name \"" << name << "\" not found, and no default value has been provided");
     162        }
     163}
     164/*}}}*/
     165/*FUNCTION Options::Get(bool* pvalue, char* name,bool default_value){{{*/
    127166void Options::Get(bool* pvalue,const char* name,bool default_value){
    128167
     
    143182}
    144183/*}}}*/
    145 /*FUNCTION Options::Get(char** pvalue, char* name){{{1*/
     184/*FUNCTION Options::Get(char** pvalue, char* name){{{*/
    146185void Options::Get(char** pvalue,const char* name){
    147186
     
    160199        /*Else, the Option does not exist, no default provided*/
    161200        else{
    162                 _error_("option of name \"%s\" not found, and no default value has been provided",name);
    163         }
    164 
    165 }
    166 /*}}}*/
    167 /*FUNCTION Options::Get(char** pvalue, char* name,char* default_value){{{1*/
     201                _error2_("option of name \"" << name << "\" not found, and no default value has been provided");
     202        }
     203
     204}
     205/*}}}*/
     206/*FUNCTION Options::Get(char** pvalue, char* name,char* default_value){{{*/
    168207void Options::Get(char** pvalue,const char* name,const char* default_value){
    169208
     
    183222        else{
    184223                stringsize=strlen(default_value)+1;
    185                 outstring=(char*)xmalloc(stringsize*sizeof(char));
    186                 memcpy(outstring,default_value,stringsize*sizeof(char));
     224                outstring=xNew<char>(stringsize);
     225                xMemCpy<char>(outstring,default_value,stringsize);
    187226                *pvalue=outstring;
    188227        }
     
    190229}
    191230/*}}}*/
    192 /*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{1*/
     231/*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{*/
    193232void Options::Get(char*** ppvalue,int* numel,const char* name){
    194233
     
    207246                if(option->ObjectEnum()==OptionCellEnum){
    208247                        if (option->NumEl()) {
    209                                 *ppvalue=(char **) xmalloc(option->NumEl()*sizeof(char *));
     248                                *ppvalue=xNew<char*>(option->NumEl());
    210249                                if (numel) *numel=option->NumEl();
    211250                                option->Get(&options);
     
    225264                /*Else: not supported*/
    226265                else{
    227                         _error_("Cannot recover field \"%s\" for an option of type %s",name,EnumToStringx(option->ObjectEnum()));
     266                        _error2_("Cannot recover field \"" << name << "\" for an option of type " << EnumToStringx(option->ObjectEnum()));
    228267                }
    229268        }
     
    236275}
    237276/*}}}*/
    238 /*FUNCTION Options::Get(double** pvalue,int* numel,const char* name){{{1*/
    239 void Options::Get(double** pvalue,int* numel,const char* name){
     277/*FUNCTION Options::Get(IssmDouble** pvalue,int* numel,const char* name){{{*/
     278void Options::Get(IssmDouble** pvalue,int* numel,const char* name){
    240279
    241280        vector<Object*>::iterator object;
     
    251290        /*Else, the Option does not exist, no default provided*/
    252291        else{
    253                 _error_("option of name \"%s\" not found, and no default value has been provided",name);
    254         }
    255 }
    256 /*}}}*/
    257 /*FUNCTION Options::GetOption{{{1*/
     292                _error2_("option of name \"" << name << "\" not found, and no default value has been provided");
     293        }
     294}
     295/*}}}*/
     296/*FUNCTION Options::GetOption{{{*/
    258297Option* Options::GetOption(const char* name){
    259298
     
    285324                                /*Else: not supported*/
    286325                                else{
    287                                         _error_("Cannot recover field \"%s\" for an option of type %s",name,EnumToStringx(option->ObjectEnum()));
     326                                        _error2_("Cannot recover field \"" << name << "\" for an option of type " << EnumToStringx(option->ObjectEnum()));
    288327                                }
    289328                        }
  • issm/branches/trunk-jpl-damage/src/c/Container/Options.h

    r12168 r12878  
    2020                int  AddOption(Option* in_oobject);
    2121                Option* GetOption(const char* name);
    22                 void Get(double*  pvalue,const char* name);
    23                 void Get(double*  pvalue,const char* name,double default_value);
     22                void Get(IssmDouble*  pvalue,const char* name);
     23                void Get(IssmDouble*  pvalue,const char* name,IssmDouble default_value);
     24                void Get(int*  pvalue,const char* name);
     25                void Get(int*  pvalue,const char* name,int default_value);
    2426                void Get(bool*    pvalue,const char* name);
    2527                void Get(bool*    pvalue,const char* name,bool default_value);
     
    2729                void Get(char**   pvalue,const char* name,const char* default_value);
    2830                void Get(char***  pvalue,int* numel,const char* name);
    29                 void Get(double** pvalue,int* numel,const char* name);
     31                void Get(IssmDouble** pvalue,int* numel,const char* name);
    3032};
    3133
  • issm/branches/trunk-jpl-damage/src/c/Container/Parameters.cpp

    r11708 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Parameters::Parameters(){{{1*/
     27/*FUNCTION Parameters::Parameters(){{{*/
    2828Parameters::Parameters(){
    2929        enum_type=ParametersEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Parameters::~Parameters(){{{1*/
     33/*FUNCTION Parameters::~Parameters(){{{*/
    3434Parameters::~Parameters(){
    3535        return;
     
    3838
    3939/*Object management*/
    40 /*FUNCTION Parameters::Exist{{{1*/
     40/*FUNCTION Parameters::Exist{{{*/
    4141bool Parameters::Exist(int enum_type){
    4242
     
    5151}
    5252/*}}}*/
    53 /*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{1*/
     53/*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{*/
    5454void Parameters::FindParam(bool* pbool,int enum_type){ _assert_(this);
    5555       
     
    6565                }
    6666        }
    67         _error_("could not find parameter %s",EnumToStringx(enum_type));
    68 }
    69 /*}}}*/
    70 /*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{1*/
     67        _error2_("could not find parameter " << EnumToStringx(enum_type));
     68}
     69/*}}}*/
     70/*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{*/
    7171void Parameters::FindParam(int* pinteger,int enum_type){ _assert_(this);
    7272       
     
    8282                }
    8383        }
    84         _error_("could not find parameter %s",EnumToStringx(enum_type));
    85 }
    86 /*}}}*/
    87 /*FUNCTION Parameters::FindParam(double* pscalar, int enum_type){{{1*/
    88 void Parameters::FindParam(double* pscalar, int enum_type){ _assert_(this);
     84        _error2_("could not find parameter " << EnumToStringx(enum_type));
     85}
     86/*}}}*/
     87/*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type){{{*/
     88void Parameters::FindParam(IssmDouble* pscalar, int enum_type){ _assert_(this);
    8989       
    9090        vector<Object*>::iterator object;
     
    9999                }
    100100        }
    101         _error_("could not find parameter %s",EnumToStringx(enum_type));
    102 }
    103 /*}}}*/
    104 /*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{1*/
     101        _error2_("could not find parameter " << EnumToStringx(enum_type));
     102}
     103/*}}}*/
     104/*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time){{{*/
     105void Parameters::FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time){ _assert_(this);
     106
     107        vector<Object*>::iterator object;
     108        Param* param=NULL;
     109
     110        for ( object=objects.begin() ; object < objects.end(); object++ ){
     111
     112                param=(Param*)(*object);
     113                if(param->InstanceEnum()==enum_type){
     114                        param->GetParameterValue(pscalar,time);
     115                        return;
     116                }
     117        }
     118        _error2_("could not find parameter " << EnumToStringx(enum_type));
     119}
     120/*}}}*/
     121/*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{*/
    105122void Parameters::FindParam(char** pstring,int enum_type){ _assert_(this);
    106123       
     
    116133                }
    117134        }
    118         _error_("could not find parameter %s",EnumToStringx(enum_type));
    119 
    120 }
    121 /*}}}*/
    122 /*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{1*/
     135        _error2_("could not find parameter " << EnumToStringx(enum_type));
     136
     137}
     138/*}}}*/
     139/*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{*/
    123140void Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){ _assert_(this);
    124141       
     
    134151                }
    135152        }
    136         _error_("could not find parameter %s",EnumToStringx(enum_type));
    137 
    138 }
    139 /*}}}*/
    140 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{1*/
     153        _error2_("could not find parameter " << EnumToStringx(enum_type));
     154
     155}
     156/*}}}*/
     157/*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{*/
    141158void Parameters::FindParam(int** pintarray,int* pM, int enum_type){ _assert_(this);
    142159
     
    152169                }
    153170        }
    154         _error_("could not find parameter %s",EnumToStringx(enum_type));
    155 
    156 }
    157 /*}}}*/
    158 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int* pN,int enum_type){{{1*/
     171        _error2_("could not find parameter " << EnumToStringx(enum_type));
     172
     173}
     174/*}}}*/
     175/*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int* pN,int enum_type){{{*/
    159176void Parameters::FindParam(int** pintarray,int* pM,int *pN,int enum_type){ _assert_(this);
    160177
     
    170187                }
    171188        }
    172         _error_("could not find parameter %s",EnumToStringx(enum_type));
    173 
    174 }
    175 /*}}}*/
    176 /*FUNCTION Parameters::FindParam(double** pdoublearray,int* pM,int enum_type){{{1*/
    177 void Parameters::FindParam(double** pdoublearray,int* pM, int enum_type){ _assert_(this);
    178 
    179         vector<Object*>::iterator object;
    180         Param* param=NULL;
    181 
    182         for ( object=objects.begin() ; object < objects.end(); object++ ){
    183 
    184                 param=(Param*)(*object);
    185                 if(param->InstanceEnum()==enum_type){
    186                         param->GetParameterValue(pdoublearray,pM);
    187                         return;
    188                 }
    189         }
    190         _error_("could not find parameter %s",EnumToStringx(enum_type));
    191 
    192 }
    193 /*}}}*/
    194 /*FUNCTION Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){{{1*/
    195 void Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){ _assert_(this);
    196 
    197         vector<Object*>::iterator object;
    198         Param* param=NULL;
    199 
    200         for ( object=objects.begin() ; object < objects.end(); object++ ){
    201 
    202                 param=(Param*)(*object);
    203                 if(param->InstanceEnum()==enum_type){
    204                         param->GetParameterValue(pdoublearray,pM,pN);
    205                         return;
    206                 }
    207         }
    208         _error_("could not find parameter %s",EnumToStringx(enum_type));
    209 
    210 }
    211 /*}}}*/
    212 /*FUNCTION Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{1*/
    213 void Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this);
     189        _error2_("could not find parameter " << EnumToStringx(enum_type));
     190
     191}
     192/*}}}*/
     193/*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type){{{*/
     194void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int enum_type){ _assert_(this);
     195
     196        vector<Object*>::iterator object;
     197        Param* param=NULL;
     198
     199        for ( object=objects.begin() ; object < objects.end(); object++ ){
     200
     201                param=(Param*)(*object);
     202                if(param->InstanceEnum()==enum_type){
     203                        param->GetParameterValue(pIssmDoublearray,pM);
     204                        return;
     205                }
     206        }
     207        _error2_("could not find parameter " << EnumToStringx(enum_type));
     208
     209}
     210/*}}}*/
     211/*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){{{*/
     212void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){ _assert_(this);
     213
     214        vector<Object*>::iterator object;
     215        Param* param=NULL;
     216
     217        for ( object=objects.begin() ; object < objects.end(); object++ ){
     218
     219                param=(Param*)(*object);
     220                if(param->InstanceEnum()==enum_type){
     221                        param->GetParameterValue(pIssmDoublearray,pM,pN);
     222                        return;
     223                }
     224        }
     225        _error2_("could not find parameter " << EnumToStringx(enum_type));
     226
     227}
     228/*}}}*/
     229/*FUNCTION Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{*/
     230void Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this);
    214231       
    215232        vector<Object*>::iterator object;
     
    224241                }
    225242        }
    226         _error_("could not find parameter %s",EnumToStringx(enum_type));
    227 }
    228 /*}}}*/
    229 /*FUNCTION Parameters::FindParam(Vector** pvec,int enum_type){{{1*/
     243        _error2_("could not find parameter " << EnumToStringx(enum_type));
     244}
     245/*}}}*/
     246/*FUNCTION Parameters::FindParam(Vector** pvec,int enum_type){{{*/
    230247void Parameters::FindParam(Vector** pvec,int enum_type){ _assert_(this);
    231248       
     
    241258                }
    242259        }
    243         _error_("could not find parameter %s",EnumToStringx(enum_type));
    244 
    245 }
    246 /*}}}*/
    247 /*FUNCTION Parameters::FindParam(Matrix** pmat,int enum_type){{{1*/
     260        _error2_("could not find parameter " << EnumToStringx(enum_type));
     261
     262}
     263/*}}}*/
     264/*FUNCTION Parameters::FindParam(Matrix** pmat,int enum_type){{{*/
    248265void Parameters::FindParam(Matrix** pmat,int enum_type){ _assert_(this);
    249266       
     
    259276                }
    260277        }
    261         _error_("could not find parameter %s",EnumToStringx(enum_type));
    262 
    263 }
    264 /*}}}*/
    265 /*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{1*/
     278        _error2_("could not find parameter " << EnumToStringx(enum_type));
     279
     280}
     281/*}}}*/
     282/*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{*/
    266283void Parameters::FindParam(FILE** pfid,int enum_type){ _assert_(this);
    267284
     
    277294                }
    278295        }
    279         _error_("could not find parameter %s",EnumToStringx(enum_type));
    280 }
    281 /*}}}*/
    282 
    283 /*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{1*/
     296        _error2_("could not find parameter " << EnumToStringx(enum_type));
     297}
     298/*}}}*/
     299
     300/*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{*/
    284301void   Parameters::SetParam(bool boolean,int enum_type){
    285302
     
    293310}
    294311/*}}}*/
    295 /*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{1*/
     312/*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{*/
    296313void   Parameters::SetParam(int integer,int enum_type){
    297314
     
    305322}
    306323/*}}}*/
    307 /*FUNCTION Parameters::SetParam(double scalar,int enum_type);{{{1*/
    308 void   Parameters::SetParam(double scalar,int enum_type){
     324/*FUNCTION Parameters::SetParam(IssmDouble scalar,int enum_type);{{{*/
     325void   Parameters::SetParam(IssmDouble scalar,int enum_type){
    309326
    310327        Param* param=NULL;
     
    317334}
    318335/*}}}*/
    319 /*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{1*/
     336/*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{*/
    320337void   Parameters::SetParam(char* string,int enum_type){
    321338
     
    329346}
    330347/*}}}*/
    331 /*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{1*/
     348/*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{*/
    332349void   Parameters::SetParam(char** stringarray,int M, int enum_type){
    333350
     
    341358}
    342359/*}}}*/
    343 /*FUNCTION Parameters::SetParam(double* doublearray,int M,int enum_type);{{{1*/
    344 void   Parameters::SetParam(double* doublearray,int M, int enum_type){
    345 
    346         Param* param=NULL;
    347        
    348         /*first, figure out if the param has already been created: */
    349         param=(Param*)this->FindParamObject(enum_type);
    350 
    351         if(param) param->SetValue(doublearray,M); //already exists, just set it.
    352         else this->AddObject(new DoubleVecParam(enum_type,doublearray,M)); //just add the new parameter.
    353 }
    354 /*}}}*/
    355 /*FUNCTION Parameters::SetParam(double* doublearray,int M,int N, int enum_type);{{{1*/
    356 void   Parameters::SetParam(double* doublearray,int M, int N, int enum_type){
    357 
    358         Param* param=NULL;
    359        
    360         /*first, figure out if the param has already been created: */
    361         param=(Param*)this->FindParamObject(enum_type);
    362 
    363         if(param) param->SetValue(doublearray,M,N); //already exists, just set it.
    364         else this->AddObject(new DoubleMatParam(enum_type,doublearray,M,N)); //just add the new parameter.
    365 }
    366 /*}}}*/
    367 /*FUNCTION Parameters::SetParam(int* intarray,int M,int enum_type);{{{1*/
     360/*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int enum_type);{{{*/
     361void   Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int enum_type){
     362
     363        Param* param=NULL;
     364       
     365        /*first, figure out if the param has already been created: */
     366        param=(Param*)this->FindParamObject(enum_type);
     367
     368        if(param) param->SetValue(IssmDoublearray,M); //already exists, just set it.
     369        else this->AddObject(new DoubleVecParam(enum_type,IssmDoublearray,M)); //just add the new parameter.
     370}
     371/*}}}*/
     372/*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int N, int enum_type);{{{*/
     373void   Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int N, int enum_type){
     374
     375        Param* param=NULL;
     376       
     377        /*first, figure out if the param has already been created: */
     378        param=(Param*)this->FindParamObject(enum_type);
     379
     380        if(param) param->SetValue(IssmDoublearray,M,N); //already exists, just set it.
     381        else this->AddObject(new DoubleMatParam(enum_type,IssmDoublearray,M,N)); //just add the new parameter.
     382}
     383/*}}}*/
     384/*FUNCTION Parameters::SetParam(int* intarray,int M,int enum_type);{{{*/
    368385void   Parameters::SetParam(int* intarray,int M, int enum_type){
    369386
     
    377394}
    378395/*}}}*/
    379 /*FUNCTION Parameters::SetParam(int* intarray,int M,int N, int enum_type);{{{1*/
     396/*FUNCTION Parameters::SetParam(int* intarray,int M,int N, int enum_type);{{{*/
    380397void   Parameters::SetParam(int* intarray,int M, int N, int enum_type){
    381398
     
    389406}
    390407/*}}}*/
    391 /*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{1*/
     408/*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{*/
    392409void   Parameters::SetParam(Vector* vector,int enum_type){
    393410
     
    401418}
    402419/*}}}*/
    403 /*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{1*/
     420/*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{*/
    404421void   Parameters::SetParam(Matrix* matrix,int enum_type){
    405422
     
    413430}
    414431/*}}}*/
    415 /*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{1*/
     432/*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{*/
    416433void   Parameters::SetParam(FILE* fid,int enum_type){
    417434
     
    425442}
    426443/*}}}*/
    427 /*FUNCTION Parameters::UnitConversion(int direction_enum);{{{1*/
     444/*FUNCTION Parameters::UnitConversion(int direction_enum);{{{*/
    428445void   Parameters::UnitConversion(int direction_enum){
    429446
     
    439456/*}}}*/
    440457
    441 /*FUNCTION Parameters::FindParamObject{{{1*/
     458/*FUNCTION Parameters::FindParamObject{{{*/
    442459Object* Parameters::FindParamObject(int enum_type){
    443460
  • issm/branches/trunk-jpl-damage/src/c/Container/Parameters.h

    r12258 r12878  
    2323        public:
    2424
    25                 /*constructors, destructors: {{{1*/
     25                /*constructors, destructors*/
    2626                Parameters();
    2727                ~Parameters();
    28                 /*}}}*/
    29                 /*numerics: {{{1*/
     28
     29                /*numerics*/
    3030                bool  Exist(int enum_type);
    3131
    3232                void  FindParam(bool* pinteger,int enum_type);
    3333                void  FindParam(int* pinteger,int enum_type);
    34                 void  FindParam(double* pscalar, int enum_type);
     34                void  FindParam(IssmDouble* pscalar, int enum_type);
     35                void  FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time);
    3536                void  FindParam(char** pstring,int enum_type);
    3637                void  FindParam(char*** pstringarray,int* pM,int enum_type);
    3738                void  FindParam(int** pintarray,int* pM,int enum_type);
    3839                void  FindParam(int** pintarray,int* pM,int* PN,int enum_type);
    39                 void  FindParam(double** pdoublearray,int* pM,int enum_type);
    40                 void  FindParam(double** pdoublearray,int* pM,int* pN,int enum_type);
    41                 void  FindParam(double*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type);
     40                void  FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type);
     41                void  FindParam(IssmDouble** pIssmDoublearray,int* pM,int* pN,int enum_type);
     42                void  FindParam(IssmDouble*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type);
    4243                void  FindParam(Vector** pvec,int enum_type);
    4344                void  FindParam(Matrix** pmat,int enum_type);
     
    4647                void  SetParam(bool boolean,int enum_type);
    4748                void  SetParam(int integer,int enum_type);
    48                 void  SetParam(double scalar, int enum_type);
     49                void  SetParam(IssmDouble scalar, int enum_type);
    4950                void  SetParam(char* string,int enum_type);
    5051                void  SetParam(char** stringarray,int M,int enum_type);
    51                 void  SetParam(double* doublearray,int M,int enum_type);
    52                 void  SetParam(double* doublearray,int M,int N,int enum_type);
     52                void  SetParam(IssmDouble* IssmDoublearray,int M,int enum_type);
     53                void  SetParam(IssmDouble* IssmDoublearray,int M,int N,int enum_type);
    5354                void  SetParam(int* intarray,int M,int enum_type);
    5455                void  SetParam(int* intarray,int M,int N,int enum_type);
     
    5960
    6061                Object* FindParamObject(int enum_type);
    61                 /*}}}*/
    6262
    6363};
  • issm/branches/trunk-jpl-damage/src/c/Container/Results.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Results::Results(){{{1*/
     27/*FUNCTION Results::Results(){{{*/
    2828Results::Results(){
    2929        enum_type=ResultsEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Results::~Results(){{{1*/
     33/*FUNCTION Results::~Results(){{{*/
    3434Results::~Results(){
    3535        return;
     
    3838
    3939/*Object management*/
    40 /*FUNCTION Results::SpawnTriaResults{{{1*/
     40/*FUNCTION Results::SpawnTriaResults{{{*/
    4141Results* Results::SpawnTriaResults(int* indices){
    4242
     
    6464}
    6565/*}}}*/
    66 /*FUNCTION Results::Write{{{1*/
     66/*FUNCTION Results::Write{{{*/
    6767void Results::Write(Parameters* parameters){
    6868       
  • issm/branches/trunk-jpl-damage/src/c/Container/Results.h

    r12168 r12878  
    2020        public:
    2121
    22                 /*constructors, destructors: {{{1*/
     22                /*constructors, destructors: {{{*/
    2323                Results();
    2424                ~Results();
    2525                /*}}}*/
    26                 /*numerics: {{{1*/
     26                /*numerics: {{{*/
    2727                Results* SpawnTriaResults(int* indices);
    2828                void Write(Parameters* parameters);
  • issm/branches/trunk-jpl-damage/src/c/Container/Vertices.cpp

    r12168 r12878  
    44 */
    55
    6 /*Headers: {{{1*/
     6/*Headers: {{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    2525
    2626/*Object constructors and destructor*/
    27 /*FUNCTION Vertices::Vertices(){{{1*/
     27/*FUNCTION Vertices::Vertices(){{{*/
    2828Vertices::Vertices(){
    2929        enum_type=VerticesEnum;
     
    3131}
    3232/*}}}*/
    33 /*FUNCTION Vertices::~Vertices(){{{1*/
     33/*FUNCTION Vertices::~Vertices(){{{*/
    3434Vertices::~Vertices(){
    3535        return;
     
    3838
    3939/*Numerics management*/
    40 /*FUNCTION Vertices::DistributeDofs{{{1*/
     40/*FUNCTION Vertices::DistributeDofs{{{*/
    4141void  Vertices::DistributeDofs(int numberofobjects,int numberofdofsperobject){
    4242
     
    6060         * cpus by the total last dofs of the previus cpu, starting from 0.
    6161         * First: bet number of dofs for each cpu*/
    62         alldofcount=(int*)xmalloc(num_procs*sizeof(int));
     62        alldofcount=xNew<int>(num_procs);
    6363        #ifdef _HAVE_MPI_
    6464        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD);
     
    8383         * object that is not a clone, tell them to show their dofs, so that later on, they can get picked
    8484         * up by their clones: */
    85         truedofs   =(int*)xcalloc(numberofobjects*numberofdofsperobject,sizeof(int));
    86         alltruedofs=(int*)xcalloc(numberofobjects*numberofdofsperobject,sizeof(int));
     85        truedofs   =xNewZeroInit<int>(numberofobjects*numberofdofsperobject);
     86        alltruedofs=xNewZeroInit<int>(numberofobjects*numberofdofsperobject);
    8787        for (i=0;i<this->Size();i++){
    8888                Vertex* vertex=(Vertex*)this->GetObjectByOffset(i);
     
    102102
    103103        /* Free ressources: */
    104         xfree((void**)&alldofcount);
    105         xfree((void**)&truedofs);
    106         xfree((void**)&alltruedofs);
     104        xDelete<int>(alldofcount);
     105        xDelete<int>(truedofs);
     106        xDelete<int>(alltruedofs);
    107107}
    108108/*}}}*/
    109 /*FUNCTION Vertices::FlagClones{{{1*/
     109/*FUNCTION Vertices::FlagClones{{{*/
    110110void  Vertices::FlagClones(int numberofobjects){
    111111
     
    117117
    118118        /*Allocate ranks: */
    119         ranks=(int*)xmalloc(numberofobjects*sizeof(int));
    120         minranks=(int*)xmalloc(numberofobjects*sizeof(int));
     119        ranks=xNew<int>(numberofobjects);
     120        minranks=xNew<int>(numberofobjects);
    121121
    122122        for(i=0;i<numberofobjects;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit.
     
    143143
    144144        /*Free ressources: */
    145         xfree((void**)&ranks);
    146         xfree((void**)&minranks);
     145        xDelete<int>(ranks);
     146        xDelete<int>(minranks);
    147147
    148148}
    149149/*}}}*/
    150 /*FUNCTION Vertices::NumberOfVertices{{{1*/
     150/*FUNCTION Vertices::NumberOfVertices{{{*/
    151151int Vertices::NumberOfVertices(void){
    152152
     
    174174}
    175175/*}}}*/
    176 /*FUNCTION Vertices::Ranks{{{1*/
     176/*FUNCTION Vertices::Ranks{{{*/
    177177void   Vertices::Ranks(int* ranks){
    178178
  • issm/branches/trunk-jpl-damage/src/c/Container/Vertices.h

    r12258 r12878  
    1919        public:
    2020
    21                 /*constructors, destructors: {{{1*/
     21                /*constructors, destructors: {{{*/
    2222                Vertices();
    2323                ~Vertices();
    2424                /*}}}*/
    25                 /*numerics: {{{1*/
     25                /*numerics: {{{*/
    2626                void  DistributeDofs(int numberofnodes,int numdofspernode);
    2727                void  FlagClones(int numberofnodes);
  • issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/EnumDefinitions.h

    r12872 r12878  
    105105        MaterialsRhoIceEnum,
    106106        MaterialsRhoWaterEnum,
     107        MaterialsRhoFreshwaterEnum,
    107108        MaterialsMuWaterEnum,
    108109        MaterialsThermalExchangeVelocityEnum,
     
    150151        SettingsResultsAsPatchesEnum,
    151152        SettingsWaitonlockEnum,
    152         DebugPetscProfilingEnum,
    153         PetscProfilingCurrentMemEnum,
    154         PetscProfilingCurrentFlopsEnum,
    155         PetscProfilingSolutionTimeEnum,
     153        SurfaceforcingsDelta18oEnum,
     154        SurfaceforcingsDelta18oSurfaceEnum,
     155        SurfaceforcingsIsdelta18oEnum,
     156        SurfaceforcingsPrecipitationsPresentdayEnum,
     157        SurfaceforcingsTemperaturesPresentdayEnum,
     158        SurfaceforcingsTemperaturesLgmEnum,
     159        DebugProfilingEnum,
     160        ProfilingCurrentMemEnum,
     161        ProfilingCurrentFlopsEnum,
     162        ProfilingSolutionTimeEnum,
    156163        MaxIterationConvergenceFlagEnum,
    157164        SteadystateMaxiterEnum,
     
    162169        SurfaceforcingsPrecipitationEnum,
    163170        SurfaceforcingsMassBalanceEnum,
     171        SurfaceforcingsIspddEnum,
     172        SurfaceforcingsIssmbgradientsEnum,
     173        SurfaceforcingsMonthlytemperaturesEnum,
     174        SurfaceforcingsHcEnum,
     175        SurfaceforcingsSmbPosMaxEnum,
     176        SurfaceforcingsSmbPosMinEnum,
     177        SurfaceforcingsAPosEnum,
     178        SurfaceforcingsBPosEnum,
     179        SurfaceforcingsANegEnum,
     180        SurfaceforcingsBNegEnum,
    164181        ThermalMaxiterEnum,
    165182        ThermalPenaltyFactorEnum,
     
    261278        IntParamEnum,
    262279        IntVecParamEnum,
     280        TransientParamEnum,
    263281        MacAyeal2dIceFrontEnum,
    264282        MacAyeal3dIceFrontEnum,
     
    386404        StressTensorzzEnum,
    387405        IceVolumeEnum,
     406        TotalSmbEnum,
    388407        /*}}}*/
    389408        /*Element Interpolations{{{1*/
  • issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/Synchronize.sh

    r12280 r12878  
    22#Synchronize EnumToStringx.cpp and StringToEnumx.cpp and matlab Enums
    33
    4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all comas > put everything in file temp
     4#Get all lines of EnumDefinitions2.h which hold Enum | remove all commas > put everything in file temp
    55cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,/ /g" | awk '{print $1}' > temp
    66
    77#Removed existing files
    88rm $ISSM_DIR/src/m/enum/*.m
     9rm $ISSM_DIR/src/m/enum/*.py
    910rm $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp
    1011rm $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp
     
    2526*/
    2627
     28#include <cstring>
    2729#include "../../shared/shared.h"
    2830#include "../../include/include.h"
     
    4749
    4850        len=strlen(EnumToStringx(enum_in));
    49         string=(char*)xmalloc((len+1)*sizeof(char));
     51        string=xNew<char>(len+1);
    5052        memcpy(string,EnumToStringx(enum_in),(len+1)*sizeof(char));
    5153
     
    5557END
    5658#}}}
    57 #Build StringToEnumx.cpp {{{1
     59#Build StringToEnumx.cpp {{{
    5860#Header
    5961cat <<END > $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp
     
    6769*/
    6870
     71#include <cstring>
    6972#include "../../shared/shared.h"
    7073#include "../../include/include.h"
     
    9598cat <<END >> $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp
    9699        /*If we reach this point, the string provided has not been found*/
    97    _error_("Enum %s not found",name);
     100        _error2_("Enum " << name << " not found");
    98101}
    99102END
     
    102105# go through the lines of temp
    103106ENUM=0;
     107#Add header to pythonenum file{{{
     108cat <<END > $ISSM_DIR/src/m/enum/EnumDefinitions.py
     109"""
     110
     111   WARNING: DO NOT MODIFY THIS FILE
     112            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
     113            Please read src/c/EnumDefinitions/README for more information
     114
     115"""
     116
     117END
     118#}}}
     119
    104120for NAMEENUM in $(cat temp); do
    105121
     
    140156END
    141157#}}}
     158        #Add case to pythonenum file{{{
     159        cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py
     160def $(echo $NAMEENUM)():
     161        """
     162        $(echo $NAMEENUM | awk {'print toupper($1)'}) - Enum of $(echo $NAME)
     163
     164           Usage:
     165              macro=$NAMEENUM()
     166        """
     167
     168        return StringToEnum('$NAME')
     169
     170END
     171#}}}
    142172
    143173done
    144 #MaximumNumberOfEnums{{{
     174#MaximumNumberOfEnums (matlab){{{
    145175cat <<END > $ISSM_DIR/src/m/enum/MaximumNumberOfEnums.m
    146176function macro=MaximumNumberOfEnums()
     
    159189END
    160190#}}}
     191#MaximumNumberOfEnums (python){{{
     192cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py
     193def MaximumNumberOfEnums():
     194        """
     195        $(echo "MaximumNumberOfEnums" | awk {'print toupper($1)'}) - Enum of MaximumNumberOfEnums
     196
     197           Usage:
     198              macro=MaximumNumberOfEnums()
     199        """
     200
     201        return $(cat EnumDefinitions.h | grep -e "[0-9]Enum" -e "[a-zA-Z]Enum" | grep -v include \
     202                | awk '{ printf "%s %s\n", NR-1, $0 }' \
     203                | grep "MaximumNumberOfEnums" | awk '{print $1}')
     204
     205END
     206#}}}
    161207
    162208#clean up{{{
  • issm/branches/trunk-jpl-damage/src/c/Makefile.am

    r12258 r12878  
    1 INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @HYPREINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
     1INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
    22
    33EXEEXT=$(ISSMEXT)
    44
    5 #Library declaration {{{1
    6 lib_LIBRARIES = libISSMCore.a libISSMModules.a libISSMOverload.a
     5#Library declaration {{{
     6lib_LIBRARIES = libISSMCore.a libISSMOverload.a
     7
     8#if SHARED
     9#lib_LTLIBRARIES = libISSM.la libISSMCore.la libISSMOverload.la
     10#endif
    711if PYTHON
    812lib_LIBRARIES += libISSMPython.a
     
    1115lib_LIBRARIES += libISSMMatlab.a
    1216endif
     17if MODULES
     18lib_LIBRARIES += libISSMModules.a
     19endif
    1320#}}}
    1421
    1522#sources
    16 #Core sources{{{1
     23#Core sources{{{
    1724core_sources = ./issm.h\
    1825                                        ./issm-binding.h\
     
    2128                                        ./include/types.h\
    2229                                        ./include/include.h\
    23                                         ./objects/objects.h\
    24                                         ./objects/Object.h\
    25                                         ./objects/Gauss/GaussTria.h\
    26                                         ./objects/Gauss/GaussTria.cpp\
    27                                         ./objects/Update.h\
    28                                         ./objects/Element.h\
    29                                         ./objects/FemModel.h\
    30                                         ./objects/FemModel.cpp\
    31                                         ./objects/Material.h\
    32                                         ./objects/Load.h\
    33                                         ./objects/Contour.h\
    34                                         ./objects/Contour.cpp\
    35                                         ./objects/OptArgs.h\
    36                                         ./objects/OptPars.h\
    37                                         ./objects/Loads/Friction.h\
    38                                         ./objects/Loads/Friction.cpp\
    39                                         ./objects/Inputs/TransientInput.h\
    40                                         ./objects/Inputs/TransientInput.cpp\
    41                                         ./objects/Constraints/SpcTransient.cpp\
    42                                         ./objects/Constraints/SpcTransient.h\
    43                                         ./objects/DofIndexing.h\
    44                                         ./objects/DofIndexing.cpp\
    45                                         ./objects/IoModel.h\
    46                                         ./objects/IoModel.cpp\
    47                                         ./objects/Node.h\
    48                                         ./objects/Node.cpp\
    49                                         ./objects/Segment.h\
    50                                         ./objects/Segment.cpp\
    51                                         ./objects/Vertex.h\
    52                                         ./objects/Vertex.cpp\
    53                                         ./objects/Hook.h\
    54                                         ./objects/Hook.cpp\
    55                                         ./objects/Patch.h\
    56                                         ./objects/Patch.cpp\
    57                                         ./objects/ElementResults/ElementResultLocal.h\
    58                                         ./objects/ElementResults/DoubleElementResult.h\
    59                                         ./objects/ElementResults/DoubleElementResult.cpp\
    60                                         ./objects/ElementResults/TriaP1ElementResult.h\
    61                                         ./objects/ElementResults/TriaP1ElementResult.cpp\
    62                                         ./objects/ElementResults/BoolElementResult.h\
    63                                         ./objects/ElementResults/BoolElementResult.cpp\
    64                                         ./objects/ExternalResults/ExternalResult.h\
    65                                         ./objects/ExternalResults/BoolExternalResult.h\
    66                                         ./objects/ExternalResults/BoolExternalResult.cpp\
    67                                         ./objects/ExternalResults/DoubleExternalResult.h\
    68                                         ./objects/ExternalResults/DoubleExternalResult.cpp\
    69                                         ./objects/ExternalResults/DoubleVecExternalResult.h\
    70                                         ./objects/ExternalResults/DoubleVecExternalResult.cpp\
    71                                         ./objects/ExternalResults/DoubleMatExternalResult.h\
    72                                         ./objects/ExternalResults/DoubleMatExternalResult.cpp\
    73                                         ./objects/ExternalResults/IntExternalResult.h\
    74                                         ./objects/ExternalResults/IntExternalResult.cpp\
    75                                         ./objects/ExternalResults/StringExternalResult.h\
    76                                         ./objects/ExternalResults/StringExternalResult.cpp\
    77                                         ./objects/Elements/Tria.h\
    78                                         ./objects/Elements/Tria.cpp\
    79                                         ./objects/Elements/TriaHook.h\
    80                                         ./objects/Elements/TriaHook.cpp\
    81                                         ./objects/Elements/TriaRef.h\
    82                                         ./objects/Elements/TriaRef.cpp\
    83                                         ./objects/Inputs/Input.h\
    84                                         ./objects/Inputs/InputLocal.h\
    85                                         ./objects/Inputs/TriaP1Input.h\
    86                                         ./objects/Inputs/TriaP1Input.cpp\
    87                                         ./objects/Inputs/BoolInput.h\
    88                                         ./objects/Inputs/BoolInput.cpp\
    89                                         ./objects/Inputs/IntInput.h\
    90                                         ./objects/Inputs/IntInput.cpp\
    91                                         ./objects/Inputs/DoubleInput.h\
    92                                         ./objects/Inputs/DoubleInput.cpp\
    93                                         ./objects/Inputs/DatasetInput.h\
    94                                         ./objects/Inputs/DatasetInput.cpp\
    95                                         ./objects/Materials/Matice.h\
    96                                         ./objects/Materials/Matice.cpp\
    97                                         ./objects/Materials/Matpar.h\
    98                                         ./objects/Materials/Matpar.cpp\
    99                                         ./objects/Constraints/Constraint.h\
    100                                         ./objects/Constraints/SpcStatic.cpp\
    101                                         ./objects/Constraints/SpcStatic.h\
    102                                         ./objects/Constraints/SpcDynamic.cpp\
    103                                         ./objects/Constraints/SpcDynamic.h\
    104                                         ./objects/Loads/Penpair.cpp\
    105                                         ./objects/Loads/Penpair.h\
    106                                         ./objects/Loads/Pengrid.cpp\
    107                                         ./objects/Loads/Pengrid.h\
    108                                         ./objects/Loads/Icefront.cpp\
    109                                         ./objects/Loads/Icefront.h\
    110                                         ./objects/Loads/Numericalflux.cpp\
    111                                         ./objects/Loads/Numericalflux.h\
    112                                         ./objects/Numerics/ElementMatrix.h\
    113                                         ./objects/Numerics/ElementMatrix.cpp\
    114                                         ./objects/Numerics/ElementVector.h\
    115                                         ./objects/Numerics/ElementVector.cpp\
    116                                         ./objects/Numerics/Matrix.h\
    117                                         ./objects/Numerics/Matrix.cpp\
    118                                         ./objects/Numerics/Vector.h\
    119                                         ./objects/Numerics/Vector.cpp\
    120                                         ./objects/Params/Param.h\
    121                                         ./objects/Params/BoolParam.cpp\
    122                                         ./objects/Params/BoolParam.h\
    123                                         ./objects/Params/IntParam.cpp\
    124                                         ./objects/Params/IntParam.h\
    125                                         ./objects/Params/IntVecParam.cpp\
    126                                         ./objects/Params/IntVecParam.h\
    127                                         ./objects/Params/IntMatParam.cpp\
    128                                         ./objects/Params/IntMatParam.h\
    129                                         ./objects/Params/DoubleParam.cpp\
    130                                         ./objects/Params/DoubleParam.h\
    131                                         ./objects/Params/FileParam.cpp\
    132                                         ./objects/Params/FileParam.h\
    133                                         ./objects/Params/StringArrayParam.cpp\
    134                                         ./objects/Params/StringArrayParam.h\
    135                                         ./objects/Params/DoubleMatParam.cpp\
    136                                         ./objects/Params/DoubleMatParam.h\
    137                                         ./objects/Params/DoubleTransientMatParam.cpp\
    138                                         ./objects/Params/DoubleTransientMatParam.h\
    139                                         ./objects/Params/DoubleMatArrayParam.cpp\
    140                                         ./objects/Params/DoubleMatArrayParam.h\
    141                                         ./objects/Params/DoubleVecParam.cpp\
    142                                         ./objects/Params/DoubleVecParam.h\
    143                                         ./objects/Params/StringParam.cpp\
    144                                         ./objects/Params/StringParam.h\
    145                                         ./objects/Params/MatrixParam.h\
    146                                         ./objects/Params/MatrixParam.cpp\
    147                                         ./objects/Params/VectorParam.h\
    148                                         ./objects/Params/VectorParam.cpp\
     30                                        ./classes/classes.h\
     31                                        ./classes/objects.h\
     32                                        ./classes/objects/Object.h\
     33                                        ./classes/gauss/GaussTria.h\
     34                                        ./classes/gauss/GaussTria.cpp\
     35                                        ./classes/objects/Update.h\
     36                                        ./classes/objects/Element.h\
     37                                        ./classes/FemModel.h\
     38                                        ./classes/FemModel.cpp\
     39                                        ./classes/objects/Material.h\
     40                                        ./classes/objects/Load.h\
     41                                        ./classes/objects/Contour.h\
     42                                        ./classes/objects/Contour.cpp\
     43                                        ./classes/objects/OptArgs.h\
     44                                        ./classes/objects/OptPars.h\
     45                                        ./classes/objects/Loads/Friction.h\
     46                                        ./classes/objects/Loads/Friction.cpp\
     47                                        ./classes/objects/Inputs/TransientInput.h\
     48                                        ./classes/objects/Inputs/TransientInput.cpp\
     49                                        ./classes/objects/Constraints/SpcTransient.cpp\
     50                                        ./classes/objects/Constraints/SpcTransient.h\
     51                                        ./classes/DofIndexing.h\
     52                                        ./classes/DofIndexing.cpp\
     53                                        ./classes/IoModel.h\
     54                                        ./classes/IoModel.cpp\
     55                                        ./classes/objects/Node.h\
     56                                        ./classes/objects/Node.cpp\
     57                                        ./classes/objects/Segment.h\
     58                                        ./classes/objects/Segment.cpp\
     59                                        ./classes/objects/Vertex.h\
     60                                        ./classes/objects/Vertex.cpp\
     61                                        ./classes/Hook.h\
     62                                        ./classes/Hook.cpp\
     63                                        ./classes/Patch.h\
     64                                        ./classes/Patch.cpp\
     65                                        ./classes/objects/ElementResults/ElementResultLocal.h\
     66                                        ./classes/objects/ElementResults/DoubleElementResult.h\
     67                                        ./classes/objects/ElementResults/DoubleElementResult.cpp\
     68                                        ./classes/objects/ElementResults/TriaP1ElementResult.h\
     69                                        ./classes/objects/ElementResults/TriaP1ElementResult.cpp\
     70                                        ./classes/objects/ElementResults/BoolElementResult.h\
     71                                        ./classes/objects/ElementResults/BoolElementResult.cpp\
     72                                        ./classes/objects/ExternalResults/ExternalResult.h\
     73                                        ./classes/objects/ExternalResults/BoolExternalResult.h\
     74                                        ./classes/objects/ExternalResults/BoolExternalResult.cpp\
     75                                        ./classes/objects/ExternalResults/DoubleExternalResult.h\
     76                                        ./classes/objects/ExternalResults/DoubleExternalResult.cpp\
     77                                        ./classes/objects/ExternalResults/DoubleVecExternalResult.h\
     78                                        ./classes/objects/ExternalResults/DoubleVecExternalResult.cpp\
     79                                        ./classes/objects/ExternalResults/DoubleMatExternalResult.h\
     80                                        ./classes/objects/ExternalResults/DoubleMatExternalResult.cpp\
     81                                        ./classes/objects/ExternalResults/IntExternalResult.h\
     82                                        ./classes/objects/ExternalResults/IntExternalResult.cpp\
     83                                        ./classes/objects/ExternalResults/StringExternalResult.h\
     84                                        ./classes/objects/ExternalResults/StringExternalResult.cpp\
     85                                        ./classes/objects/Elements/Tria.h\
     86                                        ./classes/objects/Elements/Tria.cpp\
     87                                        ./classes/objects/Elements/TriaHook.h\
     88                                        ./classes/objects/Elements/TriaHook.cpp\
     89                                        ./classes/objects/Elements/TriaRef.h\
     90                                        ./classes/objects/Elements/TriaRef.cpp\
     91                                        ./classes/objects/Inputs/Input.h\
     92                                        ./classes/objects/Inputs/InputLocal.h\
     93                                        ./classes/objects/Inputs/TriaP1Input.h\
     94                                        ./classes/objects/Inputs/TriaP1Input.cpp\
     95                                        ./classes/objects/Inputs/BoolInput.h\
     96                                        ./classes/objects/Inputs/BoolInput.cpp\
     97                                        ./classes/objects/Inputs/IntInput.h\
     98                                        ./classes/objects/Inputs/IntInput.cpp\
     99                                        ./classes/objects/Inputs/DoubleInput.h\
     100                                        ./classes/objects/Inputs/DoubleInput.cpp\
     101                                        ./classes/objects/Inputs/DatasetInput.h\
     102                                        ./classes/objects/Inputs/DatasetInput.cpp\
     103                                        ./classes/objects/Materials/Matice.h\
     104                                        ./classes/objects/Materials/Matice.cpp\
     105                                        ./classes/objects/Materials/Matpar.h\
     106                                        ./classes/objects/Materials/Matpar.cpp\
     107                                        ./classes/objects/Constraints/Constraint.h\
     108                                        ./classes/objects/Constraints/SpcStatic.cpp\
     109                                        ./classes/objects/Constraints/SpcStatic.h\
     110                                        ./classes/objects/Constraints/SpcDynamic.cpp\
     111                                        ./classes/objects/Constraints/SpcDynamic.h\
     112                                        ./classes/objects/Loads/Penpair.cpp\
     113                                        ./classes/objects/Loads/Penpair.h\
     114                                        ./classes/objects/Loads/Pengrid.cpp\
     115                                        ./classes/objects/Loads/Pengrid.h\
     116                                        ./classes/objects/Loads/Icefront.cpp\
     117                                        ./classes/objects/Loads/Icefront.h\
     118                                        ./classes/objects/Loads/Numericalflux.cpp\
     119                                        ./classes/objects/Loads/Numericalflux.h\
     120                                        ./classes/matrix/matrixobjects.h\
     121                                        ./classes/matrix/ElementMatrix.h\
     122                                        ./classes/matrix/ElementMatrix.cpp\
     123                                        ./classes/matrix/ElementVector.h\
     124                                        ./classes/matrix/ElementVector.cpp\
     125                                        ./classes/matrix/Matrix.h\
     126                                        ./classes/matrix/Matrix.cpp\
     127                                        ./classes/matrix/Vector.h\
     128                                        ./classes/matrix/Vector.cpp\
     129                                        ./classes/objects/Params/Param.h\
     130                                        ./classes/objects/Params/BoolParam.cpp\
     131                                        ./classes/objects/Params/BoolParam.h\
     132                                        ./classes/objects/Params/IntParam.cpp\
     133                                        ./classes/objects/Params/IntParam.h\
     134                                        ./classes/objects/Params/IntVecParam.cpp\
     135                                        ./classes/objects/Params/IntVecParam.h\
     136                                        ./classes/objects/Params/IntMatParam.cpp\
     137                                        ./classes/objects/Params/IntMatParam.h\
     138                                        ./classes/objects/Params/DoubleParam.cpp\
     139                                        ./classes/objects/Params/DoubleParam.h\
     140                                        ./classes/objects/Params/FileParam.cpp\
     141                                        ./classes/objects/Params/FileParam.h\
     142                                        ./classes/objects/Params/StringArrayParam.cpp\
     143                                        ./classes/objects/Params/StringArrayParam.h\
     144                                        ./classes/objects/Params/DoubleMatParam.cpp\
     145                                        ./classes/objects/Params/DoubleMatParam.h\
     146                                        ./classes/objects/Params/DoubleTransientMatParam.cpp\
     147                                        ./classes/objects/Params/DoubleTransientMatParam.h\
     148                                        ./classes/objects/Params/DoubleMatArrayParam.cpp\
     149                                        ./classes/objects/Params/DoubleMatArrayParam.h\
     150                                        ./classes/objects/Params/DoubleVecParam.cpp\
     151                                        ./classes/objects/Params/DoubleVecParam.h\
     152                                        ./classes/objects/Params/StringParam.cpp\
     153                                        ./classes/objects/Params/StringParam.h\
     154                                        ./classes/objects/Params/MatrixParam.h\
     155                                        ./classes/objects/Params/MatrixParam.cpp\
     156                                        ./classes/objects/Params/VectorParam.h\
     157                                        ./classes/objects/Params/VectorParam.cpp\
     158                                        ./classes/objects/Params/TransientParam.h\
     159                                        ./classes/objects/Params/TransientParam.cpp\
    149160                                        ./Container/Container.h\
    150161                                        ./Container/Constraints.h\
     
    173184                                        ./shared/Alloc/alloc.h\
    174185                                        ./shared/Alloc/alloc.cpp\
     186                                        ./shared/Alloc/xNewDelete.h\
     187                                        ./shared/MemOps/xMemCpy.h\
    175188                                        ./shared/Matrix/matrix.h\
    176189                                        ./shared/Matrix/MatrixUtils.cpp\
    177                                         ./shared/Dofs/dofs.h\
    178                                         ./shared/Dofs/dofsetgen.cpp\
    179190                                        ./shared/Numerics/numerics.h\
    180191                                        ./shared/Numerics/Verbosity.h\
     
    202213                                        ./shared/Elements/GetGlobalDofList.cpp\
    203214                                        ./shared/Elements/GetNumberOfDofs.cpp\
     215                                        ./shared/Elements/PrintArrays.cpp\
     216                                        ./shared/Elements/PddSurfaceMassBalance.cpp\
     217                                        ./shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp\
    204218                                        ./shared/String/sharedstring.h\
    205219                                        ./shared/Wrapper/wrappershared.h\
    206220                                        ./shared/Wrapper/ModuleBoot.cpp\
    207221                                        ./shared/Wrapper/ModuleEnd.cpp\
     222                                        ./shared/Sys/sys.h\
     223                                        ./shared/Sys/ProfilingStart.cpp\
     224                                        ./shared/Sys/ProfilingEnd.cpp\
    208225                                        ./toolkits/metis/metisincludes.h\
    209226                                        ./toolkits/issm/issmtoolkit.h\
     
    281298                                        ./modules/PositiveDegreeDayx/PositiveDegreeDayx.h\
    282299                                        ./modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp\
     300                                        ./modules/Delta18oParameterizationx/Delta18oParameterizationx.h\
     301                                        ./modules/Delta18oParameterizationx/Delta18oParameterizationx.cpp\
     302                                        ./modules/SmbGradientsx/SmbGradientsx.h\
     303                                        ./modules/SmbGradientsx/SmbGradientsx.cpp\
    283304                                        ./modules/UpdateConstraintsx/UpdateConstraintsx.h\
    284305                                        ./modules/UpdateConstraintsx/UpdateConstraintsx.cpp\
     
    310331                                        ./modules/Solverx/Solverx.cpp\
    311332                                        ./modules/Solverx/Solverx.h\
     333                                        ./modules/Solverx/SolverxSeq.cpp\
    312334                                        ./modules/VecMergex/VecMergex.cpp\
    313335                                        ./modules/VecMergex/VecMergex.h\
     
    326348                                        ./solvers/solver_linear.cpp\
    327349                                        ./solvers/solver_nonlinear.cpp\
    328                                         ./solvers/solver_newton.cpp
    329 #}}}
    330 #DAKOTA sources  {{{1
    331 dakota_sources = ./objects/DakotaPlugin.h\
    332                                           ./objects/DakotaPlugin.cpp\
     350                                        ./solvers/solver_newton.cpp\
     351                                        ./classes/objects/Options/Option.cpp\
     352                                        ./classes/objects/Options/Option.h\
     353                                        ./classes/objects/Options/OptionDouble.cpp\
     354                                        ./classes/objects/Options/OptionDouble.h\
     355                                        ./classes/objects/Options/OptionChar.cpp\
     356                                        ./classes/objects/Options/OptionChar.h\
     357                                        ./classes/objects/Options/OptionUtilities.cpp\
     358                                        ./classes/objects/Options/OptionUtilities.h\
     359                                        ./classes/objects/Options/OptionLogical.cpp\
     360                                        ./classes/objects/Options/OptionLogical.h\
     361                                        ./classes/objects/Options/OptionStruct.cpp\
     362                                        ./classes/objects/Options/OptionStruct.h\
     363                                        ./classes/objects/Options/OptionCell.cpp\
     364                                        ./classes/objects/Options/OptionCell.h
     365
     366#}}}
     367#DAKOTA sources  {{{
     368dakota_sources = ./classes/dakota/DakotaPlugin.h\
     369                                          ./classes/dakota/DakotaPlugin.cpp\
    333370                                          ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h\
    334371                                          ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\
     
    352389                                          ./modules/Dakotax/SpawnCoreParallel.cpp
    353390#}}}
    354 #Transient sources  {{{1
     391#Transient sources  {{{
    355392transient_sources  = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \
    356393                                         ./solutions/transient_core.cpp
    357394#}}}
    358 #Steadystate sources  {{{1
     395#Steadystate sources  {{{
    359396steadystate_sources = ./solutions/steadystate_core.cpp\
    360397                                          ./solutions/steadystateconvergence.cpp
    361398#}}}
    362 #Prognostic sources  {{{1
     399#Prognostic sources  {{{
    363400prognostic_sources = ./modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp\
    364401                                              ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\
     
    367404                                                  ./solutions/prognostic_core.cpp
    368405#}}}
    369 #Thermal sources  {{{1
     406#Thermal sources  {{{
    370407thermal_sources = ./modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp\
    371408                                           ./modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp\
     
    387424                                           ./solvers/solver_thermal_nonlinear.cpp
    388425#}}}
    389 #Control sources  {{{1
     426#Control sources  {{{
    390427control_sources= ./modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp\
    391428                                          ./modules/ControlInputGetGradientx/ControlInputGetGradientx.h\
     
    426463                                          ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\
    427464                                          ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\
    428                                           ./objects/Inputs/ControlInput.h\
    429                                           ./objects/Inputs/ControlInput.cpp\
     465                                          ./classes/objects/Inputs/ControlInput.h\
     466                                          ./classes/objects/Inputs/ControlInput.cpp\
    430467                                          ./shared/Numerics/BrentSearch.cpp\
    431468                                          ./shared/Numerics/OptimalSearch.cpp \
     
    442479
    443480#}}}
    444 #Hydrology sources  {{{1
     481#Hydrology sources  {{{
    445482hydrology_sources  = ./modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp\
    446483                                              ./modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp\
     
    450487                                                  ./solutions/hydrology_core_step.cpp
    451488#}}}
    452 #Diagnostic sources  {{{1
     489#Diagnostic sources  {{{
    453490diagnostic_sources = ./modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp\
    454491                                              ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp \
     
    471508                                                  ./solvers/solver_stokescoupling_nonlinear.cpp
    472509#}}}
    473 #Balanced sources  {{{1
     510#Balanced sources  {{{
    474511balanced_sources = ./modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp\
    475512                                            ./modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp\
     
    478515                                                ./solutions/balancethickness_core.cpp
    479516#}}}
    480 #Responses sources  {{{1
     517#Responses sources  {{{
    481518responses_sources = ./modules/MinVelx/MinVelx.h\
    482519                                             ./modules/MinVelx/MinVelx.cpp\
     
    501538                                             ./modules/MinVzx/MinVzx.h\
    502539                                             ./modules/MinVzx/MinVzx.cpp\
     540                                             ./modules/TotalSmbx/TotalSmbx.h\
     541                                             ./modules/TotalSmbx/TotalSmbx.cpp\
    503542                                             ./modules/IceVolumex/IceVolumex.h\
    504543                                             ./modules/IceVolumex/IceVolumex.cpp\
     
    508547                                             ./modules/MassFluxx/MassFluxx.h
    509548#}}}
    510 #Slope sources  {{{1
     549#Slope sources  {{{
    511550slope_sources =  ./modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp\
    512551                                          ./modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp \
     
    520559                                          ./solutions/bedslope_core.cpp
    521560#}}}
    522 #Groundingline sources  {{{1
     561#Groundingline sources  {{{
    523562groundingline_sources= ./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\
    524563                                                ./modules/GroundinglineMigrationx/GroundinglineMigrationx.h
    525564#}}}
    526 #Rifts sources  {{{1
    527 rifts_sources = ./objects/Loads/Riftfront.cpp\
    528                                     ./objects/Loads/Riftfront.h\
     565#Rifts sources  {{{
     566rifts_sources = ./classes/objects/Loads/Riftfront.cpp\
     567                                    ./classes/objects/Loads/Riftfront.h\
    529568                                    ./modules/ConstraintsStatex/RiftConstraintsState.cpp
    530569#}}}
    531 #3D sources  {{{1
    532 threed_sources = ./objects/Gauss/GaussPenta.h\
    533                                      ./objects/Gauss/GaussPenta.cpp\
    534                                      ./objects/ElementResults/PentaP1ElementResult.h\
    535                                      ./objects/ElementResults/PentaP1ElementResult.cpp\
    536                                      ./objects/Inputs/PentaP1Input.h\
    537                                      ./objects/Inputs/PentaP1Input.cpp\
    538                                      ./objects/Elements/Penta.h\
    539                                      ./objects/Elements/Penta.cpp\
    540                                      ./objects/Elements/PentaHook.h\
    541                                      ./objects/Elements/PentaHook.cpp\
    542                                      ./objects/Elements/PentaRef.h\
    543                                      ./objects/Elements/PentaRef.cpp
    544 #}}}
    545 #Bamg sources  {{{1
    546 bamg_sources =  ./objects/Bamg/BamgGeom.h\
    547                                 ./objects/Bamg/BamgGeom.cpp\
    548                                 ./objects/Bamg/BamgMesh.h\
    549                                 ./objects/Bamg/BamgMesh.cpp\
    550                                 ./objects/Bamg/BamgOpts.h\
    551                                 ./objects/Bamg/BamgOpts.cpp\
    552                                 ./objects/Bamg/CrackedEdge.h\
    553                                 ./objects/Bamg/CrackedEdge.cpp\
    554                                 ./objects/Bamg/Curve.h\
    555                                 ./objects/Bamg/Curve.cpp\
    556                                 ./objects/Bamg/Direction.h\
    557                                 ./objects/Bamg/Direction.cpp\
    558                                 ./objects/Bamg/DoubleAndInt.h\
    559                                 ./objects/Bamg/Edge.h\
    560                                 ./objects/Bamg/Edge.cpp\
    561                                 ./objects/Bamg/GeomEdge.h\
    562                                 ./objects/Bamg/GeomEdge.cpp\
    563                                 ./objects/Bamg/GeomSubDomain.h\
    564                                 ./objects/Bamg/GeomSubDomain.cpp\
    565                                 ./objects/Bamg/GeomVertex.h\
    566                                 ./objects/Bamg/GeomVertex.cpp\
    567                                 ./objects/Bamg/Geometry.cpp\
    568                                 ./objects/Bamg/Geometry.h\
    569                                 ./objects/Bamg/ListofIntersectionTriangles.cpp\
    570                                 ./objects/Bamg/ListofIntersectionTriangles.h\
    571                                 ./objects/Bamg/EigenMetric.cpp\
    572                                 ./objects/Bamg/Metric.cpp\
    573                                 ./objects/Bamg/Metric.h\
    574                                 ./objects/Bamg/BamgQuadtree.cpp\
    575                                 ./objects/Bamg/BamgQuadtree.h\
    576                                 ./objects/Bamg/R2.h\
    577                                 ./objects/Bamg/SetOfE4.cpp\
    578                                 ./objects/Bamg/SetOfE4.h\
    579                                 ./objects/Bamg/SubDomain.h\
    580                                 ./objects/Bamg/SubDomain.cpp\
    581                                 ./objects/Bamg/AdjacentTriangle.h\
    582                                 ./objects/Bamg/AdjacentTriangle.cpp\
    583                                 ./objects/Bamg/Triangle.cpp\
    584                                 ./objects/Bamg/Triangle.h\
    585                                 ./objects/Bamg/BamgVertex.cpp\
    586                                 ./objects/Bamg/BamgVertex.h\
    587                                 ./objects/Bamg/VertexOnEdge.h\
    588                                 ./objects/Bamg/VertexOnEdge.cpp\
    589                                 ./objects/Bamg/VertexOnGeom.h\
    590                                 ./objects/Bamg/VertexOnGeom.cpp\
    591                                 ./objects/Bamg/VertexOnVertex.h\
    592                                 ./objects/Bamg/VertexOnVertex.cpp\
    593                                 ./objects/Bamg/Mesh.cpp\
    594                                 ./objects/Bamg/Mesh.h\
     570#3D sources  {{{
     571threed_sources = ./classes/gauss/GaussPenta.h\
     572                                     ./classes/gauss/GaussPenta.cpp\
     573                                     ./classes/objects/ElementResults/PentaP1ElementResult.h\
     574                                     ./classes/objects/ElementResults/PentaP1ElementResult.cpp\
     575                                     ./classes/objects/Inputs/PentaP1Input.h\
     576                                     ./classes/objects/Inputs/PentaP1Input.cpp\
     577                                     ./classes/objects/Elements/Penta.h\
     578                                     ./classes/objects/Elements/Penta.cpp\
     579                                     ./classes/objects/Elements/PentaHook.h\
     580                                     ./classes/objects/Elements/PentaHook.cpp\
     581                                     ./classes/objects/Elements/PentaRef.h\
     582                                     ./classes/objects/Elements/PentaRef.cpp
     583#}}}
     584#Bamg sources  {{{
     585bamg_sources =  ./classes/bamg/bamgobjects.h\
     586                                ./classes/bamg/BamgGeom.h\
     587                                ./classes/bamg/BamgGeom.cpp\
     588                                ./classes/bamg/BamgMesh.h\
     589                                ./classes/bamg/BamgMesh.cpp\
     590                                ./classes/bamg/BamgOpts.h\
     591                                ./classes/bamg/BamgOpts.cpp\
     592                                ./classes/bamg/CrackedEdge.h\
     593                                ./classes/bamg/CrackedEdge.cpp\
     594                                ./classes/bamg/Curve.h\
     595                                ./classes/bamg/Curve.cpp\
     596                                ./classes/bamg/Direction.h\
     597                                ./classes/bamg/Direction.cpp\
     598                                ./classes/bamg/DoubleAndInt.h\
     599                                ./classes/bamg/Edge.h\
     600                                ./classes/bamg/Edge.cpp\
     601                                ./classes/bamg/GeomEdge.h\
     602                                ./classes/bamg/GeomEdge.cpp\
     603                                ./classes/bamg/GeomSubDomain.h\
     604                                ./classes/bamg/GeomSubDomain.cpp\
     605                                ./classes/bamg/GeomVertex.h\
     606                                ./classes/bamg/GeomVertex.cpp\
     607                                ./classes/bamg/Geometry.cpp\
     608                                ./classes/bamg/Geometry.h\
     609                                ./classes/bamg/ListofIntersectionTriangles.cpp\
     610                                ./classes/bamg/ListofIntersectionTriangles.h\
     611                                ./classes/bamg/EigenMetric.cpp\
     612                                ./classes/bamg/Metric.cpp\
     613                                ./classes/bamg/Metric.h\
     614                                ./classes/bamg/BamgQuadtree.cpp\
     615                                ./classes/bamg/BamgQuadtree.h\
     616                                ./classes/bamg/R2.h\
     617                                ./classes/bamg/SetOfE4.cpp\
     618                                ./classes/bamg/SetOfE4.h\
     619                                ./classes/bamg/SubDomain.h\
     620                                ./classes/bamg/SubDomain.cpp\
     621                                ./classes/bamg/AdjacentTriangle.h\
     622                                ./classes/bamg/AdjacentTriangle.cpp\
     623                                ./classes/bamg/Triangle.cpp\
     624                                ./classes/bamg/Triangle.h\
     625                                ./classes/bamg/BamgVertex.cpp\
     626                                ./classes/bamg/BamgVertex.h\
     627                                ./classes/bamg/VertexOnEdge.h\
     628                                ./classes/bamg/VertexOnEdge.cpp\
     629                                ./classes/bamg/VertexOnGeom.h\
     630                                ./classes/bamg/VertexOnGeom.cpp\
     631                                ./classes/bamg/VertexOnVertex.h\
     632                                ./classes/bamg/VertexOnVertex.cpp\
     633                                ./classes/bamg/Mesh.cpp\
     634                                ./classes/bamg/Mesh.h\
    595635                                ./shared/Bamg/Abs.h \
    596636                                ./shared/Bamg/BigPrimeNumber.h\
     
    609649                                ./modules/BamgTriangulatex/BamgTriangulatex.h
    610650#}}}
    611 #Kriging sources  {{{1
     651#Kriging sources  {{{
    612652kriging_sources = ./Container/Observations.h\
    613653                                                ./Container/Observations.cpp\
    614                                                 ./objects/Kriging/Variogram.h \
    615                                                 ./objects/Kriging/GaussianVariogram.h\
    616                                                 ./objects/Kriging/GaussianVariogram.cpp\
    617                                                 ./objects/Kriging/ExponentialVariogram.h\
    618                                                 ./objects/Kriging/ExponentialVariogram.cpp\
    619                                                 ./objects/Kriging/SphericalVariogram.h\
    620                                                 ./objects/Kriging/SphericalVariogram.cpp\
    621                                                 ./objects/Kriging/PowerVariogram.h\
    622                                                 ./objects/Kriging/PowerVariogram.cpp\
    623                                                 ./objects/Kriging/Quadtree.h\
    624                                                 ./objects/Kriging/Quadtree.cpp\
    625                                                 ./objects/Kriging/Observation.h\
    626                                                 ./objects/Kriging/Observation.cpp\
     654                                                ./classes/kriging/Variogram.h \
     655                                                ./classes/kriging/GaussianVariogram.h\
     656                                                ./classes/kriging/GaussianVariogram.cpp\
     657                                                ./classes/kriging/ExponentialVariogram.h\
     658                                                ./classes/kriging/ExponentialVariogram.cpp\
     659                                                ./classes/kriging/SphericalVariogram.h\
     660                                                ./classes/kriging/SphericalVariogram.cpp\
     661                                                ./classes/kriging/PowerVariogram.h\
     662                                                ./classes/kriging/PowerVariogram.cpp\
     663                                                ./classes/kriging/Quadtree.h\
     664                                                ./classes/kriging/Quadtree.cpp\
     665                                                ./classes/kriging/Observation.h\
     666                                                ./classes/kriging/Observation.cpp\
    627667                                                ./modules/Krigingx/Krigingx.cpp\
    628668                                                ./modules/Krigingx/Krigingx.h
    629669
    630 #}}}
    631 #Kml sources  {{{1
     670#For parallel kriging, only difference is ./modules/Krigingx/pKrigingx.cpp with no multithreading
     671pkriging_sources = ./Container/Observations.h\
     672                                                ./Container/Observations.cpp\
     673                                                ./classes/kriging/Variogram.h \
     674                                                ./classes/kriging/GaussianVariogram.h\
     675                                                ./classes/kriging/GaussianVariogram.cpp\
     676                                                ./classes/kriging/ExponentialVariogram.h\
     677                                                ./classes/kriging/ExponentialVariogram.cpp\
     678                                                ./classes/kriging/SphericalVariogram.h\
     679                                                ./classes/kriging/SphericalVariogram.cpp\
     680                                                ./classes/kriging/PowerVariogram.h\
     681                                                ./classes/kriging/PowerVariogram.cpp\
     682                                                ./classes/kriging/Quadtree.h\
     683                                                ./classes/kriging/Quadtree.cpp\
     684                                                ./classes/kriging/Observation.h\
     685                                                ./classes/kriging/Observation.cpp\
     686                                                ./modules/Krigingx/pKrigingx.cpp\
     687                                                ./modules/Krigingx/Krigingx.h
     688
     689#}}}
     690#Kml sources  {{{
    632691kml_sources = ./modules/Exp2Kmlx/Exp2Kmlx.h\
    633692                             ./modules/Exp2Kmlx/Exp2Kmlx.cpp\
     
    642701                             ./modules/KMLOverlayx/KMLOverlayx.h\
    643702                             ./modules/KMLOverlayx/KMLOverlayx.cpp\
    644                              ./objects/KML/KML_Attribute.cpp\
    645                              ./objects/KML/KML_Attribute.h\
    646                              ./objects/KML/KML_Comment.cpp\
    647                              ./objects/KML/KML_Comment.h\
    648                              ./objects/KML/KML_ColorStyle.cpp\
    649                              ./objects/KML/KML_ColorStyle.h\
    650                              ./objects/KML/KML_Container.cpp\
    651                              ./objects/KML/KML_Container.h\
    652                              ./objects/KML/KML_Document.cpp\
    653                              ./objects/KML/KML_Document.h\
    654                              ./objects/KML/KML_Feature.cpp\
    655                              ./objects/KML/KML_Feature.h\
    656                              ./objects/KML/KML_File.cpp\
    657                              ./objects/KML/KML_File.h\
    658                              ./objects/KML/KML_Folder.cpp\
    659                              ./objects/KML/KML_Folder.h\
    660                              ./objects/KML/KML_Geometry.cpp\
    661                              ./objects/KML/KML_Geometry.h\
    662                              ./objects/KML/KML_GroundOverlay.cpp\
    663                              ./objects/KML/KML_GroundOverlay.h\
    664                              ./objects/KML/KML_Icon.cpp\
    665                              ./objects/KML/KML_Icon.h\
    666                              ./objects/KML/KML_LatLonBox.cpp\
    667                              ./objects/KML/KML_LatLonBox.h\
    668                              ./objects/KML/KML_LinearRing.cpp\
    669                              ./objects/KML/KML_LinearRing.h\
    670                              ./objects/KML/KML_LineString.cpp\
    671                              ./objects/KML/KML_LineString.h\
    672                              ./objects/KML/KML_LineStyle.cpp\
    673                              ./objects/KML/KML_LineStyle.h\
    674                              ./objects/KML/KML_MultiGeometry.cpp\
    675                              ./objects/KML/KML_MultiGeometry.h\
    676                              ./objects/KML/KML_Object.cpp\
    677                              ./objects/KML/KML_Object.h\
    678                              ./objects/KML/KML_Overlay.cpp\
    679                              ./objects/KML/KML_Overlay.h\
    680                              ./objects/KML/KML_Point.cpp\
    681                              ./objects/KML/KML_Point.h\
    682                              ./objects/KML/KML_Placemark.cpp\
    683                              ./objects/KML/KML_Placemark.h\
    684                              ./objects/KML/KML_Polygon.cpp\
    685                              ./objects/KML/KML_Polygon.h\
    686                              ./objects/KML/KML_PolyStyle.cpp\
    687                              ./objects/KML/KML_PolyStyle.h\
    688                              ./objects/KML/KML_Style.cpp\
    689                              ./objects/KML/KML_Style.h\
    690                              ./objects/KML/KML_StyleSelector.cpp\
    691                              ./objects/KML/KML_StyleSelector.h\
    692                              ./objects/KML/KML_SubStyle.cpp\
    693                              ./objects/KML/KML_SubStyle.h\
    694                              ./objects/KML/KML_Unknown.cpp\
    695                              ./objects/KML/KML_Unknown.h\
    696                              ./objects/KML/KMLFileReadUtils.cpp\
    697                              ./objects/KML/KMLFileReadUtils.h
    698 #}}}
    699 #Petsc sources  {{{1
     703                             ./classes/objects/KML/KML_Attribute.cpp\
     704                             ./classes/objects/KML/KML_Attribute.h\
     705                             ./classes/objects/KML/KML_Comment.cpp\
     706                             ./classes/objects/KML/KML_Comment.h\
     707                             ./classes/objects/KML/KML_ColorStyle.cpp\
     708                             ./classes/objects/KML/KML_ColorStyle.h\
     709                             ./classes/objects/KML/KML_Container.cpp\
     710                             ./classes/objects/KML/KML_Container.h\
     711                             ./classes/objects/KML/KML_Document.cpp\
     712                             ./classes/objects/KML/KML_Document.h\
     713                             ./classes/objects/KML/KML_Feature.cpp\
     714                             ./classes/objects/KML/KML_Feature.h\
     715                             ./classes/objects/KML/KML_File.cpp\
     716                             ./classes/objects/KML/KML_File.h\
     717                             ./classes/objects/KML/KML_Folder.cpp\
     718                             ./classes/objects/KML/KML_Folder.h\
     719                             ./classes/objects/KML/KML_Geometry.cpp\
     720                             ./classes/objects/KML/KML_Geometry.h\
     721                             ./classes/objects/KML/KML_GroundOverlay.cpp\
     722                             ./classes/objects/KML/KML_GroundOverlay.h\
     723                             ./classes/objects/KML/KML_Icon.cpp\
     724                             ./classes/objects/KML/KML_Icon.h\
     725                             ./classes/objects/KML/KML_LatLonBox.cpp\
     726                             ./classes/objects/KML/KML_LatLonBox.h\
     727                             ./classes/objects/KML/KML_LinearRing.cpp\
     728                             ./classes/objects/KML/KML_LinearRing.h\
     729                             ./classes/objects/KML/KML_LineString.cpp\
     730                             ./classes/objects/KML/KML_LineString.h\
     731                             ./classes/objects/KML/KML_LineStyle.cpp\
     732                             ./classes/objects/KML/KML_LineStyle.h\
     733                             ./classes/objects/KML/KML_MultiGeometry.cpp\
     734                             ./classes/objects/KML/KML_MultiGeometry.h\
     735                             ./classes/objects/KML/KML_Object.cpp\
     736                             ./classes/objects/KML/KML_Object.h\
     737                             ./classes/objects/KML/KML_Overlay.cpp\
     738                             ./classes/objects/KML/KML_Overlay.h\
     739                             ./classes/objects/KML/KML_Point.cpp\
     740                             ./classes/objects/KML/KML_Point.h\
     741                             ./classes/objects/KML/KML_Placemark.cpp\
     742                             ./classes/objects/KML/KML_Placemark.h\
     743                             ./classes/objects/KML/KML_Polygon.cpp\
     744                             ./classes/objects/KML/KML_Polygon.h\
     745                             ./classes/objects/KML/KML_PolyStyle.cpp\
     746                             ./classes/objects/KML/KML_PolyStyle.h\
     747                             ./classes/objects/KML/KML_Style.cpp\
     748                             ./classes/objects/KML/KML_Style.h\
     749                             ./classes/objects/KML/KML_StyleSelector.cpp\
     750                             ./classes/objects/KML/KML_StyleSelector.h\
     751                             ./classes/objects/KML/KML_SubStyle.cpp\
     752                             ./classes/objects/KML/KML_SubStyle.h\
     753                             ./classes/objects/KML/KML_Unknown.cpp\
     754                             ./classes/objects/KML/KML_Unknown.h\
     755                             ./classes/objects/KML/KMLFileReadUtils.cpp\
     756                             ./classes/objects/KML/KMLFileReadUtils.h
     757#}}}
     758#Petsc sources  {{{
    700759petsc_sources= ./toolkits/petsc\
    701760                                        ./toolkits/petsc/patches\
     
    726785                                        ./toolkits/petsc/patches/ISSMToPetscInsertMode.cpp\
    727786                                        ./toolkits/petsc/patches/ISSMToPetscNormMode.cpp\
     787                                        ./toolkits/petsc/objects/petscobjects.h\
     788                                        ./toolkits/petsc/objects/PetscMat.h\
     789                                        ./toolkits/petsc/objects/PetscMat.cpp\
     790                                        ./toolkits/petsc/objects/PetscVec.h\
     791                                        ./toolkits/petsc/objects/PetscVec.cpp\
    728792                                        ./toolkits/petsc/petscincludes.h\
    729793                                        ./shared/Numerics/PetscOptionsFromAnalysis.cpp\
     
    732796
    733797#}}}
    734 #Gsl sources  {{{1
    735 gsl_sources= ./modules/Solverx/SolverxGsl.cpp
    736 
    737 #}}}
    738 #Mpi sources  {{{1
     798#Mpi sources  {{{
    739799mpi_sources= ./toolkits/mpi/mpiincludes.h\
    740800                                ./toolkits/mpi/patches/mpipatches.h\
     
    744804                                ./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp
    745805#}}}
    746 #Metis sources  {{{1
     806#Metis sources  {{{
    747807metis_sources= ./toolkits/metis/patches/metispatches.h\
    748808                                        ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
    749809#}}}
    750 #Python sources  {{{1
     810#Python sources  {{{
    751811python_sources=     ./python/io/pythonio.h\
    752812                                        ./python/python-binding.h\
     
    756816
    757817#}}}
    758 #Matlab sources  {{{1
     818#Matlab sources  {{{
    759819matlab_sources= ./toolkits/matlab/matlabincludes.h\
    760820                                    ./matlab/matlab-binding.h\
     
    773833                                         ./matlab/io/MatlabVectorToSeqVec.cpp
    774834#}}}
    775 #Matlab and Petsc sources  {{{1
    776 matlabpetsc_sources= ./matlab/io/MatlabMatrixToPetscMatrix.cpp\
    777                                          ./matlab/io/MatlabVectorToPetscVector.cpp
    778        
    779 #}}}
    780 #Modules sources{{{1
    781 module_sources= ./objects/Options/Option.cpp\
    782                         ./objects/Options/Option.h\
    783                         ./objects/Options/OptionDouble.cpp\
    784                         ./objects/Options/OptionDouble.h\
    785                         ./objects/Options/OptionLogical.cpp\
    786                         ./objects/Options/OptionLogical.h\
    787                         ./objects/Options/OptionChar.cpp\
    788                         ./objects/Options/OptionChar.h\
    789                         ./objects/Options/OptionStruct.cpp\
    790                         ./objects/Options/OptionStruct.h\
    791                         ./objects/Options/OptionCell.cpp\
    792                         ./objects/Options/OptionCell.h\
    793                         ./objects/Options/OptionUtilities.cpp\
    794                         ./objects/Options/OptionUtilities.h\
    795                         ./shared/Alloc/alloc_module.h\
    796                         ./shared/Alloc/alloc_module.cpp\
    797                         ./shared/Threads/issm_threads.h\
     835#Matlab and Petsc sources  {{{
     836matlabpetsc_sources= ./matlab/io/MatlabMatrixToPetscMat.cpp\
     837                                         ./matlab/io/MatlabVectorToPetscVec.cpp
     838
     839#}}}
     840#Modules sources{{{
     841module_sources= ./shared/Threads/issm_threads.h\
    798842                        ./shared/Threads/LaunchThread.cpp\
    799843                        ./shared/Threads/PartitionRange.cpp\
     
    866910#}}}
    867911
    868 #{{{1 Conditional build-up of sources
     912#{{{ Conditional build-up of sources
    869913#ISSM sources are a combination of core sources and sources related to specific capabilities (which can
    870914#be activated by autotools conditionals
    871 
    872915
    873916#First the core
     
    883926endif
    884927
    885 if GSL
    886 issm_sources  +=  $(gsl_sources)
    887 endif
    888 
    889928if TRANSIENT
    890929issm_sources  +=  $(transient_sources)
     
    953992endif
    954993
    955 
    956 #}}}
    957 #Library flags and sources {{{1
     994if KRIGING
     995issm_sources +=  $(pkriging_sources)
     996endif
     997#}}}
     998#Library flags and sources {{{
    958999ALLCXXFLAGS= -fPIC -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS)
    9591000
    9601001libISSMCore_a_SOURCES  = $(issm_sources)
    9611002libISSMCore_a_CXXFLAGS = $(ALLCXXFLAGS)
     1003
     1004#if SHARED
     1005#libISSM_la_SOURCES = solutions/issm.cpp
     1006#libISSM_la_LIBADD = @LTLIBOBJS@
     1007#libISSM_la_LDFLAGS = -prefer-pic
     1008
     1009#libISSMCore_la_SOURCES  = $(issm_sources)
     1010#libISSMOverload_la_SOURCES = ./shared/String/stricmp.c
     1011#endif
    9621012
    9631013if MODULES
     
    9671017libISSMModules_a_SOURCES += $(kml_sources)
    9681018libISSMModules_a_CXXFLAGS = $(ALLCXXFLAGS)
     1019endif
    9691020
    9701021if PYTHON
     
    9771028libISSMMatlab_a_CXXFLAGS= $(ALLCXXFLAGS)
    9781029endif
    979 endif
    980 #}}}
    981 #Overload library, to overload any non-standard symbols. {{{1
     1030
     1031#}}}
     1032#Overload library, to overload any non-standard symbols. {{{
    9821033libISSMOverload_a_SOURCES = ./shared/String/stricmp.c
    9831034libISSMOverload_a_CFLAGS  = -fPIC -D_C_ $(COPTFLAGS) $(CFLAGS)
    9841035#}}}
    9851036
    986 #Executable {{{1
     1037#Executable {{{
    9871038bin_PROGRAMS = issm
    9881039
     
    9911042
    9921043#External packages
    993 LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)
     1044LDADD += $(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)
    9941045
    9951046if FORTRAN
     
    9991050issm_SOURCES = solutions/issm.cpp
    10001051issm_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS)
     1052
     1053if KRIGING
     1054bin_PROGRAMS += kriging
     1055kriging_SOURCES = solutions/kriging.cpp
     1056kriging_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS)
     1057endif
    10011058#}}}
    10021059#Automatic differentiation: append this fold to the end of the src/c/Makefile.am to get this Makefile.am {{{
  • issm/branches/trunk-jpl-damage/src/c/include/include.h

    r9761 r12878  
    1010#include "./types.h"
    1111
    12 
    1312#endif //ifndef _INCLUDE_H_
    14 
  • issm/branches/trunk-jpl-damage/src/c/include/macros.h

    r12168 r12878  
    33 */
    44
    5 /*Header {{{1*/
     5/*Header {{{*/
    66#ifndef _MACROS_H_
    77#define _MACROS_H_
    88
     9#include <iostream>
     10#include <sstream>
     11#include <iomanip>
    912#include "./typedefs.h"
    1013
     
    1619/*}}}*/
    1720
    18 /* _printf_ {{{1*/
     21/* _printf_ {{{*/
    1922/*Printing macro: only cpu number 0 */
    20 #define _printf_(flag,...) do { if(flag) PrintfFunction(__VA_ARGS__); }while (0)
     23#define _printf_(flag,...) do{if(flag) PrintfFunction(__VA_ARGS__);}while(0)
    2124/*}}}*/
    22 /* _error_ {{{1*/
     25/* _error_ {{{*/
    2326/*Error exception macro*/
    2427#ifdef _INTEL_WIN_
     
    3033#endif
    3134/*}}}*/
    32 /* _assert_ {{{1*/
     35/* _error2_ {{{*/
     36/*new Error exception macro*/
     37#ifdef _INTEL_WIN_
     38#define _error2_(StreamArgs)\
     39   do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
     40   aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
     41   throw ErrorException(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
     42#else
     43#define _error2_(StreamArgs)\
     44        do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
     45   aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
     46   throw ErrorException(__FILE__,__func__,__LINE__,aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
     47#endif
     48/*}}}*/
     49/* _printLine_ {{{*/
     50/* macro to print a line, adds std::endl */
     51#define _printLine_(StreamArgs)\
     52   do{std::cout << StreamArgs << std::endl;}while(0)
     53/*}}}*/
     54/* _printString_ {{{*/
     55/* macro to print some string */
     56#define _printString_(StreamArgs)\
     57   do{std::cout << StreamArgs;}while(0)
     58/*}}}*/
     59/* _pprintLine_ {{{*/
     60/* macro to print a line, adds std::endl, only on cpu 0 */
     61#define _pprintLine_(StreamArgs)\
     62  do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
     63          aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
     64          PrintfFunction(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
     65/*}}}*/
     66/* _pprintString_ {{{*/
     67/* macro to print some string. Only on cpu0 */
     68#define _pprintString_(StreamArgs)\
     69  do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
     70          aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
     71          PrintfFunction2(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
     72/*}}}*/
     73/* _assert_ {{{*/
    3374/*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/
    3475#ifdef _ISSM_DEBUG_
     
    4081#endif
    4182/*}}}*/
    42 /* ISSMBOOT/ISSMEND {{{1*/
     83/* ISSMBOOT/ISSMEND {{{*/
    4384
    4485/*The following macros hide the error exception handling in a matlab module. Just put
  • issm/branches/trunk-jpl-damage/src/c/include/typedefs.h

    r11577 r12878  
    1616#define NDOF3 3
    1717#define NDOF4 4
    18 
    1918
    2019#define DIM2 2
     
    4039#endif
    4140
    42 
    43 
    44 
    4541#endif //ifndef _ISSMTYPEDEFS_H_
  • issm/branches/trunk-jpl-damage/src/c/include/types.h

    r12168 r12878  
    2727#endif 
    2828
    29 typedef double IssmDouble;
     29#ifdef _HAVE_ADOLC_
     30#include "adolc/adolc.h"
     31// for active variables
     32typedef adouble IssmDouble;
     33// for passive variables
     34typedef double IssmPDouble;
     35#else
     36// see above
     37typedef double IssmDouble;
     38// see above
     39typedef IssmDouble IssmPDouble;
     40#endif
     41
    3042typedef bool IssmBool;
    3143
    32 
    3344#endif //ifndef _TYPES_H_
  • issm/branches/trunk-jpl-damage/src/c/io/Disk/diskio.h

    r11202 r12878  
    66#define _DISK_IO_H_
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010#include "../../include/include.h"
    11 
    12 class DataSet;
    13 class Parameters;
    1411
    1512FILE* pfopen(char* filename,const char* format);
  • issm/branches/trunk-jpl-damage/src/c/io/Disk/pfclose.cpp

    r9320 r12878  
    1818        extern int my_rank;
    1919        _assert_(fid);
    20         if(fclose(fid)!=0)_error_("%s%s","could not close file ",filename);
     20        if(fclose(fid)!=0)_error2_("could not close file " << filename);
    2121}
  • issm/branches/trunk-jpl-damage/src/c/io/Disk/pfopen.cpp

    r11202 r12878  
    2020        /*Open handle to data on disk: */
    2121        fid=fopen(filename,format);
    22         if(fid==NULL) _error_("%s%s%s","could not open file ",filename," for binary reading or writing");
     22        if(fid==NULL) _error2_("could not open file " << filename << " for binary reading or writing");
    2323
    2424        return fid;
  • issm/branches/trunk-jpl-damage/src/c/io/PrintfFunction.cpp

    r12168 r12878  
    2525
    2626                /*allocate buffer for given string size*/
    27                 buffer=(char*)xmalloc(size*sizeof(char));
     27                buffer=xNew<char>(size);
    2828
    2929                /* Try to print in the allocated space. */
    3030                va_start(args, format);
    31 #ifndef WIN32
    3231                n=vsnprintf(buffer,size,format,args);
    33 #else
    34                 n=vsnprintf(buffer,size,format,args);
    35 #endif
    3632                va_end(args);
    3733
     
    4541                 size*=2;  /* twice the old size */
    4642
    47                 xfree((void**)&buffer);
     43                xDelete<char>(buffer);
    4844        }
    4945
    5046        /*Ok, if we are running in parallel, get node 0 to print*/
    51         if(my_rank==0)printf(buffer);
     47        if(my_rank==0)_printString_(buffer);
    5248
    5349        /*Clean up and return*/
    54         xfree((void**)&buffer);
     50        xDelete<char>(buffer);
    5551        return 1;
    5652}
     53int PrintfFunction(const string & message){
     54        extern int  my_rank;
     55        if(my_rank==0){
     56                printf("%s\n",message.c_str());
     57        }
     58        return 1;
     59}
     60int PrintfFunction2(const string & message){
     61        extern int  my_rank;
     62        if(my_rank==0){
     63                printf("%s",message.c_str());
     64        }
     65        return 1;
     66}
  • issm/branches/trunk-jpl-damage/src/c/io/io.h

    r12168 r12878  
    66#define _ISSM_IO_H_
    77
    8 #ifdef HAVE_CONFIG_H //config.h {{{1
     8#ifdef HAVE_CONFIG_H
    99#include <config.h>
    1010#else
    1111#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1212#endif
    13 //}}}
    14 
    1513#include "./Disk/diskio.h"
    1614
    1715/*printf: */
    1816int PrintfFunction(const char* format,...);
     17int PrintfFunction(const string & message);
     18int PrintfFunction2(const string & message);
    1919
    2020#endif  /* _IO_H_ */
  • issm/branches/trunk-jpl-damage/src/c/issm.h

    r9761 r12878  
    44
    55#ifndef _ISSM_H_
    6 #define  _ISSM_H_
     6#define _ISSM_H_
    77
    88#ifdef HAVE_CONFIG_H
     
    1414#include "./include/include.h"
    1515#include "./shared/shared.h"
    16 #include "./objects/objects.h"
     16#include "./classes/classes.h"
    1717#include "./Container/Container.h"
    1818#include "./EnumDefinitions/EnumDefinitions.h"
     
    2222#include "./modules/modules.h"
    2323
    24 
    2524#endif //ifndef _ISSM_H_
  • issm/branches/trunk-jpl-damage/src/c/matlab/include/matlab_macros.h

    r12078 r12878  
    33 */
    44
    5 /*Header {{{1*/
     5/*Header {{{*/
    66#ifndef _MATLAB_MACROS_H_
    77#define _MATLAB_MACROS_H_
     
    1515
    1616#ifdef _HAVE_MATLAB_
    17 /* MODULEBOOT/MODULEEND {{{1*/
     17/* MODULEBOOT/MODULEEND {{{*/
    1818
    1919/*The following macros hide the error exception handling in a matlab module. Just put
     
    3636        }
    3737//}}}
    38 /* WRAPPER {{{1*/
     38/* WRAPPER {{{*/
    3939#define WRAPPER(modulename,...) void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
    4040
    4141/*}}}*/
    42 /* CHECKARGUMENTS {{{1*/
     42/* CHECKARGUMENTS {{{*/
    4343#define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,functionpointer)
    4444/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/CheckNumMatlabArguments.cpp

    r12013 r12878  
    2222                /* special case: */
    2323                function();
    24                 _error_("usage: see above");
     24                _error2_("usage: see above");
    2525        }
    2626        else if (nlhs!=NLHS || nrhs!=NRHS ) {
    2727                function();
    28                 _error_("usage error.");
     28                _error2_("usage error.");
    2929        }
    3030        return 1;
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/FetchMatlabData.cpp

    r12258 r12878  
    1515
    1616/*Primitive data types*/
    17 /*FUNCTION FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
     17/*FUNCTION FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/
    1818void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){
    1919
     
    2727                outmatrix=NULL;
    2828        }
    29         else if(mxIsClass(dataref,"double") || mxIsClass(dataref,"single")){
     29        else if( mxIsClass(dataref,"double") ||
     30                                mxIsClass(dataref,"single") ||
     31                                mxIsClass(dataref,"int16") ||
     32                                mxIsClass(dataref,"int8") ||
     33                                mxIsClass(dataref,"uint8")){
    3034                /*Check dataref is not pointing to NaN: */
    3135                if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetM(dataref)==1) && (mxGetN(dataref)==1) ){
     
    3539                }
    3640                else{
     41                        if(!mxIsClass(dataref,"double") && !mxIsClass(dataref,"single")){
     42                                _printLine_("Warning: converting matlab data from '" << mxGetClassName(dataref) << "' to 'double'");
     43                        }
    3744                        /*Convert matlab matrix to double* matrix: */
    3845                        MatlabMatrixToDoubleMatrix(&outmatrix,&outmatrix_rows,&outmatrix_cols,dataref);
     
    4148        else{
    4249                /*This is an error: we don't have the correct input!: */
    43                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     50                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    4451        }
    4552                       
     
    5158}
    5259/*}}}*/
    53 /*FUNCTION FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
     60/*FUNCTION FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/
    5461void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
    5562
     
    8289        else{
    8390                /*This is an error: we don't have the correct input!: */
    84                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     91                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    8592        }
    8693                       
     
    9097        if (pndims)*pndims=outmatrix_ndims;
    9198        if (psize )*psize =outmatrix_size;
    92         else xfree((void**)&outmatrix_size);
    93 
    94 }
    95 /*}}}*/
    96 /*FUNCTION FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
     99        else xDelete<int>(outmatrix_size);
     100
     101}
     102/*}}}*/
     103/*FUNCTION FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/
    97104void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){
    98105
     
    121128
    122129                        /*Convert double matrix into integer matrix: */
    123                         outmatrix=(int*)xmalloc(outmatrix_rows*outmatrix_cols*sizeof(int));
     130                        outmatrix=xNew<int>(outmatrix_rows*outmatrix_cols);
    124131                        for(i=0;i<outmatrix_rows*outmatrix_cols;i++)outmatrix[i]=(int)doublematrix[i];
    125132                }
     
    127134        else{
    128135                /*This is an error: we don't have the correct input!: */
    129                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     136                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    130137        }
    131138
     
    136143}
    137144/*}}}*/
    138 /*FUNCTION FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
     145/*FUNCTION FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/
    139146void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){
    140147
     
    163170
    164171                        /*Convert double matrix into integer matrix: */
    165                         outmatrix=(bool*)xmalloc(outmatrix_rows*outmatrix_cols*sizeof(bool));
     172                        outmatrix=xNew<bool>(outmatrix_rows*outmatrix_cols);
    166173                        for(i=0;i<outmatrix_rows;i++)outmatrix[i]=(bool)doublematrix[i];
    167174                }
     
    169176        else{
    170177                /*This is an error: we don't have the correct input!: */
    171                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     178                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    172179        }
    173180
     
    178185}
    179186/*}}}*/
    180 /*FUNCTION FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
     187/*FUNCTION FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/
    181188void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
    182189
     
    224231
    225232                        /*Convert double matrix into bool matrix: */
    226                         outmatrix=(bool*)xmalloc(outmatrix_numel*sizeof(bool));
     233                        outmatrix=xNew<bool>(outmatrix_numel);
    227234                        for(i=0;i<outmatrix_numel;i++)outmatrix[i]=(bool)doublematrix[i];
    228                         xfree((void**)&doublematrix);
    229                 }
    230         }
    231         else{
    232                 /*This is an error: we don't have the correct input!: */
    233                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     235                        xDelete<double>(doublematrix);
     236                }
     237        }
     238        else{
     239                /*This is an error: we don't have the correct input!: */
     240                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    234241        }
    235242                       
     
    239246        if (pndims)*pndims=outmatrix_ndims;
    240247        if (psize )*psize =outmatrix_size;
    241         else xfree((void**)&outmatrix_size);
    242 
    243 }
    244 /*}}}*/
    245 /*FUNCTION FetchData(double** pvector,int* pM,const mxArray* dataref){{{1*/
     248        else xDelete<int>(outmatrix_size);
     249
     250}
     251/*}}}*/
     252/*FUNCTION FetchData(double** pvector,int* pM,const mxArray* dataref){{{*/
    246253void FetchData(double** pvector,int* pM,const mxArray* dataref){
    247254
     
    262269        else{
    263270                /*This is an error: we don't have the correct input!: */
    264                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     271                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    265272        }
    266273
     
    270277}
    271278/*}}}*/
    272 /*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{1*/
     279/*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{*/
    273280void FetchData(int** pvector,int* pM,const mxArray* dataref){
    274281
     
    289296
    290297                /*Convert double vector into integer vector: */
    291                 outvector=(int*)xmalloc(outvector_rows*sizeof(int));
     298                outvector=xNew<int>(outvector_rows);
    292299                for(i=0;i<outvector_rows;i++)outvector[i]=(int)doublevector[i];
    293300        }
    294301        else{
    295302                /*This is an error: we don't have the correct input!: */
    296                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     303                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    297304        }
    298305
     
    302309}
    303310/*}}}*/
    304 /*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{1*/
     311/*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{*/
    305312void FetchData(bool** pvector,int* pM,const mxArray* dataref){
    306313
     
    321328
    322329                /*Convert double vector into integer vector: */
    323                 outvector=(bool*)xmalloc(outvector_rows*sizeof(bool));
     330                outvector=xNew<bool>(outvector_rows);
    324331                for(i=0;i<outvector_rows;i++)outvector[i]=(bool)doublevector[i];
    325332        }
    326333        else{
    327334                /*This is an error: we don't have the correct input!: */
    328                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     335                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    329336        }
    330337
     
    334341}
    335342/*}}}*/
    336 /*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{1*/
     343/*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{*/
    337344void FetchData(float** pvector,int* pM,const mxArray* dataref){
    338345
     
    353360
    354361                /*Convert double vector into float vector: */
    355                 outvector=(float*)xmalloc(outvector_rows*sizeof(float));
     362                outvector=xNew<float>(outvector_rows);
    356363                for(i=0;i<outvector_rows;i++)outvector[i]=(float)doublevector[i];
    357364        }
    358365        else{
    359366                /*This is an error: we don't have the correct input!: */
    360                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     367                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    361368        }
    362369
     
    366373}
    367374/*}}}*/
    368 /*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{1*/
     375/*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{*/
    369376void FetchData(char** pstring,const mxArray* dataref){
    370377
     
    374381        /*Ok, the string should be coming directly from the matlab workspace: */
    375382        if (!mxIsClass(dataref,"char")){
    376                 _error_("input data_type is not a string!");
     383                _error2_("input data_type is not a string!");
    377384        }
    378385        else{
     
    381388               
    382389                stringlen = mxGetM(dataref)*mxGetN(dataref)+1;
    383                 outstring = (char*)xmalloc(sizeof(mxChar)*stringlen);
     390                outstring =xNew<char>(stringlen);
    384391                mxGetString(dataref,outstring,stringlen);
    385392        }
     
    387394        /*Assign output pointers:*/
    388395        *pstring=outstring;
    389 }
    390 /*FUNCTION FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
     396}/*}}}*/
     397/*FUNCTION FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/
    391398void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
    392399
     
    409416        else{
    410417                /*This is an error: we don't have the correct input!: */
    411                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     418                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    412419        }
    413420                       
     
    417424        if (pndims)*pndims=outmatrix_ndims;
    418425        if (psize )*psize =outmatrix_size;
    419         else xfree((void**)&outmatrix_size);
    420 
    421 }
    422 /*}}}*/
    423 /*FUNCTION FetchData(double* pscalar,const mxArray* dataref){{{1*/
     426        else xDelete<int>(outmatrix_size);
     427
     428}
     429/*}}}*/
     430/*FUNCTION FetchData(double* pscalar,const mxArray* dataref){{{*/
    424431void FetchData(double* pscalar,const mxArray* dataref){
    425432
     
    427434
    428435        if (!mxIsClass(dataref,"double")){
    429                 _error_("input data_type is not a double!");
     436                _error2_("input data_type is not a double!");
    430437        }
    431438        else{
     
    438445}
    439446/*}}}*/
    440 /*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{1*/
     447/*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{*/
    441448void FetchData(int* pinteger,const mxArray* dataref){
    442449
     
    444451
    445452        if (!mxIsClass(dataref,"double")){
    446                 _error_("input data_type is not a scalar!");
     453                _error2_("input data_type is not a scalar!");
    447454        }
    448455        else{
     
    455462}
    456463/*}}}*/
    457 /*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{1*/
     464/*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{*/
    458465void FetchData(bool* pboolean,const mxArray* dataref){
    459466
     
    461468
    462469        if (mxIsClass(dataref,"logical")){
    463                 if(mxGetM(dataref)!=1) _error_("input data is not of size 1x1");
    464                 if(mxGetN(dataref)!=1) _error_("input data is not of size 1x1");
     470                if(mxGetM(dataref)!=1) _error2_("input data is not of size 1x1");
     471                if(mxGetN(dataref)!=1) _error2_("input data is not of size 1x1");
    465472                mxbool_ptr=mxGetLogicals(dataref);
    466473        }
    467474        else{
    468                 _error_("input data_type is not a bool!");
     475                _error2_("input data_type is not a bool!");
    469476        }
    470477
     
    474481
    475482/*ISSM objects*/
    476 /*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{1*/
     483/*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{*/
    477484void FetchData(Matrix** pmatrix,const mxArray* dataref){
    478485
     
    488495        else{
    489496                /*This is an error: we don't have the correct input!: */
    490                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     497                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    491498        }
    492499
     
    495502}
    496503/*}}}*/
    497 /*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{1*/
     504/*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{*/
    498505void FetchData(Vector** pvector,const mxArray* dataref){
    499506
     
    512519        else{
    513520                /*This is an error: we don't have the correct input!: */
    514                 _error_("Input parameter of class %s not supported yet",mxGetClassName(dataref));
     521                _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
    515522        }
    516523
     
    519526}
    520527/*}}}*/
    521 /*FUNCTION FetchData(BamgGeom** pbamggeom,const mxArray* dataref){{{1*/
     528/*FUNCTION FetchData(BamgGeom** pbamggeom,const mxArray* dataref){{{*/
    522529void FetchData(BamgGeom** pbamggeom,const mxArray* dataref){
    523530
     
    538545}
    539546/*}}}*/
    540 /*FUNCTION FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){{{1*/
     547/*FUNCTION FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){{{*/
    541548void FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){
    542549
     
    558565}
    559566/*}}}*/
    560 /*FUNCTION FetchData(BamgOpts** pbamgopts,const mxArray* dataref){{{1*/
     567/*FUNCTION FetchData(BamgOpts** pbamgopts,const mxArray* dataref){{{*/
    561568void FetchData(BamgOpts** pbamgopts,const mxArray* dataref){
    562569
     
    602609}
    603610/*}}}*/
    604 /*FUNCTION FetchData(Options** poptions,const mxArray* dataref){{{1*/
     611/*FUNCTION FetchData(Options** poptions,const mxArray* dataref){{{*/
    605612void FetchData(Options** poptions,int istart, int nrhs,const mxArray** pdataref){
    606613
     
    613620        /*Fetch all options*/
    614621        for (int i=istart; i<nrhs; i=i+2){
    615                 if (!mxIsClass(pdataref[i],"char")) _error_("Argument %d must be name of option",i+1);
     622                if (!mxIsClass(pdataref[i],"char")) _error2_("Argument " << i+1 << " must be name of option");
    616623
    617624                FetchData(&name,pdataref[i]);
    618                 if(i+1 == nrhs) _error_("Argument %d must exist and be value of option \"%s\".",i+2,name);
     625                if(i+1 == nrhs) _error2_("Argument " << i+2 << " must exist and be value of option \"" << name << "\".");
    619626
    620627                option=(Option*)OptionParse(name,&pdataref[i+1]);
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabMatrixToDoubleMatrix.cpp

    r12011 r12878  
    22 * \brief: convert a sparse or dense matlab matrix to a double* pointer
    33 */
    4 
    54
    65#ifdef HAVE_CONFIG_H
     
    109#endif
    1110
    12 
    1311/*Matlab includes: */
    1412#include "mex.h"
    15 
    1613#include "../../shared/shared.h"
    1714
    1815int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix){
    1916
    20         int     i,j,count,rows,cols;
    21         double *pmxdoublematrix = NULL;
    22         float  *pmxsinglematrix = NULL;
     17        int        i,j,count,rows,cols;
    2318
    2419        /*output: */
     
    3328
    3429                /*Dealing with sparse matrix: recover size first: */
    35                 pmxdoublematrix=(double*)mxGetPr(mxmatrix);
     30                double* pmxmatrix=(double*)mxGetPr(mxmatrix);
    3631                rows=mxGetM(mxmatrix);
    3732                cols=mxGetN(mxmatrix);
    3833               
    3934                if(rows*cols){
    40                         matrix=(double*)xcalloc(rows*cols,sizeof(double));
     35                        matrix=xNewZeroInit<double>(rows*cols);
    4136
    4237                        /*Now, get ir,jc and pr: */
     
    4843                        for(i=0;i<cols;i++){
    4944                                for(j=0;j<(jc[i+1]-jc[i]);j++){
    50                                         matrix[rows*ir[count]+i]=pmxdoublematrix[count];
     45                                        matrix[rows*ir[count]+i]=pmxmatrix[count];
    5146                                        count++;
    5247                                }
     
    5752        else if(mxIsClass(mxmatrix,"double")){
    5853                /*Dealing with dense matrix: recover pointer and size: */
    59                 pmxdoublematrix=(double*)mxGetPr(mxmatrix);
     54                double* pmxmatrix=(double*)mxGetPr(mxmatrix);
    6055                rows=mxGetM(mxmatrix);
    6156                cols=mxGetN(mxmatrix);
     
    6358                /*Create serial matrix: */
    6459                if(rows*cols){
    65                         matrix=(double*)xcalloc(rows*cols,sizeof(double));
     60                        matrix=xNewZeroInit<double>(rows*cols);
    6661
    6762                        for(i=0;i<rows;i++){
    6863                                for(j=0;j<cols;j++){
    69                                         matrix[cols*i+j]=(double)pmxdoublematrix[rows*j+i];
     64                                        matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
    7065                                }
    7166                        }
     
    7469        else if(mxIsClass(mxmatrix,"single")){
    7570                /*Dealing with dense matrix: recover pointer and size: */
    76                 pmxsinglematrix=(float*)mxGetPr(mxmatrix);
     71                float *pmxmatrix=(float*)mxGetPr(mxmatrix);
    7772                rows=mxGetM(mxmatrix);
    7873                cols=mxGetN(mxmatrix);
     
    8075                /*Create serial matrix: */
    8176                if(rows*cols){
    82                         matrix=(double*)xcalloc(rows*cols,sizeof(double));
     77                        matrix=xNewZeroInit<double>(rows*cols);
    8378
    8479                        for(i=0;i<rows;i++){
    8580                                for(j=0;j<cols;j++){
    86                                         matrix[cols*i+j]=(double)pmxsinglematrix[rows*j+i];
     81                                        matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
     82                                }
     83                        }
     84                }
     85        }
     86        else if(mxIsClass(mxmatrix,"int16")){
     87                /*Dealing with dense matrix: recover pointer and size: */
     88                short int *pmxmatrix=(short*)mxGetPr(mxmatrix);
     89                rows=mxGetM(mxmatrix);
     90                cols=mxGetN(mxmatrix);
     91
     92                /*Create serial matrix: */
     93                if(rows*cols){
     94                        matrix=xNewZeroInit<double>(rows*cols);
     95
     96                        for(i=0;i<rows;i++){
     97                                for(j=0;j<cols;j++){
     98                                        matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
     99                                }
     100                        }
     101                }
     102        }
     103        else if(mxIsClass(mxmatrix,"uint8")){
     104                /*Dealing with dense matrix: recover pointer and size: */
     105                char *pmxmatrix=(char*)mxGetPr(mxmatrix);
     106                rows=mxGetM(mxmatrix);
     107                cols=mxGetN(mxmatrix);
     108
     109                /*Create serial matrix: */
     110                if(rows*cols){
     111                        matrix=xNewZeroInit<double>(rows*cols);
     112
     113                        for(i=0;i<rows;i++){
     114                                for(j=0;j<cols;j++){
     115                                        matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
    87116                                }
    88117                        }
     
    90119        }
    91120        else{
    92                 _error_("Matlab matrix type Not implemented yet");
     121                _error2_("Matlab matrix type Not implemented yet");
    93122        }
    94123
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabMatrixToMatrix.cpp

    r12013 r12878  
    33
    44/*Headers:*/
    5 /*{{{1*/
     5/*{{{*/
    66#ifdef HAVE_CONFIG_H
    77        #include <config.h>
     
    1414#include <string.h>
    1515#include "./matlabio.h"
    16 #include "../../objects/objects.h"
     16#include "../../classes/classes.h"
    1717#include "../../shared/shared.h"
    1818#include "../../Container/Container.h"
     
    3131
    3232        #ifdef _HAVE_PETSC_
    33         MatlabMatrixToPetscMatrix(&matrix->matrix,NULL,NULL,mxmatrix);
     33        matrix->pmatrix=MatlabMatrixToPetscMat(mxmatrix);
    3434        #else
    35         matrix->matrix=MatlabMatrixToSeqMat(mxmatrix);
     35        matrix->smatrix=MatlabMatrixToSeqMat(mxmatrix);
    3636        #endif
    3737       
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabMatrixToSeqMat.cpp

    r12013 r12878  
    33
    44/*Headers:*/
    5 /*{{{1*/
     5/*{{{*/
    66#ifdef HAVE_CONFIG_H
    77        #include <config.h>
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabNArrayToNArray.cpp

    r12013 r12878  
    1515#include <mex.h>
    1616
    17 /*FUNCTION MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{1*/
     17/*FUNCTION MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{*/
    1818int MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){
    1919
     
    3939        ndims=mxGetNumberOfDimensions(mxmatrix);
    4040        ipt  =mxGetDimensions(mxmatrix);
    41         size =(int *) xcalloc(ndims,sizeof(int));
    42         for (i=0; i<ndims; i++) size[i]=(int)ipt[i];
     41        size =xNew<int>(ndims);
     42        for (i=0;i<ndims;i++) size[i]=(int)ipt[i];
    4343
    4444        /*Ok, first check if we are dealing with a sparse or full matrix: */
     
    5151                nz=(int)((double)nnz/(double)rows);
    5252
    53                 matrix=(double*)xcalloc(rows*cols,sizeof(double));
     53                matrix=xNewZeroInit<double>(rows*cols);
    5454
    5555                /*Now, get ir,jc and pr: */
     
    7474               
    7575                /*Create serial matrix: */
    76                 matrix=(double*)xcalloc(numel,sizeof(double));
    77 
    78                 dims=(int *) xcalloc(ndims,sizeof(int));
     76                matrix=xNewZeroInit<double>(numel);
     77
     78                dims=xNew<int>(ndims);
    7979                for(i=0;i<numel;i++){
    8080                        ColumnWiseDimsFromIndex(dims,i,size,ndims);
     
    8282                        *(matrix+j)=*(mxmatrix_ptr+i);
    8383                }
    84                 xfree((void**)&dims);
     84                xDelete<int>(dims);
    8585               
    8686        }
     
    9595}
    9696/*}}}*/
    97 /*FUNCTION MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{1*/
     97/*FUNCTION MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{*/
    9898int MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){
    9999
     
    119119        ndims=mxGetNumberOfDimensions(mxmatrix);
    120120        ipt  =mxGetDimensions(mxmatrix);
    121         size =(int *) xcalloc(ndims,sizeof(int));
    122         for (i=0; i<ndims; i++) size[i]=(int)ipt[i];
     121        size =xNew<int>(ndims);
     122        for (i=0;i<ndims;i++) size[i]=(int)ipt[i];
    123123
    124124        /*Ok, first check if we are dealing with a sparse or full matrix: */
     
    131131                nz=(int)((double)nnz/(double)rows);
    132132
    133                 matrix=(bool*)xcalloc(rows*cols,sizeof(bool));
     133                matrix=xNewZeroInit<bool>(rows*cols);
    134134
    135135                /*Now, get ir,jc and pm: */
     
    154154               
    155155                /*Create serial matrix: */
    156                 matrix=(bool*)xcalloc(numel,sizeof(bool));
    157 
    158                 dims=(int *) xcalloc(ndims,sizeof(int));
     156                matrix=xNew<bool>(numel);
     157                dims=xNew<int>(ndims);
    159158                for(i=0;i<numel;i++){
    160159                        ColumnWiseDimsFromIndex(dims,i,size,ndims);
     
    162161                        *(matrix+j)=(bool)*(mxmatrix_ptr+i);
    163162                }
    164                 xfree((void**)&dims);
    165                
     163                xDelete<int>(dims);
    166164        }
    167165
     
    175173}
    176174/*}}}*/
    177 /*FUNCTION MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{1*/
     175/*FUNCTION MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{*/
    178176int MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){
    179177
    180         int  i,j,rows,cols;
    181         int  numel,ndims;
    182         int *size,*dims;
    183         mxChar* mxmatrix_ptr=NULL;
    184         const mwSize* ipt=NULL;
     178        int           i,j,rows,cols;
     179        int           numel,ndims;
     180        int          *size , *dims;
     181        mxChar       *mxmatrix_ptr = NULL;
     182        const mwSize *ipt          = NULL;
    185183
    186184        /*output: */
     
    188186
    189187        /*matlab indices: */
    190         mwIndex*    ir=NULL;
    191         mwIndex*    jc=NULL;
    192         char*   pm=NULL;
    193         int     count;
    194         int     nnz;
    195         int     nz;
     188        mwIndex *ir    = NULL;
     189        mwIndex *jc    = NULL;
     190        char    *pm    = NULL;
     191        int      count;
     192        int      nnz;
     193        int      nz;
    196194
    197195        /*get Matlab matrix information: */
     
    199197        ndims=mxGetNumberOfDimensions(mxmatrix);
    200198        ipt  =mxGetDimensions(mxmatrix);
    201         size =(int *) xcalloc(ndims,sizeof(int));
    202         for (i=0; i<ndims; i++) size[i]=(int)ipt[i];
     199        size =xNew<int>(ndims);
     200        for (i=0;i<ndims;i++) size[i]=(int)ipt[i];
    203201
    204202        /*Ok, first check if we are dealing with a sparse or full matrix: */
     
    211209                nz=(int)((double)nnz/(double)rows);
    212210
    213                 matrix=(char*)xcalloc(rows*cols,sizeof(double));
     211                matrix=xNew<char>(rows*cols);
    214212
    215213                /*Now, get ir,jc and pm: */
     
    234232               
    235233                /*Create serial matrix: */
    236                 matrix=(char*)xcalloc(numel+1,sizeof(mxChar));
     234                matrix=xNew<char>(numel+1);
     235                matrix[numel]='\0';
    237236
    238237                /*looping code adapted from Matlab example explore.c: */
     
    259258                        }
    260259                }
    261 
    262260        }
    263261
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabVectorToDoubleVector.cpp

    r12011 r12878  
    4646               
    4747                /*Check that input is actualy a vector*/
    48                 if (cols!=1) _error_("input vector of size %ix%i should have only one column",rows,cols);
     48                if (cols!=1) _error2_("input vector of size " << rows << "x" << cols << " should have only one column");
    4949
    5050                nz=(int)((double)nnz/(double)rows);
    5151
    5252                if(rows){
    53                         vector=(double*)xcalloc(rows,sizeof(double));
     53                        vector=xNewZeroInit<double>(rows);
    5454
    5555                        /*Now, get ir,jc and pr: */
     
    7777
    7878                /*Check that input is actualy a vector*/
    79                 if (cols!=1) _error_("input vector of size %ix%i should have only one column",rows,cols);
     79                if (cols!=1) _error2_("input vector of size " << rows << "x" << cols << " should have only one column");
    8080
    8181                /*allocate and memcpy*/
    8282                if(rows){
    83                         vector=(double*)xmalloc(rows*sizeof(double));
     83                        vector=xNew<double>(rows);
    8484                        memcpy(vector,mxvector_ptr,rows*sizeof(double));
    8585                }
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabVectorToSeqVec.cpp

    r12013 r12878  
    33
    44/*Headers:*/
    5 /*{{{1*/
     5/*{{{*/
    66#ifdef HAVE_CONFIG_H
    77        #include <config.h>
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabVectorToVector.cpp

    r12013 r12878  
    33
    44/*Headers:*/
    5 /*{{{1*/
     5/*{{{*/
    66#ifdef HAVE_CONFIG_H
    77        #include <config.h>
     
    1414#include <string.h>
    1515#include "./matlabio.h"
    16 #include "../../objects/objects.h"
     16#include "../../classes/classes.h"
    1717#include "../../shared/shared.h"
    1818#include "../../Container/Container.h"
     
    3131
    3232        #ifdef _HAVE_PETSC_
    33         MatlabVectorToPetscVector(&vector->vector,&dummy,mxvector);
     33        vector->pvector=MatlabVectorToPetscVec(mxvector);
    3434        #else
    35         vector->vector=MatlabVectorToSeqVec(mxvector);
     35        vector->svector=MatlabVectorToSeqVec(mxvector);
    3636        #endif
    3737       
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/OptionParse.cpp

    r12258 r12878  
    88#endif
    99
     10#include <cstring>
     11#include <mex.h>
    1012#include "../../shared/shared.h"
    1113#include "../../io/io.h"
     
    1315#include "./matlabio.h"
    1416
    15 #include <mex.h>
    16 
    17 /*FUNCTION OptionDoubleParse {{{1*/
     17/*FUNCTION OptionDoubleParse {{{*/
    1818OptionDouble* OptionDoubleParse( char* name, const mxArray* prhs[]){
    1919
     
    2222        /*check and parse the name  */
    2323        odouble=new OptionDouble;
    24         odouble->name =(char *) xmalloc((strlen(name)+1)*sizeof(char));
     24        odouble->name =xNew<char>(strlen(name)+1);
    2525        memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
    2626
    2727        /*check and parse the value  */
    2828        if (!mxIsClass(prhs[0],"double")){
    29                 _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",odouble->name,"double",odouble->name,mxGetClassName(prhs[0]));
     29                _error2_("Value of option \"" << odouble->name  << "\" must be class \"double\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
    3030        }
    31 
    3231        FetchData(&odouble->values,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]);
    3332
    3433        return(odouble);
    3534}/*}}}*/
    36 /*FUNCTION OptionLogicalParse {{{1*/
     35/*FUNCTION OptionLogicalParse {{{*/
    3736OptionLogical* OptionLogicalParse( char* name, const mxArray* prhs[]){
    3837
     
    4140        /*check and parse the name  */
    4241        ological=new OptionLogical;
    43         ological->name =(char*)xmalloc((strlen(name)+1)*sizeof(char));
     42        ological->name =xNew<char>(strlen(name)+1);
    4443        memcpy(ological->name,name,(strlen(name)+1)*sizeof(char));
    4544
    4645        /*check and parse the value  */
    4746        if (!mxIsClass(prhs[0],"logical")){
    48                 _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ological->name,"logical",ological->name,mxGetClassName(prhs[0]));
     47                _error2_("Value of option \"" << ological->name  << "\" must be class \"logical\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
    4948        }
    50 
    5149        FetchData(&ological->values,&ological->numel,&ological->ndims,&ological->size,prhs[0]);
    5250
    5351        return(ological);
    5452}/*}}}*/
    55 /*FUNCTION OptionCharParse {{{1*/
     53/*FUNCTION OptionCharParse {{{*/
    5654OptionChar* OptionCharParse( char* name, const mxArray* prhs[]){
    5755
     
    6058        /*check and parse the name  */
    6159        ochar=new OptionChar();
    62         ochar->name =(char*)xmalloc((strlen(name)+1)*sizeof(char));
     60        ochar->name =xNew<char>(strlen(name)+1);
    6361        memcpy(ochar->name,name,(strlen(name)+1)*sizeof(char));
    6462
    6563        /*check and parse the value  */
    6664        if (!mxIsClass(prhs[0],"char")){
    67                 _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ochar->name,"char",ochar->name,mxGetClassName(prhs[0]));
     65                _error2_("Value of option \"" << ochar->name  << "\" must be class \"char\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
    6866        }
    69 
    7067        FetchData(&ochar->values,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]);
    7168
    7269        return(ochar);
    7370}/*}}}*/
    74 /*FUNCTION OptionStructParse {{{1*/
     71/*FUNCTION OptionStructParse {{{*/
    7572OptionStruct* OptionStructParse( char* name, const mxArray* prhs[]){
    7673
     
    8582        /*check and parse the name  */
    8683        ostruct=new OptionStruct;
    87         ostruct->name =(char*)xmalloc((strlen(name)+1)*sizeof(char));
     84        ostruct->name =xNew<char>(strlen(name)+1);
    8885        memcpy(ostruct->name,name,(strlen(name)+1)*sizeof(char));
    8986
    9087        /*check and parse the value  */
    9188        if (!mxIsClass(prhs[0],"struct")){
    92                 _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ostruct->name,"struct",ostruct->name,mxGetClassName(prhs[0]));
     89                _error2_("Value of option \"" << ostruct->name  << "\" must be class \"struct\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
    9390        }
    94 
    9591        ostruct->numel=mxGetNumberOfElements(prhs[0]);
    9692        ostruct->ndims=mxGetNumberOfDimensions(prhs[0]);
    9793        ipt           =mxGetDimensions(prhs[0]);
    98         ostruct->size =(int *) xmalloc(ostruct->ndims*sizeof(int));
     94        ostruct->size =xNew<int>(ostruct->ndims);
    9995        for (i=0; i<ostruct->ndims; i++) ostruct->size[i]=(int)ipt[i];
    100         if (ostruct->numel) ostruct->values=(Options**) xmalloc(ostruct->numel*sizeof(Options *));
     96        if (ostruct->numel) ostruct->values=xNew<Options*>(ostruct->numel);
    10197
    10298        /*loop through and process each element of the struct array  */
     
    117113        return(ostruct);
    118114}/*}}}*/
    119 /*FUNCTION OptionCellParse {{{1*/
     115/*FUNCTION OptionCellParse {{{*/
    120116OptionCell* OptionCellParse( char* name, const mxArray* prhs[]){
    121117
     
    132128        /*check and parse the name  */
    133129        ocell=new OptionCell;
    134         ocell->name =(char *) xmalloc((strlen(name)+1)*sizeof(char));
     130        ocell->name =xNew<char>(strlen(name)+1);
    135131        memcpy(ocell->name,name,(strlen(name)+1)*sizeof(char));
    136132
    137133        /*check and parse the value  */
    138134        if (!mxIsClass(prhs[0],"cell")){
    139                 _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ocell->name,"cell",ocell->name,mxGetClassName(prhs[0]));
     135                _error2_("Value of option \"" << ocell->name  << "\" must be class \"cell\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
    140136        }
    141137
     
    143139        ocell->ndims=mxGetNumberOfDimensions(prhs[0]);
    144140        ipt         =mxGetDimensions(prhs[0]);
    145         ocell->size =(int *) xmalloc(ocell->ndims*sizeof(int));
     141        ocell->size =xNew<int>(ocell->ndims);
    146142        for (i=0; i<ocell->ndims; i++) ocell->size[i]=(int)ipt[i];
    147143        ocell->values=new Options;
    148144
    149145        /*loop through and process each element of the cell array  */
    150         dims=(int *) xmalloc(ocell->ndims*sizeof(int));
     146        dims=xNew<int>(ocell->ndims);
    151147        for (cindex=0; cindex<ocell->numel; cindex++) {
    152148                ColumnWiseDimsFromIndex(dims,(int)cindex,ocell->size,ocell->ndims);
     
    163159                option=NULL;
    164160        }
    165         xfree((void**)&dims);
     161        xDelete<int>(dims);
    166162
    167163        return(ocell);
    168164}/*}}}*/
    169 /*FUNCTION OptionParse{{{1*/
     165/*FUNCTION OptionParse{{{*/
    170166Option* OptionParse(char* name, const mxArray* prhs[]){
    171167
     
    180176        else if(mxIsClass(prhs[0],"cell"))    option=(Option*)OptionCellParse(name,prhs);
    181177        else {
    182                 _printf_(true,"  Converting value of option \"%s\" from unrecognized class \"%s\" to class \"%s\".\n",name,mxGetClassName(prhs[0]),"struct");
     178                _pprintLine_("  Converting value of option \"" << name << "\" from unrecognized class \"" << mxGetClassName(prhs[0]) << "\" to class \"" << "struct" << "\".");
    183179                if (!mexCallMATLAB(1,lhs,1,(mxArray**)prhs,"struct")) {
    184180                        option=(Option*)OptionStructParse(name,(const mxArray**)lhs);
    185181                        mxDestroyArray(lhs[0]);
    186182                }
    187                 else _error_("Second argument value of option \"%s\" is of unrecognized class \"%s\".",name,mxGetClassName(prhs[0]));
     183                else _error2_("Second argument value of option \""<< name <<"\" is of unrecognized class \""<< mxGetClassName(prhs[0]) <<"\".");
    188184        }
    189185
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/PrintfFunction.cpp

    r12016 r12878  
    2727
    2828                /*allocate buffer for given string size*/
    29                 buffer=(char*)xmalloc(size*sizeof(char));
     29                buffer=xNew<char>(size);
    3030
    3131                /* Try to print in the allocated space. */
     
    4747                 size*=2;  /* twice the old size */
    4848
    49                 xfree((void**)&buffer);
     49                xDelete<char>(buffer);
    5050        }
    5151
    5252        /*Ok, if we are running in parallel, get node 0 to print*/
    53         if(my_rank==0)printf(buffer);
     53        if(my_rank==0)_printString_(buffer);
    5454
    5555        /*Clean up and return*/
    56         xfree((void**)&buffer);
     56        xDelete<char>(buffer);
    5757        return 1;
    5858}
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/WriteMatlabData.cpp

    r12102 r12878  
    1717
    1818/*Primitive data types*/
    19 /*FUNCTION WriteData(mxArray** pdataref,double* matrix, int M,int N){{{1*/
     19/*FUNCTION WriteData(mxArray** pdataref,double* matrix, int M,int N){{{*/
    2020void WriteData(mxArray** pdataref,double* matrix, int M,int N){
    2121
     
    4242}
    4343/*}}}*/
    44 /*FUNCTION WriteData(mxArray** pdataref,int* matrix, int M,int N){{{1*/
     44/*FUNCTION WriteData(mxArray** pdataref,int* matrix, int M,int N){{{*/
    4545void WriteData(mxArray** pdataref,int* matrix, int M,int N){
    4646
     
    6767}
    6868/*}}}*/
    69 /*FUNCTION WriteData(mxArray** pdataref,double* vector, int M){{{1*/
     69/*FUNCTION WriteData(mxArray** pdataref,double* vector, int M){{{*/
    7070void WriteData(mxArray** pdataref,double* vector, int M){
    7171       
     
    9090}
    9191/*}}}*/
    92 /*FUNCTION WriteData(mxArray** pdataref,double scalar){{{1*/
     92/*FUNCTION WriteData(mxArray** pdataref,double scalar){{{*/
    9393void WriteData(mxArray** pdataref,double scalar){
    9494
     
    9696}
    9797/*}}}*/
    98 /*FUNCTION WriteData(mxArray** pdataref,int integer){{{1*/
     98/*FUNCTION WriteData(mxArray** pdataref,int integer){{{*/
    9999void WriteData(mxArray** pdataref,int integer){
    100100
     
    103103}
    104104/*}}}*/
    105 /*FUNCTION WriteData(mxArray** pdataref,int boolean){{{1*/
     105/*FUNCTION WriteData(mxArray** pdataref,int boolean){{{*/
    106106void WriteData(mxArray** pdataref,bool boolean){
    107107
     
    110110}
    111111/*}}}*/
    112 /*FUNCTION WriteData(mxArray** pdataref,char* string){{{1*/
     112/*FUNCTION WriteData(mxArray** pdataref,char* string){{{*/
    113113void WriteData(mxArray** pdataref,char* string){
    114114
     
    118118
    119119/*ISSM objects*/
    120 /*FUNCTION WriteData(mxArray** pdataref,BamgGeom* bamggeom){{{1*/
     120/*FUNCTION WriteData(mxArray** pdataref,BamgGeom* bamggeom){{{*/
    121121void WriteData(mxArray** pdataref,BamgGeom* bamggeom){
    122122
     
    158158}
    159159/*}}}*/
    160 /*FUNCTION WriteData(mxArray** pdataref,BamgMesh* bamgmesh){{{1*/
     160/*FUNCTION WriteData(mxArray** pdataref,BamgMesh* bamgmesh){{{*/
    161161void WriteData(mxArray** pdataref,BamgMesh* bamgmesh){
    162162
     
    216216}
    217217/*}}}*/
    218 /*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{1*/
     218/*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{*/
    219219void WriteData(mxArray** pdataref,Matrix* matrix){
    220220               
     
    227227        if(matrix){
    228228               
    229                 #ifdef _HAVE_PETSC_
    230                 PetscMatrixToDoubleMatrix(&matrix_ptr,&rows,&cols,matrix->matrix);
    231                 #else
    232                 matrix_ptr=matrix->matrix->ToSerial();
    233                 matrix->matrix->GetSize(&rows,&cols);
    234                 #endif
     229                matrix_ptr=matrix->ToSerial();
     230                matrix->GetSize(&rows,&cols);
    235231
    236232                /*Now transpose the matrix and allocate with Matlab's memory manager: */
     
    249245
    250246                /*Free ressources:*/
    251                 xfree((void**)&matrix_ptr);
    252 
    253         }
    254         else{
    255                 dataref = mxCreateDoubleMatrix(0,0,mxREAL);
    256         }
    257 
    258         *pdataref=dataref;
    259 }
    260 /*}}}*/
    261 /*FUNCTION WriteData(mxArray** pdataref,Vector* vector){{{1*/
     247                xDelete<double>(matrix_ptr);
     248
     249        }
     250        else{
     251                dataref = mxCreateDoubleMatrix(0,0,mxREAL);
     252        }
     253
     254        *pdataref=dataref;
     255}
     256/*}}}*/
     257/*FUNCTION WriteData(mxArray** pdataref,Vector* vector){{{*/
    262258void WriteData(mxArray** pdataref,Vector* vector){
    263259       
     
    269265        if(vector){
    270266                /*call toolkit routine: */
    271                 #ifdef _HAVE_PETSC_
    272                 PetscVectorToDoubleVector(&vector_ptr,&rows,vector->vector);
    273                 #else
    274                 vector_ptr=vector->vector->ToMPISerial();
    275                 vector->vector->GetSize(&rows);
    276                 #endif
     267                vector_ptr=vector->ToMPISerial();
     268                vector->GetSize(&rows);
    277269               
    278270                /*now create the matlab vector with Matlab's memory manager */
     
    290282
    291283        /*Clean-up and return*/
    292         xfree((void**)&vector_ptr);
     284        xDelete<double>(vector_ptr);
    293285        *pdataref=dataref;
    294286}
     
    296288
    297289/*Toolkit*/
    298 /*FUNCTION SetStructureField{{{1*/
     290/*FUNCTION SetStructureField{{{*/
    299291void SetStructureField(mxArray* dataref,const char* fieldname,int M,int N,double* fieldpointer){
    300292
  • issm/branches/trunk-jpl-damage/src/c/matlab/io/matlabio.h

    r12102 r12878  
    1212#endif
    1313
    14 #include "../../objects/objects.h"
     14#include "../../classes/classes.h"
    1515#include "../../Container/Container.h"
    1616#include "../../include/include.h"
     
    7979/*Matlab to Petsc routines: */
    8080#ifdef _HAVE_PETSC_
    81 int MatlabMatrixToPetscMatrix(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
    82 int MatlabVectorToPetscVector(Vec* pvector,int* pvector_rows,const mxArray* mxvector);
     81int MatlabMatrixToPetscMat(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
     82PetscMat* MatlabMatrixToPetscMat(const mxArray* mxmatrix);
     83int MatlabVectorToPetscVec(Vec* pvector,int* pvector_rows,const mxArray* mxvector);
     84PetscVec* MatlabVectorToPetscVec(const mxArray* mxvector);
    8385#endif
    8486
  • issm/branches/trunk-jpl-damage/src/c/modules/AddExternalResultx/AddExternalResultx.cpp

    r4554 r12878  
    77#include "../../Container/Container.h"
    88#include "../../io/io.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010               
    1111void AddExternalResultx( DataSet* results, int enumtype, double value){
  • issm/branches/trunk-jpl-damage/src/c/modules/AverageFilterx/AverageFilterx.cpp

    r3913 r12878  
    1818
    1919        /*output: */
    20         double*         imageout=NULL;
     20        double* imageout=NULL;
    2121
    22         imageout=(double*)xmalloc(samps*lines*sizeof(double));
     22        imageout=xNew<double>(samps*lines);
    2323
    2424        for ( i = 0; i < lines; i++ ){
  • issm/branches/trunk-jpl-damage/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp

    r11708 r12878  
    6565
    6666        /*Free ressources:*/
    67         xfree((void**)&qmu_part);
     67        xDelete<double>(qmu_part);
    6868        xdelete(&partition_contributions);
    6969        xdelete(&partition_areas);
  • issm/branches/trunk-jpl-damage/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.h

    r6231 r12878  
    66#define _AVERAGEONTOPARTITIONXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp

    r5208 r12878  
    77#include "../../include/include.h"
    88#include "../../toolkits/toolkits.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/bamg/bamgobjects.h"
    1010
    1111using namespace bamg;
    1212using namespace std;
    1313
    14 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,double* index,double* x,double* y,int nods,int nels){
    15 
    16         /*Intermediary*/
    17         int i,j,k;
    18         int verbose=0;
    19         int noerr=1;
     14int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,int* index,double* x,double* y,int nods,int nels){
    2015
    2116        /*Options*/
    22         BamgOpts* bamgopts=NULL;
    23         bamgopts=new BamgOpts();
     17        BamgOpts* bamgopts=new BamgOpts();
    2418
    25         // read mesh
    26         if(verbose) printf("Reading mesh\n");
     19        /*read mesh*/
    2720        Mesh Th(index,x,y,nods,nels);
    2821
    29         //write mesh and geometry
    30         if (verbose) printf("Write Geometry\n");
     22        /*write mesh and geometry*/
    3123        Th.Gh.WriteGeometry(bamggeom,bamgopts);
    32         if (verbose) printf("Write Mesh\n");
    3324        Th.WriteMesh(bamgmesh,bamgopts);
    3425
    35         //clean up
     26        /*clean up and return*/
    3627        delete bamgopts;
    37 
    38         /*No error return*/
    39         return noerr;
     28        return 1;
    4029
    4130}
  • issm/branches/trunk-jpl-damage/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.h

    r3913 r12878  
    66#define _BAMGCONVERTMESHX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
    11 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,double* index,double* x,double* y,int nods,int nels);
     11int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,int* index,double* x,double* y,int nods,int nels);
    1212
    1313#endif
  • issm/branches/trunk-jpl-damage/src/c/modules/BamgTriangulatex/BamgTriangulatex.cpp

    r11401 r12878  
    77#include "../../include/include.h"
    88#include "../../toolkits/toolkits.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111using namespace bamg;
  • issm/branches/trunk-jpl-damage/src/c/modules/BamgTriangulatex/BamgTriangulatex.h

    r10205 r12878  
    66#define _BAMGTRIANGULATEX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Bamgx/Bamgx.cpp

    r12258 r12878  
    33 */
    44#include "./Bamgx.h"
    5 #include "../../objects/objects.h"
     5#include "../../classes/bamg/bamgobjects.h"
    66#include "../../shared/shared.h"
    77#include "../../include/include.h"
     
    3838        /*If no mesh in input, generate one*/
    3939        if(bamgmesh_in->TrianglesSize[0]==0){
    40                 /*Mesh generation {{{1*/
     40                /*Mesh generation {{{*/
    4141
    4242                //Step1: generate geometry Gh
    43                 if (verbosity>0) printf("Construction of a mesh from a given geometry\n");
    44                 if (verbosity>1) printf("   Processing geometry...\n");
     43                if (verbosity>0) _printLine_("Construction of a mesh from a given geometry");
     44                if (verbosity>1) _printLine_("   Processing geometry...");
    4545                Geometry Gh(bamggeom_in,bamgopts);
    4646
     
    5050
    5151                //build metric using geometry
    52                 if (verbosity>1) printf("   Generating Metric...\n");
     52                if (verbosity>1) _printLine_("   Generating Metric...");
    5353                for(i=0;i<Gh.nbv;i++){
    5454                        Metric M=Gh[i];
     
    6060
    6161                //generate mesh
    62                 if (verbosity>1) printf("   Generating Mesh...\n");
     62                if (verbosity>1) _printLine_("   Generating Mesh...");
    6363                Mesh Th(maxnbv,Gh,bamgopts);
    6464
     
    7373
    7474                //Build output
    75                 if (verbosity>1) printf("   Write Mesh...\n");
     75                if (verbosity>1) _printLine_("   Write Mesh...");
    7676                Th.WriteMesh(bamgmesh_out,bamgopts);
    77                 if (verbosity>1) printf("   Write Geometry...\n");
     77                if (verbosity>1) _printLine_("   Write Geometry...");
    7878                Gh.WriteGeometry(bamggeom_out,bamgopts);
    7979
     
    8484        }
    8585        else{
    86                 /*Anisotropic mesh adaptation {{{1*/
     86                /*Anisotropic mesh adaptation {{{*/
    8787
    8888                // read background mesh
    89                 if (verbosity>0) printf("Anisotropic mesh adaptation\n");
    90                 if (verbosity>1) printf("   Processing initial mesh and geometry...\n");
     89                if (verbosity>0) _printLine_("Anisotropic mesh adaptation");
     90                if (verbosity>1) _printLine_("   Processing initial mesh and geometry...");
    9191                Mesh BTh(bamggeom_in,bamgmesh_in,bamgopts);
    9292
     
    100100                //Generate initial metric
    101101                if (bamgopts->metric){
    102                         if (verbosity>1) printf("   Processing Metric...\n");
     102                        if (verbosity>1) _printLine_("   Processing Metric...");
    103103                        BTh.ReadMetric(bamgopts);
    104104                }
    105105                else {
    106                         if (verbosity>1) printf("   Generating initial Metric...\n");
     106                        if (verbosity>1) _printLine_("   Generating initial Metric...");
    107107                        Metric Mhmax(bamgopts->hmax);
    108108                        for (int iv=0;iv<BTh.nbv;iv++) BTh[iv].m = Mhmax;
     
    111111                //use present fields to generate metric if present
    112112                if (bamgopts->field){
    113                         if (verbosity>1) printf("   Merge metric with field provided...\n");
     113                        if (verbosity>1) _printLine_("   Merge metric with field provided...");
    114114                        BTh.AddMetric(bamgopts);
    115115                }
     
    117117                // change using hVertices if provided
    118118                if(bamgopts->hVertices && bamgopts->hVerticesSize[0]==BTh.nbv){
    119                         if (verbosity>1) printf("   Merging Metric with hVertices...\n");
     119                        if (verbosity>1) _printLine_("   Merging Metric with hVertices...");
    120120                        for (i=0;i<BTh.nbv;i++){
    121                                 if (!isnan(bamgopts->hVertices[i])){
     121                                if (!xIsNan<IssmDouble>(bamgopts->hVertices[i])){
    122122                                        BTh[i].m=Metric((float)bamgopts->hVertices[i]);
    123123                                }
     
    127127                // change using hminVertices if provided
    128128                if (bamgopts->hminVertices){
    129                         if (verbosity>1) printf("   Merging Metric with hminVertices...\n");
     129                        if (verbosity>1) _printLine_("   Merging Metric with hminVertices...");
    130130                        for (i=0;i<BTh.nbv;i++){
    131                                 if (!isnan(bamgopts->hminVertices[i])){
     131                                if (!xIsNan<IssmDouble>(bamgopts->hminVertices[i])){
    132132                                        Metric M=BTh.vertices[i].m;
    133133                                        EigenMetric Vp(M/coef);
     
    140140                // change using hmaxVertices if provided
    141141                if (bamgopts->hmaxVertices){
    142                         if (verbosity>1) printf("   Merging Metric with hmaxVertices...\n");
     142                        if (verbosity>1) _printLine_("   Merging Metric with hmaxVertices...");
    143143                        for (i=0;i<BTh.nbv;i++){
    144                                 if (!isnan(bamgopts->hmaxVertices[i])){
     144                                if (!xIsNan<IssmDouble>(bamgopts->hmaxVertices[i])){
    145145                                        Metric M=BTh.vertices[i].m;
    146146                                        EigenMetric Vp(M/coef);
     
    164164
    165165                //Build new mesh
    166                 if (verbosity>1) printf("   Generating Mesh...\n");
     166                if (verbosity>1) _printLine_("   Generating Mesh...");
    167167                Thr=&BTh,Thb=0;
    168168                Mesh & Th( *(0 ?  new Mesh(*Thr,&Thr->Gh,Thb,maxnbv) :  new Mesh(maxnbv,BTh,bamgopts,bamgopts->KeepVertices)));
     
    185185                if(verbosity>0) {
    186186                        if (Th.nbt-Th.nbtout-Th.nbq*2){
    187                                 printf("   new number of triangles = %i\n",(Th.nbt-Th.nbtout-Th.nbq*2));
     187                                _printLine_("   new number of triangles = " << (Th.nbt-Th.nbtout-Th.nbq*2));
    188188                        }
    189189                        if (Th.nbq ){
    190                                 printf("   new number of quads = %i\n",Th.nbq);
     190                                _printLine_("   new number of quads = " << Th.nbq);
    191191                        }
    192192                }
    193193
    194194                //Build output
    195                 if (verbosity>1) printf("   Write Mesh...\n");
     195                if (verbosity>1) _printLine_("   Write Mesh...");
    196196                Th.WriteMesh(bamgmesh_out,bamgopts);
    197                 if (verbosity>1) printf("   Write Geometry...\n");
     197                if (verbosity>1) _printLine_("   Write Geometry...");
    198198                Th.Gh.WriteGeometry(bamggeom_out,bamgopts);
    199                 if (verbosity>1) printf("   Write Metric...\n");
     199                if (verbosity>1) _printLine_("   Write Metric...");
    200200                BTh.WriteMetric(bamgopts);
    201201
     
    207207
    208208        /*No error return*/
    209         if (verbosity>1) printf("   Exiting Bamg.\n");
     209        if (verbosity>1) _printLine_("   Exiting Bamg.");
    210210        return noerr;
    211211
  • issm/branches/trunk-jpl-damage/src/c/modules/Bamgx/Bamgx.h

    r3910 r12878  
    66#define _BAMGX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/bamg/bamgobjects.h"
    99
    1010/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Chacox/Chacox.cpp

    r11401 r12878  
    6666
    6767        if (DEBUG_TRACE > 0) {
    68                 printf("<Entering main>\n");
     68                _printLine_("<Entering main>");
    6969        }
    7070
    7171        if (PRINT_HEADERS) {
    72                 printf("\n                    Chaco 2.0\n");
    73                 printf("          Sandia National Laboratories\n\n");
     72                _printLine_("\n                    Chaco 2.0");
     73                _printLine_("          Sandia National Laboratories\n");
    7474        }
    7575
     
    177177
    178178        if (DEBUG_MEMORY > 0) {
    179                 printf("\n");
     179                _printLine_("");
    180180                smalloc_stats();
    181181        }
     
    185185
    186186        if (DEBUG_TRACE > 1) {
    187                 printf("<Leaving main>\n");
     187                _printLine_("<Leaving main>");
    188188        }
    189189       
  • issm/branches/trunk-jpl-damage/src/c/modules/Chacox/Chacox.h

    r9320 r12878  
    3333
    3434#include "../../Container/Container.h"
    35 #include "../../objects/objects.h"
     35#include "../../classes/objects/objects.h"
    3636
    3737/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Chacox/input_parse.cpp

    r11401 r12878  
    3838
    3939        if (DEBUG_TRACE > 0) {
    40                 printf("<Entering input_parse>\n");
     40                _printLine_("<Entering input_parse>");
    4141        }
    4242
    4343        if (PROMPT) {
    44                 printf("Parallel machine architecture:\n");
    45                 printf("  (0) Hypercube\n");
    46                 printf("  (1) One-dimensional mesh\n");
    47                 printf("  (2) Two-dimensional mesh\n");
    48                 printf("  (3) Three-dimensional mesh\n");
     44                _printLine_("Parallel machine architecture:");
     45                _printLine_("  (0) Hypercube");
     46                _printLine_("  (1) One-dimensional mesh");
     47                _printLine_("  (2) Two-dimensional mesh");
     48                _printLine_("  (3) Three-dimensional mesh");
    4949        }
    5050        *architecture = (int)options[OPT_ARCH];
     
    5757        /* Name output assignment file. */
    5858        if (PROMPT)
    59                 printf("Assignment output file: ");
     59                _printString_("Assignment output file: ");
    6060        outassignname = NULL;
    6161
    6262        /* Name output results file. */
    6363        if (PROMPT)
    64                 printf("File name for saving run results: ");
     64                _printString_("File name for saving run results: ");
    6565        outfilename = NULL;
    6666
     
    7575        else {
    7676                if (PROMPT) {
    77                         printf("Global partitioning method:\n");
    78                         printf("  (1) Multilevel-KL\n");
    79                         printf("  (2) Spectral\n");
    80                         printf("  (3) Inertial\n");
    81                         printf("  (4) Linear\n");
    82                         printf("  (5) Random\n");
    83                         printf("  (6) Scattered\n");
    84                         printf("  (7) Read-from-file\n");
     77                        _printLine_("Global partitioning method:");
     78                        _printLine_("  (1) Multilevel-KL");
     79                        _printLine_("  (2) Spectral");
     80                        _printLine_("  (3) Inertial");
     81                        _printLine_("  (4) Linear");
     82                        _printLine_("  (5) Random");
     83                        _printLine_("  (6) Scattered");
     84                        _printLine_("  (7) Read-from-file");
    8585                }
    8686                *global_method = (int)options[OPT_GLOBAL];
     
    9494        if (*global_method == 7) {      /* Name and open input assignment file. */
    9595                if (PROMPT)
    96                         printf("Assignment input file: ");
     96                        _printString_("Assignment input file: ");
    9797        }
    9898
    9999        else if (*global_method == 3) {
    100100                if (PROMPT)
    101                         printf("Geometry input file name: ");
     101                        _printString_("Geometry input file name: ");
    102102        }
    103103
    104104        else if (*global_method == 2) {
    105105                if (PROMPT) {
    106                         printf("Eigensolver:\n");
    107                         printf("  (1) Multilevel RQI/Symmlq\n");
    108                         printf("  (2) Lanczos\n");
     106                        _printLine_("Eigensolver:");
     107                        _printLine_("  (1) Multilevel RQI/Symmlq");
     108                        _printLine_("  (2) Lanczos");
    109109                }
    110110                eigensolver = (int)options[OPT_RQI];
     
    117117                        if (MATCH_TYPE == 5) {  /* geometric matching */
    118118                                if (PROMPT)
    119                                         printf("Geometry input file name: ");
     119                                        _printString_("Geometry input file name: ");
    120120                        }
    121121                        *rqi_flag = 1;
    122122                        if (PROMPT)
    123                                 printf("Number of vertices to coarsen down to: ");
     123                                _printString_("Number of vertices to coarsen down to: ");
    124124                        *vmax = (int)options[OPT_VMAX];
    125125                        if (*vmax <= 0) {
     
    137137                if (MATCH_TYPE == 5) {          /* geometric matching */
    138138                        if (PROMPT)
    139                                 printf("Geometry input file name: ");
    140                 }
    141                 if (PROMPT)
    142                         printf("Number of vertices to coarsen down to: ");
     139                                _printString_("Geometry input file name: ");
     140                }
     141                if (PROMPT)
     142                        _printString_("Number of vertices to coarsen down to: ");
    143143                *vmax = (int)options[OPT_VMAX];
    144144                if (*vmax <= 0) {
     
    168168        else {
    169169                if (PROMPT) {
    170                         printf("Local refinement method:\n");
    171                         printf("  (1) Kernighan-Lin\n");
    172                         printf("  (2) None\n");
     170                        _printLine_("Local refinement method:");
     171                        _printLine_("  (1) Kernighan-Lin");
     172                        _printLine_("  (2) None");
    173173                }
    174174                *local_method = (int)options[OPT_LOCAL];
     
    185185                *ndims_tot = 0;
    186186                if (PROMPT)
    187                         printf("Total number of target hypercube dimensions: ");
     187                        _printString_("Total number of target hypercube dimensions: ");
    188188                *ndims_tot = nparts[0];
    189189                if (*ndims_tot < 1) {
    190                         printf(" Number of divisions must be at least 1\n");
     190                        _printLine_(" Number of divisions must be at least 1");
    191191                        printf("%s -- Number of divisions %d must be at least 1.\n",
    192192                                   __FUNCT__,nparts[0]);
     
    200200                if (*architecture == 2) {
    201201                        if (PROMPT)
    202                                 printf("X and Y extent of of 2-D mesh: ");
     202                                _printString_("X and Y extent of of 2-D mesh: ");
    203203                        mesh_dims[0] = nparts[0];
    204204                        mesh_dims[1] = nparts[1];
     
    206206                else if (*architecture == 3) {
    207207                        if (PROMPT)
    208                                 printf("X, Y and Z extent of 3-D mesh: ");
     208                                _printString_("X, Y and Z extent of 3-D mesh: ");
    209209                        mesh_dims[0] = nparts[0];
    210210                        mesh_dims[1] = nparts[1];
     
    213213                else {                  /* Anything else => 1-D mesh */
    214214                        if (PROMPT)
    215                                 printf("Size of 1-D mesh: ");
     215                                _printString_("Size of 1-D mesh: ");
    216216                        mesh_dims[0] = nparts[0];
    217217                        *architecture = 1;
     
    227227        else if (*nprocs <= 7) {
    228228                if (PROMPT) {
    229                         printf("Partitioning dimension: \n");
    230                         printf("  (1) Bisection\n");
    231                         printf("  (2) Quadrisection\n");
     229                        _printLine_("Partitioning dimension: ");
     230                        _printLine_("  (1) Bisection");
     231                        _printLine_("  (2) Quadrisection");
    232232                }
    233233                *ndims = (int)options[OPT_NDIMS];
     
    240240        else {
    241241                if (PROMPT) {
    242                         printf("Partitioning dimension: \n");
    243                         printf("  (1) Bisection\n");
    244                         printf("  (2) Quadrisection\n");
    245                         printf("  (3) Octasection\n");
     242                        _printLine_("Partitioning dimension: ");
     243                        _printLine_("  (1) Bisection");
     244                        _printLine_("  (2) Quadrisection");
     245                        _printLine_("  (3) Octasection");
    246246                }
    247247                *ndims = (int)options[OPT_NDIMS];
  • issm/branches/trunk-jpl-damage/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp

    r11708 r12878  
    1515        int i;
    1616        int      found=0;
    17         double   numberofelements;
     17        IssmDouble   numberofelements;
    1818        Element* element=NULL;
    1919
     
    2525
    2626        /*Allocate sigma on numberofelements: */
    27         sigma=new Vector((int)numberofelements);
     27        sigma=new Vector(reCast<int>(numberofelements));
    2828
    2929        /*Compute basal stress for each element: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h

    r11708 r12878  
    66#define _COMPUTEBASALSTRESSX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h

    r11708 r12878  
    66#define _COMPUTESTRAINRATEX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp

    r9761 r12878  
    2525        parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
    2626       
    27         _printf_(VerboseMProcessor(),"      Configuring elements...\n");
     27        if(VerboseMProcessor()) _pprintLine_("      Configuring elements...");
    2828        for (i=0;i<elements->Size();i++){
    2929                element=(Element*)elements->GetObjectByOffset(i);
    3030                element->Configure(elements,loads,nodes,materials,parameters);
    3131        }
    32         _printf_(VerboseMProcessor(),"      Configuring loads...\n");
     32        if(VerboseMProcessor()) _pprintLine_("      Configuring loads...");
    3333        for (i=0;i<loads->Size();i++){
    3434                load=(Load*)loads->GetObjectByOffset(i);
     
    3737                }
    3838        }
    39         _printf_(VerboseMProcessor(),"      Configuring nodes...\n");
     39        if(VerboseMProcessor()) _pprintLine_("      Configuring nodes...");
    4040        for (i=0;i<nodes->Size();i++){
    4141                node=(Node*)nodes->GetObjectByOffset(i);
     
    4545        }
    4646       
    47         _printf_(VerboseMProcessor(),"      Configuring materials...\n");
     47        if(VerboseMProcessor()) _pprintLine_("      Configuring materials...");
    4848        for (i=0;i<materials->Size();i++){
    4949                material=(Material*)materials->GetObjectByOffset(i);
  • issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/ConstraintsStateLocal.h

    r9127 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/*melting: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp

    r9761 r12878  
    2525
    2626        /*Display message*/
    27         _printf_(VerboseModule(),"   Constraining penalties\n");
     27        if(VerboseModule()) _pprintLine_("   Constraining penalties");
    2828
    2929        /*recover parameters: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/ConstraintsStatex.h

    r9127 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp

    r12168 r12878  
    1212
    1313/*current module: */
    14 /*RiftIsPresent(Loads* loads,int configuration_type){{{1*/
     14/*RiftIsPresent(Loads* loads,int configuration_type){{{*/
    1515int RiftIsPresent(Loads* loads,int configuration_type){
    1616
     
    4141}
    4242/*}}}*/
    43 /*RiftConstraintsState(int* pconverged, int* pnum_unstable_constraints,Loads* loads,int min_mechanical_constraints,int configuration_type){{{1*/
     43/*RiftConstraintsState(int* pconverged, int* pnum_unstable_constraints,Loads* loads,int min_mechanical_constraints,int configuration_type){{{*/
    4444void RiftConstraintsState(int* pconverged, int* pnum_unstable_constraints,Loads* loads,int min_mechanical_constraints,int configuration_type){
    4545
     
    5656        }
    5757        else if(num_unstable_constraints<=min_mechanical_constraints){
    58                 _printf_(VerboseModule(),"   freezing constraints\n");
     58                if(VerboseModule()) _pprintLine_("   freezing constraints");
    5959                RiftFreezeConstraints(loads,configuration_type);
    6060        }
     
    6565}
    6666/*}}}*/
    67 /*RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){{{1*/
     67/*RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){{{*/
    6868void RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){
    6969
     
    106106}
    107107/*}}}*/
    108 /*RiftIsFrozen(Loads* loads,int configuration_type){{{1*/
     108/*RiftIsFrozen(Loads* loads,int configuration_type){{{*/
    109109int RiftIsFrozen(Loads* loads,int configuration_type){
    110110
     
    144144}
    145145/*}}}*/
    146 /*RiftFreezeConstraints(Loads* loads,int configuration_type){{{1*/
     146/*RiftFreezeConstraints(Loads* loads,int configuration_type){{{*/
    147147void RiftFreezeConstraints(Loads* loads,int configuration_type){
    148148
     
    172172
    173173/*diverse trials and errors: */
    174 /*RiftIsMaterialStable(Loads* loads){{{1*/
     174/*RiftIsMaterialStable(Loads* loads){{{*/
    175175int RiftIsMaterialStable(Loads* loads){
    176176
     
    204204}
    205205/*}}}*/
    206 /*RiftIsPreStable(Loads* loads){{{1*/
     206/*RiftIsPreStable(Loads* loads){{{*/
    207207int RiftIsPreStable(Loads* loads){
    208208
     
    243243}
    244244/*}}}*/
    245 /*RiftSetPreStable(Loads* loads){{{1*/
     245/*RiftSetPreStable(Loads* loads){{{*/
    246246void RiftSetPreStable(Loads* loads){
    247247
     
    264264}
    265265/*}}}*/
    266 /*RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){{{1*/
     266/*RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){{{*/
    267267void RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){
    268268
     
    300300}
    301301/*}}}*/
    302 /*RiftMaxPenetrationInInputs(Loads* loads){{{1*/
     302/*RiftMaxPenetrationInInputs(Loads* loads){{{*/
    303303void RiftMaxPenetrationInInputs(Loads* loads){
    304304
     
    309309
    310310        /*rift penetration: */
    311         double max_penetration=0;
    312         double mpi_max_penetration;
    313         double penetration;
     311        IssmDouble max_penetration=0;
     312        IssmDouble mpi_max_penetration;
     313        IssmDouble penetration;
    314314
    315315        /*Ok, we are going to find the node pairs which are not penetrating, even though they
     
    342342}
    343343/*}}}*/
    344 /*RiftPotentialUnstableConstraints(Loads* loads){{{1*/
     344/*RiftPotentialUnstableConstraints(Loads* loads){{{*/
    345345int RiftPotentialUnstableConstraints(Loads* loads){
    346346
  • issm/branches/trunk-jpl-damage/src/c/modules/ContourToMeshx/ContourToMeshx.cpp

    r12168 r12878  
    7070
    7171        /*Free ressources:*/
    72         xfree((void**)&in_nod_serial);
     72        xDelete<double>(in_nod_serial);
    7373
    7474        return noerr;
  • issm/branches/trunk-jpl-damage/src/c/modules/ContourToMeshx/ContourToMeshx.h

    r12168 r12878  
    88
    99#include "../../shared/shared.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/*threading: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ContourToNodesx/ContourToNodesx.h

    r12168 r12878  
    88
    99#include "../../shared/shared.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp

    r11708 r12878  
    3333
    3434        /*Clean up and return*/
    35         xfree((void**)&control_type);
     35        xDelete<int>(control_type);
    3636        *pgradient=gradient;
    3737}
  • issm/branches/trunk-jpl-damage/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.h

    r11708 r12878  
    55#define _CONTROLINPUTGETGRADIENTX_H
    66
    7 #include "../../objects/objects.h"
     7#include "../../classes/objects/objects.h"
    88#include "../../Container/Container.h"
    99
  • issm/branches/trunk-jpl-damage/src/c/modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp

    r11313 r12878  
    3737
    3838        /*Clean up and return*/
    39         xfree((void**)&control_type);
    40         xfree((void**)&scalar_list);
     39        xDelete<int>(control_type);
     40        xDelete<double>(scalar_list);
    4141}
  • issm/branches/trunk-jpl-damage/src/c/modules/ControlInputScaleGradientx/ControlInputScaleGradientx.h

    r11313 r12878  
    55#define _CONTROLINPUTSSCALEGRADIENTX_H
    66
    7 #include "../../objects/objects.h"
     7#include "../../classes/objects/objects.h"
    88#include "../../Container/Container.h"
    99
  • issm/branches/trunk-jpl-damage/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp

    r11708 r12878  
    2727
    2828        /*Clean up and return*/
    29         xfree((void**)&control_type);
     29        xDelete<int>(control_type);
    3030
    3131}
     
    3939
    4040        /*Clean up and return*/
    41         xfree((void**)&serial_gradient);
     41        xDelete<double>(serial_gradient);
    4242}
  • issm/branches/trunk-jpl-damage/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.h

    r11708 r12878  
    55#define _CONTROLINPUTSSETGRADIENTX_H
    66
    7 #include "../../objects/objects.h"
     7#include "../../classes/objects/objects.h"
    88#include "../../Container/Container.h"
    99
  • issm/branches/trunk-jpl-damage/src/c/modules/CostFunctionx/CostFunctionx.cpp

    r12004 r12878  
    3535
    3636        /*Assign output pointers: */
    37         xfree((void**)&responses);
     37        xDelete<int>(responses);
    3838        *pJ=J;
    3939}
  • issm/branches/trunk-jpl-damage/src/c/modules/CostFunctionx/CostFunctionx.h

    r8607 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp

    r11684 r12878  
    1010#include "../../EnumDefinitions/EnumDefinitions.h"
    1111
    12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,double kmax){
     12void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax){
    1313       
    1414        int      i,connectivity;
  • issm/branches/trunk-jpl-damage/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h

    r11684 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
    12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,double kmax);
     12void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax);
    1313
    1414#endif  /* _CREATEJACOBIANMATRIXX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h

    r11684 r12878  
    66
    77#include "../../Container/Container.h"
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp

    r9650 r12878  
    3030        double femmodel_response;
    3131        int    flag;
    32         double* vertex_response=NULL;
    33         double* qmu_response=NULL;
    34 
    35         double* responses_pointer=NULL;
     32        double *vertex_response   = NULL;
     33        double *qmu_response      = NULL;
     34        double *responses_pointer = NULL;
    3635
    3736        /*retrieve npart: */
     
    6665
    6766                        /*Free ressources:*/
    68                         xfree((void**)&vertex_response);
    69                         xfree((void**)&qmu_response);
     67                        xDelete<double>(vertex_response);
     68                        xDelete<double>(qmu_response);
    7069
    7170                }
     
    8786                }
    8887                else if (flag==NodalEnum){
    89                         _error_(" nodal response functions not supported yet!");
     88                        _error2_("nodal response functions not supported yet!");
    9089
    9190                        /*increment response_pointer :*/
     
    105104                        }
    106105                }
    107                 else _error_("%s%i%s"," flag type ",flag," not supported yet for response analysis");
     106                else _error2_("flag type " << flag << " not supported yet for response analysis");
    108107        }
    109108
     
    111110        /*Synthesize echo: {{{*/
    112111        if(my_rank==0){
    113                 printf("   responses: %i: ",d_numresponses);
    114                 for(i=0;i<d_numresponses-1;i++)printf("%g|",d_responses[i]);
    115                 printf("%g",d_responses[d_numresponses-1]);
    116                 printf("\n");
     112                _printString_("   responses: " << d_numresponses << ": ");
     113                for(i=0;i<d_numresponses-1;i++)_printString_(d_responses[i] << "|");
     114                _printString_(d_responses[d_numresponses-1]);
     115                _printLine_("");
    117116        }
    118117        /*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/modules/DakotaResponsesx/DakotaResponsesx.h

    r6231 r12878  
    66#define _DAKOTARESPONSESXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/DakotaFree.cpp

    r9761 r12878  
    2222        extern int my_rank;
    2323       
    24         double* variables=NULL;
    25         char**  variables_descriptors=NULL;
    26         char**  responses_descriptors=NULL;
    27         char*   string=NULL;
     24        double  *variables             = NULL;
     25        char   **variables_descriptors = NULL;
     26        char   **responses_descriptors = NULL;
     27        char    *string                = NULL;
    2828
    2929        /*recover pointers: */
     
    3535        /*Free variables and variables_descriptors only on cpu !=0*/
    3636        if(my_rank!=0){
    37                 xfree((void**)&variables);
     37                xDelete<double>(variables);
    3838                for(i=0;i<numvariables;i++){
    3939                        string=variables_descriptors[i];
    40                         xfree((void**)&string);
     40                        xDelete<char>(string);
    4141                }
    42                 xfree((void**)&variables_descriptors);
     42                xDelete<char*>(variables_descriptors);
    4343        }
    4444       
     
    4646        for(i=0;i<numresponses;i++){
    4747                string=responses_descriptors[i];
    48                 xfree((void**)&string);
     48                xDelete<char>(string);
    4949        }
    5050        //rest of dynamic allocations.
    51         xfree((void**)&responses_descriptors);
     51        xDelete<char*>(responses_descriptors);
    5252
    5353        /*Assign output pointers:*/
     
    5656        *presponses_descriptors=responses_descriptors;
    5757}
    58 
  • issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/DakotaMPI_Bcast.cpp

    r9761 r12878  
    3838       
    3939        /*variables:*/
    40         if(my_rank!=0)variables=(double*)xmalloc(numvariables*sizeof(double));
     40        if(my_rank!=0)variables=xNew<double>(numvariables);
    4141        MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,MPI_COMM_WORLD);
    4242
    4343        /*variables_descriptors: */
    4444        if(my_rank!=0){
    45                 variables_descriptors=(char**)xmalloc(numvariables*sizeof(char*));
     45                variables_descriptors=xNew<char*>(numvariables);
    4646        }
    4747        for(i=0;i<numvariables;i++){
     
    5151                }
    5252                MPI_Bcast(&string_length,1,MPI_INT,0,MPI_COMM_WORLD);
    53                 if(my_rank!=0)string=(char*)xmalloc(string_length);
     53                if(my_rank!=0)string=xNew<char>(string_length);
    5454                MPI_Bcast(string,string_length,MPI_CHAR,0,MPI_COMM_WORLD);
    5555                if(my_rank!=0)variables_descriptors[i]=string;
  • issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.cpp

    r12168 r12878  
    4040#include "../../toolkits/toolkits.h"
    4141#include "../../EnumDefinitions/EnumDefinitions.h"
    42 #include "../../objects/DakotaPlugin.h"
     42#include "../../classes/dakota/DakotaPlugin.h"
    4343
    4444#ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.
     
    121121
    122122        /*Free ressources:*/
    123         xfree((void**)&dakota_input_file);
    124         xfree((void**)&dakota_error_file);
    125         xfree((void**)&dakota_output_file);
     123        xDelete<char>(dakota_input_file);
     124        xDelete<char>(dakota_error_file);
     125        xDelete<char>(dakota_output_file);
    126126
    127127        #endif //#ifdef _HAVE_DAKOTA_
  • issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.h

    r12168 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/classes.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/DescriptorIndex.cpp

    r9761 r12878  
    2323        /*retrieve first token, separated by underscore: */
    2424        pch = strtok (descriptor,"_");
    25         if(!pch)_error_("%s%s%s"," descriptor ",descriptor," is not correctly formatted!");
     25        if(!pch)_error2_("descriptor " << descriptor << " is not correctly formatted!");
    2626
    2727        if (strncmp(pch,"scaled",6)==0){
    2828                /*we have a scaled variable. recover the root: */
    2929                pch = strtok (NULL, "_");
    30                 if(!pch)_error_("%s%s%s"," scaled descriptor ",descriptor," is not correctly formatted!");
     30                if(!pch)_error2_("scaled descriptor " << descriptor << " is not correctly formatted!");
    3131                memcpy(root,pch,(strlen(pch)+1)*sizeof(char));
    3232
     
    4444                /*we have an indexed variable. recover the root: */
    4545                pch = strtok (NULL, "_");
    46                 if(!pch)_error_("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");
     46                if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!");
    4747                memcpy(root,pch,(strlen(pch)+1)*sizeof(char));
    4848                /*now recover  the index: */
    4949                pch = strtok (NULL, "_");
    50                 if(!pch)_error_("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");
     50                if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!");
    5151                sscanf(pch,"%i",pindex);
    5252                return IndexedEnum;
     
    5555                /*we have an indexed variable. recover the root: */
    5656                pch = strtok (NULL, "_");
    57                 if(!pch)_error_("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");
     57                if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!");
    5858                memcpy(root,pch,(strlen(pch)+1)*sizeof(char));
    5959                /*now recover  the index: */
    6060                pch = strtok (NULL, "_");
    61                 if(!pch)_error_("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");
     61                if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!");
    6262                sscanf(pch,"%i",pindex);
    6363                return NodalEnum;
  • issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCore.cpp

    r12168 r12878  
    1010
    1111
    12 #include "../../objects/objects.h"
     12#include "../../classes/objects/objects.h"
    1313#include "../../io/io.h"
    1414#include "../../EnumDefinitions/EnumDefinitions.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCoreParallel.cpp

    r9775 r12878  
    2626
    2727
    28 #include "../../objects/objects.h"
     28#include "../../classes/objects/objects.h"
    2929#include "../../io/io.h"
    3030#include "../../EnumDefinitions/EnumDefinitions.h"
     
    5353        /*synchronize all cpus, as CPU 0 is probably late (it is starting the entire dakota strategy!) : */
    5454        MPI_Barrier(MPI_COMM_WORLD);
    55         _printf_(VerboseQmu(),"qmu iteration: %i\n",counter);
     55        if(VerboseQmu()) _pprintLine_("qmu iteration: " << counter);
    5656       
    5757        /*retrieve parameters: */
     
    6767
    6868        /*Determine solution sequence: */
    69         _printf_(VerboseQmu(),"%s%s%s\n","Starting ",EnumToStringx(solution_type)," core:");
     69        if(VerboseQmu()) _pprintLine_("Starting " << EnumToStringx(solution_type) << " core:");
    7070        CorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type);
    7171        #ifdef _HAVE_CONTROL_
    7272        if(control_analysis)solutioncore=&control_core;
    7373        #else
    74         _error_("ISSM was not compiled with control capabilities, exiting!");
     74        _error2_("ISSM was not compiled with control capabilities, exiting!");
    7575        #endif
    7676
     
    7979
    8080        /*compute responses: */
    81         _printf_(VerboseQmu(),"compute dakota responses:\n");
     81        if(VerboseQmu()) _pprintLine_("compute dakota responses:");
    8282        DakotaResponsesx(d_responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponsedescriptors,d_numresponses);
    8383       
  • issm/branches/trunk-jpl-damage/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h

    r8608 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ElementConnectivityx/ElementConnectivityx.cpp

    r3913 r12878  
    3636        maxels=width-1;
    3737        /*Allocate connectivity: */
    38         elementconnectivity=(double*)xcalloc(nel*3,sizeof(double));
     38        elementconnectivity=xNewZeroInit<double>(nel*3);
    3939
    4040        /*Go through all elements, and for each element, go through its nodes, to get the neighbouring elements.
  • issm/branches/trunk-jpl-damage/src/c/modules/ElementResponsex/ElementResponsex.cpp

    r12168 r12878  
    3939        #ifdef _HAVE_MPI_
    4040        MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    41         if(!sumfound)_error_("%s%i%s","could not find material with id",index," to compute ElementResponse");
     41        if(!sumfound)_error2_("could not find material with id" << index << " to compute ElementResponse");
    4242        #endif
    4343
  • issm/branches/trunk-jpl-damage/src/c/modules/ElementResponsex/ElementResponsex.h

    r10703 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/EnumToStringx/EnumToStringx.cpp

    r12872 r12878  
    88*/
    99
     10#include <cstring>
    1011#include "../../shared/shared.h"
    1112#include "../../include/include.h"
     
    109110                case MaterialsRhoIceEnum : return "MaterialsRhoIce";
    110111                case MaterialsRhoWaterEnum : return "MaterialsRhoWater";
     112                case MaterialsRhoFreshwaterEnum : return "MaterialsRhoFreshwater";
    111113                case MaterialsMuWaterEnum : return "MaterialsMuWater";
    112114                case MaterialsThermalExchangeVelocityEnum : return "MaterialsThermalExchangeVelocity";
     
    154156                case SettingsResultsAsPatchesEnum : return "SettingsResultsAsPatches";
    155157                case SettingsWaitonlockEnum : return "SettingsWaitonlock";
    156                 case DebugPetscProfilingEnum : return "DebugPetscProfiling";
    157                 case PetscProfilingCurrentMemEnum : return "PetscProfilingCurrentMem";
    158                 case PetscProfilingCurrentFlopsEnum : return "PetscProfilingCurrentFlops";
    159                 case PetscProfilingSolutionTimeEnum : return "PetscProfilingSolutionTime";
     158                case SurfaceforcingsDelta18oEnum : return "SurfaceforcingsDelta18o";
     159                case SurfaceforcingsDelta18oSurfaceEnum : return "SurfaceforcingsDelta18oSurface";
     160                case SurfaceforcingsIsdelta18oEnum : return "SurfaceforcingsIsdelta18o";
     161                case SurfaceforcingsPrecipitationsPresentdayEnum : return "SurfaceforcingsPrecipitationsPresentday";
     162                case SurfaceforcingsTemperaturesPresentdayEnum : return "SurfaceforcingsTemperaturesPresentday";
     163                case SurfaceforcingsTemperaturesLgmEnum : return "SurfaceforcingsTemperaturesLgm";
     164                case DebugProfilingEnum : return "DebugProfiling";
     165                case ProfilingCurrentMemEnum : return "ProfilingCurrentMem";
     166                case ProfilingCurrentFlopsEnum : return "ProfilingCurrentFlops";
     167                case ProfilingSolutionTimeEnum : return "ProfilingSolutionTime";
    160168                case MaxIterationConvergenceFlagEnum : return "MaxIterationConvergenceFlag";
    161169                case SteadystateMaxiterEnum : return "SteadystateMaxiter";
     
    166174                case SurfaceforcingsPrecipitationEnum : return "SurfaceforcingsPrecipitation";
    167175                case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance";
     176                case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd";
     177                case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
     178                case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures";
     179                case SurfaceforcingsHcEnum : return "SurfaceforcingsHc";
     180                case SurfaceforcingsSmbPosMaxEnum : return "SurfaceforcingsSmbPosMax";
     181                case SurfaceforcingsSmbPosMinEnum : return "SurfaceforcingsSmbPosMin";
     182                case SurfaceforcingsAPosEnum : return "SurfaceforcingsAPos";
     183                case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos";
     184                case SurfaceforcingsANegEnum : return "SurfaceforcingsANeg";
     185                case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg";
    168186                case ThermalMaxiterEnum : return "ThermalMaxiter";
    169187                case ThermalPenaltyFactorEnum : return "ThermalPenaltyFactor";
     
    257275                case IntParamEnum : return "IntParam";
    258276                case IntVecParamEnum : return "IntVecParam";
     277                case TransientParamEnum : return "TransientParam";
    259278                case MacAyeal2dIceFrontEnum : return "MacAyeal2dIceFront";
    260279                case MacAyeal3dIceFrontEnum : return "MacAyeal3dIceFront";
     
    376395                case StressTensorzzEnum : return "StressTensorzz";
    377396                case IceVolumeEnum : return "IceVolume";
     397                case TotalSmbEnum : return "TotalSmb";
    378398                case P0Enum : return "P0";
    379399                case P1Enum : return "P1";
     
    464484
    465485        len=strlen(EnumToStringx(enum_in));
    466         string=(char*)xmalloc((len+1)*sizeof(char));
     486        string=xNew<char>(len+1);
    467487        memcpy(string,EnumToStringx(enum_in),(len+1)*sizeof(char));
    468488
  • issm/branches/trunk-jpl-damage/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp

    r12168 r12878  
    1111#include "../modules.h"
    1212
    13 int Exp2Kmlx(char* filexp,char* filkml,
    14                          int sgn,
    15                          bool holes){
     13int Exp2Kmlx(char* filexp,char* filkml,int sgn,bool holes){
    1614
    1715        double  cm,sp;
    1816
    1917        Xy2lldef(&cm,&sp,sgn);
    20 
    21         return(Exp2Kmlx(filexp,filkml,
    22                                         sgn,cm,sp,
    23                                         holes));
     18        return(Exp2Kmlx(filexp,filkml,sgn,cm,sp,holes));
    2419}
    2520
    26 int Exp2Kmlx(char* filexp,char* filkml,
    27                          int sgn,double cm,double sp,
    28                          bool holes){
    29 
    30         int     i,j,iret=0;
    31         int     lwidth=1;
    32         double  popac=0.50;
    33         int     nprof;
    34         int     *pnvert=NULL;
    35         double  **pprofx=NULL,**pprofy=NULL;
    36         bool    *closed=NULL;
    37         double  *lat=NULL,*lon=NULL;
     21int Exp2Kmlx(char* filexp,char* filkml,int sgn,double cm,double sp,bool holes){
     22
     23        int      i        ,j,iret=0;
     24        int      lwidth = 1;
     25        double   popac  = 0.50;
     26        int      nprof;
     27        int     *pnvert = NULL;
     28        double **pprofx = NULL,**pprofy=NULL;
     29        bool    *closed = NULL;
     30        double  *lat    = NULL, *lon=NULL;
    3831
    3932        char    indent[81]="";
     
    5750        clock0=clock();
    5851        time0 =time(NULL);
    59         _printf_(true,"\nExp2Kmlx Module -- %s",ctime(&time0));
    60 
    61 /*  read exp file  */
     52        _pprintString_("\nExp2Kmlx Module -- " << ctime(&time0));
     53
     54        /*read exp file  */
    6255
    6356        if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,&closed,filexp))
    64                 _error_("Error reading exp file.");
    65         _printf_(true,"Exp2Kmlx -- Reading %d exp profiles from file \"%s\".\n",nprof,filexp);
     57                _error2_("Error reading exp file.");
     58        _pprintLine_("Exp2Kmlx -- Reading " << nprof << " exp profiles from file \"" << filexp << "\".");
    6659//      for (i=0; i<nprof; i++)
    67 //              printf("i=%d; nvert=%d, closed=%d\n",i,pnvert[i],closed[i]);
     60//              _printLine_("i=" << i << "; nvert=" << pnvert[i] << ", closed=" << closed[i]);
    6861
    6962/*  construct kml file  */
     
    128121
    129122        if (holes && nprof && (pnvert[0] <= 1 || pprofx[0][pnvert[0]-1] != pprofx[0][0] || pprofy[0][pnvert[0]-1] != pprofy[0][0])) {
    130                 _printf_(true,"Warning -- Outer profile is not closed, so \"holes\" option will be ignored.\n");
     123                _pprintLine_("Warning -- Outer profile is not closed, so \"holes\" option will be ignored.");
    131124                holes=false;
    132125        }
     
    143136
    144137                kring->ncoord    =pnvert[i]-1;
    145                 lat=(double *) xmalloc(kring->ncoord*sizeof(double));
    146                 lon=(double *) xmalloc(kring->ncoord*sizeof(double));
     138                lat=xNew<double>(kring->ncoord);
     139                lon=xNew<double>(kring->ncoord);
    147140                Xy2llx(lat,lon,pprofx[i],pprofy[i],kring->ncoord,sgn,cm,sp);
    148                 kring->coords    =(double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));
     141                kring->coords=xNew<double>(kring->ncoord*3);
    149142                for (j=0; j<kring->ncoord; j++) {
    150                         kring->coords[j][0]=lon[j];
    151                         kring->coords[j][1]=lat[j];
    152                         kring->coords[j][2]=0.;
     143                        kring->coords[3*j+0]=lon[j];
     144                        kring->coords[3*j+1]=lat[j];
     145                        kring->coords[3*j+2]=0.;
    153146                }
    154                 xfree((void**)&lon);
    155                 xfree((void**)&lat);
     147                xDelete<double>(lon);
     148                xDelete<double>(lat);
    156149
    157150                (kpoly ->outer     )->AddObject((Object*)kring);
     
    160153                for (i=1; i<nprof; i++) {
    161154                        if (pnvert[i] <= 1 || pprofx[i][pnvert[i]-1] != pprofx[i][0] || pprofy[i][pnvert[i]-1] != pprofy[i][0]) {
    162                                 _printf_(true,"Warning -- Inner profile %d is not closed with \"holes\" specified, so it will be ignored.\n",i+1);
     155                                _pprintLine_("Warning -- Inner profile " << i+1 << " is not closed with \"holes\" specified, so it will be ignored.");
    163156                                continue;
    164157                        }
     
    167160
    168161                        kring->ncoord    =pnvert[i]-1;
    169                         lat=(double *) xmalloc(kring->ncoord*sizeof(double));
    170                         lon=(double *) xmalloc(kring->ncoord*sizeof(double));
     162                        lat=xNew<double>(kring->ncoord);
     163                        lon=xNew<double>(kring->ncoord);
    171164                        Xy2llx(lat,lon,pprofx[i],pprofy[i],kring->ncoord,sgn,cm,sp);
    172                         kring->coords    =(double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));
     165                        kring->coords    =xNew<double>(kring->ncoord*3);
    173166                        for (j=0; j<kring->ncoord; j++) {
    174                                 kring->coords[j][0]=lon[j];
    175                                 kring->coords[j][1]=lat[j];
    176                                 kring->coords[j][2]=0.;
    177                         }
    178                         xfree((void**)&lon);
    179                         xfree((void**)&lat);
     167                                kring->coords[3*j+0]=lon[j];
     168                                kring->coords[3*j+1]=lat[j];
     169                                kring->coords[3*j+2]=0.;
     170                        }
     171                        xDelete<double>(lon);
     172                        xDelete<double>(lat);
    180173
    181174                        (kpoly ->inner     )->AddObject((Object*)kring);
     
    204197
    205198                                kring->ncoord    =pnvert[i]-1;
    206                                 lat=(double *) xmalloc(kring->ncoord*sizeof(double));
    207                                 lon=(double *) xmalloc(kring->ncoord*sizeof(double));
     199                                lat=xNew<double>(kring->ncoord);
     200                                lon=xNew<double>(kring->ncoord);
    208201                                Xy2llx(lat,lon,pprofx[i],pprofy[i],kring->ncoord,sgn,cm,sp);
    209                                 kring->coords    =(double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));
     202                                kring->coords    =xNew<double>(kring->ncoord*3);
    210203                                for (j=0; j<kring->ncoord; j++) {
    211                                         kring->coords[j][0]=lon[j];
    212                                         kring->coords[j][1]=lat[j];
    213                                         kring->coords[j][2]=0.;
     204                                        kring->coords[3*j+0]=lon[j];
     205                                        kring->coords[3*j+1]=lat[j];
     206                                        kring->coords[3*j+2]=0.;
    214207                                }
    215                                 xfree((void**)&lon);
    216                                 xfree((void**)&lat);
     208                                xDelete<double>(lon);
     209                                xDelete<double>(lat);
    217210
    218211                                (kpoly ->outer     )->AddObject((Object*)kring);
     
    231224
    232225                                kline->ncoord    =pnvert[i];
    233                                 lat=(double *) xmalloc(kline->ncoord*sizeof(double));
    234                                 lon=(double *) xmalloc(kline->ncoord*sizeof(double));
     226                                lat=xNew<double>(kline->ncoord);
     227                                lon=xNew<double>(kline->ncoord);
    235228                                Xy2llx(lat,lon,pprofx[i],pprofy[i],kline->ncoord,sgn,cm,sp);
    236                                 kline->coords    =(double (*)[3]) xmalloc(kline->ncoord*3*sizeof(double));
     229                                kline->coords    =xNew<double>(kline->ncoord*3);
    237230                                for (j=0; j<kline->ncoord; j++) {
    238                                         kline->coords[j][0]=lon[j];
    239                                         kline->coords[j][1]=lat[j];
    240                                         kline->coords[j][2]=0.;
     231                                        kline->coords[3*j+0]=lon[j];
     232                                        kline->coords[3*j+1]=lat[j];
     233                                        kline->coords[3*j+2]=0.;
    241234                                }
    242                                 xfree((void**)&lon);
    243                                 xfree((void**)&lat);
     235                                xDelete<double>(lon);
     236                                xDelete<double>(lat);
    244237
    245238                                (kplace->geometry  )->AddObject((Object*)kline);
     
    251244                                kplace->visibility=true;
    252245                                sprintf(kplace->styleurl  ,"#RandomLineEmptyPoly");
     246                                int one=1;
    253247
    254248                                kpoint=new KML_Point();
    255249
    256                                 lat=(double *) xmalloc(sizeof(double));
    257                                 lon=(double *) xmalloc(sizeof(double));
     250                                lat=xNew<double>(one);
     251                                lon=xNew<double>(one);
    258252                                Xy2llx(lat,lon,pprofx[i],pprofy[i],1,sgn,cm,sp);
    259253                                kpoint->coords[0]=lon[0];
    260254                                kpoint->coords[1]=lat[0];
    261255                                kpoint->coords[2]=0.;
    262                                 xfree((void**)&lon);
    263                                 xfree((void**)&lat);
     256                                xDelete<double>(lon);
     257                                xDelete<double>(lat);
    264258
    265259                                (kplace->geometry  )->AddObject((Object*)kpoint);
     
    281275/*  write kml file  */
    282276
    283         _printf_(true,"Exp2Kmlx -- Writing kml document to file \"%s\".\n",filkml);
     277        _pprintLine_("Exp2Kmlx -- Writing kml document to file \"" << filkml << "\".");
    284278        fid=fopen(filkml,"w");
    285279        fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
     
    289283        delete kfile;
    290284        for (i=nprof-1; i>=0; i--) {
    291                 xfree((void**)&(pprofy[i]));
    292                 xfree((void**)&(pprofx[i]));
    293         }
    294         xfree((void**)&pnvert);
     285                xDelete<double>(pprofy[i]);
     286                xDelete<double>(pprofx[i]);
     287        }
     288        xDelete<int>(pnvert);
    295289
    296290        clock1=clock();
  • issm/branches/trunk-jpl-damage/src/c/modules/Exp2Kmlx/Exp2Kmlx.h

    r8716 r12878  
    88#include <float.h>    /*  DBL_MAX  */
    99#include "../../Container/Container.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp

    r11684 r12878  
    2626        /*Get size of vector: */
    2727        gsize=nodes->NumberOfDofs(configuration_type,GsetEnum);
    28         if (gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 for configuration: %s",EnumToStringx(configuration_type));
     28        if (gsize==0) _error2_("Allocating a Vec of size 0 as gsize=0 for configuration: " << EnumToStringx(configuration_type));
    2929       
    3030        /*Initialize solution: */
  • issm/branches/trunk-jpl-damage/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h

    r11684 r12878  
    66#define _GETSOLUTIONFROMINPUTSXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp

    r11708 r12878  
    3232
    3333        /*Assign output pointers:*/
    34         xfree((void**)&control_type);
     34        xDelete<int>(control_type);
    3535        *pvector=vector;
    3636}
  • issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.h

    r11708 r12878  
    55#define _GETVECTORFROMCONTROLINPUTSXX_H
    66
    7 #include "../../objects/objects.h"
     7#include "../../classes/objects/objects.h"
    88#include "../../Container/Container.h"
    99
  • issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp

    r11708 r12878  
    3232        }
    3333        else{
    34                 _error_("%s%s%s"," vector type: ",EnumToStringx(type)," not supported yet!");
     34                _error2_("vector type: " << EnumToStringx(type) << " not supported yet!");
    3535        }
    3636
     
    4141}
    4242
    43 void GetVectorFromInputsx( double** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){
     43void GetVectorFromInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){
    4444       
    4545        /*output: */
    46         double* vector=NULL;
     46        IssmDouble* vector=NULL;
    4747       
    4848        /*intermediary: */
  • issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h

    r11708 r12878  
    55#define _GETVECTORFROMINPUTSXX_H
    66
    7 #include "../../objects/objects.h"
     7#include "../../classes/objects/objects.h"
    88#include "../../Container/Container.h"
    99
    1010/* local prototypes: */
    1111void    GetVectorFromInputsx( Vector** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int name,int type);
    12 void    GetVectorFromInputsx( double** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int name,int type);
     12void    GetVectorFromInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int name,int type);
    1313
    1414#endif  /* _GETVECTORFROMINPUTSXX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/Gradjx/Gradjx.cpp

    r11708 r12878  
    1414        int     i,j,numberofvertices;
    1515        int     num_controls;
    16         double  norm_inf;
    17         double *norm_list       = NULL;
    18         int    *control_type    = NULL;
    19         Vector*     gradient        = NULL;
    20         Vector*    *gradient_list  = NULL;
     16        double   norm_inf;
     17        double  *norm_list     = NULL;
     18        int     *control_type  = NULL;
     19        Vector  *gradient      = NULL;
     20        Vector **gradient_list = NULL;
    2121       
    2222        /*retrieve some parameters: */
     
    2626
    2727        /*Allocate gradient_list */
    28         gradient_list = (Vector**)xmalloc(num_controls*sizeof(Vector*));
    29         norm_list = (double*)xmalloc(num_controls*sizeof(double));
     28        gradient_list = xNew<Vector*>(num_controls);
     29        norm_list = xNew<double>(num_controls);
    3030        for(i=0;i<num_controls;i++){
    3131                gradient_list[i]=new Vector(num_controls*numberofvertices);
     
    5454        /*Check that gradient is clean*/
    5555        norm_inf=gradient->Norm(NORM_INF);
    56         if(norm_inf<=0)    _error_("||∂J/∂α||∞ = 0    gradient norm is zero");
    57         if(isnan(norm_inf))_error_("||∂J/∂α||∞ = NaN  gradient norm is NaN");
     56        if(norm_inf<=0)    _error2_("||∂J/∂α||∞ = 0    gradient norm is zero");
     57        if(xIsNan<IssmDouble>(norm_inf))_error2_("||∂J/∂α||∞ = NaN  gradient norm is NaN");
    5858
    5959        /*Clean-up and assign output pointer*/
     
    6262        }
    6363        else{
    64                 xfree((void**)&norm_list);
     64                xDelete<double>(norm_list);
    6565        }
    6666        if(pgradient)  *pgradient=gradient;
    67         xfree((void**)&gradient_list);
    68         xfree((void**)&control_type);
     67        xDelete<Vector*>(gradient_list);
     68        xDelete<int>(control_type);
    6969}
  • issm/branches/trunk-jpl-damage/src/c/modules/Gradjx/Gradjx.h

    r11708 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r12168 r12878  
    2020        Element* element                          = NULL;
    2121       
    22         _printf_(VerboseModule(),"   Migrating grounding line\n");
     22        if(VerboseModule()) _pprintLine_("   Migrating grounding line");
    2323       
    2424        /*retrieve parameters: */
     
    2727
    2828        if(migration_style==NoneEnum) return;
    29         if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error_("%s not supported yet!",EnumToStringx(migration_style));
     29        if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error2_(EnumToStringx(migration_style) << " not supported yet!");
    3030
    3131        if(migration_style==SoftMigrationEnum){
     
    4949        /*free ressouces: */
    5050        xdelete(&vec_old_floatingice);
    51         xfree((void**)&vertices_potentially_ungrounding);
    52         xfree((void**)&vertices_ungrounding);
    53         xfree((void**)&old_floatingice);
     51        xDelete<double>(vertices_potentially_ungrounding);
     52        xDelete<double>(vertices_ungrounding);
     53        xDelete<double>(old_floatingice);
    5454}
    5555
    56 /*FUNCTION CreateNodesOnFloatingIce {{{1*/
     56/*FUNCTION CreateNodesOnFloatingIce {{{*/
    5757Vector* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){
    5858
     
    8181}
    8282/*%}}}*/
    83 /*FUNCTION PotentialSheetUngrounding {{{1*/
     83/*FUNCTION PotentialSheetUngrounding {{{*/
    8484double*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){
    8585
     
    108108}
    109109/*}}}*/
    110 /*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{1*/
     110/*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{*/
    111111double*    PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding){
    112112
     
    158158                #ifdef _HAVE_MPI_
    159159                MPI_Allreduce(&local_nflipped,&nflipped,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    160                 _printf_(VerboseConvergence(),"   Additional number of vertices allowed to unground: %i\n",nflipped);
     160                if(VerboseConvergence()) _pprintLine_("   Additional number of vertices allowed to unground: " << nflipped);
    161161                #else
    162162                nflipped=local_nflipped;
     
    164164
    165165                /*Avoid leaks: */
    166                 xfree((void**)&elements_neighboring_floatingce);
    167                 xfree((void**)&nodes_on_floatingice);
     166                xDelete<double>(elements_neighboring_floatingce);
     167                xDelete<double>(nodes_on_floatingice);
    168168
    169169                /*Assemble and serialize:*/
     
    174174        /*Free ressources:*/
    175175        xdelete(&vec_nodes_on_floatingice);
    176         xfree((void**)&elements_neighboring_floatingce);
     176        xDelete<double>(elements_neighboring_floatingce);
    177177
    178178        return nodes_on_floatingice;
  • issm/branches/trunk-jpl-damage/src/c/modules/HoleFillerx/HoleFillerx.cpp

    r9313 r12878  
    4343
    4444         /*^^^^^^^^^^^^^  Remove pixels close to the holes ^^^^^^^^^^^^^*/
    45         image2 = (double*) xmalloc( lines*samps*sizeof(double));
     45        image2 = xNew<double>(lines*samps);
    4646        memcpy(image2,image,lines*samps*sizeof(double));
    4747       
     
    6464        }
    6565
    66         image3 = (double*) xmalloc( lines*samps*sizeof(double));
     66        image3 = xNew<double>(lines*samps);
    6767        memcpy(image3,image2,lines*samps*sizeof(double));
    6868
     
    7676                        }
    7777                }
    78                 printf( "\n" );
    79                 printf("Number of zeroes remaining: %10ld",lines*samps-counter);
     78                _printLine_( "" );
     79                _printString_("Number of zeroes remaining: " << lines*samps-counter);
    8080                fflush( stdout );
    8181        #endif
     
    9595                }
    9696                //        n u m b e r   o f   z e r o e s   r e m a i n i n g :   1 2 3 4 5 6 7 8 9 10       
    97                 printf( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );
    98                 printf("Number of zeroes remaining: %10ld",lines*samps-counter);
     97                _printString_( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );
     98                _printString_("Number of zeroes remaining: " << lines*samps-counter);
    9999                fflush( stdout );
    100100        #endif
     
    104104/***************** FIRST RUN *********************/
    105105/*
    106 fprintf ( stdout, "First  Application:  " ); time(&t2); printf( ctime(&t2) );
     106fprintf ( stdout, "First  Application:  " ); time(&t2); _printString_( ctime(&t2) );
    107107*/
    108108        for ( i = 0; i < lines; i++ ){
     
    277277                       
    278278                        #ifdef _DEBUG2_
    279                                 //printf("%g %g %g \n",temp,elev,range);
     279                                //_printLine_(temp << " " << elev << " " << range << " ");
    280280                        #endif
    281281
     
    304304/************************ SMOOTH THE RESULT ***********************/           
    305305               
    306         image4 = (double*) xmalloc( lines*samps*sizeof(double));
     306        image4 = xNew<double>(lines*samps);
    307307        memcpy(image4,image3,lines*samps*sizeof(double));
    308308
     
    348348
    349349        /*Allocate output image: */
    350         imageout=(double*)xmalloc(samps*lines*sizeof(double));
     350        imageout=xNew<double>(samps*lines);
    351351        memcpy(imageout,image3,lines*samps*sizeof(double));
    352352
     
    354354       
    355355        #ifdef _DEBUG2_
    356                 printf( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );
    357                 printf("Number of zeroes remaining:          0\n\n");
     356                _printString_( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );
     357                _printLine_("Number of zeroes remaining:          0\n");
    358358                printf ( "\n");
    359359        #endif
     
    363363        /*Assign output pointers: */
    364364        *pimageout=imageout;
    365 
    366365        return 1;
    367        
    368366}
  • issm/branches/trunk-jpl-damage/src/c/modules/IceVolumex/IceVolumex.h

    r9880 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/InputArtificialNoisex/InputArtificialNoisex.cpp

    r5578 r12878  
    99#include "../../EnumDefinitions/EnumDefinitions.h"
    1010
    11 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,int enum_name,double min,double max){
     11void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,int enum_name,IssmDouble min,IssmDouble max){
    1212
    1313        int i;
  • issm/branches/trunk-jpl-damage/src/c/modules/InputArtificialNoisex/InputArtificialNoisex.h

    r5578 r12878  
    66#define _INPUTARTIFICIALNOISEX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
    1111/* local prototypes: */
    12 void    InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int enum_name,double min,double max);
     12void    InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int enum_name,IssmDouble min,IssmDouble max);
    1313
    1414#endif  /* _UPDATEINPUTSFROMVECTORXX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/InputConvergencex/InputConvergencex.cpp

    r12168 r12878  
    99#include "../../EnumDefinitions/EnumDefinitions.h"
    1010
    11 bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, double* criterionvalues,int num_criterionenums){
     11bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, IssmDouble* criterionvalues,int num_criterionenums){
    1212
    1313        /*intermediary:*/
    14         int         i;
    15         bool        converged;
    16         int         num_notconverged=0;
    17         int         total_notconverged;
    18         double     *eps       = NULL;
    19         Element*    element=NULL;
     14        int      i;
     15        bool     converged;
     16        int      num_notconverged   = 0;
     17        int      total_notconverged;
     18        IssmDouble  *eps                = NULL;
     19        Element *element            = NULL;
    2020
    2121        /*allocate dynamic memory: */
    22         eps=(double*)xmalloc(num_criterionenums*sizeof(double));
     22        eps=xNew<IssmDouble>(num_criterionenums);
    2323
    2424        /*Go through elements, and ask them to do the job: */
     
    3434        num_notconverged=total_notconverged;
    3535        #endif
    36         _printf_(VerboseConvergence(),"      #elements above convergence criterion = %i\n",num_notconverged);
     36        if(VerboseConvergence()) _pprintLine_("      #elements above convergence criterion = " << num_notconverged);
    3737
    3838        /*Free ressources:*/
    39         xfree((void**)&eps);
     39        xDelete<IssmDouble>(eps);
    4040
    4141        /*return: */
  • issm/branches/trunk-jpl-damage/src/c/modules/InputConvergencex/InputConvergencex.h

    r4778 r12878  
    88
    99/* local prototypes: */
    10 bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, double* criterionvalues,int num_criterionenums);
     10bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, IssmDouble* criterionvalues,int num_criterionenums);
    1111
    1212#endif  /* _INPUTCONVERGENCEX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/InputScalex/InputScalex.cpp

    r4573 r12878  
    99#include "../../EnumDefinitions/EnumDefinitions.h"
    1010
    11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, double scale_factor){
     11void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, IssmDouble scale_factor){
    1212
    1313        /*intermediary:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/InputScalex/InputScalex.h

    r4236 r12878  
    99
    1010/* local prototypes: */
    11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, double scale_factor);
     11void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, IssmDouble scale_factor);
    1212
    1313#endif  /* _SCALEINPUTX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.cpp

    r12004 r12878  
    1313        /*intermediary:*/
    1414        int      step;
    15         double   time;
     15        IssmDouble   time;
    1616        Element *element = NULL;
    1717
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp

    r4573 r12878  
    4949        }
    5050}
    51 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,double constant, int name){
     51void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble constant, int name){
    5252
    5353        int i;
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h

    r4236 r12878  
    66#define _UPDATEINPUTSFROMCONSTANTXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
     
    1212void            InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters, bool   constant, int name);
    1313void            InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters, int    constant, int name);
    14 void            InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters, double constant, int name);
     14void            InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters, IssmDouble constant, int name);
    1515
    1616#endif  /* _UPDATEINPUTSFROMCONSTANTXX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp

    r10571 r12878  
    2121        double *qmu_part  = NULL;
    2222
    23         double* distributed_values=NULL;
    24         double* parameter=NULL;
    25         char*   descriptor=NULL;
     23        double *distributed_values = NULL;
     24        double *parameter          = NULL;
     25        char   *descriptor         = NULL;
    2626        char    root[50]; //root name of variable, ex: DragCoefficent, RhoIce, etc ...
    2727
     
    4949
    5050
    51                         distributed_values=(double*)xmalloc(npart*sizeof(double));
     51                        distributed_values=xNew<double>(npart);
    5252                        for(j=0;j<npart;j++){
    5353                                distributed_values[j]=variables[i+j];
     
    9191
    9292                        /*Free allocations: */
    93                         xfree((void**)&parameter);
    94                         xfree((void**)&distributed_values);
     93                        xDelete<double>(parameter);
     94                        xDelete<double>(distributed_values);
    9595                }
    9696                else if (strncmp(descriptor,"indexed_",8)==0){
    97                         _error_(" indexed variables not supported yet!");
     97                        _error2_("indexed variables not supported yet!");
    9898                }
    9999                else if (strncmp(descriptor,"nodal_",8)==0){
    100                         _error_(" nodal variables not supported yet!");
     100                        _error2_("nodal variables not supported yet!");
    101101                }
    102102                else{
     
    107107
    108108        /*Free ressources:*/
    109         xfree((void**)&qmu_part);
    110 
     109        xDelete<double>(qmu_part);
    111110}
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h

    r6231 r12878  
    66#define _INPUTUPDATEFROMDAKOTAXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromMatrixDakotax/InputUpdateFromMatrixDakotax.h

    r10576 r12878  
    66#define _UPDATEINPUTSFROMMATRIXDAKOTAXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp

    r11684 r12878  
    1111void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* solution){
    1212
    13         double* serial_solution=NULL;
     13        IssmDouble* serial_solution=NULL;
    1414
    1515        /*Serialize solution, so that elements can index into it on every CPU: */
     
    2020
    2121        /*Free ressources:*/
    22         xfree((void**)&serial_solution);
    23 
     22        xDelete<IssmDouble>(serial_solution);
    2423}
    2524
    2625
    27 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,double* solution){
     26void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution){
    2827
    2928        /*Intermediary*/
     
    3635                element->InputUpdateFromSolution(solution);
    3736        }
    38 
    3937}
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h

    r11684 r12878  
    66#define _UPDATEINPUTSFROMSOLUTIONXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
    1111/* local prototypes: */
    1212void            InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* solution);
    13 void        InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,double* solution);
     13void        InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution);
    1414
    1515//with timestep
    1616void            InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* solution,int timestep);
    17 void        InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,double* solution, int timestep);
     17void        InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution, int timestep);
    1818
    1919#endif  /* _UPDATEINPUTSFROMSOLUTIONXX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp

    r11708 r12878  
    1818
    1919        /*Free ressources:*/
    20         xfree((void**)&serial_vector);
     20        xDelete<double>(serial_vector);
    2121}
    2222
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h

    r11708 r12878  
    66#define _UPDATEINPUTSFROMVECTORDAKOTAXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp

    r11708 r12878  
    1111void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* vector, int name, int type){
    1212
    13         double* serial_vector=NULL;
     13        IssmDouble* serial_vector=NULL;
    1414
    1515        serial_vector=vector->ToMPISerial();
     
    1818
    1919        /*Free ressources:*/
    20         xfree((void**)&serial_vector);
     20        xDelete<IssmDouble>(serial_vector);
    2121}
    2222
    2323       
    24 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,double* vector, int name, int type){
     24void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* vector, int name, int type){
    2525
    2626        int i;
  • issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h

    r11708 r12878  
    66#define _UPDATEINPUTSFROMVECTORXX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
    1111/* local prototypes: */
    1212void    InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* vector, int name,int type);
    13 void    InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,double* vector, int name,int type);
     13void    InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,IssmDouble* vector, int name,int type);
    1414void    InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int* vector, int name,int type);
    1515void    InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,bool* vector, int name,int type);
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp

    r11708 r12878  
    1313#include "../../shared/shared.h"
    1414#include "../../include/include.h"
     15#include "../../io/io.h"
    1516/*}}}*/
    1617
     
    3637        /*Some checks on arguments: */
    3738        if ((M<2) || (N<2) || (nods<=0)){
    38                 _error_("nothing to be done according to the dimensions of input matrices and vectors.");
     39                _error2_("nothing to be done according to the dimensions of input matrices and vectors.");
    3940        }
    4041        if (x_in[1]-x_in[0]<0){
    41                 _error_("x coordinate vector should be increasing.\n   use Matlab's command x=flipud(x), also flip the data matrix data=fliplr(data)");
     42                _error2_("x coordinate vector should be increasing.\n   use Matlab's command x=flipud(x), also flip the data matrix data=fliplr(data)");
    4243        }
    4344        if (y_in[1]-y_in[0]<0){
    44                 _error_("y coordinate vector should be increasing.\n   use Matlab's command y=flipud(y), also flip the data matrix data=flipud(data)");
     45                _error2_("y coordinate vector should be increasing.\n   use Matlab's command y=flipud(y), also flip the data matrix data=flipud(data)");
    4546        }
    4647
     
    5253
    5354                /*The coordinates given in input describe the contour of each pixel. Take the center of each pixel*/
    54                 x=(double*)xmalloc(N*sizeof(double));
    55                 y=(double*)xmalloc(M*sizeof(double));
     55                x=xNew<double>(N);
     56                y=xNew<double>(M);
    5657                for (i=0;i<N;i++) x[i]=(x_in[i]+x_in[i+1])/2;
    5758                for (i=0;i<M;i++) y[i]=(y_in[i]+y_in[i+1])/2;
     
    6263
    6364                /*The coordinates given in input describe the center each pixel. Keep them*/
    64                 x=(double*)xmalloc(N*sizeof(double));
    65                 y=(double*)xmalloc(M*sizeof(double));
     65                x=xNew<double>(N);
     66                y=xNew<double>(M);
    6667                for (i=0;i<N;i++) x[i]=x_in[i];
    6768                for (i=0;i<M;i++) y[i]=y_in[i];
    6869        }
    6970        else{
    70                 _error_("x and y vectors length should be 1 or 0 more than data number of rows.");
     71                _error2_("x and y vectors length should be 1 or 0 more than data number of rows.");
    7172        }
    7273
     
    8182        gate.data_mesh=data_mesh;
    8283        gate.data=data;
     84        gate.default_value=default_value;
     85        gate.interp=interpenum;
    8386        gate.M=M;
    8487        gate.N=N;
    85         gate.interp=interpenum;
    8688
    8789        /*launch the thread manager with InterpFromGridToMeshxt as a core: */
    8890        LaunchThread(InterpFromGridToMeshxt,(void*)&gate,num);
     91        _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
    8992
    9093        /*Assign output pointers:*/
     
    9295}
    9396/*}}}*/
    94 /*InterpFromGridToMeshxt {{{1*/
     97/*InterpFromGridToMeshxt {{{*/
    9598void* InterpFromGridToMeshxt(void* vpthread_handle){
    9699
     
    124127        double *y             = gate->y;
    125128        int     nods          = gate->nods;
    126         Vector*     data_mesh     = gate->data_mesh;
     129        Vector *data_mesh     = gate->data_mesh;
    127130        double *data          = gate->data;
    128131        double  default_value = gate->default_value;
     
    131134        int     N             = gate->N;
    132135
     136        bool debug = M*N>1? true:false;
     137        debug = true;
     138
    133139        /*partition loop across threads: */
    134140        PartitionRange(&i0,&i1,nods,num_threads,my_thread);
    135141        for (i=i0;i<i1;i++) {
    136142
     143                if(debug && my_thread==0)
     144                 _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%");
    137145                x_grid=*(x_mesh+i);
    138146                y_grid=*(y_mesh+i);
     
    170178                                        break;
    171179                                default:
    172                                         printf("Interpolation %s not supported yet\n",EnumToStringx(interpenum));
     180                                        _printLine_("Interpolation " << EnumToStringx(interpenum) << " not supported yet");
    173181                                        return NULL; /*WARNING: no error because it would blow up the multithreading!*/
    174182                        }
    175                         if(isnan(data_value)) data_value=default_value;
     183                        if(xIsNan<IssmDouble>(data_value)) data_value=default_value;
    176184                }
    177185                else{
     
    183191}/*}}}*/
    184192
    185 /*findindices {{{1*/
     193/*findindices {{{*/
    186194bool findindices(int* pn,int* pm,double* x,int x_rows, double* y,int y_rows, double xgrid,double ygrid){
    187195
     
    218226        return (foundx && foundy);
    219227}/*}}}*/
    220 /*triangleinterp{{{1*/
     228/*triangleinterp{{{*/
    221229double triangleinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){
    222230        /*split the rectangle in 2 triangle and
     
    259267        }
    260268}/*}}}*/
    261 /*bilinearinterp{{{1*/
     269/*bilinearinterp{{{*/
    262270double bilinearinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){
    263271        /*Bilinear  interpolation: (http://en.wikipedia.org/wiki/Bilinear_interpolation) */
     
    286294}
    287295/*}}}*/
    288 /*nearestinterp{{{1*/
     296/*nearestinterp{{{*/
    289297double nearestinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){
    290298        /*Nearest neighbor interpolation*/
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h

    r12004 r12878  
    66#define _INTERPFROMGRIDTOMESHX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../toolkits/toolkits.h"
    1010#include "../../EnumDefinitions/EnumDefinitions.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp

    r11708 r12878  
    77#include "../../include/include.h"
    88#include "../../toolkits/toolkits.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010#include "../modules.h"
    1111
    1212int InterpFromMesh2dx( Vector** pdata_prime,double* index_data, double* x_data, double* y_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, int nods_prime,
    1313                double* default_values,int num_default_values,Contour** contours,int numcontours){
    14 
    1514       
    1615        /*Output*/
     
    4140        /*some checks*/
    4241        if (nels_data<1 || nods_data<3 || nods_prime==0){
    43                 _error_("nothing to be done according to the mesh given in input");
     42                _error2_("nothing to be done according to the mesh given in input");
    4443        }
    4544
     
    5554        }
    5655        else{
    57                 _error_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");
     56                _error2_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");
    5857        }
    5958
    6059        if((numcontours) && (interpolation_type==2)){
    61                 _error_(" element interpolation_type with contours not supported yet!");
     60                _error2_("element interpolation_type with contours not supported yet!");
    6261        }
    6362
     
    7271
    7372        /*Initialize output*/
    74         data_prime=new Vector(nods_prime);
     73        data_prime=new Vector(nods_prime,false,SeqVecType);
    7574        if(num_default_values){
    7675                if(num_default_values==1)for (i=0;i<nods_prime;i++) data_prime->SetValue(i,default_values[0],INS_VAL);
     
    8483        }
    8584        else{
    86                  incontour=(double*)xmalloc(nods_prime*sizeof(double));
    87                  for (i=0;i<nods_prime;i++) incontour[i]=1;
     85                 incontour=xNew<double>(nods_prime);
     86                 for (i=0;i<nods_prime;i++) incontour[i]=1.0;
    8887        }
    8988
     
    112111
    113112        /*Assign output pointers:*/
    114          xfree((void**)&incontour);
     113         xDelete<double>(incontour);
    115114        *pdata_prime=data_prime;
    116115}
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.h

    r11708 r12878  
    66#define _INTERPFROMMESH2DX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../toolkits/toolkits.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp

    r11708 r12878  
    88void* InterpFromMesh2dxt(void* vpthread_handle){
    99
    10         /*gate variables :*/
    11         InterpFromMesh2dxThreadStruct* gate=NULL;
    12         pthread_handle* handle=NULL;
    13         int     my_thread;
    14         int     num_threads;
    15        
    16         int interpolation_type;
    17         bool debug;
    18         int  nels_data;
    19         double* index_data=NULL;
    20         double* x_data=NULL;
    21         double* y_data=NULL;
    22         double* data=NULL;
    23         double xmin,xmax;
    24         double ymin,ymax;
    25         int    nods_prime;
    26         Vector*    data_prime=NULL;
    27         double* x_prime=NULL;
    28         double* y_prime=NULL;
    29         double* default_values=NULL;
    30         int     num_default_values;
    31         double*    incontour=NULL;
    32 
    3310        /*intermediary: */
    34         int     i0;
    35         int     i1;
    36         int     i,j;
    37         double  area;
    38         double  area_1,area_2,area_3;
     11        int     i0,i1,i,j;
     12        double  area,area_1,area_2,area_3;
    3913        double  data_value;
    4014
    4115        /*recover handle and gate: */
    42         handle=(pthread_handle*)vpthread_handle;
    43         gate=(InterpFromMesh2dxThreadStruct*)handle->gate;
    44         my_thread=handle->id;
    45         num_threads=handle->num;
     16        pthread_handle                *handle      = (pthread_handle*)vpthread_handle;
     17        InterpFromMesh2dxThreadStruct *gate        = (InterpFromMesh2dxThreadStruct*)handle->gate;
     18        int                            my_thread   = handle->id;
     19        int                            num_threads = handle->num;
    4620       
    4721        /*recover parameters :*/
    48         interpolation_type=gate->interpolation_type;
    49         debug=gate->debug;
    50         nels_data=gate->nels_data;
    51         index_data=gate->index_data;
    52         x_data=gate->x_data;
    53         y_data=gate->y_data;
    54         data=gate->data;
    55         xmin=gate->xmin;
    56         xmax=gate->xmax;
    57         ymin=gate->ymin;
    58         ymax=gate->ymax;
    59         nods_prime=gate->nods_prime;
    60         data_prime=gate->data_prime;
    61         x_prime=gate->x_prime;
    62         y_prime=gate->y_prime;
    63         default_values=gate->default_values;
    64         num_default_values=gate->num_default_values;
    65         incontour=gate->incontour;
     22        int     interpolation_type = gate->interpolation_type;
     23        bool    debug              = gate->debug;
     24        int     nels_data          = gate->nels_data;
     25        double *index_data         = gate->index_data;
     26        double *x_data             = gate->x_data;
     27        double *y_data             = gate->y_data;
     28        double *data               = gate->data;
     29        double  xmin               = gate->xmin;
     30        double  xmax               = gate->xmax;
     31        double  ymin               = gate->ymin;
     32        double  ymax               = gate->ymax;
     33        int     nods_prime         = gate->nods_prime;
     34        Vector *data_prime         = gate->data_prime;
     35        double *x_prime            = gate->x_prime;
     36        double *y_prime            = gate->y_prime;
     37        double *default_values     = gate->default_values;
     38        int     num_default_values = gate->num_default_values;
     39        double *incontour          = gate->incontour;
    6640
    6741        /*partition loop across threads: */
     
    6943
    7044        /*Loop over the elements*/
    71         if (debug && my_thread==0) printf("      interpolation progress:   %5.2lf %%",0.0);
    72 
    73         for (i=i0;i<i1;i++){
     45        for(i=i0;i<i1;i++){
    7446
    7547                /*display current iteration*/
    76                 if (debug && my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100*num_threads);
     48                if (debug && my_thread==0 && fmod((double)i,(double)100)==0)
     49                 _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%");
    7750
    7851                /*if there is no point inside the domain, go to next iteration*/
     
    11487                                                data_value=data[i];
    11588                                        }
    116                                         if (isnan(data_value)){
     89                                        if (xIsNan<IssmDouble>(data_value)){
    11790                                                if(num_default_values==1) data_value=default_values[0];
    11891                                                else data_value=default_values[j];
     
    12598                }
    12699        }
    127         if (debug && my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
    128        
     100        if(debug && my_thread==0)
     101         _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
    129102        return NULL;
    130 
    131103}
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp

    r12004 r12878  
    3030        /*some checks*/
    3131        if (nels<1 || nods<3 || nlines<1 || ncols<1 || xposting==0 || yposting==0){
    32                 _error_("nothing to be done according to the mesh given in input");
     32                _error2_("nothing to be done according to the mesh given in input");
    3333        }
    3434
     
    4141        }
    4242        else{
    43                 _error_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");
     43                _error2_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");
    4444        }
    4545
    4646        /*First, allocate pointers: */
    47         griddata=(double*)xcalloc(nlines*ncols,sizeof(double));
    48         x_grid=(double*)xcalloc(ncols,sizeof(double));
    49         y_grid=(double*)xcalloc(nlines,sizeof(double));
     47        griddata=xNewZeroInit<double>(nlines*ncols);
     48        x_grid=xNewZeroInit<double>(ncols);
     49        y_grid=xNewZeroInit<double>(nlines);
    5050
    5151        /*Set debug to 1 if there are lots of elements*/
     
    8585
    8686        /*Loop over the elements*/
    87         if (debug) printf("      interpolation progress:   %5.2lf %%",0.0);
    8887        for (n=0;n<nels;n++){
    8988
    9089                /*display current iteration*/
    91                 if (debug && fmod((double)n,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)n/nels*100);
     90                if (debug && fmod((double)n,(double)100)==0)
     91                 _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(n)/double(nels)*100<<"%");
    9292
    9393                /*Get extrema coordinates of current elements*/
     
    160160                                                data_value=data_mesh[n];
    161161                                        }
    162                                         if (isnan(data_value)) data_value=default_value;
     162                                        if (xIsNan<IssmDouble>(data_value)) data_value=default_value;
    163163
    164164                                        /*insert value and go to the next point*/
     
    168168                }
    169169        }
    170         if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
     170        if (debug)
     171         _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
    171172
    172173        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp

    r12168 r12878  
    77#include "../../include/include.h"
    88#include "../../toolkits/toolkits.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010#include "../modules.h"
    1111
     
    1313using namespace std;
    1414
    15 int InterpFromMeshToMesh2dx(double** pdata_interp,double* index_data,double* x_data,double* y_data,int nods_data,int nels_data,
    16                         double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values, DataSet* contours){
     15int InterpFromMeshToMesh2dx(double** pdata_interp,int* index_data,double* x_data,double* y_data,int nods_data,int nels_data,
     16                        double* data,int M_data,int N_data,double* x_interp,double* y_interp,int N_interp,Options* options){
    1717       
    1818        /*Output*/
     
    2020
    2121        /*Intermediary*/
     22        double xmin,xmax,ymin,ymax;
     23        bool   isdefault;
     24        double defaultvalue;
    2225        R2     r;
    2326        I2     I;
     
    2932        double data_value;
    3033        Icoor2 dete[3];
    31         int verbose=0;
    32 
    33         /*default values: */
    34         Vector*    vec_incontour=NULL;
    35         double*    incontour=NULL;
    36         bool   skip_bamg=false;
    3734
    3835        /*Checks*/
    39         if (data_cols<=0){
    40                 _error_("data provided has a negative number of columns");
     36        if (M_data!=nods_data && M_data!=nels_data){
     37                _error2_("data provided should have either " << nods_data << " or " << nels_data << " lines (not " << M_data << ")");
    4138        }
    42         if (data_rows!=nods_data && data_rows!=nels_data){
    43                 _error_("data provided should have either %i or %i lines (not %i)",nods_data,nels_data,data_rows);
     39
     40        /*Get default*/
     41        if(options->GetOption("default")){
     42                isdefault=true;
     43                options->Get(&defaultvalue,"default");
    4444        }
    45         if((num_default_values) && (data_cols>1)){
    46                 _error_("data provided can only have 1 column if a default value is provided");
    47         }
    48        
    49         /*If default values supplied, figure out which nodes are inside the contour, including the border of the contour: */
    50         if(num_default_values){
    51                 ContourToNodesx( &vec_incontour,x_interp,y_interp,nods_interp,contours,1);
    52                 incontour=vec_incontour->ToMPISerial();
     45        else{
     46                isdefault=false;
    5347        }
    5448
    5549        /*Initialize output*/
    56         if (verbose) printf("Initializing output vector\n");
    57         data_interp=(double*)xmalloc(nods_interp*data_cols*sizeof(double));
     50        data_interp=xNew<double>(N_interp*N_data);
    5851
    59         // read background mesh
    60         if (verbose) printf("Reading mesh\n");
     52        /*read background mesh*/
    6153        Mesh Th(index_data,x_data,y_data,nods_data,nels_data);
     54
     55        /*Get reference number (for subdomains)*/
     56        long* reft = xNew<long>(Th.nbt);
     57        Th.TriangleReferenceList(reft);
    6258        Th.CreateSingleVertexToTriangleConnectivity();
    6359
    64         //Loop over output nodes
    65         if (verbose) printf("Loop over the nodes\n");
    66         for(i=0;i<nods_interp;i++){
    67                
    68                 /*reset skip_bamg: */
    69                 skip_bamg=false;
     60        /*Get domain boundaries*/
     61        xmin=x_data[0]; ymin=y_data[0];
     62        xmax=x_data[0]; ymax=y_data[0];
     63        for(i=1;i<nods_data;i++){
     64                if(x_data[i]<xmin) xmin=x_data[i];
     65                if(x_data[i]>xmax) xmax=x_data[i];
     66                if(y_data[i]<ymin) ymin=y_data[i];
     67                if(y_data[i]>ymax) ymax=y_data[i];
     68        }
    7069
    71                 /*figure out if we should skip bamg logic: */
    72                 if(num_default_values){
    73                         if(!incontour[i]){
    74                                 /*This node is not inside the contour. Skip Bamg logic and apply default value.: */
    75                                 skip_bamg=true;
     70        /*Loop over output nodes*/
     71        for(i=0;i<N_interp;i++){
     72                //if(i%100==0) _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(i)/double(N_interp)*100.<<"%");
     73
     74                if(isdefault){
     75                        if(x_interp[i]<xmin || x_interp[i]>xmax || y_interp[i]<ymin || y_interp[i]>ymax){
     76                                for(j=0;j<N_data;j++) data_interp[i*N_data+j]=defaultvalue;
     77                                continue;
    7678                        }
    7779                }
    7880
    79                 if(skip_bamg==false){
     81                /*Get current point coordinates*/
     82                r.x=x_interp[i]; r.y=y_interp[i];
     83                I2 I=Th.R2ToI2(r);
    8084
    81                         //Get current point coordinates
    82                         r.x=x_interp[i]; r.y=y_interp[i];
    83                         I2 I=Th.R2ToI2(r);
     85                /*Find triangle holding r/I*/
     86                Triangle &tb=*Th.TriangleFindFromCoord(I,dete);
    8487
    85                         //Find triangle holding r/I
    86                         Triangle &tb=*Th.TriangleFindFromCoord(I,dete);
     88                /*point inside convex*/
     89                if (tb.det>0){
    8790
    88                         // internal point
    89                         if (tb.det>0){
    90                                 //Area coordinate
    91                                 areacoord[0]= (double) dete[0]/tb.det;
    92                                 areacoord[1]= (double) dete[1]/tb.det;
    93                                 areacoord[2]= (double) dete[2]/tb.det;
    94                                 //3 vertices of the triangle
    95                                 i0=Th.GetId(tb[0]);
    96                                 i1=Th.GetId(tb[1]);
    97                                 i2=Th.GetId(tb[2]);
    98                                 //triangle number
    99                                 it=Th.GetId(tb);
     91                        /*Area coordinates*/
     92                        areacoord[0]= (double) dete[0]/tb.det;
     93                        areacoord[1]= (double) dete[1]/tb.det;
     94                        areacoord[2]= (double) dete[2]/tb.det;
     95                        /*3 vertices of the triangle*/
     96                        i0=Th.GetId(tb[0]);
     97                        i1=Th.GetId(tb[1]);
     98                        i2=Th.GetId(tb[2]);
     99                        /*triangle number*/
     100                        it=Th.GetId(tb);
     101
     102                        /*Inside convex but outside mesh*/
     103                        if (reft[it]<0 & isdefault){
     104                                for(j=0;j<N_data;j++) data_interp[i*N_data+j]=defaultvalue;
     105                                continue;
    100106                        }
    101                         //external point
    102                         else {
     107                }
     108                //external point
     109                else{
     110                        if(isdefault){
     111                                for(j=0;j<N_data;j++) data_interp[i*N_data+j]=defaultvalue;
     112                                continue;
     113                        }
     114                        else{
    103115                                //Get closest adjacent triangle (inside the mesh)
    104116                                AdjacentTriangle ta=CloseBoundaryEdge(I,&tb,aa,bb).Adj();
     
    116128                                it=Th.GetId(tc);
    117129                        }
    118                        
    119                         if (data_rows==nods_data){
    120                                 for (j=0;j<data_cols;j++){
    121                                         data_interp[i*data_cols+j]=areacoord[0]*data[data_cols*i0+j]+areacoord[1]*data[data_cols*i1+j]+areacoord[2]*data[data_cols*i2+j];
    122                                 }
    123                         }
    124                         else{
    125                                 for (j=0;j<data_cols;j++){
    126                                         if (it<0 || it>=nels_data){
    127                                                 _error_("Triangle number %i not in [0 %i], because not correctly implemented yet... interpolate on grid first",it,nels_data);
    128                                         }
    129                                         data_interp[i*data_cols+j]=data[data_cols*it+j];
    130                                 }
     130                }
     131
     132                if (M_data==nods_data){
     133                        for (j=0;j<N_data;j++){
     134                                data_interp[i*N_data+j]=areacoord[0]*data[N_data*i0+j]+areacoord[1]*data[N_data*i1+j]+areacoord[2]*data[N_data*i2+j];
    131135                        }
    132136                }
    133137                else{
    134                         if(num_default_values==1) data_interp[i]=default_values[0];
    135                         else data_interp[i]=default_values[i];
     138                        for (j=0;j<N_data;j++){
     139                                if (it<0 || it>=nels_data){
     140                                        _error2_("Triangle number " << it << " not in [0 " << nels_data << "], report bug to developers");
     141                                }
     142                                data_interp[i*N_data+j]=data[N_data*it+j];
     143                        }
    136144                }
    137145        }
     146        //if(N_interp>=100) _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
    138147
    139         /*Assign output pointers:*/
    140         if (verbose) printf("Assigning output\n");
     148        /*clean-up and return*/
     149        xDelete<long>(reft);
    141150        *pdata_interp=data_interp;
    142 
    143         /*No error return*/
    144151        return 1;
    145152}
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h

    r12168 r12878  
    66#define _INTERPFROMMESHTOMESH2DX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/classes.h"
    99
    10 /* local prototypes: */
    11 int InterpFromMeshToMesh2dx(double** pdata_interp,double* index_data,double* x_data,double* y_data,int nods_data,int nels_data,
    12                         double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values,DataSet* contours);
     10int InterpFromMeshToMesh2dx(double** pdata_interp,int* index_data,double* x_data,double* y_data,int nods_data,int nels_data,
     11                        double* data,int M_data,int N_data,double* x_interp,double* y_interp,int N_interp,Options* options);
    1312
    1413#endif
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp

    r11708 r12878  
    2727        /*some checks*/
    2828        if (nels_data<1 || nods_data<6 || nods_prime==0){
    29                 _error_("nothing to be done according to the mesh given in input");
     29                _error2_("nothing to be done according to the mesh given in input");
    3030        }
    3131
     
    4141        }
    4242        else{
    43                 _error_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");
     43                _error2_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");
    4444        }
    4545
     
    5858
    5959        /*Loop over the elements*/
    60         if (debug) printf("      interpolation progress:   %5.2lf %%",0.0);
    6160        for (i=0;i<nels_data;i++){
    6261
    6362                /*display current iteration*/
    64                 if (debug && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100);
     63                if (debug && fmod((double)i,(double)100)==0)
     64                 _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(i)/double(nels_data)*100<<"%");
    6565
    6666                /*Get extrema coordinates of current elements*/
     
    124124                                                data_value=data[i];
    125125                                        }
    126                                         if (isnan(data_value)) data_value=default_value;
     126                                        if (xIsNan<IssmDouble>(data_value)) data_value=default_value;
    127127
    128128                                        /*insert value and go to the next point*/
     
    132132                }
    133133        }
    134         if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
     134        if (debug)
     135         _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
    135136
    136137        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h

    r12004 r12878  
    77
    88#include "../../toolkits/toolkits.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111int InterpFromMeshToMesh3dx( Vector** pdata_prime,double* index_data, double* x_data, double* y_data, double* z_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, double* z_prime, int nods_prime,double default_value);
  • issm/branches/trunk-jpl-damage/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp

    r9725 r12878  
    2222        int     counter;
    2323        int     nods;
    24         double* times=NULL;
    25         double* values=NULL;
     24        IssmDouble* times=NULL;
     25        IssmDouble* values=NULL;
    2626        bool    spcpresent=false;
    2727        int     count=0;
     
    2929
    3030        /*variables being fetched: */
    31         double *doublevector  = NULL;
     31        IssmDouble *IssmDoublevector  = NULL;
    3232        int     M,N;
    3333
     
    3838        fid=iomodel->SetFilePointerToData(&code, &vector_layout,vector_enum);
    3939
    40         if(code!=7)_error_("%s%s"," expecting a double vector for constraints with enum ",EnumToStringx(vector_enum));
    41         if(vector_layout!=1)_error_("%s%s"," expecting a nodal vector for constraints with enum ",EnumToStringx(vector_enum));
     40        if(code!=7)_error2_("expecting a IssmDouble vector for constraints with enum " << EnumToStringx(vector_enum));
     41        if(vector_layout!=1)_error2_("expecting a nodal vector for constraints with enum " << EnumToStringx(vector_enum));
    4242
    4343        /*Fetch vector:*/
    44         iomodel->FetchData(&doublevector,&M,&N,vector_enum);
     44        iomodel->FetchData(&IssmDoublevector,&M,&N,vector_enum);
    4545
    4646        /*Transient or static?:*/
     
    5555                        if((iomodel->my_vertices[i])){
    5656
    57                                 if (!isnan(doublevector[i])){
     57                                if (!xIsNan<IssmDouble>(IssmDoublevector[i])){
    5858
    59                                         constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,doublevector[i],analysis_type));
     59                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,IssmDoublevector[i],analysis_type));
    6060                                        count++;
    6161                                }
     
    6969
    7070                /*figure out times: */
    71                 times=(double*)xmalloc(N*sizeof(double));
     71                times=xNew<IssmDouble>(N);
    7272                for(j=0;j<N;j++){
    73                         times[j]=doublevector[(M-1)*N+j];
     73                        times[j]=IssmDoublevector[(M-1)*N+j];
    7474                }
    7575                /*unit conversion: */
     
    8383
    8484                                /*figure out times and values: */
    85                                 values=(double*)xmalloc(N*sizeof(double));
     85                                values=xNew<IssmDouble>(N);
    8686                                spcpresent=false;
    8787                                for(j=0;j<N;j++){
    88                                         values[j]=doublevector[i*N+j];
    89                                         if(!isnan(values[j]))spcpresent=true; //NaN means no spc by default
     88                                        values[j]=IssmDoublevector[i*N+j];
     89                                        if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default
    9090                                }
    9191
     
    9494                                        count++;
    9595                                }
    96                                 xfree((void**)&values);
     96                                xDelete<IssmDouble>(values);
    9797                        }
    9898                }
    9999        }
    100100        else{
    101                 _error_("Size of field %s not supported",EnumToStringx(vector_enum));
     101                _error2_("Size of field " << EnumToStringx(vector_enum) << " not supported");
    102102        }
    103103
    104104        /*Free ressources:*/
    105         xfree((void**)&doublevector);
    106         xfree((void**)&times);
    107         xfree((void**)&values);
     105        xDelete<IssmDouble>(IssmDoublevector);
     106        xDelete<IssmDouble>(times);
     107        xDelete<IssmDouble>(values);
    108108}
  • issm/branches/trunk-jpl-damage/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h

    r9340 r12878  
    66
    77#include "../../Container/Container.h"
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/KMLFileReadx/KMLFileReadx.cpp

    r11295 r12878  
    2121        clock0=clock();
    2222        time0 =time(NULL);
    23         _printf_(true,"\nKMLFileReadx Module -- %s",ctime(&time0));
     23        _pprintString_("\nKMLFileReadx Module -- " << ctime(&time0));
    2424
    2525/*  read kml file  */
     
    4343                }
    4444
    45 //              _printf_(true,"%s\n",kstr);
    46                 xfree((void**)&kstr);
     45//              _pprintLine_(kstr);
     46                xDelete<char>(kstr);
    4747        }
    4848
    4949        if (kxml) {
    50                 _printf_(true,"XML declaration:\n");
     50                _pprintLine_("XML declaration:");
    5151                kxml->DeepEcho("  ");
    5252                delete kxml;
    5353        }
    5454        if (kdtd) {
    55                 _printf_(true,"DTD declaration (not yet implemented):\n");
     55                _pprintLine_("DTD declaration (not yet implemented):");
    5656                kdtd->DeepEcho("  ");
    5757                delete kdtd;
  • issm/branches/trunk-jpl-damage/src/c/modules/KMLFileReadx/KMLFileReadx.h

    r11295 r12878  
    88#include <float.h>    /*  DBL_MAX  */
    99#include "../../Container/Container.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/KMLMeshWritex/KMLMeshWritex.cpp

    r9761 r12878  
    99#include "../../EnumDefinitions/EnumDefinitions.h"
    1010
    11 void KMLMeshWritex(int* ierror,
    12                                    char* name,
    13                                    char* notes,
    14                                    int* elem,int melem,int nelem,
    15                                    int* nodecon,int mncon,int nncon,
    16                                    double* lat, double* lng,
    17                                    int* part,
    18                                    double* data, int mdata, int ndata,
    19                                    double* cmap, int mcmap, int ncmap,
    20                                    FILE* fid){
    21 
    22         int     i,j,k,ipt=0,jpt=0,nnodes;
    23         int     mxepg=25;
    24         int     lwidth=1;
    25         double  popac=0.50;
    26         char    indent[81]="  ";
    27         char    cstr[81];
    28         double* edata=NULL;
    29         bool    ncfree=false,
    30                         edfree=false;
    31         KML_Document*  kdoc=NULL;
    32         KML_Style*     kstyle;
    33         KML_LineStyle* klsty;
    34         KML_PolyStyle* kpsty;
     11void KMLMeshWritex(int* ierror,char* name,char* notes,int* elem,int melem,int nelem,int* nodecon,int mncon,int nncon,double* lat, double* lng,int* part,double* data, int mdata, int ndata,double* cmap, int mcmap, int ncmap,FILE* fid){
     12
     13        int                 i,j,k,ipt=0,jpt=0,nnodes;
     14        int                 mxepg      = 25;
     15        int                 lwidth     = 1;
     16        double              popac      = 0.50;
     17        char                indent[81] = " ";
     18        char                cstr[81];
     19        double             *edata = NULL;
     20        bool ncfree=false, edfree=false;
     21        KML_Document       *kdoc = NULL;
     22        KML_Style          *kstyle;
     23        KML_LineStyle      *klsty;
     24        KML_PolyStyle      *kpsty;
    3525
    3626        clock_t clock0,clock1,clock0a,clock0b,clock0c;
     
    3929        clock0=clock();
    4030        time0 =time(NULL);
    41         _printf_(true,"\nKMLMeshWritex Module -- %s",ctime(&time0));
     31        _pprintString_("\nKMLMeshWritex Module -- " << ctime(&time0));
    4232
    4333/*  construct kml document  */
     
    9383
    9484        if (cmap) {
    95                 _printf_(true,"Writing %d Matlab colors as KML style templates.\n",mcmap);
     85                _pprintLine_("Writing " << mcmap << " Matlab colors as KML style templates.");
    9686                ipt=0;
    9787                for (i=0; i<mcmap; i++) {
     
    128118
    129119        if (!nodecon) {
    130                 _printf_(true,"Creating the node connectivity table.\n");
     120                _pprintLine_("Creating the node connectivity table.");
    131121                nncon=mxepg+1;
    132                 nodecon=(int *) xcalloc(mncon*nncon,sizeof(int));
     122                nodecon=xNewZeroInit<int>(mncon*nncon);
    133123                ncfree=true;
    134124
     
    143133                                        }
    144134                                        else
    145                                                 _error_("Nodal connectivity table needs more than specified %d columns.\n",mxepg);
     135                                                _error2_("Nodal connectivity table needs more than specified " << mxepg << " columns.\n");
    146136                                }
    147137                                jpt++;
     
    159149
    160150                else if (mdata == mncon) {
    161                         _printf_(true,"Averaging nodal data to element data.\n");
    162                         edata=(double *) xcalloc(melem*ndata,sizeof(double));
     151                        _pprintLine_("Averaging nodal data to element data.");
     152                        edata=xNewZeroInit<double>(melem*ndata);
    163153                        edfree=true;
    164154
     
    183173
    184174                else
    185                         _error_("Data matrix has incorrect number of %d rows.\n",mdata);
     175                        _error2_("Data matrix has incorrect number of " << mdata << " rows.\n");
    186176        }
    187177
     
    194184                                                                                                                cmap,mcmap,ncmap));
    195185
    196         if (edfree) xfree((void**)&edata);
    197         if (ncfree) xfree((void**)&nodecon);
     186        if(edfree) xDelete<double>(edata);
     187        if(ncfree) xDelete<int>(nodecon);
    198188        clock0a=clock();
    199189        time0a =time(NULL);
     
    203193/*  write kml file  */
    204194
    205         _printf_(true,"Writing kml document to file.\n");
     195        _pprintLine_("Writing kml document to file.");
    206196        fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    207197        fprintf(fid,"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n");
     
    213203                         ((double)(clock0b-clock0a))/CLOCKS_PER_SEC,difftime(time0b,time0a));
    214204
    215         _printf_(true,"Deleting kml document.\n");
     205        _pprintLine_("Deleting kml document.");
    216206        delete kdoc;
    217207        clock0c=clock();
     
    314304/*  write each element as a polygon placemark  */
    315305
    316         _printf_(true,"Writing %d tria elements as KML polygons.\n",melem);
     306        _pprintLine_("Writing " << melem << " tria elements as KML polygons.");
    317307
    318308        for (i=0; i<melem; i++) {
     
    344334                kring=new KML_LinearRing();
    345335                kring->ncoord    =nelem+1;
    346                 kring->coords    =(double (*)[3]) xmalloc((nelem+1)*3*sizeof(double));
     336                kring->coords =xNew<double>((nelem+1)*3);
    347337
    348338/*  write the nodal coordinates as a linear ring  */
    349339
    350340                for (j=0; j<nelem; j++) {
    351                         kring->coords[j][0]=lng[elem[ipt]-1];
    352                         kring->coords[j][1]=lat[elem[ipt]-1];
    353                         kring->coords[j][2]=alt;
     341                        kring->coords[3*j+0]=lng[elem[ipt]-1];
     342                        kring->coords[3*j+1]=lat[elem[ipt]-1];
     343                        kring->coords[3*j+2]=alt;
    354344                        ipt++;
    355345                }
    356                 kring->coords[nelem][0]=kring->coords[0][0];
    357                 kring->coords[nelem][1]=kring->coords[0][1];
    358                 kring->coords[nelem][2]=kring->coords[0][2];
     346                kring->coords[3*nelem+0]=kring->coords[3*0+0];
     347                kring->coords[3*nelem+1]=kring->coords[3*0+1];
     348                kring->coords[3*nelem+2]=kring->coords[3*0+2];
    359349//              kring->DeepEcho();
    360350
    361351/*  assemble the linear ring into polygon into placemark into folder  */
    362352
    363                 (kpoly ->outer     )->AddObject((Object*)kring);
    364                 (kplace->geometry  )->AddObject((Object*)kpoly);
    365                 (kfold ->feature   )->AddObject((Object*)kplace);
     353                (kpoly ->outer   )->AddObject((Object*)kring);
     354                (kplace->geometry)->AddObject((Object*)kpoly);
     355                (kfold ->feature )->AddObject((Object*)kplace);
    366356
    367357//              if (!(int)fmod((double)(i+1),1000))
    368 //                      _printf_(true,"  %d tria elements written.\n",(i+1));
     358//                      _pprintLine_("  " << (i+1) << " tria elements written.");
    369359        }
    370         _printf_(true,"  %d tria elements written.\n",melem);
     360        _pprintLine_("  " << melem << " tria elements written.");
    371361
    372362        return(kfold);
  • issm/branches/trunk-jpl-damage/src/c/modules/KMLMeshWritex/KMLMeshWritex.h

    r8461 r12878  
    88#include <float.h>    /*  DBL_MAX  */
    99#include "../../Container/Container.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/KMLOverlayx/KMLOverlayx.cpp

    r9761 r12878  
    2828        clock0=clock();
    2929        time0 =time(NULL);
    30         _printf_(true,"\nKMLOverlayx Module -- %s",ctime(&time0));
     30        _pprintString_("\nKMLOverlayx Module -- " << ctime(&time0));
    3131
    3232/*  construct kml file  */
     
    8282/*  write kml file  */
    8383
    84         _printf_(true,"Writing kml document to file.\n");
     84        _pprintLine_("Writing kml document to file.");
    8585        fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    8686        kfile->Write(fid,indent);
  • issm/branches/trunk-jpl-damage/src/c/modules/KMLOverlayx/KMLOverlayx.h

    r8605 r12878  
    88#include <float.h>    /*  DBL_MAX  */
    99#include "../../Container/Container.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Kml2Expx/Kml2Expx.cpp

    r9761 r12878  
    3838        clock0=clock();
    3939        time0 =time(NULL);
    40         _printf_(true,"\nKml2Expx Module -- %s",ctime(&time0));
     40        _pprintString_("\nKml2Expx Module -- " << ctime(&time0));
    4141
    4242/*  read kml file  */
     
    4444        fidi=fopen(filkml,"r");
    4545        if (!(kobj=KMLFileReadx(fidi)))
    46                 _error_("Error reading kml file.");
     46                _error2_("Error reading kml file.");
    4747        fclose(fidi);
    4848
    4949/*  open exp file  */
    5050
    51         _printf_(true,"Writing exp profiles to file.\n");
     51        _pprintLine_("Writing exp profiles to file.");
    5252        fido=fopen(filexp,"w");
    5353
  • issm/branches/trunk-jpl-damage/src/c/modules/Kml2Expx/Kml2Expx.h

    r9259 r12878  
    88#include <float.h>    /*  DBL_MAX  */
    99#include "../../Container/Container.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Krigingx/Krigingx.cpp

    r12258 r12878  
    77#include "../../include/include.h"
    88#include "../../toolkits/toolkits.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010#include "../../Container/Observations.h"
    1111#include "../modules.h"
    12 
    1312#ifdef _HAVE_GSL_
    1413#include <gsl/gsl_linalg.h>
    1514#endif
    16 
    17 #include "../../objects/Kriging/GaussianVariogram.h"
    1815/*FUNCTION Krigingx{{{*/
    1916int Krigingx(double** ppredictions,double **perror,double* obs_x, double* obs_y, double* obs_list, int obs_length,double* x_interp,double* y_interp,int n_interp,Options* options){
     
    2421
    2522        /*Intermediaries*/
    26         double        range;
     23        int           mindata,maxdata;
     24        double        radius;
    2725        char         *output       = NULL;
    2826        Variogram    *variogram    = NULL;
     
    3836        /*Get Variogram from Options*/
    3937        ProcessVariogram(&variogram,options);
    40         options->Get(&range,"searchrange",0.);
     38        options->Get(&radius,"searchradius",0.);
     39        options->Get(&mindata,"mindata",1);
     40        options->Get(&maxdata,"maxdata",50);
    4141
    4242        /*Process observation dataset*/
     
    4444
    4545        /*Allocate output*/
    46         predictions =(double*)xcalloc(n_interp,sizeof(double));
    47         error       =(double*)xcalloc(n_interp,sizeof(double));
     46        predictions =xNewZeroInit<double>(n_interp);
     47        error       =xNewZeroInit<double>(n_interp);
    4848
    4949        /*Get output*/
     
    5656                observations->Variomap(predictions,x_interp,n_interp);
    5757        }
    58         else if(strcmp(output,"prediction")==0){
    59 
     58        else if(strcmp(output,"delaunay")==0){
     59                int nobs,nel;
     60                double *x     = NULL;
     61                double *y     = NULL;
     62                double *data  = NULL;
     63                int    *index = NULL;
     64
     65                observations->ObservationList(&x,&y,&data,&nobs);
     66
     67                _printLine_("Generation Delaunay Triangulation");
     68                BamgTriangulatex(&index,&nel,x,y,nobs);
     69
     70                _printLine_("Interpolating");
     71                xDelete<double>(predictions);
     72                InterpFromMeshToMesh2dx(&predictions,index,x,y,nobs,nel,data,nobs,1,x_interp,y_interp,n_interp,options);
     73                xDelete<double>(x);
     74                xDelete<double>(y);
     75                xDelete<double>(data);
     76                xDelete<int>(index);
     77        }
     78        else if(strcmp(output,"nearestneighbor")==0){
    6079                /*initialize thread parameters: */
    6180                gate.n_interp     = n_interp;
    6281                gate.x_interp     = x_interp;
    6382                gate.y_interp     = y_interp;
    64                 gate.range        = range;
     83                gate.radius       = radius;
     84                gate.mindata      = mindata;
     85                gate.maxdata      = maxdata;
    6586                gate.variogram    = variogram;
    6687                gate.observations = observations;
    6788                gate.predictions  = predictions;
    6889                gate.error        = error;
    69                 gate.percent      = (double*)xcalloc(num,sizeof(double));
     90                gate.percent      = xNewZeroInit<double>(num);
     91
     92                /*launch the thread manager with Krigingxt as a core: */
     93                LaunchThread(NearestNeighbort,(void*)&gate,num);
     94                _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
     95                xDelete<double>(gate.percent);
     96        }
     97        else if(strcmp(output,"idw")==0){ //Inverse distance weighting
     98                double power;
     99                options->Get(&power,"power",2.);
     100                /*initialize thread parameters: */
     101                gate.n_interp     = n_interp;
     102                gate.x_interp     = x_interp;
     103                gate.y_interp     = y_interp;
     104                gate.radius       = radius;
     105                gate.mindata      = mindata;
     106                gate.maxdata      = maxdata;
     107                gate.variogram    = variogram;
     108                gate.observations = observations;
     109                gate.predictions  = predictions;
     110                gate.error        = error;
     111                gate.percent      = xNewZeroInit<double>(num);
     112                gate.power        = power;
     113
     114                /*launch the thread manager with Krigingxt as a core: */
     115                LaunchThread(idwt,(void*)&gate,num);
     116                _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
     117                xDelete<double>(gate.percent);
     118        }
     119        else if(strcmp(output,"prediction")==0){
     120
     121                /*initialize thread parameters: */
     122                gate.n_interp     = n_interp;
     123                gate.x_interp     = x_interp;
     124                gate.y_interp     = y_interp;
     125                gate.radius       = radius;
     126                gate.mindata      = mindata;
     127                gate.maxdata      = maxdata;
     128                gate.variogram    = variogram;
     129                gate.observations = observations;
     130                gate.predictions  = predictions;
     131                gate.error        = error;
     132                gate.percent      = xNewZeroInit<double>(num);
    70133
    71134                /*launch the thread manager with Krigingxt as a core: */
    72135                LaunchThread(Krigingxt,(void*)&gate,num);
    73                 printf("\r      interpolation progress:  100.00%%\n");
    74                 xfree((void**)&gate.percent);
     136                _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
     137                xDelete<double>(gate.percent);
    75138        }
    76139        else{
    77                 _error_("output '%s' not supported yet",output);
     140                _error2_("output '" << output << "' not supported yet");
    78141        }
    79142
     
    81144        delete variogram;
    82145        delete observations;
    83         xfree((void**)&output);
     146        xDelete<char>(output);
    84147        *ppredictions = predictions;
    85148        *perror       = error;
     
    106169        double       *x_interp     = gate->x_interp;
    107170        double       *y_interp     = gate->y_interp;
    108         double        range        = gate->range;
     171        double        radius       = gate->radius;
     172        int           mindata      = gate->mindata;
     173        int           maxdata      = gate->maxdata;
    109174        Variogram    *variogram    = gate->variogram;
    110175        Observations *observations = gate->observations;
     
    114179
    115180        /*Intermediaries*/
    116         int           i,j,n_obs;
    117         double        numerator,denominator,ratio,localpercent;
    118         double       *x            = NULL;
    119         double       *y            = NULL;
    120         double       *obs          = NULL;
    121         double       *Gamma        = NULL;
    122         double       *GinvG0       = NULL;
    123         double       *Ginv1        = NULL;
    124         double       *GinvZ        = NULL;
    125         double       *gamma0       = NULL;
    126         double       *ones         = NULL;
     181        double        localpercent;
     182
     183        /*partition loop across threads: */
     184        PartitionRange(&i0,&i1,n_interp,num_threads,my_thread);
     185        for(int idx=i0;idx<i1;idx++){
     186
     187                /*Print info*/
     188                percent[my_thread]=double(idx-i0)/double(i1-i0)*100.;
     189                localpercent=percent[0];
     190                for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
     191                if(my_thread==0) _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
     192
     193                /*Kriging interpolation*/
     194                observations->InterpolationKriging(&predictions[idx],&error[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,variogram);
     195        }
     196
     197        return NULL;
     198}/*}}}*/
     199/*FUNCTION NearestNeighbort{{{*/
     200void* NearestNeighbort(void* vpthread_handle){
     201
     202        /*gate variables :*/
     203        KrigingxThreadStruct *gate        = NULL;
     204        pthread_handle       *handle      = NULL;
     205        int my_thread;
     206        int num_threads;
     207        int i0,i1;
     208
     209        /*recover handle and gate: */
     210        handle      = (pthread_handle*)vpthread_handle;
     211        gate        = (KrigingxThreadStruct*)handle->gate;
     212        my_thread   = handle->id;
     213        num_threads = handle->num;
     214
     215        /*recover parameters :*/
     216        int           n_interp     = gate->n_interp;
     217        double       *x_interp     = gate->x_interp;
     218        double       *y_interp     = gate->y_interp;
     219        double        radius       = gate->radius;
     220        int           mindata      = gate->mindata;
     221        int           maxdata      = gate->maxdata;
     222        Variogram    *variogram    = gate->variogram;
     223        Observations *observations = gate->observations;
     224        double       *predictions  = gate->predictions;
     225        double       *error        = gate->error;
     226        double       *percent      = gate->percent;
     227
     228        /*Intermediaries*/
     229        int           i;
     230        double        localpercent;
    127231
    128232        /*partition loop across threads: */
     
    134238                localpercent=percent[0];
    135239                for(i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
    136                 printf("\r      interpolation progress: %5.2lf%%",localpercent);
    137 
    138                 /*Get list of observations for current point*/
    139                 observations->ObservationList(&x,&y,&obs,&n_obs,x_interp[idx],y_interp[idx],range);
    140 
    141                 /*Allocate intermediary matrix and vectors*/
    142                 Gamma  = (double*)xmalloc(n_obs*n_obs*sizeof(double));
    143                 gamma0 = (double*)xmalloc(n_obs*sizeof(double));
    144                 ones   = (double*)xmalloc(n_obs*sizeof(double));
    145 
    146                 /*First: Create semivariogram matrix for observations*/
    147                 for(i=0;i<n_obs;i++){
    148                         for(j=0;j<=i;j++){
    149                                 Gamma[i*n_obs+j] = variogram->SemiVariogram(x[i]-x[j],y[i]-y[j]);
    150                                 Gamma[j*n_obs+i] = Gamma[i*n_obs+j];
    151                         }
    152                 }
    153                 for(i=0;i<n_obs;i++) ones[i]=1;
    154 
    155                 /*Get semivariogram vector associated to this location*/
    156                 for(i=0;i<n_obs;i++) gamma0[i] = variogram->SemiVariogram(x[i]-x_interp[idx],y[i]-y_interp[idx]);
    157 
    158                 /*Solve the three linear systems*/
    159                 GslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0
    160                 GslSolve(&Ginv1, Gamma,ones,n_obs);   // Gamma^-1 ones
    161                 GslSolve(&GinvZ, Gamma,obs,n_obs);    // Gamma^-1 Z
    162 
    163                 /*Prepare predictor*/
    164                 numerator=-1.; denominator=0.;
    165                 for(i=0;i<n_obs;i++) numerator  +=GinvG0[i];
    166                 for(i=0;i<n_obs;i++) denominator+=Ginv1[i];
    167                 ratio=numerator/denominator;
    168 
    169                 predictions[idx] = 0.;
    170                 error[idx]       = - numerator*numerator/denominator;
    171                 for(i=0;i<n_obs;i++) predictions[idx] += (gamma0[i]-ratio)*GinvZ[i];
    172                 for(i=0;i<n_obs;i++) error[idx] += gamma0[i]*GinvG0[i];
    173 
    174                 /*clean-up*/
    175                 xfree((void**)&x);
    176                 xfree((void**)&y);
    177                 xfree((void**)&obs);
    178                 xfree((void**)&Gamma);
    179                 xfree((void**)&gamma0);
    180                 xfree((void**)&ones);
    181                 xfree((void**)&GinvG0);
    182                 xfree((void**)&Ginv1);
    183                 xfree((void**)&GinvZ);
    184         }
    185 
     240                if(my_thread==0) _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
     241
     242                observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
     243        }
     244
     245        return NULL;
     246}/*}}}*/
     247/*FUNCTION idwt{{{*/
     248void* idwt(void* vpthread_handle){
     249
     250        /*gate variables :*/
     251        KrigingxThreadStruct *gate        = NULL;
     252        pthread_handle       *handle      = NULL;
     253        int my_thread;
     254        int num_threads;
     255        int i0,i1;
     256
     257        /*recover handle and gate: */
     258        handle      = (pthread_handle*)vpthread_handle;
     259        gate        = (KrigingxThreadStruct*)handle->gate;
     260        my_thread   = handle->id;
     261        num_threads = handle->num;
     262
     263        /*recover parameters :*/
     264        int           n_interp     = gate->n_interp;
     265        double       *x_interp     = gate->x_interp;
     266        double       *y_interp     = gate->y_interp;
     267        double        radius       = gate->radius;
     268        int           mindata      = gate->mindata;
     269        int           maxdata      = gate->maxdata;
     270        Variogram    *variogram    = gate->variogram;
     271        Observations *observations = gate->observations;
     272        double       *predictions  = gate->predictions;
     273        double       *error        = gate->error;
     274        double       *percent      = gate->percent;
     275        double        power        = gate->power;
     276
     277        /*Intermediaries*/
     278        double localpercent;
     279
     280        /*partition loop across threads: */
     281        PartitionRange(&i0,&i1,n_interp,num_threads,my_thread);
     282        for(int idx=i0;idx<i1;idx++){
     283
     284                /*Print info*/
     285                percent[my_thread]=double(idx-i0)/double(i1-i0)*100.;
     286                localpercent=percent[0];
     287                for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
     288                if(my_thread==0) _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
     289
     290                observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
     291        }
    186292        return NULL;
    187293}/*}}}*/
     
    199305                else if(strcmp(model,"spherical")==0)   variogram = new SphericalVariogram(options);
    200306                else if(strcmp(model,"power")==0)       variogram = new PowerVariogram(options);
    201                 else _error_("variogram %s not supported yet (list of supported variogram: gaussian, exponential, spherical and power)",model);
     307                else _error2_("variogram " << model << " not supported yet (list of supported variogram: gaussian, exponential, spherical and power)");
    202308        }
    203309        else variogram = new GaussianVariogram(options);
    204310
    205311        /*Assign output pointer*/
    206         xfree((void**)&model);
     312        xDelete<char>(model);
    207313        *pvariogram = variogram;
    208314}/*}}}*/
    209 void GslSolve(double** pX,double* A,double* B,int n){/*{{{*/
    210 #ifdef _HAVE_GSL_
    211 
    212                 /*GSL Matrices and vectors: */
    213                 int              s;
    214                 gsl_matrix_view  a;
    215                 gsl_vector_view  b;
    216                 gsl_vector      *x = NULL;
    217                 gsl_permutation *p = NULL;
    218 
    219                 /*A will be modified by LU decomposition. Use copy*/
    220                 double* Acopy = (double*)xmalloc(n*n*sizeof(double));
    221                 memcpy(Acopy,A,n*n*sizeof(double));
    222 
    223                 /*Initialize gsl matrices and vectors: */
    224                 a = gsl_matrix_view_array (Acopy,n,n);
    225                 b = gsl_vector_view_array (B,n);
    226                 x = gsl_vector_alloc (n);
    227 
    228                 /*Run LU and solve: */
    229                 p = gsl_permutation_alloc (n);
    230                 gsl_linalg_LU_decomp (&a.matrix, p, &s);
    231                 gsl_linalg_LU_solve (&a.matrix, p, &b.vector, x);
    232 
    233                 //printf ("x = \n");
    234                 //gsl_vector_fprintf (stdout, x, "%g");
    235 
    236                 /*Copy result*/
    237                 double* X = (double*)xmalloc(n*sizeof(double));
    238                 memcpy(X,gsl_vector_ptr(x,0),n*sizeof(double));
    239 
    240                 /*Clean up and assign output pointer*/
    241                 xfree((void**)&Acopy);
    242                 gsl_permutation_free(p);
    243                 gsl_vector_free(x);
    244                 *pX=X;
    245 #else
    246                 _error_("GSL support required");
    247 #endif
    248         }/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/modules/Krigingx/Krigingx.h

    r12258 r12878  
    66#define _KRIGINGX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../toolkits/toolkits.h"
    1010
     
    1313
    1414int  Krigingx(double** ppredictions,double **perror,double* x, double* y, double* observations, int n_obs,double* x_interp,double* y_interp,int n_interp,Options* options);
     15int  pKrigingx(double** ppredictions,double **perror,double* x, double* y, double* observations, int n_obs,double* x_interp,double* y_interp,int n_interp,Options* options);
    1516void ProcessVariogram(Variogram **pvariogram,Options* options);
    16 void GslSolve(double** pX,double* A,double* B,int n);
    1717
    1818/*threading: */
     
    2121        double       *x_interp;
    2222        double       *y_interp;
    23         double        range;
     23        double        radius;
     24        int           mindata;
     25        int           maxdata;
    2426        Variogram    *variogram;
    2527        Observations *observations;
     
    2729        double       *error;
    2830        double       *percent;
     31        double        power;//for idw
    2932}KrigingxThreadStruct;
    3033
    3134void* Krigingxt(void*);
     35void* NearestNeighbort(void*);
     36void* idwt(void*);
    3237#endif /* _KRIGINGX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/Ll2xyx/Ll2xyx.cpp

    r9761 r12878  
    5252        double  T,rho,sl,tc,mc;
    5353
    54         if((sgn!=1) && (sgn!=-1)) _error_("Sign should be either +1 or -1.\n");
     54        if((sgn!=1) && (sgn!=-1)) _error2_("Sign should be either +1 or -1.\n");
    5555
    5656        delta = central_meridian;
     
    116116                *pdelta= 45;
    117117                *pslat = 70;
    118                 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n");
     118                if(flag) _pprintLine_("Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).");
    119119        }
    120120        else if (sgn == -1) {
    121121                *pdelta= 0;
    122122                *pslat = 71;
    123                 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n");
     123                if(flag) _pprintLine_("Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).");
    124124        }
    125         else _error_("Sign should be either +1 or -1.\n");
     125        else _error2_("Sign should be either +1 or -1.\n");
    126126
    127127        return;
  • issm/branches/trunk-jpl-damage/src/c/modules/MassFluxx/MassFluxx.cpp

    r12168 r12878  
    6767        for(j=0;j<M;j++){
    6868                double* matrix=array[j];
    69                 xfree((void**)&matrix);
     69                xDelete<double>(matrix);
    7070        }
    71         xfree((void**)&mdims_array);
    72         xfree((void**)&ndims_array);
    73         xfree((void**)&array);
     71        xDelete<int>(mdims_array);
     72        xDelete<int>(ndims_array);
     73        xDelete<double*>(array);
    7474       
    7575        /*Assign output pointers: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MassFluxx/MassFluxx.h

    r5475 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MaxAbsVxx/MaxAbsVxx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MaxAbsVyx/MaxAbsVyx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MaxAbsVzx/MaxAbsVzx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MaxVelx/MaxVelx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MaxVxx/MaxVxx.h

    r4974 r12878  
    66
    77#include "../../Container/Container.h"
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MaxVyx/MaxVyx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MaxVzx/MaxVzx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp

    r11684 r12878  
    1717
    1818        /*Display message*/
    19         _printf_(VerboseModule(),"   Merging solution vector from fset to gset\n");
     19        if(VerboseModule()) _pprintLine_("   Merging solution vector from fset to gset");
    2020
    2121        /*first, get gsize, fsize and ssize: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.h

    r11684 r12878  
    66#define _MERGESOLUTIONFROMFTOGX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MeshPartitionx/MeshPartitionx.cpp

    r12168 r12878  
    99#include "../../EnumDefinitions/EnumDefinitions.h"
    1010
    11 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,double* elements,
    12                 int numberofelements2d,int numberofnodes2d,double* elements2d,int numlayers,int elements_width, int dim,int num_procs){
     11int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,IssmDouble* elements,
     12                int numberofelements2d,int numberofnodes2d,IssmDouble* elements2d,int numlayers,int elements_width, int dim,int num_procs){
    1313
    1414        int noerr=1;
     
    3131
    3232        if(dim==2){
    33                 epart=(int*)xmalloc(numberofelements*sizeof(int));
    34                 npart=(int*)xmalloc(numberofnodes*sizeof(int));
    35                 index=(int*)xmalloc(elements_width*numberofelements*sizeof(int));
     33                epart=xNew<int>(numberofelements);
     34                npart=xNew<int>(numberofnodes);
     35                index=xNew<int>(elements_width*numberofelements);
    3636                for (i=0;i<numberofelements;i++){
    3737                        for (j=0;j<elements_width;j++){
    38                                 *(index+elements_width*i+j)=(int)*(elements+elements_width*i+j)-1; //-1 for C indexing in Metis
     38                                *(index+elements_width*i+j)=reCast<int>(*(elements+elements_width*i+j))-1; //-1 for C indexing in Metis
    3939                        }
    4040                }
     
    5151                        for (i=0;i<numberofnodes;i++)    npart[i]=0;
    5252                }
    53                 else _error_("At least one processor is required");
     53                else _error2_("At least one processor is required");
    5454        }
    5555        else{
     
    5757
    5858                /*First build concatenated 2d mesh  from 2d_coll and 2d_noncoll: */
    59                 epart2d=(int*)xmalloc(numberofelements2d*sizeof(int));
    60                 npart2d=(int*)xmalloc(numberofnodes2d*sizeof(int));
    61                 index2d=(int*)xmalloc(3*numberofelements2d*sizeof(int));
     59                epart2d=xNew<int>(numberofelements2d);
     60                npart2d=xNew<int>(numberofnodes2d);
     61                index2d=xNew<int>(3*numberofelements2d);
    6262
    6363                for (i=0;i<numberofelements2d;i++){
    6464                        for (j=0;j<3;j++){
    65                                 *(index2d+3*i+j)=(int)*(elements2d+3*i+j)-1; //-1 for C indexing in Metis
     65                                *(index2d+3*i+j)=reCast<int>(*(elements2d+3*i+j))-1; //-1 for C indexing in Metis
    6666                        }
    6767                }
     
    7878                        for (i=0;i<numberofnodes2d;i++)    npart2d[i]=0;
    7979                }
    80                 else _error_("At least one processor is required");
     80                else _error2_("At least one processor is required");
    8181
    8282                /*Extrude epart2d to epart, using numlayers: */
    83                 epart=(int*)xmalloc(numberofelements*sizeof(int));
     83                epart=xNew<int>(numberofelements);
    8484               
    8585                count=0;
     
    9292
    9393                /*Extrude npart2d to npart, using numlayers: */
    94                 npart=(int*)xmalloc(numberofnodes*sizeof(int));
     94                npart=xNew<int>(numberofnodes);
    9595               
    9696                count=0;
     
    108108
    109109        /*Free ressources: */
    110         xfree((void**)&index);
    111         xfree((void**)&epart2d);
    112         xfree((void**)&npart2d);
    113         xfree((void**)&index2d);
    114 
     110        xDelete<int>(index);
     111        xDelete<int>(epart2d);
     112        xDelete<int>(npart2d);
     113        xDelete<int>(index2d);
    115114        return noerr;
    116 
    117115}
  • issm/branches/trunk-jpl-damage/src/c/modules/MeshPartitionx/MeshPartitionx.h

    r8303 r12878  
    66#define _MESHPARTITIONX_H
    77
     8#include "../../include/include.h"
     9
    810/* local prototypes: */
    9 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,double* elements,
    10                 int numberofelements2d,int numberofnodes2d,double* elements2d,int numlayers,int elements_width, int dim,int numareas);
     11int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,IssmDouble* elements,
     12                int numberofelements2d,int numberofnodes2d,IssmDouble* elements2d,int numlayers,int elements_width, int dim,int numareas);
    1113       
    1214#endif /* _MESHPARTITIONX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/MeshProfileIntersectionx/ElementSegment.cpp

    r8303 r12878  
    3838        if(    (edge1==IntersectEnum) && (edge2==IntersectEnum) && (edge3==IntersectEnum)   ){
    3939                /*This case is impossible: */
    40                 _error_(" error: a line cannot go through 3 different vertices!");
     40                _error2_("error: a line cannot go through 3 different vertices!");
    4141        }
    4242        else if(    ((edge1==IntersectEnum) && (edge2==IntersectEnum)) || ((edge2==IntersectEnum) && (edge3==IntersectEnum)) || ((edge3==IntersectEnum) && (edge1==IntersectEnum))   ){
  • issm/branches/trunk-jpl-damage/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp

    r8303 r12878  
    55
    66void MeshProfileIntersectionx( double** psegments, int* pnumsegs, int* index, double* x, double* y, int nel, int nods,  Contour** contours,int numcontours){
    7 
    87
    98        int i,j,k;
     
    2827
    2928        /*Allocate: */
    30         allsegments=(double**)xmalloc(numcontours*sizeof(double*));
    31         allnumsegs=(int*)xmalloc(numcontours*sizeof(int));
     29        allsegments=xNew<double*>(numcontours);
     30        allnumsegs=xNew<int>(numcontours);
    3231
    3332        /*Loop through all contours: */
     
    5352
    5453        /*Out of all segments, create one common array of segments: */
    55         segments=(double*)xmalloc(5*numsegs*sizeof(double));
     54        segments=xNew<double>(5*numsegs);
    5655        count=0;
    5756        for(i=0;i<numcontours;i++){
  • issm/branches/trunk-jpl-damage/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.h

    r8303 r12878  
    88
    99#include "../../shared/shared.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MeshProfileIntersectionx/MeshSegmentsIntersection.cpp

    r8303 r12878  
    3232        /*Using the segments_dataset dataset, create segments: */
    3333        numsegs=segments_dataset->Size();
    34         segments=(double*)xmalloc(5*numsegs*sizeof(double));
     34        segments=xNew<double>(5*numsegs);
    3535        for(i=0;i<numsegs;i++){
    3636                Segment* segment=(Segment*)segments_dataset->GetObjectByOffset(i);
  • issm/branches/trunk-jpl-damage/src/c/modules/MinVelx/MinVelx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MinVxx/MinVxx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MinVyx/MinVyx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/MinVzx/MinVzx.h

    r4974 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp

    r10522 r12878  
    44#include "../../../toolkits/toolkits.h"
    55#include "../../../EnumDefinitions/EnumDefinitions.h"
    6 #include "../../../objects/objects.h"
     6#include "../../../classes/classes.h"
    77#include "../../../shared/shared.h"
    88#include "../ModelProcessorx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp

    r10522 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../../../include/include.h"
     
    4646
    4747        /*Check in 3d*/
    48         if(stabilization==3 && dim==3) _error_("DG 3d not implemented yet");
     48        if(stabilization==3 && dim==3) _error2_("DG 3d not implemented yet");
    4949
    5050        /*First fetch data: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp

    r11577 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/CreateConstraintsBedSlope.cpp

    r10522 r12878  
    77#include "../../../toolkits/toolkits.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../ModelProcessorx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/CreateLoadsBedSlope.cpp

    r10522 r12878  
    66#include "../../../toolkits/toolkits.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp

    r10522 r12878  
    77#include "../../../toolkits/toolkits.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp

    r9733 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp

    r11577 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../../../include/include.h"
     
    6363                parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps));
    6464
    65                 xfree((void**)&control_type);
    66                 xfree((void**)&cm_responses);
    67                 xfree((void**)&cm_jump);
    68                 xfree((void**)&optscal);
    69                 xfree((void**)&maxiter);
     65                xDelete<int>(control_type);
     66                xDelete<double>(cm_responses);
     67                xDelete<double>(cm_jump);
     68                xDelete<double>(optscal);
     69                xDelete<double>(maxiter);
    7070        }
    7171
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp

    r12872 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateDataSets.cpp

    r9775 r12878  
    99#endif
    1010
    11 #include "../../objects/objects.h"
     11#include "../../classes/objects/objects.h"
    1212#include "../../shared/shared.h"
    1313#include "../../include/include.h"
     
    124124
    125125                default:
    126                         _error_("%s%s%s"," analysis_type: ",EnumToStringx(analysis_type)," not supported yet!");
     126                        _error2_("analysis_type: " << EnumToStringx(analysis_type) << " not supported yet!");
    127127        }
    128128
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp

    r12872 r12878  
    77#include "../../io/io.h"
    88#include "../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010#include "../../shared/shared.h"
    1111#include "../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp

    r11001 r12878  
    2323        int    numberofelements;
    2424        int    numberofvertices;
    25         double* elements=NULL;
     25        IssmDouble* elements=NULL;
    2626
    2727        /*output*/
     
    4343
    4444        /*Allocate ouput*/
    45         connectivity=(int*)xcalloc(numberofvertices,sizeof(int));
     45        connectivity=xNewZeroInit<int>(numberofvertices);
    4646
    4747        /*Get element width (3 or 6)*/
     
    5656        for (i=0;i<numberofelements;i++){
    5757                for (j=0;j<elementswidth;j++){
    58                         vertexid=(int)elements[elementswidth*i+j];
     58                        vertexid=reCast<int>(elements[elementswidth*i+j]);
    5959                        _assert_(vertexid>0 && vertexid-1<numberofvertices);
    6060                        connectivity[vertexid-1]+=1;
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateParameters.cpp

    r12004 r12878  
    1313#include "../../toolkits/toolkits.h"
    1414#include "../../EnumDefinitions/EnumDefinitions.h"
    15 #include "../../objects/objects.h"
     15#include "../../classes/objects/objects.h"
    1616#include "../../shared/shared.h"
    1717#include "../MeshPartitionx/MeshPartitionx.h"
     
    2424        int         numoutputs;
    2525        Parameters *parameters       = NULL;
    26         double     *requestedoutputs = NULL;
    27        
     26        IssmDouble *requestedoutputs = NULL;
     27        bool        isdelta18o;
     28
    2829        if(*pparameters)return; //do not create parameters twice!
    2930
     
    5758        parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum));
    5859        parameters->AddObject(iomodel->CopyConstantObject(SettingsLowmemEnum));
    59         parameters->AddObject(iomodel->CopyConstantObject(DebugPetscProfilingEnum));
     60        parameters->AddObject(iomodel->CopyConstantObject(DebugProfilingEnum));
    6061        parameters->AddObject(iomodel->CopyConstantObject(MeshAverageVertexConnectivityEnum));
    6162        parameters->AddObject(iomodel->CopyConstantObject(ConstantsReferencetemperatureEnum));
     
    8990        parameters->AddObject(iomodel->CopyConstantObject(InversionIscontrolEnum));
    9091        parameters->AddObject(iomodel->CopyConstantObject(InversionTaoEnum));
     92        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIspddEnum));
     93        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
     94        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIssmbgradientsEnum));
     95
     96        iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
     97        if(isdelta18o){
     98                IssmDouble *temp = NULL;
     99                IssmDouble  yts;
     100                int         N,M;
     101
     102                iomodel->Constant(&yts,ConstantsYtsEnum);
     103
     104                iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oEnum); _assert_(N==2);
     105                for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
     106                parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oEnum,&temp[0],&temp[M],M));
     107                xDelete<IssmDouble>(temp);
     108
     109                iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oSurfaceEnum); _assert_(N==2);
     110                for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
     111                parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oSurfaceEnum,&temp[0],&temp[M],M));
     112                xDelete<IssmDouble>(temp);
     113        }
    91114
    92115        /*some parameters that did not come with the iomodel: */
     
    104127        parameters->AddObject(new IntParam(DiagnosticNumRequestedOutputsEnum,numoutputs));
    105128        if(numoutputs)parameters->AddObject(new IntVecParam(DiagnosticRequestedOutputsEnum,requestedoutputs,numoutputs));
    106         xfree((void**)&requestedoutputs);
     129        xDelete<IssmDouble>(requestedoutputs);
    107130        iomodel->FetchData(&requestedoutputs,&numoutputs,NULL,TransientRequestedOutputsEnum);
    108131        parameters->AddObject(new IntParam(TransientNumRequestedOutputsEnum,numoutputs));
    109132        if(numoutputs)parameters->AddObject(new IntVecParam(TransientRequestedOutputsEnum,requestedoutputs,numoutputs));
    110         xfree((void**)&requestedoutputs);
     133        xDelete<IssmDouble>(requestedoutputs);
    111134        iomodel->FetchData(&requestedoutputs,&numoutputs,NULL,SteadystateRequestedOutputsEnum);
    112135        parameters->AddObject(new IntParam(SteadystateNumRequestedOutputsEnum,numoutputs));
    113136        if(numoutputs)parameters->AddObject(new IntVecParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs));
    114         xfree((void**)&requestedoutputs);
     137        xDelete<IssmDouble>(requestedoutputs);
    115138       
    116139        /*Before returning, create parameters in case we are running Qmu or control types runs: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp

    r9733 r12878  
    2323        int    numberofelements;
    2424        int    numberofvertices;
    25         double* elements=NULL;
     25        IssmDouble* elements=NULL;
    2626
    2727        /*output*/
     
    4444
    4545        /*Allocate ouput*/
    46         connectivity=(int*)xcalloc(numberofvertices,sizeof(int));
     46        connectivity=xNewZeroInit<int>(numberofvertices);
    4747
    4848        /*Get element width (3 or 6)*/
     
    5959                if(iomodel->my_elements[i]){
    6060                        for (j=0;j<elementswidth;j++){
    61                                 vertexid=(int)elements[elementswidth*i+j];
     61                                vertexid=reCast<int>(elements[elementswidth*i+j]);
    6262                                _assert_(vertexid>0 && vertexid-1<numberofvertices);
    6363                                connectivity[vertexid-1]=i+1;
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp

    r10660 r12878  
    66#include "../../../toolkits/toolkits.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../io/io.h"
     
    1515void CreateParametersDakota(Parameters** pparameters,IoModel* iomodel,int solution_type,int analysis_type){
    1616
    17         /*variable declarations: {{{1*/
     17        /*variable declarations: {{{*/
    1818        int i,j,k;
    1919       
     
    7373                iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum);
    7474
    75                 /*name of qmu input, error and output files:{{{1*/
    76                 qmuinname=(char*)xmalloc((strlen(name)+strlen(".qmu.in")+1)*sizeof(char));
     75                /*name of qmu input, error and output files:{{{*/
     76                qmuinname=xNew<char>((strlen(name)+strlen(".qmu.in")+1));
    7777                sprintf(qmuinname,"%s%s",name,".qmu.in");
    7878                parameters->AddObject(new   StringParam(QmuInNameEnum,qmuinname));
    7979
    80                 qmuoutname=(char*)xmalloc((strlen(name)+strlen(".qmu.out")+1)*sizeof(char));
     80                qmuoutname=xNew<char>((strlen(name)+strlen(".qmu.out")+1));
    8181                sprintf(qmuoutname,"%s%s",name,".qmu.out");
    8282                parameters->AddObject(new   StringParam(QmuOutNameEnum,qmuoutname));
    8383
    84                 qmuerrname=(char*)xmalloc((strlen(name)+strlen(".qmu.err")+1)*sizeof(char));
     84                qmuerrname=xNew<char>((strlen(name)+strlen(".qmu.err")+1));
    8585                sprintf(qmuerrname,"%s%s",name,".qmu.err");
    8686                parameters->AddObject(new   StringParam(QmuErrNameEnum,qmuerrname));
    8787                /*}}}*/
    88                 /*Fetch variable descriptors: {{{1*/
     88                /*Fetch variable descriptors: {{{*/
    8989                iomodel->FetchData(&variabledescriptors,&numvariabledescriptors,QmuVariabledescriptorsEnum);
    9090
     
    9393
    9494                /*}}}*/
    95                 /*Fetch response descriptors: {{{1*/
     95                /*Fetch response descriptors: {{{*/
    9696                iomodel->FetchData(&responsedescriptors,&numresponsedescriptors,QmuResponsedescriptorsEnum);
    9797
     
    100100                parameters->AddObject(new    IntParam(QmuNumberofresponsesEnum,numberofresponses));
    101101                /*}}}*/
    102                 /*Deal with partitioning: {{{1*/
     102                /*Deal with partitioning: {{{*/
    103103                /*partition vertices in iomodel->qmu_npart parts, unless a partition is already present: */
    104104               
     
    111111                        ElementsAndVerticesPartitioning(&iomodel->my_elements,&iomodel->my_vertices,iomodel);
    112112
    113                         dpart=(double*)xmalloc(numberofvertices*sizeof(double));
     113                        dpart=xNew<double>(numberofvertices);
    114114                        for(i=0;i<numberofvertices;i++)dpart[i]=iomodel->my_vertices[i];
    115115                }
    116116                parameters->AddObject(new DoubleVecParam(QmuPartitionEnum,dpart,numberofvertices));
    117117                /*}}}*/
    118                 /*Deal with data needed because of qmu variables: {{{1*/
     118                /*Deal with data needed because of qmu variables: {{{*/
    119119               
    120120                for(i=0;i<numvariabledescriptors;i++){
     
    136136                               
    137137                                /*Free ressources:*/
    138                                 xfree((void**)&dakota_parameter);
    139                         }
    140                 }
    141                 /*}}}*/
    142                 /*Deal with data needed to compute qmu responses: {{{1*/
     138                                xDelete<double>(dakota_parameter);
     139                        }
     140                }
     141                /*}}}*/
     142                /*Deal with data needed to compute qmu responses: {{{*/
    143143                for(i=0;i<numresponsedescriptors;i++){
    144144                       
     
    153153                        /*Fetch the mass flux segments necessary to compute the mass fluxes.  Build a DoubleMatArrayParam object out of them: */
    154154                        iomodel->FetchData(&array,&mdims_array,&ndims_array,&qmu_mass_flux_num_profiles,QmuMassFluxSegmentsEnum);
    155                         if(qmu_mass_flux_num_profiles==0)_error_(" qmu_mass_flux_num_profiles is 0, when MassFlux computations were requested!");
     155                        if(qmu_mass_flux_num_profiles==0)_error2_("qmu_mass_flux_num_profiles is 0, when MassFlux computations were requested!");
    156156
    157157                        /*Go through segments, and extract those that belong to this cpu: */
     
    166166                                }
    167167                                if(m){
    168                                         matrix=(double*)xcalloc(5*m,sizeof(double));
     168                                        matrix=xNewZeroInit<double>(5*m);
    169169                                        count=0;
    170170                                        for(j=0;j<temp_m;j++){
     
    185185
    186186                                /*Free temporary matrix: */
    187                                 xfree((void**)&temp_matrix);
     187                                xDelete<double>(temp_matrix);
    188188                        }
    189189
     
    194194                        for(i=0;i<qmu_mass_flux_num_profiles;i++){
    195195                                double* matrix=array[i];
    196                                 xfree((void**)&matrix);
    197                         }
    198                         xfree((void**)&mdims_array);
    199                         xfree((void**)&ndims_array);
    200                         xfree((void**)&array);
    201                 }
    202                 /*}}}*/
    203                 /*Free data: {{{1*/
     196                                xDelete<double>(matrix);
     197                        }
     198                        xDelete<int>(mdims_array);
     199                        xDelete<int>(ndims_array);
     200                        xDelete<double*>(array);
     201                }
     202                /*}}}*/
     203                /*Free data: {{{*/
    204204                for(i=0;i<numresponsedescriptors;i++){
    205205                        descriptor=responsedescriptors[i];
    206                         xfree((void**)&descriptor);
    207                 }
    208                 xfree((void**)&responsedescriptors);
     206                        xDelete<char>(descriptor);
     207                }
     208                xDelete<char*>(responsedescriptors);
    209209
    210210                for(i=0;i<numvariabledescriptors;i++){
    211211                        descriptor=variabledescriptors[i];
    212                         xfree((void**)&descriptor);
    213                 }
    214                 xfree((void**)&variabledescriptors);
    215                 xfree((void**)&part);
    216                 xfree((void**)&dpart);
    217                 xfree((void**)&qmuinname);
    218                 xfree((void**)&qmuerrname);
    219                 xfree((void**)&qmuoutname);
     212                        xDelete<char>(descriptor);
     213                }
     214                xDelete<char*>(variabledescriptors);
     215                xDelete<int>(part);
     216                xDelete<double>(dpart);
     217                xDelete<char>(qmuinname);
     218                xDelete<char>(qmuerrname);
     219                xDelete<char>(qmuoutname);
    220220                /*}}}*/
    221221        } //if(dakota_analysis)
    222222
    223223        /*Free data*/
    224         xfree((void**)&name);
     224        xDelete<char>(name);
    225225
    226226        /*Assign output pointer: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp

    r10544 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../ModelProcessorx.h"
     
    8787
    8888        /*figure out times: */
    89         timesx=(double*)xmalloc(Nx*sizeof(double));
     89        timesx=xNew<double>(Nx);
    9090        for(j=0;j<Nx;j++){
    9191                timesx[j]=spcvx[(Mx-1)*Nx+j];
     
    9494        UnitConversion(timesx,Nx,ExtToIuEnum,TimeEnum);
    9595        /*figure out times: */
    96         timesy=(double*)xmalloc(Ny*sizeof(double));
     96        timesy=xNew<double>(Ny);
    9797        for(j=0;j<Ny;j++){
    9898                timesy[j]=spcvy[(My-1)*Ny+j];
     
    101101        UnitConversion(timesy,Ny,ExtToIuEnum,TimeEnum);
    102102        /*figure out times: */
    103         timesz=(double*)xmalloc(Nz*sizeof(double));
     103        timesz=xNew<double>(Nz);
    104104        for(j=0;j<Nz;j++){
    105105                timesz[j]=spcvz[(Mz-1)*Nz+j];
     
    107107        /*unit conversion: */
    108108        UnitConversion(timesz,Nz,ExtToIuEnum,TimeEnum);
    109 
    110109
    111110        /*Create spcs from x,y,z, as well as the spc values on those spcs: */
     
    121120                                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    122121                                                count++;
    123                                                 if (!isnan(spcvx[i])){
     122                                                if (!xIsNan<IssmDouble>(spcvx[i])){
    124123                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    125124                                                        count++;
    126125                                                }
    127                                                 if (!isnan(spcvy[i])){
     126                                                if (!xIsNan<IssmDouble>(spcvy[i])){
    128127                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    129128                                                        count++;
     
    136135                                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    137136                                                count++;
    138                                                 if (!isnan(spcvx[i])){
     137                                                if (!xIsNan<IssmDouble>(spcvx[i])){
    139138                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    140139                                                        count++;
    141140                                                }
    142                                                 if (!isnan(spcvy[i])){
     141                                                if (!xIsNan<IssmDouble>(spcvy[i])){
    143142                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    144143                                                        count++;
     
    146145
    147146                                        }
    148                                         else _error_("if vertices_type is MacAyealPattyn, you shoud have nodeonpattyn or nodeonmacayeal");
     147                                        else _error2_("if vertices_type is MacAyealPattyn, you shoud have nodeonpattyn or nodeonmacayeal");
    149148                        }
    150149                        /*Also add spcs of coupling: zero at the border pattyn/stokes for the appropriate dofs*/
     
    158157                                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    159158                                                count++;
    160                                                 if (!isnan(spcvx[i])){
     159                                                if (!xIsNan<IssmDouble>(spcvx[i])){
    161160                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    162161                                                        count++;
    163162                                                }
    164                                                 if (!isnan(spcvy[i])){
     163                                                if (!xIsNan<IssmDouble>(spcvy[i])){
    165164                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    166165                                                        count++;
     
    173172                                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    174173                                                count++;
    175                                                 if (!isnan(spcvx[i])){
     174                                                if (!xIsNan<IssmDouble>(spcvx[i])){
    176175                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    177176                                                        count++;
    178177                                                }
    179                                                 if (!isnan(spcvy[i])){
     178                                                if (!xIsNan<IssmDouble>(spcvy[i])){
    180179                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    181180                                                        count++;
    182181                                                }
    183                                                 if (!isnan(spcvz[i])){
     182                                                if (!xIsNan<IssmDouble>(spcvz[i])){
    184183                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    185184                                                        count++;
    186185                                                }
    187186                                        }
    188                                         else _error_("if vertices_type is PattynStokes, you shoud have nodeonpattyn or nodeonstokes");
     187                                        else _error2_("if vertices_type is PattynStokes, you shoud have nodeonpattyn or nodeonstokes");
    189188                        }
    190189                        /*Also add spcs of coupling: zero at the border pattyn/stokes for the appropriate dofs*/
     
    198197                                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    199198                                                count++;
    200                                                 if (!isnan(spcvx[i])){
     199                                                if (!xIsNan<IssmDouble>(spcvx[i])){
    201200                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    202201                                                        count++;
    203202                                                }
    204                                                 if (!isnan(spcvy[i])){
     203                                                if (!xIsNan<IssmDouble>(spcvy[i])){
    205204                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    206205                                                        count++;
     
    213212                                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    214213                                                count++;
    215                                                 if (!isnan(spcvx[i])){
     214                                                if (!xIsNan<IssmDouble>(spcvx[i])){
    216215                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    217216                                                        count++;
    218217                                                }
    219                                                 if (!isnan(spcvy[i])){
     218                                                if (!xIsNan<IssmDouble>(spcvy[i])){
    220219                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    221220                                                        count++;
    222221                                                }
    223                                                 if (!isnan(spcvz[i])){
     222                                                if (!xIsNan<IssmDouble>(spcvz[i])){
    224223                                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    225224                                                        count++;
    226225                                                }
    227226                                        }
    228                                         else _error_("if vertices_type is MacAyealStokes, you shoud have nodeonmacayeal or nodeonstokes");
     227                                        else _error2_("if vertices_type is MacAyealStokes, you shoud have nodeonmacayeal or nodeonstokes");
    229228                        }
    230229                        /*Now add the regular spcs*/
    231230                        else{
    232                                 if (Mx==numberofvertices && !isnan(spcvx[i])){
     231                                if (Mx==numberofvertices && !xIsNan<IssmDouble>(spcvx[i])){
    233232                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    234233                                        count++;
     
    236235                                else if (Mx==numberofvertices+1) {
    237236                                        /*figure out times and values: */
    238                                         values=(double*)xmalloc(Nx*sizeof(double));
     237                                        values=xNew<double>(Nx);
    239238                                        spcpresent=false;
    240239                                        for(j=0;j<Nx;j++){
    241240                                                values[j]=spcvx[i*Nx+j]/yts;
    242                                                 if(!isnan(values[j]))spcpresent=true; //NaN means no spc by default
     241                                                if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default
    243242                                        }
    244243
     
    247246                                                count++;
    248247                                        }
    249                                         xfree((void**)&values);
     248                                        xDelete<double>(values);
    250249                                }
    251250                                else if (vertices_type[i]==HutterApproximationEnum){
     
    254253                                }
    255254
    256                                 if (My==numberofvertices && !isnan(spcvy[i])){
     255                                if (My==numberofvertices && !xIsNan<IssmDouble>(spcvy[i])){
    257256                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy.
    258257                                        count++;
     
    260259                                else if (My==numberofvertices+1){
    261260                                        /*figure out times and values: */
    262                                         values=(double*)xmalloc(Ny*sizeof(double));
     261                                        values=xNew<double>(Ny);
    263262                                        spcpresent=false;
    264263                                        for(j=0;j<Ny;j++){
    265264                                                values[j]=spcvy[i*Ny+j]/yts;
    266                                                 if(!isnan(values[j]))spcpresent=true; //NaN means no spc by default
     265                                                if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default
    267266                                        }
    268267                                        if(spcpresent){
     
    270269                                                count++;
    271270                                        }
    272                                         xfree((void**)&values);
     271                                        xDelete<double>(values);
    273272                                }
    274273                                else if (vertices_type[i]==HutterApproximationEnum){
     
    278277
    279278                                if ((int)vertices_type[i]==StokesApproximationEnum ||  ((int)vertices_type[i]==NoneApproximationEnum)){
    280                                         if (Mz==numberofvertices && !isnan(spcvz[i])){
     279                                        if (Mz==numberofvertices && !xIsNan<IssmDouble>(spcvz[i])){
    281280                                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
    282281                                                count++;
     
    284283                                        else if (Mz==numberofvertices+1){
    285284                                                /*figure out times and values: */
    286                                                 values=(double*)xmalloc(Nz*sizeof(double));
     285                                                values=xNew<double>(Nz);
    287286                                                spcpresent=false;
    288287                                                for(j=0;j<Nz;j++){
    289288                                                        values[j]=spcvz[i*Nz+j]/yts;
    290                                                         if(!isnan(values[j]))spcpresent=true; //NaN means no spc by default
     289                                                        if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default
    291290                                                }
    292291                                                if(spcpresent){
     
    294293                                                        count++;
    295294                                                }
    296                                                 xfree((void**)&values);
     295                                                xDelete<double>(values);
    297296                                        }
    298297
     
    319318                                                count++;
    320319                                                break;
    321                                         default: _error_("Vertex approximation %s not supported",EnumToStringx((int)vertices_type[i]));
     320                                        default: _error2_("Vertex approximation " << EnumToStringx((int)vertices_type[i]) << " not supported");
    322321                                }
    323322                        }
     
    326325         
    327326        /*Free data: */
    328         xfree((void**)&spcvx);
    329         xfree((void**)&spcvy);
    330         xfree((void**)&spcvz);
    331         xfree((void**)&nodeonmacayeal);
    332         xfree((void**)&nodeonpattyn);
    333         xfree((void**)&nodeonstokes);
    334         xfree((void**)&nodeonicesheet);
    335         xfree((void**)&nodeonbed);
    336         xfree((void**)&vertices_type);
    337         xfree((void**)&surface);
    338         xfree((void**)&z);
     327        xDelete<double>(spcvx);
     328        xDelete<double>(spcvy);
     329        xDelete<double>(spcvz);
     330        xDelete<double>(nodeonmacayeal);
     331        xDelete<double>(nodeonpattyn);
     332        xDelete<double>(nodeonstokes);
     333        xDelete<double>(nodeonicesheet);
     334        xDelete<double>(nodeonbed);
     335        xDelete<double>(vertices_type);
     336        xDelete<double>(surface);
     337        xDelete<double>(z);
    339338
    340339        /*Free resources:*/
    341         xfree((void**)&timesx);
    342         xfree((void**)&timesy);
    343         xfree((void**)&timesz);
    344         xfree((void**)&values);
     340        xDelete<double>(timesx);
     341        xDelete<double>(timesy);
     342        xDelete<double>(timesz);
     343        xDelete<double>(values);
    345344
    346345        /*Assign output pointer: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
     
    120120        /*Free data: */
    121121        iomodel->DeleteData(3,DiagnosticIcefrontEnum,ThicknessEnum,BedEnum);
    122         xfree((void**)&elements_type);
    123         xfree((void**)&pressureload);
     122        xDelete<double>(elements_type);
     123        xDelete<double>(pressureload);
    124124
    125125        /*Create Penpair for penalties: */
     
    144144
    145145        /*free ressources: */
    146         xfree((void**)&penalties);
     146        xDelete<double>(penalties);
    147147
    148148        /*Create Riffront loads for rifts: */
     
    157157                }
    158158                iomodel->DeleteData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskVertexonfloatingiceEnum);
    159                 xfree((void**)&riftfront);
     159                xDelete<Riftfront>(riftfront);
    160160        }
    161161
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp

    r10522 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp

    r11577 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp

    r10522 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../ModelProcessorx.h"
     
    6060                        }
    6161                        else{
    62                                 if (!isnan(iomodel->Data(DiagnosticSpcvxEnum)[i])){
     62                                if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvxEnum)[i])){
    6363                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->Data(DiagnosticSpcvxEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
    6464                                        count++;
    6565                                }
    6666
    67                                 if (!isnan(iomodel->Data(DiagnosticSpcvyEnum)[i])){
     67                                if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvyEnum)[i])){
    6868                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->Data(DiagnosticSpcvyEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
    6969                                        count++;
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp

    r11001 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp

    r9733 r12878  
    88#include "../../../modules/modules.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp

    r11197 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../ModelProcessorx.h"
     
    5656                                count++;
    5757                        }
    58                         else if (!isnan(iomodel->Data(DiagnosticSpcvzEnum)[i])){
     58                        else if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvzEnum)[i])){
    5959                                constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,
    6060                                                                iomodel->Data(DiagnosticSpcvzEnum)[i]/yts,DiagnosticVertAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp

    r10522 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp

    r11577 r12878  
    88#include "../../../modules/modules.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DistributeNumDofs.cpp

    r9218 r12878  
    77#include "../../EnumDefinitions/EnumDefinitions.h"
    88       
    9 void DistributeNumDofs(DofIndexing* index,int analysis_type,double* vertices_type){
     9void DistributeNumDofs(DofIndexing* index,int analysis_type,IssmDouble* vertices_type){
    1010
    1111        /*For now, we distribute by analysis_type, later, we will distribute using the analysis_type,
     
    3535                else if (vertices_type[0]==MacAyealPattynApproximationEnum){
    3636                        numdofs=4;
    37                         doftype=(int*)xmalloc(numdofs*sizeof(int));
     37                        doftype=xNew<int>(numdofs);
    3838                        doftype[0]=MacAyealApproximationEnum;
    3939                        doftype[1]=MacAyealApproximationEnum;
     
    4343                else if (vertices_type[0]==PattynStokesApproximationEnum){
    4444                        numdofs=6;
    45                         doftype=(int*)xmalloc(numdofs*sizeof(int));
     45                        doftype=xNew<int>(numdofs);
    4646                        doftype[0]=PattynApproximationEnum;
    4747                        doftype[1]=PattynApproximationEnum;
     
    5353                else if (vertices_type[0]==MacAyealStokesApproximationEnum){
    5454                        numdofs=6;
    55                         doftype=(int*)xmalloc(numdofs*sizeof(int));
     55                        doftype=xNew<int>(numdofs);
    5656                        doftype[0]=MacAyealApproximationEnum;
    5757                        doftype[1]=MacAyealApproximationEnum;
     
    6161                        doftype[5]=StokesApproximationEnum;
    6262                }
    63                 else _error_("Approximationtype %i (%s) not implemented yet for DiagnosticHoriz",(int)*vertices_type,EnumToStringx((int)*vertices_type));
     63                else _error2_("Approximationtype " << reCast<int>(*vertices_type) << " (" << EnumToStringx(reCast<int>(*vertices_type)) << ") not implemented yet for DiagnosticHoriz");
    6464        }
    6565        else if (analysis_type==DiagnosticVertAnalysisEnum){
     
    9090                numdofs=1;
    9191        }
    92         else _error_("analysis type: %i (%s) not implemented yet",analysis_type,EnumToStringx(analysis_type));
     92        else _error2_("analysis type: " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not implemented yet");
    9393
    9494        /*Now initialize the index*/
     
    9696
    9797        /*Clean up*/
    98          xfree((void**)&doftype);
     98         xDelete<int>(doftype);
    9999}
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r12168 r12878  
    1010
    1111#include <string.h>
    12 #include "../../objects/objects.h"
     12#include "../../classes/objects/objects.h"
    1313#include "../../shared/shared.h"
    1414#include "../../EnumDefinitions/EnumDefinitions.h"
     
    4242        int  el1,el2;
    4343        int    dim;
    44         double* elements=NULL;
    45         double* elements2d=NULL;
    46         double* riftinfo=NULL;
    47         double* vertex_pairing=NULL;
     44        IssmDouble* elements=NULL;
     45        IssmDouble* elements2d=NULL;
     46        IssmDouble* riftinfo=NULL;
     47        IssmDouble* vertex_pairing=NULL;
    4848
    4949        /*Fetch parameters: */
     
    7676
    7777        /*Free elements and elements2d: */
    78         xfree((void**)&elements);
    79         xfree((void**)&elements2d);
     78        xDelete<IssmDouble>(elements);
     79        xDelete<IssmDouble>(elements2d);
    8080
    8181        /*Deal with rifts, they have to be included into one partition only, not several: */
     
    8383                iomodel->FetchData(&riftinfo,&numrifts,NULL,RiftsRiftstructEnum);
    8484                for(i=0;i<numrifts;i++){
    85                         el1=(int)*(riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing
    86                         el2=(int)*(riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing
     85                        el1=reCast<int>(*(riftinfo+RIFTINFOSIZE*i+2))-1; //matlab indexing to c indexing
     86                        el2=reCast<int>(*(riftinfo+RIFTINFOSIZE*i+3))-1; //matlab indexing to c indexing
    8787                        epart[el2]=epart[el1]; //ensures that this pair of elements will be in the same partition, as well as the corresponding vertices;
    8888                }
    89                 xfree((void**)&riftinfo);
     89                xDelete<IssmDouble>(riftinfo);
    9090        }
    9191
    9292        /*Used later on: */
    93         my_vertices=(int*)xcalloc(numberofvertices,sizeof(int));
    94         my_elements=(bool*)xcalloc(numberofelements,sizeof(bool));
     93        my_vertices=xNewZeroInit<int>(numberofvertices);
     94        my_elements=xNewZeroInit<bool>(numberofelements);
    9595
    9696        /*Start figuring out, out of the partition, which elements belong to this cpu: */
     
    107107                         into the vertices coordinates. If we start plugging 1 into my_vertices for each index[n][i] (i=0:2), then my_vertices
    108108                         will hold which vertices belong to this partition*/
    109                         my_vertices[(int)*(elements+elements_width*i+0)-1]=1;
    110                         my_vertices[(int)*(elements+elements_width*i+1)-1]=1;
    111                         my_vertices[(int)*(elements+elements_width*i+2)-1]=1;
     109                        my_vertices[reCast<int>(*(elements+elements_width*i+0))-1]=1;
     110                        my_vertices[reCast<int>(*(elements+elements_width*i+1))-1]=1;
     111                        my_vertices[reCast<int>(*(elements+elements_width*i+2))-1]=1;
    112112                       
    113113                        if(elements_width==6){
    114                                 my_vertices[(int)*(elements+elements_width*i+3)-1]=1;
    115                                 my_vertices[(int)*(elements+elements_width*i+4)-1]=1;
    116                                 my_vertices[(int)*(elements+elements_width*i+5)-1]=1;
     114                                my_vertices[reCast<int>(*(elements+elements_width*i+3))-1]=1;
     115                                my_vertices[reCast<int>(*(elements+elements_width*i+4))-1]=1;
     116                                my_vertices[reCast<int>(*(elements+elements_width*i+5))-1]=1;
    117117                        }
    118118                }
    119119        }//for (i=0;i<numberofelements;i++)
    120120        /*Free data : */
    121         xfree((void**)&elements);
     121        xDelete<IssmDouble>(elements);
    122122
    123123        /*We might have vertex_pairing in which case, some vertices have to be cloned:
     
    126126        iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,DiagnosticVertexPairingEnum);
    127127        for(i=0;i<numvertex_pairing;i++){
    128                 if(my_vertices[(int)vertex_pairing[2*i+0]-1] && !my_vertices[(int)vertex_pairing[2*i+1]-1]){
    129                         my_vertices[(int)vertex_pairing[2*i+1]-1]=2; //to know that these elements are not on the partition
     128                if(my_vertices[reCast<int>(vertex_pairing[2*i+0])-1] && !my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]){
     129                        my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]=2; //to know that these elements are not on the partition
    130130                }
    131131        }
    132         xfree((void**)&vertex_pairing);
     132        xDelete<IssmDouble>(vertex_pairing);
    133133        iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,PrognosticVertexPairingEnum);
    134134        for(i=0;i<numvertex_pairing;i++){
    135                 if(my_vertices[(int)vertex_pairing[2*i+0]-1] && !my_vertices[(int)vertex_pairing[2*i+1]-1]){
    136                         my_vertices[(int)vertex_pairing[2*i+1]-1]=2; //to know that these elements are not on the partition
     135                if(my_vertices[reCast<int>(vertex_pairing[2*i+0])-1] && !my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]){
     136                        my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]=2; //to know that these elements are not on the partition
    137137                }
    138138        }
    139         xfree((void**)&vertex_pairing);
     139        xDelete<IssmDouble>(vertex_pairing);
    140140
    141141        /*Free ressources:*/
    142         xfree((void**)&npart);
    143         xfree((void**)&epart);
     142        xDelete<int>(npart);
     143        xDelete<int>(epart);
    144144
    145145        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp

    r11270 r12878  
    77#include "../../../toolkits/toolkits.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
     11#include "../../../include/include.h"
    1112#include "../ModelProcessorx.h"
    1213
     
    1415
    1516        /*Intermediary*/
    16         int i;
    17         int count;
     17        int    i,j;
     18        int    count;
    1819        int    dim;
     20        int    M,N;
    1921        int    numberofvertices;
     22        bool   spcpresent=false;
    2023        double heatcapacity;
    2124        double referencetemperature;
    2225       
    2326        /*Output*/
     27        IssmDouble *spcvector  = NULL;
     28        IssmDouble* times=NULL;
     29        IssmDouble* values=NULL;
    2430        Constraints* constraints = NULL;
    25         SpcStatic*    spcstatic  = NULL;
    2631
    2732        /*Fetch parameters: */
     
    4449
    4550        /*Fetch data: */
    46         double *spctemperature=NULL;
    47         iomodel->FetchData(&spctemperature,NULL,NULL,ThermalSpctemperatureEnum);
     51        iomodel->FetchData(&spcvector,&M,&N,ThermalSpctemperatureEnum);
    4852
    49         /*Initialize counter*/
    50         count=0;
     53        //FIX ME: SHOULD USE IOMODELCREATECONSTRAINTS
     54        /*Transient or static?:*/
     55        if(M==numberofvertices){
     56                /*static: just create Constraints objects*/
     57                count=0;
    5158
    52         /*Create constraints from x,y,z: */
    53         for (i=0;i<numberofvertices;i++){
    54                 /*keep only this partition's nodes:*/
    55                 if((iomodel->my_vertices[i])){
     59                for (i=0;i<numberofvertices;i++){
     60                        /*keep only this partition's nodes:*/
     61                        if((iomodel->my_vertices[i])){
    5662
    57                         if (!isnan(spctemperature[i])){
     63                                if (!xIsNan<IssmDouble>(spcvector[i])){
    5864
    59                                 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,heatcapacity*(spctemperature[i]-referencetemperature),EnthalpyAnalysisEnum));
    60                                 count++;
     65                                        constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,heatcapacity*(spcvector[i]-referencetemperature),EnthalpyAnalysisEnum));
     66                                        count++;
    6167
     68                                }
    6269                        }
    6370                }
    6471        }
     72        else if (M==(numberofvertices+1)){
     73                /*transient: create transient SpcTransient objects. Same logic, except we need to retrieve
     74                 * various times and values to initialize an SpcTransient object: */
     75                count=0;
    6576
    66         /*Free data: */
    67         xfree((void**)&spctemperature);
    68        
     77                /*figure out times: */
     78                times=xNew<IssmDouble>(N);
     79                for(j=0;j<N;j++){
     80                        times[j]=spcvector[(M-1)*N+j];
     81                }
     82                /*unit conversion: */
     83                UnitConversion(times,N,ExtToIuEnum,TimeEnum);
     84
     85                /*Create constraints from x,y,z: */
     86                for (i=0;i<numberofvertices;i++){
     87                       
     88                        /*keep only this partition's nodes:*/
     89                        if((iomodel->my_vertices[i])){
     90
     91                                /*figure out times and values: */
     92                                values=xNew<IssmDouble>(N);
     93                                spcpresent=false;
     94                                for(j=0;j<N;j++){
     95                                        values[j]=heatcapacity*(spcvector[i*N+j]-referencetemperature);
     96                                        if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default
     97                                }
     98
     99                                if(spcpresent){
     100                                        constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,N,times,values,EnthalpyAnalysisEnum));
     101                                        count++;
     102                                }
     103                                xDelete<IssmDouble>(values);
     104                        }
     105                }
     106        }
     107        else{
     108                _error2_("Size of field " << EnumToStringx(ThermalSpctemperatureEnum) << " not supported");
     109        }
     110
     111        /*Free ressources:*/
     112        xDelete<IssmDouble>(spcvector);
     113        xDelete<IssmDouble>(times);
     114        xDelete<IssmDouble>(values);
     115
    69116        /*Assign output pointer: */
    70117        *pconstraints=constraints;
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/CreateLoadsEnthalpy.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/CreateNodesEnthalpy.cpp

    r10522 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../include/include.h"
    1111#include "../../../shared/shared.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp

    r11261 r12878  
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    99#include "../../../modules/modules.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/CreateConstraintsHydrology.cpp

    r10522 r12878  
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    99#include "../../../io/io.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../ModelProcessorx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/CreateLoadsHydrology.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp

    r10522 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../include/include.h"
    1111#include "../../../shared/shared.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp

    r9733 r12878  
    88#include "../../../modules/modules.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/CreateConstraintsMelting.cpp

    r10522 r12878  
    77#include "../../../toolkits/toolkits.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../ModelProcessorx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
     
    2626
    2727        /*if 2d: Error*/
    28         if (dim==2) _error_("2d meshes not supported yet");
     28        if (dim==2) _error2_("2d meshes not supported yet");
    2929
    3030        /*Recover pointer: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/CreateNodesMelting.cpp

    r10522 r12878  
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    99#include "../../../include/include.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp

    r11577 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/ModelProcessorx.cpp

    r11684 r12878  
    99#endif
    1010
    11 #include "../../objects/objects.h"
     11#include "../../classes/objects/objects.h"
    1212#include "../../shared/shared.h"
    1313#include "../../io/io.h"
     
    6868                if(solution_type==SteadystateSolutionEnum && analysis_type==EnthalpyAnalysisEnum && isenthalpy==false) continue;
    6969       
    70                 _printf_(VerboseMProcessor(),"   creating datasets for analysis %s\n",EnumToStringx(analysis_type));
     70                if(VerboseMProcessor()) _pprintLine_("   creating datasets for analysis " << EnumToStringx(analysis_type));
    7171                CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,solution_type,analysis_type,nummodels,i);
    7272        }
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/ModelProcessorx.h

    r10576 r12878  
    108108
    109109/*Distribution of dofs: */
    110 void DistributeNumDofs(DofIndexing* index,int analysis_type,double* vertices_type);
     110void DistributeNumDofs(DofIndexing* index,int analysis_type,IssmDouble* vertices_type);
    111111
    112112#endif
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/NodesPartitioning.cpp

    r9733 r12878  
    1010
    1111#include <string.h>
    12 #include "../../objects/objects.h"
     12#include "../../classes/objects/objects.h"
    1313#include "../../shared/shared.h"
    1414#include "../../EnumDefinitions/EnumDefinitions.h"
     
    2424       
    2525        /*First thing, this is a new partition for a new analysis_type, therefore, to avoid a leak, erase the nodes partition that might come through pmy_nodes: */
    26         xfree((void**)pmy_nodes);
     26        xDelete<bool>(*pmy_nodes);
    2727
    2828        /*Now, depending on whether we are running galerkin discontinous or continuous elements, carry out a different partition of the nodes: */
     
    4444        iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum);
    4545
    46         my_nodes=(bool*)xmalloc(numberofvertices*sizeof(bool));
    47         memcpy(my_nodes,my_vertices,numberofvertices*sizeof(bool));
     46        my_nodes=xNew<bool>(numberofvertices);
     47        for(int i=0;i<numberofvertices;i++) my_nodes[i]=(bool)my_vertices[i];
    4848
    4949        /*Assign output pointers:*/
     
    6969        bool*   my_nodes=NULL;
    7070
    71         int     i1,i2;
    72         int     cols;
    73         double  e1,e2;
    74         int     pos;
    75         int     numberofedges;
    76         double* edges=NULL;
    77         double* elements=NULL;
     71        int  i1,i2;
     72        int  cols;
     73        int  e1,e2;
     74        int  pos;
     75        int  numberofedges;
     76        int *edges         = NULL;
     77        int *elements      = NULL;
    7878
    7979        /*Fetch parameters: */
     
    9090
    9191        /*Allocate*/
    92         my_nodes=(bool*)xcalloc(3*numberofelements,sizeof(int));
     92        my_nodes=xNewZeroInit<bool>(3*numberofelements);
    9393
    9494        /*First: add all the nodes of all the elements belonging to this cpu*/
     
    9696                for (i=0;i<numberofelements;i++){
    9797                        if (my_elements[i]){
    98                                 my_nodes[3*i+0]=1;
    99                                 my_nodes[3*i+1]=1;
    100                                 my_nodes[3*i+2]=1;
     98                                my_nodes[3*i+0]=true;
     99                                my_nodes[3*i+1]=true;
     100                                my_nodes[3*i+2]=true;
    101101                        }
    102102                }
    103103        }
    104104        else{
    105                 _error_("not implemented yet");
     105                _error2_("not implemented yet");
    106106        }
    107107
     
    111111        iomodel->FetchData(&edges,&numberofedges,&cols,MeshEdgesEnum);
    112112        iomodel->FetchData(&elements,NULL,NULL,MeshElementsEnum);
    113         if (cols!=4) _error_("field edges should have 4 columns");
     113        if (cols!=4) _error2_("field edges should have 4 columns");
    114114
    115115        /*!All elements have been partitioned above, only create elements for this CPU: */
     
    125125                 * we must clone the nodes on this partition so that the loads (Numericalflux)
    126126                 * will have access to their properties (dofs,...)*/
    127                 if(my_elements[(int)e1] && !isnan(e2) && !my_elements[(int)e2]){
     127                if(my_elements[e1] && e2!=-2 && !my_elements[e2]){
    128128
    129129                        /*1: Get vertices ids*/
    130                         i1=(int)edges[4*i+0];
    131                         i2=(int)edges[4*i+1];
     130                        i1=edges[4*i+0];
     131                        i2=edges[4*i+1];
    132132
    133133                        /*2: Get the column where these ids are located in the index*/
    134134                        pos=UNDEF;
    135135                        for(j=0;j<3;j++){
    136                                 if ((int)elements[3*(int)e2+j]==i1) pos=j;
     136                                if (elements[3*e2+j]==i1) pos=j;
    137137                        }
    138138
     
    140140                         * we can now create the corresponding nodes:*/
    141141                        if (pos==0){
    142                                 my_nodes[(int)e2*3+0]=1;
    143                                 my_nodes[(int)e2*3+2]=1;
     142                                my_nodes[e2*3+0]=true;
     143                                my_nodes[e2*3+2]=true;
    144144                        }
    145145                        else if(pos==1){
    146                                 my_nodes[(int)e2*3+1]=1;
    147                                 my_nodes[(int)e2*3+0]=1;
     146                                my_nodes[e2*3+1]=true;
     147                                my_nodes[e2*3+0]=true;
    148148                        }
    149149                        else if (pos==2){
    150                                 my_nodes[(int)e2*3+2]=1;
    151                                 my_nodes[(int)e2*3+1]=1;
     150                                my_nodes[e2*3+2]=true;
     151                                my_nodes[e2*3+1]=true;
    152152                        }
    153153                        else{
    154                                 _error_("Problem in edges creation");
     154                                _error2_("Problem in edges creation");
    155155                        }
    156156                }
     
    158158
    159159        /*Free data: */
    160         xfree((void**)&elements);
    161         xfree((void**)&edges);
     160        xDelete<int>(elements);
     161        xDelete<int>(edges);
    162162
    163163        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp

    r10522 r12878  
    44#include "../../../EnumDefinitions/EnumDefinitions.h"
    55#include "../../../io/io.h"
    6 #include "../../../objects/objects.h"
     6#include "../../../classes/objects/objects.h"
    77#include "../../../shared/shared.h"
    88#include "../ModelProcessorx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
     
    4747
    4848                        /*Get left and right elements*/
    49                         element=(int)(iomodel->Data(MeshEdgesEnum)[4*i+2])-1; //edges are [node1 node2 elem1 elem2]
     49                        element=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+2])-1; //edges are [node1 node2 elem1 elem2]
    5050
    5151                        /*Now, if this element is not in the partition, pass: */
     
    6161
    6262        /*Create Penpair for vertex_pairing: */
    63         double *vertex_pairing=NULL;
    64         double *nodeonbed=NULL;
     63        IssmDouble *vertex_pairing=NULL;
     64        IssmDouble *nodeonbed=NULL;
    6565        iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,PrognosticVertexPairingEnum);
    6666        iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
     
    6868        for(i=0;i<numvertex_pairing;i++){
    6969
    70                 if(iomodel->my_vertices[(int)vertex_pairing[2*i+0]-1]){
     70                if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){
    7171
    7272                        /*In debugging mode, check that the second node is in the same cpu*/
    73                         _assert_(iomodel->my_vertices[(int)vertex_pairing[2*i+1]-1]);
     73                        _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]);
    7474
    7575                        /*Skip if one of the two is not on the bed*/
    76                         if(!nodeonbed[(int)vertex_pairing[2*i+0]-1] || !nodeonbed[(int)vertex_pairing[2*i+1]-1]) continue;
     76                        if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue;
    7777
    7878                        /*Get node ids*/
    79                         penpair_ids[0]=iomodel->nodecounter+(int)vertex_pairing[2*i+0];
    80                         penpair_ids[1]=iomodel->nodecounter+(int)vertex_pairing[2*i+1];
     79                        penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]);
     80                        penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]);
    8181
    8282                        /*Create Load*/
     
    9090
    9191        /*free ressources: */
    92         xfree((void**)&vertex_pairing);
    93         xfree((void**)&nodeonbed);
    94 
     92        xDelete<IssmDouble>(vertex_pairing);
     93        xDelete<IssmDouble>(nodeonbed);
    9594
    9695        /*Assign output pointer: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp

    r10522 r12878  
    66#include "../../../toolkits/toolkits.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../io/io.h"
     
    4646
    4747        /*Check in 3d*/
    48         if(stabilization==3 && dim==3) _error_("DG 3d not implemented yet");
     48        if(stabilization==3 && dim==3) _error2_("DG 3d not implemented yet");
    4949
    5050        /*First fetch data: */
     
    7272
    7373                                        //Get index of the vertex on which the current node is located
    74                                         vertex_id=(int)*(iomodel->Data(MeshElementsEnum)+3*i+j); //(Matlab indexing)
     74                                        vertex_id=reCast<int>(*(iomodel->Data(MeshElementsEnum)+3*i+j)); //(Matlab indexing)
    7575                                        io_index=vertex_id-1;                      //(C indexing)
    7676                                        _assert_(vertex_id>0 && vertex_id<=numberofvertices);
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp

    r12004 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
     
    2020        int    stabilization;
    2121        bool   dakota_analysis;
     22        bool   issmbgradients;
     23        bool   ispdd;
     24        bool   isdelta18o;
     25        IssmDouble *size, Delta18oTimeSerie,Delta18oSurfaceTimeSerie ;
    2226
    2327        /*Fetch data needed: */
     
    2630        iomodel->Constant(&stabilization,PrognosticStabilizationEnum);
    2731        iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
     32        iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum);
     33        iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
     34        iomodel->Constant(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
    2835        iomodel->FetchData(1,MeshElementsEnum);
    2936
     
    4451        iomodel->FetchDataToInput(elements,MaskElementonfloatingiceEnum);
    4552        iomodel->FetchDataToInput(elements,MaskElementonwaterEnum);
    46         iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
    4753        iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
    4854        iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateCorrectionEnum);
     
    6672                iomodel->FetchDataToInput(elements,TemperatureEnum);
    6773        }
     74        if(issmbgradients){
     75                iomodel->FetchDataToInput(elements,SurfaceforcingsHcEnum);
     76                iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMaxEnum);
     77                iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMinEnum);
     78                iomodel->FetchDataToInput(elements,SurfaceforcingsAPosEnum);
     79                iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
     80                iomodel->FetchDataToInput(elements,SurfaceforcingsANegEnum);
     81                iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
     82        }
     83        if(ispdd){
     84                iomodel->FetchDataToInput(elements,ThermalSpctemperatureEnum);
     85                if(isdelta18o){
     86                        iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesLgmEnum);
     87                        iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesPresentdayEnum);
     88                        iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsPresentdayEnum);
     89                }
     90                else{
     91                        iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
     92                        iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum);
     93                }
     94        }
     95        if(~ispdd & ~issmbgradients){
     96                iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
     97        }
    6898
    6999        /*Free data: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SortDataSets.cpp

    r9320 r12878  
    99#endif
    1010
    11 #include "../../objects/objects.h"
     11#include "../../classes/objects/objects.h"
    1212#include "../../shared/shared.h"
    1313#include "../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/CreateConstraintsSurfaceSlope.cpp

    r10522 r12878  
    77#include "../../../toolkits/toolkits.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../ModelProcessorx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/CreateLoadsSurfaceSlope.cpp

    r10522 r12878  
    66#include "../../../toolkits/toolkits.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp

    r10522 r12878  
    77#include "../../../toolkits/toolkits.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../shared/shared.h"
    1111#include "../../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/UpdateElementsSurfaceSlope.cpp

    r9733 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp

    r10522 r12878  
    88#include "../../../toolkits/toolkits.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../ModelProcessorx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp

    r10522 r12878  
    66#include "../../../io/io.h"
    77#include "../../../EnumDefinitions/EnumDefinitions.h"
    8 #include "../../../objects/objects.h"
     8#include "../../../classes/objects/objects.h"
    99#include "../../../shared/shared.h"
    1010#include "../../../include/include.h"
     
    3333
    3434        /*return if 2d mesh*/
    35         if (dim==2) _error_("2d meshes not supported yet");
     35        if (dim==2) _error2_("2d meshes not supported yet");
    3636
    3737        //create penalties for nodes: no node can have a temperature over the melting point
     
    4343                /*keep only this partition's nodes:*/
    4444                if((iomodel->my_vertices[i]==1)){
    45                         if (isnan(iomodel->Data(ThermalSpctemperatureEnum)[i])){ //No penalty applied on spc nodes!
     45                        if (xIsNan<IssmDouble>(iomodel->Data(ThermalSpctemperatureEnum)[i])){ //No penalty applied on spc nodes!
    4646                                loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,ThermalAnalysisEnum));
    4747                        }
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp

    r10522 r12878  
    77#include "../../../io/io.h"
    88#include "../../../EnumDefinitions/EnumDefinitions.h"
    9 #include "../../../objects/objects.h"
     9#include "../../../classes/objects/objects.h"
    1010#include "../../../include/include.h"
    1111#include "../../../shared/shared.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp

    r10653 r12878  
    88#include "../../../io/io.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp

    r9340 r12878  
    88#include "../../../modules/modules.h"
    99#include "../../../EnumDefinitions/EnumDefinitions.h"
    10 #include "../../../objects/objects.h"
     10#include "../../../classes/objects/objects.h"
    1111#include "../../../shared/shared.h"
    1212#include "../../MeshPartitionx/MeshPartitionx.h"
     
    1515
    1616void    UpdateElementsTransient(Elements* elements, Parameters* parameters,IoModel* iomodel,int analysis_counter,int analysis_type){
    17 
    18         /*nothing for now: */
    19 
    2017}
  • issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/UpdateCounters.cpp

    r9320 r12878  
    99#endif
    1010
    11 #include "../../objects/objects.h"
     11#include "../../classes/objects/objects.h"
    1212#include "../../shared/shared.h"
    1313#include "../../include/include.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/NodalValuex/NodalValuex.cpp

    r12168 r12878  
    1010#include "../../EnumDefinitions/EnumDefinitions.h"
    1111
    12 void NodalValuex( double* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units){
     12void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units){
    1313
    1414        extern int my_rank;
     
    1616        int index;
    1717        Element* element=NULL;
    18         double value;
     18        IssmDouble value;
    1919        int found;
    2020        int sumfound;
     
    3838        #ifdef _HAVE_MPI_
    3939        MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    40         if(!sumfound)_error_("%s%i%s%s","could not find element with vertex with id",index," to compute nodal value ",EnumToStringx(natureofdataenum));
     40        if(!sumfound)_error2_("could not find element with vertex with id" << index << " to compute nodal value " << EnumToStringx(natureofdataenum));
    4141        #endif
    4242
  • issm/branches/trunk-jpl-damage/src/c/modules/NodalValuex/NodalValuex.h

    r9206 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
    12 void NodalValuex( double* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units);
     12void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units);
    1313
    1414#endif  /* _NODALVALUEX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp

    r6412 r12878  
    3737
    3838        /*Allocate connectivity: */
    39         connectivity=(double*)xcalloc(nods*width,sizeof(double));
     39        connectivity=xNewZeroInit<double>(nods*width);
    4040
    4141        /*Go through all elements, and for each elements, plug into the connectivity, all the nodes.
     
    7171         * warn the user to increase the connectivity width: */
    7272        for(i=0;i<nods;i++){
    73                 if (*(connectivity+width*i+maxels)>maxels)_error_("%s%g%s"," max connectivity width reached (",*(connectivity+width*i+maxels),")! increase width of connectivity table");
     73                if (*(connectivity+width*i+maxels)>maxels)_error2_("max connectivity width reached (" << *(connectivity+width*i+maxels) << ")! increase width of connectivity table");
    7474        }
    7575
  • issm/branches/trunk-jpl-damage/src/c/modules/NodesDofx/NodesDofx.h

    r4236 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Orthx/Orthx.h

    r11708 r12878  
    66#define _ORTHX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../include/include.h"
    1010#include "../../shared/shared.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.cpp

    r12168 r12878  
    1414#include "../../Container/Container.h"
    1515#include "../../io/io.h"
    16 #include "../../objects/objects.h"
     16#include "../../classes/objects/objects.h"
    1717               
    18 void OutputResultsx(                    Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
     18void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
    1919
    2020        extern int  my_rank;
     
    4646                EnumToStringx(&solutiontypestring,solutiontype);
    4747                results->AddObject(new StringExternalResult(results->Size()+1,SolutionTypeEnum,solutiontypestring,1,0));
    48                 xfree((void**)&solutiontypestring);
     48                xDelete<char>(solutiontypestring);
    4949        }
    5050
     
    6868                        fid=pfopen(cpu_outputfilename ,"wb");
    6969                }
    70                 xfree((void**)&outputfilename);
     70                xDelete<char>(outputfilename);
    7171               
    7272                /*Add file pointer in parameters for further calls to OutputResultsx: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp

    r12168 r12878  
    1010#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1111#endif
     12
     13#include <cstring>
    1214
    1315#include "./ParsePetscOptionsx.h"
     
    2527
    2628        /*intermediary: */
    27         double* analyses=NULL;
     29        IssmDouble* analyses=NULL;
    2830        char** strings=NULL;
    2931        int numanalyses;
     
    4648
    4749                /*Now, allocate analyses and strings: */
    48                 analyses=(double*)xmalloc(numanalyses*sizeof(double));
    49                 strings=(char**)xmalloc(numanalyses*sizeof(char*));
     50                analyses=xNew<IssmDouble>(numanalyses);
     51                strings=xNew<char*>(numanalyses);
    5052                for(i=0;i<numanalyses;i++)strings[i]=NULL;
    5153
     
    6870                        to the already existing options*/
    6971                                if(strings[numanalyses-1]==NULL){
    70                                         string=(char*)xmalloc((strlen(line)+1)*sizeof(char));
    71                                         memcpy(string,line,(strlen(line)+1)*sizeof(char));
     72                                        string=xNew<char>((strlen(line)+1));
     73                                        xMemCpy<char>(string,line,(strlen(line)+1));
    7274
    7375                                        strings[numanalyses-1]=string;
     
    7577                                else{
    7678                                        string=strings[numanalyses-1];
    77                                         newstring=(char*)xmalloc((strlen(line)+1)*sizeof(char));
    78                                         memcpy(newstring,line,(strlen(line)+1)*sizeof(char));
     79                                        newstring=xNew<char>((strlen(line)+1));
     80                                        xMemCpy<char>(newstring,line,(strlen(line)+1));
    7981
    8082                                        /*concatenate:*/
    81                                         catstring=(char*)xmalloc((strlen(string)+1+strlen(newstring)+1+1)*sizeof(char)); //fit in a space " "
    82                                         memcpy(catstring,string,(strlen(string)+1)*sizeof(char));
     83                                        catstring=xNew<char>(strlen(string)+1+strlen(newstring)+1+1); //fit in a space " "
     84                                        xMemCpy<char>(catstring,string,(strlen(string)+1));
    8385
    8486                                        strcat(catstring," ");
    8587                                        strcat(catstring,newstring);
    8688                                        strings[numanalyses-1]=catstring;
    87                                         xfree((void**)&newstring);
    88                                         xfree((void**)&string);
     89                                        xDelete<char>(newstring);
     90                                        xDelete<char>(string);
    8991                                }
    9092                        }
     
    9698        MPI_Bcast(&numanalyses,1,MPI_INT,0,MPI_COMM_WORLD);
    9799        if(my_rank!=0){
    98                 analyses=(double*)xmalloc(numanalyses*sizeof(double));
    99                 strings=(char**)xmalloc(numanalyses*sizeof(char*));
     100                analyses=xNew<IssmPDouble>(numanalyses);
     101                strings=xNew<char*>(numanalyses);
    100102        }
    101103        MPI_Bcast(analyses,numanalyses,MPI_DOUBLE,0,MPI_COMM_WORLD);
     
    104106                char* string=strings[i];
    105107                if(my_rank==0){
    106                         if(string==NULL) _error_("PETSc options for analysis %s have been declared but were not found",EnumToStringx((int)analyses[i]));
     108                        if(string==NULL) _error2_("PETSc options for analysis " << EnumToStringx(reCast<int>(analyses[i])) << " have been declared but were not found");
    107109                }
    108110                if(my_rank==0)stringlength=(strlen(string)+1)*sizeof(char);
    109111                #ifdef _HAVE_MPI_
    110112                MPI_Bcast(&stringlength,1,MPI_INT,0,MPI_COMM_WORLD);
    111                 if(my_rank!=0)string=(char*)xmalloc(stringlength);
     113                if(my_rank!=0)string=xNew<char>(stringlength);
    112114                MPI_Bcast(string,stringlength,MPI_CHAR,0,MPI_COMM_WORLD);
    113115                if(my_rank!=0)strings[i]=string;
     
    120122
    121123        /*Clean up and return*/
    122         for(i=0;i<numanalyses;i++) xfree((void**)&strings[i]);
    123         xfree((void**)&strings);
    124         xfree((void**)&analyses);
     124        for(i=0;i<numanalyses;i++) xDelete<char>(strings[i]);
     125        xDelete<char*>(strings);
     126        xDelete<IssmDouble>(analyses);
    125127        return;
    126128}
    127 
  • issm/branches/trunk-jpl-damage/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.h

    r8330 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.h

    r11708 r12878  
    88
    99#include "../../shared/shared.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp

    r11708 r12878  
    3939
    4040        /*allocate: */
    41         already=(bool*)xcalloc(nods,sizeof(bool));
     41        already=xNewZeroInit<bool>(nods);
    4242
    4343        /*partition loop across threads: */
     
    4545
    4646        /*Loop over the nodes*/
    47         if (my_thread==0) printf("      loop progress:   %5.2lf %%",0.0);
    48 
    4947        for (i=i0;i<i1;i++){
    5048
    5149                /*display current iteration*/
    52                 if (my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nods*100*num_threads);
     50                if (my_thread==0 && fmod((double)i,(double)100)==0)
     51                 _printString_("\r      loop progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%");
    5352
    5453                distance=mindistance+100; //make sure initialization respects min distance criterion.
     
    7069                }
    7170        }
    72         if (my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
     71        if (my_thread==0)
     72         _printLine_("\r      loop progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
    7373
    7474        /*Free ressources:*/
    75         xfree((void**)&already);
     75        xDelete<bool>(already);
    7676       
    7777        return NULL;
  • issm/branches/trunk-jpl-damage/src/c/modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp

    r12168 r12878  
    2323
    2424  int    i, it, jj, itm;
    25   double DT = 0.02, sigfac, snormfac;
    26   double signorm = 5.5;      // signorm : sigma of the temperature distribution for a normal day
    27   double siglim;       // sigma limit for the integration which is equal to 2.5 sigmanorm
    28   double signormc;     // sigma of the temperature distribution for cloudy day
    29   double siglimc=0, siglim0, siglim0c;
    30   double tstep, tsint, tint, tstepc;
     25  IssmDouble DT = 0.02, sigfac, snormfac;
     26  IssmDouble signorm = 5.5;      // signorm : sigma of the temperature distribution for a normal day
     27  IssmDouble siglim;       // sigma limit for the integration which is equal to 2.5 sigmanorm
     28  IssmDouble signormc = signorm - 0.5;     // sigma of the temperature distribution for cloudy day
     29  IssmDouble siglimc, siglim0, siglim0c;
     30  IssmDouble tstep, tsint, tint, tstepc;
    3131  int    NPDMAX = 1504, NPDCMAX = 1454;
    32   //double pdds[NPDMAX]={0};
    33   //double pds[NPDCMAX]={0};
    34   double pddt, pd ; // pd : snow/precip fraction, precipitation falling as snow
    35   double PDup, PDCUT = 2.0;    // PDcut: rain/snow cutoff temperature (C)
    36   double tstar; // monthly mean surface temp
     32  //IssmDouble pdds[NPDMAX]={0};
     33  //IssmDouble pds[NPDCMAX]={0};
     34  IssmDouble pddt, pd ; // pd : snow/precip fraction, precipitation falling as snow
     35  IssmDouble PDup, PDCUT = 2.0;    // PDcut: rain/snow cutoff temperature (C)
     36  IssmDouble tstar; // monthly mean surface temp
    3737 
    38   double* pdds=NULL;
    39   double* pds=NULL;
     38  IssmDouble* pdds=NULL;
     39  IssmDouble* pds=NULL;
    4040  Element* element = NULL;
    4141 
    42   pdds=(double*)xmalloc(NPDMAX*sizeof(double)+1);
    43   pds=(double*)xmalloc(NPDCMAX*sizeof(double)+1);
    44  
    45  
    46   // PDD constant
    47   siglim = 2.5*signorm;
     42  pdds=xNew<IssmDouble>(NPDMAX+1);
     43  pds=xNew<IssmDouble>(NPDCMAX+1);
    4844 
    4945  // initialize PDD (creation of a lookup table)
     
    5349  snormfac = 1.0/(signorm*sqrt(2.0*acos(-1.0)));
    5450  siglim = 2.5*signorm;
    55   itm = (int)(2*siglim/DT + 1.5);
     51  siglimc = 2.5*signormc;
     52  siglim0 =  siglim/DT + 0.5;
     53  siglim0c =  siglimc/DT + 0.5;
     54  PDup = siglimc+PDCUT;
     55
     56  itm = reCast<int,IssmDouble>((2*siglim/DT + 1.5));
    5657 
    5758  if (itm >= NPDMAX){
    58     printf("increase NPDMAX in massBalance.cpp\n");
     59    _printLine_("increase NPDMAX in massBalance.cpp");
    5960    exit (1);
    6061      }
     
    6364    tstar = it*DT-siglim;
    6465    tint = tsint;
    65     pddt = 0;
     66    pddt = 0.;
    6667    for ( jj = 0; jj < 600; jj++){
    6768      if (tint > (tstar+siglim)){break;}
     
    8081  snormfac = 1.0/(signormc*sqrt(2.0*acos(-1.0)));
    8182  siglimc = 2.5*signormc ;
    82   itm = (int)((PDCUT+2.*siglimc)/DT + 1.5);
     83  itm = reCast<int,IssmDouble>((PDCUT+2.*siglimc)/DT + 1.5);
    8384  if (itm >= NPDCMAX){
    84     printf("'increase NPDCMAX in p35com'\n");
     85    _printLine_("'increase NPDCMAX in p35com'");
    8586    exit (1);
    8687      }
     
    8990    //    tstar = REAL(it)*DT-siglimc;
    9091    tint = tsint;          // start against upper bound
    91     pd = 0;
     92    pd = 0.;
    9293    for (jj = 0; jj < 600; jj++){
    9394      if (tint<(tstar-siglimc)) {break;}
     
    9798    pds[it] = pd*snormfac;  // gaussian integral lookup table for snow fraction
    9899  }
    99   pds[itm+1] = 0;
     100  pds[itm+1] = 0.;
    100101  //     *******END initialize PDD
    101102 
     
    105106  }
    106107  /*free ressouces: */
    107   xfree((void**)&pdds);
    108   xfree((void**)&pds);
     108  xDelete<IssmDouble>(pdds);
     109  xDelete<IssmDouble>(pds);
    109110 
    110111}
  • issm/branches/trunk-jpl-damage/src/c/modules/PositiveDegreeDayx/PositiveDegreeDayx.h

    r11577 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Reduceloadx/Reduceloadx.cpp

    r11708 r12878  
    2222        int         verbose;
    2323
    24         _printf_(VerboseModule(),"   Dirichlet lifting applied to load vector\n");
     24        if(VerboseModule()) _pprintLine_("   Dirichlet lifting applied to load vector");
    2525
    2626        Kfs->GetSize(&global_m,&global_n);
  • issm/branches/trunk-jpl-damage/src/c/modules/Reduceloadx/Reduceloadx.h

    r11684 r12878  
    66#define _REDUCELOADX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp

    r11684 r12878  
    1515        int configuration_type;
    1616        int fsize;
    17         double* ug_serial=NULL;
     17        IssmDouble* ug_serial=NULL;
    1818
    1919        /*first figure out fsize: */
     
    5151
    5252        /*Free ressources:*/
    53         xfree((void**)&ug_serial);
     53        xDelete<IssmDouble>(ug_serial);
    5454
    5555        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h

    r11684 r12878  
    77#define _REDUCEVECTORGTOFX_H
    88
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp

    r11684 r12878  
    5151
    5252        /*Free ressources:*/
    53         xfree((void**)&yg_serial);
     53        xDelete<double>(yg_serial);
    5454
    5555        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h

    r11684 r12878  
    77#define _REDUCEVECTORGTOSX_H
    88
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.cpp

    r12004 r12878  
    1313        int      output_enum;
    1414        int      step;
    15         double   time;
    16         double   output_value;
     15        IssmDouble   time;
     16        IssmDouble   output_value;
    1717        Element *element      = NULL;
    1818
     
    3232                                        results->AddObject(new DoubleExternalResult(results->Size()+1,IceVolumeEnum,output_value,step,time));
    3333                                        break;
     34                                case TotalSmbEnum:
     35                                        Responsex(&output_value,elements,nodes,vertices,loads,materials,parameters,"TotalSmb",false,0);
     36                                        results->AddObject(new DoubleExternalResult(results->Size()+1,TotalSmbEnum,output_value,step,time));
     37                                        break;
    3438                                default:
    3539                                        /*create this output in the element inputs, and then transfer to results:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp

    r9761 r12878  
    2222
    2323        /*Display message*/
    24         _printf_(VerboseModule(),"   Resetting penalties\n");
     24        if(VerboseModule()) _pprintLine_("   Resetting penalties");
    2525
    2626        /*recover parameters: */
     
    3030         * management routine, otherwise, skip : */
    3131        if (RiftIsPresent(loads,analysis_type)){
    32                 _error_("rift constraints reset not supported yet!");
     32                _error2_("rift constraints reset not supported yet!");
    3333        }
    3434        else if(ThermalIsPresent(loads,analysis_type)){
  • issm/branches/trunk-jpl-damage/src/c/modules/ResetConstraintsx/ResetConstraintsx.h

    r9127 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h

    r10440 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Responsex/Responsex.cpp

    r11202 r12878  
    1616#include "../modules.h"
    1717
    18 void Responsex(double* responses,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index){
     18void Responsex(IssmDouble* responses,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index){
    1919
    2020        switch (StringToEnumx(response_descriptor)){
     
    4141                case ThicknessAbsMisfitEnum:     ThicknessAbsMisfitx(      responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
    4242                case ThicknessAbsGradientEnum:   ThicknessAbsGradientx(    responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
     43                case TotalSmbEnum:                                      TotalSmbx(                responses, elements,nodes, vertices, loads, materials, parameters,process_units); break;
    4344                case RheologyBbarAbsGradientEnum:RheologyBbarAbsGradientx( responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
    4445                case DragCoefficientAbsGradientEnum:DragCoefficientAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
     
    4647                case VelEnum:ElementResponsex(responses, elements,nodes, vertices, loads, materials, parameters,VelEnum,process_units); break;
    4748                case FrictionCoefficientEnum:NodalValuex(responses, FrictionCoefficientEnum,elements,nodes, vertices, loads, materials, parameters,process_units); break;
    48                 default: _error_(" response descriptor \"%s\" not supported yet!",response_descriptor); break;
     49                default: _error2_("response descriptor \"" << response_descriptor << "\" not supported yet!"); break;
    4950                #else
    50                 default: _error_(" ISSM was not compiled with responses capabilities, exiting!");
     51                default: _error2_("ISSM was not compiled with responses capabilities, exiting!");
    5152                #endif
    5253        }
  • issm/branches/trunk-jpl-damage/src/c/modules/Responsex/Responsex.h

    r11202 r12878  
    66#define _RESPONSESX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
    11 void Responsex(double* presponse,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index);
     11void Responsex(IssmDouble* presponse,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index);
    1212
    1313#endif  /* _RESPONSESXX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h

    r8608 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Scotchx/Scotchx.h

    r9320 r12878  
    2020
    2121#include "../../Container/Container.h"
    22 #include "../../objects/objects.h"
     22#include "../../classes/objects/objects.h"
    2323
    2424#ifdef _HAVE_SCOTCH_ //only works if scotch library has been compiled in.
  • issm/branches/trunk-jpl-damage/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp

    r11708 r12878  
    2525        }
    2626
    27         xfree((void**)&control_type);
     27        xDelete<int>(control_type);
    2828}
    2929
     
    3737
    3838        /*Free ressources:*/
    39         xfree((void**)&serial_vector);
     39        xDelete<double>(serial_vector);
    4040}
  • issm/branches/trunk-jpl-damage/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.h

    r11708 r12878  
    55#define _SETCONTROLINPUTSXFROMVECTOR_H
    66
    7 #include "../../objects/objects.h"
     7#include "../../classes/objects/objects.h"
    88#include "../../Container/Container.h"
    99
  • issm/branches/trunk-jpl-damage/src/c/modules/Shp2Kmlx/Shp2Kmlx.cpp

    r11401 r12878  
    3939        int     nshape,ncoord;
    4040        double  cpsum;
    41         int     *pstype=NULL,*pnpart=NULL,**ppstrt=NULL,**pptype=NULL,*pnvert=NULL;
    42         double  **pshapx=NULL,**pshapy=NULL,**pshapz=NULL,**pshapm=NULL;
    43         double  *lat=NULL,*lon=NULL;
     41        int     *pstype = NULL, *pnpart=NULL,**ppstrt=NULL,**pptype=NULL,*pnvert=NULL;
     42        double **pshapx = NULL,**pshapy=NULL,**pshapz=NULL,**pshapm=NULL;
     43        double  *lat    = NULL, *lon=NULL;
    4444
    4545        SHPHandle   hSHP;
     
    4949
    5050        char    indent[81]="";
    51         KML_File*             kfile =NULL;
    52         KML_Document*         kdoc  =NULL;
    53         KML_Style*            kstyle=NULL;
    54         KML_LineStyle*        klsty =NULL;
    55         KML_PolyStyle*        kpsty =NULL;
    56         KML_Folder*           kfold =NULL;
    57         KML_Placemark*        kplace=NULL;
    58         KML_MultiGeometry*    kmulti=NULL;
    59         KML_Polygon*          kpoly =NULL;
    60         KML_LinearRing*       kring =NULL;
    61         KML_LineString*       kline =NULL;
    62         KML_Point*            kpoint=NULL;
    63 
    64         FILE*   fid=NULL;
     51        KML_File          *kfile  = NULL;
     52        KML_Document      *kdoc   = NULL;
     53        KML_Style         *kstyle = NULL;
     54        KML_LineStyle     *klsty  = NULL;
     55        KML_PolyStyle     *kpsty  = NULL;
     56        KML_Folder        *kfold  = NULL;
     57        KML_Placemark     *kplace = NULL;
     58        KML_MultiGeometry *kmulti = NULL;
     59        KML_Polygon       *kpoly  = NULL;
     60        KML_LinearRing    *kring  = NULL;
     61        KML_LineString    *kline  = NULL;
     62        KML_Point         *kpoint = NULL;
     63        FILE              *fid    = NULL;
    6564
    6665        clock_t clock0,clock1;
     
    6968        clock0=clock();
    7069        time0 =time(NULL);
    71         _printf_(true,"\nShp2Kmlx Module -- %s",ctime(&time0));
     70        _pprintString_("\nShp2Kmlx Module -- " << ctime(&time0));
    7271
    7372/*  note that much of the following code is taken from shpdump.c in shapelib.  */
     
    7675
    7776        hSHP = SHPOpen( filshp, "rb" );
    78         if (!hSHP) _error_("Error opening shp/shx files.");
     77        if (!hSHP) _error2_("Error opening shp/shx files.");
    7978
    8079/*  read header and print out file bounds  */
     
    9796
    9897        nshape=nEntities;
    99         pstype=(int *) xmalloc(nshape*sizeof(int));
    100         pnpart=(int *) xmalloc(nshape*sizeof(int));
    101         ppstrt=(int **) xmalloc(nshape*sizeof(int *));
    102         pptype=(int **) xmalloc(nshape*sizeof(int *));
    103         pnvert=(int *) xmalloc(nshape*sizeof(int));
    104         pshapx=(double **) xmalloc(nshape*sizeof(double *));
    105         pshapy=(double **) xmalloc(nshape*sizeof(double *));
    106         pshapz=(double **) xmalloc(nshape*sizeof(double *));
    107         pshapm=(double **) xmalloc(nshape*sizeof(double *));
     98        pstype=xNew<int>(nshape);
     99        pnpart=xNew<int>(nshape);
     100        ppstrt=xNew<int*>(nshape);
     101        pptype=xNew<int*>(nshape);
     102        pnvert=xNew<int>(nshape);
     103        pshapx=xNew<double*>(nshape);
     104        pshapy=xNew<double*>(nshape);
     105        pshapz=xNew<double*>(nshape);
     106        pshapm=xNew<double*>(nshape);
    108107
    109108/*  loop over the list of shapes  */
     
    129128        pnpart[i]=psShape->nParts;
    130129        if (pnpart[i]) {
    131                 ppstrt[i]=(int *) xmalloc(pnpart[i]*sizeof(int));
    132                 pptype[i]=(int *) xmalloc(pnpart[i]*sizeof(int));
     130                ppstrt[i]=xNew<int>(pnpart[i]);
     131                pptype[i]=xNew<int>(pnpart[i]);
    133132        }
    134133        else {
     
    138137        pnvert[i]=psShape->nVertices;
    139138        if (pnvert[i]) {
    140                 pshapx[i]=(double *) xmalloc(pnvert[i]*sizeof(double));
    141                 pshapy[i]=(double *) xmalloc(pnvert[i]*sizeof(double));
    142                 pshapz[i]=(double *) xmalloc(pnvert[i]*sizeof(double));
    143                 pshapm[i]=(double *) xmalloc(pnvert[i]*sizeof(double));
     139                pshapx[i]=xNew<double>(pnvert[i]);
     140                pshapy[i]=xNew<double>(pnvert[i]);
     141                pshapz[i]=xNew<double>(pnvert[i]);
     142                pshapm[i]=xNew<double>(pnvert[i]);
    144143        }
    145144        else {
     
    296295                        kpoint=new KML_Point();
    297296
    298                         lat=(double *) xmalloc(pnvert[i]*sizeof(double));
    299                         lon=(double *) xmalloc(pnvert[i]*sizeof(double));
     297                        lat=xNew<double>(pnvert[i]);
     298                        lon=xNew<double>(pnvert[i]);
    300299                        if (sgn) {
    301300                                Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp);
     
    310309                        kpoint->coords[2]=pshapz[i][0];
    311310
    312                         xfree((void**)&lon);
    313                         xfree((void**)&lat);
     311                        xDelete<double>(lon);
     312                        xDelete<double>(lat);
    314313
    315314                        (kplace->geometry  )->AddObject((Object*)kpoint);
     
    337336/*  convert to lat/lon, if necessary  */
    338337
    339                         lat=(double *) xmalloc(pnvert[i]*sizeof(double));
    340                         lon=(double *) xmalloc(pnvert[i]*sizeof(double));
     338                        lat=xNew<double>(pnvert[i]);
     339                        lon=xNew<double>(pnvert[i]);
    341340                        if (sgn) {
    342341                                Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp);
     
    353352
    354353                                kline->ncoord    =(j<pnpart[i]-1 ? ppstrt[i][j+1]-ppstrt[i][j] : pnvert[i]-ppstrt[i][j]);
    355                                 kline->coords    =(double (*)[3]) xmalloc(kline->ncoord*3*sizeof(double));
     354                                kline->coords    =xNew<double>(kline->ncoord*3);
    356355                                for (k=0; k<kline->ncoord; k++) {
    357                                         kline->coords[k][0]=lon      [ppstrt[i][j]+k];
    358                                         kline->coords[k][1]=lat      [ppstrt[i][j]+k];
    359                                         kline->coords[k][2]=pshapz[i][ppstrt[i][j]+k];
     356                                        kline->coords[3*k+0]=lon      [ppstrt[i][j]+k];
     357                                        kline->coords[3*k+1]=lat      [ppstrt[i][j]+k];
     358                                        kline->coords[3*k+2]=pshapz[i][ppstrt[i][j]+k];
    360359                                }
    361 
    362360                                (kmulti->geometry  )->AddObject((Object*)kline);
    363                                 kline =NULL;
    364                         }
    365 
    366                         xfree((void**)&lon);
    367                         xfree((void**)&lat);
    368 
    369                         (kplace->geometry  )->AddObject((Object*)kmulti);
     361                                kline = NULL;
     362                        }
     363
     364                        xDelete<double>(lon);
     365                        xDelete<double>(lat);
     366
     367                        (kplace->geometry)->AddObject((Object*)kmulti);
    370368                        kmulti=NULL;
    371                         (kfold ->feature   )->AddObject((Object*)kplace);
     369                        (kfold ->feature )->AddObject((Object*)kplace);
    372370                        kplace=NULL;
    373371                }
     
    401399/*  convert to lat/lon, if necessary  */
    402400
    403                         lat=(double *) xmalloc(pnvert[i]*sizeof(double));
    404                         lon=(double *) xmalloc(pnvert[i]*sizeof(double));
     401                        lat=xNew<double>(pnvert[i]);
     402                        lon=xNew<double>(pnvert[i]);
    405403                        if (sgn) {
    406404                                Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp);
     
    438436
    439437                                        kring->ncoord    =(j<pnpart[i]-1 ? ppstrt[i][j+1]-ppstrt[i][j] : pnvert[i]-ppstrt[i][j]);
    440                                         kring->coords    =(double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));
     438                                        kring->coords    =xNew<double>(kring->ncoord*3);
    441439                                        if (cpsum < 0)
    442440                                                for (k=0; k<kring->ncoord; k++) {
    443                                                         kring->coords[kring->ncoord-1-k][0]=lon      [ppstrt[i][j]+k];
    444                                                         kring->coords[kring->ncoord-1-k][1]=lat      [ppstrt[i][j]+k];
    445                                                         kring->coords[kring->ncoord-1-k][2]=pshapz[i][ppstrt[i][j]+k];
     441                                                        kring->coords[3*(kring->ncoord-1-k)+0]=lon      [ppstrt[i][j]+k];
     442                                                        kring->coords[3*(kring->ncoord-1-k)+1]=lat      [ppstrt[i][j]+k];
     443                                                        kring->coords[3*(kring->ncoord-1-k)+2]=pshapz[i][ppstrt[i][j]+k];
    446444                                                }
    447445                                        else
    448446                                                for (k=0; k<kring->ncoord; k++) {
    449                                                         kring->coords[k                ][0]=lon      [ppstrt[i][j]+k];
    450                                                         kring->coords[k                ][1]=lat      [ppstrt[i][j]+k];
    451                                                         kring->coords[k                ][2]=pshapz[i][ppstrt[i][j]+k];
     447                                                        kring->coords[3*k+0]=lon      [ppstrt[i][j]+k];
     448                                                        kring->coords[3*k+1]=lat      [ppstrt[i][j]+k];
     449                                                        kring->coords[3*k+2]=pshapz[i][ppstrt[i][j]+k];
    452450                                                }
    453451
     
    470468
    471469                                        kring->ncoord    =(j<pnpart[i]-1 ? ppstrt[i][j+1]-ppstrt[i][j] : pnvert[i]-ppstrt[i][j]);
    472                                         kring->coords    =(double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));
     470                                        kring->coords    =xNew<double>(kring->ncoord*3);
    473471                                        for (k=0; k<kring->ncoord; k++) {
    474                                                 kring->coords[k][0]=lon      [ppstrt[i][j]+k];
    475                                                 kring->coords[k][1]=lat      [ppstrt[i][j]+k];
    476                                                 kring->coords[k][2]=pshapz[i][ppstrt[i][j]+k];
     472                                                kring->coords[3*k+0]=lon      [ppstrt[i][j]+k];
     473                                                kring->coords[3*k+1]=lat      [ppstrt[i][j]+k];
     474                                                kring->coords[3*k+2]=pshapz[i][ppstrt[i][j]+k];
    477475                                        }
    478476
     
    487485                        }
    488486
    489                         xfree((void**)&lon);
    490                         xfree((void**)&lat);
     487                        xDelete<double>(lon);
     488                        xDelete<double>(lat);
    491489
    492490                        (kplace->geometry  )->AddObject((Object*)kmulti);
     
    518516/*  convert to lat/lon, if necessary  */
    519517
    520                         lat=(double *) xmalloc(pnvert[i]*sizeof(double));
    521                         lon=(double *) xmalloc(pnvert[i]*sizeof(double));
     518                        lat=xNew<double>(pnvert[i]);
     519                        lon=xNew<double>(pnvert[i]);
    522520                        if (sgn) {
    523521                                Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp);
     
    541539                        }
    542540
    543                         xfree((void**)&lon);
    544                         xfree((void**)&lat);
     541                        xDelete<double>(lon);
     542                        xDelete<double>(lat);
    545543
    546544                        (kplace->geometry  )->AddObject((Object*)kmulti);
     
    575573/*  write kml file  */
    576574
    577         _printf_(true,"Writing kml document to file.\n");
     575        _pprintLine_("Writing kml document to file.");
    578576        fid=fopen(filkml,"w");
    579577        fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
     
    583581        delete kfile;
    584582        for (i=nshape-1; i>=0; i--) {
    585                 xfree((void**)&(pshapm[i]));
    586                 xfree((void**)&(pshapz[i]));
    587                 xfree((void**)&(pshapy[i]));
    588                 xfree((void**)&(pshapx[i]));
    589         }
    590         xfree((void**)&pshapm);
    591         xfree((void**)&pshapz);
    592         xfree((void**)&pshapy);
    593         xfree((void**)&pshapx);
    594         xfree((void**)&pnvert);
     583                xDelete<double>((pshapm[i]));
     584                xDelete<double>((pshapz[i]));
     585                xDelete<double>((pshapy[i]));
     586                xDelete<double>((pshapx[i]));
     587        }
     588        xDelete<double*>(pshapm);
     589        xDelete<double*>(pshapz);
     590        xDelete<double*>(pshapy);
     591        xDelete<double*>(pshapx);
     592        xDelete<int>(pnvert);
    595593        for (i=nshape-1; i>=0; i--) {
    596                 xfree((void**)&(pptype[i]));
    597                 xfree((void**)&(ppstrt[i]));
    598         }
    599         xfree((void**)&pptype);
    600         xfree((void**)&ppstrt);
    601         xfree((void**)&pnpart);
    602         xfree((void**)&pstype);
     594                xDelete<int>((pptype[i]));
     595                xDelete<int>((ppstrt[i]));
     596        }
     597        xDelete<int*>(pptype);
     598        xDelete<int*>(ppstrt);
     599        xDelete<int>(pnpart);
     600        xDelete<int>(pstype);
    603601
    604602        clock1=clock();
  • issm/branches/trunk-jpl-damage/src/c/modules/Shp2Kmlx/Shp2Kmlx.h

    r12258 r12878  
    1919
    2020#include "../../Container/Container.h"
    21 #include "../../objects/objects.h"
     21#include "../../classes/objects/objects.h"
    2222
    2323/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/SmearFunctionx/SmearFunctionx.h

    r11258 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Solverx/DofTypesToIndexSet.cpp

    r9826 r12878  
    2020
    2121        int         start,end;
    22         double*     df_local=NULL;
     22        IssmDouble*     df_local=NULL;
    2323        int         df_local_size;
    2424        int         i;
     
    4646
    4747                /*Allocate indices: */
    48                 if(pressure_num)pressure_indices=(int*)xmalloc(pressure_num*sizeof(int));
    49                 if(velocity_num)velocity_indices=(int*)xmalloc(velocity_num*sizeof(int));
     48                if(pressure_num)pressure_indices=xNew<int>(pressure_num);
     49                if(velocity_num)velocity_indices=xNew<int>(velocity_num);
    5050
    5151                pressure_count=0;
     
    7474
    7575        /*Free ressources:*/
    76         xfree((void**)&pressure_indices);
    77         xfree((void**)&velocity_indices);
     76        xDelete<int>(pressure_indices);
     77        xDelete<int>(velocity_indices);
    7878
    7979        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.cpp

    r12168 r12878  
    2626        _assert_(pf);
    2727
    28         #ifdef _HAVE_PETSC_
    29                 Vec uf0_vector = NULL;
    30                 Vec df_vector  = NULL;
    31                 Vec uf_vector  = NULL;
    32                 if(uf0) uf0_vector = uf0->vector;
    33                 if(df)  df_vector  = df->vector;
     28        /*Initialize vector: */
     29        uf=new Vector();
    3430
    35                 /*In serial mode, the Petsc Options database has not been initialized properly: */
     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;
    3637
    37                 SolverxPetsc(&uf_vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters);
    38 
    39                 /*Create vector out of petsc vector: */
    40                 uf=new Vector(uf_vector);
    41 
    42                 /*Free ressources: */
    43                 VecFree(&uf_vector);
    44         #else
    45                 #ifdef _HAVE_GSL_
    46                 SeqVec* uf_vector=NULL;
    47 
    48                 SolverxGsl(&uf_vector,Kff->matrix,pf->vector);
    49 
    50                 /*Create vector out of SeqVec vector: */
    51                 uf=new Vector(uf_vector);
    52 
    53                 /*Free ressources: */
    54                 delete uf_vector;
    55 
    56                 #else
    57                         _error_("GSL support not compiled in!");
    58                 #endif
    59         #endif
     38                SolverxPetsc(&uf->pvector,Kff->pmatrix,pf->pvector,uf0_vector,df_vector,parameters);
     39        }
     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!");
    6044
    6145        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.h

    r12004 r12878  
    1212#endif
    1313
    14 #include "../../objects/objects.h"
     14#include "../../classes/objects/objects.h"
    1515
    1616/* local prototypes: */
     
    1818
    1919#ifdef _HAVE_PETSC_
     20void    SolverxPetsc(PetscVec** puf, PetscMat* Kff, PetscVec* pf, PetscVec* uf0,PetscVec* df, Parameters* parameters);
    2021void    SolverxPetsc(Vec* puf, Mat Kff, Vec pf, Vec uf0,Vec df, Parameters* parameters);
    21 void    DofTypesToIndexSet(IS* pisv, IS* pisp, Vec df,int typeenum);
     22void  DofTypesToIndexSet(IS* pisv, IS* pisp, Vec df,int typeenum);
    2223#endif
    2324
    24 #ifdef _HAVE_GSL_
    25 void    SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf);
    26 #endif
     25void SolverxSeq(SeqVec** puf,SeqMat* Kff, SeqVec* pf);
     26void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n);
    2727
    2828#endif  /* _SOLVERX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/Solverx/SolverxPetsc.cpp

    r12168 r12878  
    1414#endif
    1515
     16void    SolverxPetsc(PetscVec** puf, PetscMat* Kff, PetscVec* pf, PetscVec* uf0,PetscVec* df, Parameters* parameters){
     17
     18        PetscVec* uf=new PetscVec();
     19
     20        Vec uf0_vector = NULL;
     21        Vec df_vector  = NULL;
     22       
     23        if(uf0) uf0_vector = uf0->vector;
     24        if(df)  df_vector  = df->vector;
     25
     26        SolverxPetsc(&uf->vector, Kff->matrix, pf->vector, uf0_vector, df_vector, parameters);
     27
     28        *puf=uf;
     29
     30}
    1631void    SolverxPetsc(Vec* puf, Mat Kff, Vec pf, Vec uf0,Vec df, Parameters* parameters){
    1732
     
    4459
    4560        /*Display message*/
    46         _printf_(VerboseModule(),"   Solving\n");
     61        if(VerboseModule()) _pprintLine_("   Solving");
    4762        #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
    4863        if(VerboseSolver())PetscOptionsPrint(stdout);
     
    5570        MatGetSize(Kff,&global_m,&global_n); _assert_(global_m==global_m);
    5671        if(!global_n){
    57                 *puf=NULL; return;
     72                *puf=NewVec(0); return;
    5873        }
    5974
     
    8196                #if _PETSC_MAJOR_ >=3
    8297                        #ifndef _HAVE_MUMPS_
    83                         _error_("requested MUMPS solver, which was not compiled into ISSM!\n");
     98                        _error2_("requested MUMPS solver, which was not compiled into ISSM!\n");
    8499                        #endif
    85100                #endif
     
    105120        if (solver_type==StokesSolverEnum){
    106121                /*Make indices out of doftypes: */
    107                 if(!df)_error_("need doftypes for Stokes solver!\n");
     122                if(!df)_error2_("need doftypes for Stokes solver!\n");
    108123                DofTypesToIndexSet(&isv,&isp,df,StokesSolverEnum);
    109124
     
    136151        /*Check convergence*/
    137152        KSPGetIterationNumber(ksp,&iteration_number);
    138         if (iteration_number<0) _error_("%s%i"," Solver diverged at iteration number: ",-iteration_number);
     153        if (iteration_number<0) _error2_("Solver diverged at iteration number: " << -iteration_number);
    139154
    140155        /*Free resources:*/
  • issm/branches/trunk-jpl-damage/src/c/modules/SpcNodesx/SpcNodesx.h

    r9002 r12878  
    66#define _SPCNODESX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010#include "../../toolkits/toolkits.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/StringToEnumx/StringToEnumx.cpp

    r12872 r12878  
    88*/
    99
     10#include <cstring>
    1011#include "../../shared/shared.h"
    1112#include "../../include/include.h"
     
    110111              else if (strcmp(name,"MaterialsRhoIce")==0) return MaterialsRhoIceEnum;
    111112              else if (strcmp(name,"MaterialsRhoWater")==0) return MaterialsRhoWaterEnum;
     113              else if (strcmp(name,"MaterialsRhoFreshwater")==0) return MaterialsRhoFreshwaterEnum;
    112114              else if (strcmp(name,"MaterialsMuWater")==0) return MaterialsMuWaterEnum;
    113115              else if (strcmp(name,"MaterialsThermalExchangeVelocity")==0) return MaterialsThermalExchangeVelocityEnum;
     
    136138              else if (strcmp(name,"MiscellaneousName")==0) return MiscellaneousNameEnum;
    137139              else if (strcmp(name,"PrognosticHydrostaticAdjustment")==0) return PrognosticHydrostaticAdjustmentEnum;
    138               else if (strcmp(name,"PrognosticMinThickness")==0) return PrognosticMinThicknessEnum;
    139140         else stage=2;
    140141   }
    141142   if(stage==2){
    142               if (strcmp(name,"PrognosticPenaltyFactor")==0) return PrognosticPenaltyFactorEnum;
     143              if (strcmp(name,"PrognosticMinThickness")==0) return PrognosticMinThicknessEnum;
     144              else if (strcmp(name,"PrognosticPenaltyFactor")==0) return PrognosticPenaltyFactorEnum;
    143145              else if (strcmp(name,"PrognosticSpcthickness")==0) return PrognosticSpcthicknessEnum;
    144146              else if (strcmp(name,"PrognosticStabilization")==0) return PrognosticStabilizationEnum;
     
    158160              else if (strcmp(name,"SettingsResultsAsPatches")==0) return SettingsResultsAsPatchesEnum;
    159161              else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
    160               else if (strcmp(name,"DebugPetscProfiling")==0) return DebugPetscProfilingEnum;
    161               else if (strcmp(name,"PetscProfilingCurrentMem")==0) return PetscProfilingCurrentMemEnum;
    162               else if (strcmp(name,"PetscProfilingCurrentFlops")==0) return PetscProfilingCurrentFlopsEnum;
    163               else if (strcmp(name,"PetscProfilingSolutionTime")==0) return PetscProfilingSolutionTimeEnum;
     162              else if (strcmp(name,"SurfaceforcingsDelta18o")==0) return SurfaceforcingsDelta18oEnum;
     163              else if (strcmp(name,"SurfaceforcingsDelta18oSurface")==0) return SurfaceforcingsDelta18oSurfaceEnum;
     164              else if (strcmp(name,"SurfaceforcingsIsdelta18o")==0) return SurfaceforcingsIsdelta18oEnum;
     165              else if (strcmp(name,"SurfaceforcingsPrecipitationsPresentday")==0) return SurfaceforcingsPrecipitationsPresentdayEnum;
     166              else if (strcmp(name,"SurfaceforcingsTemperaturesPresentday")==0) return SurfaceforcingsTemperaturesPresentdayEnum;
     167              else if (strcmp(name,"SurfaceforcingsTemperaturesLgm")==0) return SurfaceforcingsTemperaturesLgmEnum;
     168              else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
     169              else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
     170              else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
     171              else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
    164172              else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
    165173              else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
     
    170178              else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
    171179              else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
     180              else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
     181              else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
     182              else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
     183              else if (strcmp(name,"SurfaceforcingsHc")==0) return SurfaceforcingsHcEnum;
     184              else if (strcmp(name,"SurfaceforcingsSmbPosMax")==0) return SurfaceforcingsSmbPosMaxEnum;
     185              else if (strcmp(name,"SurfaceforcingsSmbPosMin")==0) return SurfaceforcingsSmbPosMinEnum;
     186              else if (strcmp(name,"SurfaceforcingsAPos")==0) return SurfaceforcingsAPosEnum;
     187              else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
     188              else if (strcmp(name,"SurfaceforcingsANeg")==0) return SurfaceforcingsANegEnum;
     189              else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
    172190              else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
    173191              else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum;
     
    243261              else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
    244262              else if (strcmp(name,"Contour")==0) return ContourEnum;
    245               else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
     263         else stage=3;
     264   }
     265   if(stage==3){
     266              if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
    246267              else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
    247268              else if (strcmp(name,"DofIndexing")==0) return DofIndexingEnum;
     
    260281              else if (strcmp(name,"IntInput")==0) return IntInputEnum;
    261282              else if (strcmp(name,"IntParam")==0) return IntParamEnum;
    262          else stage=3;
    263    }
    264    if(stage==3){
    265               if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
     283              else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
     284              else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
    266285              else if (strcmp(name,"MacAyeal2dIceFront")==0) return MacAyeal2dIceFrontEnum;
    267286              else if (strcmp(name,"MacAyeal3dIceFront")==0) return MacAyeal3dIceFrontEnum;
     
    365384              else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
    366385              else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
    367               else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
     386         else stage=4;
     387   }
     388   if(stage==4){
     389              if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
    368390              else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
    369391              else if (strcmp(name,"Outputfilename")==0) return OutputfilenameEnum;
     
    383405              else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
    384406              else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
    385          else stage=4;
    386    }
    387    if(stage==4){
    388               if (strcmp(name,"P0")==0) return P0Enum;
     407              else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
     408              else if (strcmp(name,"P0")==0) return P0Enum;
    389409              else if (strcmp(name,"P1")==0) return P1Enum;
    390410              else if (strcmp(name,"P1DG")==0) return P1DGEnum;
     
    468488   }
    469489        /*If we reach this point, the string provided has not been found*/
    470    _error_("Enum %s not found",name);
     490        _error2_("Enum " << name << " not found");
    471491}
  • issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h

    r8607 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAreax/SurfaceAreax.cpp

    r12168 r12878  
    1111#include "../InputUpdateFromConstantx/InputUpdateFromConstantx.h"
    1212
    13 void SurfaceAreax( double* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
     13void SurfaceAreax( IssmDouble* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
    1414       
    1515        /*Intermediary*/
     
    1818
    1919        /*output: */
    20         double S=0;
    21         double S_sum;
     20        IssmDouble S=0;
     21        IssmDouble S_sum;
    2222       
    2323        /*Compute gradients: */
  • issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAreax/SurfaceAreax.h

    r4236 r12878  
    66#define _SURFACEAREAX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010
    1111/* local prototypes: */
    12 void SurfaceAreax( double* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
     12void SurfaceAreax( IssmDouble* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
    1313
    1414#endif  /* _SURFACEAREAX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h

    r8607 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h

    r8607 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h

    r8607 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h

    r8607 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/SystemMatricesx/SystemMatricesx.cpp

    r11708 r12878  
    1010#include "../../EnumDefinitions/EnumDefinitions.h"
    1111
    12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){
     12void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){
    1313       
    1414        /*intermediary: */
     
    2525        Vector*    pf   = NULL;
    2626        Vector*    df=NULL;
    27         double kmax = 0;
     27        IssmDouble kmax = 0;
    2828
    2929        /*Display message*/
    30         _printf_(VerboseModule(),"   Generating matrices\n");
     30        if(VerboseModule()) _pprintLine_("   Generating matrices");
    3131
    3232        /*retrive parameters: */
     
    4141        numberofdofspernode=nodes->MaxNumDofs(configuration_type,GsetEnum);
    4242
    43         /*Checks in debugging mode {{{1*/
     43        /*Checks in debugging mode {{{*/
    4444        if(penalty_kflag)_assert_(kflag);
    4545        if(penalty_pflag)_assert_(pflag);
  • issm/branches/trunk-jpl-damage/src/c/modules/SystemMatricesx/SystemMatricesx.h

    r11684 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
    12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,
     12void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,
    1313                        bool kflag=true,bool pflag=true,bool penalty_kflag=true,bool penalty_pflag=true);
    1414
  • issm/branches/trunk-jpl-damage/src/c/modules/ThicknessAbsGradientx/ThicknessAbsGradientx.h

    r8608 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h

    r8607 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/TimeAdaptx/TimeAdaptx.cpp

    r12168 r12878  
    1010#include "../../Container/Container.h"
    1111
    12 void TimeAdaptx(double* pdt, Elements* elements, Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters){
     12void TimeAdaptx(IssmDouble* pdt, Elements* elements, Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters){
    1313
    1414        int      i;
    1515
    1616        /*output: */
    17         double   dt;
     17        IssmDouble   dt;
    1818
    1919        /*intermediary: */
    2020        Element *element     = NULL;
    21         double   min_dt      = 0;
    22         double   node_min_dt = 0;
     21        IssmDouble   min_dt      = 0;
     22        IssmDouble   node_min_dt = 0;
    2323
    2424        /*Go through elements, and figure out the minimum of the time steps for each element (using CFL criterion): */
  • issm/branches/trunk-jpl-damage/src/c/modules/TimeAdaptx/TimeAdaptx.h

    r6130 r12878  
    66
    77#include "../../Container/Container.h"
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
    11 void TimeAdaptx(double* pdt, Elements* elements, Nodes* nodes,Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters);
     11void TimeAdaptx(IssmDouble* pdt, Elements* elements, Nodes* nodes,Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters);
    1212
    1313#endif  /* _TIMEADAPTX_H */
  • issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.cpp

    r12168 r12878  
    5757
    5858        /*fill in the point list: */
    59         in.pointlist = (REAL *) xmalloc(in.numberofpoints * 2 * sizeof(REAL));
     59        in.pointlist = xNew<REAL>(in.numberofpoints*2);
    6060
    6161        counter=0;
     
    7878       
    7979        /*fill in the point attribute list: */
    80         in.pointattributelist = (REAL*)xmalloc(in.numberofpoints*in.numberofpointattributes*sizeof(REAL));
     80        in.pointattributelist = xNew<REAL>(in.numberofpoints*in.numberofpointattributes);
    8181        for (i=0;i<in.numberofpoints;i++) in.pointattributelist[i] = 0.0;
    8282       
    8383        /*fill in the point marker list: */
    84         in.pointmarkerlist = (int *) xmalloc(in.numberofpoints * sizeof(int));
     84        in.pointmarkerlist = xNew<int>(in.numberofpoints);
    8585        for(i=0;i<in.numberofpoints;i++) in.pointmarkerlist[i] = 0;
    8686
     
    9797        }
    9898       
    99         in.segmentlist = (int *) xmalloc(in.numberofsegments * 2 * sizeof(int));
    100         in.segmentmarkerlist = (int *) xcalloc(in.numberofsegments,sizeof(int));
     99        in.segmentlist = xNew<int>(in.numberofsegments*2);
     100        in.segmentmarkerlist = xNewZeroInit<int>(in.numberofsegments);
    101101        counter=0;
    102102        backcounter=0;
     
    135135        in.numberofholes = domain->Size()-1; /*everything is a hole, but for the first profile.*/
    136136        if(in.numberofholes){
    137                 in.holelist = (REAL *) xmalloc(in.numberofholes * 2 * sizeof(REAL));
     137                in.holelist = xNew<REAL>(in.numberofholes*2);
    138138                for (i=0;i<domain->Size()-1;i++){
    139139                        contour=(Contour*)domain->GetObjectByOffset(i+1);
     
    164164
    165165        /*Allocate index, x and y: */
    166         index=(double*)xmalloc(3*out.numberoftriangles*sizeof(double));
    167         x=(double*)xmalloc(out.numberofpoints*sizeof(double));
    168         y=(double*)xmalloc(out.numberofpoints*sizeof(double));
    169         segments=(double*)xmalloc(3*out.numberofsegments*sizeof(double));
    170         segmentmarkerlist=(double*)xmalloc(out.numberofsegments*sizeof(double));
     166        index=xNew<double>(3*out.numberoftriangles);
     167        x=xNew<double>(out.numberofpoints);
     168        y=xNew<double>(out.numberofpoints);
     169        segments=xNew<double>(3*out.numberofsegments);
     170        segmentmarkerlist=xNew<double>(out.numberofsegments);
    171171
    172172        for (i = 0; i< out.numberoftriangles; i++) {
     
    192192
    193193        /*Output : */
    194         index_matrix=new Matrix(index,out.numberoftriangles,3,1);
    195         index_matrix->Convert(DENSE_SEQUENTIAL);
     194        index_matrix=new Matrix(index,out.numberoftriangles,3,1,SeqMatType);
    196195        *pindex=index_matrix;
    197196       
    198         segments_matrix=new Matrix(segments,out.numberofsegments,3,1); segments_matrix->Convert(DENSE_SEQUENTIAL);
     197        segments_matrix=new Matrix(segments,out.numberofsegments,3,1,SeqMatType);
    199198        *psegments=segments_matrix;
    200199
    201         *px=new Vector(x,out.numberofpoints);
    202         *py=new Vector(y,out.numberofpoints);
    203         *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments);
     200        *px=new Vector(x,out.numberofpoints,SeqMatType);
     201        *py=new Vector(y,out.numberofpoints,SeqMatType);
     202        *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments,SeqMatType);
    204203}
  • issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.h

    r12168 r12878  
    88#include "string.h"
    99#include "../../Container/Container.h"
    10 #include "../../objects/objects.h"
     10#include "../../classes/objects/objects.h"
    1111
    1212/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/TriaSearchx/TriaSearchx.cpp

    r8303 r12878  
    77#include "../../include/include.h"
    88#include "../../toolkits/toolkits.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010#include "../modules.h"
    1111
     
    1313using namespace std;
    1414
    15 void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes){
     15void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes){
    1616
    1717        /*Output*/
     
    1919
    2020        /*allocate: */
    21         tria=(double*)xmalloc(numberofnodes*sizeof(double));
     21        tria=xNew<double>(numberofnodes);
    2222
    2323        /*Intermediary*/
     
    5252        }
    5353
    54 
    5554        /*Assign output pointers:*/
    5655        *ptria=tria;
  • issm/branches/trunk-jpl-damage/src/c/modules/TriaSearchx/TriaSearchx.h

    r8303 r12878  
    66#define _TRIASEARCHX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010/* local prototypes: */
    11 void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes);
     11void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes);
    1212
    1313#endif
  • issm/branches/trunk-jpl-damage/src/c/modules/UpdateConstraintsx/UpdateConstraintsx.cpp

    r9761 r12878  
    1414void UpdateConstraintsx(Nodes* nodes,Constraints* constraints,Parameters* parameters){
    1515
    16         double time;
     16        IssmDouble time;
    1717        int    analysis_type;
    1818
     
    2222
    2323        /*start module: */
    24         _printf_(VerboseModule(),"%s%g\n","   Updating constraints for time: ",time);
     24        if(VerboseModule()) _pprintLine_("   Updating constraints for time: " << time);
    2525       
    2626        /*First, update dof constraints in nodes, using constraints: */
  • issm/branches/trunk-jpl-damage/src/c/modules/UpdateConstraintsx/UpdateConstraintsx.h

    r9002 r12878  
    66#define _UPDATECONSTRAINTSX_H
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010#include "../../toolkits/toolkits.h"
  • issm/branches/trunk-jpl-damage/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp

    r11684 r12878  
    1313       
    1414        int configuration_type;
    15         double* yg_serial=NULL;
     15        IssmDouble* yg_serial=NULL;
    1616
    1717        /*Get current configuration*/
     
    3434
    3535        /*Free ressources:*/
    36         xfree((void**)&yg_serial);
     36        xDelete<IssmDouble>(yg_serial);
    3737}
  • issm/branches/trunk-jpl-damage/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h

    r11684 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vector* yg);
  • issm/branches/trunk-jpl-damage/src/c/modules/UpdateVertexPositionsx/UpdateVertexPositionsx.cpp

    r11708 r12878  
    1515        Vector*     vz        = NULL;
    1616        Vertex *vertex    = NULL;
    17         double *thickness = NULL;
    18         double *bed       = NULL;
     17        IssmDouble *thickness = NULL;
     18        IssmDouble *bed       = NULL;
    1919
    2020        /*get vertex vectors for bed and thickness: */
     
    3838
    3939        /*Free ressources:*/
    40         xfree((void**)&thickness);
    41         xfree((void**)&bed);
     40        xDelete<IssmDouble>(thickness);
     41        xDelete<IssmDouble>(bed);
    4242        xdelete(&vz);
    4343        return 1;
  • issm/branches/trunk-jpl-damage/src/c/modules/VecMergex/VecMergex.cpp

    r11684 r12878  
    1515        int i;
    1616        int configuration_type;
    17         double* uf_serial=NULL;
     17        IssmDouble* uf_serial=NULL;
    1818
    1919        /*retrieve parameters: */
     
    4141        }
    4242        /*Free ressources:*/
    43         xfree((void**)&uf_serial);
     43        xDelete<IssmDouble>(uf_serial);
    4444
    4545        /*Assemble vector: */
  • issm/branches/trunk-jpl-damage/src/c/modules/VecMergex/VecMergex.h

    r11684 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/VerticesDofx/VerticesDofx.h

    r6231 r12878  
    77
    88#include "../../Container/Container.h"
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010
    1111/* local prototypes: */
  • issm/branches/trunk-jpl-damage/src/c/modules/Xy2llx/Xy2llx.cpp

    r9761 r12878  
    5353        double  sl,rho,cm,T,chi;
    5454
    55         if((sgn!=1) && (sgn!=-1)) _error_("Sign should be either +1 or -1.\n");
     55        if((sgn!=1) && (sgn!=-1)) _error2_("Sign should be either +1 or -1.\n");
    5656
    5757        delta = central_meridian;
     
    124124                *pdelta= 45;
    125125                *pslat = 70;
    126                 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n");
     126                if(flag) _pprintLine_("Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).");
    127127        }
    128128        else if (sgn == -1) {
    129129                *pdelta= 0;
    130130                *pslat = 71;
    131                 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n");
     131                if(flag) _pprintLine_("Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).");
    132132        }
    133         else _error_("Sign should be either +1 or -1.\n");
     133        else _error2_("Sign should be either +1 or -1.\n");
    134134
    135135        return;
  • issm/branches/trunk-jpl-damage/src/c/modules/modules.h

    r12168 r12878  
    2525#include "./CreateNodalConstraintsx/CreateNodalConstraintsx.h"
    2626#include "./DakotaResponsesx/DakotaResponsesx.h"
     27#include "./Delta18oParameterizationx/Delta18oParameterizationx.h"
    2728#include "./DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h"
    2829#include "./ElementConnectivityx/ElementConnectivityx.h"
     
    3637#include "./GroundinglineMigrationx/GroundinglineMigrationx.h"
    3738#include "./HoleFillerx/HoleFillerx.h"
     39#include "./TotalSmbx/TotalSmbx.h"
    3840#include "./IceVolumex/IceVolumex.h"
    3941#include "./InputControlUpdatex/InputControlUpdatex.h"
     
    9496#include "./ConstraintsStatex/ConstraintsStatex.h"
    9597#include "./PointCloudFindNeighborsx/PointCloudFindNeighborsx.h"
     98#include "./PositiveDegreeDayx/PositiveDegreeDayx.h"
    9699#include "./PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.h"
    97100#include "./Dakotax/Dakotax.h"
     
    105108#include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h"
    106109#include "./Scotchx/Scotchx.h"
     110#include "./SmbGradientsx/SmbGradientsx.h"
    107111#include "./Solverx/Solverx.h"
    108112#include "./SpcNodesx/SpcNodesx.h"
     
    120124#include "./VerticesDofx/VerticesDofx.h"
    121125#include "./VecMergex/VecMergex.h"
    122 
    123126#endif
  • issm/branches/trunk-jpl-damage/src/c/python/include/python_macros.h

    r12119 r12878  
    66#define _PYTHON_MACROS_H_
    77
    8 /*Header {{{1*/
     8/*Header {{{*/
    99
    1010#ifdef HAVE_CONFIG_H
     
    1616
    1717#ifdef _HAVE_PYTHON_
    18 /* MODULEBOOT/MODULEEND {{{1*/
     18/* MODULEBOOT/MODULEEND {{{*/
    1919
    2020/*The following macros hide the error exception handling in a matlab module. Just put
     
    3030//}}}
    3131#if _PYTHON_MAJOR_ >=3
    32 /* WRAPPER 3.2 {{{1*/
     32/* WRAPPER 3.2 {{{*/
    3333#define WRAPPER(modulename,...)  \
    3434\
     
    5757/*}}}*/
    5858#else
    59 /* WRAPPER 2.7 {{{1*/
     59/* WRAPPER 2.7 {{{*/
    6060#define WRAPPER(modulename,...)  \
    6161\
     
    7575/*}}}*/
    7676#endif
    77 /* CHECKARGUMENTS {{{1*/
     77/* CHECKARGUMENTS {{{*/
    7878#define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumPythonArguments(args, NRHS,functionpointer)
    7979/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/python/io/CheckNumPythonArguments.cpp

    r12017 r12878  
    2727        if (size==0){
    2828                function();
    29                 _error_("usage: see above");
     29                _error2_("usage: see above");
    3030        }
    3131        else if (size!=NRHS ) {
    3232                function();
    33                 _error_("usage error.");
     33                _error2_("usage error.");
    3434        }
    3535        return 1;
  • issm/branches/trunk-jpl-damage/src/c/python/io/FetchPythonData.cpp

    r12120 r12878  
    1515#include "../../include/include.h"
    1616#include "../../shared/shared.h"
     17#include "../../io/io.h"
    1718
    1819/*Primitive data types*/
    19 /*FUNCTION FetchData(double* pscalar,PyObject* py_float){{{1*/
     20/*FUNCTION FetchData(double* pscalar,PyObject* py_float){{{*/
    2021void FetchData(double* pscalar,PyObject* py_float){
    2122
     
    2930}
    3031/*}}}*/
    31 /*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{1*/
     32/*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{*/
    3233void FetchData(int* pinteger, PyObject* py_long){
    3334
     
    4142}
    4243/*}}}*/
    43 /*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{1*/
     44/*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{*/
    4445void FetchData(bool* pboolean,PyObject* py_boolean){
    4546
     
    4748       
    4849        /*check this is indeed a subtype of long type: */
    49         if(!PyBool_Check(py_boolean))_error_("expecting a boolean in input!");
     50        if(!PyBool_Check(py_boolean))_error2_("expecting a boolean in input!");
    5051
    5152        /*extract boolean: */
     
    5758}
    5859/*}}}*/
    59 /*FUNCTION FetchData(double** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{1*/
     60/*FUNCTION FetchData(double** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{*/
    6061void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_matrix){
    6162
     
    6869        /*retrive dimensions: */
    6970        ndim=PyArray_NDIM((const PyArrayObject*)py_matrix);
    70         if(ndim!=2)_error_("expecting an MxN matrix in input!");
     71        if(ndim!=2)_error2_("expecting an MxN matrix in input!");
    7172        dims=PyArray_DIMS((PyArrayObject*)py_matrix);
    7273        M=dims[0]; N=dims[1];
     
    8182}
    8283/*}}}*/
    83 /*FUNCTION FetchData(double** pvector,int* pM, PyObject* py_vector){{{1*/
     84/*FUNCTION FetchData(int** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{*/
     85void FetchData(int** pmatrix,int* pM,int *pN,PyObject* py_matrix){
     86
     87        /*output: */
     88        double* dmatrix=NULL;
     89        int* matrix=NULL;
     90        int M,N;
     91
     92        /*intermediary:*/
     93        int i;
     94        int ndim;
     95        npy_intp*  dims=NULL;
     96
     97        /*retrive dimensions: */
     98        ndim=PyArray_NDIM((const PyArrayObject*)py_matrix);
     99        if(ndim!=2)_error2_("expecting an MxN matrix in input!");
     100        dims=PyArray_DIMS((PyArrayObject*)py_matrix);
     101        M=dims[0]; N=dims[1];
     102       
     103        /*retrieve internal value: */
     104        dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix);
     105
     106        /*transform into integer matrix: */
     107        matrix=xNew<int>(M*N);
     108        for(i=0;i<M*N;i++)matrix[i]=(int)dmatrix[i];
     109
     110        /*output: */
     111        if(pM)*pM=M;
     112        if(pN)*pN=N;
     113        if(pmatrix)*pmatrix=matrix;
     114}
     115/*}}}*/
     116/*FUNCTION FetchData(double** pvector,int* pM, PyObject* py_vector){{{*/
    84117void FetchData(double** pvector,int* pM,PyObject* py_vector){
    85118
     
    92125        /*retrive dimensions: */
    93126        ndim=PyArray_NDIM((const PyArrayObject*)py_vector);
    94         if(ndim!=1)_error_("expecting an Mx1 vector in input!");
     127        if(ndim!=1)_error2_("expecting an Mx1 vector in input!");
    95128        dims=PyArray_DIMS((PyArrayObject*)py_vector);
    96129        M=dims[0];
     
    104137}
    105138/*}}}*/
     139/*FUNCTION FetchData(Options** poptions,int istart, int nrhs,PyObject* arguments){{{*/
     140void FetchData(Options** poptions,int istart, int nrhs,PyObject* arguments){
     141
     142        /*Initialize output*/
     143        Options* options=new Options();
     144
     145        _pprintLine_("FetchData for Options not implemented yet, ignoring them!");
     146
     147        /*Assign output pointers:*/
     148        *poptions=options;
     149
     150}
     151/*}}}*/
    106152
    107153/*Python version dependent: */
    108154#if _PYTHON_MAJOR_ >= 3
    109 /*FUNCTION FetchData(char** pstring,PyObject* py_unicode){{{1*/
     155/*FUNCTION FetchData(char** pstring,PyObject* py_unicode){{{*/
    110156void FetchData(char** pstring,PyObject* py_unicode){
    111157
     
    124170/*}}}*/
    125171#else
    126 /*FUNCTION FetchData(char** pstring,PyObject* py_string){{{1*/
     172/*FUNCTION FetchData(char** pstring,PyObject* py_string){{{*/
    127173void FetchData(char** pstring,PyObject* py_string){
    128174
  • issm/branches/trunk-jpl-damage/src/c/python/io/WritePythonData.cpp

    r12112 r12878  
    2121
    2222
    23 /*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{1*/
     23/*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{*/
    2424void WriteData(PyObject* py_tuple, int index, char* string){
    2525       
    2626        PyTuple_SetItem(py_tuple, index, PyUnicode_FromString(string));
    2727
    28 }
    29 /*}}}*/
    30 /*FUNCTION WriteData(PyObject* tuple,int index,Matrix* matrix){{{1*/
     28}/*}}}*/
     29/*FUNCTION WriteData(PyObject* tuple,int index,Matrix* matrix){{{*/
    3130void WriteData(PyObject* tuple,int index,Matrix* matrix){
    3231       
     
    4544
    4645
    47 }
    48 /*FUNCTION WriteData(PyObject* py_tuple,int index,Vector* vector){{{1*/
     46}/*}}}*/
     47/*FUNCTION WriteData(PyObject* py_tuple,int index,Vector* vector){{{*/
    4948void WriteData(PyObject* tuple,int index,Vector* vector){
    5049       
     
    6463}
    6564/*}}}*/
    66 /*FUNCTION WriteData(PyObject* py_tuple,int index, double* matrix, int M, int N){{{1*/
     65/*FUNCTION WriteData(PyObject* py_tuple,int index, double* matrix, int M, int N){{{*/
    6766void WriteData(PyObject* tuple, int index, double* matrix, int M,int N){
    6867       
     
    7675        PyTuple_SetItem(tuple, index, array);
    7776
    78 }
     77}/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/python/io/pythonio.h

    r12120 r12878  
    1313
    1414
    15 #include "../../objects/objects.h"
     15#include "../../classes/classes.h"
    1616#include "../../Container/Container.h"
    1717#include "../../include/include.h"
     
    4747void FetchData(double** pvector,int* pM,PyObject* py_ref);
    4848void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_array);
     49void FetchData(int** pmatrix,int* pM,int *pN,PyObject* py_matrix);
    4950void FetchData(char** pstring,PyObject* py_unicode);
    5051void FetchData(double* pscalar,PyObject* py_float);
    5152void FetchData(int* pinteger,PyObject* py_long);
    5253void FetchData(bool* pbool,PyObject* py_boolean);
     54void FetchData(Options** poptions,int istart, int nrhs,PyObject* arguments);
    5355
    5456int CheckNumPythonArguments(PyObject* inputs,int NRHS, void (*function)( void ));
  • issm/branches/trunk-jpl-damage/src/c/shared/Alloc/alloc.cpp

    r12168 r12878  
    2525#include "../Exceptions/exceptions.h"
    2626#include "../../include/include.h"
    27 #include "../../objects/objects.h"
     27#include "../../classes/objects/objects.h"
    2828
    2929void* xmalloc(int size){
     
    3131        void* memptr=NULL;
    3232
    33         if(!size)_error_(" attempting to 0 size allocation!");
     33        if(!size)_error2_("attempting to 0 size allocation!");
    3434
    3535        /* Use the c library to do the allocation: */
    3636        memptr=malloc(size);
    37         if(!memptr) _error_("memory allocation failed!");
     37        if(!memptr) _error2_("memory allocation failed!");
    3838
    3939        return memptr;
     
    4444        void* memptr=NULL;
    4545       
    46         if(!size)_error_("attempting to 0 size allocation!");
     46        if(!size)_error2_("attempting to 0 size allocation!");
    4747
    4848        /* Use the c library to do the allocation: */
    4949        memptr=calloc(n,size);
    50         if(!memptr) _error_("memory allocation failed!");
     50        if(!memptr) _error2_("memory allocation failed!");
    5151
    5252        return memptr;
     
    8484}
    8585
    86 
    8786void* xrealloc( void* pv, int size){
    8887       
    8988        register void* value=NULL;
    9089       
    91         if(!size)_error_("attempting to realloc to zero");
     90        if(!size)_error2_("attempting to realloc to zero");
    9291        value = (void*)realloc(pv,size);
    9392
    9493        if (value == NULL) {
    95                 _error_("virtual memory exhausted");
     94                _error2_("virtual memory exhausted");
    9695        }
    9796        return value;
  • issm/branches/trunk-jpl-damage/src/c/shared/Bamg/OppositeAngle.h

    r3913 r12878  
    22#define _OPPOSITEANGLE_H_
    33
    4 #include "../../objects/Bamg/include.h"
     4#include "../../classes/bamg/include.h"
    55
    66/*Return the opposite angle modulo 2 Pi*/
  • issm/branches/trunk-jpl-damage/src/c/shared/Bamg/det.h

    r5581 r12878  
    22#define _BAMGDET_H_
    33
    4 #include "../../objects/Bamg/include.h"
     4#include "../../classes/bamg/include.h"
    55
    66namespace bamg {
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/Arrhenius.cpp

    r7848 r12878  
    66#include <math.h>
    77
    8 double Arrhenius(double temperature,double depth,double n){
     8IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n){
    99        /*Use EISMINT Parameterization for the rheology: Payne2000
    1010         *
     
    2525
    2626        /*Some physical constants (Payne2000)*/
    27         double beta=8.66*pow(10.,-4.);
    28         double R=8.314;
     27        IssmDouble beta=8.66*pow(10.,-4.);
     28        IssmDouble R=8.314;
    2929
    3030        /*Intermediaries*/
    31         double A,B,Tstar;
     31        IssmDouble A,B,Tstar;
    3232
    3333        /*convert temperature to absolute temperature*/
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/CoordinateSystemTransform.cpp

    r10532 r12878  
    55#include <math.h>
    66
    7 void CoordinateSystemTransform(double** ptransform,Node** nodes,int numnodes,int* cs_array){
     7void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array){
    88
    99        int     i,counter;
    1010        int     numdofs           = 0;
    11         double  norm;
    12         double *transform         = NULL;
    13         double *values            = NULL;
    14         double  coord_system[3][3];
     11        IssmDouble  norm;
     12        IssmDouble *transform         = NULL;
     13        IssmDouble *values            = NULL;
     14        IssmDouble  coord_system[3][3];
    1515
    1616        /*Some checks in debugging mode*/
     
    2222                        case XYEnum:   numdofs+=2; break;
    2323                        case XYZPEnum: numdofs+=4; break;
    24                         default: _error_("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));
     24                        default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
    2525                }
    2626        }
    2727
    2828        /*Allocate and initialize transform matrix*/
    29         transform=(double*)xmalloc(numdofs*numdofs*sizeof(double));
     29        transform=xNew<IssmDouble>(numdofs*numdofs);
    3030        for(i=0;i<numdofs*numdofs;i++) transform[i]=0.0;
    3131
     
    6767                                break;
    6868                        default:
    69                                 _error_("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));
     69                                _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
    7070                }
    7171        }
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/GetGlobalDofList.cpp

    r10116 r12878  
    1414
    1515                /*Allocate:*/
    16                 ndof_list=(int*)xmalloc(numnodes*sizeof(int));
     16                ndof_list=xNew<int>(numnodes);
    1717
    1818                /*First, figure out size of doflist: */
     
    2525                if(numdof){
    2626                        /*Allocate: */
    27                         doflist=(int*)xmalloc(numdof*sizeof(int));
     27                        doflist=xNew<int>(numdof);
    2828
    2929                        /*Populate: */
     
    3737        }
    3838        /*Free ressources:*/
    39         xfree((void**)&ndof_list);
     39        xDelete<int>(ndof_list);
    4040
    4141        return doflist;
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/GetLocalDofList.cpp

    r10104 r12878  
    1313        if(numnodes){
    1414                /*allocate: */
    15                 ndof_list=(int*)xmalloc(numnodes*sizeof(int));
    16                 ngdof_list_cumulative=(int*)xmalloc(numnodes*sizeof(int));
     15                ndof_list=xNew<int>(numnodes);
     16                ngdof_list_cumulative=xNew<int>(numnodes);
    1717
    1818
     
    3333                if(numdof){
    3434                        /*Allocate: */
    35                         doflist=(int*)xmalloc(numdof*sizeof(int));
     35                        doflist=xNew<int>(numdof);
    3636
    3737                        /*Populate: */
     
    5555
    5656        /*Free ressources:*/
    57         xfree((void**)&ndof_list);
    58         xfree((void**)&ngdof_list_cumulative);
     57        xDelete<int>(ndof_list);
     58        xDelete<int>(ngdof_list_cumulative);
    5959
    6060        /*CLean-up and return*/
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/GetVerticesCoordinates.cpp

    r11197 r12878  
    55#include "./elements.h"
    66
    7 void GetVerticesCoordinates(double* xyz,  Node** nodes, int numvertices){
     7void GetVerticesCoordinates(IssmDouble* xyz,  Node** nodes, int numvertices){
    88
    99        /*In debugging mode, check that nodes is not a NULL pointer*/
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/Paterson.cpp

    r6966 r12878  
    77#include <math.h>
    88
    9 double Paterson(double temperature){
     9#include "../../include/include.h"
     10
     11IssmDouble Paterson(IssmDouble temperature){
    1012       
    1113        /*output: */
    12         double B;
    13         double T;
     14        IssmDouble B;
     15        IssmDouble T;
    1416
    1517        /*Switch to celsius from Kelvin: */
     
    3032
    3133        if(T<=-45.0){
    32                 B=pow((double)10,(double)8)*(-0.000292866376675*pow(T+50,3)+ 0.011672640664130*pow(T+50,2)  -0.325004442485481*(T+50)+  6.524779401948101);
     34                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+50,3)+ 0.011672640664130*pow(T+50,2)  -0.325004442485481*(T+50)+  6.524779401948101);
    3335        }
    3436        else if((T>=-45.0) && (T<=-40.0)){
    35                 B=pow((double)10,(double)8)*(-0.000292866376675*pow(T+45,3)+ 0.007279645014004*pow(T+45,2)  -0.230243014094813*(T+45)+  5.154964909039554);
     37                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+45,3)+ 0.007279645014004*pow(T+45,2)  -0.230243014094813*(T+45)+  5.154964909039554);
    3638        }
    3739        else if((T>=-40.0) && (T<=-35.0)){
    38                 B=pow((double)10,(double)8)*(0.000072737147457*pow(T+40,3)+  0.002886649363879*pow(T+40,2)  -0.179411542205399*(T+40)+  4.149132666831214);
     40                B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000072737147457*pow(T+40,3)+  0.002886649363879*pow(T+40,2)  -0.179411542205399*(T+40)+  4.149132666831214);
    3941        }
    4042        else if((T>=-35.0) && (T<=-30.0)){
    41                 B=pow((double)10,(double)8)*(-0.000086144770023*pow(T+35,3)+ 0.003977706575736*pow(T+35,2)  -0.145089762507325*(T+35)+  3.333333333333331);
     43                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000086144770023*pow(T+35,3)+ 0.003977706575736*pow(T+35,2)  -0.145089762507325*(T+35)+  3.333333333333331);
    4244        }
    4345        else if((T>=-30.0) && (T<=-25.0)){
    44                 B=pow((double)10,(double)8)*(-0.000043984685769*pow(T+30,3)+ 0.002685535025386*pow(T+30,2)  -0.111773554501713*(T+30)+  2.696559088937191);
     46                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000043984685769*pow(T+30,3)+ 0.002685535025386*pow(T+30,2)  -0.111773554501713*(T+30)+  2.696559088937191);
    4547        }
    4648        else if((T>=-25.0) && (T<=-20.0)){
    47                 B=pow((double)10,(double)8)*(-0.000029799523463*pow(T+25,3)+ 0.002025764738854*pow(T+25,2)  -0.088217055680511*(T+25)+  2.199331606342181);
     49                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000029799523463*pow(T+25,3)+ 0.002025764738854*pow(T+25,2)  -0.088217055680511*(T+25)+  2.199331606342181);
    4850        }
    4951        else if((T>=-20.0) && (T<=-15.0)){
    50                 B=pow((double)10,(double)8)*(0.000136920904777*pow(T+20,3)+  0.001578771886910*pow(T+20,2)  -0.070194372551690*(T+20)+  1.805165505978111);
     52                B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000136920904777*pow(T+20,3)+  0.001578771886910*pow(T+20,2)  -0.070194372551690*(T+20)+  1.805165505978111);
    5153        }
    5254        else if((T>=-15.0) && (T<=-10.0)){
    53                 B=pow((double)10,(double)8)*(-0.000899763781026*pow(T+15,3)+ 0.003632585458564*pow(T+15,2)  -0.044137585824322*(T+15)+  1.510778053489523);
     55                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000899763781026*pow(T+15,3)+ 0.003632585458564*pow(T+15,2)  -0.044137585824322*(T+15)+  1.510778053489523);
    5456        }
    5557        else if((T>=-10.0) && (T<=-5.0)){
    56                 B=pow((double)10,(double)8)*(0.001676964325070*pow(T+10,3)-  0.009863871256831*pow(T+10,2)  -0.075294014815659*(T+10)+  1.268434288203714);
     58                B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.001676964325070*pow(T+10,3)-  0.009863871256831*pow(T+10,2)  -0.075294014815659*(T+10)+  1.268434288203714);
    5759        }
    5860        else if((T>=-5.0) && (T<=-2.0)){
    59                 B=pow((double)10,(double)8)*(-0.003748937622487*pow(T+5,3)+0.015290593619213*pow(T+5,2)  -0.048160403003748*(T+5)+  0.854987973338348);
     61                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622487*pow(T+5,3)+0.015290593619213*pow(T+5,2)  -0.048160403003748*(T+5)+  0.854987973338348);
    6062        }
    6163        else if(T>=-2.0){
    62                 B=pow((double)10,(double)8)*(-0.003748937622488*pow(T+2,3)-0.018449844983174*pow(T+2,2)  -0.057638157095631*(T+2)+  0.746900791092860);
     64                B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622488*pow(T+2,3)-0.018449844983174*pow(T+2,2)  -0.057638157095631*(T+2)+  0.746900791092860);
    6365        }
    6466
    6567        /*B cannot be negative!*/
    66         if(B<0) B=pow((double)10,(double)6);
     68        if(B<0) B=pow((IssmPDouble)10,(IssmPDouble)6);
    6769
    6870        return B;
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp

    r10529 r12878  
    99
    1010        /*All nodes have the same Coordinate System*/
    11         cs_array=(int*)xmalloc(numnodes*sizeof(int));
     11        cs_array=xNew<int>(numnodes);
    1212        for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
    1313
     
    1616
    1717        /*Clean-up*/
    18         xfree((void**)&cs_array);
     18        xDelete<int>(cs_array);
    1919}
    2020
     
    2323        int     i,j;
    2424        int     numdofs   = 0;
    25         double *transform = NULL;
    26         double *values    = NULL;
     25        IssmDouble *transform = NULL;
     26        IssmDouble *values    = NULL;
    2727
    2828        /*Get total number of dofs*/
     
    3131                        case XYEnum:   numdofs+=2; break;
    3232                        case XYZPEnum: numdofs+=4; break;
    33                         default: _error_("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));
     33                        default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
    3434                }
    3535        }
    3636
    3737        /*Copy current stiffness matrix*/
    38         values=(double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));
     38        values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
    3939        for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j];
    4040
     
    4949
    5050        /*Free Matrix*/
    51         xfree((void**)&transform);
    52         xfree((void**)&values);
     51        xDelete<IssmDouble>(transform);
     52        xDelete<IssmDouble>(values);
    5353}
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformLoadVectorCoord.cpp

    r10523 r12878  
    88
    99        /*All nodes have the same Coordinate System*/
    10         cs_array=(int*)xmalloc(numnodes*sizeof(int));
     10        cs_array=xNew<int>(numnodes);
    1111        for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
    1212
     
    1515
    1616        /*Clean-up*/
    17         xfree((void**)&cs_array);
     17        xDelete<int>(cs_array);
    1818}
    1919
     
    2222        int     i,j;
    2323        int     numdofs   = 0;
    24         double *transform = NULL;
    25         double *values    = NULL;
     24        IssmDouble *transform = NULL;
     25        IssmDouble *values    = NULL;
    2626
    2727        /*Get total number of dofs*/
     
    3030                        case XYEnum:   numdofs+=2; break;
    3131                        case XYZPEnum: numdofs+=4; break;
    32                         default: _error_("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));
     32                        default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
    3333                }
    3434        }
    3535
    3636        /*Copy current load vector*/
    37         values=(double*)xmalloc(pe->nrows*sizeof(double));
     37        values=xNew<IssmDouble>(pe->nrows);
    3838        for(i=0;i<pe->nrows;i++) values[i]=pe->values[i];
    3939
     
    4646                                &pe->values[0],0);
    4747
    48         /*Free Matrix*/
    49         xfree((void**)&transform);
    50         xfree((void**)&values);
     48        /*Free Matrices*/
     49        xDelete<IssmDouble>(transform);
     50        xDelete<IssmDouble>(values);
    5151}
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformSolutionCoord.cpp

    r10523 r12878  
    44#include "./elements.h"
    55
    6 void TransformSolutionCoord(double* solution,Node** nodes,int numnodes,int cs_enum){
     6void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum){
    77
    88        int* cs_array=NULL;
    99
    1010        /*All nodes have the same Coordinate System*/
    11         cs_array=(int*)xmalloc(numnodes*sizeof(int));
     11        cs_array=xNew<int>(numnodes);
    1212        for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
    1313
     
    1616
    1717        /*Clean-up*/
    18         xfree((void**)&cs_array);
     18        xDelete<int>(cs_array);
    1919}
    2020
    21 void TransformSolutionCoord(double* solution,Node** nodes,int numnodes,int* cs_array){
     21void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array){
    2222
    2323        int     i,j;
    2424        int     numdofs   = 0;
    25         double *transform = NULL;
    26         double *values    = NULL;
     25        IssmDouble *transform = NULL;
     26        IssmDouble *values    = NULL;
    2727
    2828        /*Get total number of dofs*/
     
    3131                        case XYEnum:   numdofs+=2; break;
    3232                        case XYZPEnum: numdofs+=4; break;
    33                         default: _error_("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));
     33                        default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
    3434                }
    3535        }
    3636
    3737        /*Copy current solution vector*/
    38         values=(double*)xmalloc(numdofs*sizeof(double));
     38        values=xNew<IssmDouble>(numdofs);
    3939        for(i=0;i<numdofs;i++) values[i]=solution[i];
    4040
     
    4747                                &solution[0],0);
    4848
    49         /*Free Matrix*/
    50         xfree((void**)&transform);
    51         xfree((void**)&values);
     49        /*Free Matrices*/
     50        xDelete<IssmDouble>(transform);
     51        xDelete<IssmDouble>(values);
    5252}
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformStiffnessMatrixCoord.cpp

    r10523 r12878  
    99
    1010        /*All nodes have the same Coordinate System*/
    11         cs_array=(int*)xmalloc(numnodes*sizeof(int));
     11        cs_array=xNew<int>(numnodes);
    1212        for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
    1313
     
    1616
    1717        /*Clean-up*/
    18         xfree((void**)&cs_array);
     18        xDelete<int>(cs_array);
    1919}
    2020
     
    2323        int     i,j;
    2424        int     numdofs   = 0;
    25         double *transform = NULL;
    26         double *values    = NULL;
     25        IssmDouble *transform = NULL;
     26        IssmDouble *values    = NULL;
    2727
    2828        /*Get total number of dofs*/
     
    3131                        case XYEnum:   numdofs+=2; break;
    3232                        case XYZPEnum: numdofs+=4; break;
    33                         default: _error_("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));
     33                        default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet");
    3434                }
    3535        }
    3636
    3737        /*Copy current stiffness matrix*/
    38         values=(double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));
     38        values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
    3939        for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j];
    4040
     
    4949
    5050        /*Free Matrix*/
    51         xfree((void**)&transform);
    52         xfree((void**)&values);
     51        xDelete<IssmDouble>(transform);
     52        xDelete<IssmDouble>(values);
    5353}
  • issm/branches/trunk-jpl-damage/src/c/shared/Elements/elements.h

    r12258 r12878  
    44
    55#ifndef _SHARED_ELEMENTS_H_
    6 #define  _SHARED_ELEMENTS_H_
     6#define _SHARED_ELEMENTS_H_
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99#include "../../Container/Container.h"
    1010class ElementMatrix;
    1111class ElementVector;
    1212
    13 double Paterson(double temperature);
    14 double Arrhenius(double temperature,double depth,double n);
    15 void   GetVerticesCoordinates(double* xyz,  Node** nodes, int numvertices);
     13IssmDouble Paterson(IssmDouble temperature);
     14IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n);
     15IssmDouble PddSurfaceMassBlance(IssmDouble* monthlytemperatures,  IssmDouble* monthlyprec, IssmDouble* pdds, IssmDouble* pds,
     16                                IssmDouble signorm, IssmDouble yts, IssmDouble h, IssmDouble s, IssmDouble rho_ice, IssmDouble rho_water);
     17void ComputeDelta18oTemperaturePrecipitation(IssmDouble Delta18oSurfacePresent, IssmDouble Delta18oSurfaceLgm, IssmDouble Delta18oSurfaceTime,
     18                                     IssmDouble Delta18oPresent, IssmDouble Delta18oLgm, IssmDouble Delta18oTime,
     19                                     IssmDouble* PrecipitationsPresentday,
     20                                     IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday,
     21                                             IssmDouble* monthlytemperaturesout, IssmDouble* monthlyprecout);
     22void   GetVerticesCoordinates(IssmDouble* xyz,  Node** nodes, int numvertices);
    1623int    GetNumberOfDofs( Node** nodes,int numnodes,int setenum,int approximation_enum);
    1724int*   GetLocalDofList( Node** nodes,int numnodes,int setenum,int approximation_enum);
    1825int*   GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation_enum);
     26
    1927#ifdef _HAVE_DIAGNOSTIC_
    20 void   CoordinateSystemTransform(double** ptransform,Node** nodes,int numnodes,int* cs_array);
     28void   CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array);
    2129void   TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum);
    2230void   TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array);
     
    2533void   TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int cs_enum);
    2634void   TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int* cs_array);
    27 void   TransformSolutionCoord(double* solution,Node** nodes,int numnodes,int cs_enum);
    28 void   TransformSolutionCoord(double* solution,Node** nodes,int numnodes,int* cs_array);
     35void   TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum);
     36void   TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array);
    2937#endif
    3038
    31 inline void printarray(double* array,int lines,int cols=1){
    32         printf("\n");
    33         for(int i=0;i<lines;i++){ 
    34                 printf("   [ ");
    35                 for(int j=0;j<cols;j++) printf(" %12.7g ",array[i*cols+j]);
    36                 printf(" ]\n");
    37         } 
    38         printf("\n");
    39 }
    40 inline void printarray(int* array,int lines,int cols=1){
    41         printf("\n");
    42         for(int i=0;i<lines;i++){ 
    43                 printf("   [ ");
    44                 for(int j=0;j<cols;j++) printf(" %6i",array[i*cols+j]);
    45                 printf(" ]\n");
    46         } 
    47         printf("\n");
    48 }
    49 inline void printbinary(int n) {
    50         unsigned int i=1L<<(sizeof(n)*8-1);
    51 
    52         while (i>0) {
    53                 if (n&i)
    54                  printf("1");
    55                 else
    56                  printf("0");
    57                 i>>=1;
    58         }
    59 }
    60 
     39/*Print arrays*/
     40void printarray(IssmPDouble* array,int lines,int cols=1);
     41void printarray(int* array,int lines,int cols=1);
     42void printbinary(int n);
    6143#endif //ifndef _SHARED_ELEMENTS_H_
  • issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/Exceptions.cpp

    r12168 r12878  
    2020}
    2121
    22 ErrorException::ErrorException(string what_file,string what_function,int what_line,string what_arg){
     22ErrorException::ErrorException(const string& what_file, const string& what_function,int what_line, const string& what_arg){
    2323
    2424        what_str=what_arg;
     
    4444
    4545        if (function_name=="" || file_line==0){ //WINDOWS
    46                 printf("%s%s","Error message: ",what());
     46                _printString_("Error message: " << what());
    4747        }
    4848        else{
    4949                if(num_procs==1){
    50                         printf("\n??? Error using ==> %s:%i\n",file_name.c_str(),file_line);
    51                         printf("%s error message: %s\n\n",function_name.c_str(),what());
     50                        _printLine_("\n??? Error using ==> " << file_name.c_str() << ":" << file_line);
     51                        _printLine_(function_name.c_str() << " error message: " << what() << "\n");
    5252                }
    5353                else{
    54                         printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line);
    55                         printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what());
     54                        _printLine_("\n[" << my_rank << "] ??? Error using ==> " << file_name.c_str() << ":" << file_line);
     55                        _printLine_("[" << my_rank << "] " << function_name.c_str() << " error message: " << what() << "\n");
    5656                }
    5757        }
  • issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/exceptions.h

    r12168 r12878  
    2424        public:
    2525        ErrorException(const string &what_arg); //for windows
    26         ErrorException(string what_file,string what_function,int what_line,string what_arg);//UNIX
     26        ErrorException(const string&  what_file,const string& what_function,int what_line,const string& what_arg);//UNIX
    2727        ~ErrorException() throw();
    2828        virtual const char *what() const throw();
  • issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/exprintf.cpp

    r11199 r12878  
    99#include <stdarg.h>
    1010#include <stdio.h>
     11#include "../Alloc/xNewDelete.h"
    1112#include "../Alloc/alloc.h"
    1213
     
    1415
    1516        /*returned string: */
    16         char* string=NULL;
     17        char *buffer = NULL;
     18        int   n,size = 100;
     19        int   string_size;
    1720
    18         /*Assum nobody will print more that 1024 characters!*/
    19         string=(char*)xmalloc(1024*sizeof(char));//assume that nobody will print more than 1024 characters at once.
    20                                                                                                                                                                                                      
    2121        //variable list of arguments
    22         va_list ap;
     22        va_list args;
    2323
    24         //First use vsprintf to get the whole input string.
    25         va_start(ap,format);
    26         vsprintf(string,format,ap); //printf style coding
    27         va_end(ap);
     24        while(true){
    2825
    29         return string;
     26                /*allocate buffer for given string size*/
     27                buffer=xNew<char>(size);
     28
     29                /* Try to print in the allocated space. */
     30                va_start(args, format);
     31#ifndef WIN32
     32                n=vsnprintf(buffer,size,format,args);
     33#else
     34                n=vsnprintf(buffer,size,format,args);
     35#endif
     36                va_end(args);
     37
     38                /* If that worked, return the string. */
     39                if(n>-1 && n<size) break;
     40
     41                /* Else try again with more space. */
     42                if(n>-1)   /* glibc 2.1 */
     43                 size=n+1; /* precisely what is needed */
     44                else       /* glibc 2.0 */
     45                 size*=2;  /* twice the old size */
     46
     47                xDelete<char>(buffer);
     48        }
     49
     50        return buffer;
    3051}
  • issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineRead.cpp

    r12168 r12878  
    77
    88#include <stdio.h>
     9#include <cstring>
    910#include "../Alloc/alloc.h"
    1011#include "../../include/include.h"
    11 #include "../../objects/objects.h"
     12#include "../../classes/classes.h"
    1213#include "../Exceptions/exceptions.h"
    1314#include "../../Container/DataSet.h"
     
    1920
    2021        /*I/O: */
    21         FILE* fid=NULL;
    22         char chardummy[256];
     22        FILE   *fid = NULL;
     23        char    chardummy[256];
    2324        double  ddummy;
    2425
    2526        /*output: */
    26         int nprof; //number of profiles in the domainname file
    27         int* profnvertices=NULL; //array holding the number of vertices for the nprof profiles
    28         double** pprofx=NULL; //array of profiles x coordinates
    29         double** pprofy=NULL; //array of profiles y coordinates
    30         bool* closed=NULL; //array holding closed flags for the nprof profiles
     27        int      nprof;                //number of profiles in the domainname file
     28        int     *profnvertices = NULL; //array holding the number of vertices for the nprof profiles
     29        double **pprofx        = NULL; //array of profiles x coordinates
     30        double **pprofy        = NULL; //array of profiles y coordinates
     31        bool    *closed        = NULL; //array holding closed flags for the nprof profiles
    3132
    3233        /*For each profile: */
    33         int n;
    34         double* x=NULL;
    35         double* y=NULL;
    36         bool cl;
     34        int     n;
     35        double *x  = NULL;
     36        double *y  = NULL;
     37        bool    cl;
    3738
    3839        /*open domain outline file for reading: */
    3940        if ((fid=fopen(domainname,"r"))==NULL){
    40                 _error_("%s%s","could not find domain file ",domainname);
     41                _error2_("could not find domain file " << domainname);
    4142        }
    4243
     
    6162       
    6263        /*Allocate and initialize all the profiles: */
    63         profnvertices=(int*)xmalloc(nprof*sizeof(int));
    64         pprofx=(double**)xmalloc(nprof*sizeof(double*));
    65         pprofy=(double**)xmalloc(nprof*sizeof(double*));
     64        profnvertices=xNew<int>(nprof);
     65        pprofx=xNew<double*>(nprof);
     66        pprofy=xNew<double*>(nprof);
    6667        for (i=0;i<nprof;i++){
    6768                pprofx[i]=NULL;
    6869                pprofy[i]=NULL;
    6970        }
    70         closed=(bool*)xmalloc(nprof*sizeof(bool));
     71        closed=xNew<bool>(nprof);
    7172
    7273        /*Reaset file pointer to beginning of file: */
     
    8889
    8990                /*Allocate vertices: */
    90                 x=(double*)xmalloc(n*sizeof(double));
    91                 y=(double*)xmalloc(n*sizeof(double));
     91                x=xNew<double>(n);
     92                y=xNew<double>(n);
    9293               
    93 
    9494                /*Read vertices: */
    9595                for (i=0;i<n;i++){
     
    118118        *ppprofx=pprofx;
    119119        *ppprofy=pprofy;
    120         if(pclosed)*pclosed=closed;
    121         else       xfree((void**)&closed);
     120        if(pclosed)
     121         *pclosed=closed;
     122        else
     123         xDelete<bool>(closed);
    122124}
    123125
  • issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineWrite.cpp

    r12168 r12878  
    2323        /*open domain outline file for writing: */
    2424        if ((fid=fopen(domainname,"w"))==NULL){
    25                 _error_("%s%s","could not open domain file ",domainname);
     25                _error2_("could not open domain file " << domainname);
    2626                noerr=0; goto cleanupandreturn;
    2727        }
  • issm/branches/trunk-jpl-damage/src/c/shared/Exp/IsInPoly.cpp

    r11708 r12878  
    1414#endif
    1515
    16 /*IsInPoly {{{1*/
     16/*IsInPoly {{{*/
    1717int IsInPoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){
    1818
     
    5555         return 1;
    5656}/*}}}*/
    57 /*IsOutsidePoly {{{1*/
     57/*IsOutsidePoly {{{*/
    5858int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){
    5959
     
    9696        return 1;
    9797}/*}}}*/
    98 /*pnpoly{{{1*/
     98/*pnpoly{{{*/
    9999int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue) {
    100100        int i, j, c = 0;
  • issm/branches/trunk-jpl-damage/src/c/shared/Exp/exp.h

    r12168 r12878  
    77#define _EXP_H_
    88
    9 #include "../../objects/objects.h"
     9#include "../../classes/objects/objects.h"
    1010#include "../../toolkits/toolkits.h"
    1111
  • issm/branches/trunk-jpl-damage/src/c/shared/Matrix/MatrixUtils.cpp

    r12004 r12878  
    44
    55/*Headers*/
    6 /*{{{1*/
     6/*{{{*/
    77#include "./matrix.h"
    88#include "../Exceptions/exceptions.h"
     
    1616/*}}}*/
    1717
    18 /*FUNCTION TripleMultiply {{{1*/
    19 int TripleMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int nrowc, int ncolc, int itrnc, double* d, int iaddd){
     18/*FUNCTION TripleMultiply {{{*/
     19int TripleMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int nrowc, int ncolc, int itrnc, IssmDouble* d, int iaddd){
    2020        /*TripleMultiply    Perform triple matrix product a*b*c+d.*/
    2121       
    2222        int idima,idimb,idimc,idimd;
    23         double* dtemp;
     23        IssmDouble* dtemp;
    2424
    2525/*  set up dimensions for triple product  */
     
    3636        if (!itrnb) {
    3737                if (nrowb != idimb) {
    38                         _error_("Matrix A and B inner vectors not equal size.");
     38                        _error2_("Matrix A and B inner vectors not equal size.");
    3939                }
    4040                idimc=ncolb;
     
    4242        else {
    4343                if (ncolb != idimb) {
    44                         _error_("Matrix A and B inner vectors not equal size.");
     44                        _error2_("Matrix A and B inner vectors not equal size.");
    4545                }
    4646                idimc=nrowb;
     
    4949        if (!itrnc) {
    5050                if (nrowc != idimc) {
    51                         _error_("Matrix B and C inner vectors not equal size.");
     51                        _error2_("Matrix B and C inner vectors not equal size.");
    5252                }
    5353                idimd=ncolc;
     
    5555        else {
    5656                if (ncolc != idimc) {
    57                         _error_("Matrix B and C inner vectors not equal size.");
     57                        _error2_("Matrix B and C inner vectors not equal size.");
    5858                }
    5959                idimd=nrowc;
     
    6262/*  perform the matrix triple product in the order that minimizes the
    6363        number of multiplies and the temporary space used, noting that
    64         (a*b)*c requires ac(b+d) multiplies and ac doubles, and a*(b*c)
    65         requires bd(a+c) multiplies and bd doubles (both are the same for
     64        (a*b)*c requires ac(b+d) multiplies and ac IssmDoubles, and a*(b*c)
     65        requires bd(a+c) multiplies and bd IssmDoubles (both are the same for
    6666        a symmetric triple product)  */
    6767
     
    6969
    7070        if (idima*idimc*(idimb+idimd) <= idimb*idimd*(idima+idimc)) {
    71                 dtemp=(double *) xmalloc(idima*idimc*sizeof(double));
    72 
    73                 MatrixMultiply(a    ,nrowa,ncola,itrna,
    74                                    b    ,nrowb,ncolb,itrnb,
    75                                    dtemp,0);
    76                 MatrixMultiply(dtemp,idima,idimc,0    ,
    77                                    c    ,nrowc,ncolc,itrnc,
    78                                    d    ,iaddd);
    79 
    80                 xfree((void **)&dtemp);
     71                dtemp=xNew<IssmDouble>(idima*idimc);
     72
     73                MatrixMultiply(a,nrowa,ncola,itrna,b,nrowb,ncolb,itrnb,dtemp,0);
     74                MatrixMultiply(dtemp,idima,idimc,0,c,nrowc,ncolc,itrnc,d,iaddd);
     75                xDelete<IssmDouble>(dtemp);
    8176        }
    8277
     
    8479
    8580        else {
    86                 dtemp=(double *) xmalloc(idimb*idimd*sizeof(double));
    87 
    88                 MatrixMultiply(b    ,nrowb,ncolb,itrnb,
    89                                    c    ,nrowc,ncolc,itrnc,
    90                                    dtemp,0);
    91                 MatrixMultiply(a    ,nrowa,ncola,itrna,
    92                                    dtemp,idimb,idimd,0    ,
    93                                    d    ,iaddd);
    94 
    95                 xfree((void **)&dtemp);
     81                dtemp=xNew<IssmDouble>(idimb*idimd);
     82
     83                MatrixMultiply(b,nrowb,ncolb,itrnb,c,nrowc,ncolc,itrnc,dtemp,0);
     84                MatrixMultiply(a,nrowa,ncola,itrna,dtemp,idimb,idimd,0,d,iaddd);
     85                xDelete<IssmDouble>(dtemp);
    9686        }
    9787
    9888        return 1;
    9989}/*}}}*/
    100 /*FUNCTION MatrixMuliply {{{1*/
    101 int MatrixMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int iaddc ){
     90/*FUNCTION MatrixMuliply {{{*/
     91int MatrixMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int iaddc ){
    10292        /*MatrixMultiply    Perform matrix multiplication a*b+c.*/
    10393        int noerr=1;
     
    134124
    135125        if (ntrma != ntrmb) {
    136                 _error_("Matrix A and B inner vectors not equal size");
     126                _error2_("Matrix A and B inner vectors not equal size");
    137127            noerr=0;   
    138128                return noerr;
     
    167157        return noerr;
    168158}/*}}}*/
    169 /*FUNCTION MatrixInverse {{{1*/
    170 int MatrixInverse( double* a, int ndim, int nrow, double* b, int nvec, double* pdet ){
     159/*FUNCTION MatrixInverse {{{*/
     160int MatrixInverse( IssmDouble* a, int ndim, int nrow, IssmDouble* b, int nvec, IssmDouble* pdet ){
    171161/* MatrixInverse    Perform matrix inversion and linear equation solution.
    172162
     
    181171        int noerr=1;
    182172        int i,j,k,ipt,jpt,irow,icol,ipiv,ncol;
    183         int (*pivrc)[2],*pindx;
    184         double pivot,det,dtemp;
     173        int *pivrc1,*pivrc2,*pindx;
     174        IssmDouble pivot,det,dtemp;
    185175
    186176        if (!b && nvec) {
    187                 _error_("No right-hand side for nvec=%d.",nvec);
     177                _error2_("No right-hand side for nvec=" << nvec << ".");
    188178                noerr=0;
    189179                return noerr;
     
    198188        ncol=nrow;
    199189        det=1.;
    200 
    201         pivrc = (int (*)[2]) xmalloc((nrow*2)*sizeof(int));
    202         pindx = (int (*)   ) xcalloc( nrow   ,sizeof(int));
     190        pivrc1 =xNew<int>(nrow);
     191        pivrc2 =xNew<int>(nrow);
     192        pindx =xNew<int>(nrow);
    203193
    204194/*  loop over the rows/columns of the matrix  */
     
    221211
    222212                if (fabs(pivot) < DBL_EPSILON) {
    223                         xfree((void **)&pivrc);
    224                         xfree((void **)&pindx);
    225                         _error_("Pivot %f less than machine epsilon",pivot);
     213                        xDelete<int>(pivrc1);
     214                        xDelete<int>(pivrc2);
     215                        xDelete<int>(pindx);
     216                        _error2_("Pivot " << pivot << " less than machine epsilon");
    226217                        noerr=0;
    227218                        return noerr;
    228219                }
    229220
    230                 pivrc[i][0]=irow;
    231                 pivrc[i][1]=icol;
     221                pivrc1[i]=irow;
     222                pivrc2[i]=icol;
    232223
    233224                ipiv=icol;
     
    319310                j=(nrow-1)-i;
    320311
    321                 if (pivrc[j][0] != pivrc[j][1]) {
    322                         irow=pivrc[j][0];
    323                         icol=pivrc[j][1];
     312                if (pivrc1[j] != pivrc2[j]) {
     313                        irow=pivrc1[j];
     314                        icol=pivrc2[j];
    324315
    325316//                      _printf_(true,"column switch back for j=%d: irow=%d, icol=%d\n",
     
    336327        }
    337328
    338         if (pdet)
    339                 *pdet=det;
    340 
    341         xfree((void **)&pivrc);
    342         xfree((void **)&pindx);
    343 
     329        if (pdet) *pdet=det;
     330        xDelete<int>(pivrc1);
     331        xDelete<int>(pivrc2);
     332        xDelete<int>(pindx);
    344333        return noerr;
    345334}/*}}}*/
    346 /*FUNCTION Matrix2x2Determinant(double* Adet,double* A) {{{1*/
    347 void Matrix2x2Determinant(double* Adet,double* A){
     335/*FUNCTION Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A) {{{*/
     336void Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A){
    348337        /*Compute determinant of a 2x2 matrix*/
    349338
     
    352341}
    353342/*}}}*/
    354 /*FUNCTION Matrix2x2Invert(double* Ainv,double* A) {{{1*/
    355 void Matrix2x2Invert(double* Ainv,double* A){
     343/*FUNCTION Matrix2x2Invert(IssmDouble* Ainv,IssmDouble* A) {{{*/
     344void Matrix2x2Invert(IssmDouble* Ainv,IssmDouble* A){
    356345
    357346        /*Intermediaries*/
    358         double det;
     347        IssmDouble det;
    359348
    360349        /*Compute determinant*/
    361350        Matrix2x2Determinant(&det,A);
    362         if (fabs(det) < DBL_EPSILON) _error_("Determinant smaller that machine epsilon");
     351        if (fabs(det) < DBL_EPSILON) _error2_("Determinant smaller that machine epsilon");
    363352
    364353        /*Compute invert*/
     
    369358
    370359}/*}}}*/
    371 /*FUNCTION Matrix3x3Determinant(double* Adet,double* A) {{{1*/
    372 void Matrix3x3Determinant(double* Adet,double* A){
     360/*FUNCTION Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A) {{{*/
     361void Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A){
    373362        /*Compute determinant of a 3x3 matrix*/
    374363
     
    377366}
    378367/*}}}*/
    379 /*FUNCTION Matrix3x3Invert(double* Ainv,double* A) {{{1*/
    380 void Matrix3x3Invert(double* Ainv,double* A){
     368/*FUNCTION Matrix3x3Invert(IssmDouble* Ainv,IssmDouble* A) {{{*/
     369void Matrix3x3Invert(IssmDouble* Ainv,IssmDouble* A){
    381370
    382371        /*Intermediaries*/
    383         double det;
     372        IssmDouble det;
    384373
    385374        /*Compute determinant*/
    386375        Matrix3x3Determinant(&det,A);
    387         if (fabs(det) < DBL_EPSILON) _error_("Determinant smaller that machine epsilon");
     376        if (fabs(det) < DBL_EPSILON) _error2_("Determinant smaller that machine epsilon");
    388377
    389378        /*Compute invert*/
     
    399388
    400389}/*}}}*/
    401 /*FUNCTION MatrixTranspose(double* Adet,double* A) {{{1*/
    402 void MatrixTranspose(double* tA,double* A, int nrows, int ncols){
     390/*FUNCTION MatrixTranspose(IssmDouble* Adet,IssmDouble* A) {{{*/
     391void MatrixTranspose(IssmDouble* tA,IssmDouble* A, int nrows, int ncols){
    403392        /*Transpose a n*m matrix*/
    404393
  • issm/branches/trunk-jpl-damage/src/c/shared/Matrix/matrix.h

    r5371 r12878  
    66#define _MATRIXUTILS_H_
    77
    8 int  TripleMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int nrowc, int ncolc, int itrnc, double* d, int iaddd);
    9 int  MatrixMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int iaddc );
    10 int  MatrixInverse( double* a, int ndim, int nrow, double* b, int nvec, double* pdet );
    11 void Matrix2x2Invert(double* Ainv, double* A);
    12 void Matrix2x2Determinant(double* Adet,double* A);
    13 void Matrix3x3Invert(double* Ainv, double* A);
    14 void Matrix3x3Determinant(double* Adet,double* A);
    15 void MatrixTranspose(double* tA,double* A,int nrows, int ncols);
     8#include "../../include/include.h"
     9
     10int  TripleMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int nrowc, int ncolc, int itrnc, IssmDouble* d, int iaddd);
     11int  MatrixMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int iaddc );
     12int  MatrixInverse( IssmDouble* a, int ndim, int nrow, IssmDouble* b, int nvec, IssmDouble* pdet );
     13void Matrix2x2Invert(IssmDouble* Ainv, IssmDouble* A);
     14void Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A);
     15void Matrix3x3Invert(IssmDouble* Ainv, IssmDouble* A);
     16void Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A);
     17void MatrixTranspose(IssmDouble* tA,IssmDouble* A,int nrows, int ncols);
    1618
    1719#endif //ifndef _MATRIXUTILS_H_
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/BrentSearch.cpp

    r9761 r12878  
    1010
    1111#include "./numerics.h"
    12 #include "../../objects/objects.h"
     12#include "../../classes/objects/objects.h"
    1313#include "../../include/include.h"
    1414#include "../../io/io.h"
    1515#include "../../shared/shared.h"
    1616#include <float.h>
    17 
    18 void BrentSearch(double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs){
     17#include <iomanip>
     18
     19void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){
    1920
    2021        /* This routine is optimizing a given function using Brent's method
     
    2223
    2324        /*Intermediary*/
    24         double si,gold,intervalgold,oldintervalgold;
    25         double parab_num,parab_den;
    26         double distance,cm_jump;
    27         double fxmax,fxmin,fxbest;
    28         double fx,fx1,fx2;
    29         double xmax,xmin,xbest;
    30         double x,x1,x2,xm;
    31         double tol1,tol2,seps;
    32         double tolerance=1.e-4;
    33         int    maxiter,iter;
    34         bool   loop=true,goldenflag;
     25        IssmDouble si,gold,intervalgold,oldintervalgold;
     26        IssmDouble parab_num,parab_den;
     27        IssmDouble distance,cm_jump;
     28        IssmDouble fxmax,fxmin,fxbest;
     29        IssmDouble fx,fx1,fx2;
     30        IssmDouble xmax,xmin,xbest;
     31        IssmDouble x,x1,x2,xm;
     32        IssmDouble tol1,tol2,seps;
     33        IssmDouble tolerance = 1.e-4;
     34        int        maxiter ,iter;
     35        bool       loop= true,goldenflag;
    3536
    3637        /*Recover parameters:*/
     
    4344        iter=0;
    4445        fxmin = (*f)(xmin,optargs);
    45         if (isnan(fxmin)) _error_("Function evaluation returned NaN");
    46         _printf_(VerboseControl(),"\n        Iteration         x           f(x)       Tolerance         Procedure\n\n");
    47         _printf_(VerboseControl(),"        %s    %12.6g  %12.6g  %s","   N/A",xmin,fxmin,"         N/A         boundary\n");
     46        if (xIsNan<IssmDouble>(fxmin)) _error2_("Function evaluation returned NaN");
     47        cout<<setprecision(5);
     48        if(VerboseControl()) _pprintLine_("");
     49        if(VerboseControl()) _pprintLine_("       Iteration         x           f(x)       Tolerance         Procedure");
     50        if(VerboseControl()) _pprintLine_("");
     51        if(VerboseControl()) _pprintLine_("           N/A    "<<setw(12)<<xmin<<"  "<<setw(12)<<fxmin<<"           N/A         boundary");
    4852        fxmax = (*f)(xmax,optargs);
    49         if (isnan(fxmax)) _error_("Function evaluation returned NaN");
    50         _printf_(VerboseControl(),"        %s    %12.6g  %12.6g  %s","   N/A",xmax,fxmax,"         N/A         boundary\n");
     53        if (xIsNan<IssmDouble>(fxmax)) _error2_("Function evaluation returned NaN");
     54        if(VerboseControl()) _pprintLine_("           N/A    "<<setw(12)<<xmax<<"  "<<setw(12)<<fxmax<<"           N/A         boundary");
    5155
    5256        /*test if jump option activated and xmin==0*/
    53         if (!isnan(cm_jump) && (xmin==0) && (fxmax/fxmin)<cm_jump){
     57        if (!xIsNan<IssmDouble>(cm_jump) && (xmin==0) && (fxmax/fxmin)<cm_jump){
    5458                *psearch_scalar=xmax;
    5559                *pJ=fxmax;
     
    5862
    5963        /*initialize optimization variables*/
    60         seps=sqrt(DBL_EPSILON);    //precision of a double
     64        seps=sqrt(DBL_EPSILON);    //precision of a IssmDouble
    6165        distance=0.0;              //new_x=old_x + distance
    6266        gold=0.5*(3.0-sqrt(5.0));  //gold = 1 - golden ratio
     
    7175        /*2: call the function to be evaluated*/
    7276        fxbest = (*f)(x,optargs);
    73         if(isnan(fxbest)) _error_("Function evaluation returned NaN");
     77        if(xIsNan<IssmDouble>(fxbest)) _error2_("Function evaluation returned NaN");
    7478        iter=iter+1;
    7579
     
    8488
    8589        /*4: print result*/
    86         _printf_(VerboseControl(),"         %5i    %12.6g  %12.6g  %12.6g  %s\n",iter,xbest,fxbest,pow(pow(xbest-xm,2),0.5),"       initial");
    87         if (!isnan(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){
    88                 _printf_(VerboseControl(),"      optimization terminated: current x satisfies criteria 'cm_jump'=%g\n",cm_jump);
     90        if(VerboseControl())
     91         _pprintLine_("         "<<setw(5)<<iter<<"    "<<setw(12)<<xbest<<"  "<<setw(12)<<fxbest<<"  "<<setw(12)<<pow(pow(xbest-xm,2),0.5)<<"         initial");
     92        if (!xIsNan<IssmDouble>(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){
     93                if(VerboseControl()) _pprintLine_("      optimization terminated: current x satisfies criteria 'cm_jump'=" << cm_jump);
    8994                loop=false;
    9095        }
     
    154159                //evaluate function on x
    155160                fx = (*f)(x,optargs);
    156                 if(isnan(fx)) _error_("Function evaluation returned NaN");
     161                if(xIsNan<IssmDouble>(fx)) _error2_("Function evaluation returned NaN");
    157162                iter=iter+1;
    158163
     
    179184                tol1=seps*pow(pow(xbest,2),0.5)+tolerance/3.0;
    180185                tol2=2.0*tol1;
    181                 _printf_(VerboseControl(),"         %5i    %12.6g  %12.6g  %12.6g  %s\n",iter,x,fx,pow(pow(xbest-xm,2),0.5),goldenflag?"       golden":"       parabolic");
     186                if(VerboseControl())
     187                 _pprintLine_("         "<<setw(5)<<iter<<"    "<<setw(12)<<x<<"  "<<setw(12)<<fx<<"  "<<setw(12)<<pow(pow(xbest-xm,2),0.5)<<
     188                                         "         "<<(goldenflag?"golden":"parabolic"));
    182189
    183190                /*Stop the optimization?*/
    184191                if (sqrt(pow(xbest-xm,2)) < (tol2-0.5*(xmax-xmin))){
    185                         _printf_(VerboseControl(),"      optimization terminated: current x satisfies criteria 'tolx'=%g\n",tolerance);
     192                        if(VerboseControl()) _pprintLine_("      optimization terminated: current x satisfies criteria 'tolx'=" << tolerance);
    186193                        loop=false;
    187194                }
    188195                else if (iter>=maxiter){
    189                         _printf_(VerboseControl(),"      exiting: Maximum number of iterations has been exceeded  ('maxiter'=%i)\n",maxiter);
     196                        if(VerboseControl()) _pprintLine_("      exiting: Maximum number of iterations has been exceeded  ('maxiter'=" << maxiter << ")");
    190197                        loop=false;
    191198                }
    192                 else if (!isnan(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){
    193                         _printf_(VerboseControl(),"      optimization terminated: current x satisfies criteria 'cm_jump'=%g\n",cm_jump);
     199                else if (!xIsNan<IssmDouble>(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){
     200                        if(VerboseControl()) _pprintLine_("      optimization terminated: current x satisfies criteria 'cm_jump'=" << cm_jump);
    194201                        loop=false;
    195202                }
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/GaussPoints.cpp

    r12004 r12878  
    11/*  Gauss point structures and prototypes  */
    22
     3#include "../../include/include.h"
    34#include "./GaussPoints.h"
    45#include "../Alloc/alloc.h"
    5 #include "../../include/include.h"
    66#include "../../io/io.h"
    77#include "../Exceptions/exceptions.h"
     
    1010
    1111/*General Gauss points*/
    12 /*FUNCTION GaussLegendreLinear {{{1*/
    13 void GaussLegendreLinear( double** pxgaus, double** pxwgt, int ngaus){
     12/*FUNCTION GaussLegendreLinear {{{*/
     13void GaussLegendreLinear( IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus){
    1414        /* Gauss-Legendre quadrature points.
    1515
     
    2525        /*Intermediaries*/
    2626        int i;
    27         double *alpha,*beta;
     27        IssmPDouble *alpha,*beta;
    2828
    2929        /*p= 1, npoint= 1*/
    30         static double wgt1[]={2.000000000000000};
    31         static double xi1[]={0.000000000000000};
     30        static IssmPDouble wgt1[]={2.000000000000000};
     31        static IssmPDouble xi1[]={0.000000000000000};
    3232
    3333        /*p= 3, npoint= 2*/
    34         static double wgt2[]={1.000000000000000, 1.000000000000000};
    35         static double xi2[]={-0.577350269189626, 0.577350269189626};
     34        static IssmPDouble wgt2[]={1.000000000000000, 1.000000000000000};
     35        static IssmPDouble xi2[]={-0.577350269189626, 0.577350269189626};
    3636
    3737        /*p= 5, npoint= 3*/
    38         static double wgt3[]={0.555555555555556, 0.888888888888889, 0.555555555555556};
    39         static double xi3[]={-0.774596669241483, 0.000000000000000, 0.774596669241483};
     38        static IssmPDouble wgt3[]={0.555555555555556, 0.888888888888889, 0.555555555555556};
     39        static IssmPDouble xi3[]={-0.774596669241483, 0.000000000000000, 0.774596669241483};
    4040
    4141        /*p= 7, npoint= 4*/
    42         static double wgt4[]={0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454};
    43         static double xi4[]={-0.861136311594053,-0.339981043584856, 0.339981043584856, 0.861136311594053};
    44 
    45         static double* wgtp[MAX_LINE_GAUS_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 };
    46         static double* xip [MAX_LINE_GAUS_PTS]={xi1  ,xi2  ,xi3  ,xi4  };
    47 
    48         static int np[MAX_LINE_GAUS_PTS]={sizeof(wgt1 )/sizeof(double),
    49                 sizeof(wgt2 )/sizeof(double),
    50                 sizeof(wgt3 )/sizeof(double),
    51                 sizeof(wgt4 )/sizeof(double)};
    52 
    53         //      _printf_(true,"Gauss-Legendre recurrence coefficients ngaus=%d\n",ngaus);
    54         *pxgaus = (double *) xmalloc(ngaus*sizeof(double));
    55         *pxwgt  = (double *) xmalloc(ngaus*sizeof(double));
     42        static IssmPDouble wgt4[]={0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454};
     43        static IssmPDouble xi4[]={-0.861136311594053,-0.339981043584856, 0.339981043584856, 0.861136311594053};
     44
     45        static IssmPDouble* wgtp[MAX_LINE_GAUS_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 };
     46        static IssmPDouble* xip [MAX_LINE_GAUS_PTS]={xi1  ,xi2  ,xi3  ,xi4  };
     47
     48        static int np[MAX_LINE_GAUS_PTS]={sizeof(wgt1 )/sizeof(IssmPDouble),
     49                sizeof(wgt2 )/sizeof(IssmPDouble),
     50                sizeof(wgt3 )/sizeof(IssmPDouble),
     51                sizeof(wgt4 )/sizeof(IssmPDouble)};
     52
     53        //      _pprintLine_("Gauss-Legendre recurrence coefficients ngaus=" << ngaus);
     54        *pxgaus =xNew<IssmPDouble>(ngaus);
     55        *pxwgt  =xNew<IssmPDouble>(ngaus);
    5656
    5757        /*  check to see if Gauss points need to be calculated  */
     
    7070
    7171                /*  calculate the Gauss points using recurrence relations  */
    72                 alpha=(double *) xmalloc(ngaus*sizeof(double));
    73                 beta =(double *) xmalloc(ngaus*sizeof(double));
     72                alpha=xNew<IssmPDouble>(ngaus);
     73                beta =xNew<IssmPDouble>(ngaus);
    7474
    7575                /*  calculate the Legendre recurrence coefficients  */
     
    8484                /*  calculate the Gauss points  */
    8585                GaussRecur(*pxgaus, *pxwgt, ngaus, alpha, beta );
    86                 xfree((void **)&beta );
    87                 xfree((void **)&alpha);
     86                xDelete<IssmPDouble>(beta);
     87                xDelete<IssmPDouble>(alpha);
    8888        }
    89 }/*}}}1*/
    90 /*FUNCTION GaussLegendreTria{{{1*/
    91 void GaussLegendreTria( int* pngaus, double** pl1, double** pl2, double** pl3, double** pwgt, int iord ) {
     89}/*}}}*/
     90/*FUNCTION GaussLegendreTria{{{*/
     91void GaussLegendreTria( int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pwgt, int iord ) {
    9292        /*Gauss quadrature points for the triangle.
    9393
     
    9898        /*Intermediaries*/
    9999        int i,j,ipt,nigaus;
    100         double xi,eta;
    101         double *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt;
     100        IssmPDouble xi,eta;
     101        IssmPDouble *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt;
    102102
    103103        /*Hardcoded Gauss points declaration*/
    104         /*p= 1, npoint= 1{{{2*/
    105         static double wgt1[]={
     104        /*p= 1, npoint= 1{{{*/
     105        static IssmPDouble wgt1[]={
    106106                1.732050807568877};
    107         static double l11[]={
     107        static IssmPDouble l11[]={
    108108                0.333333333333333};
    109         static double l21[]={
     109        static IssmPDouble l21[]={
    110110                0.333333333333333};
    111         static double l31[]={
     111        static IssmPDouble l31[]={
    112112                0.333333333333333};
    113         /*}}}2*/
    114         /*p= 2, npoint= 3  {{{2*/
    115         static double wgt2[]={
     113        /*}}}*/
     114        /*p= 2, npoint= 3  {{{*/
     115        static IssmPDouble wgt2[]={
    116116                0.577350269189625, 0.577350269189625, 0.577350269189625};
    117         static double l12[]={
     117        static IssmPDouble l12[]={
    118118                0.666666666666667, 0.166666666666667, 0.166666666666667};
    119         static double l22[]={
     119        static IssmPDouble l22[]={
    120120                0.166666666666667, 0.666666666666667, 0.166666666666667};
    121         static double l32[]={
     121        static IssmPDouble l32[]={
    122122                0.166666666666667, 0.166666666666667, 0.666666666666667};
    123         /*}}}2*/
    124         /*p= 3, npoint= 4  {{{2*/
    125         static double wgt3[]={
     123        /*}}}*/
     124        /*p= 3, npoint= 4  {{{*/
     125        static IssmPDouble wgt3[]={
    126126                -0.974278579257493, 0.902109795608790, 0.902109795608790,
    127127                0.902109795608790};
    128         static double l13[]={
     128        static IssmPDouble l13[]={
    129129                0.333333333333333, 0.600000000000000, 0.200000000000000,
    130130                0.200000000000000};
    131         static double l23[]={
     131        static IssmPDouble l23[]={
    132132                0.333333333333333, 0.200000000000000, 0.600000000000000,
    133133                0.200000000000000};
    134         static double l33[]={
     134        static IssmPDouble l33[]={
    135135                0.333333333333333, 0.200000000000000, 0.200000000000000,
    136136                0.600000000000000};
    137         /*}}}2*/
    138         /*p= 4, npoint= 6  {{{2*/
    139         static double wgt4[]={
     137        /*}}}*/
     138        /*p= 4, npoint= 6  {{{*/
     139        static IssmPDouble wgt4[]={
    140140                0.386908262797819, 0.386908262797819, 0.386908262797819,
    141141                0.190442006391807, 0.190442006391807, 0.190442006391807};
    142         static double l14[]={
     142        static IssmPDouble l14[]={
    143143                0.108103018168070, 0.445948490915965, 0.445948490915965,
    144144                0.816847572980459, 0.091576213509771, 0.091576213509771};
    145         static double l24[]={
     145        static IssmPDouble l24[]={
    146146                0.445948490915965, 0.108103018168070, 0.445948490915965,
    147147                0.091576213509771, 0.816847572980459, 0.091576213509771};
    148         static double l34[]={
     148        static IssmPDouble l34[]={
    149149                0.445948490915965, 0.445948490915965, 0.108103018168070,
    150150                0.091576213509771, 0.091576213509771, 0.816847572980459};
    151         /*}}}2*/
    152         /*p= 5, npoint= 7  {{{2*/
    153         static double wgt5[]={
     151        /*}}}*/
     152        /*p= 5, npoint= 7  {{{*/
     153        static IssmPDouble wgt5[]={
    154154                0.389711431702997, 0.229313399254729, 0.229313399254729,
    155155                0.229313399254729, 0.218133059367230, 0.218133059367230,
    156156                0.218133059367230};
    157         static double l15[]={
     157        static IssmPDouble l15[]={
    158158                0.333333333333333, 0.059715871789770, 0.470142064105115,
    159159                0.470142064105115, 0.797426985353087, 0.101286507323456,
    160160                0.101286507323456};
    161         static double l25[]={
     161        static IssmPDouble l25[]={
    162162                0.333333333333333, 0.470142064105115, 0.059715871789770,
    163163                0.470142064105115, 0.101286507323456, 0.797426985353087,
    164164                0.101286507323456};
    165         static double l35[]={
     165        static IssmPDouble l35[]={
    166166                0.333333333333333, 0.470142064105115, 0.470142064105115,
    167167                0.059715871789770, 0.101286507323456, 0.101286507323456,
    168168                0.797426985353087};
    169         /*}}}2*/
    170         /*p= 6, npoint=12  {{{2*/
    171         static double wgt6[]={
     169        /*}}}*/
     170        /*p= 6, npoint=12  {{{*/
     171        static IssmPDouble wgt6[]={
    172172                0.202279763184836, 0.202279763184836, 0.202279763184836,
    173173                0.088065961139281, 0.088065961139281, 0.088065961139281,
    174174                0.143502272432755, 0.143502272432755, 0.143502272432755,
    175175                0.143502272432755, 0.143502272432755, 0.143502272432755};
    176         static double l16[]={
     176        static IssmPDouble l16[]={
    177177                0.501426509658179, 0.249286745170910, 0.249286745170910,
    178178                0.873821971016996, 0.063089014491502, 0.063089014491502,
    179179                0.053145049844817, 0.053145049844817, 0.310352451033784,
    180180                0.636502499121399, 0.310352451033784, 0.636502499121399};
    181         static double l26[]={
     181        static IssmPDouble l26[]={
    182182                0.249286745170910, 0.501426509658179, 0.249286745170910,
    183183                0.063089014491502, 0.873821971016996, 0.063089014491502,
    184184                0.310352451033784, 0.636502499121399, 0.053145049844817,
    185185                0.053145049844817, 0.636502499121399, 0.310352451033784};
    186         static double l36[]={
     186        static IssmPDouble l36[]={
    187187                0.249286745170910, 0.249286745170910, 0.501426509658179,
    188188                0.063089014491502, 0.063089014491502, 0.873821971016996,
    189189                0.636502499121399, 0.310352451033784, 0.636502499121399,
    190190                0.310352451033784, 0.053145049844817, 0.053145049844817};
    191         /*}}}2*/
    192         /*p= 7, npoint=13  {{{2*/
    193         static double wgt7[]={
     191        /*}}}*/
     192        /*p= 7, npoint=13  {{{*/
     193        static IssmPDouble wgt7[]={
    194194                -0.259062916308362, 0.304174548458604, 0.304174548458604,
    195195                0.304174548458604, 0.092400122517855, 0.092400122517855,
     
    197197                0.133564951824643, 0.133564951824643, 0.133564951824643,
    198198                0.133564951824643};
    199         static double l17[]={
     199        static IssmPDouble l17[]={
    200200                0.333333333333333, 0.479308067841920, 0.260345966079040,
    201201                0.260345966079040, 0.869739794195568, 0.065130102902216,
     
    203203                0.312865496004874, 0.638444188569810, 0.312865496004874,
    204204                0.638444188569810};
    205         static double l27[]={
     205        static IssmPDouble l27[]={
    206206                0.333333333333333, 0.260345966079040, 0.479308067841920,
    207207                0.260345966079040, 0.065130102902216, 0.869739794195568,
     
    209209                0.048690315425316, 0.048690315425316, 0.638444188569810,
    210210                0.312865496004874};
    211         static double l37[]={
     211        static IssmPDouble l37[]={
    212212                0.333333333333333, 0.260345966079040, 0.260345966079040,
    213213                0.479308067841920, 0.065130102902216, 0.065130102902216,
     
    215215                0.638444188569810, 0.312865496004874, 0.048690315425316,
    216216                0.048690315425316};
    217         /*}}}2*/
    218         /*p= 8, npoint=16  {{{2*/
    219         static double wgt8[]={
     217        /*}}}*/
     218        /*p= 8, npoint=16  {{{*/
     219        static IssmPDouble wgt8[]={
    220220                0.249961964823104, 0.164703541925695, 0.164703541925695,
    221221                0.164703541925695, 0.178777729989794, 0.178777729989794,
     
    224224                0.047164287656184, 0.047164287656184, 0.047164287656184,
    225225                0.047164287656184};
    226         static double l18[]={
     226        static IssmPDouble l18[]={
    227227                0.333333333333333, 0.081414823414554, 0.459292588292723,
    228228                0.459292588292723, 0.658861384496480, 0.170569307751760,
     
    231231                0.263112829634638, 0.728492392955404, 0.263112829634638,
    232232                0.728492392955404};
    233         static double l28[]={
     233        static IssmPDouble l28[]={
    234234                0.333333333333333, 0.459292588292723, 0.081414823414554,
    235235                0.459292588292723, 0.170569307751760, 0.658861384496480,
     
    238238                0.008394777409958, 0.008394777409958, 0.728492392955404,
    239239                0.263112829634638};
    240         static double l38[]={
     240        static IssmPDouble l38[]={
    241241                0.333333333333333, 0.459292588292723, 0.459292588292723,
    242242                0.081414823414554, 0.170569307751760, 0.170569307751760,
     
    245245                0.728492392955404, 0.263112829634638, 0.008394777409958,
    246246                0.008394777409958};
    247         /*}}}2*/
    248         /*p= 9, npoint=19  {{{2*/
    249         static double wgt9[]={
     247        /*}}}*/
     248        /*p= 9, npoint=19  {{{*/
     249        static IssmPDouble wgt9[]={
    250250                0.168244134395468, 0.054273292833345, 0.054273292833345,
    251251                0.054273292833345, 0.134801255248419, 0.134801255248419,
     
    255255                0.074969289332873, 0.074969289332873, 0.074969289332873,
    256256                0.074969289332873};
    257         static double l19[]={
     257        static IssmPDouble l19[]={
    258258                0.333333333333333, 0.020634961602525, 0.489682519198738,
    259259                0.489682519198738, 0.125820817014127, 0.437089591492937,
     
    263263                0.221962989160766, 0.741198598784498, 0.221962989160766,
    264264                0.741198598784498};
    265         static double l29[]={
     265        static IssmPDouble l29[]={
    266266                0.333333333333333, 0.489682519198738, 0.020634961602525,
    267267                0.489682519198738, 0.437089591492937, 0.125820817014127,
     
    271271                0.036838412054736, 0.036838412054736, 0.741198598784498,
    272272                0.221962989160766};
    273         static double l39[]={
     273        static IssmPDouble l39[]={
    274274                0.333333333333333, 0.489682519198738, 0.489682519198738,
    275275                0.020634961602525, 0.437089591492937, 0.437089591492937,
     
    279279                0.741198598784498, 0.221962989160766, 0.036838412054736,
    280280                0.036838412054736};
    281         /*}}}2*/
    282         /*p=10, npoint=25  {{{2*/
    283         static double wgt10[]={
     281        /*}}}*/
     282        /*p=10, npoint=25  {{{*/
     283        static IssmPDouble wgt10[]={
    284284                0.157301373584232, 0.063611224790829, 0.063611224790829,
    285285                0.063611224790829, 0.078498377595183, 0.078498377595183,
     
    291291                0.016318805873179, 0.016318805873179, 0.016318805873179,
    292292                0.016318805873179};
    293         static double l110[]={
     293        static IssmPDouble l110[]={
    294294                0.333333333333333, 0.028844733232685, 0.485577633383657,
    295295                0.485577633383657, 0.781036849029926, 0.109481575485037,
     
    301301                0.066803251012200, 0.923655933587500, 0.066803251012200,
    302302                0.923655933587500};
    303         static double l210[]={
     303        static IssmPDouble l210[]={
    304304                0.333333333333333, 0.485577633383657, 0.028844733232685,
    305305                0.485577633383657, 0.109481575485037, 0.781036849029926,
     
    311311                0.009540815400299, 0.009540815400299, 0.923655933587500,
    312312                0.066803251012200};
    313         static double l310[]={
     313        static IssmPDouble l310[]={
    314314                0.333333333333333, 0.485577633383657, 0.485577633383657,
    315315                0.028844733232685, 0.109481575485037, 0.109481575485037,
     
    321321                0.923655933587500, 0.066803251012200, 0.009540815400299,
    322322                0.009540815400299};
    323         /*}}}2*/
    324         /*p=11, npoint=27  {{{2*/
    325         static double wgt11[]={
     323        /*}}}*/
     324        /*p=11, npoint=27  {{{*/
     325        static IssmPDouble wgt11[]={
    326326                0.001605622060698, 0.001605622060698, 0.001605622060698,
    327327                0.133626914252765, 0.133626914252765, 0.133626914252765,
     
    333333                0.035866718600836, 0.035866718600836, 0.035866718600836,
    334334                0.035866718600836, 0.035866718600836, 0.035866718600836};
    335         static double l111[]={
     335        static IssmPDouble l111[]={
    336336                -0.069222096541517, 0.534611048270758, 0.534611048270758,
    337337                0.202061394068290, 0.398969302965855, 0.398969302965855,
     
    343343                0.021022016536166, 0.021022016536166, 0.171488980304042,
    344344                0.807489003159792, 0.171488980304042, 0.807489003159792};
    345         static double l211[]={
     345        static IssmPDouble l211[]={
    346346                0.534611048270758,-0.069222096541517, 0.534611048270758,
    347347                0.398969302965855, 0.202061394068290, 0.398969302965855,
     
    353353                0.171488980304042, 0.807489003159792, 0.021022016536166,
    354354                0.021022016536166, 0.807489003159792, 0.171488980304042};
    355         static double l311[]={
     355        static IssmPDouble l311[]={
    356356                0.534611048270758, 0.534611048270758,-0.069222096541517,
    357357                0.398969302965855, 0.398969302965855, 0.202061394068290,
     
    363363                0.807489003159792, 0.171488980304042, 0.807489003159792,
    364364                0.171488980304042, 0.021022016536166, 0.021022016536166};
    365         /*}}}2*/
    366         /*p=12, npoint=33  {{{2*/
    367         static double wgt12[]={
     365        /*}}}*/
     366        /*p=12, npoint=33  {{{*/
     367        static IssmPDouble wgt12[]={
    368368                0.044567514407799, 0.044567514407799, 0.044567514407799,
    369369                0.075677707051848, 0.075677707051848, 0.075677707051848,
     
    377377                0.029992592075802, 0.029992592075802, 0.029992592075802,
    378378                0.029992592075802, 0.029992592075802, 0.029992592075802};
    379         static double l112[]={
     379        static IssmPDouble l112[]={
    380380                0.023565220452390, 0.488217389773805, 0.488217389773805,
    381381                0.120551215411079, 0.439724392294460, 0.439724392294460,
     
    389389                0.025734050548330, 0.025734050548330, 0.116251915907597,
    390390                0.858014033544073, 0.116251915907597, 0.858014033544073};
    391         static double l212[]={
     391        static IssmPDouble l212[]={
    392392                0.488217389773805, 0.023565220452390, 0.488217389773805,
    393393                0.439724392294460, 0.120551215411079, 0.439724392294460,
     
    401401                0.116251915907597, 0.858014033544073, 0.025734050548330,
    402402                0.025734050548330, 0.858014033544073, 0.116251915907597};
    403         static double l312[]={
     403        static IssmPDouble l312[]={
    404404                0.488217389773805, 0.488217389773805, 0.023565220452390,
    405405                0.439724392294460, 0.439724392294460, 0.120551215411079,
     
    413413                0.858014033544073, 0.116251915907597, 0.858014033544073,
    414414                0.116251915907597, 0.025734050548330, 0.025734050548330};
    415         /*}}}2*/
    416         /*  p=13, npoint=37  {{{2*/
    417         static double wgt13[]={
     415        /*}}}*/
     416        /*  p=13, npoint=37  {{{*/
     417        static IssmPDouble wgt13[]={
    418418                0.090968907790622, 0.019537784619314, 0.019537784619314,
    419419                0.019537784619314, 0.054427130356344, 0.054427130356344,
     
    429429                0.026884523429480, 0.026884523429480, 0.026884523429480,
    430430                0.026884523429480};
    431         static double l113[]={
     431        static IssmPDouble l113[]={
    432432                0.333333333333333, 0.009903630120591, 0.495048184939705,
    433433                0.495048184939705, 0.062566729780852, 0.468716635109574,
     
    443443                0.126357385491669, 0.851409537834241, 0.126357385491669,
    444444                0.851409537834241};
    445         static double l213[]={
     445        static IssmPDouble l213[]={
    446446                0.333333333333333, 0.495048184939705, 0.009903630120591,
    447447                0.495048184939705, 0.468716635109574, 0.062566729780852,
     
    457457                0.022233076674090, 0.022233076674090, 0.851409537834241,
    458458                0.126357385491669};
    459         static double l313[]={
     459        static IssmPDouble l313[]={
    460460                0.333333333333333, 0.495048184939705, 0.495048184939705,
    461461                0.009903630120591, 0.468716635109574, 0.468716635109574,
     
    471471                0.851409537834241, 0.126357385491669, 0.022233076674090,
    472472                0.022233076674090};
    473         /*}}}2*/
    474         /*p=14, npoint=42{{{2*/
    475         static double wgt14[]={
     473        /*}}}*/
     474        /*p=14, npoint=42{{{*/
     475        static IssmPDouble wgt14[]={
    476476                0.037903474783419, 0.037903474783419, 0.037903474783419,
    477477                0.056791094234956, 0.056791094234956, 0.056791094234956,
     
    488488                0.008677970905831, 0.008677970905831, 0.008677970905831,
    489489                0.008677970905831, 0.008677970905831, 0.008677970905831};
    490         static double l114[]={
     490        static IssmPDouble l114[]={
    491491                0.022072179275643, 0.488963910362179, 0.488963910362179,
    492492                0.164710561319092, 0.417644719340454, 0.417644719340454,
     
    503503                0.001268330932872, 0.001268330932872, 0.118974497696957,
    504504                0.879757171370171, 0.118974497696957, 0.879757171370171};
    505         static double l214[]={
     505        static IssmPDouble l214[]={
    506506                0.488963910362179, 0.022072179275643, 0.488963910362179,
    507507                0.417644719340454, 0.164710561319092, 0.417644719340454,
     
    518518                0.118974497696957, 0.879757171370171, 0.001268330932872,
    519519                0.001268330932872, 0.879757171370171, 0.118974497696957};
    520         static double l314[]={
     520        static IssmPDouble l314[]={
    521521                0.488963910362179, 0.488963910362179, 0.022072179275643,
    522522                0.417644719340454, 0.417644719340454, 0.164710561319092,
     
    533533                0.879757171370171, 0.118974497696957, 0.879757171370171,
    534534                0.118974497696957, 0.001268330932872, 0.001268330932872};
    535         /*}}}2*/
    536         /*p=15, npoint=48{{{2*/
    537         static double wgt15[]={
     535        /*}}}*/
     536        /*p=15, npoint=48{{{*/
     537        static IssmPDouble wgt15[]={
    538538                0.003320126005206, 0.003320126005206, 0.003320126005206,
    539539                0.076641563419124, 0.076641563419124, 0.076641563419124,
     
    552552                0.013291658531346, 0.013291658531346, 0.013291658531346,
    553553                0.013291658531346, 0.013291658531346, 0.013291658531346};
    554         static double l115[]={
     554        static IssmPDouble l115[]={
    555555                -0.013945833716486, 0.506972916858243, 0.506972916858243,
    556556                0.137187291433955, 0.431406354283023, 0.431406354283023,
     
    569569                0.012459809331199, 0.012459809331199, 0.103575616576386,
    570570                0.883964574092416, 0.103575616576386, 0.883964574092416};
    571         static double l215[]={
     571        static IssmPDouble l215[]={
    572572                0.506972916858243,-0.013945833716486, 0.506972916858243,
    573573                0.431406354283023, 0.137187291433955, 0.431406354283023,
     
    586586                0.103575616576386, 0.883964574092416, 0.012459809331199,
    587587                0.012459809331199, 0.883964574092416, 0.103575616576386};
    588         static double l315[]={
     588        static IssmPDouble l315[]={
    589589                0.506972916858243, 0.506972916858243,-0.013945833716486,
    590590                0.431406354283023, 0.431406354283023, 0.137187291433955,
     
    603603                0.883964574092416, 0.103575616576386, 0.883964574092416,
    604604                0.103575616576386, 0.012459809331199, 0.012459809331199};
    605         /*}}}2*/
    606         /*p=16, npoint=52  {{{2*/
    607         static double wgt16[]={
     605        /*}}}*/
     606        /*p=16, npoint=52  {{{*/
     607        static IssmPDouble wgt16[]={
    608608                0.081191089584902, 0.011095307165226, 0.011095307165226,
    609609                0.011095307165226, 0.072244353151393, 0.072244353151393,
     
    624624                0.011864642509229, 0.011864642509229, 0.011864642509229,
    625625                0.011864642509229};
    626         static double l116[]={
     626        static IssmPDouble l116[]={
    627627                0.333333333333333, 0.005238916103123, 0.497380541948438,
    628628                0.497380541948438, 0.173061122901295, 0.413469438549352,
     
    643643                0.085283615682657, 0.900399064086661, 0.085283615682657,
    644644                0.900399064086661};
    645         static double l216[]={
     645        static IssmPDouble l216[]={
    646646                0.333333333333333, 0.497380541948438, 0.005238916103123,
    647647                0.497380541948438, 0.413469438549352, 0.173061122901295,
     
    662662                0.014317320230681, 0.014317320230681, 0.900399064086661,
    663663                0.085283615682657};
    664         static double l316[]={
     664        static IssmPDouble l316[]={
    665665                0.333333333333333, 0.497380541948438, 0.497380541948438,
    666666                0.005238916103123, 0.413469438549352, 0.413469438549352,
     
    681681                0.900399064086661, 0.085283615682657, 0.014317320230681,
    682682                0.014317320230681};
    683         /*}}}2*/
    684         /*p=17, npoint=61{{{2*/
    685         static double wgt17[]={
     683        /*}}}*/
     684        /*p=17, npoint=61{{{*/
     685        static IssmPDouble wgt17[]={
    686686                0.057914928034477, 0.008822054327014, 0.008822054327014,
    687687                0.008822054327014, 0.025410682752829, 0.025410682752829,
     
    705705                0.011545213295771, 0.011545213295771, 0.011545213295771,
    706706                0.011545213295771};
    707         static double l117[]={
     707        static IssmPDouble l117[]={
    708708                0.333333333333333, 0.005658918886452, 0.497170540556774,
    709709                0.497170540556774, 0.035647354750751, 0.482176322624625,
     
    727727                0.080711313679564, 0.904625504095608, 0.080711313679564,
    728728                0.904625504095608};
    729         static double l217[]={
     729        static IssmPDouble l217[]={
    730730                0.333333333333333, 0.497170540556774, 0.005658918886452,
    731731                0.497170540556774, 0.482176322624625, 0.035647354750751,
     
    749749                0.014663182224828, 0.014663182224828, 0.904625504095608,
    750750                0.080711313679564};
    751         static double l317[]={
     751        static IssmPDouble l317[]={
    752752                0.333333333333333, 0.497170540556774, 0.497170540556774,
    753753                0.005658918886452, 0.482176322624625, 0.482176322624625,
     
    771771                0.904625504095608, 0.080711313679564, 0.014663182224828,
    772772                0.014663182224828};
    773         /*}}}2*/
    774         /*  p=18, npoint=70  {{{2*/
    775 
    776         static double wgt18[]={
     773        /*}}}*/
     774        /*  p=18, npoint=70  {{{*/
     775
     776        static IssmPDouble wgt18[]={
    777777                0.053364381350150, 0.015713921277179, 0.015713921277179,
    778778                0.015713921277179, 0.032495554156279, 0.032495554156279,
     
    799799                0.000079999375178, 0.000079999375178, 0.000079999375178,
    800800                0.000079999375178};
    801         static double l118[]={
     801        static IssmPDouble l118[]={
    802802                0.333333333333333, 0.013310382738157, 0.493344808630921,
    803803                0.493344808630921, 0.061578811516086, 0.469210594241957,
     
    824824                0.020874755282586, 1.014347260005363, 0.020874755282586,
    825825                1.014347260005363};
    826         static double l218[]={
     826        static IssmPDouble l218[]={
    827827                0.333333333333333, 0.493344808630921, 0.013310382738157,
    828828                0.493344808630921, 0.469210594241957, 0.061578811516086,
     
    849849                -0.035222015287949,-0.035222015287949, 1.014347260005363,
    850850                0.020874755282586};
    851         static double l318[]={
     851        static IssmPDouble l318[]={
    852852                0.333333333333333, 0.493344808630921, 0.493344808630921,
    853853                0.013310382738157, 0.469210594241957, 0.469210594241957,
     
    874874                1.014347260005363, 0.020874755282586,-0.035222015287949,
    875875                -0.035222015287949};
    876         /*}}}2*/
    877         /*p=19, npoint=73  {{{2*/
    878 
    879         static double wgt19[]={
     876        /*}}}*/
     877        /*p=19, npoint=73  {{{*/
     878
     879        static IssmPDouble wgt19[]={
    880880                0.056995437856306, 0.017893352515055, 0.017893352515055,
    881881                0.017893352515055, 0.038775849701151, 0.038775849701151,
     
    903903                0.006581669842530, 0.006581669842530, 0.006581669842530,
    904904                0.006581669842530};
    905         static double l119[]={
     905        static IssmPDouble l119[]={
    906906                0.333333333333333, 0.020780025853987, 0.489609987073006,
    907907                0.489609987073006, 0.090926214604215, 0.454536892697893,
     
    929929                0.065494628082938, 0.924344252620784, 0.065494628082938,
    930930                0.924344252620784};
    931         static double l219[]={
     931        static IssmPDouble l219[]={
    932932                0.333333333333333, 0.489609987073006, 0.020780025853987,
    933933                0.489609987073006, 0.454536892697893, 0.090926214604215,
     
    955955                0.010161119296278, 0.010161119296278, 0.924344252620784,
    956956                0.065494628082938};
    957         static double l319[]={
     957        static IssmPDouble l319[]={
    958958                0.333333333333333, 0.489609987073006, 0.489609987073006,
    959959                0.020780025853987, 0.454536892697893, 0.454536892697893,
     
    981981                0.924344252620784, 0.065494628082938, 0.010161119296278,
    982982                0.010161119296278};
    983         /*}}}2*/
    984         /*p=20, npoint=79 {{{2*/
    985         static double wgt20[]={
     983        /*}}}*/
     984        /*p=20, npoint=79 {{{*/
     985        static IssmPDouble wgt20[]={
    986986                0.057256499746719, 0.001501721280705, 0.001501721280705,
    987987                0.001501721280705, 0.020195803723819, 0.020195803723819,
     
    10111011                0.006190192638113, 0.006190192638113, 0.006190192638113,
    10121012                0.006190192638113};
    1013         static double l120[]={
     1013        static IssmPDouble l120[]={
    10141014                0.333333333333333,-0.001900928704400, 0.500950464352200,
    10151015                0.500950464352200, 0.023574084130543, 0.488212957934729,
     
    10391039                0.059696109149007, 0.929756171556853, 0.059696109149007,
    10401040                0.929756171556853};
    1041         static double l220[]={
     1041        static IssmPDouble l220[]={
    10421042                0.333333333333333, 0.500950464352200,-0.001900928704400,
    10431043                0.500950464352200, 0.488212957934729, 0.023574084130543,
     
    10671067                0.010547719294141, 0.010547719294141, 0.929756171556853,
    10681068                0.059696109149007};
    1069         static double l320[]={
     1069        static IssmPDouble l320[]={
    10701070                0.333333333333333, 0.500950464352200, 0.500950464352200,
    10711071                -0.001900928704400, 0.488212957934729, 0.488212957934729,
     
    10951095                0.929756171556853, 0.059696109149007, 0.010547719294141,
    10961096                0.010547719294141};
    1097         /*}}}2*/
    1098 
    1099         static double* wgtp[MAX_TRIA_SYM_ORD]={
     1097        /*}}}*/
     1098
     1099        static IssmPDouble* wgtp[MAX_TRIA_SYM_ORD]={
    11001100                wgt1 ,wgt2 ,wgt3 ,wgt4 ,wgt5 ,
    11011101                wgt6 ,wgt7 ,wgt8 ,wgt9 ,wgt10,
    11021102                wgt11,wgt12,wgt13,wgt14,wgt15,
    11031103                wgt16,wgt17,wgt18,wgt19,wgt20};
    1104         static double* l1p [MAX_TRIA_SYM_ORD]={
     1104        static IssmPDouble* l1p [MAX_TRIA_SYM_ORD]={
    11051105                l11  ,l12  ,l13  ,l14  ,l15  ,
    11061106                l16  ,l17  ,l18  ,l19  ,l110 ,
    11071107                l111 ,l112 ,l113 ,l114 ,l115 ,
    11081108                l116 ,l117 ,l118 ,l119 ,l120 };
    1109         static double* l2p [MAX_TRIA_SYM_ORD]={
     1109        static IssmPDouble* l2p [MAX_TRIA_SYM_ORD]={
    11101110                l21  ,l22  ,l23  ,l24  ,l25  ,
    11111111                l26  ,l27  ,l28  ,l29  ,l210 ,
    11121112                l211 ,l212 ,l213 ,l214 ,l215 ,
    11131113                l216 ,l217 ,l218 ,l219 ,l220 };
    1114         static double* l3p [MAX_TRIA_SYM_ORD]={
     1114        static IssmPDouble* l3p [MAX_TRIA_SYM_ORD]={
    11151115                l31  ,l32  ,l33  ,l34  ,l35  ,
    11161116                l36  ,l37  ,l38  ,l39  ,l310 ,
     
    11181118                l316 ,l317 ,l318 ,l319 ,l320 };
    11191119
    1120         static int np[MAX_TRIA_SYM_ORD]={sizeof(wgt1 )/sizeof(double),
    1121                 sizeof(wgt2 )/sizeof(double),
    1122                 sizeof(wgt3 )/sizeof(double),
    1123                 sizeof(wgt4 )/sizeof(double),
    1124                 sizeof(wgt5 )/sizeof(double),
    1125                 sizeof(wgt6 )/sizeof(double),
    1126                 sizeof(wgt7 )/sizeof(double),
    1127                 sizeof(wgt8 )/sizeof(double),
    1128                 sizeof(wgt9 )/sizeof(double),
    1129                 sizeof(wgt10)/sizeof(double),
    1130                 sizeof(wgt11)/sizeof(double),
    1131                 sizeof(wgt12)/sizeof(double),
    1132                 sizeof(wgt13)/sizeof(double),
    1133                 sizeof(wgt14)/sizeof(double),
    1134                 sizeof(wgt15)/sizeof(double),
    1135                 sizeof(wgt16)/sizeof(double),
    1136                 sizeof(wgt17)/sizeof(double),
    1137                 sizeof(wgt18)/sizeof(double),
    1138                 sizeof(wgt19)/sizeof(double),
    1139                 sizeof(wgt20)/sizeof(double)};
    1140 
    1141         //      _printf_(true,"GaussLegendreTria: iord=%d\n",iord);
     1120        static int np[MAX_TRIA_SYM_ORD]={sizeof(wgt1 )/sizeof(IssmPDouble),
     1121                sizeof(wgt2 )/sizeof(IssmPDouble),
     1122                sizeof(wgt3 )/sizeof(IssmPDouble),
     1123                sizeof(wgt4 )/sizeof(IssmPDouble),
     1124                sizeof(wgt5 )/sizeof(IssmPDouble),
     1125                sizeof(wgt6 )/sizeof(IssmPDouble),
     1126                sizeof(wgt7 )/sizeof(IssmPDouble),
     1127                sizeof(wgt8 )/sizeof(IssmPDouble),
     1128                sizeof(wgt9 )/sizeof(IssmPDouble),
     1129                sizeof(wgt10)/sizeof(IssmPDouble),
     1130                sizeof(wgt11)/sizeof(IssmPDouble),
     1131                sizeof(wgt12)/sizeof(IssmPDouble),
     1132                sizeof(wgt13)/sizeof(IssmPDouble),
     1133                sizeof(wgt14)/sizeof(IssmPDouble),
     1134                sizeof(wgt15)/sizeof(IssmPDouble),
     1135                sizeof(wgt16)/sizeof(IssmPDouble),
     1136                sizeof(wgt17)/sizeof(IssmPDouble),
     1137                sizeof(wgt18)/sizeof(IssmPDouble),
     1138                sizeof(wgt19)/sizeof(IssmPDouble),
     1139                sizeof(wgt20)/sizeof(IssmPDouble)};
     1140
     1141        //      _pprintLine_("GaussLegendreTria: iord=" << iord);
    11421142
    11431143        /*  check to see if Gauss points need to be calculated  */
     
    11501150                *pngaus=np[iord-1];
    11511151
    1152                 *pl1  = (double *) xmalloc(*pngaus*sizeof(double));
    1153                 *pl2  = (double *) xmalloc(*pngaus*sizeof(double));
    1154                 *pl3  = (double *) xmalloc(*pngaus*sizeof(double));
    1155                 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));
     1152                *pl1  =xNew<IssmPDouble>(*pngaus);
     1153                *pl2  =xNew<IssmPDouble>(*pngaus);
     1154                *pl3  =xNew<IssmPDouble>(*pngaus);
     1155                *pwgt =xNew<IssmPDouble>(*pngaus);
    11561156
    11571157                for (i=0; i<*pngaus; i++) {
     
    11681168                *pngaus=nigaus*nigaus;
    11691169
    1170                 *pl1  = (double *) xmalloc(*pngaus*sizeof(double));
    1171                 *pl2  = (double *) xmalloc(*pngaus*sizeof(double));
    1172                 *pl3  = (double *) xmalloc(*pngaus*sizeof(double));
    1173                 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));
     1170                *pl1  =xNew<IssmPDouble>(*pngaus);
     1171                *pl2  =xNew<IssmPDouble>(*pngaus);
     1172                *pl3  =xNew<IssmPDouble>(*pngaus);
     1173                *pwgt =xNew<IssmPDouble>(*pngaus);
    11741174
    11751175                /*  get the gauss points in each direction  */
     
    11951195                        }
    11961196                }
    1197                 xfree((void **)&xwgt );
    1198                 xfree((void **)&xgaus);
     1197                xDelete<IssmPDouble>(xwgt );
     1198                xDelete<IssmPDouble>(xgaus);
    11991199        }
    12001200
    1201         //      _printf_(true,"GaussLegendreTria - ngaus=%d\n",*pngaus);
     1201        //      _pprintLine_("GaussLegendreTria - ngaus=" << *pngaus);
    12021202        //      for (i=0; i<*pngaus; i++)
    12031203        //              _printf_(true,"i=%d: l1gaus=%f,l2gaus=%f,l3gaus=%f,wgt=%f\n",
     
    12051205
    12061206        return;
    1207 }/*}}}1*/
    1208 /*FUNCTION GaussLegendreTetra{{{1*/
    1209 void GaussLegendreTetra( int* pngaus, double** pl1, double** pl2, double** pl3, double** pl4, double** pwgt, int iord ) {
     1207}/*}}}*/
     1208/*FUNCTION GaussLegendreTetra{{{*/
     1209void GaussLegendreTetra( int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord ) {
    12101210        /* Gauss quadrature points for the tetrahedron.
    12111211
     
    12201220        /*Intermediaries*/
    12211221        int i,j,k,ipt,nigaus;
    1222         double xi,eta,zeta;
    1223         double *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt,*zgaus,*zwgt;
     1222        IssmPDouble xi,eta,zeta;
     1223        IssmPDouble *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt,*zgaus,*zwgt;
    12241224
    12251225        /*Hardcoded Gauss points definition*/
    1226         /*p= 1, npoint= 1  {{{2*/
    1227         static double wgt1[]={
     1226        /*p= 1, npoint= 1  {{{*/
     1227        static IssmPDouble wgt1[]={
    12281228                1.000000000000000};
    1229         static double l11[]={
     1229        static IssmPDouble l11[]={
    12301230                0.250000000000000};
    1231         static double l21[]={
     1231        static IssmPDouble l21[]={
    12321232                0.250000000000000};
    1233         static double l31[]={
     1233        static IssmPDouble l31[]={
    12341234                0.250000000000000};
    1235         static double l41[]={
     1235        static IssmPDouble l41[]={
    12361236                0.250000000000000};
    1237         /*}}}2*/
    1238         /*p= 2, npoint= 4  {{{2*/
    1239 
    1240         static double wgt2[]={
     1237        /*}}}*/
     1238        /*p= 2, npoint= 4  {{{*/
     1239
     1240        static IssmPDouble wgt2[]={
    12411241                0.250000000000000, 0.250000000000000, 0.250000000000000,
    12421242                0.250000000000000};
    1243         static double l12[]={
     1243        static IssmPDouble l12[]={
    12441244                0.585410196624969, 0.138196601125011, 0.138196601125011,
    12451245                0.138196601125011};
    1246         static double l22[]={
     1246        static IssmPDouble l22[]={
    12471247                0.138196601125011, 0.585410196624969, 0.138196601125011,
    12481248                0.138196601125011};
    1249         static double l32[]={
     1249        static IssmPDouble l32[]={
    12501250                0.138196601125011, 0.138196601125011, 0.585410196624969,
    12511251                0.138196601125011};
    1252         static double l42[]={
     1252        static IssmPDouble l42[]={
    12531253                0.138196601125011, 0.138196601125011, 0.138196601125011,
    12541254                0.585410196624969};
    1255         /*}}}2*/
    1256         /*p= 3, npoint= 5  {{{2*/
    1257         static double wgt3[]={
     1255        /*}}}*/
     1256        /*p= 3, npoint= 5  {{{*/
     1257        static IssmPDouble wgt3[]={
    12581258                -0.800000000000000, 0.450000000000000, 0.450000000000000,
    12591259                0.450000000000000, 0.450000000000000};
    1260         static double l13[]={
     1260        static IssmPDouble l13[]={
    12611261                0.250000000000000, 0.500000000000000, 0.166666666666667,
    12621262                0.166666666666667, 0.166666666666667};
    1263         static double l23[]={
     1263        static IssmPDouble l23[]={
    12641264                0.250000000000000, 0.166666666666667, 0.500000000000000,
    12651265                0.166666666666667, 0.166666666666667};
    1266         static double l33[]={
     1266        static IssmPDouble l33[]={
    12671267                0.250000000000000, 0.166666666666667, 0.166666666666667,
    12681268                0.500000000000000, 0.166666666666667};
    1269         static double l43[]={
     1269        static IssmPDouble l43[]={
    12701270                0.250000000000000, 0.166666666666667, 0.166666666666667,
    12711271                0.166666666666667, 0.500000000000000};
    1272         /*}}}2*/
    1273         /*p= 4, npoint=11  {{{2*/
    1274 
    1275         static double wgt4[]={
     1272        /*}}}*/
     1273        /*p= 4, npoint=11  {{{*/
     1274
     1275        static IssmPDouble wgt4[]={
    12761276                -0.013155555555556, 0.007622222222222, 0.007622222222222,
    12771277                0.007622222222222, 0.007622222222222, 0.024888888888889,
    12781278                0.024888888888889, 0.024888888888889, 0.024888888888889,
    12791279                0.024888888888889, 0.024888888888889};
    1280         static double l14[]={
     1280        static IssmPDouble l14[]={
    12811281                0.250000000000000, 0.785714285714286, 0.071428571428571,
    12821282                0.071428571428571, 0.071428571428571, 0.399403576166799,
    12831283                0.399403576166799, 0.399403576166799, 0.100596423833201,
    12841284                0.100596423833201, 0.100596423833201};
    1285         static double l24[]={
     1285        static IssmPDouble l24[]={
    12861286                0.250000000000000, 0.071428571428571, 0.785714285714286,
    12871287                0.071428571428571, 0.071428571428571, 0.399403576166799,
    12881288                0.100596423833201, 0.100596423833201, 0.399403576166799,
    12891289                0.399403576166799, 0.100596423833201};
    1290         static double l34[]={
     1290        static IssmPDouble l34[]={
    12911291                0.250000000000000, 0.071428571428571, 0.071428571428571,
    12921292                0.785714285714286, 0.071428571428571, 0.100596423833201,
    12931293                0.399403576166799, 0.100596423833201, 0.399403576166799,
    12941294                0.100596423833201, 0.399403576166799};
    1295         static double l44[]={
     1295        static IssmPDouble l44[]={
    12961296                0.250000000000000, 0.071428571428571, 0.071428571428571,
    12971297                0.071428571428571, 0.785714285714286, 0.100596423833201,
    12981298                0.100596423833201, 0.399403576166799, 0.100596423833201,
    12991299                0.399403576166799, 0.399403576166799};
    1300         /*}}}2*/
    1301         /*p= 5, npoint=15  {{{2*/
    1302 
    1303         static double wgt5[]={
     1300        /*}}}*/
     1301        /*p= 5, npoint=15  {{{*/
     1302
     1303        static IssmPDouble wgt5[]={
    13041304                0.030283678097089, 0.006026785714286, 0.006026785714286,
    13051305                0.006026785714286, 0.006026785714286, 0.011645249086029,
     
    13071307                0.010949141561386, 0.010949141561386, 0.010949141561386,
    13081308                0.010949141561386, 0.010949141561386, 0.010949141561386};
    1309         static double l15[]={
     1309        static IssmPDouble l15[]={
    13101310                0.250000000000000, 0.000000000000000, 0.333333333333333,
    13111311                0.333333333333333, 0.333333333333333, 0.727272727272727,
     
    13131313                0.066550153573664, 0.066550153573664, 0.066550153573664,
    13141314                0.433449846426336, 0.433449846426336, 0.433449846426336};
    1315         static double l25[]={
     1315        static IssmPDouble l25[]={
    13161316                0.250000000000000, 0.333333333333333, 0.000000000000000,
    13171317                0.333333333333333, 0.333333333333333, 0.090909090909091,
     
    13191319                0.066550153573664, 0.433449846426336, 0.433449846426336,
    13201320                0.066550153573664, 0.066550153573664, 0.433449846426336};
    1321         static double l35[]={
     1321        static IssmPDouble l35[]={
    13221322                0.250000000000000, 0.333333333333333, 0.333333333333333,
    13231323                0.000000000000000, 0.333333333333333, 0.090909090909091,
     
    13251325                0.433449846426336, 0.066550153573664, 0.433449846426336,
    13261326                0.066550153573664, 0.433449846426336, 0.066550153573664};
    1327         static double l45[]={
     1327        static IssmPDouble l45[]={
    13281328                0.250000000000000, 0.333333333333333, 0.333333333333333,
    13291329                0.333333333333333, 0.000000000000000, 0.090909090909091,
     
    13311331                0.433449846426336, 0.433449846426336, 0.066550153573664,
    13321332                0.433449846426336, 0.066550153573664, 0.066550153573664};
    1333         /*}}}2*/
    1334         /*p= 6, npoint=24  {{{2*/
    1335 
    1336         static double wgt6[]={
     1333        /*}}}*/
     1334        /*p= 6, npoint=24  {{{*/
     1335
     1336        static IssmPDouble wgt6[]={
    13371337                0.006653791709695, 0.006653791709695, 0.006653791709695,
    13381338                0.006653791709695, 0.001679535175887, 0.001679535175887,
     
    13431343                0.008035714285714, 0.008035714285714, 0.008035714285714,
    13441344                0.008035714285714, 0.008035714285714, 0.008035714285714};
    1345         static double l16[]={
     1345        static IssmPDouble l16[]={
    13461346                0.356191386222545, 0.214602871259152, 0.214602871259152,
    13471347                0.214602871259152, 0.877978124396166, 0.040673958534611,
     
    13531353                0.269672331458316, 0.603005664791649, 0.269672331458316,
    13541354                0.603005664791649, 0.269672331458316, 0.603005664791649};
    1355         static double l26[]={
     1355        static IssmPDouble l26[]={
    13561356                0.214602871259152, 0.356191386222545, 0.214602871259152,
    13571357                0.214602871259152, 0.040673958534611, 0.877978124396166,
     
    13631363                0.063661001875018, 0.063661001875018, 0.063661001875018,
    13641364                0.063661001875018, 0.603005664791649, 0.269672331458316};
    1365         static double l36[]={
     1365        static IssmPDouble l36[]={
    13661366                0.214602871259152, 0.214602871259152, 0.356191386222545,
    13671367                0.214602871259152, 0.040673958534611, 0.040673958534611,
     
    13731373                0.063661001875018, 0.063661001875018, 0.603005664791649,
    13741374                0.269672331458316, 0.063661001875018, 0.063661001875018};
    1375         static double l46[]={
     1375        static IssmPDouble l46[]={
    13761376                0.214602871259152, 0.214602871259152, 0.214602871259152,
    13771377                0.356191386222545, 0.040673958534611, 0.040673958534611,
     
    13831383                0.603005664791649, 0.269672331458316, 0.063661001875018,
    13841384                0.063661001875018, 0.063661001875018, 0.063661001875018};
    1385         /*}}}2*/
    1386 
    1387         static double* wgtp[MAX_TETRA_SYM_ORD]={wgt1,wgt2,wgt3,wgt4,wgt5,wgt6};
    1388         static double* l1p [MAX_TETRA_SYM_ORD]={l11 ,l12 ,l13 ,l14 ,l15 ,l16 };
    1389         static double* l2p [MAX_TETRA_SYM_ORD]={l21 ,l22 ,l32 ,l24 ,l25 ,l26 };
    1390         static double* l3p [MAX_TETRA_SYM_ORD]={l31 ,l32 ,l33 ,l34 ,l35 ,l36 };
    1391         static double* l4p [MAX_TETRA_SYM_ORD]={l41 ,l42 ,l43 ,l44 ,l45 ,l46 };
    1392 
    1393         static int np[MAX_TETRA_SYM_ORD]={sizeof(wgt1 )/sizeof(double),
    1394                 sizeof(wgt2 )/sizeof(double),
    1395                 sizeof(wgt3 )/sizeof(double),
    1396                 sizeof(wgt4 )/sizeof(double),
    1397                 sizeof(wgt5 )/sizeof(double),
    1398                 sizeof(wgt6 )/sizeof(double)};
    1399 
    1400         //      _printf_(true,"GaussLegendreTetra: iord=%d\n",iord);
     1385        /*}}}*/
     1386
     1387        static IssmPDouble* wgtp[MAX_TETRA_SYM_ORD]={wgt1,wgt2,wgt3,wgt4,wgt5,wgt6};
     1388        static IssmPDouble* l1p [MAX_TETRA_SYM_ORD]={l11 ,l12 ,l13 ,l14 ,l15 ,l16 };
     1389        static IssmPDouble* l2p [MAX_TETRA_SYM_ORD]={l21 ,l22 ,l32 ,l24 ,l25 ,l26 };
     1390        static IssmPDouble* l3p [MAX_TETRA_SYM_ORD]={l31 ,l32 ,l33 ,l34 ,l35 ,l36 };
     1391        static IssmPDouble* l4p [MAX_TETRA_SYM_ORD]={l41 ,l42 ,l43 ,l44 ,l45 ,l46 };
     1392
     1393        static int np[MAX_TETRA_SYM_ORD]={sizeof(wgt1 )/sizeof(IssmPDouble),
     1394                sizeof(wgt2 )/sizeof(IssmPDouble),
     1395                sizeof(wgt3 )/sizeof(IssmPDouble),
     1396                sizeof(wgt4 )/sizeof(IssmPDouble),
     1397                sizeof(wgt5 )/sizeof(IssmPDouble),
     1398                sizeof(wgt6 )/sizeof(IssmPDouble)};
     1399
     1400        //      _pprintLine_("GaussLegendreTetra: iord=" << iord);
    14011401
    14021402        /*  check to see if Gauss points need to be calculated  */
     
    14101410                *pngaus=np[iord-1];
    14111411
    1412                 *pl1  = (double *) xmalloc(*pngaus*sizeof(double));
    1413                 *pl2  = (double *) xmalloc(*pngaus*sizeof(double));
    1414                 *pl3  = (double *) xmalloc(*pngaus*sizeof(double));
    1415                 *pl4  = (double *) xmalloc(*pngaus*sizeof(double));
    1416                 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));
     1412                *pl1  =xNew<IssmPDouble>(*pngaus);
     1413                *pl2  =xNew<IssmPDouble>(*pngaus);
     1414                *pl3  =xNew<IssmPDouble>(*pngaus);
     1415                *pl4  =xNew<IssmPDouble>(*pngaus);
     1416                *pwgt =xNew<IssmPDouble>(*pngaus);
    14171417
    14181418                for (i=0; i<*pngaus; i++) {
     
    14301430                *pngaus=nigaus*nigaus*nigaus;
    14311431
    1432                 *pl1  = (double *) xmalloc(*pngaus*sizeof(double));
    1433                 *pl2  = (double *) xmalloc(*pngaus*sizeof(double));
    1434                 *pl3  = (double *) xmalloc(*pngaus*sizeof(double));
    1435                 *pl4  = (double *) xmalloc(*pngaus*sizeof(double));
    1436                 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));
     1432                *pl1  =xNew<IssmPDouble>(*pngaus);
     1433                *pl2  =xNew<IssmPDouble>(*pngaus);
     1434                *pl3  =xNew<IssmPDouble>(*pngaus);
     1435                *pl4  =xNew<IssmPDouble>(*pngaus);
     1436                *pwgt =xNew<IssmPDouble>(*pngaus);
    14371437
    14381438                /*  get the gauss points in each direction  */
     
    14671467                        }
    14681468                }
    1469                 xfree((void **)&xwgt );
    1470                 xfree((void **)&xgaus);
     1469                xDelete<IssmPDouble>(xwgt );
     1470                xDelete<IssmPDouble>(xgaus);
    14711471        }
    1472 }/*}}}1*/
    1473 /*FUNCTION GaussLobatto{{{1*/
    1474 void GaussLobatto( double** pxgaus, double** pxwgt, int ngaus ) {
     1472}/*}}}*/
     1473/*FUNCTION GaussLobatto{{{*/
     1474void GaussLobatto( IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus ) {
    14751475        /*Gauss-Lobatto quadrature points.
    14761476
     
    14881488
    14891489        int i;
    1490         double *alpha,*beta;
    1491         double left=-1.,right= 1.;
    1492         double p0l=0.,p0r=0.,p1l=1.,p1r=1.,pm1l,pm1r,det;
     1490        IssmPDouble *alpha,*beta;
     1491        IssmPDouble left=-1.,right= 1.;
     1492        IssmPDouble p0l=0.,p0r=0.,p1l=1.,p1r=1.,pm1l,pm1r,det;
    14931493
    14941494        /*p= 1, npoint= 1 (Gauss-Legendre)*/
    1495         static double wgt1[]={2.000000000000000};
    1496         static double xi1[]={0.000000000000000};
     1495        static IssmPDouble wgt1[]={2.000000000000000};
     1496        static IssmPDouble xi1[]={0.000000000000000};
    14971497
    14981498        /*p= 1, npoint= 2*/
    1499         static double wgt2[]={1.000000000000000, 1.000000000000000};
    1500         static double xi2[]={-1.000000000000000, 1.000000000000000};
     1499        static IssmPDouble wgt2[]={1.000000000000000, 1.000000000000000};
     1500        static IssmPDouble xi2[]={-1.000000000000000, 1.000000000000000};
    15011501
    15021502        /*p= 3, npoint= 3*/
    1503         static double wgt3[]={0.333333333333333, 1.333333333333333, 0.333333333333333};
    1504         static double xi3[]={-1.000000000000000, 0.000000000000000, 1.000000000000000};
     1503        static IssmPDouble wgt3[]={0.333333333333333, 1.333333333333333, 0.333333333333333};
     1504        static IssmPDouble xi3[]={-1.000000000000000, 0.000000000000000, 1.000000000000000};
    15051505
    15061506        /*p= 5, npoint= 4*/
    1507         static double wgt4[]={0.166666666666667, 0.833333333333333, 0.833333333333333, 0.166666666666667};
    1508         static double xi4[]={-1.000000000000000,-0.447213595499958, 0.447213595499958, 1.000000000000000};
     1507        static IssmPDouble wgt4[]={0.166666666666667, 0.833333333333333, 0.833333333333333, 0.166666666666667};
     1508        static IssmPDouble xi4[]={-1.000000000000000,-0.447213595499958, 0.447213595499958, 1.000000000000000};
    15091509
    15101510        /*p= 7, npoint= 5*/
    1511         static double wgt5[]={0.100000000000000, 0.544444444444444, 0.711111111111111, 0.544444444444444, 0.100000000000000};
    1512         static double xi5[]={-1.000000000000000,-0.654653670707977, 0.000000000000000, 0.654653670707977, 1.000000000000000};
    1513 
    1514         static double* wgtp[MAX_LINE_GLOB_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 ,wgt5 };
    1515         static double* xip [MAX_LINE_GLOB_PTS]={xi1  ,xi2  ,xi3  ,xi4  ,xi5  };
    1516 
    1517         static int np[MAX_LINE_GLOB_PTS]={sizeof(wgt1 )/sizeof(double),
    1518                 sizeof(wgt2 )/sizeof(double),
    1519                 sizeof(wgt3 )/sizeof(double),
    1520                 sizeof(wgt4 )/sizeof(double),
    1521                 sizeof(wgt5 )/sizeof(double)};
    1522 
    1523         //      _printf_(true,"Gauss-Lobatto recurrence coefficients ngaus=%d\n",ngaus);
    1524         *pxgaus = (double *) xmalloc(ngaus*sizeof(double));
    1525         *pxwgt  = (double *) xmalloc(ngaus*sizeof(double));
     1511        static IssmPDouble wgt5[]={0.100000000000000, 0.544444444444444, 0.711111111111111, 0.544444444444444, 0.100000000000000};
     1512        static IssmPDouble xi5[]={-1.000000000000000,-0.654653670707977, 0.000000000000000, 0.654653670707977, 1.000000000000000};
     1513
     1514        static IssmPDouble* wgtp[MAX_LINE_GLOB_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 ,wgt5 };
     1515        static IssmPDouble* xip [MAX_LINE_GLOB_PTS]={xi1  ,xi2  ,xi3  ,xi4  ,xi5  };
     1516
     1517        static int np[MAX_LINE_GLOB_PTS]={sizeof(wgt1 )/sizeof(IssmPDouble),
     1518                sizeof(wgt2 )/sizeof(IssmPDouble),
     1519                sizeof(wgt3 )/sizeof(IssmPDouble),
     1520                sizeof(wgt4 )/sizeof(IssmPDouble),
     1521                sizeof(wgt5 )/sizeof(IssmPDouble)};
     1522
     1523        //      _pprintLine_("Gauss-Lobatto recurrence coefficients ngaus=" << ngaus);
     1524        *pxgaus =xNew<IssmPDouble>(ngaus);
     1525        *pxwgt  =xNew<IssmPDouble>(ngaus);
    15261526
    15271527        /*  check to see if Gauss points need to be calculated  */
     
    15391539
    15401540                /*  calculate the Gauss points using recurrence relations  */
    1541                 alpha=(double *) xmalloc(ngaus*sizeof(double));
    1542                 beta =(double *) xmalloc(ngaus*sizeof(double));
     1541                alpha=xNew<IssmPDouble>(ngaus);
     1542                beta =xNew<IssmPDouble>(ngaus);
    15431543
    15441544                /*  calculate the Legendre recurrence coefficients  */
     
    15751575                /*  calculate the Gauss points  */
    15761576                GaussRecur(*pxgaus, *pxwgt, ngaus, alpha, beta );
    1577                 xfree((void **)&beta );
    1578                 xfree((void **)&alpha);
     1577                xDelete<IssmPDouble>(beta );
     1578                xDelete<IssmPDouble>(alpha);
    15791579        }
    15801580
    1581 }/*}}}1*/
    1582 /*FUNCTION GaussRecur{{{1*/
    1583 void GaussRecur( double* zero, double* weight, int n, double* alpha, double* beta ) {
     1581}/*}}}*/
     1582/*FUNCTION GaussRecur{{{*/
     1583void GaussRecur( IssmPDouble* zero, IssmPDouble* weight, int n, IssmPDouble* alpha, IssmPDouble* beta ) {
    15841584        /*Gauss quadrature points from recursion coefficients.
    15851585         *
     
    15891589        /*Intermediaries*/
    15901590        int i,j,k,l,m,ii,mml,iter;
    1591         double p,g,r,s,c,f,b;
    1592         double* work;
     1591        IssmPDouble p,g,r,s,c,f,b;
     1592        IssmPDouble* work;
    15931593
    15941594        if (n==1){
     
    15981598        }
    15991599
    1600         work=(double*)xmalloc(n*sizeof(double));
     1600        work=xNew<IssmPDouble>(n);
    16011601
    16021602        zero[0]  =alpha[0];
     
    16691669                } while (iter < MAX_GAUS_ITER);
    16701670                if (iter >= MAX_GAUS_ITER) {
    1671                         xfree((void **)&work);
    1672                         _error_("%s%i"," Max iterations exceeded for l=",MAX_GAUS_ITER);
     1671                        xDelete<IssmPDouble>(work);
     1672                        _error2_("Max iterations exceeded for l=" << MAX_GAUS_ITER);
    16731673                }
    16741674        }
     
    16981698
    16991699        /*Cleanup*/
    1700         xfree((void **)&work);
    1701 
    1702 }/*}}}1*/
     1700        xDelete<IssmPDouble>(work);
     1701
     1702}/*}}}*/
    17031703
    17041704/*Element Gauss points TO BE REMOVED*/
    1705 /*FUNCTION gaussQuad{{{1*/
    1706 void gaussQuad( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, int nigaus, int njgaus ) {
     1705/*FUNCTION gaussQuad{{{*/
     1706void gaussQuad( IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, int nigaus, int njgaus ) {
    17071707        /*Gauss quadrature points for the quadrilaterial.*/
    17081708
     
    17101710        GaussLegendreLinear(pxgaus, pxwgt, nigaus);
    17111711        GaussLegendreLinear(pegaus, pewgt, njgaus);
    1712 }/*}}}1*/
    1713 /*FUNCTION gaussHexa{{{1*/
    1714 void gaussHexa( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, double** pzgaus, double** pzwgt, int nigaus, int njgaus, int nkgaus ) {
     1712}/*}}}*/
     1713/*FUNCTION gaussHexa{{{*/
     1714void gaussHexa( IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, IssmPDouble** pzgaus, IssmPDouble ** pzwgt, int nigaus, int njgaus, int nkgaus ) {
    17151715        /*Gauss quadrature points for the hexahedron.*/
    17161716
     
    17191719        GaussLegendreLinear(pegaus, pewgt, njgaus);
    17201720        GaussLegendreLinear(pzgaus, pzwgt, nkgaus);
    1721 }/*}}}1*/
     1721}/*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/GaussPoints.h

    r5808 r12878  
    33 */
    44
     5#include "../../include/types.h"
    56#ifndef _GAUSSPOINTS_H
    67#define _GAUSSPOINTS_H
    78
    89#define MAX_LINE_GAUS_PTS    4
    9 void GaussLegendreLinear( double** pxgaus, double** pxwgt, int ngaus );
     10void GaussLegendreLinear(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus);
    1011#define MAX_TRIA_SYM_ORD    20
    11 void GaussLegendreTria( int* pngaus, double** pl1, double** pl2, double** pl3, double** pwgt, int iord );
     12void GaussLegendreTria(int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pwgt, int iord);
    1213#define MAX_TETRA_SYM_ORD    6
    13 void GaussLegendreTetra( int* pngaus, double** pl1, double** pl2, double** pl3, double** pl4, double** pwgt, int iord );
     14void GaussLegendreTetra(int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord);
    1415#define MAX_LINE_GLOB_PTS    5
    15 void GaussLobatto( double** pxgaus, double** pxwgt, int ngaus );
     16void GaussLobatto(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus);
    1617#define MAX_GAUS_ITER   30
    17 void GaussRecur( double* zero, double* weight, int n, double* alpha, double* beta );
     18void GaussRecur(IssmPDouble* zero, IssmPDouble* weight, int n, IssmPDouble* alpha, IssmPDouble* beta);
    1819
    19 void gaussQuad( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, int nigaus, int njgaus );
    20 void gaussHexa( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, double** pzgaus, double** pzwgt, int nigaus, int njgaus, int nkgaus );
     20void gaussQuad(IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, int nigaus, int njgaus);
     21void gaussHexa(IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, IssmPDouble** pzgaus, IssmPDouble ** pzwgt, int nigaus, int njgaus, int nkgaus);
    2122
    2223#endif
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/IsInputConverged.cpp

    r9883 r12878  
    1212#endif
    1313
    14 #include "../../objects/objects.h"
     14#include "../../classes/objects/objects.h"
    1515
    16 void IsInputConverged(double* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){
     16void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){
    1717
    1818        int i,j;
    1919
    2020        /*output: */
    21         double eps;
     21        IssmDouble eps;
    2222       
    2323        /*intermediary: */
    24         double *newvalues     = NULL;
    25         double *oldvalues     = NULL;
     24        IssmDouble *newvalues     = NULL;
     25        IssmDouble *oldvalues     = NULL;
    2626        int     num_values;
    27         double  ndu        = 0;
    28         double  nu         = 0;
     27        IssmDouble  ndu        = 0;
     28        IssmDouble  nu         = 0;
    2929
    3030        if(criterion_enum==RelativeEnum){
     
    5050
    5151                /*now, compute eps: */
    52                 if(nu)eps=ndu/nu;
     52                if(reCast<bool>(nu))eps=ndu/nu;
    5353                else eps=0;
    5454        }
    55         else _error_("%s%s%s"," convergence criterion ",EnumToStringx(criterion_enum)," not supported yet!");
     55        else _error2_("convergence criterion " << EnumToStringx(criterion_enum) << " not supported yet!");
    5656
    5757        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptimalSearch.cpp

    r9761 r12878  
    1010
    1111#include "./numerics.h"
    12 #include "../../objects/objects.h"
     12#include "../../classes/objects/objects.h"
    1313#include "../../io/io.h"
    1414#include "../../include/include.h"
     
    1616#include <float.h>
    1717
    18 void OptimalSearch(double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs){
     18void OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){
    1919
    2020        /* This routine is optimizing a given function*/
    2121
    2222        /*function values: */
    23         double fx1,fx2,fxbest;
    24         double x1,x2,xmin,xbest;
     23        IssmDouble fx1,fx2,fxbest;
     24        IssmDouble x1,x2,xmin,xbest;
    2525
    2626        /*tolerances: */
    27         double seps;
    28         double tolerance=1.e-4;
     27        IssmDouble seps;
     28        IssmDouble tolerance=1.e-4;
    2929        int    maxiter;
    3030
     
    4141        //get the value of the function at the first boundary
    4242        fx1= (*f)(x1,optargs);
    43         if (isnan(fx1)) _error_("Function evaluation returned NaN");
    44         _printf_(VerboseControl(),"\n        Iteration         x           f(x)       Tolerance\n\n");
    45         _printf_(VerboseControl(),"        %s    %12.6g  %12.6g  %s","   N/A",x1,fx1,"         N/A\n");
     43        if (xIsNan<IssmDouble>(fx1)) _error2_("Function evaluation returned NaN");
     44        cout<<setprecision(5);
     45        if(VerboseControl()) _pprintLine_("");
     46        if(VerboseControl()) _pprintLine_("       Iteration         x           f(x)       Tolerance");
     47        if(VerboseControl()) _pprintLine_("");
     48        if(VerboseControl()) _pprintLine_("           N/A    "<<setw(12)<<x1<<"  "<<setw(12)<<fx1<<"           N/A");
    4649
    4750        //update tolerances
     
    5457                iter++;
    5558                fx2 = (*f)(x2,optargs);
    56                 if (isnan(fx2)) _error_("Function evaluation returned NaN");
    57                 _printf_(VerboseControl(),"         %5i    %12.6g  %12.6g  %12.6g\n",iter,x2,fx2,fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1));
     59                if (xIsNan<IssmDouble>(fx2)) _error2_("Function evaluation returned NaN");
     60                if(VerboseControl())
     61                 _pprintLine_("         "<<setw(5)<<iter<<"    "<<setw(12)<<x2<<"  "<<setw(12)<<fx2<<"  "<<(fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1)));
    5862
    5963                //Stop the optimization?
    6064                if ((fabs(x2-x1)+seps)<tolerance || (fabs(fx2-fx1)+seps)<tolerance){
    61                         _printf_(VerboseControl(),"      %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of " ,tolerance);
     65                        if(VerboseControl()) _pprintLine_("      " << "optimization terminated: the current x satisfies the termination criteria using 'tolx' of "  << tolerance);
    6266                        loop=false;
    6367                }
    6468                else if (iter>=maxiter){
    65                         _printf_(VerboseControl(),"      %s\n","exiting: Maximum number of iterations has been exceeded  - increase 'maxiter'\n");
     69                        if(VerboseControl()) _pprintLine_("      " << "exiting: Maximum number of iterations has been exceeded  - increase 'maxiter'");
    6670                        loop=false;
    6771                }
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptionsFromAnalysis.cpp

    r12168 r12878  
    99#endif
    1010
    11 #include "../../objects/objects.h"
     11#include <cstring>
     12
     13#include "../../classes/objects/objects.h"
    1214#include "../../Container/Parameters.h"
    1315#include "../../EnumDefinitions/EnumDefinitions.h"
     
    2022        /*intermediary: */
    2123        int     dummy;
    22         double* analyses=NULL;
     24        IssmDouble* analyses=NULL;
    2325        char**  strings=NULL;
    2426        char*   string=NULL;
     
    5557        if (found==-1){
    5658                /*ok, we did not find anything, this is not good! error out: */
    57                 _error_("%s%s","could find neither a default analysis  nor analysis ",EnumToStringx(analysis_type));
     59                _error2_("could find neither a default analysis  nor analysis " << EnumToStringx(analysis_type));
    5860        }
    5961
    6062        /*ok, grab the option string: */
    61         outstring=(char*)xmalloc((strlen(strings[found])+1)*sizeof(char));
     63        outstring=xNew<char>(strlen(strings[found])+1);
    6264        strcpy(outstring,strings[found]);
    6365
    6466        /*Free ressources*/
    65         xfree((void**)&analyses);
     67        xDelete<IssmDouble>(analyses);
    6668        for(i=0;i<numanalyses;i++){
    6769                string=strings[i];
    68                 xfree((void**)&string);
     70                xDelete<char>(string);
    6971        }
    70         xfree((void**)&strings);
    71 
    72 
     72        xDelete<char*>(strings);
    7373        return outstring;
    7474}
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/PetscOptionsFromAnalysis.cpp

    r11708 r12878  
    99#endif
    1010
    11 #include "../../objects/objects.h"
     11#include "../../classes/objects/objects.h"
    1212#include "../../Container/Parameters.h"
    1313#include "../../toolkits/toolkits.h"
     
    3939
    4040        /*Free ressources:*/
    41         xfree((void**)&options);
     41        xDelete<char>(options);
    4242}
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/Synchronize.sh

    r12168 r12878  
    88#Get all lines of Verbosity.cpp
    99cat Verbosity.h |  grep "bool Verbose" | awk '{print $2}' | sed -e "s/(/ /" | awk '{print $1}' | awk '{ printf "%s %s\n", NR, $0 }' >temp
    10 #Build header of Verbosity.cpp {{{1
     10#Build header of Verbosity.cpp {{{
    1111cat <<END > Verbosity.cpp
    1212/*
     
    127127done
    128128
    129 #Add footer of Verbosity.cpp{{{1
     129#Add footer of Verbosity.cpp{{{
    130130cat <<END >> Verbosity.cpp
    131131
     
    135135void SetVerbosityLevel(int level){
    136136
    137         if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
     137        if(level<0) _error2_("vebosity level should be a positive integer (user provided " << level << ")");
    138138
    139139        verbositylevel = level;
     
    147147END
    148148#}}}
    149 #Complete verbose.m {{{1
     149#Complete verbose.m {{{
    150150VERBOSEPATH="$ISSM_DIR/src/m/classes/verbose.m"
    151151cat $VERBOSEPATH  | sed "/%BEGINFIELDS/,$ d"  > temp_begin
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/UnitConversion.cpp

    r12004 r12878  
    33 */
    44
    5 /*headers {{{1*/
     5/*headers {{{*/
    66#ifdef HAVE_CONFIG_H
    77        #include <config.h>
     
    1111
    1212#include "../../Container/Container.h"
    13 #include "../../objects/objects.h"
     13#include "../../classes/objects/objects.h"
    1414#include "../../EnumDefinitions/EnumDefinitions.h"
    1515#include "../../shared/shared.h"
    1616
    17 double UnitConversionScaleFactor(int type_enum);
     17IssmDouble UnitConversionScaleFactor(int type_enum);
    1818/*}}}*/
    1919
    20 void UnitConversion(double* values, int numvalues,int direction_enum, int type_enum){
     20void UnitConversion(IssmDouble* values, int numvalues,int direction_enum, int type_enum){
    2121
    22         double scale;
     22        IssmDouble scale;
    2323        int i;
    2424
     
    2929        if(direction_enum==IuToExtEnum) for(i=0;i<numvalues;i++)values[i]=values[i]*scale;
    3030        else if(direction_enum==ExtToIuEnum) for(i=0;i<numvalues;i++)values[i]=values[i]/scale;
    31         else _error_(" wrong direction for unit conversion, either IuToExtEnum or ExtToIuEnum. ");
     31        else _error2_("wrong direction for unit conversion, either IuToExtEnum or ExtToIuEnum. ");
    3232
    3333}
    3434
    35 double UnitConversion(double value, int direction_enum, int type_enum){
     35IssmDouble UnitConversion(IssmDouble value, int direction_enum, int type_enum){
    3636
    3737        UnitConversion(&value,1,direction_enum,type_enum);
     
    4141
    4242
    43 double UnitConversionScaleFactor(int type_enum){
     43IssmDouble UnitConversionScaleFactor(int type_enum){
    4444
    45         double yts=365.0*24.0*3600.0;
     45        IssmDouble yts=365.0*24.0*3600.0;
    4646       
    47         double scale;
     47        IssmDouble scale;
    4848        switch(type_enum){
    4949                case TimesteppingStartTimeEnum:              scale=1.0/yts;break; //yr
     
    6666                case SurfaceforcingsPrecipitationEnum:       scale=yts;break; //m/yr
    6767                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
    6874                case MisfitEnum:                             scale=pow(yts,2);break; //(m/yr)^2
    69                 case MassFluxEnum:                           scale=pow((double)10,-12)*yts;break; // (GigaTon/year)
     75                case MassFluxEnum:                           scale=pow((IssmDouble)10,-12)*yts;break; // (GigaTon/year)
     76                case TotalSmbEnum:                           scale=pow((IssmDouble)10,-12)*yts;break; // (GigaTon/year)
    7077                default: scale=1.0; break;
    7178        }
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/Verbosity.cpp

    r12168 r12878  
    3434void SetVerbosityLevel(int level){
    3535
    36         if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
     36        if(level<0) _error2_("vebosity level should be a positive integer (user provided " << level << ")");
    3737
    3838        verbositylevel = level;
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/XZvectorsToCoordinateSystem.cpp

    r12168 r12878  
    55#include <math.h>
    66
    7 void XZvectorsToCoordinateSystem(double* T,double* xzvectors){
     7void XZvectorsToCoordinateSystem(IssmDouble* T,IssmDouble* xzvectors){
    88
    99        int             i,j;
    10         double  x[3],y[3],z[3];
    11         double  x_norm, y_norm, z_norm;
     10        IssmDouble      x[3],y[3],z[3];
     11        IssmDouble      x_norm, y_norm, z_norm;
    1212
    1313        for(i=0;i<6;i++){
    14                 if(isnan(xzvectors[i])){
     14                if(xIsNan<IssmDouble>(xzvectors[i])){
    1515                        /*At least one NaN found: default to Id*/
    1616                        T[0*3+0] = 1.0; T[0*3+1] = 0.0; T[0*3+2] = 0.0;
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/cross.cpp

    r9320 r12878  
    99#endif
    1010
    11 void cross(double* result,double* vector1,double* vector2){
     11#include "../../include/include.h"
     12
     13void cross(IssmDouble* result,IssmDouble* vector1,IssmDouble* vector2){
    1214
    1315        /*result,vector1 and vector2 are all assumed to be of size 3: */
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/extrema.cpp

    r9320 r12878  
    99#endif
    1010
     11#include "../../include/include.h"
    1112
    12 double min(double a,double b){
     13IssmDouble min(IssmDouble a,IssmDouble b){
    1314        if (a<b)return a;
    1415        else return b;
     
    1819        else return b;
    1920}
    20 double max(double a,double b){
     21IssmDouble max(IssmDouble a,IssmDouble b){
    2122        if (a>b)return a;
    2223        else return b;
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/isnan.cpp

    r2241 r12878  
    11/*This routine only used by Intel compler: */
    2 #ifdef _INTEL_WIN_
    32
    4 int isnan(double x){
    5         if (x!=x)return 1;
    6         else return 0;
     3#include "../../include/include.h"
     4#include "isnan.h"
     5
     6#ifdef _HAVE_ADOLC_
     7template <> int xIsNan<adouble> (const adouble& X) {
     8  return isnan(X.getValue());
    79}
    810#endif
    9 
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/isnan.h

    r11092 r12878  
    33 */
    44
    5 #ifndef _ISNAN_INTEL_H_
    6 #define _ISNAN_INTEL_H_
     5#ifndef _XISNAN_H_
     6#define _XISNAN_H_
    77
     8#include <cmath>
     9
     10template <class T> int xIsNan(const T& X) {
    811#ifdef _INTEL_WIN_
    9 int isnan(double X);
     12                return (X!=X)?1:0;
     13#else
     14                return isnan(X);
     15#endif
     16}
     17
     18#ifdef _HAVE_ADOLC_
     19template <> int xIsNan<adouble> (const adouble& X);
    1020#endif
    1121
    1222#endif
    13 
  • issm/branches/trunk-jpl-damage/src/c/shared/Numerics/numerics.h

    r11708 r12878  
    99#include "./GaussPoints.h"
    1010#include "./isnan.h"
     11#include "./recast.h"
    1112
    1213class Input;
     
    1617struct OptPars;
    1718
    18 double min(double a,double b);
    19 double max(double a,double b);
     19IssmDouble min(IssmDouble a,IssmDouble b);
     20IssmDouble max(IssmDouble a,IssmDouble b);
    2021int    min(int a,int b);
    2122int    max(int a,int b);
    22 double OptFunc(double scalar, OptArgs* optargs);
    23 void   BrentSearch(double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs);
    24 void   OptimalSearch(double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs);
    25 void   cross(double* result,double* vector1,double* vector2);
    26 void   IsInputConverged(double* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum);
    27 void   UnitConversion(double* values, int numvalues,int direction_enum, int type_enum);
    28 double UnitConversion(double value, int direction_enum, int type_enum);
     23IssmDouble OptFunc(IssmDouble scalar, OptArgs* optargs);
     24void   BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs);
     25void   OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs);
     26void   cross(IssmDouble* result,IssmDouble* vector1,IssmDouble* vector2);
     27void   IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum);
     28void   UnitConversion(IssmDouble* values, int numvalues,int direction_enum, int type_enum);
     29IssmDouble UnitConversion(IssmDouble value, int direction_enum, int type_enum);
    2930char*  OptionsFromAnalysis(Parameters* parameters,int analysis_type);
    30 void   XZvectorsToCoordinateSystem(double* T,double* xzvectors);
     31void   XZvectorsToCoordinateSystem(IssmDouble* T,IssmDouble* xzvectors);
    3132#ifdef _HAVE_PETSC_
    3233void   PetscOptionsFromAnalysis(Parameters* parameters,int analysis_type);
  • issm/branches/trunk-jpl-damage/src/c/shared/Sorting/binary_search.cpp

    r9320 r12878  
    1111#include <stdio.h>
    1212
    13 int binary_search(int* poffset,int target, int* sorted_integers,int num_integers){
     13int binary_search(int* poffset,int target,int* sorted_integers,int num_integers){
    1414
    1515        /*output: */
    1616        int offset;  //offset, if found
    17         int found=0;  //found=0 if target is not found, 1 otherwise.
     17        int found=0; //found=0 if target is not found, 1 otherwise.
    1818
    1919        /*intermediary: */
     
    6464        return found;
    6565}
    66 
  • issm/branches/trunk-jpl-damage/src/c/shared/Sorting/sorting.h

    r1 r12878  
    66#define  _SORTING_H_
    77
    8 int binary_search(int* poffset,int target, int* sorted_integers,int num_integers);
    9 
     8int binary_search(int* poffset,int target,int* sorted_integers,int num_integers);
    109
    1110#endif //ifndef _SORTING_H_
    12 
  • issm/branches/trunk-jpl-damage/src/c/shared/String/DescriptorIndex.cpp

    r9336 r12878  
    2323        /*retrieve first token, separated by underscore: */
    2424        pch = strtok (descriptor,"_");
    25         if(!pch)_error_("%s%s%s"," descriptor ",descriptor," is not correctly formatted!");
     25        if(!pch)_error2_("descriptor " << descriptor << " is not correctly formatted!");
    2626
    2727        if (strncmp(pch,"scaled",6)==0){
    2828                /*we have a scaled variable. recover the root: */
    2929                pch = strtok (NULL, "_");
    30                 if(!pch)_error_("%s%s%s"," scaled descriptor ",descriptor," is not correctly formatted!");
     30                if(!pch)_error2_("scaled descriptor " << descriptor << " is not correctly formatted!");
    3131                memcpy(root,pch,(strlen(pch)+1)*sizeof(char));
    3232
     
    4444                /*we have an indexed variable. recover the root: */
    4545                pch = strtok (NULL, "_");
    46                 if(!pch)_error_("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");
     46                if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!");
    4747                memcpy(root,pch,(strlen(pch)+1)*sizeof(char));
    4848                /*now recover  the index: */
    4949                pch = strtok (NULL, "_");
    50                 if(!pch)_error_("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");
     50                if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!");
    5151                sscanf(pch,"%i",pindex);
    5252                return IndexedEnum;
     
    5555                /*we have an indexed variable. recover the root: */
    5656                pch = strtok (NULL, "_");
    57                 if(!pch)_error_("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");
     57                if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!");
    5858                memcpy(root,pch,(strlen(pch)+1)*sizeof(char));
    5959                /*now recover  the index: */
    6060                pch = strtok (NULL, "_");
    61                 if(!pch)_error_("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");
     61                if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!");
    6262                sscanf(pch,"%i",pindex);
    6363                return NodalEnum;
  • issm/branches/trunk-jpl-damage/src/c/shared/Threads/LaunchThread.cpp

    r9320 r12878  
    2020
    2121#include "./issm_threads.h"
    22 #include "../Alloc/alloc.h"
     22#include "../Alloc/xNewDelete.h"
    2323#include "../Exceptions/exceptions.h"
    2424#include "../../include/include.h"
     
    2828        #ifdef _MULTITHREADING_
    2929        int i;
    30         int* status=NULL;
    31 
    32         pthread_t* threads=NULL;
    33         pthread_handle* handles=NULL;
     30        int            *status  = NULL;
     31        pthread_t      *threads = NULL;
     32        pthread_handle *handles = NULL;
    3433       
    3534        /*dynamically allocate: */
    36         threads=(pthread_t*)xmalloc(num_threads*sizeof(pthread_t));
    37         handles=(pthread_handle*)xmalloc(num_threads*sizeof(pthread_handle));
     35        threads=xNew<pthread_t>(num_threads);
     36        handles=xNew<pthread_handle>(num_threads);
    3837
    3938        for(i=0;i<num_threads;i++){
     
    4241                handles[i].num=num_threads;
    4342        }
    44        
    4543        for(i=0;i<num_threads;i++){
    4644
    4745                if(pthread_create(threads+i,NULL,function,(void*)(handles+i))){
    48                         _error_(" pthread_create error");
     46                        _error2_("pthread_create error");
    4947                }
    5048        }
    5149        for(i=0;i<num_threads;i++){
    5250                if(pthread_join(threads[i],(void**)&status)){
    53                         _error_(" pthread_join error");
     51                        _error2_("pthread_join error");
    5452                }
    5553        }
    5654       
    5755        /*Free ressources:*/
    58         xfree((void**)&threads);
    59         xfree((void**)&handles);
     56        xDelete<pthread_t>(threads);
     57        xDelete<pthread_handle>(handles);
    6058
    6159        #else
     
    6765        function((void*)&handle);
    6866        #endif
    69 
    7067}
  • issm/branches/trunk-jpl-damage/src/c/shared/TriMesh/SplitMeshForRifts.cpp

    r12168 r12878  
    33 */
    44#include "./trimesh.h"
    5 
     5#include "../Alloc/xNewDelete.h"
    66#include "../Alloc/alloc.h"
    77
     
    5252
    5353        /*Go through all nodes of the rift segments, and start splitting the mesh: */
    54         flags=(int*)xcalloc(nods,sizeof(int)); //to make sure we don't split the same nodes twice!
     54        flags=xNewZeroInit<int>(nods); //to make sure we don't split the same nodes twice!
    5555        for (i=0;i<nriftsegs;i++){
    5656                for (j=0;j<2;j++){
  • issm/branches/trunk-jpl-damage/src/c/shared/TriMesh/TriMeshUtils.cpp

    r12168 r12878  
    77#include "./trimesh.h"
    88#include "../Exceptions/exceptions.h"
     9#include "../Alloc/xNewDelete.h"
    910#include "../Alloc/alloc.h"
    1011#include "../../include/include.h"
     
    5354        current_size=max_number_elements;
    5455        NumGridElements=0;
    55         GridElements=(int*)xmalloc(max_number_elements*sizeof(int));
     56        GridElements=xNew<int>(max_number_elements);
    5657
    5758        for (i=0;i<nel;i++){
     
    6566                                else{
    6667                                        /*Reallocate another max_number_elements slots in the GridElements: */
    67                                         GridElementsRealloc=(int*)xrealloc(GridElements,(current_size+max_number_elements)*sizeof(int));
     68                                        GridElementsRealloc=xReNew<int>(GridElements,current_size,(current_size+max_number_elements));
    6869                                        if (!GridElementsRealloc){
    6970                                                noerr=0;
     
    8182        cleanup_and_return:
    8283        if(!noerr){
    83                 xfree((void**)&GridElements);
     84                xDelete<int>(GridElements);
    8485        }
    8586        /*Allocate return pointers: */
     
    128129
    129130        /*Allocate segmentflags: */
    130         riftsegments_uncompressed=(int*)xcalloc(nsegs*5,sizeof(int));
     131        riftsegments_uncompressed=xNewZeroInit<int>(nsegs*5);
    131132
    132133        /*Find the segments that belong to a rift: they are the ones that see two elements. The other ones belong to a boundary
     
    165166
    166167        /*Compress riftsegments_uncompressed:*/
    167         riftsegments=(int*)xmalloc(nriftsegs*4*sizeof(int));
     168        riftsegments=xNew<int>(nriftsegs*4);
    168169        counter=0;
    169170        for (i=0;i<nsegs;i++){
     
    177178        }
    178179
    179         xfree((void**)&riftsegments_uncompressed);
     180        xDelete<int>(riftsegments_uncompressed);
    180181       
    181182        /*Assign output pointers: */
     
    202203        /*Figure out the list of elements  that are on the same side of the rift. To do so, we start from one
    203204         * side of the rift and keep rotating in the same direction:*/
    204         GridElementListOnOneSideOfRift=(int*)xmalloc(NumGridElements*sizeof(int));
     205        GridElementListOnOneSideOfRift=xNew<int>(NumGridElements);
    205206        //bootstrap the GridElementListOnOneSideOfRift by filling elements from riftsegments: */
    206207        GridElementListOnOneSideOfRift[0]=*(riftsegments+4*segmentnumber+0); /*this one does not belong to the same side, but is just there
     
    241242
    242243        /*Free ressources: */
    243         xfree((void**)&GridElements);
     244        xDelete<int>(GridElements);
    244245        /*Assign output pointers: */
    245246        *pNumGridElementListOnOneSideOfRift=NumGridElementListOnOneSideOfRift;
     
    380381
    381382        /*input: */
    382         double* segments=NULL;
    383         double* segmentmarkerlist=NULL;
     383        double *segments          = NULL;
     384        double *segmentmarkerlist = NULL;
    384385        int numsegs;
    385386       
    386387        /*output: */
    387         int* riftsnumsegs=NULL;
    388         double** riftssegments=NULL;
    389         int new_numsegs;
    390         double* new_segments=NULL;
    391         double* new_segmentmarkers=NULL;
     388        int      new_numsegs;
     389        int     *riftsnumsegs       = NULL;
     390        double **riftssegments      = NULL;
     391        double  *new_segments       = NULL;
     392        double  *new_segmentmarkers = NULL;
    392393
    393394        /*intermediary: */
     
    406407        /*Allocate new segments: */
    407408        new_numsegs=counter;
    408         new_segments=(double*)xmalloc(new_numsegs*3*sizeof(double));
    409         new_segmentmarkers=(double*)xmalloc(new_numsegs*sizeof(double));
     409        new_segments=xNew<double>(new_numsegs*3);
     410        new_segmentmarkers=xNew<double>(new_numsegs);
    410411
    411412        /*Copy new segments info : */
     
    422423
    423424        /*Now deal with rift segments: */
    424         riftsnumsegs=(int*)xmalloc(numrifts*sizeof(int));
    425         riftssegments=(double**)xmalloc(numrifts*sizeof(double*));
     425        riftsnumsegs=xNew<int>(numrifts);
     426        riftssegments=xNew<double*>(numrifts);
    426427        for (i=0;i<numrifts;i++){
    427428                /*Figure out how many segments for rift i: */
     
    431432                }
    432433                riftsnumsegs[i]=counter;
    433                 riftsegment=(double*)xmalloc(counter*3*sizeof(double));
     434                riftsegment=xNew<double>(counter*3);
    434435                /*Copy new segments info :*/
    435436                counter=0;
     
    446447
    447448        /*Free ressources: */
    448         xfree((void**)&segments);
     449        xDelete<double>(segments);
    449450
    450451        /*Assign output pointers: */
     
    465466
    466467        /*output: */
    467         int* riftsnumpairs=NULL;
    468         double** riftspairs=NULL;
     468        int     *riftsnumpairs = NULL;
     469        double **riftspairs    = NULL;
    469470
    470471        /*intermediary :*/
     
    474475        int     node1,node2,node3,node4;
    475476
    476         riftsnumpairs=(int*)xmalloc(numrifts*sizeof(int));
    477         riftspairs=(double**)xmalloc(numrifts*sizeof(double*));
     477        riftsnumpairs=xNew<int>(numrifts);
     478        riftspairs=xNew<double*>(numrifts);
    478479        for (i=0;i<numrifts;i++){
    479480                segments=riftssegments[i];
    480481                numsegs=riftsnumsegments[i];
    481482                riftsnumpairs[i]=numsegs;
    482                 pairs=(double*)xmalloc(2*numsegs*sizeof(double));
     483                pairs=xNew<double>(2*numsegs);
    483484                for (j=0;j<numsegs;j++){
    484485                        *(pairs+2*j+0)=*(segments+3*j+2); //retrieve element to which this segment belongs.
     
    500501        }
    501502
    502 
    503503        /*Assign output pointers: */
    504504        *priftsnumpairs=riftsnumpairs;
    505505        *priftspairs=riftspairs;
    506 
    507506        return noerr;
    508507}/*}}}*/
     
    522521
    523522        /*intermediary: */
    524         double* riftsegments=NULL;
    525         double* riftpairs=NULL;
     523        double *riftsegments = NULL;
     524        double *riftpairs    = NULL;
    526525        int     node1,node2,node3,node4,temp_node;
    527526        double  el2;
    528527        int     newnods; //temporary # node counter.
    529528        double  xmin,ymin;
    530         double* xreal=NULL;
    531         double* yreal=NULL;
    532         int* nodes=NULL;
    533         int* mergingnodes=NULL;
     529        double *xreal        = NULL;
     530        double *yreal        = NULL;
     531        int    *nodes        = NULL;
     532        int    *mergingnodes = NULL;
    534533        int     max_size;
    535534        int     redundant;
    536 
    537535
    538536        /*Recover input: */
     
    562560                max_size+=rifts1numsegs[i];
    563561        }
    564         nodes=(int*)xmalloc(max_size*sizeof(int));
    565         mergingnodes=(int*)xmalloc(max_size*sizeof(int));
     562        nodes=xNew<int>(max_size);
     563        mergingnodes=xNew<int>(max_size);
    566564
    567565        /*Go through the rifts segments, and identify which node we are going to merge with its counterpart on the other side
     
    678676                }
    679677        }
    680         xfree((void**)&x); x=xreal;
    681         xfree((void**)&y); y=yreal;
     678        xDelete<double>(x); x=xreal;
     679        xDelete<double>(y); y=yreal;
    682680
    683681        /*Assign output pointers:*/
     
    688686        *psegments=segments;
    689687        *pnumsegs=numsegs;
    690 
    691688        return noerr;
    692689}/*}}}*/
     
    716713        *priftflag=riftflag;
    717714        *pnumrifts=numrifts;
    718 
    719715        return noerr;
    720716}/*}}}*/
     
    726722
    727723        /*intermediary: */
    728         double* riftsegments=NULL;
    729         double* riftpairs=NULL;
     724        double *riftsegments = NULL;
     725        double *riftpairs    = NULL;
    730726        int numsegs;
    731727
    732728        /*ordering and copy: */
    733         int*    order=NULL;
    734         double* riftsegments_copy=NULL;
    735         double* riftpairs_copy=NULL;
     729        int    *order             = NULL;
     730        double *riftsegments_copy = NULL;
     731        double *riftpairs_copy    = NULL;
    736732
    737733        /*node and element manipulation: */
     
    744740
    745741        /*Allocate byproduct of this routine, riftstips: */
    746         riftstips=(double*)xmalloc(numrifts*2*sizeof(double));
     742        riftstips=xNew<double>(numrifts*2);
    747743
    748744        /*Go through all rifts: */
     
    754750                /*Allocate copy of riftsegments and riftpairs,
    755751                 *as well as ordering vector: */
    756                 riftsegments_copy=(double*)xmalloc(numsegs*3*sizeof(double));
    757                 riftpairs_copy=(double*)xmalloc(numsegs*2*sizeof(double));
    758                 order=(int*)xmalloc(numsegs*sizeof(int));
     752                riftsegments_copy=xNew<double>(numsegs*3);
     753                riftpairs_copy=xNew<double>(numsegs*2);
     754                order=xNew<int>(numsegs);
    759755
    760756                /*First find the tips, using the pairs. If a pair of elements has one node in common, this node is a rift tip: */
     
    814810                *(riftstips+2*i+0)=(double)tip1;
    815811                *(riftstips+2*i+1)=(double)tip2;
    816 
    817812
    818813                /*We have the two tips for this rift.  Go from tip1 to tip2, and figure out the order in which segments are sequential.
     
    865860                }
    866861
    867                 xfree((void**)&order);
    868                 xfree((void**)&riftsegments_copy);
    869                 xfree((void**)&riftpairs_copy);
     862                xDelete<int>(order);
     863                xDelete<double>(riftsegments_copy);
     864                xDelete<double>(riftpairs_copy);
    870865
    871866        }
     
    887882
    888883        /*output: */
    889         double** riftspenaltypairs=NULL;
    890         double*  riftpenaltypairs=NULL;
    891         int*     riftsnumpenaltypairs=NULL;
     884        double **riftspenaltypairs    = NULL;
     885        double  *riftpenaltypairs     = NULL;
     886        int     *riftsnumpenaltypairs = NULL;
    892887
    893888        /*intermediary: */
     
    901896
    902897        /*Allocate: */
    903         riftspenaltypairs=(double**)xmalloc(numrifts*sizeof(double*));
    904         riftsnumpenaltypairs=(int*)xmalloc(numrifts*sizeof(int));
     898        riftspenaltypairs=xNew<double*>(numrifts);
     899        riftsnumpenaltypairs=xNew<int>(numrifts);
    905900
    906901        for(i=0;i<numrifts;i++){
     
    910905
    911906                /*allocate riftpenaltypairs, and riftnumpenaltypairs: */
    912                 if((numsegs/2-1)!=0)riftpenaltypairs=(double*)xcalloc((numsegs/2-1)*RIFTPENALTYPAIRSWIDTH,sizeof(double));
     907                if((numsegs/2-1)!=0)riftpenaltypairs=xNewZeroInit<double>((numsegs/2-1)*RIFTPENALTYPAIRSWIDTH);
    913908               
    914909                /*Go through only one flank of the rifts, not counting the tips: */
     
    10061001                riftsnumpenaltypairs[i]=(numsegs/2-1);
    10071002        }
    1008                        
    1009 
    10101003
    10111004        /*Assign output pointers: */
    10121005        *priftspenaltypairs=riftspenaltypairs;
    10131006        *priftsnumpenaltypairs=riftsnumpenaltypairs;
    1014 
    10151007        return noerr;
    10161008}
     
    11431135        *py=y;
    11441136        *pnods=nods;
    1145 
    11461137        return noerr;
    11471138}
  • issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/wrappershared.h

    r12168 r12878  
    66#define _WRAPPER_SHARED_H_
    77
    8 #include "../../objects/objects.h"
     8#include "../../classes/objects/objects.h"
    99
    1010int ModuleBoot(void);
  • issm/branches/trunk-jpl-damage/src/c/shared/shared.h

    r12168 r12878  
    66#define _SHARED_H_
    77
    8 
    98#include "Alloc/alloc.h"
    10 #include "Alloc/alloc_module.h"
     9#include "Alloc/xNewDelete.h"
     10#include "Bamg/shared.h"
     11#include "Elements/elements.h"
    1112#include "Exceptions/exceptions.h"
    1213#include "Exp/exp.h"
     14#include "Matrix/matrix.h"
     15#include "MemOps/xMemCpy.h"
     16#include "Numerics/numerics.h"
     17#include "Sorting/sorting.h"
     18#include "Sys/sys.h"
     19#include "Threads/issm_threads.h"
    1320#include "TriMesh/trimesh.h"
    14 #include "Sorting/sorting.h"
    15 #include "Elements/elements.h"
    16 #include "Matrix/matrix.h"
    17 #include "Numerics/numerics.h"
    18 #include "Dofs/dofs.h"
    19 #include "Threads/issm_threads.h"
    20 #include "Bamg/shared.h"
    2121#include "Wrapper/wrappershared.h"
    2222
  • issm/branches/trunk-jpl-damage/src/c/solutions/AdjointCorePointerFromSolutionEnum.cpp

    r9320 r12878  
    1010
    1111#include "../toolkits/toolkits.h"
    12 #include "../objects/objects.h"
     12#include "../classes/objects/objects.h"
    1313#include "../shared/shared.h"
    1414#include "../EnumDefinitions/EnumDefinitions.h"
     
    3535                        break;
    3636                default:
    37                         _error_("No adjoint has been implemented for solution %s yet",EnumToStringx(solutiontype));
     37                        _error2_("No adjoint has been implemented for solution " << EnumToStringx(solutiontype) << " yet");
    3838                        break;
    3939        }
  • issm/branches/trunk-jpl-damage/src/c/solutions/AnalysisConfiguration.cpp

    r11684 r12878  
    1010
    1111#include "../toolkits/toolkits.h"
    12 #include "../objects/objects.h"
     12#include "../classes/objects/objects.h"
    1313#include "../shared/shared.h"
    1414#include "../EnumDefinitions/EnumDefinitions.h"
     
    2929                case DiagnosticSolutionEnum:
    3030                        numanalyses=5;
    31                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     31                        analyses=xNew<int>(numanalyses);
    3232                        analyses[0]=DiagnosticHorizAnalysisEnum;
    3333                        analyses[1]=DiagnosticVertAnalysisEnum;
     
    3939                case SteadystateSolutionEnum:
    4040                        numanalyses=8;
    41                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     41                        analyses=xNew<int>(numanalyses);
    4242                        analyses[0]=DiagnosticHorizAnalysisEnum;
    4343                        analyses[1]=DiagnosticVertAnalysisEnum;
     
    5252                case ThermalSolutionEnum:
    5353                        numanalyses=2;
    54                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     54                        analyses=xNew<int>(numanalyses);
    5555                        analyses[0]=ThermalAnalysisEnum;
    5656                        analyses[1]=MeltingAnalysisEnum;
     
    5959                case EnthalpySolutionEnum:
    6060                        numanalyses=1;
    61                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     61                        analyses=xNew<int>(numanalyses);
    6262                        analyses[0]=EnthalpyAnalysisEnum;
    6363                        break;
     
    6565                case HydrologySolutionEnum:
    6666                        numanalyses=3;
    67                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     67                        analyses=xNew<int>(numanalyses);
    6868                        analyses[0]=HydrologyAnalysisEnum;
    6969                        analyses[1]=SurfaceSlopeAnalysisEnum;
     
    7373                case PrognosticSolutionEnum:
    7474                        numanalyses=1;
    75                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     75                        analyses=xNew<int>(numanalyses);
    7676                        analyses[0]=PrognosticAnalysisEnum;
    7777                        break;
     
    7979                case BalancethicknessSolutionEnum:
    8080                        numanalyses=1;
    81                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     81                        analyses=xNew<int>(numanalyses);
    8282                        analyses[0]=BalancethicknessAnalysisEnum;
    8383                        break;
     
    8585                case SurfaceSlopeSolutionEnum:
    8686                        numanalyses=1;
    87                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     87                        analyses=xNew<int>(numanalyses);
    8888                        analyses[0]=SurfaceSlopeAnalysisEnum;
    8989                        break;
     
    9191                case BedSlopeSolutionEnum:
    9292                        numanalyses=1;
    93                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     93                        analyses=xNew<int>(numanalyses);
    9494                        analyses[0]=BedSlopeAnalysisEnum;
    9595                        break;
     
    9797                case TransientSolutionEnum:
    9898                        numanalyses=9;
    99                         analyses=(int*)xmalloc(numanalyses*sizeof(int));
     99                        analyses=xNew<int>(numanalyses);
    100100                        analyses[0]=DiagnosticHorizAnalysisEnum;
    101101                        analyses[1]=DiagnosticVertAnalysisEnum;
     
    110110               
    111111                default:
    112                         _error_("%s%s%s"," solution type: ",EnumToStringx(solutiontype)," not supported yet!");
     112                        _error2_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!");
    113113                        break;
    114114        }
     
    117117        if(pnumanalyses) *pnumanalyses=numanalyses;
    118118        if(panalyses)    *panalyses=analyses;
    119         else              xfree((void**)&analyses);
     119        else              xDelete<int>(analyses);
    120120}
  • issm/branches/trunk-jpl-damage/src/c/solutions/CorePointerFromSolutionEnum.cpp

    r10287 r12878  
    1010
    1111#include "../toolkits/toolkits.h"
    12 #include "../objects/objects.h"
     12#include "../classes/objects/objects.h"
    1313#include "../shared/shared.h"
    1414#include "../EnumDefinitions/EnumDefinitions.h"
     
    2929                        solutioncore=&diagnostic_core;
    3030                        #else
    31                         _error_("ISSM was not compiled with diagnostic capabilities. Exiting");
     31                        _error2_("ISSM was not compiled with diagnostic capabilities. Exiting");
    3232                        #endif
    3333                        break;
     
    3636                        solutioncore=&steadystate_core;
    3737                        #else
    38                         _error_("ISSM was not compiled with steady state capabilities. Exiting");
     38                        _error2_("ISSM was not compiled with steady state capabilities. Exiting");
    3939                        #endif
    4040                        break;
     
    4343                        solutioncore=&thermal_core;
    4444                        #else
    45                         _error_("ISSM was not compiled with thermal capabilities. Exiting");
     45                        _error2_("ISSM was not compiled with thermal capabilities. Exiting");
    4646                        #endif
    4747                        break;
     
    5050                        solutioncore=&enthalpy_core;
    5151                        #else
    52                         _error_("ISSM was not compiled with thermal capabilities. Exiting");
     52                        _error2_("ISSM was not compiled with thermal capabilities. Exiting");
    5353                        #endif
    5454                        break;
     
    5757                        solutioncore=&balancethickness_core;
    5858                        #else
    59                         _error_("ISSM was not compiled with balanced capabilities. Exiting");
     59                        _error2_("ISSM was not compiled with balanced capabilities. Exiting");
    6060                        #endif
    6161                        break;
     
    6464                        solutioncore=&hydrology_core;
    6565                        #else
    66                         _error_("ISSM was not compiled with hydrology capabilities. Exiting");
     66                        _error2_("ISSM was not compiled with hydrology capabilities. Exiting");
    6767                        #endif
    6868                        break;
     
    7171                        solutioncore=&surfaceslope_core;
    7272                        #else
    73                         _error_("ISSM was not compiled with slope capabilities. Exiting");
     73                        _error2_("ISSM was not compiled with slope capabilities. Exiting");
    7474                        #endif
    7575                        break;
     
    7878                        solutioncore=&bedslope_core;
    7979                        #else
    80                         _error_("ISSM was not compiled with slope capabilities. Exiting");
     80                        _error2_("ISSM was not compiled with slope capabilities. Exiting");
    8181                        #endif
    8282                        break;
     
    8585                        solutioncore=&transient_core;
    8686                        #else
    87                         _error_("ISSM was not compiled with transient capabilities. Exiting");
     87                        _error2_("ISSM was not compiled with transient capabilities. Exiting");
    8888                        #endif
    8989                        break;
     
    9292                        solutioncore=&prognostic_core;
    9393                        #else
    94                         _error_("ISSM was not compiled with prognostic capabilities. Exiting");
     94                        _error2_("ISSM was not compiled with prognostic capabilities. Exiting");
    9595                        #endif
    9696                        break;
    9797                default:
    98                         _error_("%s%s%s"," solution type: ",EnumToStringx(solutiontype)," not supported yet!");
     98                        _error2_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!");
    9999                        break;
    100100        }
  • issm/branches/trunk-jpl-damage/src/c/solutions/ProcessArguments.cpp

    r10568 r12878  
    44
    55#include <stdio.h>
     6#include <cstring>
     7
    68#include "../shared/shared.h"
    79#include "../include/include.h"
     
    1517        char *lockfilename   = NULL;
    1618
    17         if(argc<2)_error_("Usage error: no solution requested");
     19        if(argc<2)_error2_("Usage error: no solution requested");
    1820        *solution_type=StringToEnumx(argv[1]);
    19         if(argc<3)_error_("Usage error: missing model name");
     21        if(argc<3)_error2_("Usage error: missing model name");
    2022        modelname=argv[3];
    21         binfilename    = (char*)xmalloc((strlen(modelname)+strlen(".bin")   +1)*sizeof(char)); sprintf(binfilename,   "%s%s",modelname,".bin");
    22         outbinfilename = (char*)xmalloc((strlen(modelname)+strlen(".outbin")+1)*sizeof(char)); sprintf(outbinfilename,"%s%s",modelname,".outbin");
    23         petscfilename  = (char*)xmalloc((strlen(modelname)+strlen(".petsc") +1)*sizeof(char)); sprintf(petscfilename, "%s%s",modelname,".petsc");
    24         lockfilename   = (char*)xmalloc((strlen(modelname)+strlen(".lock")  +1)*sizeof(char)); sprintf(lockfilename,  "%s%s",modelname,".lock");
     23        binfilename    = xNew<char>(strlen(modelname)+strlen(".bin")   +1); sprintf(binfilename,   "%s%s",modelname,".bin");
     24        outbinfilename = xNew<char>(strlen(modelname)+strlen(".outbin")+1); sprintf(outbinfilename,"%s%s",modelname,".outbin");
     25        petscfilename  = xNew<char>(strlen(modelname)+strlen(".petsc") +1); sprintf(petscfilename, "%s%s",modelname,".petsc");
     26        lockfilename   = xNew<char>(strlen(modelname)+strlen(".lock")  +1); sprintf(lockfilename,  "%s%s",modelname,".lock");
    2527
    2628        /*Clean up and assign output pointer*/
  • issm/branches/trunk-jpl-damage/src/c/solutions/ResetBoundaryConditions.cpp

    r11684 r12878  
    33 */
    44
    5 #include "../objects/objects.h"
     5#include "../classes/objects/objects.h"
    66#include "../modules/modules.h"
    77#include "../io/io.h"
     
    1515        int    i;
    1616
    17         _printf_(VerboseSolution(),"%s\n","   updating boundary conditions...");
     17        if(VerboseSolution()) _pprintLine_("   updating boundary conditions...");
    1818                       
    1919        /*set current analysis: */
  • issm/branches/trunk-jpl-damage/src/c/solutions/WriteLockFile.cpp

    r9320 r12878  
    1717        if(my_rank==0){
    1818                fid=fopen(filename,"w");
    19                 if(fid==NULL) _error_("%s%s","error message: could not open lock file ",filename);
     19                if(fid==NULL) _error2_("error message: could not open lock file " << filename);
    2020
    2121                /*Close file: */
    22                 if(fclose(fid)!=0) _error_("%s%s","could not close lock file ",filename);
     22                if(fclose(fid)!=0) _error2_("could not close lock file " << filename);
    2323        }
    2424
  • issm/branches/trunk-jpl-damage/src/c/solutions/adjointbalancethickness_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    2222
    2323        /*compute thickness */
    24         _printf_(VerboseSolution(),"%s\n","   computing thickness");
     24        if(VerboseSolution()) _pprintLine_("   computing thickness");
    2525        femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
    2626        solver_linear(femmodel);
     
    3030
    3131        /*compute adjoint*/
    32         _printf_(VerboseSolution(),"%s\n","   computing adjoint");
     32        if(VerboseSolution()) _pprintLine_("   computing adjoint");
    3333        femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum,AdjointBalancethicknessAnalysisEnum);
    3434        solver_adjoint_linear(femmodel);
     
    3636        /*Save results*/
    3737        if(save_results){
    38                 _printf_(VerboseSolution(),"   saving results\n");
     38                if(VerboseSolution()) _pprintLine_("   saving results");
    3939                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointEnum);
    4040        }
  • issm/branches/trunk-jpl-damage/src/c/solutions/adjointdiagnostic_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    2525
    2626        /*Compute velocities*/
    27         _printf_(VerboseSolution(),"%s\n","   computing velocities");
     27        if(VerboseSolution()) _pprintLine_("   computing velocities");
    2828        femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum);
    2929        solver_nonlinear(femmodel,conserve_loads);
     
    3333
    3434        /*Compute adjoint*/
    35         _printf_(VerboseSolution(),"%s\n","   computing adjoint");
     35        if(VerboseSolution()) _pprintLine_("   computing adjoint");
    3636        femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum,AdjointHorizAnalysisEnum);
    3737        solver_adjoint_linear(femmodel);
     
    3939        /*Save results*/
    4040        if(save_results){
    41                 _printf_(VerboseSolution(),"   saving results\n");
     41                if(VerboseSolution()) _pprintLine_("   saving results");
    4242                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointxEnum);
    4343                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointyEnum);
  • issm/branches/trunk-jpl-damage/src/c/solutions/balancethickness_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    2424        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
    2525
    26         _printf_(VerboseSolution(),"call computational core:\n");
     26        if(VerboseSolution()) _pprintLine_("call computational core:");
    2727        solver_linear(femmodel);
    2828
    2929        if(save_results){
    30                 _printf_(VerboseSolution(),"   saving results\n");
     30                if(VerboseSolution()) _pprintLine_("   saving results");
    3131                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum);
    3232        }
  • issm/branches/trunk-jpl-damage/src/c/solutions/bedslope_core.cpp

    r12004 r12878  
    55#include "./solutions.h"
    66#include "../toolkits/toolkits.h"
    7 #include "../objects/objects.h"
     7#include "../classes/objects/objects.h"
    88#include "../io/io.h"
    99#include "../EnumDefinitions/EnumDefinitions.h"
     
    1919        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
    2020
    21         _printf_(VerboseSolution(),"%s\n","   computing slope");
     21        if(VerboseSolution()) _pprintLine_("   computing slope");
    2222
    2323        /*Call on core computations: */
     
    2828       
    2929        if(save_results){
    30                 _printf_(VerboseSolution(),"   saving results\n");
     30                if(VerboseSolution()) _pprintLine_("   saving results");
    3131                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedSlopeXEnum);
    3232                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedSlopeYEnum);
  • issm/branches/trunk-jpl-damage/src/c/solutions/control_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    2020        int     num_controls,num_responses;
    2121        int     nsteps;
    22         double  tol_cm;
     22        IssmDouble  tol_cm;
    2323        bool    cm_gradient;
    2424        int     dim;
     
    2828
    2929        int*    control_type = NULL;
    30         double* responses=NULL;
     30        IssmDouble* responses=NULL;
    3131        int*    step_responses=NULL;
    32         double* maxiter=NULL;
    33         double* cm_jump=NULL;
     32        IssmDouble* maxiter=NULL;
     33        IssmDouble* cm_jump=NULL;
    3434               
    3535        /*intermediary: */
    36         double  search_scalar=1;
     36        IssmDouble  search_scalar=1;
    3737        OptArgs optargs;
    3838        OptPars optpars;
     
    4343
    4444        /*output: */
    45         double* J=NULL;
     45        IssmDouble* J=NULL;
    4646
    4747        /*Recover parameters used throughout the solution*/
     
    6666
    6767        /*Launch once a complete solution to set up all inputs*/
    68         _printf_(VerboseControl(),"%s\n","   preparing initial solution");
     68        if(VerboseControl()) _pprintLine_("   preparing initial solution");
    6969        if(isstokes) solutioncore(femmodel);
    7070
    7171        /*Initialize responses: */
    72         J=(double*)xmalloc(nsteps*sizeof(double));
    73         step_responses=(int*)xmalloc(num_responses*sizeof(int));
     72        J=xNew<IssmDouble>(nsteps);
     73        step_responses=xNew<int>(num_responses);
    7474               
    7575        /*Initialize some of the BrentSearch arguments: */
     
    8181
    8282                /*Display info*/
    83                 _printf_(VerboseControl(),"\n%s%i%s%i\n","   control method step ",n+1,"/",nsteps);
     83                if(VerboseControl()) _pprintLine_("\n" << "   control method step " << n+1 << "/" << nsteps);
    8484                for(i=0;i<num_responses;i++) step_responses[i]=(int)responses[n*num_responses+i];
    8585                femmodel->parameters->SetParam(step_responses,1,num_responses,StepResponsesEnum);
     
    8888                if(solution_type==SteadystateSolutionEnum) solutioncore(femmodel);
    8989
    90                 _printf_(VerboseControl(),"%s\n","   compute adjoint state:");
     90                if(VerboseControl()) _pprintLine_("   compute adjoint state:");
    9191                adjointcore(femmodel);
    9292                gradient_core(femmodel,n,search_scalar==0);
     
    9898                }
    9999
    100                 _printf_(VerboseControl(),"%s\n","   optimizing along gradient direction");
     100                if(VerboseControl()) _pprintLine_("   optimizing along gradient direction");
    101101                optpars.maxiter=(int)maxiter[n]; optpars.cm_jump=cm_jump[n];
    102102                BrentSearch(&search_scalar,J+n,&optpars,&objectivefunction,&optargs);
    103103
    104                 _printf_(VerboseControl(),"%s\n","   updating parameter using optimized search scalar"); //true means update save controls
     104                if(VerboseControl()) _pprintLine_("   updating parameter using optimized search scalar"); //true means update save controls
    105105                InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,true);
    106106               
     
    108108        }
    109109
    110         _printf_(VerboseControl(),"%s\n","   preparing final solution");
     110        if(VerboseControl()) _pprintLine_("   preparing final solution");
    111111        femmodel->parameters->SetParam(true,SaveResultsEnum);
    112112        solutioncore(femmodel);
     
    120120        cleanup_and_return:
    121121        /*Free ressources: */
    122         xfree((void**)&control_type);
    123         xfree((void**)&responses);
    124         xfree((void**)&step_responses);
    125         xfree((void**)&maxiter);
    126         xfree((void**)&cm_jump);
    127         xfree((void**)&J);
     122        xDelete<int>(control_type);
     123        xDelete<int>(step_responses);
     124        xDelete<IssmDouble>(maxiter);
     125        xDelete<IssmDouble>(responses);
     126        xDelete<IssmDouble>(cm_jump);
     127        xDelete<IssmDouble>(J);
    128128}
  • issm/branches/trunk-jpl-damage/src/c/solutions/controlconvergence.cpp

    r10197 r12878  
    88#endif
    99
    10 #include "../objects/objects.h"
     10#include "../classes/objects/objects.h"
    1111#include "../shared/shared.h"
    1212#include "../io/io.h"
     
    1717#include "./solutions.h"
    1818
    19 bool controlconvergence(double J, double tol_cm){
     19bool controlconvergence(IssmDouble J, IssmDouble tol_cm){
    2020
    2121        int i;
     
    2323
    2424        /*Has convergence been reached?*/
    25         if (!isnan(tol_cm) && J<tol_cm){
     25        if (!xIsNan<IssmDouble>(tol_cm) && J<tol_cm){
    2626                converged=true;
    27                 _printf_(VerboseConvergence(),"      Convergence criterion reached: J = %g < %g",J,tol_cm);
     27                if(VerboseConvergence()) _pprintString_("      Convergence criterion reached: J = " << J << " < " << tol_cm);
    2828        }
    2929
  • issm/branches/trunk-jpl-damage/src/c/solutions/controlrestart.cpp

    r12004 r12878  
    77#include "../EnumDefinitions/EnumDefinitions.h"
    88
    9 void controlrestart(FemModel* femmodel,double* J){
     9void controlrestart(FemModel* femmodel,IssmDouble* J){
    1010
    1111        int      num_controls;
     
    3333
    3434        /*Clean up and return*/
    35         xfree((void**)&control_type);
     35        xDelete<int>(control_type);
    3636}
  • issm/branches/trunk-jpl-damage/src/c/solutions/controltao_core.cpp

    r12004 r12878  
    44#include <config.h>
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    1717
    1818/*Local prototype*/
    19 int FormFunctionGradient(TaoSolver,Vec,double*,Vec,void*);
     19int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*);
    2020int IssmMonitor(TaoSolver,void*);
    2121typedef struct {
     
    3030        int        nsteps,maxiter;
    3131        AppCtx     user;
    32         TaoSolver  tao;
    33         double    *dummy          = NULL;
     32        TaoSolver  tao = 0;
     33        IssmDouble    *dummy          = NULL;
    3434        int       *control_list   = NULL;
    3535        Vector    *X              = NULL;
     
    4141        PetscGetArgs(&argc,&args);
    4242        ierr = TaoInitialize(&argc,&args,(char*)0,"");
    43         if(ierr) _error_("Could not initialize Tao");
     43        if(ierr) _error2_("Could not initialize Tao");
    4444
    4545        /*Recover some parameters*/
     
    5050        femmodel->parameters->FindParam(&dummy,NULL,NULL,InversionMaxiterPerStepEnum);
    5151        femmodel->parameters->SetParam(false,SaveResultsEnum);
    52         maxiter=nsteps*(int)dummy[0]; xfree((void**)&dummy);
     52        maxiter=nsteps*(int)dummy[0]; xDelete<IssmDouble>(dummy);
    5353
    5454        /*Initialize TAO*/
    55         _printf_(VerboseControl(),"%s\n","   Initializing the Toolkit for Advanced Optimization (TAO)");
    5655        TaoCreate(PETSC_COMM_WORLD,&tao);
     56        if(VerboseControl()) _pprintLine_("   Initializing the Toolkit for Advanced Optimization (TAO)");
    5757        TaoSetFromOptions(tao);
    5858        TaoSetType(tao,"tao_blmvm");
     
    7878
    7979        /*Solver optimization problem*/
    80         _printf_(VerboseControl(),"%s\n","   Starting optimization");
     80        if(VerboseControl()) _pprintLine_("   Starting optimization");
    8181        TaoSolve(tao);
    8282        TaoView(tao,PETSC_VIEWER_STDOUT_WORLD);
     
    8888
    8989        /*Finalize*/
    90         _printf_(VerboseControl(),"%s\n","   preparing final solution");
     90        if(VerboseControl()) _pprintLine_("   preparing final solution");
    9191        femmodel->parameters->SetParam(true,SaveResultsEnum);
    9292        void (*solutioncore)(FemModel*)=NULL;
     
    9595
    9696        /*Clean up and return*/
    97         xfree((void**)&control_list);
     97        xDelete<int>(control_list);
    9898        xdelete(&X);
    9999        TaoDestroy(&tao);
    100100        TaoFinalize();
    101101}
    102 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, double *fcn,Vec G,void *userCtx){
     102int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *userCtx){
    103103
    104104        /*Retreive arguments*/
     
    107107        FemModel *femmodel       = user->femmodel;
    108108        int      *cost_functions = NULL;
    109         double   *cost_functionsd= NULL;
     109        IssmDouble   *cost_functionsd= NULL;
    110110        Vector   *gradient       = NULL;
    111111        Vector   *X              = NULL;
     
    125125
    126126        /*Prepare objective function*/
    127         cost_functions=(int*)xmalloc(num_cost_functions*sizeof(int));
     127        cost_functions=xNew<int>(num_cost_functions);
    128128        for(int i=0;i<num_cost_functions;i++) cost_functions[i]=(int)cost_functionsd[i]; //FIXME
    129129        femmodel->parameters->SetParam(cost_functions,1,num_cost_functions,StepResponsesEnum);
     
    146146
    147147        /*Clean-up and return*/
    148         xfree((void**)&cost_functions);
    149         xfree((void**)&cost_functionsd);
     148        xDelete<int>(cost_functions);
     149        xDelete<IssmDouble>(cost_functionsd);
    150150        return 0;
    151151}
     
    153153
    154154        int       i,its,num_responses;
    155         double    f,gnorm,cnorm,xdiff;
     155        IssmDouble    f,gnorm,cnorm,xdiff;
    156156        AppCtx   *user      = (AppCtx *)userCtx;
    157157        FemModel *femmodel  = user->femmodel;
     
    163163
    164164        TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, NULL);
    165         if(its==0) _printf_(true,"Iter       Function      Residual  |  List of contributions\n");
    166         if(its==0) _printf_(true,"-----------------------------------+-----------------------\n");
    167         _printf_(true,"%4i   %12.7g  %12.7g  | ",its,f,gnorm);
     165        if(its==0) _pprintLine_("Iter       Function      Residual  |  List of contributions");
     166        if(its==0) _pprintLine_("-----------------------------------+-----------------------");
     167        _pprintString_(setw(4)<<its<<"   "<<setw(12)<<setprecision(7)<<f<<"  "<<setw(12)<<setprecision(7)<<gnorm<<"  | ");
    168168
    169169        /*Retrieve objective functions independently*/
    170170        for(i=0;i<num_responses;i++){
    171171                Responsex(&f,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnumToStringx(responses[i]),false,i);
    172                 _printf_(true," %12.7g ","",f);
     172                _pprintString_(" "<<setw(12)<<setprecision(7)<<f);
    173173        }
    174         _printf_(true,"\n");
     174        _pprintLine_("");
    175175
    176176        /*Clean-up and return*/
    177         xfree((void**)&responses);
     177        xDelete<int>(responses);
    178178        return 0;
    179179}
     
    181181#else
    182182void controltao_core(FemModel* femmodel){
    183         _error_("TAO not installed or PETSc version not supported");
     183        _error2_("TAO not installed or PETSc version not supported");
    184184}
    185185#endif //_HAVE_TAO_
  • issm/branches/trunk-jpl-damage/src/c/solutions/convergence.cpp

    r12004 r12878  
    33 */
    44
    5 #include "../objects/objects.h"
     5#include "../classes/objects/objects.h"
    66#include "../modules/modules.h"
    77#include "../io/io.h"
     
    1919        Vector* KUoldF=NULL;
    2020        Vector* duf=NULL;
    21         double ndu,nduinf,nu;
    22         double nKUF;
    23         double nKUoldF;
    24         double nF;
    25         double solver_residue,res;
     21        IssmDouble ndu,nduinf,nu;
     22        IssmDouble nKUF;
     23        IssmDouble nKUoldF;
     24        IssmDouble nF;
     25        IssmDouble solver_residue,res;
    2626
    2727        /*convergence options*/
    28         double eps_res;
    29         double eps_rel;
    30         double eps_abs;
    31         double yts;
     28        IssmDouble eps_res;
     29        IssmDouble eps_rel;
     30        IssmDouble eps_abs;
     31        IssmDouble yts;
    3232
    3333        /*If uf is NULL in input, f-set is nil, model is fully constrained, therefore converged from
     
    5555                nF=pf->Norm(NORM_TWO);
    5656                solver_residue=nKUF/nF;
    57                 _printf_(true,"\n%s%g\n","   solver residue: norm(KU-F)/norm(F)=",solver_residue);
     57                _pprintLine_("\n" << "   solver residue: norm(KU-F)/norm(F)=" << solver_residue);
    5858
    5959                //clean up
     
    7070        nF=pf->Norm(NORM_TWO);
    7171        res=nKUoldF/nF;
    72         if (isnan(res)){
    73                 _printf_(true,"norm nf = %lf and norm kuold = %lf\n",nF,nKUoldF);
    74                 _error_("mechanical equilibrium convergence criterion is NaN!");
     72        if (xIsNan<IssmDouble>(res)){
     73                _pprintLine_("norm nf = " << nF << "f and norm kuold = " << nKUoldF << "f");
     74                _error2_("mechanical equilibrium convergence criterion is NaN!");
    7575        }
    7676
     
    8181        //print
    8282        if(res<eps_res){
    83                 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n","   mechanical equilibrium convergence criterion",res*100," < ",eps_res*100," %");
     83                if(VerboseConvergence()) _pprintLine_(setw(50) << left << "   mechanical equilibrium convergence criterion" << res*100 << " < " << eps_res*100 << " %");
    8484                converged=true;
    8585        }
    8686        else{
    87                 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n","   mechanical equilibrium convergence criterion",res*100," > ",eps_res*100," %");
     87                if(VerboseConvergence()) _pprintLine_(setw(50) << left << "   mechanical equilibrium convergence criterion" << res*100 << " > " << eps_res*100 << " %");
    8888                converged=false;
    8989        }
    9090
    9191        /*Relative criterion (optional)*/
    92         if (!isnan(eps_rel) || (VerboseConvergence())){
     92        if (!xIsNan<IssmDouble>(eps_rel) || (VerboseConvergence())){
    9393
    9494                //compute norm(du)/norm(u)
     
    9696                ndu=duf->Norm(NORM_TWO); nu=old_uf->Norm(NORM_TWO);
    9797
    98                 if (isnan(ndu) || isnan(nu)) _error_("convergence criterion is NaN!");
     98                if (xIsNan<IssmDouble>(ndu) || xIsNan<IssmDouble>(nu)) _error2_("convergence criterion is NaN!");
    9999
    100100                //clean up
     
    102102
    103103                //print
    104                 if (!isnan(eps_rel)){
     104                if (!xIsNan<IssmDouble>(eps_rel)){
    105105                        if((ndu/nu)<eps_rel){
    106                                 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n","   Convergence criterion: norm(du)/norm(u)",ndu/nu*100," < ",eps_rel*100," %");
     106                                if(VerboseConvergence()) _pprintLine_(setw(50) << left << "   Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " < " << eps_rel*100 << " %");
    107107                        }
    108108                        else{
    109                                 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n","   Convergence criterion: norm(du)/norm(u)",ndu/nu*100," > ",eps_rel*100," %");
     109                                if(VerboseConvergence()) _pprintLine_(setw(50) << left << "   Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " > " << eps_rel*100 << " %");
    110110                                converged=false;
    111111                        }
    112112                }
    113                 else _printf_(true,"%-50s%g%s\n","   Convergence criterion: norm(du)/norm(u)",ndu/nu*100," %");
     113                else _pprintLine_(setw(50) << left << "   Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " %");
    114114
    115115        }
    116116
    117117        /*Absolute criterion (Optional) = max(du)*/
    118         if (!isnan(eps_abs) || (VerboseConvergence())){
     118        if (!xIsNan<IssmDouble>(eps_abs) || (VerboseConvergence())){
    119119
    120120                //compute max(du)
    121121                duf=old_uf->Duplicate(); old_uf->Copy(duf); duf->AYPX(uf,-1.0);
    122122                ndu=duf->Norm(NORM_TWO); nduinf=duf->Norm(NORM_INF);
    123                 if (isnan(ndu) || isnan(nu)) _error_("convergence criterion is NaN!");
     123                if (xIsNan<IssmDouble>(ndu) || xIsNan<IssmDouble>(nu)) _error2_("convergence criterion is NaN!");
    124124
    125125                //clean up
     
    127127
    128128                //print
    129                 if (!isnan(eps_abs)){
     129                if (!xIsNan<IssmDouble>(eps_abs)){
    130130                        if ((nduinf*yts)<eps_abs){
    131                                 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n","   Convergence criterion: max(du)",nduinf*yts," < ",eps_abs," m/yr");
     131                                if(VerboseConvergence()) _pprintLine_(setw(50) << left << "   Convergence criterion: max(du)" << nduinf*yts << " < " << eps_abs << " m/yr");
    132132                        }
    133133                        else{
    134                                 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n","   Convergence criterion: max(du)",nduinf*yts," > ",eps_abs," m/yr");
     134                                if(VerboseConvergence()) _pprintLine_(setw(50) << left << "   Convergence criterion: max(du)" << nduinf*yts << " > " << eps_abs << " m/yr");
    135135                                converged=false;
    136136                        }
    137137                }
    138                 else  _printf_(true,"%-50s%g%s\n","   Convergence criterion: max(du)",nduinf*yts," m/yr");
     138                else  _pprintLine_(setw(50) << left << "   Convergence criterion: max(du)" << nduinf*yts << " m/yr");
    139139
    140140        }
  • issm/branches/trunk-jpl-damage/src/c/solutions/diagnostic_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    5959        if(ishutter){
    6060                       
    61                 _printf_(VerboseSolution(),"%s\n","   computing hutter velocities");
     61                if(VerboseSolution()) _pprintLine_("   computing hutter velocities");
    6262
    6363                //Take the last velocity into account so that the velocity on the MacAyeal domain is not zero
     
    7272        if (ismacayealpattyn ^ isstokes){ // ^ = xor
    7373               
    74                 _printf_(VerboseSolution(),"%s\n","   computing velocities");
     74                if(VerboseSolution()) _pprintLine_("   computing velocities");
    7575                femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum);
    7676                if(isnewton)
     
    8282        if (ismacayealpattyn && isstokes){
    8383
    84                 _printf_(VerboseSolution(),"%s\n","   computing coupling macayealpattyn and stokes velocities and pressure ");
     84                if(VerboseSolution()) _pprintLine_("   computing coupling macayealpattyn and stokes velocities and pressure ");
    8585                solver_stokescoupling_nonlinear(femmodel,conserve_loads);
    8686        }
     
    8888        if (dim==3 & (ishutter || ismacayealpattyn)){
    8989
    90                 _printf_(VerboseSolution(),"%s\n","   computing vertical velocities");
     90                if(VerboseSolution()) _pprintLine_("   computing vertical velocities");
    9191                femmodel->SetCurrentConfiguration(DiagnosticVertAnalysisEnum);
    9292                solver_linear(femmodel);
     
    9595
    9696        if(save_results){
    97                 _printf_(VerboseSolution(),"   saving results\n");
     97                if(VerboseSolution()) _pprintLine_("   saving results");
    9898                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum);
    9999                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum);
     
    105105
    106106        /*Free ressources:*/
    107         xfree((void**)&requested_outputs);
     107        xDelete<int>(requested_outputs);
    108108}
  • issm/branches/trunk-jpl-damage/src/c/solutions/enthalpy_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../EnumDefinitions/EnumDefinitions.h"
     
    2121        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
    2222
    23         _printf_(VerboseSolution(),"   computing enthalpy\n");
     23        if(VerboseSolution()) _pprintLine_("   computing enthalpy");
    2424        femmodel->SetCurrentConfiguration(EnthalpyAnalysisEnum);
    2525        solver_nonlinear(femmodel,true);
     
    2929
    3030        if(save_results){
    31                 _printf_(VerboseSolution(),"   saving results\n");
     31                if(VerboseSolution()) _pprintLine_("   saving results");
    3232                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum);
    3333                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnthalpyEnum);
  • issm/branches/trunk-jpl-damage/src/c/solutions/gradient_core.cpp

    r11708 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    1616
    1717        /*Intermediaries*/
    18         double  norm_inf;
    19         double *norm_list    = NULL;
     18        IssmDouble  norm_inf;
     19        IssmDouble *norm_list    = NULL;
    2020        Vector*     new_gradient = NULL;
    2121        Vector*     gradient     = NULL;
     
    2323
    2424        /*Compute gradient*/
    25         _printf_(VerboseControl(),"   compute cost function gradient\n");
     25        if(VerboseControl()) _pprintLine_("   compute cost function gradient");
    2626        Gradjx(&gradient,&norm_list,femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters);
    2727
    2828        if (orthogonalize){
    29                 _printf_(VerboseControl(),"   orthogonalization\n");
     29                if(VerboseControl()) _pprintLine_("   orthogonalization");
    3030                ControlInputGetGradientx(&old_gradient,femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters);
    3131                Orthx(&new_gradient,gradient,old_gradient); xdelete(&old_gradient); xdelete(&gradient);
     
    3737        /*Check that gradient is clean*/
    3838        norm_inf=new_gradient->Norm(NORM_INF);
    39         if(norm_inf<=0)    _error_("||∂J/∂α||∞ = 0    gradient norm is zero");
    40         if(isnan(norm_inf))_error_("||∂J/∂α||∞ = NaN  gradient norm is NaN");
     39        if(norm_inf<=0)    _error2_("||∂J/∂α||∞ = 0    gradient norm is zero");
     40        if(xIsNan<IssmDouble>(norm_inf))_error2_("||∂J/∂α||∞ = NaN  gradient norm is NaN");
    4141
    4242        /*plug back into inputs: */
     
    4848
    4949        /*Clean up and return*/
    50         xfree((void**)&norm_list);
     50        xDelete<IssmDouble>(norm_list);
    5151}
  • issm/branches/trunk-jpl-damage/src/c/solutions/hydrology_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    1717
    1818        /*intermediary*/
    19         double time;
     19        IssmDouble time;
    2020        int    nsteps;
    21         double starttime,final_time;
    22         double dt;
     21        IssmDouble starttime,final_time;
     22        IssmDouble dt;
    2323        bool   save_results;
    2424        int    output_frequency;
     
    4545        for(i=0;i<nsteps;i++){
    4646               
    47                 if(nsteps)_printf_(VerboseSolution(),"time step:%i/%i\n",i+1,nsteps);
     47                if(nsteps)if(VerboseSolution()) _pprintLine_("time step:" << i+1 << "/" << nsteps);
    4848                time+=dt;
    4949                femmodel->parameters->SetParam(time,TimeEnum);
     
    5353
    5454                if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){
    55                         _printf_(VerboseSolution(),"   saving results \n");
     55                        if(VerboseSolution()) _pprintLine_("   saving results ");
    5656                        //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WatercolumnEnum,i+1,time);
    5757                        //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVxEnum,i+1,time);
     
    5959                       
    6060                        /*unload results*/
    61                         _printf_(VerboseSolution(),"   saving temporary results\n");
     61                        if(VerboseSolution()) _pprintLine_("   saving temporary results");
    6262                        OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
    6363                }
  • issm/branches/trunk-jpl-damage/src/c/solutions/hydrology_core_step.cpp

    r9761 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    1313#include "../solvers/solvers.h"
    1414
    15 void hydrology_core_step(FemModel* femmodel,int step, double time){
     15void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time){
    1616       
    1717        bool modify_loads=true;
    1818
    19         _printf_(VerboseSolution(),"   computing water column\n");
     19        if(VerboseSolution()) _pprintLine_("   computing water column");
    2020        femmodel->SetCurrentConfiguration(HydrologyAnalysisEnum);
    2121        solver_nonlinear(femmodel,modify_loads);
  • issm/branches/trunk-jpl-damage/src/c/solutions/issm.cpp

    r12168 r12878  
    3030
    3131        /*time*/
    32         double   start, finish;
    33         double   start_core, finish_core;
    34         double   start_init, finish_init;
     32        IssmPDouble   start, finish;
     33        IssmPDouble   start_core, finish_core;
     34        IssmPDouble   start_init, finish_init;
    3535        int      ierr;
     36
     37        /*profiling*/   
     38        bool profiling = false;
     39        IssmPDouble Time_start, Flops_start;
     40        IssmPDouble Solution_time, Memory_use, Current_flops;
    3641
    3742        ISSMBOOT();
     
    4045        #ifdef _HAVE_PETSC_
    4146        ierr=PetscInitialize(&argc,&argv,(char*)0,""); 
    42         if(ierr) _error_("Could not initialize Petsc");
     47        if(ierr) _error2_("Could not initialize Petsc");
    4348        #else
    4449        #ifdef _HAVE_MPI_
     
    5055        MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime();
    5156        #else
    52         start=(double)clock();
     57        start=(IssmPDouble)clock();
    5358        #endif
    5459
     
    6065
    6166        /*First process inputs*/
    62         _printf_(true,"\n");
    63         _printf_(true,"Ice Sheet System Model (%s) version %s\n",PACKAGE_NAME,PACKAGE_VERSION);
    64         _printf_(true,"(website: %s contact: %s)\n",PACKAGE_URL,PACKAGE_BUGREPORT);
    65         _printf_(true,"\n");
     67        _pprintLine_("");
     68        _pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION);
     69        _pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")");
     70        _pprintLine_("");
    6671        ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,argc,argv);
    6772
     
    7378        MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime();
    7479        #else
    75         start_init=(double)clock();
     80        start_init=(IssmPDouble)clock();
    7681        #endif
    7782        femmodel=new FemModel(binfilename,outbinfilename,solution_type,analyses,numanalyses);
     
    9499        femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
    95100        femmodel->parameters->FindParam(&tao_analysis,InversionTaoEnum);
     101        femmodel->parameters->FindParam(&profiling,DebugProfilingEnum);
     102
    96103        #ifdef _HAVE_MPI_
    97104        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
    98105        #else
    99         finish_init=(double)clock();
    100         #endif
    101 
    102         _printf_(true,"call computational core:\n");
     106        finish_init=(IssmPDouble)clock();
     107        #endif
     108
     109        _pprintLine_("call computational core:");
    103110        #ifdef _HAVE_MPI_
    104111        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    105112        #else
    106         start_core=(double)clock();
    107         #endif
    108        
     113        start_core=(IssmPDouble)clock();
     114        #endif
     115       
     116        if(profiling)ProfilingStart(&Time_start,&Flops_start);
     117
    109118        if(dakota_analysis){
    110119                #ifdef _HAVE_DAKOTA_
    111120                Dakotax(femmodel);
    112121                #else
    113                 _error_("ISSM was not compiled with dakota support, cannot carry out dakota analysis!");
     122                _error2_("ISSM was not compiled with dakota support, cannot carry out dakota analysis!");
    114123                #endif
    115124        }
     
    121130                 control_core(femmodel);
    122131                #else
    123                 _error_("ISSM was not compiled with control support, cannot carry out dakota analysis!");
     132                _error2_("ISSM was not compiled with control support, cannot carry out dakota analysis!");
    124133                #endif
    125134        }
     
    127136                solutioncore(femmodel);
    128137        }
     138
     139        if(profiling){
     140                ProfilingEnd(&Solution_time,&Memory_use,&Current_flops,Time_start,Flops_start);
     141                femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, ProfilingSolutionTimeEnum, Solution_time, 1, 0));
     142                femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, ProfilingCurrentMemEnum, Memory_use, 1, 0));
     143                femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, ProfilingCurrentFlopsEnum, Current_flops, 1, 0));
     144        }
     145
     146
    129147        #ifdef _HAVE_MPI_
    130148        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    131149        #else
    132         finish_core=(double)clock();
    133         #endif
    134        
    135         _printf_(true,"write results to disk:\n");
     150        finish_core=(IssmPDouble)clock();
     151        #endif
     152
     153        _pprintLine_("write results to disk:");
    136154        OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
    137155
     
    139157        pfclose(output_fid,lockfilename);
    140158        if (waitonlock>0){
    141                 _printf_(true,"write lock file:\n");
     159                _pprintLine_("write lock file:");
    142160                WriteLockFile(lockfilename);
    143161        }
    144162
    145         /*Free ressources */
    146         xfree((void**)&analyses);
    147         xfree((void**)&lockfilename);
    148         xfree((void**)&binfilename);
    149         xfree((void**)&outbinfilename);
    150         xfree((void**)&petscfilename);
     163        /*Free resources */
     164        xDelete<int>(analyses);
     165        xDelete<char>(lockfilename);
     166        xDelete<char>(binfilename);
     167        xDelete<char>(outbinfilename);
     168        xDelete<char>(petscfilename);
    151169        delete femmodel;
    152170
     
    154172        #ifdef _HAVE_MPI_
    155173        MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( );
    156         _printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",finish_init-start_init);
    157         _printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",finish_core-start_core);
    158         _printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600),int(int(finish-start)%3600/60),int(finish-start)%60);
    159         #else
    160         finish=(double)clock();
    161         _printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",(finish_init-start_init)/CLOCKS_PER_SEC);
    162         _printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",(finish_core-start_core)/CLOCKS_PER_SEC);
    163         _printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600/CLOCKS_PER_SEC),int(int((finish-start)/CLOCKS_PER_SEC)%3600/60),(int(finish-start)/CLOCKS_PER_SEC)%60);
    164         #endif
    165        
    166                
     174        _pprintLine_("");
     175        _pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<finish_init-start_init);
     176        _pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<finish_core-start_core);
     177        _pprintLine_("");
     178        _pprintLine_("   Total elapsed time:"<<int((finish-start)/3600)<<" hrs "<<int(int(finish-start)%3600/60)<<" min "<<int(finish-start)%60<<" sec");
     179        _pprintLine_("");
     180        #else
     181        finish=(IssmPDouble)clock();
     182        _pprintLine_("");
     183        _pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<(finish_init-start_init)/CLOCKS_PER_SEC);
     184        _pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<(finish_core-start_core)/CLOCKS_PER_SEC);
     185        _pprintLine_("");
     186        _pprintLine_("   Total elapsed time:"
     187                                <<int((finish-start)/CLOCKS_PER_SEC/3600)<<" hrs "
     188                                <<int(int(finish-start)/CLOCKS_PER_SEC%3600/60)<<" min "
     189                                <<int(finish-start)/CLOCKS_PER_SEC%60<<" sec");
     190        _pprintLine_("");
     191        #endif
    167192       
    168193        #ifdef _HAVE_PETSC_
    169         _printf_(true,"closing MPI and Petsc\n");
     194        _pprintLine_("closing MPI and Petsc");
    170195        PetscFinalize();
    171196        #else
    172197        #ifdef _HAVE_MPI_
    173         _printf_(true,"closing MPI and Petsc\n");
     198        _pprintLine_("closing MPI and Petsc");
    174199        MPI_Finalize();
    175200        #endif
  • issm/branches/trunk-jpl-damage/src/c/solutions/objectivefunction.cpp

    r12004 r12878  
    33 */
    44
    5 /*include files: {{{1*/
     5/*include files: {{{*/
    66#ifdef HAVE_CONFIG_H
    77        #include <config.h>
     
    1111
    1212#include "../toolkits/toolkits.h"
    13 #include "../objects/objects.h"
     13#include "../classes/objects/objects.h"
    1414#include "../shared/shared.h"
    1515#include "../EnumDefinitions/EnumDefinitions.h"
     
    2020/*}}}*/
    2121
    22 double objectivefunction(double search_scalar,OptArgs* optargs){
     22IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs){
    2323
    2424        int i; 
    2525       
    2626        /*output: */
    27         double J;
     27        IssmDouble J;
    2828       
    2929        /*parameters: */
     
    4949        }
    5050        else{
    51                 _error_("Solution %s not implemented yet",EnumToStringx(solution_type));
     51                _error2_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
    5252        }
    5353
     
    6666        }
    6767        else{
    68                 _error_("Solution %s not implemented yet",EnumToStringx(solution_type));
     68                _error2_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
    6969        }
    7070
  • issm/branches/trunk-jpl-damage/src/c/solutions/prognostic_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    1616        /*parameters: */
    1717        bool save_results;
     18        bool issmbgradients,ispdd,isdelta18o;
    1819
    1920        /*activate formulation: */
     
    2223        /*recover parameters: */
    2324        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
     25        femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);
     26        femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum);
     27        femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
    2428
    25         _printf_(VerboseSolution(),"   call computational core\n");
     29        if(issmbgradients){
     30          _printf_(VerboseSolution(),"  call smb gradients module\n");
     31          SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
     32        }
     33        if(ispdd){
     34                if(isdelta18o){
     35                        if(VerboseSolution()) _pprintLine_("   call Delta18oParametrization module");
     36                        Delta18oParameterizationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
     37                }
     38                if(VerboseSolution()) _pprintLine_("   call positive degree day module");
     39                PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
     40        }
     41        if(VerboseSolution()) _pprintLine_("   call computational core");
    2642        solver_linear(femmodel);
    27                
     43       
    2844        if(save_results){
    29                 _printf_(VerboseSolution(),"   saving results\n");
     45                if(VerboseSolution()) _pprintLine_("   saving results");
    3046                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum);
    3147        }
  • issm/branches/trunk-jpl-damage/src/c/solutions/solutions.h

    r12004 r12878  
    66#define SOLUTIONS_H_
    77
    8 #include "../objects/objects.h"
     8#include "../classes/objects/objects.h"
    99#include "../io/io.h"
    1010
     
    1818void diagnostic_core(FemModel* femmodel);
    1919void hydrology_core(FemModel* femmodel);
    20 void hydrology_core_step(FemModel* femmodel,int step, double time);
     20void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time);
    2121void thermal_core(FemModel* femmodel);
    2222void enthalpy_core(FemModel* femmodel);
     
    3030void steadystate_core(FemModel* femmodel);
    3131void transient_core(FemModel* femmodel);
    32 double objectivefunction(double search_scalar,OptArgs* optargs);
     32IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs);
    3333
    3434//convergence:
    3535void convergence(bool* pconverged, Matrix* K_ff,Vector* p_f,Vector* u_f,Vector* u_f_old,Parameters* parameters);
    36 bool controlconvergence(double J,double tol_cm);
     36bool controlconvergence(IssmDouble J,IssmDouble tol_cm);
    3737bool steadystateconvergence(FemModel* femmodel);
    3838
    3939//optimization
    40 int GradJSearch(double* search_vector,FemModel* femmodel,int step);
     40int GradJSearch(IssmDouble* search_vector,FemModel* femmodel,int step);
    4141
    4242//diverse
    4343void ProcessArguments(int* solution,char** pbinname,char** poutbinname,char** ppetscname,char** plockname,int argc,char **argv);
    4444void WriteLockFile(char* filename);
    45 void controlrestart(FemModel* femmodel,double* J);
     45void controlrestart(FemModel* femmodel,IssmDouble* J);
    4646void ResetBoundaryConditions(FemModel* femmodel, int analysis_type);
    4747
  • issm/branches/trunk-jpl-damage/src/c/solutions/steadystate_core.cpp

    r12004 r12878  
    99#endif
    1010
     11#include "../include/include.h"
    1112#include "../toolkits/toolkits.h"
    12 #include "../objects/objects.h"
     13#include "../classes/objects/objects.h"
    1314#include "../shared/shared.h"
    1415#include "../io/io.h"
     
    1617#include "./solutions.h"
    1718#include "../modules/modules.h"
    18 #include "../include/include.h"
    1919#include "../solvers/solvers.h"
    2020
     
    4343        for(;;){
    4444       
    45                 _printf_(VerboseSolution(),"%s%i\n","   computing temperature and velocity for step: ",step);
     45                if(VerboseSolution()) _pprintLine_("   computing temperature and velocity for step: " << step);
    4646                #ifdef _HAVE_THERMAL_
    4747                if(isenthalpy==0){
     
    5252                }
    5353                #else
    54                 _error_("ISSM was not compiled with thermal capabilities. Exiting");
     54                _error2_("ISSM was not compiled with thermal capabilities. Exiting");
    5555                #endif
    5656
    57                 _printf_(VerboseSolution(),"%s\n","   computing new velocity");
     57                if(VerboseSolution()) _pprintLine_("   computing new velocity");
    5858                diagnostic_core(femmodel);
    5959
    6060                if (step>1){
    61                         _printf_(VerboseSolution(),"%s\n","   checking velocity, temperature and pressure convergence");
     61                        if(VerboseSolution()) _pprintLine_("   checking velocity, temperature and pressure convergence");
    6262                        if(steadystateconvergence(femmodel)) break;
    6363                }
    6464                if(step>maxiter){
    65                         _printf_(VerboseSolution(),"%s%i%s\n","   maximum number steadystate iterations ",maxiter," reached");
     65                        if(VerboseSolution()) _pprintLine_("   maximum number steadystate iterations " << maxiter << " reached");
    6666                        break;
    6767                }
    6868               
    69                 _printf_(VerboseSolution(),"%s\n","   saving velocity, temperature and pressure to check for convergence at next step");
     69                if(VerboseSolution()) _pprintLine_("   saving velocity, temperature and pressure to check for convergence at next step");
    7070                InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum,VxPicardEnum);
    7171                InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum,VyPicardEnum);
     
    7979       
    8080        if(save_results){
    81                 _printf_(VerboseSolution(),"   saving results\n");
     81                if(VerboseSolution()) _pprintLine_("   saving results");
    8282                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum);
    8383                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum);
     
    9393
    9494        /*Free ressources:*/
    95         xfree((void**)&requested_outputs);
     95        xDelete<int>(requested_outputs);
    9696}
  • issm/branches/trunk-jpl-damage/src/c/solutions/steadystateconvergence.cpp

    r9677 r12878  
    99#endif
    1010
    11 #include "../objects/objects.h"
     11#include "../classes/objects/objects.h"
    1212#include "../shared/shared.h"
    1313#include "../Container/Container.h"
     
    2828        int temperatureenums[2]={TemperatureEnum,TemperatureOldEnum};
    2929        int convergencecriterion[1]={RelativeEnum}; //criterions for convergence, RelativeEnum or AbsoluteEnum
    30         double convergencecriterionvalue[1]; //value of criterion to be respected
     30        IssmDouble convergencecriterionvalue[1]; //value of criterion to be respected
    3131
    3232        /*retrieve parameters: */
  • issm/branches/trunk-jpl-damage/src/c/solutions/surfaceslope_core.cpp

    r12004 r12878  
    55#include "./solutions.h"
    66#include "../toolkits/toolkits.h"
    7 #include "../objects/objects.h"
     7#include "../classes/objects/objects.h"
    88#include "../io/io.h"
    99#include "../EnumDefinitions/EnumDefinitions.h"
     
    1919        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
    2020
    21         _printf_(VerboseSolution(),"%s\n","computing slope...");
     21        if(VerboseSolution()) _pprintLine_("computing slope...");
    2222
    2323        /*Call on core computations: */
     
    2828       
    2929        if(save_results){
    30                 _printf_(VerboseSolution(),"saving results:\n");
     30                if(VerboseSolution()) _pprintLine_("saving results:");
    3131                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceSlopeXEnum);
    3232                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceSlopeYEnum);
  • issm/branches/trunk-jpl-damage/src/c/solutions/thermal_core.cpp

    r12004 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../shared/shared.h"
    88#include "../io/io.h"
     
    1616
    1717        /*intermediary*/
    18         double melting_offset;
     18        IssmDouble melting_offset;
    1919        bool   save_results;
    2020        bool   dakota_analysis  = false;
     
    2929        }
    3030
    31         _printf_(VerboseSolution(),"   computing temperatures\n");
     31        if(VerboseSolution()) _pprintLine_("   computing temperatures");
    3232        femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);
    3333        solver_thermal_nonlinear(femmodel);
    3434
    35         _printf_(VerboseSolution(),"   computing melting\n");
     35        if(VerboseSolution()) _pprintLine_("   computing melting");
    3636        femmodel->SetCurrentConfiguration(MeltingAnalysisEnum);
    3737        solver_linear(femmodel);
    3838
    3939        if(save_results){
    40                 _printf_(VerboseSolution(),"   saving results\n");
     40                if(VerboseSolution()) _pprintLine_("   saving results");
    4141                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum);
    4242                InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BasalforcingsMeltingRateEnum);
  • issm/branches/trunk-jpl-damage/src/c/solutions/transient_core.cpp

    r12004 r12878  
    1010
    1111#include "../toolkits/toolkits.h"
    12 #include "../objects/objects.h"
     12#include "../classes/objects/objects.h"
    1313#include "../shared/shared.h"
    1414#include "../io/io.h"
     
    2323
    2424        /*parameters: */
    25         double starttime,finaltime,dt,yts;
     25        IssmDouble starttime,finaltime,dt,yts;
    2626        bool   isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy;
    2727        bool   save_results,dakota_analysis;
     
    3434        /*intermediary: */
    3535        int    step;
    36         double time;
     36        IssmDouble time;
    3737
    3838        //first recover parameters common to all solutions
     
    8686                femmodel->parameters->SetParam(step,StepEnum);
    8787
    88                 _printf_(VerboseSolution(),"iteration %i/%g  time [yr]: %-7.3g (time step: %.2g)\n",step,floor((finaltime-time)/dt)+step,time/yts,dt/yts);
     88                if(VerboseSolution()) _pprintLine_("iteration " << step << "/" << floor((finaltime-time)/dt)+step << "  time [yr]: " << time/yts << " (time step: " << dt/yts << ")");
    8989                if(step%output_frequency==0 || time==finaltime)
    9090                 save_results=true;
     
    9494
    9595                if(isthermal && dim==3){
    96                         _printf_(VerboseSolution(),"   computing temperatures\n");
     96                        if(VerboseSolution()) _pprintLine_("   computing temperatures");
    9797                        #ifdef _HAVE_THERMAL_
    9898                        if(isenthalpy==0){
     
    103103                        }
    104104                        #else
    105                         _error_("ISSM was not compiled with thermal capabilities. Exiting");
     105                        _error2_("ISSM was not compiled with thermal capabilities. Exiting");
    106106                        #endif
    107107                }
    108 
     108               
    109109                if(isdiagnostic){
    110                         _printf_(VerboseSolution(),"   computing new velocity\n");
     110                        if(VerboseSolution()) _pprintLine_("   computing new velocity");
    111111                        #ifdef _HAVE_DIAGNOSTIC_
    112112                        diagnostic_core(femmodel);
    113113                        #else
    114                         _error_("ISSM was not compiled with diagnostic capabilities. Exiting");
     114                        _error2_("ISSM was not compiled with diagnostic capabilities. Exiting");
    115115                        #endif
    116116                }
    117117
    118118                if(isprognostic){
    119                         _printf_(VerboseSolution(),"   computing new thickness\n");
     119                        if(VerboseSolution()) _pprintLine_("   computing new thickness");
    120120                        prognostic_core(femmodel);
    121                         _printf_(VerboseSolution(),"   updating vertices positions\n");
     121                        if(VerboseSolution()) _pprintLine_("   updating vertices positions");
    122122                        UpdateVertexPositionsx(femmodel->elements, femmodel->nodes,femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters);
    123123                }
    124124
    125125                if(isgroundingline){
    126                         _printf_(VerboseSolution(),"   computing new grounding line position\n");
     126                        if(VerboseSolution()) _pprintLine_("   computing new grounding line position");
    127127                        #ifdef _HAVE_GROUNDINGLINE_
    128128                        GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
    129129                        #else
    130                         _error_("ISSM was not compiled with grounding line migration capabilities. Exiting");
     130                        _error2_("ISSM was not compiled with grounding line migration capabilities. Exiting");
    131131                        #endif
    132132                }
     
    134134                /*unload results*/
    135135                if(save_results){
    136                         _printf_(VerboseSolution(),"   saving transient results\n");
     136                        if(VerboseSolution()) _pprintLine_("   saving transient results");
    137137                        InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceEnum);
    138138                        InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum);
     
    141141                        RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs);
    142142
    143                         _printf_(VerboseSolution(),"   saving temporary results\n");
     143                        if(VerboseSolution()) _pprintLine_("   saving temporary results");
    144144                        OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
    145145                }
     
    147147
    148148        /*Free ressources:*/
    149         xfree((void**)&requested_outputs);
     149        xDelete<int>(requested_outputs);
    150150}
  • issm/branches/trunk-jpl-damage/src/c/solvers/solver_adjoint_linear.cpp

    r11684 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../EnumDefinitions/EnumDefinitions.h"
    88#include "../modules/modules.h"
  • issm/branches/trunk-jpl-damage/src/c/solvers/solver_linear.cpp

    r11684 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../EnumDefinitions/EnumDefinitions.h"
    88#include "../modules/modules.h"
  • issm/branches/trunk-jpl-damage/src/c/solvers/solver_newton.cpp

    r12280 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../io/io.h"
    88#include "../EnumDefinitions/EnumDefinitions.h"
     
    1717        int    num_unstable_constraints;
    1818        int    count;
    19         double kmax;
     19        IssmDouble kmax;
    2020        Matrix* Kff = NULL;
    2121        Matrix* Kfs    = NULL;
     
    7070                        bool max_iteration_state=false;
    7171                        int tempStep=1;
    72                         double tempTime=1.0;
     72                        IssmDouble tempTime=1.0;
    7373                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
    7474                        break;
    7575                }
    7676                if(count>=max_nonlinear_iterations){
    77                         _printf_(true,"   maximum number of Newton iterations (%i) exceeded\n",max_nonlinear_iterations);
     77                        _pprintLine_("   maximum number of Newton iterations (" << max_nonlinear_iterations << ") exceeded");
    7878                        bool max_iteration_state=true;
    7979                        int tempStep=1;
    80                         double tempTime=1.0;
     80                        IssmDouble tempTime=1.0;
    8181                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
    8282                        break;
     
    100100        }
    101101
    102         _printf_(VerboseConvergence(),"\n   total number of iterations: %i\n",count-1);
     102        if(VerboseConvergence()) _pprintLine_("\n   total number of iterations: " << count-1);
    103103
    104104        /*clean-up*/
  • issm/branches/trunk-jpl-damage/src/c/solvers/solver_nonlinear.cpp

    r12280 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../io/io.h"
    88#include "../EnumDefinitions/EnumDefinitions.h"
     
    7373
    7474                ConstraintsStatex(&constraints_converged, &num_unstable_constraints, femmodel->elements,femmodel->nodes,femmodel->vertices,loads,femmodel->materials,femmodel->parameters);
    75                 _printf_(VerboseConvergence(),"   number of unstable constraints: %i\n",num_unstable_constraints);
     75                if(VerboseConvergence()) _pprintLine_("   number of unstable constraints: " << num_unstable_constraints);
    7676
    7777                //rift convergence
     
    8888                        bool max_iteration_state=false;
    8989                        int tempStep=1;
    90                         double tempTime=1.0;
     90                        IssmDouble tempTime=1.0;
    9191                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
    9292                        break;
    9393                }
    9494                if(count>=max_nonlinear_iterations){
    95                         _printf_(true,"   maximum number of nonlinear iterations (%i) exceeded\n",max_nonlinear_iterations);
     95                        _pprintLine_("   maximum number of nonlinear iterations (" << max_nonlinear_iterations << ") exceeded");
    9696                        converged=true;
    9797                        InputUpdateFromConstantx( femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,converged,ConvergedEnum);
     
    9999                        bool max_iteration_state=true;
    100100                        int tempStep=1;
    101                         double tempTime=1.0;
     101                        IssmDouble tempTime=1.0;
    102102                        femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime));
    103103                        break;
     
    105105        }
    106106
    107         _printf_(VerboseConvergence(),"\n   total number of iterations: %i\n",count-1);
     107        if(VerboseConvergence()) _pprintLine_("\n   total number of iterations: " << count-1);
    108108
    109109        /*clean-up*/
  • issm/branches/trunk-jpl-damage/src/c/solvers/solver_stokescoupling_nonlinear.cpp

    r11684 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../EnumDefinitions/EnumDefinitions.h"
    88#include "../io/io.h"
     
    9191                if(converged==true)break;
    9292                if(count>=max_nonlinear_iterations){
    93                         _printf_(true,"   maximum number of iterations (%i) exceeded\n",max_nonlinear_iterations);
     93                        _pprintLine_("   maximum number of iterations (" << max_nonlinear_iterations << ") exceeded");
    9494                        break;
    9595                }
  • issm/branches/trunk-jpl-damage/src/c/solvers/solver_thermal_nonlinear.cpp

    r11684 r12878  
    44
    55#include "../toolkits/toolkits.h"
    6 #include "../objects/objects.h"
     6#include "../classes/objects/objects.h"
    77#include "../io/io.h"
    88#include "../EnumDefinitions/EnumDefinitions.h"
     
    1616        Vector* tf_old=NULL;
    1717        Vector* ys=NULL;
    18         double melting_offset;
     18        IssmDouble melting_offset;
    1919
    2020        /*intermediary: */
     
    4747        converged=false;
    4848
    49         _printf_(VerboseSolution(),"%s\n","starting direct shooting method");
     49        if(VerboseSolution()) _pprintLine_("starting direct shooting method");
    5050        InputUpdateFromConstantx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,true,ResetPenaltiesEnum);
    5151        InputUpdateFromConstantx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,false,ConvergedEnum);
     
    6666
    6767                if (!converged){
    68                         _printf_(VerboseConvergence(),"%s%i\n","   #unstable constraints = ",num_unstable_constraints);
     68                        if(VerboseConvergence()) _pprintLine_("   #unstable constraints = " << num_unstable_constraints);
    6969                        if (num_unstable_constraints <= thermal_penalty_threshold)converged=true;
    7070                        if (count>=thermal_maxiter){
    7171                                converged=true;
    72                                 _printf_(true,"   maximum number of iterations (%i) exceeded\n",thermal_maxiter);
     72                                _pprintLine_("   maximum number of iterations (" << thermal_maxiter << ") exceeded");
    7373                        }
    7474                }
  • issm/branches/trunk-jpl-damage/src/c/solvers/solvers.h

    r11322 r12878  
    66#define SOLVERS_H_
    77
    8 #include "../objects/objects.h"
     8#include "../classes/objects/objects.h"
    99#include "../io/io.h"
    1010
  • issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.cpp

    r12168 r12878  
    44
    55/*Headers:*/
    6 /*{{{1*/
     6/*{{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    1919
    2020/*SeqMat constructors and destructor*/
    21 /*FUNCTION SeqMat::SeqMat(){{{1*/
     21/*FUNCTION SeqMat::SeqMat(){{{*/
    2222SeqMat::SeqMat(){
    2323
     
    2727}
    2828/*}}}*/
    29 /*FUNCTION SeqMat::SeqMat(int M,int N){{{1*/
     29/*FUNCTION SeqMat::SeqMat(int M,int N){{{*/
    3030SeqMat::SeqMat(int pM,int pN){
    3131
     
    3333        this->N=pN;
    3434        this->matrix=NULL;
    35         if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
    36 }
    37 /*}}}*/
    38 /*FUNCTION SeqMat::SeqMat(int M,int N, double sparsity){{{1*/
    39 SeqMat::SeqMat(int pM,int pN, double sparsity){
    40 
    41         this->M=pM;
    42         this->N=pN;
    43         this->matrix=NULL;
    44         if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
    45 }
    46 /*}}}*/
    47 /*FUNCTION SeqMat(double* serial_mat,int M,int N,double sparsity){{{1*/
    48 SeqMat::SeqMat(double* serial_mat,int pM,int pN,double sparsity){
     35        if(M*N) this->matrix=xNewZeroInit<IssmDouble>(pM*pN);
     36}
     37/*}}}*/
     38/*FUNCTION SeqMat::SeqMat(int M,int N, IssmDouble sparsity){{{*/
     39SeqMat::SeqMat(int pM,int pN, IssmDouble sparsity){
     40
     41        this->M=pM;
     42        this->N=pN;
     43        this->matrix=NULL;
     44        if(M*N) this->matrix=xNewZeroInit<IssmDouble>(pM*pN);
     45}
     46/*}}}*/
     47/*FUNCTION SeqMat::SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity){{{*/
     48SeqMat::SeqMat(IssmDouble* serial_mat,int pM,int pN,IssmDouble sparsity){
    4949
    5050        int i,j;
     
    5454        this->matrix=NULL;
    5555        if(M*N){
    56                 this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
    57                 memcpy(this->matrix,serial_mat,pM*pN*sizeof(double));
    58         }
    59 
    60 }
    61 /*}}}*/
    62 /*FUNCTION SeqMat::SeqMat(int M,int N, int connectivity, int numberofdofspernode){{{1*/
     56                this->matrix=xNewZeroInit<IssmDouble>(pM*pN);
     57                xMemCpy<IssmDouble>(this->matrix,serial_mat,pM*pN);
     58        }
     59
     60}
     61/*}}}*/
     62/*FUNCTION SeqMat::SeqMat(int M,int N, int connectivity, int numberofdofspernode){{{*/
    6363SeqMat::SeqMat(int pM,int pN, int connectivity,int numberofdofspernode){
    6464
     
    6666        this->N=pN;
    6767        this->matrix=NULL;
    68         if(M*N)this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
    69 }
    70 /*}}}*/
    71 /*FUNCTION SeqMat::~SeqMat(){{{1*/
     68        if(M*N) this->matrix=xNewZeroInit<IssmDouble>(pM*pN);
     69}
     70/*}}}*/
     71/*FUNCTION SeqMat::~SeqMat(){{{*/
    7272SeqMat::~SeqMat(){
    7373
    74         xfree((void**)&this->matrix);
     74        xDelete<IssmDouble>(this->matrix);
    7575        M=0;
    7676        N=0;
     
    7979
    8080/*SeqMat specific routines: */
    81 /*FUNCTION SeqMat::Echo{{{1*/
     81/*FUNCTION SeqMat::Echo{{{*/
    8282void SeqMat::Echo(void){
    8383
    8484        int i,j;
    85         printf("SeqMat size %i-%i\n",this->M,this->N);
     85        _printLine_("SeqMat size " << this->M << "-" << this->N);
    8686        for(i=0;i<M;i++){
    8787                for(j=0;j<N;j++){
    88                         printf("%g ",this->matrix[N*i+j]);
     88                        _printString_(this->matrix[N*i+j] << " ");
    8989                }
    90                 printf("\n");
    91         }
    92 }
    93 /*}}}*/
    94 /*FUNCTION SeqMat::Assemble{{{1*/
     90                _printLine_("");
     91        }
     92}
     93/*}}}*/
     94/*FUNCTION SeqMat::Assemble{{{*/
    9595void SeqMat::Assemble(void){
    9696               
     
    9999}
    100100/*}}}*/
    101 /*FUNCTION SeqMat::Norm{{{1*/
    102 double SeqMat::Norm(NormMode mode){
    103 
    104         double norm;
    105         double absolute;
     101/*FUNCTION SeqMat::Norm{{{*/
     102IssmDouble SeqMat::Norm(NormMode mode){
     103
     104        IssmDouble norm;
     105        IssmDouble absolute;
    106106        int i,j;
    107107
     
    119119                        break;
    120120                default:
    121                         _error_("unknown norm !");
    122                         break;
    123         }
    124 }
    125 /*}}}*/
    126 /*FUNCTION SeqMat::GetSize{{{1*/
     121                        _error2_("unknown norm !");
     122                        break;
     123        }
     124}
     125/*}}}*/
     126/*FUNCTION SeqMat::GetSize{{{*/
    127127void SeqMat::GetSize(int* pM,int* pN){
    128128
     
    132132}
    133133/*}}}*/
    134 /*FUNCTION SeqMat::GetLocalSize{{{1*/
     134/*FUNCTION SeqMat::GetLocalSize{{{*/
    135135void SeqMat::GetLocalSize(int* pM,int* pN){
    136136       
     
    140140}
    141141/*}}}*/
    142 /*FUNCTION SeqMat::MatMult{{{1*/
     142/*FUNCTION SeqMat::MatMult{{{*/
    143143void SeqMat::MatMult(SeqVec* X,SeqVec* AX){
    144144
    145145        int i,j;
    146146        int XM,AXM;
    147         double dummy;
     147        IssmDouble dummy;
    148148
    149149        X->GetSize(&XM);
    150150        AX->GetSize(&AXM);
    151151
    152         if(M!=AXM)_error_("A and AX should have the same number of rows!");
    153         if(N!=XM)_error_("A and X should have the same number of columns!");
     152        if(M!=AXM)_error2_("A and AX should have the same number of rows!");
     153        if(N!=XM)_error2_("A and X should have the same number of columns!");
    154154
    155155        for(i=0;i<M;i++){
     
    163163}
    164164/*}}}*/
    165 /*FUNCTION SeqMat::Duplicate{{{1*/
     165/*FUNCTION SeqMat::Duplicate{{{*/
    166166SeqMat* SeqMat::Duplicate(void){
    167167
    168         double dummy=0;
     168        IssmDouble dummy=0;
    169169
    170170        return new SeqMat(this->matrix,this->M,this->N,dummy);
     
    172172}
    173173/*}}}*/
    174 /*FUNCTION SeqMat::ToSerial{{{1*/
    175 double* SeqMat::ToSerial(void){
    176 
    177         double* buffer=NULL;
     174/*FUNCTION SeqMat::ToSerial{{{*/
     175IssmDouble* SeqMat::ToSerial(void){
     176
     177        IssmDouble* buffer=NULL;
    178178
    179179        if(this->M*this->N){
    180                 buffer=(double*)xmalloc(this->M*this->N*sizeof(double));
    181                 memcpy(buffer,this->matrix,this->M*this->N*sizeof(double));
     180                buffer=xNew<IssmDouble>(this->M*this->N);
     181                xMemCpy<IssmDouble>(buffer,this->matrix,this->M*this->N);
    182182        }
    183183        return buffer;
     
    185185}
    186186/*}}}*/
    187 /*FUNCTION SeqMat::SetValues{{{1*/
    188 void SeqMat::SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode){
     187/*FUNCTION SeqMat::SetValues{{{*/
     188void SeqMat::SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){
    189189       
    190190        int i,j;
     
    197197                        break;
    198198                default:
    199                         _error_("unknown insert mode!");
    200                         break;
    201         }
    202 
    203 }
    204 /*}}}*/
    205 /*FUNCTION SeqMat::Convert{{{1*/
     199                        _error2_("unknown insert mode!");
     200                        break;
     201        }
     202
     203}
     204/*}}}*/
     205/*FUNCTION SeqMat::Convert{{{*/
    206206void SeqMat::Convert(MatrixType type){
    207207
  • issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.h

    r12168 r12878  
    11/*!\file:  SeqMat.h
    2  * \brief wrapper to SeqMat objects, which are just wrappers to a simple double* buffer.
     2 * \brief wrapper to SeqMat objects, which are just wrappers to a simple IssmDouble* buffer.
    33 */
    44
     
    77
    88/*Headers:*/
    9 /*{{{1*/
     9/*{{{*/
    1010#ifdef HAVE_CONFIG_H
    1111        #include <config.h>
     
    2424       
    2525                int M,N;
    26                 double* matrix;
     26                IssmDouble* matrix;
    2727
    28                 /*SeqMat constructors, destructors {{{1*/
     28                /*SeqMat constructors, destructors {{{*/
    2929                SeqMat();
    3030                SeqMat(int M,int N);
    31                 SeqMat(int M,int N,double sparsity);
    32                 SeqMat(double* serial_mat,int M,int N,double sparsity);
     31                SeqMat(int M,int N,IssmDouble sparsity);
     32                SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity);
    3333                SeqMat(int M,int N,int connectivity,int numberofdofspernode);
    3434                ~SeqMat();
    3535                /*}}}*/
    36                 /*SeqMat specific routines {{{1*/
     36                /*SeqMat specific routines {{{*/
    3737                void Echo(void);
    3838                void Assemble(void);
    39                 double Norm(NormMode norm_type);
     39                IssmDouble Norm(NormMode norm_type);
    4040                void GetSize(int* pM,int* pN);
    4141                void GetLocalSize(int* pM,int* pN);
    4242                void MatMult(SeqVec* X,SeqVec* AX);
    4343                SeqMat* Duplicate(void);
    44                 double* ToSerial(void);
    45                 void SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode);
     44                IssmDouble* ToSerial(void);
     45                void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode);
    4646                void Convert(MatrixType type);
    4747                /*}}}*/
  • issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.cpp

    r12168 r12878  
    44
    55/*Headers:*/
    6 /*{{{1*/
     6/*{{{*/
    77#ifdef HAVE_CONFIG_H
    88        #include <config.h>
     
    1919
    2020/*SeqVec constructors and destructor*/
    21 /*FUNCTION SeqVec::SeqVec(){{{1*/
     21/*FUNCTION SeqVec::SeqVec(){{{*/
    2222SeqVec::SeqVec(){
    2323
     
    2626}
    2727/*}}}*/
    28 /*FUNCTION SeqVec::SeqVec(int M,bool fromlocalsize){{{1*/
     28/*FUNCTION SeqVec::SeqVec(int M,bool fromlocalsize){{{*/
    2929SeqVec::SeqVec(int pM,bool fromlocalsize){
    3030
    3131        this->M=pM;
    3232        this->vector=NULL;
    33         if(this->M) this->vector=(double*)xcalloc(pM,sizeof(double));
    34 }
    35 /*}}}*/
    36 /*FUNCTION SeqVec::SeqVec(double* serial_vec,int M){{{1*/
    37 SeqVec::SeqVec(double* buffer,int pM){
     33        if(this->M) this->vector=xNewZeroInit<IssmDouble>(pM);
     34}
     35/*}}}*/
     36/*FUNCTION SeqVec::SeqVec(IssmDouble* serial_vec,int M){{{*/
     37SeqVec::SeqVec(IssmDouble* buffer,int pM){
    3838
    3939        int i,j;
     
    4242        this->vector=NULL;
    4343        if(this->M){
    44                 this->vector=(double*)xcalloc(pM,sizeof(double));
    45                 memcpy(this->vector,buffer,pM*sizeof(double));
    46         }
    47 }
    48 /*}}}*/
    49                 /*FUNCTION SeqVec::~SeqVec(){{{1*/
     44                this->vector=xNew<IssmDouble>(pM);
     45                xMemCpy<IssmDouble>(this->vector,buffer,pM);
     46        }
     47}
     48/*}}}*/
     49                /*FUNCTION SeqVec::~SeqVec(){{{*/
    5050SeqVec::~SeqVec(){
    51         xfree((void**)&this->vector);
     51        xDelete<IssmDouble>(this->vector);
    5252        M=0;
    5353}
     
    5555
    5656/*SeqVec specific routines: */
    57 /*FUNCTION SeqVec::Echo{{{1*/
     57/*FUNCTION SeqVec::Echo{{{*/
    5858void SeqVec::Echo(void){
    5959
    6060        int i;
    61         printf("SeqVec size %i\n",this->M);
     61        _printLine_("SeqVec size " << this->M);
    6262        for(i=0;i<M;i++){
    63                 printf("%g\n ",vector[i]);
    64         }
    65 }
    66 /*}}}*/
    67 
    68 /*FUNCTION SeqVec::Assemble{{{1*/
     63                _printString_(vector[i] << "\n ");
     64        }
     65}
     66/*}}}*/
     67
     68/*FUNCTION SeqVec::Assemble{{{*/
    6969void SeqVec::Assemble(void){
    7070               
     
    7373}
    7474/*}}}*/
    75 /*FUNCTION SeqVec::SetValues{{{1*/
    76 void SeqVec::SetValues(int ssize, int* list, double* values, InsMode mode){
     75/*FUNCTION SeqVec::SetValues{{{*/
     76void SeqVec::SetValues(int ssize, int* list, IssmDouble* values, InsMode mode){
    7777       
    7878        int i;
     
    8585                        break;
    8686                default:
    87                         _error_("unknown insert mode!");
    88                         break;
    89         }
    90 
    91 }
    92 /*}}}*/
    93 /*FUNCTION SeqVec::SetValue{{{1*/
    94 void SeqVec::SetValue(int dof, double value, InsMode mode){
     87                        _error2_("unknown insert mode!");
     88                        break;
     89        }
     90
     91}
     92/*}}}*/
     93/*FUNCTION SeqVec::SetValue{{{*/
     94void SeqVec::SetValue(int dof, IssmDouble value, InsMode mode){
    9595
    9696        switch(mode){
     
    102102                        break;
    103103                default:
    104                         _error_("unknown insert mode!");
    105                         break;
    106         }
    107 }
    108 /*}}}*/
    109 /*FUNCTION SeqVec::GetValue{{{1*/
    110 void SeqVec::GetValue(double* pvalue,int dof){
     104                        _error2_("unknown insert mode!");
     105                        break;
     106        }
     107}
     108/*}}}*/
     109/*FUNCTION SeqVec::GetValue{{{*/
     110void SeqVec::GetValue(IssmDouble* pvalue,int dof){
    111111
    112112        *pvalue=this->vector[dof];
     
    115115/*}}}*/
    116116               
    117 /*FUNCTION SeqVec::GetSize{{{1*/
     117/*FUNCTION SeqVec::GetSize{{{*/
    118118void SeqVec::GetSize(int* pM){
    119119
     
    122122}
    123123/*}}}*/
    124 /*FUNCTION SeqVec::GetLocalSize{{{1*/
     124/*FUNCTION SeqVec::GetLocalSize{{{*/
    125125void SeqVec::GetLocalSize(int* pM){
    126126       
     
    129129}
    130130/*}}}*/
    131 /*FUNCTION SeqVec::Duplicate{{{1*/
     131/*FUNCTION SeqVec::Duplicate{{{*/
    132132SeqVec* SeqVec::Duplicate(void){
    133133       
     
    136136}
    137137/*}}}*/
    138 /*FUNCTION SeqVec::Set{{{1*/
    139 void SeqVec::Set(double value){
     138/*FUNCTION SeqVec::Set{{{*/
     139void SeqVec::Set(IssmDouble value){
    140140
    141141        int i;
     
    144144}
    145145/*}}}*/
    146 /*FUNCTION SeqVec::AXPY{{{1*/
    147 void SeqVec::AXPY(SeqVec* X, double a){
     146/*FUNCTION SeqVec::AXPY{{{*/
     147void SeqVec::AXPY(SeqVec* X, IssmDouble a){
    148148
    149149        int i;
     
    154154}
    155155/*}}}*/
    156 /*FUNCTION SeqVec::AYPX{{{1*/
    157 void SeqVec::AYPX(SeqVec* X, double a){
     156/*FUNCTION SeqVec::AYPX{{{*/
     157void SeqVec::AYPX(SeqVec* X, IssmDouble a){
    158158       
    159159        int i;
     
    164164}
    165165/*}}}*/
    166 /*FUNCTION SeqVec::ToMPISerial{{{1*/
    167 double* SeqVec::ToMPISerial(void){
    168 
    169         double* buffer=NULL;
     166/*FUNCTION SeqVec::ToMPISerial{{{*/
     167IssmDouble* SeqVec::ToMPISerial(void){
     168
     169        IssmDouble* buffer=NULL;
    170170
    171171        if(this->M){
    172                 buffer=(double*)xmalloc(this->M*sizeof(double));
    173                 memcpy(buffer,this->vector,this->M*sizeof(double));
     172                buffer=xNew<IssmDouble>(this->M);
     173                xMemCpy<IssmDouble>(buffer,this->vector,this->M);
    174174        }
    175175        return buffer;
     
    177177}
    178178/*}}}*/
    179 /*FUNCTION SeqVec::Copy{{{1*/
     179/*FUNCTION SeqVec::Copy{{{*/
    180180void SeqVec::Copy(SeqVec* to){
    181181
     
    187187}
    188188/*}}}*/
    189 /*FUNCTION SeqVec::Norm{{{1*/
    190 double SeqVec::Norm(NormMode mode){
    191 
    192         double norm;
     189/*FUNCTION SeqVec::Norm{{{*/
     190IssmDouble SeqVec::Norm(NormMode mode){
     191
     192        IssmDouble norm;
    193193        int i;
    194194
     
    204204                        break;
    205205                default:
    206                         _error_("unknown norm !");
    207                         break;
    208         }
    209 }
    210 /*}}}*/
    211 /*FUNCTION SeqVec::Scale{{{1*/
    212 void SeqVec::Scale(double scale_factor){
     206                        _error2_("unknown norm !");
     207                        break;
     208        }
     209}
     210/*}}}*/
     211/*FUNCTION SeqVec::Scale{{{*/
     212void SeqVec::Scale(IssmDouble scale_factor){
    213213
    214214        int i;
     
    217217}
    218218/*}}}*/
    219 /*FUNCTION SeqVec::Dot{{{1*/
    220 double SeqVec::Dot(SeqVec* input){
    221 
    222         int i;
    223 
    224         double dot=0;
     219/*FUNCTION SeqVec::Dot{{{*/
     220IssmDouble SeqVec::Dot(SeqVec* input){
     221
     222        int i;
     223
     224        IssmDouble dot=0;
    225225        for(i=0;i<this->M;i++)dot+=this->vector[i]*input->vector[i];
    226226        return dot;
     
    228228}
    229229/*}}}*/
    230 /*FUNCTION SeqVec::PointwiseDivide{{{1*/
     230/*FUNCTION SeqVec::PointwiseDivide{{{*/
    231231void SeqVec::PointwiseDivide(SeqVec* x,SeqVec* y){
    232232
  • issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.h

    r12168 r12878  
    11/*!\file:  SeqVec.h
    2  * \brief wrapper to our SeqVec object, which is just a wrapper to a double*
     2 * \brief wrapper to our SeqVec object, which is just a wrapper to a IssmDouble*
    33 */
    44
     
    77
    88/*Headers:*/
    9 /*{{{1*/
     9/*{{{*/
    1010#ifdef HAVE_CONFIG_H
    1111        #include <config.h>
     
    2222        public:
    2323       
    24                 double* vector;
     24                IssmDouble* vector;
    2525                int M;
    2626
    27                 /*SeqVec constructors, destructors {{{1*/
     27                /*SeqVec constructors, destructors {{{*/
    2828                SeqVec();
    2929                SeqVec(int M,bool fromlocalsize=false);
    30                 SeqVec(double* buffer, int M);
     30                SeqVec(IssmDouble* buffer, int M);
    3131                ~SeqVec();
    3232                /*}}}*/
    33                 /*SeqVec specific routines {{{1*/
     33                /*SeqVec specific routines {{{*/
    3434                void Echo(void);
    3535                void Assemble(void);
    36                 void SetValues(int ssize, int* list, double* values, InsMode mode);
    37                 void SetValue(int dof, double value, InsMode  mode);
    38                 void GetValue(double* pvalue, int dof);
     36                void SetValues(int ssize, int* list, IssmDouble* values, InsMode mode);
     37                void SetValue(int dof, IssmDouble value, InsMode  mode);
     38                void GetValue(IssmDouble* pvalue, int dof);
    3939                void GetSize(int* pM);
    4040                void GetLocalSize(int* pM);
    4141                SeqVec* Duplicate(void);
    42                 void Set(double value);
    43                 void AXPY(SeqVec* X, double a);
    44                 void AYPX(SeqVec* X, double a);
    45                 double* ToMPISerial(void);
     42                void Set(IssmDouble value);
     43                void AXPY(SeqVec* X, IssmDouble a);
     44                void AYPX(SeqVec* X, IssmDouble a);
     45                IssmDouble* ToMPISerial(void);
    4646                void Copy(SeqVec* to);
    47                 double Norm(NormMode norm_type);
    48                 void Scale(double scale_factor);
     47                IssmDouble Norm(NormMode norm_type);
     48                void Scale(IssmDouble scale_factor);
    4949                void PointwiseDivide(SeqVec* x,SeqVec* y);
    50                 double Dot(SeqVec* vector);
     50                IssmDouble Dot(SeqVec* vector);
    5151                /*}}}*/
    5252};
  • issm/branches/trunk-jpl-damage/src/c/toolkits/issm/issmtoolkit.h

    r11733 r12878  
    66#define _ISSM_TOOLKIT_H_
    77
     8#include "../../include/include.h"
     9
    810#include "./SeqMat.h"
    911#include "./SeqVec.h"
  • issm/branches/trunk-jpl-damage/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp

    r10087 r12878  
    1313        METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart);
    1414        #elif _METIS_VERSION_ == 5
    15         /*This interface is heavily changed. More options, different way of meshing, etc ...: */
     15        /*This interface is heavily changed. More options, different ways of meshing, etc ...: */
    1616        int i;
    1717
     
    2121        idx_t  k=0;
    2222        real_t* tpwgts=NULL;
    23 
    24 
    2523
    2624        /*setup options: */
     
    4038        options[METIS_OPTION_NCUTS]   = 1;
    4139
    42 
    4340        /*create eptr: */
    44         eptr=(idx_t*)xmalloc((*pnumberofelements+1)*sizeof(idx_t));
     41        eptr=xNew<idx_t>((*pnumberofelements+1));
    4542        eptr[0]=0;
    4643        for(i=0;i<*pnumberofelements;i++){
     
    4946        }
    5047
    51 
    5248        /*create tpwgts: */
    53         tpwgts=(real_t*)xmalloc(*pnum_procs*sizeof(real_t));
     49        tpwgts=xNew<real_t>(*pnum_procs);
    5450        for(i=0;i<*pnum_procs;i++){
    5551                tpwgts[i]=1.0/(*pnum_procs);
    5652        }
    5753
     54        METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index,
     55                        NULL, NULL, pnum_procs, tpwgts, options, &objval,epart, npart);
    5856
    59         METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index,
    60                         NULL, NULL, pnum_procs, tpwgts, options, &objval,
    61                         epart, npart);
    62        
     57        /*clean-up*/
     58        xDelete<idx_t>(eptr);
     59        xDelete<real_t>(tpwgts);
    6360
    6461        #else
    65         _error_("METIS version not supported yet");
     62        _error2_("METIS version not supported yet");
    6663        #endif
    6764}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp

    r11708 r12878  
    55#include <stdio.h>
    66#include <math.h>
    7 
    8 
    97#include "../../../shared/shared.h"
    108
     
    2422       
    2523        /*We are  not bound by any library, just use what seems most logical*/
    26         num_local_rows=(int*)xmalloc(num_procs*sizeof(int));   
     24        num_local_rows=xNew<int>(num_procs);   
    2725
    2826        for (i=0;i<num_procs;i++){
    29 
    3027                /*Here, we use floor. We under distribute rows. The rows
    3128                  left  are then redistributed, therefore resulting in a
     
    3936                num_local_rows[i]++;
    4037        }
    41 
    4238        local_size=num_local_rows[my_rank];
    4339       
    4440        /*free ressources: */
    45         xfree((void**)&num_local_rows);
     41        xDelete<int>(num_local_rows);
    4642
    4743        /*return size: */
  • issm/branches/trunk-jpl-damage/src/c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp

    r11708 r12878  
    2020
    2121        /*Gather all range values into allranges, for all nodes*/
    22         allranges=(int*)xmalloc(num_procs*sizeof(int));
     22        allranges=xNew<int>(num_procs);
    2323        MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD);
    24 
    2524
    2625        /*From all ranges, get lower row and upper row*/
     
    3130                upper_row=upper_row+allranges[i];
    3231        }
    33        
    34         /*free: */
    35         xfree((void**)&allranges);
    3632
    3733        /*Assign output pointers: */
     34        xDelete<int>(allranges);
    3835        *plower_row=lower_row;
    3936        *pupper_row=upper_row;
    40 
    4137        return 1;
    4238}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/GetOwnershipBoundariesFromRange.cpp

    r9320 r12878  
    2828
    2929        /*Gather all range values into allranges, for all nodes*/
    30         allranges=(int*)xmalloc(num_procs*sizeof(int));
     30        allranges=xNew<int>(num_procs);
    3131        MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD);
    3232
     
    4242        *plower_row=lower_row;
    4343        *pupper_row=upper_row;
    44 
    45         /*Free ressources:*/
    46         xfree((void**)&allranges);
    47 
     44        xDelete<int>(allranges);
    4845}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscInsertMode.cpp

    r11708 r12878  
    3030                        break;
    3131                default:
    32                         _error_("unknown insert mode!");
     32                        _error2_("unknown insert mode!");
    3333                        break;
    3434        }
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscMatrixType.cpp

    r12004 r12878  
    3030                        break;
    3131                default:
    32                         _error_("unknown matrix type !");
     32                        _error2_("unknown matrix type !");
    3333                        break;
    3434        }
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscNormMode.cpp

    r11708 r12878  
    3030                        break;
    3131                default:
    32                         _error_("unknown norm !");
     32                        _error2_("unknown norm !");
    3333                        break;
    3434        }
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatInvert.cpp

    r12168 r12878  
    2929        /*Some checks: */
    3030        MatGetSize(matrix,&M,&N);
    31         if(M!=N) _error_("trying to invert a non square matrix!");
     31        if(M!=N) _error2_("trying to invert a non square matrix!");
    3232
    3333        /*Create identitiy matrix: */
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatMultPatch.cpp

    r9826 r12878  
    6464        }
    6565        else{
    66                 result=1;\
     66                result=1;
    6767        }
    6868        return result;
     
    8989        range=upper_row-lower_row+1;
    9090        if (range){
    91                 index=(int*)xmalloc(range*sizeof(int));
    92                 values=(double*)xmalloc(range*sizeof(double));
     91                index=xNew<int>(range);
     92                values=xNew<double>(range);
    9393                for (int i=0;i<range;i++){
    9494                        *(index+i)=lower_row+i;
     
    103103
    104104        /*Free ressources:*/
    105         xfree((void**)&index);
    106         xfree((void**)&values);
     105        xDelete<int>(index);
     106        xDelete<double>(values);       
    107107
    108108        /*Assign output pointers:*/
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatPartition.cpp

    r12004 r12878  
    4848                        d_nz=0;
    4949                        o_nz=0;
    50                         #ifdef _HAVE_PETSCDEV_
     50                        #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
    5151                        MatCreateAIJ(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,d_nz,PETSC_NULL,o_nz,PETSC_NULL,&outmatrix);
    5252                        #else
     
    5555                }
    5656                else if (strcmp(type,"mpidense")==0){
    57                         #ifdef _HAVE_PETSCDEV_
     57                        #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
    5858                        MatCreateDense(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,PETSC_NULL,&outmatrix);
    5959                        #else
     
    6262                }
    6363                else{
    64                         _error_("MatType %s not supported yet",type);
     64                        _error2_("MatType " << type << " not supported yet");
    6565                }
    6666                /*Assemble*/
     
    7777                count=0;
    7878                if (range){
    79                         node_rows=(int*)xmalloc(range*sizeof(int)); //this is the maximum number of rows one node can extract.
     79                        node_rows=xNew<int>(range); //this is the maximum number of rows one node can extract.
    8080               
    8181                        for (i=0;i<row_partition_vector_size;i++){
     
    9898               
    9999                /*Same deal for columns*/
    100                 node_cols=(int*)xmalloc(col_partition_vector_size*sizeof(int));
     100                node_cols=xNew<int>(col_partition_vector_size);
    101101                for (i=0;i<col_partition_vector_size;i++){
    102102                        *(node_cols+i)=(int)*(col_partition_vector+i)-1;
     
    128128
    129129        /*Free ressources:*/
    130         xfree((void**)&node_rows);
    131         xfree((void**)&node_cols);
     130        xDelete<int>(node_rows);
     131        xDelete<int>(node_cols);
    132132        ISFree(&col_index);
    133133        ISFree(&row_index);
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatToSerial.cpp

    r11708 r12878  
    3232        double* outmatrix=NULL;
    3333       
    34        
    3534        /*get matrix size: */
    3635        MatGetSize(matrix,&M,&N);
     
    4241       
    4342        /*Local and global allocation*/
    44         if (my_rank==0)outmatrix=(double*)xmalloc(M*N*sizeof(double));
     43        if (my_rank==0)outmatrix=xNew<double>(M*N);
    4544       
    4645        if (range){
    47                 local_matrix=(double*)xmalloc(N*range*sizeof(double));
    48                 idxm=(int*)xmalloc(range*sizeof(int)); 
    49                 idxn=(int*)xmalloc(N*sizeof(int)); 
     46                local_matrix=xNew<double>(N*range);
     47                idxm=xNew<int>(range); 
     48                idxn=xNew<int>(N); 
    5049         
    5150                for (i=0;i<N;i++){
     
    7877                //Still have the local_matrix on node 0 to take care of.
    7978                memcpy(outmatrix,local_matrix,N*range*sizeof(double));
    80 
    8179        }
    8280       
    8381        /*Assign output pointer: */
    8482        *poutmatrix=outmatrix;
    85        
    86         xfree((void**)&idxm);
    87         xfree((void**)&idxn);
    88         xfree((void**)&local_matrix);
    89 
     83        xDelete<int>(idxm);
     84        xDelete<int>(idxn);
     85        xDelete<double>(local_matrix);
    9086}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/NewMat.cpp

    r12168 r12878  
    2020#include "../../mpi/patches/mpipatches.h"
    2121
    22 /*NewMat(int M,int N){{{1*/
     22/*NewMat(int M,int N){{{*/
    2323Mat NewMat(int M,int N){
    2424
     
    3939        o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
    4040
    41         #ifdef _HAVE_PETSCDEV_
     41        #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
    4242        MatCreateAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
    4343        #else
     
    4848}
    4949/*}}}*/
    50 /*NewMat(int M,int N,double sparsity){{{1*/
     50/*NewMat(int M,int N,double sparsity){{{*/
    5151Mat NewMat(int M,int N,double sparsity){
    5252
     
    6767        o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
    6868
    69         #ifdef _HAVE_PETSCDEV_
     69        #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
    7070        if(sparsity==1){
    7171                MatCreateDense(MPI_COMM_WORLD,m,n,M,N,NULL,&outmatrix);
     
    8181}
    8282/*}}}*/
    83 /*NewMat(int M,int N,int connectivity,int numberofdofspernode){{{1*/
     83/*NewMat(int M,int N,int connectivity,int numberofdofspernode){{{*/
    8484Mat NewMat(int M,int N,int connectivity,int numberofdofspernode){
    8585
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscMatrixToDoubleMatrix.cpp

    r12168 r12878  
    3636        MatGetSize(petsc_matrix,&rows,&cols);
    3737
    38         idxm=(int*)xmalloc(rows*sizeof(int));
    39         idxn=(int*)xmalloc(cols*sizeof(int));
     38        idxm=xNew<int>(rows);
     39        idxn=xNew<int>(cols);
    4040
    4141        for(i=0;i<rows;i++)idxm[i]=i;
    4242        for(i=0;i<cols;i++)idxn[i]=i;
    4343
    44         matrix=(double*)xmalloc(rows*cols*sizeof(double));
     44        matrix=xNew<double>(rows*cols);
    4545        MatGetValues(petsc_matrix,rows,idxm,cols,idxn,matrix);
     46
     47        xDelete<int>(idxm);
     48        xDelete<int>(idxn);
    4649
    4750        /*Assign output pointers: */
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp

    r12004 r12878  
    5555                        if(first[0]!='-'){
    5656                                /*This is not good, the option does not have '-'! Get out*/
    57                                 _error_("%s%s%s","Option ",first," should be preceded by '-'!");
     57                                _error2_("Option " << first << " should be preceded by '-'!");
    5858                        }
    5959                        /*Reduce first to bare option value*/
     
    9090        }
    9191
    92 #ifdef _HAVE_PETSCDEV_
     92#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
    9393        PetscTokenDestroy(&token);
    9494#else
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscVectorToDoubleVector.cpp

    r12168 r12878  
    2828                VecGetSize(petsc_vector,&rows);
    2929                if(rows){
    30                         idxm=(int*)xmalloc(rows*sizeof(int));
    31                         vector=(double*)xmalloc(rows*sizeof(double));
     30                        idxm=xNew<int>(rows);
     31                        vector=xNew<double>(rows);
    3232                        for(i=0;i<rows;i++)idxm[i]=i;
    33 
    3433                        VecGetValues(petsc_vector,rows,idxm,vector);
     34                        xDelete<int>(idxm);
    3535                }
    3636        }
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/SerialToVec.cpp

    r12004 r12878  
    3838
    3939        if (range){
    40                 idxn=(int*)xmalloc(range*sizeof(int));
    41                 values=(double*)xmalloc(range*sizeof(double));
     40                idxn=xNew<int>(range);
     41                values=xNew<double>(range);
    4242                for (i=0;i<range;i++){
    4343                        idxn[i]=lower_row+i;
     
    5454
    5555        /*Free ressources:*/
    56         xfree((void**)&idxn);
    57         xfree((void**)&values);
     56        xDelete<int>(idxn);
     57        xDelete<double>(values);
    5858
    5959        return outvector;
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecMerge.cpp

    r9320 r12878  
    3535        /*If the dimension of the partitioning vector is not the same as that of vector B, we have a problem: */
    3636        if ( (row_partition_size !=MB) ){
    37                 _error_("Dimensions of partitioning vector incompatible with dimensions of input vector\n");
     37                _error2_("Dimensions of partitioning vector incompatible with dimensions of input vector\n");
    3838        }
    3939
     
    4545        if (range){
    4646                /*This node owns rows of vector B, get them*/
    47                 idxm=(int*)xmalloc(range*sizeof(int));
    48                 values=(double*)xmalloc(range*sizeof(double));
     47                idxm=xNew<int>(range);
     48                values=xNew<double>(range);
    4949                for (i=0;i<range;i++){
    5050                        *(idxm+i)=lower_row+i;
     
    6363
    6464        /*Free ressources:*/
    65         xfree((void**)&idxm);
    66         xfree((void**)&values);
    67 
     65        xDelete<int>(idxm);
     66        xDelete<double>(values);
    6867}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecPartition.cpp

    r9320 r12878  
    5656
    5757                if (range){
    58                         node_rows=(int*)xmalloc(range*sizeof(int)); //this is the maximum number of rows one node can extract.
     58                        node_rows=xNew<int>(range); //this is the maximum number of rows one node can extract.
    5959               
    6060                        count=0;
     
    7171                                       
    7272        if (count){
    73                         values=(double*)xmalloc(count*sizeof(double)); //holder for the values to be extracted from vectorA
     73                        values=xNew<double>(count); //holder for the values to be extracted from vectorA
    7474                }
    7575                else{
    76                         xfree((void**)&node_rows); //count=0 means no values was condensed out for this node. null node_rows for use in VecGetValues.
     76                        xDelete<int>(node_rows); //count=0 means no values was condensed out for this node. null node_rows for use in VecGetValues.
    7777                        values=NULL;
    7878                }
     
    110110                VecAssemblyBegin(outvector);
    111111                VecAssemblyEnd(outvector);
    112                
    113112        }
    114113       
    115114        /*Assign output pointers:*/
    116115        *poutvector=outvector;
    117 
    118         /*Free ressources:*/
    119         xfree((void**)&node_rows);
    120         xfree((void**)&values);
    121 
     116        xDelete<int>(node_rows);
     117        xDelete<double>(values);
    122118}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecToMPISerial.cpp

    r11708 r12878  
    4242
    4343        /*Allocate gathered vector on all nodes .*/
    44         gathered_vector=(double*)xmalloc(vector_size*sizeof(double));
     44        gathered_vector=xNew<double>(vector_size);
    4545       
    4646        /*Allocate local vectors*/
     
    5050
    5151        if (range){
    52                 idxn=(int*)xmalloc(range*sizeof(int));
     52                idxn=xNew<int>(range);
    5353                for (i=0;i<range;i++){
    5454                        *(idxn+i)=lower_row+i;
    5555                }
    56                 local_vector=(double*)xmalloc(range*sizeof(double));
     56                local_vector=xNew<double>(range);
    5757                /*Extract values from MPI vector to serial local_vector on each node*/
    5858                VecGetValues(vector,range,idxn,local_vector);
     
    8787       
    8888        /*free ressources: */
    89         xfree((void**)&idxn);
    90         xfree((void**)&local_vector);
     89        xDelete<int>(idxn);
     90        xDelete<double>(local_vector);
    9191       
    9292        return 1;
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecTranspose.cpp

    r1 r12878  
    3333
    3434        if (range){
    35                 idxm=(int*)xmalloc(range*sizeof(int));
    36                 tidxm=(int*)xmalloc(range*sizeof(int));
     35                idxm=xNew<int>(range);
     36                tidxm=xNew<int>(range);
    3737                for (i=0;i<range;i++){
    3838                        *(idxm+i)=lower_row+i;
    3939                }
    40                 values=(double*)xmalloc(range*sizeof(double));
    41                 tvalues=(double*)xmalloc(range*sizeof(double));
     40                values=xNew<double>(range);
     41                tvalues=xNew<double>(range);
    4242               
    4343                VecGetValues(vector,range,idxm,values);
     
    5656
    5757        /*Free ressources: */
    58         xfree((void**)&idxm);
    59         xfree((void**)&values);
    60         xfree((void**)&tidxm);
    61         xfree((void**)&tvalues);
     58        xDelete<int>(idxm);
     59        xDelete<double>(values);
     60        xDelete<int>(tidxm);
     61        xDelete<double>(tvalues);
    6262
    6363        /*Assign output pointers: */
  • issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/petscincludes.h

    r11708 r12878  
    1616/*our own patches: */
    1717#include "patches/petscpatches.h"
     18#include "objects/petscobjects.h"
    1819
    1920#endif
  • issm/branches/trunk-jpl-damage/src/c/toolkits/plapack/patches/CyclicalFactorization.cpp

    r3595 r12878  
    4444        int i;
    4545
    46         decomp=xmalloc(input*sizeof(int));
     46        decomp=xNew<int>(input);
    4747        *decomp=input;
    4848        for (i=0;i<input;i++){
     
    5757                }
    5858        }
    59 
    6059        *pdecomp=decomp;
    6160}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/plapack/patches/PlapackInvertMatrix.cpp

    r6412 r12878  
    1313#include "../../scalapack/FortranMapping.h"
    1414
    15 void PlapackInvertMatrixLocalCleanup(PLA_Obj* pa,PLA_Template* ptempl,double** parrayA,
    16                 int** pidxnA,MPI_Comm* pcomm_2d);
     15void PlapackInvertMatrixLocalCleanup(PLA_Obj* pa,PLA_Template* ptempl,double** parrayA,int** pidxnA,MPI_Comm* pcomm_2d);
    1716       
    1817int PlapackInvertMatrix(Mat* A,Mat* inv_A,int status,int con){
    19         /*inv_A does not yet exist, inv_A was just xmalloced, that's all*/
     18        /*inv_A does not yet exist, inv_A was just allocated, that's all*/
    2019
    2120        /*Error management*/
    2221        int i,j;
    23        
    2422
    2523        /*input*/
     
    5351
    5452        /*Some dimensions checks: */
    55         if (mA!=nA) _error_(" trying to take the invert of a non-square matrix!");
     53        if (mA!=nA) _error2_("trying to take the invert of a non-square matrix!");
    5654
    5755        /* Set default Plapack parameters */
     
    9492        /* Set the datatype */
    9593        datatype = MPI_DOUBLE;
    96 
    9794       
    9895        /* Copy A into a*/
     
    104101        upper_row--;
    105102        range=upper_row-lower_row+1;
    106         arrayA=xmalloc(nA*sizeof(double));
    107         idxnA=xmalloc(nA*sizeof(int));
     103        arrayA = xNew<double>(nA);
     104        idxnA  = xNew<int>(nA);
    108105        for (i=0;i<nA;i++){
    109106                *(idxnA+i)=i;
     
    128125        PLA_Obj_free(&a);
    129126        PLA_Temp_free(&templ);
    130         xfree((void**)&arrayA);
    131         xfree((void**)&idxnA);
     127        xDelete<double>(arrayA);
     128        xDelete<int>(idxnA);
    132129       
    133130        /*Finalize PLAPACK*/
    134131        PLA_Finalize();
    135132        MPI_Comm_free(&comm_2d);
    136 
    137133}
  • issm/branches/trunk-jpl-damage/src/c/toolkits/plapack/patches/PlapackToPetsc.cpp

    r3332 r12878  
    4545       
    4646        /*Vector physically based block cyclic distribution: */
    47         row_nodes=xmalloc(mA*sizeof(int));
    48         col_nodes=xmalloc(nA*sizeof(int));
     47        row_nodes=xNew<int>(mA);
     48        col_nodes=xNew<int>(nA);
    4949        for (i=0;i<mA;i++){
    5050                i0=i/nb;
     
    6060        PLA_Temp_comm_col_rank(templ,&myrow);
    6161
    62         idxm=xmalloc(mA*sizeof(int));
     62        idxm=xNew<int>(mA);
    6363        count=0;
    6464        for (i=0;i<mA;i++){
     
    7070        idxm_count=count;
    7171
    72         idxn=xmalloc(nA*sizeof(int));
     72        idxn=xNew<int>(nA);
    7373        count=0;
    7474        for (i=0;i<nA;i++){
     
    9292
    9393        /*Free ressources:*/
    94         xfree((void**)&row_nodes);
    95         xfree((void**)&col_nodes);
    96         xfree((void**)&idxm);
    97         xfree((void**)&idxn);
     94        xDelete<int>(row_nodes);
     95        xDelete<int>(col_nodes);
     96        xDelete<int>(idxm);
     97        xDelete<int>(idxn);
    9898}
  • issm/branches/trunk-jpl-damage/src/dox/issm.dox

    r12168 r12878  
    4646</th>
    4747<tr>
    48 <th  bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td  bgcolor=#FFFFFF style="text-align:right;">499</td><td  bgcolor=#FFFFFF style="text-align:right;">14338</td><td  bgcolor=#FFFFFF style="text-align:right;">16340</td><td  bgcolor=#FFFFFF style="text-align:right;">54651</td><td  bgcolor=#FFFFFF style="text-align:right;">85329</td>
     48<th  bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td  bgcolor=#FFFFFF style="text-align:right;">508</td><td  bgcolor=#FFFFFF style="text-align:right;">14595</td><td  bgcolor=#FFFFFF style="text-align:right;">16762</td><td  bgcolor=#FFFFFF style="text-align:right;">56036</td><td  bgcolor=#FFFFFF style="text-align:right;">87393</td>
    4949</tr>
    5050<tr>
    51 <th  bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td  bgcolor=#C6E2FF style="text-align:right;">919</td><td  bgcolor=#C6E2FF style="text-align:right;">6875</td><td  bgcolor=#C6E2FF style="text-align:right;">13184</td><td  bgcolor=#C6E2FF style="text-align:right;">30350</td><td  bgcolor=#C6E2FF style="text-align:right;">50409</td>
     51<th  bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td  bgcolor=#C6E2FF style="text-align:right;">925</td><td  bgcolor=#C6E2FF style="text-align:right;">6851</td><td  bgcolor=#C6E2FF style="text-align:right;">13228</td><td  bgcolor=#C6E2FF style="text-align:right;">30468</td><td  bgcolor=#C6E2FF style="text-align:right;">50547</td>
    5252</tr>
    5353<tr>
    54 <th  bgcolor=#FFFFFF style="text-align:left;"> C/C++  Header </th><td  bgcolor=#FFFFFF style="text-align:right;">366</td><td  bgcolor=#FFFFFF style="text-align:right;">2665</td><td  bgcolor=#FFFFFF style="text-align:right;">2529</td><td  bgcolor=#FFFFFF style="text-align:right;">9400</td><td  bgcolor=#FFFFFF style="text-align:right;">14594</td>
     54<th  bgcolor=#FFFFFF style="text-align:left;"> C/C++  Header </th><td  bgcolor=#FFFFFF style="text-align:right;">378</td><td  bgcolor=#FFFFFF style="text-align:right;">2758</td><td  bgcolor=#FFFFFF style="text-align:right;">2612</td><td  bgcolor=#FFFFFF style="text-align:right;">9818</td><td  bgcolor=#FFFFFF style="text-align:right;">15188</td>
    5555</tr>
    5656<tr>
    57 <th  bgcolor=#C6E2FF style="text-align:left;"> m4 </th><td  bgcolor=#C6E2FF style="text-align:right;">7</td><td  bgcolor=#C6E2FF style="text-align:right;">993</td><td  bgcolor=#C6E2FF style="text-align:right;">80</td><td  bgcolor=#C6E2FF style="text-align:right;">8237</td><td  bgcolor=#C6E2FF style="text-align:right;">9310</td>
     57<th  bgcolor=#C6E2FF style="text-align:left;"> m4 </th><td  bgcolor=#C6E2FF style="text-align:right;">7</td><td  bgcolor=#C6E2FF style="text-align:right;">997</td><td  bgcolor=#C6E2FF style="text-align:right;">80</td><td  bgcolor=#C6E2FF style="text-align:right;">8259</td><td  bgcolor=#C6E2FF style="text-align:right;">9336</td>
    5858</tr>
    5959<tr>
    60 <th  bgcolor=#FFFFFF style="text-align:left;"> Python </th><td  bgcolor=#FFFFFF style="text-align:right;">47</td><td  bgcolor=#FFFFFF style="text-align:right;">183</td><td  bgcolor=#FFFFFF style="text-align:right;">518</td><td  bgcolor=#FFFFFF style="text-align:right;">1099</td><td  bgcolor=#FFFFFF style="text-align:right;">1800</td>
     60<th  bgcolor=#FFFFFF style="text-align:left;"> Python </th><td  bgcolor=#FFFFFF style="text-align:right;">53</td><td  bgcolor=#FFFFFF style="text-align:right;">400</td><td  bgcolor=#FFFFFF style="text-align:right;">610</td><td  bgcolor=#FFFFFF style="text-align:right;">1424</td><td  bgcolor=#FFFFFF style="text-align:right;">2434</td>
    6161</tr>
    6262<tr>
     
    6767</tr>
    6868<tr>
    69 <th  bgcolor=#C6E2FF style="text-align:left;"> Bourne  Shell </th><td  bgcolor=#C6E2FF style="text-align:right;">5</td><td  bgcolor=#C6E2FF style="text-align:right;">46</td><td  bgcolor=#C6E2FF style="text-align:right;">71</td><td  bgcolor=#C6E2FF style="text-align:right;">226</td><td  bgcolor=#C6E2FF style="text-align:right;">343</td>
     69<th  bgcolor=#C6E2FF style="text-align:left;"> Bourne  Shell </th><td  bgcolor=#C6E2FF style="text-align:right;">5</td><td  bgcolor=#C6E2FF style="text-align:right;">47</td><td  bgcolor=#C6E2FF style="text-align:right;">75</td><td  bgcolor=#C6E2FF style="text-align:right;">239</td><td  bgcolor=#C6E2FF style="text-align:right;">361</td>
    7070</tr>
    7171<tr>
     
    7373</tr>
    7474<tr>
    75 <th  bgcolor=#C6E2FF style="text-align:left;"> C </th><td  bgcolor=#C6E2FF style="text-align:right;">2</td><td  bgcolor=#C6E2FF style="text-align:right;">3</td><td  bgcolor=#C6E2FF style="text-align:right;">3</td><td  bgcolor=#C6E2FF style="text-align:right;">24</td><td  bgcolor=#C6E2FF style="text-align:right;">30</td>
     75<th  bgcolor=#C6E2FF style="text-align:left;"> C </th><td  bgcolor=#C6E2FF style="text-align:right;">1</td><td  bgcolor=#C6E2FF style="text-align:right;">2</td><td  bgcolor=#C6E2FF style="text-align:right;">3</td><td  bgcolor=#C6E2FF style="text-align:right;">6</td><td  bgcolor=#C6E2FF style="text-align:right;">11</td>
    7676</tr>
    7777<tr>
    78 <th  bgcolor=#FFFFFF style="text-align:left;"> SUM: </th><td  bgcolor=#FFFFFF style="text-align:right;">1858</td><td  bgcolor=#FFFFFF style="text-align:right;">25240</td><td  bgcolor=#FFFFFF style="text-align:right;">32752</td><td  bgcolor=#FFFFFF style="text-align:right;">104721</td><td  bgcolor=#FFFFFF style="text-align:right;">162713</td>
     78<th  bgcolor=#FFFFFF style="text-align:left;"> SUM: </th><td  bgcolor=#FFFFFF style="text-align:right;">1890</td><td  bgcolor=#FFFFFF style="text-align:right;">25787</td><td  bgcolor=#FFFFFF style="text-align:right;">33397</td><td  bgcolor=#FFFFFF style="text-align:right;">106984</td><td  bgcolor=#FFFFFF style="text-align:right;">166168</td>
    7979</tr>
    8080</table>
  • issm/branches/trunk-jpl-damage/src/m/classes/autodiff.m

    r12004 r12878  
    2222
    2323                end % }}}
    24                 function checkconsistency(obj,md,solution,analyses) % {{{
     24                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2525
    2626                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/balancethickness.m

    r12004 r12878  
    2525
    2626                end % }}}
    27                 function checkconsistency(obj,md,solution,analyses) % {{{
     27                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2828                        %Early return
    2929                        if solution~=BalancethicknessSolutionEnum, return; end
    3030
    31                         checkfield(md,'balancethickness.spcthickness','forcing',1);
    32                         checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
    33                         checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
     31                        md = checkfield(md,'balancethickness.spcthickness','forcing',1);
     32                        md = checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
     33                        md = checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
    3434                end % }}}
    3535                function disp(obj) % {{{
  • issm/branches/trunk-jpl-damage/src/m/classes/bamggeom.m

    r8587 r12878  
    66classdef bamggeom
    77        properties (SetAccess=public)
    8                 % {{{1
     8                % {{{
    99                Vertices=[];
    1010                Edges=[];
     
    1818        end
    1919        methods
    20                 function bg = bamggeom(varargin)% {{{1
     20                function bg = bamggeom(varargin)% {{{
    2121                %BAMGGEOM - constructor for bamggeom object
    2222                %
     
    4444                        end
    4545                end%}}}
    46                 function display(bg)% {{{1
     46                function display(bg)% {{{
    4747                        disp(sprintf('\n%s = \n',inputname(1)));
    4848                        disp(struct(bg))
  • issm/branches/trunk-jpl-damage/src/m/classes/bamgmesh.m

    r8587 r12878  
    66classdef bamgmesh
    77        properties (SetAccess=public)
    8                 % {{{1
     8                % {{{
    99                Vertices=[];
    1010                Edges=[];
     
    2626        end
    2727        methods
    28                 function bg = bamgmesh(varargin)% {{{1
     28                function bg = bamgmesh(varargin)% {{{
    2929
    3030                switch nargin
     
    4848                        end
    4949                end%}}}
    50                 function display(bm)% {{{1
     50                function display(bm)% {{{
    5151                        disp(sprintf('\n%s = \n',inputname(1)));
    5252                        disp(struct(bm))
  • issm/branches/trunk-jpl-damage/src/m/classes/basalforcings.m

    r12004 r12878  
    2222
    2323                end % }}}
    24                 function checkconsistency(obj,md,solution,analyses) % {{{
     24                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2525
    2626                        if ismember(PrognosticAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isprognostic==0),
    27                                 checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
     27                                md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
    2828                        end
    2929                        if ismember(BalancethicknessAnalysisEnum,analyses),
    30                                 checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
     30                                md = checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
    3131                        end
    3232                        if ismember(ThermalAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isthermal==0),
    33                                 checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
    34                                 checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
     33                                md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
     34                                md = checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
    3535                        end
    3636                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/castor.m

    r12004 r12878  
    88classdef castor
    99    properties (SetAccess=public)
    10                  % {{{1
     10                 % {{{
    1111                 name='castor'
    1212                 login='username';
     
    2020         end
    2121         methods
    22                  function cluster=castor(varargin) % {{{1
     22                 function cluster=castor(varargin) % {{{
    2323                         cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
    2424                 end
    2525                 %}}}
    26                  function disp(cluster) % {{{1
     26                 function disp(cluster) % {{{
    2727                         %  display the object
    2828                         disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     
    3737                 end
    3838                 %}}}
    39                  function checkconsistency(cluster,md,solution,analyses) % {{{1
     39                 function md = checkconsistency(cluster,md,solution,analyses) % {{{
    4040
    4141                         available_queues={'shortc','longc'};
     
    4646                 end
    4747                 %}}}
    48                  function BuildQueueScript(cluster,md) % {{{1
     48                 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
    4949
    50                          %retrieve parameters
    51                          modelname=md.miscellaneous.name;
    52                          solution=md.private.solution;
     50                         if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     51                         if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    5352
    54                          %open file for writing:
     53                         %write queuing script
    5554                         fid=fopen([modelname '.queue'],'w');
    56 
    5755                         fprintf(fid,'#!/bin/sh\n');
    5856                         fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
     
    6462                         fprintf(fid,'#PBS -o %s.outlog \n',modelname);
    6563                         fprintf(fid,'#PBS -e %s.errlog \n',modelname);
    66 
    6764                         fprintf(fid,'export PBS_O_WORKDIR=%s\n',cluster.executionpath);
    6865                         fprintf(fid,'cd $PBS_O_WORKDIR\n');
    6966                         fprintf(fid,'export OMP_NUM_THREADS=1\n');
    7067                         fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    71 
    72                          %close file
    7368                         fclose(fid);
    7469
    7570                 end
    7671                 %}}}
    77                  function LaunchQueueJob(cluster,md,options)% {{{1
    78                          
    79                          %lauch command, to be executed via ssh
    80                          launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    81                                         ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && qsub ' modelname '.queue '];
     72                 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
    8273
    83                         if ~strcmpi(options.batch,'yes'),
    84                                
    85                                 %compress the files into one zip.
    86                                 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    87                                 if md.qmu.isdakota,
    88                                         compressstring=[compressstring md.miscellaneous.name '.qmu.in'];
    89                                 end
    90                                 system(compressstring);
    91                                
    92                                 disp('uploading input file and queueing script');
    93                                 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']});
    94                                
    95                                 disp('launching solution sequence on remote cluster');
    96                                 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand);
     74                         %compress the files into one zip.
     75                         compressstring=['tar -zcf ' dirname '.tar.gz '];
     76                         for i=1:numel(filelist),
     77                                 compressstring = [compressstring ' ' filelist{i}];
     78                         end
     79                         if cluster.interactive,
     80                                 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     81                         end
     82                         system(compressstring);
    9783
    98                         else
    99                                 disp('batch mode requested: not launching job interactively');
    100                                 disp('launch solution sequence on remote cluster by hand');
    101                         end
     84                         disp('uploading input file and queueing script');
     85                         issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    10286
    103                  end
    104                  %}}}
    105                  function Download(cluster,md)% {{{1
     87                         disp('launching solution sequence on remote cluster');
     88                         launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     89                                 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     90                         issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     91                 end %}}}
     92                 function Download(cluster,dirname,filelist)% {{{
    10693
    107                         %some check
    108                         if isempty(md.private.runtimename),
    109                                 error('pfe Download error message: supply runtime name for results to be loaded!');
    110                         end
     94                         %copy files from cluster to current directory
     95                         directory=[cluster.executionpath '/' dirname '/'];
     96                         issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    11197
    112                         %Figure out the  directory where all the files are in:
    113                         directory=[cluster.executionpath '/' md.private.runtimename '/'];
    114 
    115                         %What packages are we picking up from remote cluster
    116                         packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    117                         if md.qmu.isdakota,
    118                                 packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    119                                 packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    120                                 if isfield(md.qmu.params,'tabular_graphics_data'),
    121                                         if md.qmu.params.tabular_graphics_data==true,
    122                                                 packages{end+1}='dakota_tabular.dat';
    123                                         end
    124                                 end
    125                         else
    126                                 packages{end+1}=[md.miscellaneous.name '.outbin'];
    127                         end
    128 
    129                         %copy files from cluster to present directory
    130                         issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    131                 end %}}}
     98                 end %}}}
    13299        end
    133100end
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/cosmos.m

    r12004 r12878  
    88classdef cosmos
    99    properties (SetAccess=public)
    10                  % {{{1
     10                 % {{{
    1111                 name='cosmos'
    1212                 login='username';
     
    2020         end
    2121         methods
    22                  function cluster=cosmos(varargin) % {{{1
     22                 function cluster=cosmos(varargin) % {{{
    2323                         cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
    2424                 end
    2525                 %}}}
    26                  function disp(cluster) % {{{1
     26                 function disp(cluster) % {{{
    2727                         %  display the object
    2828                         disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     
    3737                 end
    3838                 %}}}
    39                  function checkconsistency(cluster,md,solution,analyses) % {{{1
     39                 function md = checkconsistency(cluster,md,solution,analyses) % {{{
    4040
    4141                         available_queues={'debug','shortq','longq'};
     
    4646                 end
    4747                 %}}}
    48                  function BuildQueueScript(cluster,md) % {{{1
     48                 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
    4949
    50                          %retrieve parameters
    51                          modelname=md.miscellaneous.name;
    52                          solution=md.private.solution;
     50                         if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     51                         if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    5352
    54                          %open file for writing:
     53                         %write queuing script
    5554                         fid=fopen([modelname '.queue'],'w');
    56 
    5755                         fprintf(fid,'#!/bin/bash\n');
    5856                         fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np);
     
    6866                         fprintf(fid,'ulimit -c 0\n');
    6967                         fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    70 
    71                          %close file
    7268                         fclose(fid);
    7369
    7470                 end
    7571                 %}}}
    76                  function LaunchQueueJob(cluster,md,options)% {{{1
    77                          
    78                          %lauch command, to be executed via ssh
    79                          launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    80                                         ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && qsub -S/bin/sh ' modelname '.queue '];
     72                 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
    8173
    82                         if ~strcmpi(options.batch,'yes'),
    83                                
    84                                 %compress the files into one zip.
    85                                 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    86                                 if md.qmu.isdakota,
    87                                         compressstring=[compressstring md.miscellaneous.name '.qmu.in'];
    88                                 end
    89                                 system(compressstring);
    90                                
    91                                 disp('uploading input file and queueing script');
    92                                 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']});
    93                                
    94                                 disp('launching solution sequence on remote cluster');
    95                                 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand);
     74                         %compress the files into one zip.
     75                         compressstring=['tar -zcf ' dirname '.tar.gz '];
     76                         for i=1:numel(filelist),
     77                                 compressstring = [compressstring ' ' filelist{i}];
     78                         end
     79                         if cluster.interactive,
     80                                 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     81                         end
     82                         system(compressstring);
    9683
    97                         else
    98                                 disp('batch mode requested: not launching job interactively');
    99                                 disp('launch solution sequence on remote cluster by hand');
    100                         end
     84                         disp('uploading input file and queueing script');
     85                         issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    10186
    102                  end
    103                  %}}}
    104                  function Download(cluster,md)% {{{1
     87                         disp('launching solution sequence on remote cluster');
     88                         launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     89                                 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     90                         issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     91                 end %}}}
     92                 function Download(cluster,dirname,filelist)% {{{
    10593
    106                         %some check
    107                         if isempty(md.private.runtimename),
    108                                 error('pfe Download error message: supply runtime name for results to be loaded!');
    109                         end
     94                         %copy files from cluster to current directory
     95                         directory=[cluster.executionpath '/' dirname '/'];
     96                         issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    11097
    111                         %Figure out the  directory where all the files are in:
    112                         directory=[cluster.executionpath '/' md.private.runtimename '/'];
    113 
    114                         %What packages are we picking up from remote cluster
    115                         packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    116                         if md.qmu.isdakota,
    117                                 packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    118                                 packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    119                                 if isfield(md.qmu.params,'tabular_graphics_data'),
    120                                         if md.qmu.params.tabular_graphics_data==true,
    121                                                 packages{end+1}='dakota_tabular.dat';
    122                                         end
    123                                 end
    124                         else
    125                                 packages{end+1}=[md.miscellaneous.name '.outbin'];
    126                         end
    127 
    128                         %copy files from cluster to present directory
    129                         issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    130                 end %}}}
     98                 end %}}}
    13199        end
    132100end
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/gemini.m

    r12004 r12878  
    88classdef gemini
    99    properties (SetAccess=public)
    10         % {{{1
     10        % {{{
    1111                name='gemini'
    1212                login='username';
     
    2020    end
    2121    methods
    22                  function cluster=gemini(varargin) % {{{1
     22                 function cluster=gemini(varargin) % {{{
    2323                         cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
    2424                 end
    2525                 %}}}
    26                  function disp(cluster) % {{{1
     26                 function disp(cluster) % {{{
    2727                         %  display the object
    2828                         disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     
    3737                 end
    3838                 %}}}
    39                  function checkconsistency(cluster,md,solution,analyses) % {{{1
     39                 function md = checkconsistency(cluster,md,solution,analyses) % {{{
    4040
    4141                         available_queues={'debug','shortg','longg'};
     
    4646                 end
    4747                 %}}}
    48                  function BuildQueueScript(cluster,md) % {{{1
     48                 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
    4949
    50                          %retrieve parameters
    51                          modelname=md.miscellaneous.name;
    52                          solution=md.private.solution;
     50                         if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     51                         if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    5352
    54                          %open file for writing:
     53                         %write queuing script
    5554                         fid=fopen([modelname '.queue'],'w');
    56 
    5755                         fprintf(fid,'#!/bin/sh\n');
    5856                         fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
     
    6967                         fprintf(fid,'export OMP_NUM_THREADS=1\n');
    7068                         fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    71 
    72                          %close file
    7369                         fclose(fid);
    7470
    7571                 end
    7672                 %}}}
    77                  function LaunchQueueJob(cluster,md,options)% {{{1
    78                          
    79                          %lauch command, to be executed via ssh
    80                          launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    81                                         ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && qsub ' modelname '.queue '];
     73                 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
    8274
    83                         if ~strcmpi(options.batch,'yes'),
    84                                
    85                                 %compress the files into one zip.
    86                                 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    87                                 if md.qmu.isdakota,
    88                                         compressstring=[compressstring md.miscellaneous.name '.qmu.in'];
    89                                 end
    90                                 system(compressstring);
    91                                
    92                                 disp('uploading input file and queueing script');
    93                                 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']});
    94                                
    95                                 disp('launching solution sequence on remote cluster');
    96                                 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand);
     75                         %compress the files into one zip.
     76                         compressstring=['tar -zcf ' dirname '.tar.gz '];
     77                         for i=1:numel(filelist),
     78                                 compressstring = [compressstring ' ' filelist{i}];
     79                         end
     80                         if cluster.interactive,
     81                                 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     82                         end
     83                         system(compressstring);
    9784
    98                         else
    99                                 disp('batch mode requested: not launching job interactively');
    100                                 disp('launch solution sequence on remote cluster by hand');
    101                         end
     85                         disp('uploading input file and queueing script');
     86                         issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    10287
    103                  end
    104                  %}}}
    105                  function Download(cluster,md)% {{{1
     88                         disp('launching solution sequence on remote cluster');
     89                         launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     90                                 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     91                         issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     92                 end %}}}
     93                 function Download(cluster,dirname,filelist)% {{{
    10694
    107                         %some check
    108                         if isempty(md.private.runtimename),
    109                                 error('pfe Download error message: supply runtime name for results to be loaded!');
    110                         end
     95                         %copy files from cluster to current directory
     96                         directory=[cluster.executionpath '/' dirname '/'];
     97                         issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    11198
    112                         %Figure out the  directory where all the files are in:
    113                         directory=[cluster.executionpath '/' md.private.runtimename '/'];
    114 
    115                         %What packages are we picking up from remote cluster
    116                         packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    117                         if md.qmu.isdakota,
    118                                 packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    119                                 packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    120                                 if isfield(md.qmu.params,'tabular_graphics_data'),
    121                                         if md.qmu.params.tabular_graphics_data==true,
    122                                                 packages{end+1}='dakota_tabular.dat';
    123                                         end
    124                                 end
    125                         else
    126                                 packages{end+1}=[md.miscellaneous.name '.outbin'];
    127                         end
    128 
    129                         %copy files from cluster to present directory
    130                         issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    131                 end %}}}
     99                 end %}}}
    132100        end
    133101end
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.m

    r12168 r12878  
    66
    77classdef generic
    8     properties (SetAccess=public)
    9                  % {{{1
    10                  name='';
    11                  login='';
    12                  np=1;
    13                  port=0;
    14                  interactive=1;
    15                  codepath=[issmdir() '/bin'];
    16                  executionpath=[issmdir() '/execution'];
    17                  valgrind=[issmdir() '/externalpackages/valgrind/install/bin/valgrind'];
    18                  valgrindlib=[issmdir() '/externalpackages/valgrind/install/lib/libmpidebug.so'];
    19                  valgrindsup=[issmdir() '/externalpackages/valgrind/issm.supp'];
    20                  %}}}
    21          end
    22          methods
    23                  function cluster=generic(varargin) % {{{1
     8        properties (SetAccess=public)
     9                % {{{
     10                name='';
     11                login='';
     12                np=1;
     13                port=0;
     14                interactive=1;
     15                codepath=[issmdir() '/bin'];
     16                executionpath=[issmdir() '/execution'];
     17                valgrind=[issmdir() '/externalpackages/valgrind/install/bin/valgrind'];
     18                valgrindlib=[issmdir() '/externalpackages/valgrind/install/lib/libmpidebug.so'];
     19                valgrindsup=[issmdir() '/externalpackages/valgrind/issm.supp'];
     20                %}}}
     21        end
     22        methods
     23                function cluster=generic(varargin) % {{{
    2424
    25                          %use provided options to change fields
    26                          options=pairoptions(varargin{:});
     25                        %use provided options to change fields
     26                        options=pairoptions(varargin{:});
    2727
    28                          %get name
    29                          cluster.name=getfieldvalue(options,'name',oshostname());
     28                        %get name
     29                        cluster.name=getfieldvalue(options,'name',oshostname());
    3030
    31                          %initialize cluster using user settings if provided
    32                          if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
     31                        %initialize cluster using user settings if provided
     32                        if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
    3333
    34                          %OK get other fields
    35                          cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
    36                  end
    37                  %}}}
    38                  function disp(cluster) % {{{1
    39                          %  display the object
    40                          disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
    41                          disp(sprintf('    name: %s',cluster.name));
    42                          disp(sprintf('    login: %s',cluster.login));
    43                          disp(sprintf('    np: %i',cluster.np));
    44                          disp(sprintf('    port: %i',cluster.port));
    45                          disp(sprintf('    codepath: %s',cluster.codepath));
    46                          disp(sprintf('    executionpath: %s',cluster.executionpath));
    47                          disp(sprintf('    valgrind: %s',cluster.valgrind));
    48                          disp(sprintf('    valgrindlib: %s',cluster.valgrindlib));
    49                          disp(sprintf('    valgrindsup: %s',cluster.valgrindsup));
    50                  end
    51                  %}}}
    52                  function checkconsistency(cluster,md,solution,analyses) % {{{1
    53                          if cluster.np<1
    54                                  checkmessage(['number of processors should be at least 1']);
    55                          end
    56                          if isnan(cluster.np),
    57                                  checkessage('number of processors should not be NaN!');
    58                          end
    59                  end
    60                  %}}}
    61                  function BuildQueueScript(cluster,md) % {{{1
    62                  
    63                          %retrieve parameters
    64                          modelname=md.miscellaneous.name;
    65                          solution=md.private.solution;
    66                          isvalgrind=md.debug.valgrind;
    67                          isgprof=md.debug.gprof;
     34                        %OK get other fields
     35                        cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
     36                end
     37                %}}}
     38                function disp(cluster) % {{{
     39                        %  display the object
     40                        disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     41                        disp(sprintf('    name: %s',cluster.name));
     42                        disp(sprintf('    login: %s',cluster.login));
     43                        disp(sprintf('    np: %i',cluster.np));
     44                        disp(sprintf('    port: %i',cluster.port));
     45                        disp(sprintf('    codepath: %s',cluster.codepath));
     46                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     47                        disp(sprintf('    valgrind: %s',cluster.valgrind));
     48                        disp(sprintf('    valgrindlib: %s',cluster.valgrindlib));
     49                        disp(sprintf('    valgrindsup: %s',cluster.valgrindsup));
     50                end
     51                %}}}
     52                function md = checkconsistency(cluster,md,solution,analyses) % {{{
     53                        if cluster.np<1
     54                                md = checkmessage(md,['number of processors should be at least 1']);
     55                        end
     56                        if isnan(cluster.np),
     57                                md = checkmessage(md,'number of processors should not be NaN!');
     58                        end
     59                end
     60                %}}}
     61                function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
    6862
    69                          %open file for writing:
    70                          if ~ispc,
    71                                  fid=fopen([modelname '.queue'],'w');
    72                          else
    73                                  fid=fopen([modelname '.bat'],'w');
    74                          end
     63                        %write queuing script
     64                        if ~ispc,
    7565
    76                          %write instructions for launching a job on the cluster
    77                          if ~ispc,
    78                                  fprintf(fid,'#!/bin/sh\n');
    79                          else
    80                                  fprintf(fid,'@echo off\n');
    81                          end
    82                          
    83                          if ~isvalgrind,
    84                                  if cluster.interactive
    85                                          if ~ispc,
    86                                                  fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    87                                          else
    88                                                  fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    89                                          end
    90                                  else
    91                                          if ~ispc,
    92                                                  fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
    93                                          else
    94                                                  fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
    95                                          end
    96                                  end
    97                          else
    98                                  if ~ispc,
    99                                          %Add --gen-suppressions=all to get suppression lines
    100                                          fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib);
    101                                          fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
    102                                          cluster.np,cluster.valgrind,cluster.valgrindsup, cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
    103                                  else
    104                                          error('valgrind not supported on windows platforms');
    105                                  end
    106                          end
     66                                fid=fopen([modelname '.queue'],'w');
     67                                fprintf(fid,'#!/bin/sh\n');
     68                                if ~isvalgrind,
     69                                        if cluster.interactive
     70                                                fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
     71                                        else
     72                                                fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
     73                                        end
     74                                elseif isgprof,
     75                                        fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);
     76                                else
     77                                        %Add --gen-suppressions=all to get suppression lines
     78                                        fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib);
     79                                        fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
     80                                                cluster.np,cluster.valgrind,cluster.valgrindsup,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
     81                                end
     82                                if ~io_gather, %concatenate the output files:
     83                                        fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);
     84                                end
     85                                fclose(fid);
    10786
    108                          if isgprof,
    109                                  if ~ispc,
    110                                          fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);
    111                                  else
    112                                          error('gprof not supported on windows platforms');
    113                                  end
     87                        else % Windows
    11488
    115                          end
    116 
    117                          if ~md.settings.io_gather,
    118                                  if ~ispc,
    119                                          %concatenate the output files:
    120                                          fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);
    121                                  else
    122                                          error('iogather not supported on windows platforms');
    123                                  end
    124 
    125                          end
    126                          
    127                          %close file:
    128                          fclose(fid);
    129 
    130                          %in interactive mode, create a run file, and errlog and outlog file
    131                          if cluster.interactive,
    132                                  fid=fopen([modelname '.errlog'],'w'); fclose(fid);
    133                                  fid=fopen([modelname '.outlog'],'w'); fclose(fid);
    134                          end
    135 
    136 
    137                  end
    138                  %}}}
    139                  function LaunchQueueJob(cluster,md,options)% {{{1
    140                          
    141                          if ~ispc,
    142                                          %lauch command, to be executed via ssh
    143                                          launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    144                                          ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && source  ' md.miscellaneous.name '.queue '];
    145 
    146                                          if ~strcmpi(options.batch,'yes'),
    147 
    148                                                  %compress the files into one zip.
    149                                                  compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    150                                                  if md.qmu.isdakota,
    151                                                          compressstring=[compressstring md.miscellaneous.name '.qmu.in'];
    152                                         end
    153                                         if cluster.interactive,
    154                                                 compressstring=[compressstring ' ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog '];
    155                                         end
    156                                         system(compressstring);
    157 
    158                                         disp('uploading input file and queueing script');
    159                                         issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']});
    160 
    161                                         disp('launching solution sequence on remote cluster');
    162                                         issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     89                                fid=fopen([modelname '.bat'],'w');
     90                                fprintf(fid,'@echo off\n');
     91                                if cluster.interactive
     92                                        fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    16393                                else
    164                                         disp('batch mode requested: not launching job interactively');
    165                                         disp('launch solution sequence on remote cluster by hand');
     94                                        fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog',...
     95                                                cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
    16696                                end
    167                         else
    168                                 %launch right here, do not compress or archive.
    169                                 system([md.miscellaneous.name '.bat']);
     97                                fclose(fid);
    17098                        end
    17199
     100                        %in interactive mode, create a run file, and errlog and outlog file
     101                        if cluster.interactive,
     102                                fid=fopen([modelname '.errlog'],'w'); fclose(fid);
     103                                fid=fopen([modelname '.outlog'],'w'); fclose(fid);
     104                        end
     105                end
     106                %}}}
     107                function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
     108
     109                        %write queuing script
     110                        if ~ispc,
     111
     112                                fid=fopen([modelname '.queue'],'w');
     113                                fprintf(fid,'#!/bin/sh\n');
     114                                if ~isvalgrind,
     115                                        if cluster.interactive
     116                                                fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s ',cluster.np,cluster.codepath,cluster.executionpath,modelname);
     117                                        else
     118                                                fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,cluster.executionpath,modelname,modelname,modelname);
     119                                        end
     120                                elseif isgprof,
     121                                        fprintf(fid,'\n gprof %s/kriging.exe gmon.out > %s.performance',cluster.codepath,modelname);
     122                                else
     123                                        %Add --gen-suppressions=all to get suppression lines
     124                                        fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib);
     125                                        fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/kriging.exe %s %s 2> %s.errlog >%s.outlog ',...
     126                                                cluster.np,cluster.valgrind,cluster.valgrindsup,cluster.codepath,cluster.executionpath,modelname,modelname,modelname);
     127                                end
     128                                if ~io_gather, %concatenate the output files:
     129                                        fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);
     130                                end
     131                                fclose(fid);
     132
     133                        else % Windows
     134
     135                                fid=fopen([modelname '.bat'],'w');
     136                                fprintf(fid,'@echo off\n');
     137                                if cluster.interactive
     138                                        fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
     139                                else
     140                                        fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog',...
     141                                                cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
     142                                end
     143                                fclose(fid);
     144                        end
     145
     146                        %in interactive mode, create a run file, and errlog and outlog file
     147                        if cluster.interactive,
     148                                fid=fopen([modelname '.errlog'],'w'); fclose(fid);
     149                                fid=fopen([modelname '.outlog'],'w'); fclose(fid);
     150                        end
     151                end
     152                %}}}
     153                function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
     154
     155                        %compress the files into one zip.
     156                        compressstring=['tar -zcf ' dirname '.tar.gz '];
     157                        for i=1:numel(filelist),
     158                                compressstring = [compressstring ' ' filelist{i}];
     159                        end
     160                        if cluster.interactive,
     161                                compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     162                        end
     163                        system(compressstring);
     164
     165                        disp('uploading input file and queueing script');
     166                        issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
     167
     168                        disp('launching solution sequence on remote cluster');
     169                        launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     170                                ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && source  ' modelname '.queue '];
     171                        issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    172172                end %}}}
    173                  function Download(cluster,md)% {{{1
     173                function Download(cluster,dirname,filelist)% {{{
    174174
    175                         if ~ispc,
    176                                 %some check
    177                                 if isempty(md.private.runtimename),
    178                                         error('supply runtime name for results to be loaded!');
    179                                 end
     175                        if ispc,
     176                                %do nothing
     177                                return;
     178                        end
    180179
    181                                 %Figure out the  directory where all the files are in:
    182                                 directory=[cluster.executionpath '/' md.private.runtimename '/'];
    183 
    184                                 %What packages are we picking up from remote cluster
    185                                 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    186                                 if md.qmu.isdakota,
    187                                         packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    188                                         packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    189                                         if isfield(md.qmu.params,'tabular_graphics_data'),
    190                                                 if md.qmu.params.tabular_graphics_data==true,
    191                                                         packages{end+1}='dakota_tabular.dat';
    192                                                 end
    193                                         end
    194                                 else
    195                                         packages{end+1}=[md.miscellaneous.name '.outbin'];
    196                                 end
    197 
    198                                 %copy files from cluster to present directory
    199                                 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    200                         else
    201                                 %do nothing!
    202                         end
     180                        %copy files from cluster to current directory
     181                        directory=[cluster.executionpath '/' dirname '/'];
     182                        issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    203183                end %}}}
    204184        end
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.py

    r12168 r12878  
    1 #GENERIC cluster class definition
    2 #
    3 #   Usage:
    4 #      cluster=generic('name','astrid',);
    5 #      cluster=generic('name','astrid','np',3);
    6 #      cluster=generic('name',oshostname(),'np',3,'login','username');
     1import socket
     2import os
     3import math
     4import platform
     5import subprocess
     6from issmdir import *
     7from pairoptions import *
     8from issmssh import *
     9from issmscpin import *
     10from issmscpout import *
    711
     12class generic(object):
     13        """
     14        GENERIC cluster class definition
     15 
     16            Usage:
     17               cluster=generic('name','astrid','np',3);
     18               cluster=generic('name',oshostname(),'np',3,'login','username');
     19        """
    820
    9 class generic:
    10         #properties
    11         def __init__(self):
    12                 # {{{ Properties
     21        def __init__(self,*args):    # {{{
     22
    1323                self.name=''
    1424                self.login=''
     
    1626                self.port=0
    1727                self.interactive=1
    18                 self.codepath=issmdir() + '/bin'
    19                 self.executionpath=issmdir() + '/execution'
    20                 self.valgrind=issmdir() + '/externalpackages/valgrind/install/bin/valgrind'
    21                 self.valgrindlib=issmdir() + '/externalpackages/valgrind/install/lib/libmpidebug.so'
    22                 self.valgrindsup=issmdir() + '/externalpackages/valgrind/issm.supp'
    23                 #}}}
    24         def __repr__(obj):
    25                 # {{{ Display
    26                
    27                 string="class 'generic' object:"
    28                 string="%s\n\n%s"%(string,"%s%s"%('    name: ',obj.name))
    29                 string="%s\n%s"%(string,"%s%i"%('    np: ',obj.np))
    30                 string="%s\n%s"%(string,"%s%i"%('    port: ',obj.port))
    31                 string="%s\n%s"%(string,"%s%s"%('    codepath: ',obj.codepath))
    32                 string="%s\n%s"%(string,"%s%s"%('    executionpath: ',obj.executionpath))
    33                 string="%s\n%s"%(string,"%s%s"%('    valgrind: ',obj.valgrind))
    34                 string="%s\n%s"%(string,"%s%s"%('    valgrindlib: ',obj.valgrindlib))
    35                 string="%s\n%s"%(string,"%s%s"%('    valgrindsup: ',obj.valgrindsup))
    36                 return string
    37                 #}}}
    38                
     28                self.codepath=issmdir()+'/bin'
     29                self.executionpath=issmdir()+'/execution'
     30                self.valgrind=issmdir()+'/externalpackages/valgrind/install/bin/valgrind'
     31                self.valgrindlib=issmdir()+'/externalpackages/valgrind/install/lib/libmpidebug.so'
     32                self.valgrindsup=issmdir()+'/externalpackages/valgrind/issm.supp'
    3933
    40 #old matlab
    41 #               function cluster=generic(varargin) % {{{1
    42 #
    43 #                        %use provided options to change fields
    44 #                        options=pairoptions(varargin{:});
    45 #
    46 #                        %get name
    47 #                        if ~exist(options,'name'), error('option ''name'' has not been provided'); end
    48 #                        cluster.name=getfieldvalue(options,'name');
    49 #
    50 #                        %initialize cluster using user settings if provided
    51 #                        if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
    52 #
    53 #                        %OK get other fields
    54 #                        for i=1:size(options.list,1),
    55 #                                fieldname=options.list{i,1};
    56 #                                fieldvalue=options.list{i,2};
    57 #                                if ismember(fieldname,properties('generic')),
    58 #                                        cluster.(fieldname)=fieldvalue;
    59 #                                else
    60 #                                        disp(['''' fieldname ''' is not a property of cluster generic']);
    61 #                                end
    62 #                        end
    63 #                end
    64 #                %}}}
    65 #                function checkconsistency(cluster,md,solution,analyses) % {{{1
    66 #                        if cluster.np<1
    67 #                                checkmessage(['number of processors should be at least 1']);
    68 #                        end
    69 #                        if isnan(cluster.np),
    70 #                                checkessage('number of processors should not be NaN!');
    71 #                        end
    72 #                end
    73 #                %}}}
    74 #                function BuildQueueScript(cluster,md) % {{{1
    75 #               
    76 #                        %retrieve parameters
    77 #                        modelname=md.miscellaneous.name;
    78 #                        solution=md.private.solution;
    79 #                        isvalgrind=md.debug.valgrind;
    80 #                        isgprof=md.debug.gprof;
    81 #
    82 #                        %open file for writing:
    83 #                        if ~ispc,
    84 #                                fid=fopen([modelname '.queue'],'w');
    85 #                        else
    86 #                                fid=fopen([modelname '.bat'],'w');
    87 #                        end
    88 #
    89 #                        %write instructions for launching a job on the cluster
    90 #                        if ~ispc,
    91 #                                fprintf(fid,'#!/bin/sh\n');
    92 #                        else
    93 #                                fprintf(fid,'@echo off\n');
    94 #                        end
    95 #                       
    96 #                        if ~isvalgrind,
    97 #                                if cluster.interactive
    98 #                                        if ~ispc,
    99 #                                                fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    100 #                                        else
    101 #                                                fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    102 #                                        end
    103 #                                else
    104 #                                        if ~ispc,
    105 #                                                fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
    106 #                                        else
    107 #                                                fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
    108 #                                        end
    109 #                                end
    110 #                        else
    111 #                                if ~ispc,
    112 #                                        %Add --gen-suppressions=all to get suppression lines
    113 #                                        fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib);
    114 #                                        fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
    115 #                                        cluster.np,cluster.valgrind,cluster.valgrindsup, cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
    116 #                                else
    117 #                                        error('valgrind not supported on windows platforms');
    118 #                                end
    119 #                        end
    120 #
    121 #                        if isgprof,
    122 #                                if ~ispc,
    123 #                                        fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);
    124 #                                else
    125 #                                        error('gprof not supported on windows platforms');
    126 #                                end
    127 #
    128 #                        end
    129 #
    130 #                        if ~md.settings.io_gather,
    131 #                                if ~ispc,
    132 #                                        %concatenate the output files:
    133 #                                        fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);
    134 #                                else
    135 #                                        error('iogather not supported on windows platforms');
    136 #                                end
    137 #
    138 #                        end
    139 #                       
    140 #                        %close file:
    141 #                        fclose(fid);
    142 #
    143 #                        %in interactive mode, create a run file, and errlog and outlog file
    144 #                        if cluster.interactive,
    145 #                                fid=fopen([modelname '.errlog'],'w'); fclose(fid);
    146 #                                fid=fopen([modelname '.outlog'],'w'); fclose(fid);
    147 #                        end
    148 #
    149 #
    150 #                end
    151 #                %}}}
    152 #                function LaunchQueueJob(cluster,md,options)% {{{1
    153 #                       
    154 #                        if ~ispc,
    155 #                                        %lauch command, to be executed via ssh
    156 #                                        launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    157 #                                        ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && source  ' md.miscellaneous.name '.queue '];
    158 #
    159 #                                        if ~strcmpi(options.batch,'yes'),
    160 #
    161 #                                                %compress the files into one zip.
    162 #                                                compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    163 #                                                if md.qmu.isdakota,
    164 #                                                        compressstring=[compressstring md.miscellaneous.name '.qmu.in'];
    165 #                                       end
    166 #                                       if cluster.interactive,
    167 #                                               compressstring=[compressstring ' ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog '];
    168 #                                       end
    169 #                                       system(compressstring);
    170 #
    171 #                                       disp('uploading input file and queueing script');
    172 #                                       issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']});
    173 #
    174 #                                       disp('launching solution sequence on remote cluster');
    175 #                                       issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    176 #                               else
    177 #                                       disp('batch mode requested: not launching job interactively');
    178 #                                       disp('launch solution sequence on remote cluster by hand');
    179 #                               end
    180 #                       else
    181 #                               %launch right here, do not compress or archive.
    182 #                               system([md.miscellaneous.name '.bat']);
    183 #                       end
    184 #
    185 #               end %}}}
    186 #                function Download(cluster,md)% {{{1
    187 #
    188 #                       if ~ispc,
    189 #                               %some check
    190 #                               if isempty(md.private.runtimename),
    191 #                                       error('supply runtime name for results to be loaded!');
    192 #                               end
    193 #
    194 #                               %Figure out the  directory where all the files are in:
    195 #                               directory=[cluster.executionpath '/' md.private.runtimename '/'];
    196 #
    197 #                               %What packages are we picking up from remote cluster
    198 #                               packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    199 #                               if md.qmu.isdakota,
    200 #                                       packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    201 #                                       packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    202 #                                       if isfield(md.qmu.params,'tabular_graphics_data'),
    203 #                                               if md.qmu.params.tabular_graphics_data==true,
    204 #                                                       packages{end+1}='dakota_tabular.dat';
    205 #                                               end
    206 #                                       end
    207 #                               else
    208 #                                       packages{end+1}=[md.miscellaneous.name '.outbin'];
    209 #                               end
    210 #
    211 #                               %copy files from cluster to present directory
    212 #                               issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    213 #                       else
    214 #                               %do nothing!
    215 #                       end
    216 #               end %}}}
    217 #
     34                #use provided options to change fields
     35                options=pairoptions(*args)
     36
     37                #get name
     38                self.name=options.getfieldvalue('name',socket.gethostname().lower().split('.')[0])
     39
     40                #initialize cluster using user settings if provided
     41                if os.path.exists(self.name+'_settings.py'):
     42                        execfile(self.name+'_settings.py',globals())
     43
     44                #OK get other fields
     45                self=options.AssignObjectFields(self)
     46        # }}}
     47
     48        def __repr__(self):    # {{{
     49                #  display the object
     50                s ="class '%s' object '%s' = \n" % (type(self),'self')
     51                s+="    name: %s\n" % self.name
     52                s+="    login: %s\n" % self.login
     53                s+="    np: %i\n" % self.np
     54                s+="    port: %i\n" % self.port
     55                s+="    codepath: %s\n" % self.codepath
     56                s+="    executionpath: %s\n" % self.executionpath
     57                s+="    valgrind: %s\n" % self.valgrind
     58                s+="    valgrindlib: %s\n" % self.valgrindlib
     59                s+="    valgrindsup: %s\n" % self.valgrindsup
     60                return s
     61        # }}}
     62
     63        def checkconsistency(self,md,solution,analyses):    # {{{
     64                if self.np<1:
     65                        md = checkmessage(md,'number of processors should be at least 1')
     66                if math.isnan(self.np):
     67                        md = checkmessage(md,'number of processors should not be NaN!')
     68
     69                return md
     70        # }}}
     71
     72        def BuildQueueScript(self,dirname,modelname,solution,io_gather,isvalgrind,isgprof):    # {{{
     73
     74                #write queuing script
     75                if not 'Windows' in platform.system():
     76
     77                        fid=open(modelname+'.queue','w')
     78                        fid.write('#!/bin/sh\n')
     79                        if not isvalgrind:
     80                                if self.interactive:
     81                                        fid.write('mpiexec -np %i %s/issm.exe %s %s %s ' % (self.np,self.codepath,EnumToString(solution),self.executionpath,modelname))
     82                                else:
     83                                        fid.write('mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ' % (self.np,self.codepath,EnumToString(solution),self.executionpath,modelname,modelname,modelname))
     84                        elif isgprof:
     85                                fid.write('\n gprof %s/issm.exe gmon.out > %s.performance' % (self.codepath,modelname))
     86                        else:
     87                                #Add --gen-suppressions=all to get suppression lines
     88                                fid.write('LD_PRELOAD=%s \\\n' % self.valgrindlib)
     89                                fid.write('mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ' % \
     90                                        (self.np,self.valgrind,self.valgrindsup,self.codepath,EnumToString(solution),self.executionpath,modelname,modelname,modelname))
     91                        if not io_gather:    #concatenate the output files:
     92                                fid.write('\ncat %s.outbin.* > %s.outbin' % (modelname,modelname))
     93                        fid.close()
     94
     95                else:    # Windows
     96
     97                        fid=open(modelname+'.bat','w')
     98                        fid.write('@echo off\n')
     99                        if self.interactive:
     100                                fid.write('"%s/issm.exe" %s "%s" %s ' % (self.codepath,EnumToString(solution),self.executionpath,modelname))
     101                        else:
     102                                fid.write('"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog' % \
     103                                        (self.codepath,EnumToString(solution),self.executionpath,modelname,modelname,modelname))
     104                        fid.close()
     105
     106                #in interactive mode, create a run file, and errlog and outlog file
     107                if self.interactive:
     108                        fid=open(modelname+'.errlog','w')
     109                        fid.close()
     110                        fid=open(modelname+'.outlog','w')
     111                        fid.close()
     112        # }}}
     113
     114        def BuildKrigingQueueScript(self,modelname,solution,io_gather,isvalgrind,isgprof):    # {{{
     115
     116                #write queuing script
     117                if not 'Windows' in platform.system():
     118
     119                        fid=open(modelname+'.queue','w')
     120                        fid.write('#!/bin/sh\n')
     121                        if not isvalgrind:
     122                                if self.interactive:
     123                                        fid.write('mpiexec -np %i %s/kriging.exe %s %s ' % (self.np,self.codepath,self.executionpath,modelname))
     124                                else:
     125                                        fid.write('mpiexec -np %i %s/kriging.exe %s %s 2> %s.errlog >%s.outlog ' % (self.np,self.codepath,self.executionpath,modelname,modelname,modelname))
     126                        elif isgprof:
     127                                fid.write('\n gprof %s/kriging.exe gmon.out > %s.performance' & (self.codepath,modelname))
     128                        else:
     129                                #Add --gen-suppressions=all to get suppression lines
     130                                fid.write('LD_PRELOAD=%s \\\n' % self.valgrindlib)
     131                                fid.write('mpiexec -np %i %s --leak-check=full --suppressions=%s %s/kriging.exe %s %s 2> %s.errlog >%s.outlog ' % \
     132                                        (self.np,self.valgrind,self.valgrindsup,self.codepath,self.executionpath,modelname,modelname,modelname))
     133                        if not io_gather:    #concatenate the output files:
     134                                fid.write('\ncat %s.outbin.* > %s.outbin' % (modelname,modelname))
     135                        fid.close()
     136
     137                else:    # Windows
     138
     139                        fid=open(modelname+'.bat','w')
     140                        fid.write('@echo off\n')
     141                        if self.interactive:
     142                                fid.write('"%s/issm.exe" %s "%s" %s ' % (self.codepath,EnumToString(solution),self.executionpath,modelname))
     143                        else:
     144                                fid.write('"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog' % \
     145                                        (self.codepath,EnumToString(solution),self.executionpath,modelname,modelname,modelname))
     146                        fid.close()
     147
     148                #in interactive mode, create a run file, and errlog and outlog file
     149                if self.interactive:
     150                        fid=open(modelname+'.errlog','w')
     151                        fid.close()
     152                        fid=open(modelname+'.outlog','w')
     153                        fid.close()
     154        # }}}
     155
     156        def LaunchQueueJob(self,modelname,dirname,filelist):    # {{{
     157
     158                #compress the files into one zip.
     159                compressstring='tar -zcf %s.tar.gz ' % dirname
     160                for file in filelist:
     161                        compressstring += ' %s' % file
     162                if self.interactive:
     163                        compressstring += ' %s.errlog %s.outlog ' % (modelname,modelname)
     164                subprocess.call(compressstring,shell=True)
     165
     166                print 'uploading input file and queueing script'
     167                issmscpout(self.name,self.executionpath,self.login,self.port,[dirname+'.tar.gz'])
     168
     169                print 'launching solution sequence on remote cluster'
     170                launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && source  %s.queue ' % \
     171                        (self.executionpath,dirname,dirname,dirname,dirname,dirname,modelname)
     172                issmssh(self.name,self.login,self.port,launchcommand)
     173        # }}}
     174
     175        def Download(self,dirname,filelist):     # {{{
     176
     177                if 'Windows' in platform.system():
     178                        #do nothing
     179                        return
     180
     181                #copy files from cluster to current directory
     182                directory='%s/%s/' % (self.executionpath,dirname)
     183                issmscpin(self.name,self.login,self.port,directory,filelist)
     184        # }}}
     185
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/greenplanet.m

    r12004 r12878  
    88classdef greenplanet
    99    properties (SetAccess=public) 
    10                  % {{{1
     10                 % {{{
    1111                 name='greenplanet'
    1212                 login='';
     
    2424         end
    2525         methods
    26                  function cluster=greenplanet(varargin) % {{{1
     26                 function cluster=greenplanet(varargin) % {{{
    2727
    2828                         %initialize cluster using default settings if provided
     
    3333                 end
    3434                 %}}}
    35                  function disp(cluster) % {{{1
     35                 function disp(cluster) % {{{
    3636                         %  display the object
    3737                         disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     
    4848                 end
    4949                 %}}}
    50                  function checkconsistency(cluster,md,solution,analyses) % {{{1
     50                 function md = checkconsistency(cluster,md,solution,analyses) % {{{
    5151
    5252                         available_queues={'rignot','default'};
     
    5757
    5858                         %Miscelaneous
    59                          if isempty(cluster.login), checkmessage('login empty'); end
    60                          if isempty(cluster.codepath), checkmessage('codepath empty'); end
    61                          if isempty(cluster.executionpath), checkmessage('executionpath empty'); end
     59                         if isempty(cluster.login), md = checkmessage(md,'login empty'); end
     60                         if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     61                         if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
    6262
    6363                 end
    6464                 %}}}
    65                  function BuildQueueScript(cluster,md) % {{{1
     65                 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
    6666
    67                          %retrieve parameters
    68                          modelname=md.miscellaneous.name;
    69                          solution=md.private.solution;
    70                          isvalgrind=md.debug.valgrind;
     67                         if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     68                         if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    7169
    7270                         %compute number of processors
    7371                         cluster.np=cluster.numnodes*cluster.cpuspernode;
    7472
    75                          %open file for writing:
     73                         %write queuing script
    7674                         fid=fopen([modelname '.queue'],'w');
    77 
    7875                         fprintf(fid,'#PBS -S /bin/bash\n');
    7976                         fprintf(fid,'#PBS -N %s\n',modelname);
     
    8481                         fprintf(fid,'#PBS -o %s.outlog \n',modelname);
    8582                         fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
    86 
    87                          fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,md.private.runtimename);
     83                         fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    8884                         fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    89 
    90                          if ~md.settings.io_gather,
    91                                  %concatenate the output files:
     85                         if ~io_gather, %concatenate the output files:
    9286                                 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
    9387                         end
    94 
    95                          %close file
    9688                         fclose(fid);
    9789
     
    10092                                 fid=fopen([modelname '.run'],'w');
    10193                                 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    102 
    103                                  if ~md.settings.io_gather,
    104                                          %concatenate the output files:
     94                                 if ~io_gather, %concatenate the output files:
    10595                                         fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
    10696                                 end
     
    112102                         end
    113103                 end %}}}
    114                  function LaunchQueueJob(cluster,md,options)% {{{1
    115                          
    116                          %lauch command, to be executed via ssh
    117                          if ~cluster.interactive,
    118                                 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    119                                         ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && qsub ' md.miscellaneous.name '.queue '];
    120                         else
    121                                 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' md.private.runtimename '.tar.gz'];
    122                         end
     104                 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
    123105
    124                         if ~strcmpi(options.batch,'yes'),
    125                                
    126                                 %compress the files into one zip.
    127                                 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    128                                 if md.qmu.isdakota,
    129                                         compressstring=[compressstring md.miscellaneous.name '.qmu.in '];
    130                                 end
    131                                 if cluster.interactive,
    132                                         compressstring=[compressstring md.miscellaneous.name '.run ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog '];
    133                                 end
    134                                 system(compressstring);
    135                                
    136                                 disp('uploading input file and queueing script');
    137                                 if cluster.interactive,
    138                                         directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
    139                                 else
    140                                         directory=cluster.executionpath;
    141                                 end
    142                                
    143                                 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']});
    144                                
    145                                 disp('launching solution sequence on remote cluster');
    146                                 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     106                         %compress the files into one zip.
     107                         compressstring=['tar -zcf ' dirname '.tar.gz '];
     108                         for i=1:numel(filelist),
     109                                 compressstring = [compressstring ' ' filelist{i}];
     110                         end
     111                         if cluster.interactive,
     112                                 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     113                         end
     114                         system(compressstring);
    147115
    148                         else
    149                                 disp('batch mode requested: not launching job interactively');
    150                                 disp('launch solution sequence on remote cluster by hand');
    151                         end
    152                  end
    153                  %}}}
    154                  function Download(cluster,md)% {{{1
     116                         disp('uploading input file and queueing script');
     117                         issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    155118
    156                         %some check
    157                         if isempty(md.private.runtimename),
    158                                 if ~cluster.interactive,
    159                                         error('greenplanet Download error message: supply runtime name for results to be loaded!');
    160                                 end
    161                         end
     119                         disp('launching solution sequence on remote cluster');
     120                         launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     121                                 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     122                         issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     123                 end %}}}
     124                 function Download(cluster,dirname,filelist)% {{{
    162125
    163                         %Figure out the  directory where all the files are in:
    164                         if ~cluster.interactive,
    165                                 directory=[cluster.executionpath '/' md.private.runtimename '/'];
    166                         else
    167                                 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
    168                         end
     126                         %copy files from cluster to current directory
     127                         directory=[cluster.executionpath '/' dirname '/'];
     128                         issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    169129
    170                         %What packages are we picking up from remote cluster
    171                         if ~cluster.interactive,
    172                                 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    173                         else
    174                                 packages={};
    175                         end
    176                         if md.qmu.isdakota,
    177                                 packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    178                                 packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    179                                 if isfield(md.qmu.params,'tabular_graphics_data'),
    180                                         if md.qmu.params.tabular_graphics_data==true,
    181                                                 packages{end+1}='dakota_tabular.dat';
    182                                         end
    183                                 end
    184                         else
    185                                 packages{end+1}=[md.miscellaneous.name '.outbin'];
    186                         end
    187 
    188                         %copy files from cluster to present directory
    189                         issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    190 
    191                 end %}}}
     130                 end %}}}
    192131        end
    193132end
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/pfe.m

    r12004 r12878  
    88classdef pfe
    99    properties (SetAccess=public) 
    10                  % {{{1
     10                 % {{{
    1111                 name='pfe'
    1212                 login='';
     
    2929         end
    3030         methods
    31                  function cluster=pfe(varargin) % {{{1
     31                 function cluster=pfe(varargin) % {{{
    3232
    3333                         %initialize cluster using default settings if provided
     
    3838                 end
    3939                 %}}}
    40                  function disp(cluster) % {{{1
     40                 function disp(cluster) % {{{
    4141                         %  display the object
    4242                         disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     
    5656                 end
    5757                 %}}}
    58                  function checkconsistency(cluster,md,solution,analyses) % {{{1
     58                 function md = checkconsistency(cluster,md,solution,analyses) % {{{
    5959
    6060                         available_queues={'long','normal','debug'};
     
    6868                                 if cluster.hyperthreading,
    6969                                         if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
    70                                                  checkmessage('cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode');
     70                                                 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode');
    7171                                         end
    7272                                 else
    7373                                         if ((cluster.cpuspernode>8 ) | (cluster.cpuspernode<1)),
    74                                                  checkmessage('cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');
     74                                                 md = checkmessage(md,'cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');
    7575                                         end
    7676                                 end
     
    7878                                 if cluster.hyperthreading,
    7979                                         if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
    80                                                  checkmessage('cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');
     80                                                 md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');
    8181                                         end
    8282                                 else
    8383                                         if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)),
    84                                                  checkmessage('cpuspernode should be between 1 and 12 for ''wes'' processors');
    85                                          end
    86                                  end
    87                          else
    88                                  checkmessage('unknown processor type, should be ''neh'',''wes'' or ''har''');
     84                                                 md = checkmessage(md,'cpuspernode should be between 1 and 12 for ''wes'' processors');
     85                                         end
     86                                 end
     87                         else
     88                                 md = checkmessage(md,'unknown processor type, should be ''neh'',''wes'' or ''har''');
    8989                         end
    9090
    9191                         %Miscelaneous
    92                          if isempty(cluster.login), checkmessage('login empty'); end
    93                          if isempty(cluster.codepath), checkmessage('codepath empty'); end
    94                          if isempty(cluster.executionpath), checkmessage('executionpath empty'); end
    95 
    96                  end
    97                  %}}}
    98                  function BuildQueueScript(cluster,md) % {{{1
    99 
    100                          %retrieve parameters
    101                          modelname=md.miscellaneous.name;
    102                          solution=md.private.solution;
    103                          isvalgrind=md.debug.valgrind;
     92                         if isempty(cluster.login), md = checkmessage(md,'login empty'); end
     93                         if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     94                         if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
     95
     96                 end
     97                 %}}}
     98                 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
     99
     100                         if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    104101
    105102                         %compute number of processors
    106103                         cluster.np=cluster.numnodes*cluster.cpuspernode;
    107104
    108                          %open file for writing:
     105                         %write queuing script
    109106                         fid=fopen([modelname '.queue'],'w');
    110 
    111107                         fprintf(fid,'#PBS -S /bin/bash\n');
    112108%                        fprintf(fid,'#PBS -N %s\n',modelname);
     
    118114                         fprintf(fid,'#PBS -o %s.outlog \n',modelname);
    119115                         fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
    120 
    121116                         fprintf(fid,'. /usr/share/modules/init/bash\n\n');
    122 
    123117                         fprintf(fid,'module load comp-intel/11.1.046\n');
    124118                         fprintf(fid,'module load mpi/mpt.1.25\n');
    125119                         fprintf(fid,'module load math/intel_mkl_64_10.0.011\n\n');
    126 
    127120                         fprintf(fid,'export PATH="$PATH:."\n\n');
    128121                         fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
    129 
    130122                         fprintf(fid,'cd $PBS_O_WORKDIR\n\n');
    131 
    132123                         fprintf(fid,'mpiexec -np %i %s/issm.exe %s $PBS_O_WORKDIR %s\n',cluster.np,cluster.codepath,EnumToString(solution),modelname);
    133 
    134                          if ~md.settings.io_gather,
    135                                  %concatenate the output files:
     124                         if ~io_gather, %concatenate the output files:
    136125                                 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
    137126                         end
    138 
    139                          %close file
    140127                         fclose(fid);
    141128
     
    148135                                         fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/issm.exe %s $PBS_O_WORKDIR %s\n',cluster.np,cluster.codepath,EnumToString(solution),modelname);
    149136                                 end
    150 
    151                                  if ~md.settings.io_gather,
    152                                          %concatenate the output files:
     137                                 if ~io_gather, %concatenate the output files:
    153138                                         fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
    154139                                 end
     
    160145                         end
    161146                 end %}}}
    162                  function LaunchQueueJob(cluster,md,options)% {{{1
    163                          
     147                 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
     148
     149                         %compress the files into one zip.
     150                         compressstring=['tar -zcf ' dirname '.tar.gz '];
     151                         for i=1:numel(filelist),
     152                                 compressstring = [compressstring ' ' filelist{i}];
     153                         end
     154                         if cluster.interactive,
     155                                 compressstring = [compressstring ' ' modelname '.run '  modelname '.errlog ' modelname '.outlog '];
     156                         end
     157                         system(compressstring);
     158
     159                         disp('uploading input file and queueing script');
     160                         if cluster.interactive,
     161                                 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
     162                         else
     163                                 directory=cluster.executionpath;
     164                         end
     165
     166                         if ~cluster.bbftp,
     167                                 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
     168                         else
     169                                 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
     170                         end
     171
    164172                         %lauch command, to be executed via ssh
    165173                         if ~cluster.interactive,
    166                                 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    167                                         ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && qsub ' md.miscellaneous.name '.queue '];
    168                         else
    169                                 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' md.private.runtimename '.tar.gz'];
    170                         end
    171 
    172                         if ~strcmpi(options.batch,'yes'),
    173                                
    174                                 %compress the files into one zip.
    175                                 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    176                                 if md.qmu.isdakota,
    177                                         compressstring=[compressstring md.miscellaneous.name '.qmu.in '];
    178                                 end
    179                                 if cluster.interactive,
    180                                         compressstring=[compressstring md.miscellaneous.name '.run ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog '];
    181                                 end
    182                                 system(compressstring);
    183                                
    184                                 disp('uploading input file and queueing script');
    185                                 if cluster.interactive,
    186                                         directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
    187                                 else
    188                                         directory=cluster.executionpath;
    189                                 end
    190                                
    191                                 if ~cluster.bbftp,
    192                                         issmscpout(cluster.name,directory,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']});
    193                                 else
    194                                         issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[md.private.runtimename '.tar.gz']});
    195                                 end
    196                                
    197                                 disp('launching solution sequence on remote cluster');
    198                                 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    199 
    200                         else
    201                                 disp('batch mode requested: not launching job interactively');
    202                                 disp('launch solution sequence on remote cluster by hand');
    203                         end
    204                  end
    205                  %}}}
    206                  function Download(cluster,md)% {{{1
    207 
    208                         %some check
    209                         if isempty(md.private.runtimename),
    210                                 if ~cluster.interactive,
    211                                         error('pfe Download error message: supply runtime name for results to be loaded!');
    212                                 end
    213                         end
    214 
    215                         %Figure out the  directory where all the files are in:
    216                         if ~cluster.interactive,
    217                                 directory=[cluster.executionpath '/' md.private.runtimename '/'];
    218                         else
    219                                 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
    220                         end
    221 
    222                         %What packages are we picking up from remote cluster
    223                         if ~cluster.interactive,
    224                                 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    225                         else
    226                                 packages={};
    227                         end
    228                         if md.qmu.isdakota,
    229                                 packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    230                                 packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    231                                 if isfield(md.qmu.params,'tabular_graphics_data'),
    232                                         if md.qmu.params.tabular_graphics_data==true,
    233                                                 packages{end+1}='dakota_tabular.dat';
    234                                         end
    235                                 end
    236                         else
    237                                 packages{end+1}=[md.miscellaneous.name '.outbin'];
    238                         end
    239 
    240                         %copy files from cluster to present directory
    241                         if ~cluster.bbftp,
    242                                 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    243                         else
    244                                 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, packages);
    245                         end
    246 
    247                 end %}}}
     174                                 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     175                                         ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     176                         else
     177                                 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
     178                         end
     179
     180                         disp('launching solution sequence on remote cluster');
     181                         issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     182                 end
     183                 %}}}
     184                 function Download(cluster,dirname,filelist)% {{{
     185
     186                         %copy files from cluster to current directory
     187                         if ~cluster.interactive,
     188                                 directory=[cluster.executionpath '/' dirname '/'];
     189                         else
     190                                 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
     191                         end
     192
     193                         if ~cluster.bbftp,
     194                                 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     195                         else
     196                                 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
     197                         end
     198
     199                 end %}}}
    248200        end
    249201end
  • issm/branches/trunk-jpl-damage/src/m/classes/clusters/pollux.m

    r12004 r12878  
    88classdef pollux
    99    properties (SetAccess=public)
    10                  % {{{1
     10                 % {{{
    1111                 name='pollux'
    1212                 login='username';
     
    2020         end
    2121         methods
    22                  function cluster=pollux(varargin) % {{{1
     22                 function cluster=pollux(varargin) % {{{
    2323                         cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
    2424                 end
    2525                 %}}}
    26                  function disp(cluster) % {{{1
     26                 function disp(cluster) % {{{
    2727                         %  display the object
    2828                         disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     
    3737                 end
    3838                 %}}}
    39                  function checkconsistency(cluster,md,solution,analyses) % {{{1
     39                 function md = checkconsistency(cluster,md,solution,analyses) % {{{
    4040
    4141                         available_queues={'shortp','longp'};
     
    4646                 end
    4747                 %}}}
    48                  function BuildQueueScript(cluster,md) % {{{1
     48                 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
    4949
    50                          %retrieve parameters
    51                          modelname=md.miscellaneous.name;
    52                          solution=md.private.solution;
     50                         if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     51                         if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    5352
    54                          %open file for writing:
     53                         %write queuing script
    5554                         fid=fopen([modelname '.queue'],'w');
    56 
    5755                         fprintf(fid,'#!/bin/sh\n');
    5856                         fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
     
    6462                         fprintf(fid,'#PBS -o %s.outlog \n',modelname);
    6563                         fprintf(fid,'#PBS -e %s.errlog \n',modelname);
    66 
    6764                         fprintf(fid,'export PBS_O_WORKDIR=%s\n',cluster.executionpath);
    6865                         fprintf(fid,'cd $PBS_O_WORKDIR\n');
    6966                         fprintf(fid,'export OMP_NUM_THREADS=1\n');
    7067                         fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
    71 
    72                          %close file
    7368                         fclose(fid);
    7469
    7570                 end
    7671                 %}}}
    77                  function LaunchQueueJob(cluster,md,options)% {{{1
    78                          
    79                          %lauch command, to be executed via ssh
    80                          launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
    81                                         ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && qsub ' modelname '.queue '];
     72                 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
    8273
    83                         if ~strcmpi(options.batch,'yes'),
    84                                
    85                                 %compress the files into one zip.
    86                                 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
    87                                 if md.qmu.isdakota,
    88                                         compressstring=[compressstring md.miscellaneous.name '.qmu.in'];
    89                                 end
    90                                 system(compressstring);
    91                                
    92                                 disp('uploading input file and queueing script');
    93                                 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']});
    94                                
    95                                 disp('launching solution sequence on remote cluster');
    96                                 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand);
     74                         %compress the files into one zip.
     75                         compressstring=['tar -zcf ' dirname '.tar.gz '];
     76                         for i=1:numel(filelist),
     77                                 compressstring = [compressstring ' ' filelist{i}];
     78                         end
     79                         if cluster.interactive,
     80                                 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     81                         end
     82                         system(compressstring);
    9783
    98                         else
    99                                 disp('batch mode requested: not launching job interactively');
    100                                 disp('launch solution sequence on remote cluster by hand');
    101                         end
     84                         disp('uploading input file and queueing script');
     85                         issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    10286
    103                  end
    104                  %}}}
    105                  function Download(cluster,md)% {{{1
     87                         disp('launching solution sequence on remote cluster');
     88                         launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     89                                 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     90                         issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     91                 end %}}}
     92                 function Download(cluster,dirname,filelist)% {{{
    10693
    107                         %some check
    108                         if isempty(md.private.runtimename),
    109                                 error('pfe Download error message: supply runtime name for results to be loaded!');
    110                         end
     94                         %copy files from cluster to current directory
     95                         directory=[cluster.executionpath '/' dirname '/'];
     96                         issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    11197
    112                         %Figure out the  directory where all the files are in:
    113                         directory=[cluster.executionpath '/' md.private.runtimename '/'];
    114 
    115                         %What packages are we picking up from remote cluster
    116                         packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
    117                         if md.qmu.isdakota,
    118                                 packages{end+1}=[md.miscellaneous.name '.qmu.err'];
    119                                 packages{end+1}=[md.miscellaneous.name '.qmu.out'];
    120                                 if isfield(md.qmu.params,'tabular_graphics_data'),
    121                                         if md.qmu.params.tabular_graphics_data==true,
    122                                                 packages{end+1}='dakota_tabular.dat';
    123                                         end
    124                                 end
    125                         else
    126                                 packages{end+1}=[md.miscellaneous.name '.outbin'];
    127                         end
    128 
    129                         %copy files from cluster to present directory
    130                         issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
    131                 end %}}}
     98                 end %}}}
    13299        end
    133100end
  • issm/branches/trunk-jpl-damage/src/m/classes/constants.m

    r12004 r12878  
    3131
    3232                end % }}}
    33                 function flag = checkconsistency(obj,md,solution,analyses) % {{{
     33                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3434
    35                         checkfield(md,'constants.g','>',0,'size',[1 1]);
    36                         checkfield(md,'constants.yts','>',0,'size',[1 1]);
    37                         checkfield(md,'constants.referencetemperature','size',[1 1]);
     35                        md = checkfield(md,'constants.g','>',0,'size',[1 1]);
     36                        md = checkfield(md,'constants.yts','>',0,'size',[1 1]);
     37                        md = checkfield(md,'constants.referencetemperature','size',[1 1]);
    3838
    3939                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/debug.m

    r12004 r12878  
    88                valgrind = false;
    99                gprof    = false;
    10                 petsc_profiling = false;
     10                profiling = false;
    1111        end
    1212        methods
     
    2727                        fielddisplay(obj,'valgrind','use Valgrind to debug (0 or 1)');
    2828                        fielddisplay(obj,'gprof','use gnu-profiler to find out where the time is spent');
    29                         fielddisplay(obj,'petsc_profiling','enables PETSc profiling (memory, flops, time)');
     29                        fielddisplay(obj,'profiling','enables profiling (memory, flops, time)');
    3030
    3131                end % }}}
    3232                function marshall(obj,fid) % {{{
    33                         WriteData(fid,'object',obj,'fieldname','petsc_profiling','format','Boolean');
     33                        WriteData(fid,'object',obj,'fieldname','profiling','format','Boolean');
    3434                end % }}}
    3535        end
  • issm/branches/trunk-jpl-damage/src/m/classes/diagnostic.m

    r12168 r12878  
    6464
    6565                end % }}}
    66                 function checkconsistency(obj,md,solution,analyses) % {{{
     66                function md = checkconsistency(obj,md,solution,analyses) % {{{
    6767
    6868                        %Early return
     
    7070                        %if ~ismember(DiagnosticHorizAnalysisEnum,analyses) |  (solution==TransientSolutionEnum & md.transient.isdiagnostic==0), return; end
    7171
    72                         checkfield(md,'diagnostic.spcvx','forcing',1);
    73                         checkfield(md,'diagnostic.spcvy','forcing',1);
    74                         if md.mesh.dimension==3, checkfield(md,'diagnostic.spcvz','forcing',1); end
    75                         checkfield(md,'diagnostic.restol','size',[1 1],'>',0);
    76                         checkfield(md,'diagnostic.reltol','size',[1 1]);
    77                         checkfield(md,'diagnostic.abstol','size',[1 1]);
    78                         checkfield(md,'diagnostic.isnewton','numel',1,'values',[0 1]);
    79                         checkfield(md,'diagnostic.stokesreconditioning','size',[1 1],'NaN',1);
    80                         checkfield(md,'diagnostic.viscosity_overshoot','size',[1 1],'NaN',1);
     72                        md = checkfield(md,'diagnostic.spcvx','forcing',1);
     73                        md = checkfield(md,'diagnostic.spcvy','forcing',1);
     74                        if md.mesh.dimension==3, md = checkfield(md,'diagnostic.spcvz','forcing',1); end
     75                        md = checkfield(md,'diagnostic.restol','size',[1 1],'>',0);
     76                        md = checkfield(md,'diagnostic.reltol','size',[1 1]);
     77                        md = checkfield(md,'diagnostic.abstol','size',[1 1]);
     78                        md = checkfield(md,'diagnostic.isnewton','numel',1,'values',[0 1]);
     79                        md = checkfield(md,'diagnostic.stokesreconditioning','size',[1 1],'NaN',1);
     80                        md = checkfield(md,'diagnostic.viscosity_overshoot','size',[1 1],'NaN',1);
    8181                        if md.mesh.dimension==2,
    82                                 checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
     82                                md = checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
    8383                        else
    84                                 checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1);
     84                                md = checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1);
    8585                        end
    86                         checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
    87                         checkfield(md,'diagnostic.maxiter','size',[1 1],'>=',1);
    88                         checkfield(md,'diagnostic.referential','size',[md.mesh.numberofvertices 6]);
     86                        md = checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
     87                        md = checkfield(md,'diagnostic.maxiter','size',[1 1],'>=',1);
     88                        md = checkfield(md,'diagnostic.referential','size',[md.mesh.numberofvertices 6]);
    8989                        if ~isempty(md.diagnostic.requested_outputs),
    90                                 checkfield(md,'diagnostic.requested_outputs','size',[NaN 1]);
     90                                md = checkfield(md,'diagnostic.requested_outputs','size',[NaN 1]);
    9191                        end
    9292
    9393                        %singular solution
    9494                        if ~any((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy))==2),
    95                                 checkmessage(['model ' md.miscellaneous.name ' is not well posed (singular). You need at least one node with fixed velocity!'])
     95                                md = checkmessage(md,['model is not well posed (singular). You need at least one node with fixed velocity!']);
    9696                        end
    9797                        %CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
    9898                        if any(sum(isnan(md.diagnostic.referential),2)~=0 & sum(isnan(md.diagnostic.referential),2)~=6),
    99                                 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. Each line of diagnostic.referential should contain either only NaN values or no NaN values']);
     99                                md = checkmessage(md,['Each line of diagnostic.referential should contain either only NaN values or no NaN values']);
    100100                        end
    101101                        %CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
     
    103103                                pos=find(sum(isnan(md.diagnostic.referential),2)==0);
    104104                                if any(abs(dot(md.diagnostic.referential(pos,1:3)',md.diagnostic.referential(pos,4:6)'))>eps),
    105                                         checkmessage(['model ' md.miscellaneous.name ' has problem with referential. Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']);
     105                                        md = checkmessage(md,['Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']);
    106106                                end
    107107                        end
     
    110110                                pos=find(md.mask.vertexongroundedice & md.mesh.vertexonbed);
    111111                                if any(~isnan(md.diagnostic.referential(pos,:))),
    112                                         checkmessage(['no referential should be specified for basal vertices of grounded ice']);
     112                                        md = checkmessage(md,['no referential should be specified for basal vertices of grounded ice']);
    113113                                end
    114114                        end
  • issm/branches/trunk-jpl-damage/src/m/classes/flaim.m

    r12004 r12878  
    3232
    3333                end % }}}
    34                 function checkconsistency(obj,md,solution,analyses) % {{{
     34                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3535
    3636                        %Early return
    3737                        if solution~=FlaimSolutionEnum, return; end
    3838
    39                         checkfield(md,'flaim.tracks','file',1);
     39                        md = checkfield(md,'flaim.tracks','file',1);
    4040                        if any(isnan(md.flaim.criterion)) || isempty(md.flaim.criterion)
    41                                 checkfield(md,'flaim.targets','file',1);
     41                                md = checkfield(md,'flaim.targets','file',1);
    4242                        else
    43                                 checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]);
     43                                md = checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]);
    4444                        end
    4545
  • issm/branches/trunk-jpl-damage/src/m/classes/flowequation.m

    r12004 r12878  
    2727
    2828                end % }}}
    29                 function checkconsistency(obj,md,solution,analyses) % {{{
     29                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3030
    3131                        if ismember(DiagnosticHorizAnalysisEnum,analyses),
    3232
    33                                 checkfield(md,'flowequation.ismacayealpattyn','numel',1,'values',[0 1]);
    34                                 checkfield(md,'flowequation.ishutter','numel',1,'values',[0 1]);
    35                                 checkfield(md,'flowequation.isstokes','numel',1,'values',[0 1]);
    36                                 checkfield(md,'flowequation.bordermacayeal','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    37                                 checkfield(md,'flowequation.borderpattyn','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    38                                 checkfield(md,'flowequation.borderstokes','size',[md.mesh.numberofvertices 1],'values',[0 1]);
     33                                md = checkfield(md,'flowequation.ismacayealpattyn','numel',1,'values',[0 1]);
     34                                md = checkfield(md,'flowequation.ishutter','numel',1,'values',[0 1]);
     35                                md = checkfield(md,'flowequation.isstokes','numel',1,'values',[0 1]);
     36                                md = checkfield(md,'flowequation.bordermacayeal','size',[md.mesh.numberofvertices 1],'values',[0 1]);
     37                                md = checkfield(md,'flowequation.borderpattyn','size',[md.mesh.numberofvertices 1],'values',[0 1]);
     38                                md = checkfield(md,'flowequation.borderstokes','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    3939                                if (md.mesh.dimension==2),
    40                                         checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
    41                                         checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
     40                                        md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
     41                                        md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
    4242                                else
    43                                         checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:7]);
    44                                         checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:7]);
     43                                        md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:7]);
     44                                        md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:7]);
    4545                                end
    4646                                if (md.flowequation.ismacayealpattyn==0 && md.flowequation.ishutter==0 && md.flowequation.isstokes==0),
    47                                         checkmessage(['no element types set for this model. At least one of ismacayealpattyn, ishutter or isstokes need to be =1']);
     47                                        md = checkmessage(md,['no element types set for this model. At least one of ismacayealpattyn, ishutter or isstokes need to be =1']);
    4848                                end
    4949                        end
    5050                        if ismember(DiagnosticHutterAnalysisEnum,analyses),
    51                                 if any(md.flowequation.element_equation==1 & md.mask.elementonfloatingice),
    52                                         disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));
     51                                if any(md.flowequation.element_equation==1),
     52                                        if(md.flowequation.element_equation & md.mask.elementonfloatingice),
     53                                                disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));
     54                                        end
    5355                                end
    5456                        end
  • issm/branches/trunk-jpl-damage/src/m/classes/friction.m

    r12004 r12878  
    2222
    2323                end % }}}
    24                 function checkconsistency(obj,md,solution,analyses) % {{{
     24                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2525
    2626                        %Early return
    2727                        if ~ismember(DiagnosticHorizAnalysisEnum,analyses) & ~ismember(ThermalAnalysisEnum,analyses), return; end
    2828
    29                         checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);
    30                         checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
    31                         checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
     29                        md = checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);
     30                        md = checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
     31                        md = checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
    3232                end % }}}
    3333                function disp(obj) % {{{
  • issm/branches/trunk-jpl-damage/src/m/classes/geometry.m

    r12004 r12878  
    2424
    2525                end % }}}
    26                 function checkconsistency(obj,md,solution,analyses) % {{{
     26                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2727
    28                         checkfield(md,'geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
    29                         checkfield(md,'geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
    30                         checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
     28                        md = checkfield(md,'geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
     29                        md = checkfield(md,'geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
     30                        md = checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
    3131                        if any((obj.thickness-obj.surface+obj.bed)>10^-9),
    32                                 checkmessage(['equality thickness=surface-bed violated']);
     32                                md = checkmessage(md,['equality thickness=surface-bed violated']);
    3333                        end
    3434                        if solution==TransientSolutionEnum & md.transient.isgroundingline,
    35                                 checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
     35                                md = checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
    3636                        end
    3737                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/groundingline.m

    r12168 r12878  
    2828
    2929                end % }}}
    30                 function checkconsistency(obj,md,solution,analyses) % {{{
     30                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3131
    32                         checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'});
     32                        md = checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'});
    3333
    3434                        if ~strcmp(obj.migration,'None'),
    3535                                if isnan(md.geometry.bathymetry),
    36                                         checkmessage(['requesting grounding line migration, but bathymetry is absent!']);
     36                                        md = checkmessage(md,['requesting grounding line migration, but bathymetry is absent!']);
    3737                                end
    3838                                pos=find(md.mask.vertexongroundedice);
    3939                                if any(abs(md.geometry.bed(pos)-md.geometry.bathymetry(pos))>10^-10),
    40                                         checkmessage(['bathymetry not equal to bed on grounded ice !']);
     40                                        md = checkmessage(md,['bathymetry not equal to bed on grounded ice !']);
    4141                                end
    4242                                pos=find(md.mask.vertexonfloatingice);
    4343                                if any(md.geometry.bathymetry(pos)-md.geometry.bed(pos)>10^-9),
    44                                         checkmessage(['bathymetry superior to bed on floating ice !']);
     44                                        md = checkmessage(md,['bathymetry superior to bed on floating ice !']);
    4545                                end
    4646                        end
  • issm/branches/trunk-jpl-damage/src/m/classes/hydrology.m

    r12004 r12878  
    3535                        obj.stabilization=1;
    3636                end % }}}
    37                 function checkconsistency(obj,md,solution,analyses) % {{{
     37                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3838
    3939                        %Early return
    4040                        if ~ismember(HydrologyAnalysisEnum,analyses), return; end
    4141
    42                         checkfield(md,'hydrology.spcwatercolumn','forcing',1);
    43                         checkfield(md,'hydrology.stabilization','>=',0);
     42                        md = checkfield(md,'hydrology.spcwatercolumn','forcing',1);
     43                        md = checkfield(md,'hydrology.stabilization','>=',0);
    4444                end % }}}
    4545                function disp(obj) % {{{
  • issm/branches/trunk-jpl-damage/src/m/classes/initialization.m

    r12004 r12878  
    2727
    2828                end % }}}
    29                 function checkconsistency(obj,md,solution,analyses) % {{{
     29                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3030                        if ismember(DiagnosticHorizAnalysisEnum,analyses)
    3131                                if ~isnan(md.initialization.vx) & ~isnan(md.initialization.vy),
    32                                         checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
    33                                         checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
     32                                        md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
     33                                        md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
    3434                                end
    3535                        end
    3636                        if ismember(PrognosticAnalysisEnum,analyses),
    37                                 checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
    38                                 checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
     37                                md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
     38                                md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
    3939                        end
    4040                        if ismember(HydrologyAnalysisEnum,analyses),
    41                                 checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);
     41                                md = checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);
    4242                        end
    4343                        if ismember(BalancethicknessAnalysisEnum,analyses),
    44                                 checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
    45                                 checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
     44                                md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
     45                                md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
    4646                                %Triangle with zero velocity
    4747                                if any(sum(abs(md.initialization.vx(md.mesh.elements)),2)==0 & sum(abs(md.initialization.vy(md.mesh.elements)),2)==0)
    48                                         checkmessage('at least one triangle has all its vertices with a zero velocity');
     48                                        md = checkmessage(md,'at least one triangle has all its vertices with a zero velocity');
    4949                                end
    5050                        end
    5151                        if ismember(ThermalAnalysisEnum,analyses),
    52                                 checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
    53                                 checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
    54                                 checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
    55                                 checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
     52                                md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
     53                                md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
     54                                md = checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
     55                                md = checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
    5656                        end
    57                         if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy),
    58                                 checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);
     57                        if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy) | solution==EnthalpySolutionEnum,
     58                                md = checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);
    5959                        end
    6060                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/inversion.m

    r12872 r12878  
    7575
    7676                end % }}}
    77                 function checkconsistency(obj,md,solution,analyses) % {{{
     77                function md = checkconsistency(obj,md,solution,analyses) % {{{
    7878
    7979                        %Early return
     
    9898
    9999                        if solution==BalancethicknessSolutionEnum
    100                                 checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
     100                                md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
    101101                        else
    102                                 checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
    103                                 checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
     102                                md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
     103                                md = checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
    104104                        end
    105105                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/mask.m

    r12004 r12878  
    2525
    2626                end % }}}
    27                 function checkconsistency(obj,md,solution,analyses) % {{{
     27                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2828
    29                         checkfield(md,'mask.elementonfloatingice','size',[md.mesh.numberofelements 1],'values',[0 1]);
    30                         checkfield(md,'mask.elementongroundedice','size',[md.mesh.numberofelements 1],'values',[0 1]);
    31                         checkfield(md,'mask.elementonwater'      ,'size',[md.mesh.numberofelements 1],'values',[0 1]);
    32                         checkfield(md,'mask.vertexonfloatingice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    33                         checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    34                         checkfield(md,'mask.vertexonwater'      ,'size',[md.mesh.numberofvertices 1],'values',[0 1]);
     29                        md = checkfield(md,'mask.elementonfloatingice','size',[md.mesh.numberofelements 1],'values',[0 1]);
     30                        md = checkfield(md,'mask.elementongroundedice','size',[md.mesh.numberofelements 1],'values',[0 1]);
     31                        md = checkfield(md,'mask.elementonwater'      ,'size',[md.mesh.numberofelements 1],'values',[0 1]);
     32                        md = checkfield(md,'mask.vertexonfloatingice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
     33                        md = checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
     34                        md = checkfield(md,'mask.vertexonwater'      ,'size',[md.mesh.numberofvertices 1],'values',[0 1]);
    3535                end % }}}
    3636                function disp(obj) % {{{
  • issm/branches/trunk-jpl-damage/src/m/classes/materials.m

    r12004 r12878  
    88                rho_ice                    = 0;
    99                rho_water                  = 0;
     10                rho_freshwater             = 0;
    1011                mu_water                   = 0;
    1112                heatcapacity               = 0;
     
    3536                        obj.rho_ice=917;
    3637
    37                         %water density (kg/m^3)
     38                        %ocean water density (kg/m^3)
    3839                        obj.rho_water=1023;
     40
     41                        %fresh water density (kg/m^3)
     42                        obj.rho_freshwater=1000;
    3943
    4044                        %water viscosity (N.s/m^2)
     
    6670                        obj.rheology_law='Paterson';
    6771                end % }}}
    68                 function checkconsistency(obj,md,solution,analyses) % {{{
    69                         checkfield(md,'materials.rho_ice','>',0);
    70                         checkfield(md,'materials.rho_water','>',0);
    71                         checkfield(md,'materials.mu_water','>',0);
    72                         checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
    73                         checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
    74                         checkfield(md,'materials.rheology_Z','>',0,'size',[md.mesh.numberofvertices 1]);
    75                         checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius'});
     72                function md = checkconsistency(obj,md,solution,analyses) % {{{
     73                        md = checkfield(md,'materials.rho_ice','>',0);
     74                        md = checkfield(md,'materials.rho_water','>',0);
     75                        md = checkfield(md,'materials.rho_freshwater','>',0);
     76                        md = checkfield(md,'materials.mu_water','>',0);
     77                        md = checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
     78                        md = checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
     79                        md = checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius'});
    7680                end % }}}
    7781                function disp(obj) % {{{
     
    7983
    8084                        fielddisplay(obj,'rho_ice','ice density [kg/m^3]');
    81                         fielddisplay(obj,'rho_water','water density [kg/m^3]');
     85                        fielddisplay(obj,'rho_water','ocean water density [kg/m^3]');
     86                        fielddisplay(obj,'rho_freshwater','fresh water density [kg/m^3]');
    8287                        fielddisplay(obj,'mu_water','water viscosity [N s/m^2]');
    8388                        fielddisplay(obj,'heatcapacity','heat capacity [J/kg/K]');
     
    96101                        WriteData(fid,'object',obj,'fieldname','rho_ice','format','Double');
    97102                        WriteData(fid,'object',obj,'fieldname','rho_water','format','Double');
     103                        WriteData(fid,'object',obj,'fieldname','rho_freshwater','format','Double');
    98104                        WriteData(fid,'object',obj,'fieldname','mu_water','format','Double');
    99105                        WriteData(fid,'object',obj,'fieldname','heatcapacity','format','Double');
  • issm/branches/trunk-jpl-damage/src/m/classes/mesh.m

    r12004 r12878  
    6464                        obj.average_vertex_connectivity=25;
    6565                end % }}}
    66                 function checkconsistency(obj,md,solution,analyses) % {{{
     66                function md = checkconsistency(obj,md,solution,analyses) % {{{
    6767
    68                         checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
    69                         checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
    70                         checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
    71                         checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
     68                        md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
     69                        md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
     70                        md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
     71                        md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
    7272                        if(md.mesh.dimension==2),
    73                                 checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
     73                                md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
    7474                        else
    75                                 checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]);
     75                                md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]);
    7676                        end
    7777                        if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
    78                                 checkmessage('orphan nodes have been found. Check the mesh outline');
     78                                md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
    7979                        end
    80                         checkfield(md,'mesh.dimension','values',[2 3]);
    81                         checkfield(md,'mesh.numberoflayers','>=',0);
    82                         checkfield(md,'mesh.numberofelements','>',0);
    83                         checkfield(md,'mesh.numberofvertices','>',0);
     80                        md = checkfield(md,'mesh.dimension','values',[2 3]);
     81                        md = checkfield(md,'mesh.numberoflayers','>=',0);
     82                        md = checkfield(md,'mesh.numberofelements','>',0);
     83                        md = checkfield(md,'mesh.numberofvertices','>',0);
    8484                        %no checks for numberofedges lat long and hemisphere
    85                         checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
    86                         checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
    87                         checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    88                         checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
     85                        md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
     86                        md = checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
     87                        md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
     88                        md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    8989                        if (md.mesh.dimension==2),
    90                                 checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
     90                                md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
    9191                        else
    92                                 checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
     92                                md = checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
    9393                        end
    94                         checkfield(md,'mesh.elementconnectivity','size',[md.mesh.numberofelements 3],'NaN',1);
     94                        md = checkfield(md,'mesh.elementconnectivity','size',[md.mesh.numberofelements 3],'NaN',1);
    9595
    9696                        %Solution specific checks
     
    9898                                case PrognosticSolutionEnum,
    9999                                        if md.prognostic.stabilization==3,
    100                                                 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
    101                                                 checkfield(md,'mesh.edges','size',[NaN 4]);
    102                                                 checkfield(md,'mesh.edges(:,1:3)','>',0);
     100                                                md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
     101                                                md = checkfield(md,'mesh.edges','size',[NaN 4]);
     102                                                md = checkfield(md,'mesh.edges(:,1:3)','>',0);
    103103                                        end
    104104                                case BalancethicknessSolutionEnum,
    105105                                        if md.balancethickness.stabilization==3,
    106                                                 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
    107                                                 checkfield(md,'mesh.edges','size',[NaN 4]);
    108                                                 checkfield(md,'mesh.edges(:,1:3)','>',0);
     106                                                md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
     107                                                md = checkfield(md,'mesh.edges','size',[NaN 4]);
     108                                                md = checkfield(md,'mesh.edges(:,1:3)','>',0);
    109109                                        end
    110110                                case TransientSolutionEnum,
    111111                                        if md.transient.isprognostic & md.prognostic.stabilization==3,
    112                                                 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
    113                                                 checkfield(md,'mesh.edges','size',[NaN 4]);
    114                                                 checkfield(md,'mesh.edges(:,1:3)','>',0);
     112                                                md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
     113                                                md = checkfield(md,'mesh.edges','size',[NaN 4]);
     114                                                md = checkfield(md,'mesh.edges(:,1:3)','>',0);
    115115                                        end
    116116                                case ThermalSolutionEnum,
    117                                         checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');
     117                                        md = checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');
    118118                        end
    119119                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/miscellaneous.m

    r12004 r12878  
    1919                        end
    2020                end % }}}
    21                 function checkconsistency(obj,md,solution,analyses) % {{{
     21                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2222
    23                         checkfield(md,'miscellaneous.name','empty',1);
     23                        md = checkfield(md,'miscellaneous.name','empty',1);
    2424
    2525                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/model/model.m

    r12872 r12878  
    66classdef model
    77    properties (SetAccess=public) %Model fields
    8                  % {{{1
     8                 % {{{
    99                 %Careful here: no other class should be used as default value this is a bug of matlab
    1010                 mesh             = 0;
     
    7575         end
    7676         methods
    77                  function md = model(varargin) % {{{1
     77                 function md = model(varargin) % {{{
    7878
    7979                         switch nargin
     
    8383                                         error('model constructor error message: 0 of 1 argument only in input.');
    8484                                 end
     85                 end
     86                 %}}}
     87                 function md = checkmessage(md,string) % {{{
     88                         if(nargout~=1) error('wrong usage, model must be an output'); end
     89                         disp(['model not consistent: ' string]);
     90                         md.private.isconsistent=false;
    8591                 end
    8692                 %}}}
     
    244250                         if isfield(structmd,'pressureload'), md.diagnostic.icefront=structmd.pressureload; end
    245251                         if isfield(structmd,'diagnostic_ref'), md.diagnostic.referential=structmd.diagnostic_ref; end
    246 
    247 
     252                         if isfield(structmd,'npart'); md.qmu.numberofpartitions=structmd.npart; end
     253                         if isfield(structmd,'part'); md.qmu.partition=structmd.part; end
     254                                 
    248255                         %Field changes
    249256                         if (isfield(structmd,'type') & ischar(structmd.type)),
     
    352359                                 md.mesh.lowerelements(1:md.mesh.numberofelements2d)=NaN;
    353360                         end
     361                                 
    354362                         if ~isfield(structmd,'diagnostic_ref');
    355363                                 md.diagnostic.referential=NaN*ones(md.mesh.numberofvertices,6);
    356364                         end
     365
    357366                 end% }}}
    358                  function md = setdefaultparameters(md) % {{{1
     367                 function md = setdefaultparameters(md) % {{{
    359368
    360369                         %initialize subclasses
  • issm/branches/trunk-jpl-damage/src/m/classes/model/planet.m

    r9548 r12878  
    66classdef planet < model
    77    properties (SetAccess=public) %Planet fields
    8                  % {{{1
     8                 % {{{
    99                 %Planet specific fields
    1010                 r=NaN;
     
    1414         end
    1515         methods
    16                 function md=planetmesh(md,varargin) % {{{1
     16                function md=planetmesh(md,varargin) % {{{
    1717                %PLANETMESH: build 2d shell mesh
    1818                %
  • issm/branches/trunk-jpl-damage/src/m/classes/organizer.m

    r9423 r12878  
    1616classdef organizer
    1717    properties (SetAccess=private)
    18                  % {{{1
     18                 % {{{
    1919                 currentstep   =0;
    2020         end
     
    2828         end
    2929         methods
    30                  function org=organizer(varargin) % {{{1
     30                 function org=organizer(varargin) % {{{
    3131
    3232                         %process options
     
    5757                 end
    5858                 %}}}
    59                  function disp(org) % {{{1
     59                 function disp(org) % {{{
    6060                         disp(sprintf('   Repository: ''%s''',org.repository));
    6161                         disp(sprintf('   Prefix:     ''%s''',org.prefix));
     
    6969                 end
    7070                 %}}}
    71                  function md=loadmodel(org,string),% {{{1
     71                 function md=load(org,string),% {{{
     72
     73                         %Get model path
     74                         if ~ischar(string), error('argument provided is not a string'); end
     75                         path=[org.repository '/' org.prefix string];
     76
     77                         %figure out if the model is there
     78                         if exist(path,'file'),
     79                                 struc=load(path,'-mat');
     80                                 name=char(fieldnames(struc));
     81                                 md=struc.(name);
     82                                 if nargout,
     83                                         varargout{1}=md;
     84                                 end
     85                         else
     86                                 error(['Could not find ' path ]);
     87                         end
     88                 end%}}}
     89                 function md=loadmodel(org,string),% {{{
    7290
    7391                         %Get model path
     
    7694
    7795                         %figure out if the model is there, otherwise, we have to use the default path supplied by user.
    78                          if exist(path,'file'),
     96                         if exist(path,'file') | exist([path '.mat'],'file'),
    7997                                 md=loadmodel(path);
    8098                                 return;
     
    95113                         end
    96114                 end%}}}
    97                  function bool=perform(org,string) % {{{1
     115                 function bool=perform(org,string) % {{{
    98116                         
    99117                         bool=false;
     
    129147
    130148                 end%}}}
    131                  function savemodel(org,md) % {{{1
     149                 function savemodel(org,md) % {{{
    132150
    133151                         %check
     
    139157                         
    140158                         %check that md is a model
    141                          if ~isa(md,'model'),       error('savemodel error message: third argument is not a model'); end
     159                         if ~isa(md,'model'), warning('third argument is not a model'); end
    142160                         if (org.currentstep>length(org.steps)), error(['organizer error message: element with id ' num2str(org.currentstep) ' not found']); end
    143161
  • issm/branches/trunk-jpl-damage/src/m/classes/pairoptions.m

    r12004 r12878  
    223223                        end
    224224                end % }}}
     225                function marshall(obj,fid,firstindex)% {{{
     226
     227                        for i=1:size(obj.list,1),
     228                                name  = obj.list{i,1};
     229                                value = obj.list{i,2};
     230
     231                                %Write option name
     232                                WriteData(fid,'enum',(firstindex-1)+2*i-1,'data',name,'format','String');
     233
     234                                %Write option value
     235                                if (isnumeric(value) & numel(value)==1),
     236                                        WriteData(fid,'enum',(firstindex-1)+2*i,'data',value,'format','Double');
     237                                elseif ischar(value),
     238                                        WriteData(fid,'enum',(firstindex-1)+2*i,'data',value,'format','String');
     239                                else
     240                                        error(['Cannot marshall option ' name ': format not supported yet']);
     241                                end
     242                        end
     243                end % }}}
    225244        end
    226245end
  • issm/branches/trunk-jpl-damage/src/m/classes/pairoptions.py

    r12168 r12878  
    1 class pairoptions:
    2         #properties
    3         def __init__(self,*args):
    4                 # {{{ Properties
    5                 if len(args)%2==1:
    6                         raise RuntimeError('pairoption error message: an even number of options is required')
    7 
    8                 #create a pairoption object
    9                 if len(args)==0:
    10                         self.list=[]
    11                 else:
    12                         self.list=[]
    13                         for i in range(int(round(len(args)/2))):
    14                                 if isinstance(args[2*i],str):
    15                                         self.list.append([args[2*i],args[2*i+1]])
     1from WriteData import *
     2
     3class pairoptions(object):
     4        """
     5        PAIROPTIONS class definition
     6 
     7            Usage:
     8               pairoptions=pairoptions();
     9               pairoptions=pairoptions('module',true,'solver',false);
     10        """
     11
     12        def __init__(self,*arg):
     13                self.functionname = ''
     14                self.list         = {}
     15
     16                #get calling function name
     17                import inspect
     18                if len(inspect.stack()) > 1:
     19                        self.functionname=inspect.stack()[1][3]
     20
     21                #initialize list
     22                if not len(arg):
     23                        pass    #Do nothing,
     24                else:
     25                        self.buildlist(*arg)
     26        # }}}
     27
     28        def buildlist(self,*arg):    # {{{
     29                """BUILDLIST - build list of objects from input"""
     30
     31                #check length of input
     32                if len(arg) % 2:
     33                        raise TypeError('error: an even number of options is required')
     34                numoptions = len(arg)/2
     35
     36                #go through arg and build list of objects
     37                for i in xrange(numoptions):
     38                        if isinstance(arg[2*i],str):
     39                                self.list[arg[2*i]] = arg[2*i+1];
     40                        else:
     41                                #option is not a string, ignore it
     42                                print "WARNING: option number %d '%s' is not a string and will be ignored." % (i+1,type(arg[2*i]))
     43        # }}}
     44
     45        def addfield(self,field,value):    # {{{
     46                """ADDFIELD - add a field to an options list"""
     47                if isinstance(field,str):
     48                        if field in self.list:
     49                                print "WARNING: field '%s' with value=%s exists and will be overwritten with value=%s." % (field,str(self.list[field]),str(value))
     50                        self.list[field] = value
     51        # }}}
     52
     53        def addfielddefault(self,field,value):    # {{{
     54                """ADDFIELDDEFAULT - add a field to an options list if it does not exist"""
     55                if isinstance(field,str):
     56                        if not field in self.list:
     57                                self.list[field] = value
     58        # }}}
     59
     60        def AssignObjectFields(self,obj2):    # {{{
     61                """ASSIGNOBJECTFIELDS - assign object fields from options"""
     62                for item in self.list.iteritems():
     63                        if item[0] in dir(obj2):
     64                                setattr(obj2,item[0],item[1])
     65                        else:
     66                                print "WARNING: field '%s' is not a property of '%s'." % (item[0],type(obj2))
     67                return obj2
     68        # }}}
     69
     70        def changefieldvalue(self,field,newvalue):    # {{{
     71                """CHANGEOPTIONVALUE - change the value of an option in an option list"""
     72
     73                self.list[field]=newvalue;
     74        # }}}
     75
     76#       function obj = deleteduplicates(obj,warn) % {{{
     77#       %DELETEDUPLICATES - delete duplicates in an option list
     78#
     79#               %track the first occurance of each option
     80#               [dummy lines]=unique(obj.list(:,1),'first');
     81#               clear dummy
     82#
     83#               %warn user if requested
     84#               if warn,
     85#                       numoptions=size(obj.list,1);
     86#                       for i=1:numoptions,
     87#                               if ~ismember(i,lines),
     88#                                       disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurence will be kept'])
     89#                               end
     90#                       end
     91#               end
     92#
     93#               %remove duplicates from the options list
     94#               obj.list=obj.list(lines,:);
     95#       end % }}}
     96
     97        def __repr__(self):    # {{{
     98                s="   functionname: '%s'\n" % self.functionname
     99                if self.list:
     100                        s+="   list: (%ix%i)\n\n" % (len(self.list),2)
     101                        for item in self.list.iteritems():
     102                                if   isinstance(item[1],str):
     103                                        s+="     field: %-10s value: '%s'\n" % (item[0],item[1])
     104                                elif isinstance(item[1],(bool,int,long,float)):
     105                                        s+="     field: %-10s value: %g\n" % (item[0],item[1])
    16106                                else:
    17                                         #option is not a string, ignore it
    18                                         print("%s%i%s"%('buildlist info: option number ',i,' is not a string, it will be ignored'))
    19                                         continue
    20 
    21                 #}}}
    22         def __repr__(obj):
    23                 # {{{ Display
    24                 if not obj.list:
    25                         string='   list: empty'
    26                 else:
    27                         string="   list: (%i)"%(len(obj.list))
    28                         for i in range(len(obj.list)):
    29                                 if isinstance(obj.list[i][1],str):
    30                                         string2="     field: %-10s value: '%s'"%(obj.list[i][0],obj.list[i][1])
    31                                 elif isinstance(obj.list[i][1],float):
    32                                         string2="     field: %-10s value: %g"%(obj.list[i][0],obj.list[i][1])
    33                                 elif isinstance(obj.list[i][1],int):
    34                                         string2="     field: %-10s value: %i"%(obj.list[i][0],obj.list[i][1])
    35                                 else:
    36                                         string2="     field: %-10s value: (%i)"%(len(obj.list[i][1]))
    37                                 string="%s\n%s"%(string,string2)
    38                 return string
     107                                        s+="     field: %-10s value: %s\n" % (item[0],type(item[1]))
     108                else:
     109                        s+="   list: empty\n"
     110                return s
     111        # }}}
     112
     113        def exist(self,field):    # {{{
     114                """EXIST - check if the option exist"""
     115
     116                #some argument checking:
     117                if field == None or field == '':
     118                        raise ValueError('exist error message: bad usage');
     119                if not isinstance(field,str):
     120                        raise TypeError("exist error message: field '%s' should be a string." % str(field));
     121
     122                #Recover option
     123                if field in self.list:
     124                        return True
     125                else:
     126                        return False
     127        # }}}
     128
     129#       function num = fieldoccurences(obj,field), % {{{
     130#       %FIELDOCCURENCES - get number of occurence of a field
     131#
     132#               %check input
     133#               if ~ischar(field),
     134#                       error('fieldoccurences error message: field should be a string');
     135#               end
     136#
     137#               %get number of occurence
     138#               num=sum(strcmpi(field,obj.list(:,1)));
     139#       end % }}}
     140
     141        def getfieldvalue(self,field,default=None):    # {{{
     142                """
     143                GETOPTION - get the value of an option
     144       
     145                Usage:
     146                   value=options.getfieldvalue(field,default)
     147         
     148                Find an option value from a field. A default option
     149                can be given in input if the field does not exist
     150         
     151                Examples:
     152                   value=options.getfieldvalue(options,'caxis')
     153                   value=options.getfieldvalue(options,'caxis',[0 2])
     154                """
     155
     156                #some argument checking:
     157                if field == None or field == '':
     158                        raise ValueError('getfieldvalue error message: bad usage');
     159                if not isinstance(field,str):
     160                        raise TypeError("getfieldvalue error message: field '%s' should be a string." % str(field));
     161
     162                #Recover option
     163                if field in self.list:
     164                        value=self.list[field]
     165                else:
     166                        if not default == None:
     167                                value=default
     168                        else:
     169                                raise KeyError("error message: field '%s' has not been provided by user (and no default value has been specified)." % field)
     170
     171                return value
     172        # }}}
     173
     174        def removefield(self,field,warn):    # {{{
     175                """
     176                REMOVEFIELD - delete a field in an option list
     177         
     178                Usage:
     179                   obj=removefield(self,field,warn)
     180         
     181                if warn==1 display an info message to warn user that
     182                some of his options have been removed.
     183                """
     184
     185                #check if field exist
     186                if field in self.list:
     187
     188                        #remove duplicates from the options list
     189                        del self.list[field]
     190
     191                        #warn user if requested
     192                        if warn:
     193                                print "removefield info: option '%s' has been removed from the list of options." % field
     194        # }}}
     195
     196        def marshall(self,fid,firstindex):    # {{{
     197
     198                for i,item in enumerate(self.list.iteritems()):
     199                        name  = item[0]
     200                        value = item[1]
     201
     202                        #Write option name
     203                        WriteData(fid,'enum',(firstindex-1)+2*i+1,'data',name,'format','String')
     204
     205                        #Write option value
     206                        if   isinstance(value,str):
     207                                WriteData(fid,'enum',(firstindex-1)+2*i+2,'data',value,'format','String')
     208                        elif isinstance(value,(bool,int,long,float)):
     209                                WriteData(fid,'enum',(firstindex-1)+2*i+2,'data',value,'format','Double')
     210                        else:
     211                                raise TypeError("Cannot marshall option '%s': format not supported yet." % name)
     212        # }}}
     213
  • issm/branches/trunk-jpl-damage/src/m/classes/plotoptions.m

    r12004 r12878  
    66classdef plotoptions
    77    properties (SetAccess=public)
    8                  % {{{1
     8                 % {{{
    99                 numberofplots = 0;
    1010                 figurenumber  = 1;
     
    1313         end
    1414         methods
    15                  function opt=plotoptions(varargin) % {{{1
     15                 function opt=plotoptions(varargin) % {{{
    1616                         opt=buildlist(opt,varargin{:});
    1717                 end
    1818                 %}}}
    19                  function disp(opt) % {{{1
     19                 function disp(opt) % {{{
    2020                         disp(sprintf('\n%s = \n',inputname(1)));
    2121                         disp(sprintf('   numberofplots: %i',opt.numberofplots));
     
    4141                 end
    4242                 %}}}
    43                  function opt=buildlist(opt,varargin) % {{{1
     43                 function opt=buildlist(opt,varargin) % {{{
    4444
    4545                         %check length of input
  • issm/branches/trunk-jpl-damage/src/m/classes/private.m

    r12004 r12878  
    66classdef private
    77        properties (SetAccess=public)
    8                  runtimename = '';
    9                  bamg        = struct();
    10                  solution    = '';
     8                isconsistent = true;
     9                runtimename  = '';
     10                bamg         = struct();
     11                solution     = '';
    1112        end
    1213        methods
     
    2223
    2324                end % }}}
    24                 function checkconsistency(obj,md,solution,analyses) % {{{
     25                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2526
    2627                end % }}}
     
    2829                        disp(sprintf('   private parameters: do not change'));
    2930
     31                        fielddisplay(obj,'isconsistent','is model self consistent');
    3032                        fielddisplay(obj,'runtimename','name of the run launched');
    3133                        fielddisplay(obj,'bamg','structure with mesh properties construced if bamg is used to mesh the domain');
  • issm/branches/trunk-jpl-damage/src/m/classes/prognostic.m

    r12004 r12878  
    3636                        obj.hydrostatic_adjustment='Absolute';
    3737                end % }}}
    38                 function checkconsistency(obj,md,solution,analyses) % {{{
     38                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3939
    4040                        %Early return,
    4141                        if ~ismember(PrognosticAnalysisEnum,analyses) |  (solution==TransientSolutionEnum & md.transient.isprognostic==0), return; end
    4242
    43                         checkfield(md,'prognostic.spcthickness','forcing',1);
    44                         checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
    45                         checkfield(md,'prognostic.stabilization','values',[0 1 2 3]);
    46                         checkfield(md,'prognostic.min_thickness','>',0);
     43                        md = checkfield(md,'prognostic.spcthickness','forcing',1);
     44                        md = checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
     45                        md = checkfield(md,'prognostic.stabilization','values',[0 1 2 3]);
     46                        md = checkfield(md,'prognostic.min_thickness','>',0);
    4747
    4848                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/qmu.m

    r12004 r12878  
    3535       
    3636                end % }}}
    37                 function checkconsistency(obj,md,solution,analyses) % {{{
     37                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3838
    3939                        %Early return
     
    4141
    4242                        if md.qmu.params.evaluation_concurrency~=1,
    43                                 checkmessage(['concurrency should be set to 1 when running dakota in library mode']);
     43                                md = checkmessage(md,['concurrency should be set to 1 when running dakota in library mode']);
    4444                        end
    4545                        if ~isempty(md.qmu.partition),
    4646                                if numel(md.qmu.partition)~=md.mesh.numberofvertices,
    47                                         checkmessage(['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']);
     47                                        md = checkmessage(md,['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']);
    4848                                end
    4949                                if find(md.qmu.partition)>=md.mesh.numberofvertices,
    50                                         checkmessage(['user supplied partition should be indexed from 0 (c-convention)']);
     50                                        md = checkmessage(md,['user supplied partition should be indexed from 0 (c-convention)']);
    5151                                end
    5252                                if min(md.qmu.partition)~=0,
    53                                         checkmessage(['partition vector not indexed from 0 on']);
     53                                        md = checkmessage(md,['partition vector not indexed from 0 on']);
    5454                                end
    5555                                if max(md.qmu.partition)>=md.mesh.numberofvertices,
    56                                         checkmessage(['partition vector cannot have maximum index larger than number of nodes']);
     56                                        md = checkmessage(md,['partition vector cannot have maximum index larger than number of nodes']);
    5757                                end
    5858                                if ~isempty(find(md.qmu.partition<0)),
    59                                         checkmessage(['partition vector cannot have values less than 0']);
     59                                        md = checkmessage(md,['partition vector cannot have values less than 0']);
    6060                                end
    6161                                if ~isempty(find(md.qmu.partition>=md.qmu.numberofpartitions)),
    62                                         checkmessage(['partition vector cannot have values more than md.qmu.numberofpartitions-1']);
     62                                        md = checkmessage(md,['partition vector cannot have values more than md.qmu.numberofpartitions-1']);
    6363                                end
    6464                                if max(md.qmu.partition)>=md.qmu.numberofpartitions,
    65                                         checkmessage(['for qmu analysis, partitioning vector cannot go over npart, number of partition areas']);
     65                                        md = checkmessage(md,['for qmu analysis, partitioning vector cannot go over npart, number of partition areas']);
    6666                                end
    6767                        end
     
    6969                        if ~strcmpi(md.cluster.name,'none'),
    7070                                if md.settings.waitonlock==0,
    71                                         checkmessage(['waitonlock should be activated when running qmu in parallel mode!']);
     71                                        md = checkmessage(md,['waitonlock should be activated when running qmu in parallel mode!']);
    7272                                end
    7373                        end
  • issm/branches/trunk-jpl-damage/src/m/classes/rifts.m

    r12004 r12878  
    2121
    2222                end % }}}
    23                 function checkconsistency(obj,md,solution,analyses) % {{{
     23                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2424                        if isempty(obj.riftstruct) | isnans(obj.riftstruct),
    2525                                numrifts=0;
     
    2929                        if numrifts,
    3030                                if ~(md.mesh.dimension==2),
    31                                         checkmessage(['models with rifts are only supported in 2d for now!']);
     31                                        md = checkmessage(md,['models with rifts are only supported in 2d for now!']);
    3232                                end
    3333                                if ~isstruct(obj.riftstruct),
    34                                         checkmessage(['rifts.riftstruct should be a structure!']);
     34                                        md = checkmessage(md,['rifts.riftstruct should be a structure!']);
    3535                                end
    3636                                if ~isempty(find(md.mesh.segmentmarkers>=2)),
    3737                                        %We have segments with rift markers, but no rift structure!
    38                                         checkmessage(['model should be processed for rifts (run meshprocessrifts)!']);
     38                                        md = checkmessage(md,['model should be processed for rifts (run meshprocessrifts)!']);
    3939                                end
    40                                 checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
     40                                md = checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
    4141                        else
    4242                                if ~isnans(obj.riftstruct),
    43                                         checkmessage(['riftstruct shoud be NaN since numrifts is 0!']);
     43                                        md = checkmessage(md,['riftstruct shoud be NaN since numrifts is 0!']);
    4444                                end
    4545                        end
  • issm/branches/trunk-jpl-damage/src/m/classes/settings.m

    r12004 r12878  
    4141                        obj.waitonlock=Inf;
    4242                end % }}}
    43                 function checkconsistency(obj,md,solution,analyses) % {{{
     43                function md = checkconsistency(obj,md,solution,analyses) % {{{
    4444
    45                         checkfield(md,'settings.io_gather','numel',1,'values',[0 1]);
    46                         checkfield(md,'settings.lowmem','numel',1,'values',[0 1]);
    47                         checkfield(md,'settings.results_as_patches','numel',1,'values',[0 1]);
    48                         checkfield(md,'settings.output_frequency','numel',1,'>=',1);
    49                         checkfield(md,'settings.waitonlock','numel',1);
     45                        md = checkfield(md,'settings.io_gather','numel',1,'values',[0 1]);
     46                        md = checkfield(md,'settings.lowmem','numel',1,'values',[0 1]);
     47                        md = checkfield(md,'settings.results_as_patches','numel',1,'values',[0 1]);
     48                        md = checkfield(md,'settings.output_frequency','numel',1,'>=',1);
     49                        md = checkfield(md,'settings.waitonlock','numel',1);
    5050
    5151                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/solver.m

    r12168 r12878  
    1818                                 end
    1919                         end % }}}
    20                  function obj = addoptions(obj,analysis,varargin) % {{{1
     20                 function obj = addoptions(obj,analysis,varargin) % {{{
    2121                 % Usage example:
    2222                 %    md.solver=addoptions(md.solver,DiagnosticHorizAnalysisEnum,stokesoptions());
     
    5454                         end
    5555                 end % }}}
    56                  function checkconsistency(obj,md,solution,analyses) % {{{
     56                 function md = checkconsistency(obj,md,solution,analyses) % {{{
    5757                         analyses=properties(obj);
    5858                         for i=1:numel(analyses),
    5959                                 if isempty(fieldnames(obj.(analyses{i})))
    60                                          checkmessage(['md.solver.' analyses{i} ' is empty']);
     60                                         md = checkmessage(md,['md.solver.' analyses{i} ' is empty']);
    6161                                 end
    6262                         end
  • issm/branches/trunk-jpl-damage/src/m/classes/steadystate.m

    r12004 r12878  
    2626                        obj.reltol=0.01;
    2727                end % }}}
    28                 function checkconsistency(obj,md,solution,analyses) % {{{
     28                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2929
    3030                        %Early return
     
    3232
    3333                        if md.timestepping.time_step~=0,
    34                                 checkmessage(['for a steadystate computation, timestepping.time_step must be zero.']);
     34                                md = checkmessage(md,['for a steadystate computation, timestepping.time_step must be zero.']);
    3535                        end
    3636
    3737                        if isnan(md.diagnostic.reltol),
    38                                 checkmessage(['for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']);
     38                                md = checkmessage(md,['for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']);
    3939                        end
    4040                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/surfaceforcings.m

    r12004 r12878  
    88                precipitation = NaN;
    99                mass_balance  = NaN;
     10                ispdd = 0;
     11                issmbgradients = 0;
     12                isdelta18o = 0;
     13           hc = NaN;
     14                smb_pos_max = NaN;
     15                smb_pos_min = NaN;
     16                a_pos = NaN;
     17                b_pos = NaN;
     18                a_neg = NaN;
     19                b_neg = NaN;
     20                monthlytemperatures = NaN;
     21                delta18o = NaN;
     22                delta18o_surface = NaN;
     23                temperatures_presentday = NaN;
     24                temperatures_lgm = NaN;
     25                precipitations_presentday = NaN;
    1026        end
    1127        methods
     
    1935                end % }}}
    2036                function obj = setdefaultparameters(obj) % {{{
     37                 
     38                  %pdd method not used in default mode
     39                  obj.ispdd=0;
     40                  obj.issmbgradients=0;
     41                  obj.isdelta18o=0;
    2142
    2243                end % }}}
    23                 function checkconsistency(obj,md,solution,analyses) % {{{
     44                function md = checkconsistency(obj,md,solution,analyses) % {{{
    2445
    2546                        if ismember(PrognosticAnalysisEnum,analyses),
    26                                 checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1);
     47                                md = checkfield(md,'surfaceforcings.ispdd','numel',1,'values',[0 1]);
     48                                checkfield(md,'surfaceforcings.issmbgradients','numel',1,'values',[0 1]);
     49                                if(obj.ispdd)
     50                                        if(obj.isdelta18o==0)
     51                                                md = checkfield(md,'surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
     52                                                md = checkfield(md,'surfaceforcings.precipitation','forcing',1,'NaN',1);
     53                                        else
     54                                                md = checkfield(md,'surfaceforcings.delta18o','NaN',1);
     55                                                md = checkfield(md,'surfaceforcings.delta18o_surface','NaN',1);
     56                                                md = checkfield(md,'surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     57                                                md = checkfield(md,'surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     58                                                md = checkfield(md,'surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     59                                        end
     60                                elseif(obj.issmbgradients)
     61                                        checkfield(md,'surfaceforcings.hc','forcing',1,'NaN',1);
     62                                        checkfield(md,'surfaceforcings.smb_pos_max','forcing',1,'NaN',1);
     63                                        checkfield(md,'surfaceforcings.smb_pos_min','forcing',1,'NaN',1);
     64                                        checkfield(md,'surfaceforcings.a_pos','forcing',1,'NaN',1);
     65                                        checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1);
     66                                        checkfield(md,'surfaceforcings.a_neg','forcing',1,'NaN',1);
     67                                        checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1);
     68                                else
     69                                        md = checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1);
     70                                end
    2771                        end
    2872                        if ismember(BalancethicknessAnalysisEnum,analyses),
    29                                 checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
     73                                md = checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
    3074                        end
    3175                end % }}}
     
    3377                        disp(sprintf('   surface forcings parameters:'));
    3478
     79                        fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]');
     80                        fielddisplay(obj,'ispdd','is pdd activated (0 or 1, default is 0)');
     81                        fielddisplay(obj,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)');
     82                        fielddisplay(obj,'monthlytemperatures','monthly surface temperatures [Kelvin], required if pdd is activated and delta18o not activated');
    3583                        fielddisplay(obj,'precipitation','surface precipitation [m/yr water eq]');
    36                         fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]');
     84                        fielddisplay(obj,'temperatures_presentday','monthly present day surface temperatures [Kelvin], required if pdd is activated and delta18o activated');
     85                        fielddisplay(obj,'temperatures_lgm','monthly LGM surface temperatures [Kelvin], required if pdd is activated and delta18o activated');
     86                        fielddisplay(obj,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated');
     87                        fielddisplay(obj,'delta18o','delta18o, required if pdd is activated and delta18o activated');
     88                        fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
     89                        fielddisplay(obj,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)');
     90                        fielddisplay(obj,'hc',' elevation of intersection between accumulation and ablation regime required if smb gradients is activated');
     91                        fielddisplay(obj,'smb_pos_max',' maximum value of positive smb required if smb gradients is activated');
     92                        fielddisplay(obj,'smb_pos_min',' minimum value of positive smb required if smb gradients is activated');
     93                        fielddisplay(obj,'a_pos',' intercept of hs - smb regression line for accumulation regime required if smb gradients is activated');
     94                        fielddisplay(obj,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated');
     95                        fielddisplay(obj,'a_neg',' intercept of hs - smb regression line for ablation regime required if smb gradients is activated');
     96                        fielddisplay(obj,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated');
    3797
    3898                end % }}}
     
    40100                        WriteData(fid,'object',obj,'fieldname','precipitation','format','DoubleMat','mattype',1);
    41101                        WriteData(fid,'object',obj,'fieldname','mass_balance','format','DoubleMat','mattype',1);
     102                        WriteData(fid,'object',obj,'fieldname','ispdd','format','Boolean');
     103                        WriteData(fid,'object',obj,'fieldname','isdelta18o','format','Boolean');
     104                        if obj.ispdd,
     105                          if obj.isdelta18o
     106                                WriteData(fid,'object',obj,'fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
     107                                WriteData(fid,'object',obj,'fieldname','temperatures_lgm','format','DoubleMat','mattype',1);
     108                                WriteData(fid,'object',obj,'fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
     109                                WriteData(fid,'object',obj,'fieldname','delta18o_surface','format','DoubleMat','mattype',1);
     110                                WriteData(fid,'object',obj,'fieldname','delta18o','format','DoubleMat','mattype',1);
     111                          else
     112                                WriteData(fid,'object',obj,'fieldname','monthlytemperatures','format','DoubleMat','mattype',1);
     113                                WriteData(fid,'object',obj,'fieldname','precipitation','format','DoubleMat','mattype',1);
     114                          end
     115                        end
     116                        WriteData(fid,'object',obj,'fieldname','issmbgradients','format','Boolean');
     117                        if obj.issmbgradients,
     118                                WriteData(fid,'object',obj,'fieldname','hc','format','DoubleMat','mattype',1);
     119                                WriteData(fid,'object',obj,'fieldname','smb_pos_max','format','DoubleMat','mattype',1);
     120                                WriteData(fid,'object',obj,'fieldname','smb_pos_min','format','DoubleMat','mattype',1);
     121                                WriteData(fid,'object',obj,'fieldname','a_pos','format','DoubleMat','mattype',1);
     122                                WriteData(fid,'object',obj,'fieldname','b_pos','format','DoubleMat','mattype',1);
     123                                WriteData(fid,'object',obj,'fieldname','a_neg','format','DoubleMat','mattype',1);
     124                                WriteData(fid,'object',obj,'fieldname','b_neg','format','DoubleMat','mattype',1);
     125                        end
     126
    42127                end % }}}
    43128        end
  • issm/branches/trunk-jpl-damage/src/m/classes/thermal.m

    r12004 r12878  
    4040                        obj.isenthalpy=0;
    4141                end % }}}
    42                 function checkconsistency(obj,md,solution,analyses) % {{{
     42                function md = checkconsistency(obj,md,solution,analyses) % {{{
    4343
    4444                        %Early return
    4545                        if (~ismember(ThermalAnalysisEnum,analyses) & ~ismember(EnthalpyAnalysisEnum,analyses)) | (solution==TransientSolutionEnum & md.transient.isthermal==0), return; end
    4646
    47                         checkfield(md,'thermal.stabilization','numel',1,'values',[0 1 2]);
    48                         checkfield(md,'thermal.spctemperature','forcing',1);
    49                         if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy),
    50                         checkfield(md,'thermal.spctemperature','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*md.geometry.thickness,'message','spctemperature should be below the adjusted melting point');
    51                         checkfield(md,'thermal.isenthalpy','numel',1,'values',[0 1]);
     47                        md = checkfield(md,'thermal.stabilization','numel',1,'values',[0 1 2]);
     48                        md = checkfield(md,'thermal.spctemperature','forcing',1);
     49                        if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy & md.mesh.dimension==3),
     50                        md = checkfield(md,'thermal.spctemperature','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*(md.geometry.surface-md.mesh.z),'message','spctemperature should be below the adjusted melting point');
     51                        md = checkfield(md,'thermal.isenthalpy','numel',1,'values',[0 1]);
    5252                        end
    5353                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/timestepping.m

    r12004 r12878  
    3333                        obj.cfl_coefficient=.5;
    3434                end % }}}
    35                 function checkconsistency(obj,md,solution,analyses) % {{{
     35                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3636
    37                         checkfield(md,'timestepping.start_time','numel',1,'NaN',1);
    38                         checkfield(md,'timestepping.final_time','numel',1,'NaN',1);
    39                         checkfield(md,'timestepping.time_step','numel',1,'>=',0,'NaN',1);
    40                         checkfield(md,'timestepping.time_adapt','numel',1,'values',[0 1]);
    41                         checkfield(md,'timestepping.cfl_coefficient','numel',1,'>',0,'<=',1);
     37                        md = checkfield(md,'timestepping.start_time','numel',1,'NaN',1);
     38                        md = checkfield(md,'timestepping.final_time','numel',1,'NaN',1);
     39                        md = checkfield(md,'timestepping.time_step','numel',1,'>=',0,'NaN',1);
     40                        md = checkfield(md,'timestepping.time_adapt','numel',1,'values',[0 1]);
     41                        md = checkfield(md,'timestepping.cfl_coefficient','numel',1,'>',0,'<=',1);
    4242                        if obj.final_time-obj.start_time<0,
    43                                 checkmessage('timestepping.final_time should be larger than timestepping.start_time');
     43                                md = checkmessage(md,'timestepping.final_time should be larger than timestepping.start_time');
    4444                        end
    4545                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/transient.m

    r12004 r12878  
    3030
    3131                end % }}}
    32                 function checkconsistency(obj,md,solution,analyses) % {{{
     32                function md = checkconsistency(obj,md,solution,analyses) % {{{
    3333
    3434                        %Early return
    3535                        if solution~=TransientSolutionEnum, return; end
    3636
    37                         checkfield(md,'transient.isprognostic','numel',1,'values',[0 1]);
    38                         checkfield(md,'transient.isdiagnostic','numel',1,'values',[0 1]);
    39                         checkfield(md,'transient.isthermal','numel',1,'values',[0 1]);
    40                         checkfield(md,'transient.isgroundingline','numel',1,'values',[0 1]);
     37                        md = checkfield(md,'transient.isprognostic','numel',1,'values',[0 1]);
     38                        md = checkfield(md,'transient.isdiagnostic','numel',1,'values',[0 1]);
     39                        md = checkfield(md,'transient.isthermal','numel',1,'values',[0 1]);
     40                        md = checkfield(md,'transient.isgroundingline','numel',1,'values',[0 1]);
     41                        md = checkfield(md,'transient.requested_outputs','size',[NaN 1]);
    4142
    4243                end % }}}
  • issm/branches/trunk-jpl-damage/src/m/classes/verbose.m

    r12004 r12878  
    2121classdef verbose
    2222        properties (SetAccess=public)
    23                 % {{{1
     23                % {{{
    2424                %BEGINFIELDS
    2525                mprocessor  = false;
     
    3535        %}}}
    3636        methods
    37                 function verbose=verbose(varargin) % {{{1
     37                function verbose=verbose(varargin) % {{{
    3838
    3939                        switch(nargin),
     
    7070                end
    7171                %}}}
    72                 function binary=VerboseToBinary(verbose) % {{{1
     72                function binary=VerboseToBinary(verbose) % {{{
    7373
    7474                %BEGINVERB2BIN
     
    8585                end
    8686                %}}}
    87                 function verbose=BinaryToVerbose(verbose,binary) % {{{1
     87                function verbose=BinaryToVerbose(verbose,binary) % {{{
    8888
    8989                %BEGINBIN2VERB
     
    9999                end
    100100                %}}}
    101                 function checkconsistency(obj,md,solution,analyses) % {{{
     101                function md = checkconsistency(obj,md,solution,analyses) % {{{
    102102
    103103                end % }}}
    104                 function disp(verbose) % {{{1
     104                function disp(verbose) % {{{
    105105                       
    106106                %BEGINDISP
  • issm/branches/trunk-jpl-damage/src/m/enum/EnumDefinitions.py

    r12877 r12878  
    897897        return StringToEnum('MaterialsRheologyN')
    898898
     899def MaterialsRheologyZEnum():
     900        """
     901        MATERIALSRHEOLOGYZENUM - Enum of MaterialsRheologyZ
     902
     903           Usage:
     904              macro=MaterialsRheologyZEnum()
     905        """
     906
     907        return StringToEnum('MaterialsRheologyZ')
     908
     909def MaterialsRheologyZbarEnum():
     910        """
     911        MATERIALSRHEOLOGYZBARENUM - Enum of MaterialsRheologyZbar
     912
     913           Usage:
     914              macro=MaterialsRheologyZbarEnum()
     915        """
     916
     917        return StringToEnum('MaterialsRheologyZbar')
     918
    899919def MaterialsRhoIceEnum():
    900920        """
     
    45754595        """
    45764596
    4577         return 456
    4578 
     4597        return 458
     4598
  • issm/branches/trunk-jpl-damage/src/m/enum/MaximumNumberOfEnums.m

    r12872 r12878  
    99%      macro=MaximumNumberOfEnums()
    1010
    11 macro=439;
     11macro=458;
  • issm/branches/trunk-jpl-damage/src/m/model/MatlabProcessPatch.m

    r12168 r12878  
    55%      Result=ProcessPatch(Result);
    66
    7 %return if there is no fiel Patch
     7%return if there is no field Patch
    88if (~isfield(structure,'Patch')),
    99        return;
  • issm/branches/trunk-jpl-damage/src/m/model/SectionValues.m

    r12004 r12878  
    1212if ischar(infile),
    1313        %read infile:
    14         contempt=expread(infile);
    15         nods=contempt.nods;
    16         x=contempt.x;
    17         y=contempt.y;
     14        profile=expread(infile);
     15        nods=profile.nods;
     16        x=profile.x;
     17        y=profile.y;
    1818else
    1919        %read infile:
  • issm/branches/trunk-jpl-damage/src/m/model/WriteData.m

    r10969 r12878  
    3535%Step 2: write the data itself.
    3636if     strcmpi(format,'Boolean'),% {{{
    37         if(numel(data)~=1), error(['field ' field ' cannot be marshalled as it has more than one element!']); end
     37        if(numel(data)~=1), error(['field ' EnumToString(enum) ' cannot be marshalled as it has more than one element!']); end
    3838
    3939        %first write length of record
     
    5959        % }}}
    6060elseif strcmpi(format,'Double'), % {{{
    61         if(numel(data)~=1), error(['field ' field ' cannot be marshalled as it has more than one element!']); end
     61        if(numel(data)~=1), error(['field ' EnumToString(enum) ' cannot be marshalled as it has more than one element!']); end
    6262
    6363        %first write length of record
     
    233233        enum=eval([string 'Enum();']);
    234234end % }}}
    235 function code=FormatToCode(format) % {{{1
     235function code=FormatToCode(format) % {{{
    236236%This routine takes the format string, and hardcodes it into an integer, which
    237237%is passed along the record, in order to identify the nature of the dataset being
  • issm/branches/trunk-jpl-damage/src/m/model/addnote.py

    r12168 r12878  
    1 def addnote(md, string):
     1def addnote(md,string):
     2        """
     3        ADDNOTE - add a note to the existing model notes field
     4         
     5            Usage:
     6               md=addnote(md,string);
     7         
     8            Example:
     9               md=addnote(md,'Pine Island, Geometry of 2007');
     10        """
    211
    3     # Local Variables: md, string, i, notes, miscellaneous, newnotes
    4     # Function calls: ischar, nargout, cell, nargin, length, addnote, error
    5     #ADDNOTE - add a note to the existing model notes field
    6     #
    7     #   Usage:
    8     #      md=addnote(md,string);
    9     #
    10     #   Example:
    11     #      md=addnote(md,'Pine Island, Geometry of 2007');
    12    
    13         if not isinstance(string,basetring):
    14         print 'addnote error message: second input argument should be a string'
    15                 return []
    16    
    17     notes = md.miscellaneous.notes
    18    
    19         if isinstance(notes,basestring):
     12        if not isinstance(string,str):
     13                raise TypeError('addnote error message: second input argument should be a string')
     14
     15        notes=md.miscellaneous.notes
     16
     17        if isinstance(notes,str):
    2018                newnotes=[notes,string]
    21     else:
    22                 newnotes=[];
    23                 for i in range(len(notes)):
    24                         newnotes=newnotes+notes[i]
    25            
    26         newnotes=newnotes+nodes;
    27        
    28     md.miscellaneous.notes = newnotes
    29     return md
     19        else:
     20                newnotes=notes.append(string)
     21
     22        md.miscellaneous.notes=newnotes
     23
     24        return md
     25
  • issm/branches/trunk-jpl-damage/src/m/model/averaging.m

    r9734 r12878  
    1 function average=averaging(md,data,iterations)
     1function average=averaging(md,data,iterations,varargin)
    22%AVERAGING - smooths the input over the mesh
    33%
     
    88%   by taking the average of the element around a node weighted by the
    99%   elements volume
     10%   For 3d mesh, a last argument can be added to specify the layer to be averaged on.
    1011%
    1112%   Usage:
    1213%      smoothdata=averaging(md,data,iterations)
     14%      smoothdata=averaging(md,data,iterations,layer)
    1315%
    1416%   Examples:
    1517%      velsmoothed=averaging(md,md.initialization.vel,4);
    1618%      pressure=averaging(md,md.initialization.pressure,0);
     19%      temperature=averaging(md,md.initialization.temperature,1,1);
    1720
    18 if length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices
     21if ((nargin~=4) & (nargin~=3)),
     22        error('averaging error message');
     23end
     24if (length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices),
    1925        error('averaging error message: data not supported yet');
     26end
     27if md.mesh.dimension==3 & nargin==4,
     28        if varargin{1}<=0 | varargin{1}>md.mesh.numberoflayers,
     29                error('layer should be between 1 and md.mesh.numberoflayers');
     30        end
     31        layer=varargin{1};
     32else
     33        layer=0;
    2034end
    2135
    2236%initialization
    23 weights=zeros(md.mesh.numberofvertices,1);
    24 data=data(:);
     37if layer==0,
     38        weights=zeros(md.mesh.numberofvertices,1);
     39        data=data(:);
     40else
     41        weights=zeros(md.mesh.numberofvertices2d,1);
     42        data=data((layer-1)*md.mesh.numberofvertices2d+1:layer*md.mesh.numberofvertices2d,:);
     43end
    2544
    26 %load some variables (it is much faster if the variab;es are loaded from md once for all)
    27 index=md.mesh.elements;
    28 numberofnodes=md.mesh.numberofvertices;
    29 numberofelements=md.mesh.numberofelements;
     45%load some variables (it is much faster if the variabes are loaded from md once for all)
     46if layer==0,
     47        index=md.mesh.elements;
     48        numberofnodes=md.mesh.numberofvertices;
     49        numberofelements=md.mesh.numberofelements;
     50else
     51        index=md.mesh.elements2d;
     52        numberofnodes=md.mesh.numberofvertices2d;
     53        numberofelements=md.mesh.numberofelements2d;
     54end
    3055
    3156%build some variables
    3257line=index(:);
    33 if md.mesh.dimension==3
     58if md.mesh.dimension==3 & layer==0,
    3459        rep=6;
    3560        areas=GetAreas(index,md.mesh.x,md.mesh.y,md.mesh.z);
     61elseif md.mesh.dimension==2,
     62        rep=3;
     63        areas=GetAreas(index,md.mesh.x,md.mesh.y);
    3664else
    3765        rep=3;
    38         areas=GetAreas(index,md.mesh.x,md.mesh.y);
     66        areas=GetAreas(index,md.mesh.x2d,md.mesh.y2d);
    3967end
    4068summation=1/rep*ones(rep,1);
  • issm/branches/trunk-jpl-damage/src/m/model/collapse.m

    r12258 r12878  
    4242if ~isnan(md.initialization.vz),md.initialization.vz=DepthAverage(md,md.initialization.vz);end;
    4343if ~isnan(md.initialization.vel),md.initialization.vel=DepthAverage(md,md.initialization.vel);end;
     44if ~isnan(md.initialization.temperature),md.initialization.temperature=DepthAverage(md,md.initialization.temperature);end;
    4445
    4546%bedinfo and surface info
     
    9293md.geometry.thickness=project2d(md,md.geometry.thickness,1);
    9394md.geometry.bed=project2d(md,md.geometry.bed,1);
     95md.geometry.bathymetry=project2d(md,md.geometry.bathymetry,1);
    9496md.mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1);
    9597md.mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1);
  • issm/branches/trunk-jpl-damage/src/m/model/contourenvelope.m

    r9734 r12878  
    3535%Now, build the connectivity tables for this mesh.
    3636%Computing connectivity
    37 if size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices,
     37if (size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices & size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices2d),
    3838        md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
    3939end
    40 if size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements,
     40if (size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements & size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements2d),
    4141        md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
    4242end
     
    4444%get nodes inside profile
    4545mesh.elementconnectivity=md.mesh.elementconnectivity;
     46if md.mesh.dimension==2;
     47        mesh.elements=md.mesh.elements;
     48        mesh.x=md.mesh.x;
     49        mesh.y=md.mesh.y;
     50        mesh.numberofvertices=md.mesh.numberofvertices;
     51        mesh.numberofelements=md.mesh.numberofelements;
     52else
     53        mesh.elements=md.mesh.elements2d;
     54        mesh.x=md.mesh.x2d;
     55        mesh.y=md.mesh.y2d;
     56        mesh.numberofvertices=md.mesh.numberofvertices2d;
     57        mesh.numberofelements=md.mesh.numberofelements2d;
     58end
     59
    4660if nargin==2,
     61
    4762        if isfile,
    4863                %get flag list of elements and nodes inside the contour
    49                 nodein=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,file,'node',1);
    50                 elemin=(sum(nodein(md.mesh.elements),2)==size(md.mesh.elements,2));
     64                nodein=ContourToMesh(mesh.elements,mesh.x,mesh.y,file,'node',1);
     65                elemin=(sum(nodein(mesh.elements),2)==size(mesh.elements,2));
    5166                %modify element connectivity
    5267                elemout=find(~elemin);
     
    5570        else
    5671                %get flag list of elements and nodes inside the contour
    57                 nodein=zeros(md.mesh.numberofvertices,1);
    58                 elemin=zeros(md.mesh.numberofelements,1);
     72                nodein=zeros(mesh.numberofvertices,1);
     73                elemin=zeros(mesh.numberofelements,1);
    5974               
    6075                pos=find(flags);
    6176                elemin(pos)=1;
    62                 nodein(md.mesh.elements(pos,:))=1;
     77                nodein(mesh.elements(pos,:))=1;
    6378
    6479                %modify element connectivity
     
    87102        els2=mesh.elementconnectivity(el1,find(mesh.elementconnectivity(el1,:)));
    88103        if length(els2)>1,
    89                 flag=intersect(md.mesh.elements(els2(1),:),md.mesh.elements(els2(2),:));
    90                 nods1=md.mesh.elements(el1,:);
     104                flag=intersect(mesh.elements(els2(1),:),mesh.elements(els2(2),:));
     105                nods1=mesh.elements(el1,:);
    91106                nods1(find(nods1==flag))=[];
    92107                segments(count,:)=[nods1 el1];
    93108
    94                 ord1=find(nods1(1)==md.mesh.elements(el1,:));
    95                 ord2=find(nods1(2)==md.mesh.elements(el1,:));
     109                ord1=find(nods1(1)==mesh.elements(el1,:));
     110                ord2=find(nods1(2)==mesh.elements(el1,:));
    96111
    97112                %swap segment nodes if necessary
     
    104119                count=count+1;
    105120        else
    106                 nods1=md.mesh.elements(el1,:);
    107                 flag=setdiff(nods1,md.mesh.elements(els2,:));
     121                nods1=mesh.elements(el1,:);
     122                flag=setdiff(nods1,mesh.elements(els2,:));
    108123                for j=1:3,
    109124                        nods=nods1; nods(j)=[];
    110125                        if any(ismember(flag,nods)),
    111126                                segments(count,:)=[nods el1];
    112                                 ord1=find(nods(1)==md.mesh.elements(el1,:));
    113                                 ord2=find(nods(2)==md.mesh.elements(el1,:));
     127                                ord1=find(nods(1)==mesh.elements(el1,:));
     128                                ord2=find(nods(2)==mesh.elements(el1,:));
    114129                                if ( (ord1==1 & ord2==2) | (ord1==2 & ord2==3) | (ord1==3 & ord2==1) ),
    115130                                        temp=segments(count,1);
  • issm/branches/trunk-jpl-damage/src/m/model/extrude.m

    r12004 r12878  
    143143md.surfaceforcings.precipitation=project3d(md,'vector',md.surfaceforcings.precipitation,'type','node');
    144144md.balancethickness.thickening_rate=project3d(md,'vector',md.balancethickness.thickening_rate,'type','node');
     145md.surfaceforcings.monthlytemperatures=project3d(md,'vector',md.surfaceforcings.monthlytemperatures,'type','node');
    145146
    146147%results
     
    223224if ~isnan(md.inversion.max_parameters),md.inversion.max_parameters=project3d(md,'vector',md.inversion.max_parameters,'type','node');end;
    224225if ~isnan(md.qmu.partition),md.qmu.partition=project3d(md,'vector',md.qmu.partition','type','node');end
     226if(md.surfaceforcings.isdelta18o),md.surfaceforcings.temperatures_lgm=project3d(md,'vector',md.surfaceforcings.temperatures_lgm,'type','node');end
     227if(md.surfaceforcings.isdelta18o),md.surfaceforcings.temperatures_presentday=project3d(md,'vector',md.surfaceforcings.temperatures_presentday,'type','node');end
     228if(md.surfaceforcings.isdelta18o),md.surfaceforcings.precipitations_presentday=project3d(md,'vector',md.surfaceforcings.precipitations_presentday,'type','node');end
    225229
    226230%Put lithostatic pressure if there is an existing pressure
  • issm/branches/trunk-jpl-damage/src/m/model/ismodelselfconsistent.m

    r11224 r12878  
    66
    77%initialize consistency as true
    8 modelconsistency(true);
     8md.private.isconsistent=true;
    99
    1010%Get solution and associated analyses
     
    1212[analyses,numanalyses]=AnalysisConfiguration(solution);
    1313
    14 %Go through al model field check that it is a class and call checkconsistency
     14%Go through a model field, check that it is a class, and call checkconsistency
    1515fields=properties('model');
    1616for i=1:length(fields),
     
    2424        %Check that current field is an object
    2525        if ~isobject(md.(field))
    26                 checkmessage(['field ''' char(field) ''' is not an object']);
     26                md=checkmessage(md,['field ''' char(field) ''' is not an object']);
    2727        end
    2828
    2929        %Check consistency of the object
    3030        if verLessThan('matlab', '7.6')
    31                 checkconsistency(md.(field),md,solution,analyses);
     31                md=checkconsistency(md.(field),md,solution,analyses);
    3232        else
    33                 md.(field).checkconsistency(md,solution,analyses);
     33                md=md.(field).checkconsistency(md,solution,analyses);
    3434        end
    3535end
    3636
    3737%error message if mode is not consistent
    38 if modelconsistency==false,
    39         error(' ');
     38if md.private.isconsistent==false,
     39        error('Model not consistent, see messages above');
    4040end
  • issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromcluster.m

    r11577 r12878  
    1313
    1414%Download outputs from the cluster
    15 if verLessThan('matlab', '7.6');
    16         Download(cluster,md);
     15filelist={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
     16if md.qmu.isdakota,
     17        filelist{end+1}=[md.miscellaneous.name '.qmu.err'];
     18        filelist{end+1}=[md.miscellaneous.name '.qmu.out'];
     19        if isfield(md.qmu.params,'tabular_graphics_data'),
     20                if md.qmu.params.tabular_graphics_data==true,
     21                        filelist{end+1}='dakota_tabular.dat';
     22                end
     23        end
    1724else
    18         cluster.Download(md);
     25        filelist{end+1}=[md.miscellaneous.name '.outbin'];
    1926end
     27Download(cluster,md.private.runtimename,filelist);
    2028
    2129%If we are here, no errors in the solution sequence, call loadresultsfromdisk.
  • issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromdisk.m

    r11333 r12878  
    5959        md=postqmu(md);
    6060        cd ..
    61 
    6261end
  • issm/branches/trunk-jpl-damage/src/m/model/marshall.m

    r12280 r12878  
    1616end
    1717
    18 %First, right MaximumNumberOfEnum to make sure that the Enums are synchronized
     18%First, write MaximumNumberOfEnum to make sure that the Enums are synchronized
    1919WriteData(fid,'enum',MaximumNumberOfEnums(),'data',true,'format','Boolean');
    2020
     
    3131        %Check that current field is an object
    3232        if ~isobject(md.(field))
    33                 checkmessage(['field ''' char(field) ''' is not an object']);
     33                error(['field ''' char(field) ''' is not an object']);
    3434        end
    3535
  • issm/branches/trunk-jpl-damage/src/m/model/mesh/bamg.m

    r11684 r12878  
    5858bamg_mesh=bamgmesh;
    5959
    60 % Bamg Geometry parameters {{{1
     60% Bamg Geometry parameters {{{
    6161if exist(options,'domain'),
    6262
     
    259259end
    260260%}}}
    261 % Bamg Mesh parameters {{{1
     261% Bamg Mesh parameters {{{
    262262if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & md.mesh.dimension==2),
    263263
     
    274274end
    275275%}}}
    276 % Bamg Options {{{1
     276% Bamg Options {{{
    277277bamg_options.Crack=getfieldvalue(options,'Crack',0);
    278278bamg_options.anisomax=getfieldvalue(options,'anisomax',10^30);
  • issm/branches/trunk-jpl-damage/src/m/model/modelextract.m

    r11142 r12878  
    166166        if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs...
    167167                %renumber first two columns
    168                 pos=find(~isnan(md2.mesh.edges(:,4)));
     168                pos=find(md2.mesh.edges(:,4)~=-1);
    169169                md2.mesh.edges(:  ,1)=Pnode(md2.mesh.edges(:,1));
    170170                md2.mesh.edges(:  ,2)=Pnode(md2.mesh.edges(:,2));
     
    173173                %remove edges when the 2 vertices are not in the domain.
    174174                md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:);
    175                 %Replace all zeros by NaN in the last two columns;
     175                %Replace all zeros by -1 in the last two columns;
    176176                pos=find(md2.mesh.edges(:,3)==0);
    177                 md2.mesh.edges(pos,3)=NaN;
     177                md2.mesh.edges(pos,3)=-1;
    178178                pos=find(md2.mesh.edges(:,4)==0);
    179                 md2.mesh.edges(pos,4)=NaN;
    180                 %Invert NaN of the third column with last column (Also invert first two columns!!)
    181                 pos=find(isnan(md2.mesh.edges(:,3)));
     179                md2.mesh.edges(pos,4)=-1;
     180                %Invert -1 on the third column with last column (Also invert first two columns!!)
     181                pos=find(md2.mesh.edges(:,3)==-1);
    182182                md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4);
    183                 md2.mesh.edges(pos,4)=NaN;
     183                md2.mesh.edges(pos,4)=-1;
    184184                values=md2.mesh.edges(pos,2);
    185185                md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1);
    186186                md2.mesh.edges(pos,1)=values;
    187187                %Finally remove edges that do not belong to any element
    188                 pos=find(isnan(md2.mesh.edges(:,3)) & isnan(md2.mesh.edges(:,4)));
     188                pos=find(md2.mesh.edges(:,3)==-1 & md2.mesh.edges(:,4)==-1);
    189189                md2.mesh.edges(pos,:)=[];
    190190        end
     
    210210                md2.mesh.segments=contourenvelope(md2);
    211211                md2.mesh.vertexonboundary=zeros(numberofvertices2,1); md2.mesh.vertexonboundary(md2.mesh.segments(:,1:2))=1;
     212        else
     213                %First do the connectivity for the contourenvelope in 2d
     214                md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d);
     215                md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity);
     216                md2.mesh.segments=contourenvelope(md2);
     217                md2.mesh.vertexonboundary=zeros(numberofvertices2/md2.mesh.numberoflayers,1); md2.mesh.vertexonboundary(md2.mesh.segments(:,1:2))=1;
     218                md2.mesh.vertexonboundary=repmat(md2.mesh.vertexonboundary,md2.mesh.numberoflayers,1);
     219                %Then do it for 3d as usual
     220                md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices);
     221                md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements,md2.mesh.vertexconnectivity);
    212222        end
    213223
  • issm/branches/trunk-jpl-damage/src/m/model/parameterization/parameterize.m

    r11235 r12878  
    44%   from a parameter matlab file, start filling in all the @model fields that were not
    55%   filled in by the mesh.m and mask.m @model methods.
    6 %   Warning: the paramter file must be able to be run in Matlab
     6%   Warning: the parameter file must be able to be run in Matlab
    77%
    88%   Usage:
     
    1414%some checks
    1515if ~exist(parametername),
    16         error(['parameterize error message: file ' parametername ' not found !']);
     16        error(['parameterize error message: file ' parametername ' not found!']);
    1717end
    1818
  • issm/branches/trunk-jpl-damage/src/m/model/parameterization/parameterize.py

    r12168 r12878  
    11import os
    2 def  parameterize(md,parametername):
    3         #PARAMETERIZE - parameterize a model
    4         #
    5         #   from a parameter matlab file, start filling in all the model fields that were not
    6         #   filled in by the mesh.py and setmask.py model methods.
    7         #   Warning: the parameter file must be able to be run in Python
    8         #
    9         #   Usage:
    10         #      md=parameterize(md,parametername)
    11         #
    12         #   Example:
    13         #      md=parameterize(md,'Square.par');
     2import datetime
     3from addnote import *
     4
     5def parameterize(md,parametername):
     6        """
     7        PARAMETERIZE - parameterize a model
     8         
     9            from a parameter python file, start filling in all the model fields that were not
     10            filled in by the mesh.py and mask.py model methods.
     11            Warning: the parameter file must be able to be run in Python
     12         
     13            Usage:
     14               md=parameterize(md,parametername)
     15         
     16            Example:
     17               md=parameterize(md,'Square.par');
     18        """
    1419
    1520        #some checks
    16         if not os.path.isfile(parametername):
    17                 print 'parameterize error message: file '+parametername+' not found.'
    18                 return []
     21        if not os.path.exists(parametername):
     22                raise IOError("parameterize error message: file '%s' not found!" % parametername)
    1923
    2024        #Try and run parameter file.
    2125        execfile(parametername)
    22        
    23         #ame and notes
    24         if len(md.miscellaneous.name)==0:
    25                 md.miscellaneous.name=os.path.basename(parametername)
    26        
    27         md=addnote(md,'Model created by using parameter file: '+parametername+' on: '+str(datetime.datetime.now()))
     26
     27        #Name and notes
     28        if not md.miscellaneous.name:
     29                md.miscellaneous.name=os.path.basename(parametername).split('.')[0]
     30
     31        md=addnote(md,"Model created by using parameter file: '%s' on: %s." % (parametername,datetime.datetime.strftime(datetime.datetime.now(),'%c') ))
     32
     33        return md
     34
  • issm/branches/trunk-jpl-damage/src/m/model/parseresultsfromdisk.m

    r10399 r12878  
    172172% }}}
    173173function result=ReadDataDimensions(fid) % {{{
    174 %READDATA - read data dimensions, step and time, but not the data itself.
     174%READDATADIMENSIONS - read data dimensions, step and time, but not the data itself.
    175175%
    176176%   Usage:
  • issm/branches/trunk-jpl-damage/src/m/model/plot/applyoptions.m

    r12254 r12878  
    3131end
    3232
    33 %xlabel
     33%xlabel, ylabel and zlabel
    3434if exist(options,'xlabel');
    3535        xlabel(getfieldvalue(options,'xlabel'),'FontSize',fontsize,'FontWeight',fontweight);
    3636end
    37 
    38 %ylabel
    3937if exist(options,'ylabel');
    4038        ylabel(getfieldvalue(options,'ylabel'),'FontSize',fontsize,'FontWeight',fontweight);
    4139end
    42 
    43 %zlabel
    4440if exist(options,'zlabel');
    4541        zlabel(getfieldvalue(options,'zlabel'),'FontSize',fontsize,'FontWeight',fontweight);
    4642end
    4743
    48 %xtikcs
     44%xticks, yticks and zticks
    4945if exist(options,'xtick'), set(gca,'XTick',getfieldvalue(options,'xtick')); end
    5046if exist(options,'ytick'), set(gca,'YTick',getfieldvalue(options,'ytick')); end
     
    7571end
    7672
    77 %xlim
     73%xlim, ylim and zlim
    7874if exist(options,'xlim');
    7975        xlim(getfieldvalue(options,'xlim'));
     
    8379if exist(options,'ylim');
    8480        ylim(getfieldvalue(options,'ylim'));
     81end
     82if exist(options,'zlim');
     83        zlim(getfieldvalue(options,'zlim'));
    8584end
    8685
     
    9291end
    9392
    94 
    95 %zlim
    96 if exist(options,'zlim');
    97         zlim(getfieldvalue(options,'zlim'));
    98 end
    99 
    10093%Basinzoom
    10194if exist(options,'basin');
     
    107100        showbasins(options);
    108101end
    109 
    110102
    111103%Caxis
     
    127119
    128120%colormap
    129 if exist(options,'colormap'),
    130         cname=getfieldvalue(options,'colormap');
    131         if strcmpi(cname,'Ala'),
    132                 c = jet(64);
    133                 c = c (32:end,:);
    134         elseif strcmpi(cname,'redblue'),
    135                 %m = 30;
    136                 %n = fix(0.5*m);
    137                 %r = [(0:1:n-1)/n,ones(1,n)];
    138                 %g = [(0:n-1)/n, (n-1:-1:0)/n];
    139                 %b = [ones(1,n),(n-1:-1:0)/n];
    140                 %c = [r(:), g(:), b(:)];
     121c = getcolormap(options);
     122h = colormap(c);
    141123
    142124                c = hsv(64);
     
    302284                textpositioni=textposition{i};
    303285                textrotationi=textrotation{i};
    304                 h=text(textpositioni(1),textpositioni(2),textstringi,'FontSize',textsizei,'FontWeight',textweighti,'Color',textcolori,'Rotation',textrotationi);
     286                h=text(textpositioni(1),textpositioni(2),10,textstringi,'FontSize',textsizei,'FontWeight',textweighti,'Color',textcolori,'Rotation',textrotationi);
    305287                set(h,'Clipping','on'); %prevent text from appearing outside of the box
    306288        end
     
    359341if exist(options,'axispos'),
    360342        Axis=getfieldvalue(options,'axispos');
     343        hold on
    361344        set(gca,'pos',Axis);
    362345end
     
    384367                        left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;
    385368                        set(gcf,'Position',fix([left bott widt/2 heig]));
     369                elseif strcmpi(figposition,'square'),
     370                        screen=get(0,'ScreenSize');
     371                        left=screen(1); bott=screen(2); widt=min(screen(3)-25,screen(4)-25);
     372                        set(gcf,'Position',fix([left+(screen(3)-widt) bott widt widt]));
    386373                elseif strcmpi(figposition,'portrait'),
    387374                        %reformat with letter paper size (8.5" x 11")
     
    426413                A=expread([ jplsvn() '/projects/Exp/GreenlandBoxFront.exp']);
    427414                [A.x A.y]=ll2xy(A.x,A.y,+1,45,70);
     415                A.x = A.x(1:30:end);
     416                A.y = A.y(1:30:end);
    428417        elseif strcmpi(md.mesh.hemisphere,'s') | strcmpi(md.mesh.hemisphere,'south'),
    429418                %A=expread([ jplsvn() '/projects/Exp/Antarctica.exp']);
     
    444433        line(A.x,A.y,ones(size(A.x)),'color','b');
    445434        patch([Ax(1)  Ax(2)  Ax(2)  Ax(1) Ax(1)],[Ay(1)  Ay(1)  Ay(2)  Ay(2) Ay(1)],[1 1 1],'EdgeColor',[0 0 0],'LineWidth',1,'FaceLighting','none')
    446         patch( [mdx(1) mdx(2) mdx(2) mdx(1)],[mdy(1) mdy(1) mdy(2) mdy(2)],ones(4,1),'EdgeColor',[0 0 0],'FaceColor','r','FaceAlpha',0.5)
     435        patch([mdx(1) mdx(2) mdx(2) mdx(1)],[mdy(1) mdy(1) mdy(2) mdy(2)],ones(4,1),'EdgeColor',[0 0 0],'FaceColor','r','FaceAlpha',0.5)
    447436        colorbar('off');
    448437        %back to main gca
     
    452441%flag edges of a partition
    453442if exist(options,'partitionedges')
    454 [xsegments ysegments]=flagedges(md.mesh.elements,md.mesh.x,md.mesh.y,md.qmu.partition);
    455 xsegments=xsegments*getfieldvalue(options,'unit',1);
    456 ysegments=ysegments*getfieldvalue(options,'unit',1);
    457 color=getfieldvalue(options,'partitionedgescolor','r-');
    458 linewidth=getfieldvalue(options,'linewidth',1);
    459 hold on;
    460 for i=1:length(xsegments),
    461         plot(xsegments(i,:),ysegments(i,:),color,'LineWidth',linewidth);
    462 end
     443        [xsegments ysegments]=flagedges(md.mesh.elements,md.mesh.x,md.mesh.y,md.qmu.partition);
     444        xsegments=xsegments*getfieldvalue(options,'unit',1);
     445        ysegments=ysegments*getfieldvalue(options,'unit',1);
     446        color=getfieldvalue(options,'partitionedgescolor','r-');
     447        linewidth=getfieldvalue(options,'linewidth',1);
     448        hold on;
     449        for i=1:length(xsegments),
     450                plot(xsegments(i,:),ysegments(i,:),color,'LineWidth',linewidth);
     451        end
     452end
     453
     454%Scatter
     455if exist(options,'scatter')
     456        data=getfieldvalue(options,'scatter');
     457        hold on
     458        plot_scatter(data(:,1),data(:,2),getfieldvalue(options,'scattersize',3),data(:,3),options);
    463459end
    464460
  • issm/branches/trunk-jpl-damage/src/m/model/plot/plot_gridded.m

    r12168 r12878  
    66%
    77%   See also: PLOTMODEL
    8 
    9 whitepos=getfieldvalue(options,'whitepos',2); %1: up, 2: down, else: none
    108
    119%process mesh and data
     
    2927end
    3028
     29%Get and change colormap
     30map    = getcolormap(options);
     31lenmap = size(map,1);
     32map    = [1 1 1; map];
     33options=changefieldvalue(options,'colormap',map);
     34
    3135%Process data_grid: add white in NaN and correct caxis accordingly
    3236if exist(options,'caxis'),
     
    4044        data_max=max(data_grid(:));
    4145end
    42 options=changefieldvalue(options,'cbYLim',[data_min data_max]);
    43 if whitepos==1,
    44         white  =data_max + (data_max-data_min)/55;
    45         options=changefieldvalue(options,'caxis',[data_min white]);
    46         data_grid(isnan(data_grid))=white;
    47 elseif whitepos==2,
    48         white  =data_min - (data_max-data_min)/55;
    49         options=changefieldvalue(options,'caxis',[white data_max]);
    50         data_grid(isnan(data_grid))=white;
    51 end
     46options = changefieldvalue(options,'cbYLim',[data_min data_max]);
     47white   = data_min - (data_max-data_min)/(lenmap);
     48options = changefieldvalue(options,'caxis',[white data_max]);
     49data_grid(isnan(data_grid))=white;
    5250
    5351%Select plot area
    54 subplot(plotlines,plotcols,i);
     52subplotmodel(plotlines,plotcols,i,options);
    5553
    5654%shading interp;
    5755h=imagesc(xlim,ylim,data_grid);set(gca,'YDir','normal');
    58 map=getfieldvalue(options,'colormap',jet);
    59 if whitepos==1,
    60         map(end,:)=[1 1 1];
    61 elseif whitepos==2,
    62         map(1,:)=[1 1 1];
    63 end
    64 options=changefieldvalue(options,'colormap',map);
    6556
    6657%last step: mesh gridded?
  • issm/branches/trunk-jpl-damage/src/m/model/plot/plot_manager.m

    r11249 r12878  
    165165if exist(options,'sectionvalue')
    166166        plot_section(md,data,options,nlines,ncols,i);
     167        return;
     168end
     169
     170%Figure out if this is a Profile plot
     171if exist(options,'profile')
     172        plot_profile(md,data,options,nlines,ncols,i);
    167173        return;
    168174end
  • issm/branches/trunk-jpl-damage/src/m/model/plot/plot_overlay.m

    r12168 r12878  
    4141        md=radarpower(md,options);
    4242end
     43contrast = getfieldvalue(options,'contrast',1); 
     44radar = (md.radaroverlay.pwr).^(contrast);
     45radar = radar./max(radar(:));
     46%radar(find(radar==0))=1; %Change background from black to white
    4347
    4448%InterpFromMeshToGrid
     
    5054ncols =length(md.radaroverlay.x);
    5155disp('Interpolating data on grid...');
    52 [x_m y_m data_grid]=InterpFromMeshToGrid(elements,x/getfieldvalue(options,'unit',1),y/getfieldvalue(options,'unit',1),...
    53         data,xmin,ymax,xspacing,yspacing,nlines,ncols,NaN);
     56if radaronly,
     57        x_m=xmin:xspacing:xmin+ncols*xspacing;
     58        y_m=ymax-nlines*yspacing:yspacing:ymax;
     59        data_grid=NaN*ones(nlines,ncols);
     60else
     61        [x_m y_m data_grid]=InterpFromMeshToGrid(elements,x/getfieldvalue(options,'unit',1),y/getfieldvalue(options,'unit',1),...
     62                data,xmin,ymax,xspacing,yspacing,nlines,ncols,NaN);
     63end
    5464
    55 %Process data_grid
     65%Process data_grid (For processing, it is better not to have nan)
    5666pos=find(isinf(data_grid));
    5767if ~isempty(pos),
     
    7080end
    7181data_nan=find(isnan(data_grid));
    72 
    73 %Generate HSV image
    74 contrast=getfieldvalue(options,'contrast',1); 
    75 transparency=getfieldvalue(options,'alpha',1);
    7682data_grid(data_nan)=data_min;
    7783
     84%Special colormaps that require hsv treatment
    7885colorm=getfieldvalue(options,'colormap','Rignot');
    79 if strcmpi(colorm,'Rignot'),
    80         %hue (H)
    81         h_data=(data_grid-data_min)/(data_max-data_min+eps);
    82         if radaronly, h_data(:)=0; end
    83         %saturation (S)
    84         s_data=max(min((0.1+h_data).^(1/transparency),1),0);
    85 elseif strcmpi(colorm,'Seroussi'),
    86         %hue (H)
    87         h_data=1-(data_grid-data_min)/(data_max-data_min+eps)*0.7;
    88         %h_data=(data_grid-data_min)/(data_max-data_min)*2/3;
    89         if radaronly, h_data(:)=0; end
    90         %saturation (S)
    91         s_data=max(min((0.1+h_data).^(1/transparency),1),0);
    92 elseif strcmpi(colorm,'redblue')
    93         data_mean=data_min+(data_max-data_min)/2;
    94         %hue (H)
    95         %h_data=0.7*ones(size(data_grid));
    96         %h_data(find(data_grid>data_mean))=1;
    97         h_data=1*ones(size(data_grid));
    98         h_data(find(data_grid<data_mean))=0.7;
    99         %saturation (S)
    100         s_data=max(min(abs(data_grid-data_mean)/(data_max-data_mean) ,1),0);
     86if strcmpi(colorm,'Rignot') | strcmpi(colorm,'Seroussi') | strcmpi(colorm,'redblue')
     87        if strcmpi(colorm,'Rignot'),
     88                transparency=getfieldvalue(options,'alpha',1);
     89                h=(data_grid-data_min)/(data_max-data_min+eps);
     90                if radaronly, h(:)=0; end
     91                s=max(min((0.1+h).^(1/transparency),1),0);
     92        elseif strcmpi(colorm,'Seroussi'),
     93                transparency=getfieldvalue(options,'alpha',1);
     94                h=1-(data_grid-data_min)/(data_max-data_min+eps)*0.7;
     95                if radaronly, h(:)=0; end
     96                s=max(min((0.1+h).^(1/transparency),1),0);
     97        elseif strcmpi(colorm,'redblue')
     98                data_mean=data_min+(data_max-data_min)/2;
     99                h=1*ones(size(data_grid));
     100                h(find(data_grid<data_mean))=0.7;
     101                s=max(min(abs(data_grid-data_mean)/(data_max-data_mean) ,1),0);
     102        else
     103                error('colormap not supported yet. (''Rignot'' and ''redblue'' are the only cupported colormaps)');
     104        end
     105        %(S) Saturation is 0 in NaNs
     106        s(data_nan)=0;
     107        %(V) intensity is based on radar image
     108        v=radar; %use radar power as intensity
     109
     110        %Transform HSV to RGB
     111        image_hsv=zeros(size(data_grid,1),size(data_grid,2),3);
     112        image_hsv(:,:,1)=h; clear h;
     113        image_hsv(:,:,2)=s; clear s;
     114        image_hsv(:,:,3)=v; clear v;
     115        image_rgb=hsv2rgb(image_hsv);
    101116else
    102         error('colormap not supported yet. (''Rignot'' and ''redblue'' are the only cupported colormaps)');
     117        colorm = getcolormap(options);
     118        len    = size(colorm,1);
     119
     120        ind = ceil((len-1)*(data_grid-data_min)/(data_max - data_min + eps) +1);
     121        ind(find(ind>len))=len;
     122        image_rgb=zeros(size(data_grid,1),size(data_grid,2),3);
     123        r=colorm(:,1); image_rgb(:,:,1)=r(ind); clear r;
     124        g=colorm(:,2); image_rgb(:,:,2)=g(ind); clear g;
     125        b=colorm(:,3); image_rgb(:,:,3)=b(ind); clear b;
     126
     127        %Now add radarmap
     128        r = image_rgb(:,:,1).*radar;  r(data_nan) = radar(data_nan);  image_rgb(:,:,1) = r;  clear r;
     129        g = image_rgb(:,:,2).*radar;  g(data_nan) = radar(data_nan);  image_rgb(:,:,2) = g;  clear g;
     130        b = image_rgb(:,:,3).*radar;  b(data_nan) = radar(data_nan);  image_rgb(:,:,3) = b;  clear b;
    103131end
    104132
    105 %Saturation is 0 in NaNs
    106 s_data(data_nan)=0;
    107 %intensity (V)
    108 radar=(md.radaroverlay.pwr).^(contrast);
    109 v_data=radar/max(radar(:)); %use radar power as intensity
    110 
    111 %Change background from black to white
    112 %pos=find(v_data==0);v_data(pos)=1;
    113 
    114 %Transform HSV to RGB
    115 image_hsv=zeros(size(data_grid,1),size(data_grid,2),3);
    116 image_hsv(:,:,1)=h_data;
    117 image_hsv(:,:,2)=s_data;
    118 image_hsv(:,:,3)=v_data;
    119 image_rgb=hsv2rgb(image_hsv);
    120 
    121133%Select plot area
    122 subplot(plotlines,plotcols,i);
     134subplotmodel(plotlines,plotcols,i,options);
    123135
    124136%Plot:
     
    134146
    135147%Apply options, without colorbar and without grid
    136 options=changefieldvalue(options,'colormap',colorm);           %We used an HSV colorbar
     148options=changefieldvalue(options,'colormap',colorm);              % We used an HSV colorbar
    137149if ~isnan(data_min),
    138         options=changefieldvalue(options,'caxis',[data_min data_max]); %force caxis so that the colorbar is ready
     150        options=changefieldvalue(options,'caxis',[data_min data_max]); % force caxis so that the colorbar is ready
    139151end
    140 options=addfielddefault(options,'axis','equal off');           %default axis
     152options=addfielddefault(options,'axis','equal off');              % default axis
    141153applyoptions(md,data,options);
     154drawnow
  • issm/branches/trunk-jpl-damage/src/m/model/plot/plotdoc.m

    r12194 r12878  
    9494disp('       ''showsection'': show section used by ''sectionvalue'' (string ''on'' or a number of labels)');
    9595disp('       ''sectionvalue'': give the value of data on a profile given by an Argus file (string ''Argusfile_name.exp'')');
     96disp('       ''profile'': give the value of data along a vertical profile ([xlocation ylocation])');
    9697disp('       ''smooth'': smooth element data (string ''yes'' or integer)');
    9798disp('       ''title'': same as standard matlab option');
  • issm/branches/trunk-jpl-damage/src/m/model/plot/plotmodel.m

    r12004 r12878  
    4848                for i=1:numberofplots,
    4949                        plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
    50                         %cbfreeze;
    5150                end
    5251        catch me,
  • issm/branches/trunk-jpl-damage/src/m/model/radarpower.m

    r12197 r12878  
    3737                        error(['radarpower error message: file ' jplsvn() '/projects/ModelData/MOG/mog150_greenland_map.jpg not found.']);
    3838                end
    39                 jpgim=[jplsvn() '/projects/ModelData/MOG/mog150_greenland_map.jpg'];
    40                 geom=load([jplsvn() '/projects/ModelData/MOG/mog150_greenland_map.jpgw'],'ascii');
     39                name = 'mog150_greenland_map';
     40                %name = 'mog100_hp1_v10';
     41                %name = 'mog500_hp1_v10';
     42                jpgim=[jplsvn() '/projects/ModelData/MOG/' name '.jpg'];
     43                geom=load([jplsvn() '/projects/ModelData/MOG/' name '.jpgw'],'ascii');
    4144
    4245                %geom:   xposting nbcols nbrows yposting xmin ymax
    4346                xmin=max(geom(5),x0);
    4447                xmax=min(geom(5)+geom(1)*geom(2),x1);
    45                 ymin=max(geom(6)-geom(4)*geom(3),y0);
     48                ymin=max(geom(6)-geom(3)*geom(4),y0);
    4649                ymax=min(geom(6),y1);
    4750
     
    106109        toplefty=floor((overlay_ylim(2)-y1)/overlay_yposting); % y max
    107110
    108 
    109111        %Read and crop file
    110112        disp('Warning: expecting coordinates in polar stereographic (Std Latitude: 70ºN Meridian: 45º)');
  • issm/branches/trunk-jpl-damage/src/m/model/regionaltransient2d.m

    r10587 r12878  
    106106                        thickness=PatchToVec(md1.results.TransientSolution(t).Thickness);
    107107                        spcx=[spcx InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,vx,md2.mesh.x,md2.mesh.y)];
    108                         spcy=[spcy InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,vx,md2.mesh.x,md2.mesh.y)];
     108                        spcy=[spcy InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,vy,md2.mesh.x,md2.mesh.y)];
    109109                        spct=[spct InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,thickness,md2.mesh.x,md2.mesh.y)];
    110110                        steps=[steps t*md1.timestepping.time_step];
  • issm/branches/trunk-jpl-damage/src/m/model/setmask.m

    r11234 r12878  
    2525elements=md.mesh.elements;
    2626
    27 %Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{1
     27%Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{
    2828elementonfloatingice=FlagElements(md,floatingicename);
    2929elementongroundedice=FlagElements(md,groundedicename);
  • issm/branches/trunk-jpl-damage/src/m/model/setmask.py

    r12168 r12878  
    2222        elements = md.mesh.elements
    2323
    24         #Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{1
     24        #Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{
    2525        elementonfloatingice = fe.FlagElements(md, floatingicename)
    2626        elementongroundedice = fe.FlagElements(md, groundedicename)
  • issm/branches/trunk-jpl-damage/src/m/model/solve.m

    r10969 r12878  
    2424%      md=solve(md,DiagnosticSolutionEnum);
    2525
    26 %recover options
     26%recover and process solve options
    2727options=pairoptions(varargin{:},'solution_type',solutionenum);
    28 
    29 %add default options
    3028options=process_solve_options(options);
    3129
    3230%recover some fields
    3331md.private.solution=options.solution_type;
     32cluster=md.cluster;
    3433
    3534%check model consistency
    3635disp('checking model consistency');
    3736if (solutionenum == FlaimSolutionEnum)
    38         modelconsistency(true);
    39         md.mesh.checkconsistency(md,solutionenum);
    40         md.flaim.checkconsistency(md,solutionenum);
    41         if ~modelconsistency()
    42                 error(' ');
     37        md.private.isconsistent=true;
     38        md=checkconsistency(md.mesh,md,solutionenum);
     39        md=checkconsistency(md.flaim,md,solutionenum);
     40        if md.private.isconsistent==false,
     41                error('Model not consistent, see messages above');
    4342        end
    4443else
     
    4645end
    4746
    48 %if running qmu analysis, some preprocessing of dakota files using
    49 %models fields needs to be carried out.
     47%First, build a runtime name that is unique
     48c=clock;
     49md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
     50
     51%if running qmu analysis, some preprocessing of dakota files using models
     52%fields needs to be carried out.
    5053if md.qmu.isdakota,
    5154        md=preqmu(md,options);
    5255end
    5356
    54 %Save model as is (in case of a crash)
    55 assignin('base',inputname(1),md);
    56 
    5757%flaim analysis
    58 if (md.private.solution == FlaimSolutionEnum)
     58if (options.solution_type == FlaimSolutionEnum)
    5959        md=flaim_sol(md,options);
    6060        md.private.solution=EnumToString(options.solution_type);
     
    6262end
    6363
    64 %Marshall model data into a binary file.
    65 marshall(md);
    66 
    67 %write a template file for issm to use, in parallel
    68 PetscFile(md.solver,[md.miscellaneous.name '.petsc']);
    69 
    70 %If running in parallel, we have a different way of launching the solution
    71 %sequences.
    72 if ~strcmpi(md.cluster.name,'none'),
    73         md=solveparallel(md,options);
     64%Do we load results only?
     65if options.loadonly, 
     66        md=loadresultsfromcluster(md);
    7467        return;
    7568end
    7669
    77 %Launch correct solution sequence
    78 md=issm(md,md.private.solution);
     70%Wite all input files
     71marshall(md);                                          % bin file
     72PetscFile(md.solver,[md.miscellaneous.name '.petsc']); % petsc file
     73BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof); % queue file
     74
     75%we need to make sure we have PETSC support, otherwise, we run with only one cpu:
     76if ~ispetsc,
     77        disp('PETSC support not included, running on 1 cpu only!');
     78        cluster.np=1;
     79end
     80
     81%Stop here if batch mode
     82if strcmpi(options.batch,'yes')
     83        disp('batch mode requested: not launching job interactively');
     84        disp('launch solution sequence on remote cluster by hand');
     85        return;
     86end
     87
     88%Launch job
     89modelname = md.miscellaneous.name;
     90filelist  = {[modelname '.bin '] [modelname '.petsc '] [modelname '.queue ']};
     91if md.qmu.isdakota,
     92        filelist{end+1} = [modelname '.qmu.in'];
     93end
     94LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist);
     95
     96%did we even try to run? if so, wait on lock
     97if strcmpi(options.upload,'on'),
     98        disp('solve done uploading test decks');
     99        return;
     100end
     101
     102%wait on lock
     103if md.settings.waitonlock>0,
     104        %we wait for the done file
     105        islock=waitonlock(md);
     106        if islock==0, %no results to be loaded
     107                disp('The results must be loaded manually with md=loadresultsfromcluster(md).');
     108        else          %load results
     109                disp('loading results from cluster');
     110                md=loadresultsfromcluster(md);
     111        end
     112end
    79113
    80114%post processes qmu results if necessary
    81115if md.qmu.isdakota,
    82         md=postqmu(md);
    83         cd ..
    84116        if ~strncmpi(options.keep,'y',1)
    85117                system(['rm -rf qmu' num2str(feature('GetPid'))]);
    86118        end
    87119end
    88 
    89 %convert analysis type to string finally
    90 md.private.solution=EnumToString(options.solution_type);
  • issm/branches/trunk-jpl-damage/src/m/model/solvers/stokesoptions.m

    r12004 r12878  
    66
    77%retrieve options provided in varargin
    8 arguments=pairoptions(varargin{:});
     8options=pairoptions(varargin{:});
    99stokes=struct();
    1010
  • issm/branches/trunk-jpl-damage/src/m/qmu/preqmu.m

    r9668 r12878  
    4444responses=expandresponses(md,responses);
    4545
    46 %go through variables and responses, and check they don't have more than md.qmu.numberofpartitions values. Also determine numvariables and numresponses{{{1
     46%go through variables and responses, and check they don't have more than md.qmu.numberofpartitions values. Also determine numvariables and numresponses{{{
    4747numvariables=0;
    4848variable_fieldnames=fieldnames(variables);
     
    7676system(['rm -rf ' md.miscellaneous.name '.m']);
    7777
    78 %build a list of variables and responses descriptors. the list is not expanded. {{{1
     78%build a list of variables and responses descriptors. the list is not expanded. {{{
    7979variabledescriptors={};
    8080variable_fieldnames=fieldnames(md.qmu.variables(options.ivar));
  • issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceShelfBC.py

    r12258 r12878  
    1 from numpy import *
     1import os
     2import numpy
     3
    24def SetIceShelfBC(md,icefrontfile=''):
    3         #SETICESHELFBC - Create the boundary conditions for diagnostic and thermal models for a  Ice Shelf with Ice Front
    4         #
    5         #   Neumann BC are used on the ice front (an ANRGUS contour around the ice front
    6         #   must be given in input)
    7         #   Dirichlet BC are used elsewhere for diagnostic
    8         #
    9         #   Usage:
    10         #      md=SetIceShelfBC(md,varargin)
    11         #
    12         #   Example:
    13         #      md=SetIceShelfBC(md);
    14         #      md=SetIceShelfBC(md,'Front.exp');
    15         #
    16         #   See also: SETICESHEETBC, SETMARINEICESHEETBC
     5        """
     6        SETICESHELFBC - Create the boundary conditions for diagnostic and thermal models for a  Ice Shelf with Ice Front
     7         
     8            Neumann BC are used on the ice front (an ANRGUS contour around the ice front
     9            must be given in input)
     10            Dirichlet BC are used elsewhere for diagnostic
     11         
     12            Usage:
     13               md=SetIceShelfBC(md,varargin)
     14         
     15            Example:
     16               md=SetIceShelfBC(md);
     17               md=SetIceShelfBC(md,'Front.exp');
     18         
     19            See also: SETICESHEETBC, SETMARINEICESHEETBC
     20        """
    1721
    1822        #node on Dirichlet (boundary and ~icefront)
    19         if not icefrontfile:
    20                 nodeonicefront=zeros(md.mesh.numberofvertices)
     23        if icefrontfile:
     24                if not os.path.exists(icefrontfile):
     25                        raise IOError("SetIceShelfBC error message: ice front file '%s' not found." % icefrontfile)
     26                nodeinsideicefront=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,icefrontfile,'node',2)
     27                nodeonicefront=double(md.mesh.vertexonboundary and nodeinsideicefront)
    2128        else:
    22                 if not os.path.isfile(icefrontfile):
    23                         print 'SetIceShelfBC error message: ice front file '+icefrontfile+ ' not found'
    24                         return []
    25                 nodeinsideicefront=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,icefrontfile,'node',2)
    26                 nodeonicefront=double(md.mesh.vertexonboundary.astype(bool) and nodeinsideicefront.astype(bool))
    27        
    28         pos=argwhere(logical_and(md.mesh.vertexonboundary.astype(bool),~nodeonicefront.astype(bool)))
    29         md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices);
    30         md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices);
    31         md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices);
    32         md.diagnostic.spcvx[pos]=0;
    33         md.diagnostic.spcvy[pos]=0;
    34         md.diagnostic.spcvz[pos]=0;
    35         md.diagnostic.referential=float('NaN')*ones((md.mesh.numberofvertices,6),float);
     29                nodeonicefront=numpy.zeros(md.mesh.numberofvertices)
     30
     31#       pos=find(md.mesh.vertexonboundary & ~nodeonicefront);
     32        pos=[i for i,(vob,noif) in enumerate(zip(md.mesh.vertexonboundary,nodeonicefront)) if vob and not noif]
     33        md.diagnostic.spcvx=float('NaN')*numpy.ones(md.mesh.numberofvertices)
     34        md.diagnostic.spcvy=float('NaN')*numpy.ones(md.mesh.numberofvertices)
     35        md.diagnostic.spcvz=float('NaN')*numpy.ones(md.mesh.numberofvertices)
     36        md.diagnostic.spcvx[pos]=0
     37        md.diagnostic.spcvy[pos]=0
     38        md.diagnostic.spcvz[pos]=0
     39        md.diagnostic.referential=float('NaN')*numpy.ones((md.mesh.numberofvertices,6))
    3640
    3741        #Dirichlet Values
    38         if ~isnan(md.inversion.vx_obs) and ~isnan(md.inversion.vy_obs):
    39                 if (len(md.inversion.vx_obs)==md.mesh.numberofvertices) and (len(md.inversion.vy_obs)==md.mesh.numberofvertices):
    40                         print '      boundary conditions for diagnostic model: spc set as observed velocities'
    41                         md.diagnostic.spcvx[pos]=md.inversion.vx_obs[pos]
    42                         md.diagnostic.spcvy[pos]=md.inversion.vy_obs[pos]
     42        if numpy.size(md.inversion.vx_obs)==md.mesh.numberofvertices and numpy.size(md.inversion.vy_obs)==md.mesh.numberofvertices:
     43                print '      boundary conditions for diagnostic model: spc set as observed velocities'
     44                md.diagnostic.spcvx[pos]=md.inversion.vx_obs[pos]
     45                md.diagnostic.spcvy[pos]=md.inversion.vy_obs[pos]
    4346        else:
    4447                print '      boundary conditions for diagnostic model: spc set as zero'
     
    4649        #segment on Ice Front
    4750        #segment on Neumann (Ice Front)
    48         segs1=md.mesh.segments[:,0].astype(int)-1
    49         segs2=md.mesh.segments[:,1].astype(int)-1
    50 
    51         pos=argwhere(logical_and(nodeonicefront[segs1].astype(bool),nodeonicefront[segs2].astype(bool)))
    52         if (md.mesh.dimension==2):
    53                 pressureload=md.mesh.segments[pos,:];
     51#       pos=find(nodeonicefront(md.mesh.segments(:,1)) | nodeonicefront(md.mesh.segments(:,2)));
     52        pos=[i for i,(noif1,noif2) in enumerate(zip(nodeonicefront[md.mesh.segments[:,0].astype('int')-1],nodeonicefront[md.mesh.segments[:,1].astype('int')-1])) if noif1 or noif2]
     53        if   md.mesh.dimension==2:
     54                pressureload=md.mesh.segments[pos,:]
    5455        elif md.mesh.dimension==3:
    55                 pressureload_layer=[md.mesh.segments[pos,0:2],md.mesh.segments[pos,1]+md.mesh.numberofvertices2d,md.mesh.segments[pos,0]+md.mesh.numberofvertices2d, md.mesh.segments[pos,2]];
    56                 pressureload=[];
    57                 for i in range(1,md.mesh.numberoflayers-1):
    58                         pressureload=[pressureload ,pressureload_layer1[:,1:4]+(i-1)*md.mesh.numberofvertices2d, pressureload_layer1[:,5]+(i-1)*md.mesh.numberofelements2d ];
     56#               pressureload_layer1=[md.mesh.segments(pos,1:2)  md.mesh.segments(pos,2)+md.mesh.numberofvertices2d  md.mesh.segments(pos,1)+md.mesh.numberofvertices2d  md.mesh.segments(pos,3)];
     57                pressureload_layer1=numpy.concatenate((md.mesh.segments[pos,0:2],md.mesh.segments[pos,1]+md.mesh.numberofvertices2d,md.mesh.segments[pos,0]+md.mesh.numberofvertices2d,md.mesh.segments[pos,2]),axis=1)
     58                pressureload=numpy.zeros((0,5))
     59                for i in xrange(1,md.mesh.numberoflayers):
     60#                       pressureload=[pressureload ;pressureload_layer1(:,1:4)+(i-1)*md.mesh.numberofvertices2d pressureload_layer1(:,5)+(i-1)*md.mesh.numberofelements2d ];
     61                        pressureload=numpy.concatenate((pressureload,numpy.concatenate((pressureload_layer1[:,0:3]+(i-1)*md.mesh.numberofvertices2d,pressureload_layer1[:,4]+(i-1)*md.mesh.numberofelements2d),axis=1)),axis=0)
    5962
    6063        #Add water or air enum depending on the element
    61         pressureload=[pressureload, 1*md.mask.elementonfloatingice(pressureload[:,end])];
     64#       pressureload=[pressureload 1*md.mask.elementonfloatingice(pressureload(:,end))];
     65        pressureload=numpy.concatenate((pressureload,1*md.mask.elementonfloatingice[pressureload[:,-1].astype('int')-1].reshape((-1,1))),axis=1)
    6266
    6367        #plug onto model
    64         md.diagnostic.icefront=pressureload;
     68        md.diagnostic.icefront=pressureload
    6569
    6670        #Create zeros basalforcings and surfaceforcings
    67         if isnan(md.surfaceforcings.precipitation):
    68                 md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices);
     71        if numpy.isnan(md.surfaceforcings.precipitation).all():
     72                md.surfaceforcings.precipitation=numpy.zeros(md.mesh.numberofvertices)
    6973                print '      no surfaceforcings.precipitation specified: values set as zero'
    70         if isnan(md.surfaceforcings.mass_balance):
    71                 md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices);
     74        if numpy.isnan(md.surfaceforcings.mass_balance).all():
     75                md.surfaceforcings.mass_balance=numpy.zeros(md.mesh.numberofvertices)
    7276                print '      no surfaceforcings.mass_balance specified: values set as zero'
    73         if isnan(md.basalforcings.melting_rate):
    74                 md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices)
     77        if numpy.isnan(md.basalforcings.melting_rate).all():
     78                md.basalforcings.melting_rate=numpy.zeros(md.mesh.numberofvertices)
    7579                print '      no basalforcings.melting_rate specified: values set as zero'
    76         if isnan(md.balancethickness.thickening_rate):
    77                 md.balancethickness.thickening_rate=zeros(md.mesh.numberofvertices);
     80        if numpy.isnan(md.balancethickness.thickening_rate).all():
     81                md.balancethickness.thickening_rate=numpy.zeros(md.mesh.numberofvertices)
    7882                print '      no balancethickness.thickening_rate specified: values set as zero'
    7983
    80         md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices);
    81         md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices);
     84        md.prognostic.spcthickness=float('NaN')*numpy.ones(md.mesh.numberofvertices)
     85        md.balancethickness.spcthickness=float('NaN')*numpy.ones(md.mesh.numberofvertices)
    8286
    83         if (len(md.initialization.temperature)==md.mesh.numberofvertices):
    84                 md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices);
    85                 pos=argwhere(md.mesh.vertexonsurface); md.thermal.spctemperature[pos]=md.initialization.temperature[pos]; #impose observed temperature on surface
    86                 if (len(md.basalforcings.geothermalflux) !=md.mesh.numberofvertices):
    87                         md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices);
     87        if numpy.size(md.initialization.temperature)==md.mesh.numberofvertices:
     88                md.thermal.spctemperature=float('NaN')*numpy.ones(md.mesh.numberofvertices)
     89#               pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
     90                pos=[i for i,vos in enumerate(md.mesh.vertexonsurface) if vos]
     91                md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    # impose observed temperature on surface
     92                if not numpy.size(md.basalforcings.geothermalflux)==md.mesh.numberofvertices:
     93                        md.basalforcings.geothermalflux=numpy.zeros(md.mesh.numberofvertices)
    8894        else:
    8995                print '      no thermal boundary conditions created: no observed temperature found'
    9096
    9197        return md
     98
  • issm/branches/trunk-jpl-damage/src/m/utils/Basins/isbasin.m

    r7140 r12878  
    99
    1010%First, load basin names:
    11 load([issmdir '/projects/ModelData/Names/Names.mat']);
     11load([jplsvn '/projects/ModelData/Names/Names.mat']);
    1212
    1313
  • issm/branches/trunk-jpl-damage/src/m/utils/Exp/expcoarsen.m

    r1264 r12878  
    2626%Get exp oldfile
    2727[path root ext ver]=fileparts(oldfile);
    28 A=expread(oldfile,1);
     28A=expread(oldfile);
    2929numprofiles=size(A,2);
    3030
  • issm/branches/trunk-jpl-damage/src/m/utils/Exp/expcontract.m

    r8298 r12878  
    88
    99
    10 contour=expread(oldfile,1);
     10contour=expread(oldfile);
    1111num=numel(contour.x);
    1212
  • issm/branches/trunk-jpl-damage/src/m/utils/Exp/manipulation/cutarea.m

    r8662 r12878  
    8787                                                                        A(selection).x=x(1:p1);
    8888                                                                        A(selection).y=y(1:p1);
     89                                                                        closed(selection)=0;
    8990                                                                        A(end+1).x=x(p2:end);
    9091                                                                        A(end).y=y(p2:end);
    9192                                                                        A(end).density=A(selection).density;
    9293                                                                        A(end).name=A(selection).name;
     94                                                                        closed(end+1)=0;
    9395                                                                        numprofiles=numprofiles+1;
    9496                                                                        numpoints=numpoints-(p2-p1-1);
     
    113115                                                                else
    114116                                                                        %cut in 2 profiles
     117                                                                        closed(selection)=0;
    115118                                                                        A(selection).x=x(1:p2);
    116119                                                                        A(selection).y=y(1:p2);
     
    119122                                                                        A(end).density=A(selection).density;
    120123                                                                        A(end).name=A(selection).name;
     124                                                                        closed(end+1)=0;
    121125                                                                        numprofiles=numprofiles+1;
    122126                                                                        numpoints=numpoints-(p1-p2-1);
  • issm/branches/trunk-jpl-damage/src/m/utils/Geometry/find_point.m

    r1 r12878  
    88%      f=find_point(tabx,taby,pointx,pointy)
    99
     10%Compute distance between point and cloud of points
    1011distance=sqrt((tabx-pointx).^2+(taby-pointy).^2);
    11 f=find(distance==min(min(distance)));
     12
     13%find index of the minimum distance and return the first one only
     14f=find(distance==min(min(distance)),1);
  • issm/branches/trunk-jpl-damage/src/m/utils/Kml/exp2kml.m

    r7148 r12878  
    88
    99%First, read exp file
    10 domain=expread(input,1);
     10domain=expread(input);
    1111
    1212
  • issm/branches/trunk-jpl-damage/src/m/utils/Miscellaneous/issmdoc.m

    r12168 r12878  
    99disp(sprintf('%s','        md=model;                                %creates a new empty model structure'));
    1010disp(sprintf('%s','        md=triangle(md,''DomainOutline.exp'',50000);   %creates a mesh of the domain outline with a resolution of 50000m'));
    11 disp(sprintf('%s','        md=geography(md,''all'','''');               %defines the glacier system as an ice shelf (no island)'));
     11disp(sprintf('%s','        md=setmask(md,''all'','''');               %defines the glacier system as an ice shelf (no island)'));
    1212disp(sprintf('%s','        md=parameterize(md,''Square.par'');        %fills all the other fields of the model'));
    13 disp(sprintf('%s','        md=setelementstype(md,''macayeal'',''all''); %defines all elements as MacAyeal''s'));
     13disp(sprintf('%s','        md=setflowequation(md,''macayeal'',''all''); %defines all elements as MacAyeal''s'));
    1414disp(sprintf('%s','        md=solve(md,DiagnosticSolutionEnum);   %generate the velocity field'));
    1515disp(sprintf('%s','        plotmodel(md,''data'',md.results.DiagnosticSolution.Vel);    %displays the velocity (type plotdoc for plotmodel help)'));
  • issm/branches/trunk-jpl-damage/src/m/utils/Model/loadmodel.m

    r10184 r12878  
    1212        error('loadmodel usage error: md=loadmodel(path)');
    1313end
     14
    1415%check existence
    15 if ~exist(path)
     16if exist(path,'file')
     17        %do nothing
     18elseif exist([path '.mat'],'file')
     19        %add extension
     20        path = [path '.mat'];
     21else
    1622        error(['loadmodel error message: file ' path ' does not exist']);
    1723end
  • issm/branches/trunk-jpl-damage/src/m/utils/Numerics/cfl_step.m

    r12004 r12878  
    88%
    99%   Example:
    10 %      dt=cfl_step(md,md,md.results.DiagnosticSolution.Vx,md.results.DiagnosticSolution.Vy)
     10%      dt=cfl_step(md,md.results.DiagnosticSolution.Vx,md.results.DiagnosticSolution.Vy)
    1111
    1212%Check length of velocities
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpin.m

    r12168 r12878  
    3535                [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]');
    3636                if status,
    37                         error('scpin error message: could not find ISSM_DIR_WIN envirnoment variable');
     37                        error('scpin error message: could not find ISSM_DIR_WIN environment variable');
    3838                end
    3939                ISSM_DIR=ISSM_DIR(2:end-2);
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpout.m

    r12168 r12878  
    2626                [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]');
    2727                if status,
    28                         error('scpout error message: could not find ISSM_DIR_WIN envirnoment variable');
     28                        error('scpout error message: could not find ISSM_DIR_WIN environment variable');
    2929                end
    3030                ISSM_DIR=ISSM_DIR(2:end-2);
  • issm/branches/trunk-jpl-damage/src/m/utils/OS/issmssh.m

    r12168 r12878  
    1818                [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]');
    1919                if status,
    20                         error('issmssh error message: could not find ISSM_DIR_WIN envirnoment variable');
     20                        error('issmssh error message: could not find ISSM_DIR_WIN environment variable');
    2121                end
    2222                ISSM_DIR=ISSM_DIR(2:end-2);
  • issm/branches/trunk-jpl-damage/src/m/utils/consistency/checkfield.m

    r11264 r12878  
    1 function checkfield(md,fieldname,varargin)
     1function md = checkfield(md,fieldname,varargin)
    22%CHECKFIELD - check field consistency
    33%
     
    1919%
    2020%   Usage:
    21 %      checkfield(md,fieldname,options);
     21%      md = checkfield(md,fieldname,options);
    2222%
    2323%   Example:
    24 %      checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
    25 %      checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
    26 %      checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
     24%      md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
     25%      md = checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
     26%      md = checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
    2727
    2828%get options
     
    3535if exist(options,'empty')
    3636        if isempty(field),
    37                 checkmessage(getfieldvalue(options,'message',...
     37                md = checkmessage(md,getfieldvalue(options,'message',...
    3838                        ['field ''' fieldname ''' is empty']));
    3939        end
     
    4545        if isnan(fieldsize(1)),
    4646                if (size(field,2)~=fieldsize(2)),
    47                         checkmessage(getfieldvalue(options,'message',...
     47                        md = checkmessage(md,getfieldvalue(options,'message',...
    4848                                ['field ''' fieldname ''' should have ' num2str(fieldsize(2)) ' columns']));
    4949                end
    5050        elseif isnan(fieldsize(2)),
    5151                if (size(field,1)~=fieldsize(1)),
    52                         checkmessage(getfieldvalue(options,'message',...
     52                        md = checkmessage(md,getfieldvalue(options,'message',...
    5353                                ['field ''' fieldname ''' should have ' num2str(fieldsize(1)) ' lines']));
    5454                end
    5555        else
    56                 if ((size(field)~=fieldsize(1)) |  (size(field,2)~=fieldsize(2)))
    57                         checkmessage(getfieldvalue(options,'message',...
     56                if ((size(field,1)~=fieldsize(1)) |  (size(field,2)~=fieldsize(2)))
     57                        md = checkmessage(md,getfieldvalue(options,'message',...
    5858                                ['field ''' fieldname ''' size should be ' num2str(fieldsize(1)) ' x ' num2str(fieldsize(2))]));
    5959                end
     
    6666        if ~ismember(numel(field),fieldnumel),
    6767                if length(fieldnumel)==1
    68                         checkmessage(getfieldvalue(options,'message',...
     68                        md = checkmessage(md,getfieldvalue(options,'message',...
    6969                                ['field ''' fieldname ''' size should be ' sprintf('%g ',fieldnumel) ]));
    7070                elseif length(fieldnumel)==2
    71                         checkmessage(getfieldvalue(options,'message',...
     71                        md = checkmessage(md,getfieldvalue(options,'message',...
    7272                                ['field ''' fieldname ''' size should be ' num2str(fieldnumel(1)) ' or ' num2str(fieldnumel(2)) ]));
    7373                else
    74                         checkmessage(getfieldvalue(options,'message',...
     74                        md = checkmessage(md,getfieldvalue(options,'message',...
    7575                                ['field ''' fieldname ''' size should be ' sprintf('%g, ',fieldnumel(1:end-1)) ' or ' num2str(fieldnumel(end)) ]));
    7676                end
     
    8282        field2=reshape(field,prod(size(field)),1);
    8383        if any(isnan(field2)),
    84                 checkmessage(getfieldvalue(options,'message',...
     84                md = checkmessage(md,getfieldvalue(options,'message',...
    8585                        ['NaN values found in field ''' fieldname '''']));
    8686        end
    8787end
    8888
    89 %check NaN
     89%check cell
    9090if getfieldvalue(options,'cell',0);
    9191        if ~iscell(field),
    92                 checkmessage(getfieldvalue(options,'message',...
     92                md = checkmessage(md,getfieldvalue(options,'message',...
    9393                        ['field ''' fieldname ''' should be a cell']));
    9494        end
     
    9999        fieldvalues=getfieldvalue(options,'values');
    100100        if iscell(fieldvalues), %strings
    101         if ischar(field) | iscell(fieldvalues),
    102                 if any(~ismember(field,fieldvalues)),
    103                         if length(fieldvalues)==1
    104                                 checkmessage(getfieldvalue(options,'message',...
    105                                         ['field ''' fieldname ''' value should be ' fieldvalues{1} ]));
    106                         elseif length(fieldvalues)==2
    107                                 checkmessage(getfieldvalue(options,'message',...
    108                                         ['field ''' fieldname ''' values should be ' fieldvalues{1} ' or ' fieldvalues{2} ]));
    109                         else
    110                                 checkmessage(getfieldvalue(options,'message',...
    111                                         ['field ''' fieldname ''' should have values in ' sprintf('''%s'', ',fieldvalues{1:end-1}) 'or ''' fieldvalues{end} '''']));
     101                if ischar(field) | iscell(fieldvalues),
     102                        if any(~ismember(field,fieldvalues)),
     103                                if length(fieldvalues)==1
     104                                        md = checkmessage(md,getfieldvalue(options,'message',...
     105                                                ['field ''' fieldname ''' value should be ''' fieldvalues{1} '''']));
     106                                elseif length(fieldvalues)==2
     107                                        md = checkmessage(md,getfieldvalue(options,'message',...
     108                                                ['field ''' fieldname ''' values should be ''' fieldvalues{1} ''' or ''' fieldvalues{2} '''']));
     109                                else
     110                                        md = checkmessage(md,getfieldvalue(options,'message',...
     111                                                ['field ''' fieldname ''' should have values in ' sprintf('''%s'', ',fieldvalues{1:end-1}) 'or ''' fieldvalues{end} '''']));
     112                                end
    112113                        end
     114                else
     115                        md = checkmessage(md,getfieldvalue(options,'message',...
     116                                ['field ''' fieldname ''' should be one of the following strings: ' sprintf('''%s'', ',fieldvalues{1:end-1}) 'or ''' fieldvalues{end} '''']));
    113117                end
    114118        else
    115                 checkmessage(getfieldvalue(options,'message',...
    116                         ['field ''' fieldname ''' should be one of the following strings: ' sprintf('''%s'', ',fieldvalues{1:end-1}) 'or ''' fieldvalues{end} '''']));
    117         end
    118 else
    119         field2=reshape(field,prod(size(field)),1);
    120         if isnumeric(field),
    121                 if any(~ismember(field2,fieldvalues)),
    122                         checkmessage(getfieldvalue(options,'message',...
    123                                 ['field ''' fieldname ''' should have values in [' num2str(fieldvalues) ']']));
     119                field2=reshape(field,prod(size(field)),1);
     120                if isnumeric(field),
     121                        if any(~ismember(field2,fieldvalues)),
     122                                md = checkmessage(md,getfieldvalue(options,'message',...
     123                                        ['field ''' fieldname ''' should have values in [' num2str(fieldvalues) ']']));
     124                        end
     125                else
     126                        md = checkmessage(md,getfieldvalue(options,'message',...
     127                                ['field ''' fieldname ''' should be a number in [' num2str(fieldvalues) ']']));
    124128                end
    125         else
    126                 checkmessage(getfieldvalue(options,'message',...
    127                         ['field ''' fieldname ''' should be a number in [' num2str(fieldvalues) ']']));
    128         end
    129129        end
    130130end
     
    135135        field2=reshape(field,prod(size(field)),1);
    136136        if any(field2<lowerbound),
    137                 checkmessage(getfieldvalue(options,'message',...
     137                md = checkmessage(md,getfieldvalue(options,'message',...
    138138                        ['field ''' fieldname ''' should have values above ' num2str(lowerbound)]));
    139139        end
     
    143143        field2=reshape(field,prod(size(field)),1);
    144144        if any(field2<=lowerbound),
    145                 checkmessage(getfieldvalue(options,'message',...
     145                md = checkmessage(md,getfieldvalue(options,'message',...
    146146                        ['field ''' fieldname ''' should have values above ' num2str(lowerbound)]));
    147147        end
     
    153153        field2=reshape(field,prod(size(field)),1);
    154154        if any(field2>upperbound),
    155                 checkmessage(getfieldvalue(options,'message',...
     155                md = checkmessage(md,getfieldvalue(options,'message',...
    156156                        ['field ''' fieldname ''' should have values below ' num2str(upperbound)]));
    157157        end
     
    161161        field2=reshape(field,prod(size(field)),1);
    162162        if any(field2>=upperbound),
    163                 checkmessage(getfieldvalue(options,'message',...
    164                         ['field ''' fieldname ''' should have values below ' num2str(upperbound(1))]));
     163                md = checkmessage(md,getfieldvalue(options,'message',...
     164                        ['field ''' fieldname ''' should have values below ' num2str(upperbound)]));
    165165        end
    166166end
     
    169169if getfieldvalue(options,'file',0),
    170170        if ~exist(field,'file')
    171                 checkmessage(['file profided in ''' fieldname ''': ''' field ''' does not exist']);
     171                md = checkmessage(md,['file provided in ''' fieldname ''': ''' field ''' does not exist']);
    172172        end
    173173end
     
    177177        if size(field,1)==md.mesh.numberofvertices,
    178178                if ~size(field,2)==1,
    179                         checkmessage(getfieldvalue(options,'message',...
     179                        md = checkmessage(md,getfieldvalue(options,'message',...
    180180                                ['field ''' fieldname ''' should have only one column as there are md.mesh.numberofvertices lines']));
    181181                end
    182182        elseif size(field,1)==md.mesh.numberofvertices+1
    183183                if any(field(end,:)~=sort(field(end,:))),
    184                         checkmessage(getfieldvalue(options,'message',...
    185                                 ['field ''' fieldname ''' columns should be chronological']));
     184                        md = checkmessage(md,getfieldvalue(options,'message',...
     185                                ['field ''' fieldname ''' columns should be sorted chronologically']));
    186186                end
    187187                if any(field(end,1:end-1)==field(end,2:end)),
    188                         checkmessage(getfieldvalue(options,'message',...
     188                        md = checkmessage(md,getfieldvalue(options,'message',...
    189189                                ['field ''' fieldname ''' columns must not contain duplicate timesteps']));
    190190                end
    191191        else
    192                 checkmessage(getfieldvalue(options,'message',...
     192                md = checkmessage(md,getfieldvalue(options,'message',...
    193193                        ['field ''' fieldname ''' should have md.mesh.numberofvertices or md.mesh.numberofvertices+1 lines']));
    194194        end
  • issm/branches/trunk-jpl-damage/src/modules/AverageFilter/AverageFilter.cpp

    r11933 r12878  
    5353void AverageFilterUsage(void)
    5454{
    55         printf("   AverageFilter usage:\n");
    56         printf("   [image_out]=AverageFilter(image_in,pixels);\n\n");
    57         printf("   where:\n");
    58         printf("      image_in in double format\n");
    59         printf("      pixels: characteristic size of smoothing\n");
    60         printf("      image_out in double format\n");
    61         printf("\n");
     55        _printLine_("   AverageFilter usage:");
     56        _printLine_("   [image_out]=AverageFilter(image_in,pixels);\n");
     57        _printLine_("   where:");
     58        _printLine_("      image_in in double format");
     59        _printLine_("      pixels: characteristic size of smoothing");
     60        _printLine_("      image_out in double format");
     61        _printLine_("");
    6262}
  • issm/branches/trunk-jpl-damage/src/modules/BamgConvertMesh/BamgConvertMesh.cpp

    r12044 r12878  
    44#include "./BamgConvertMesh.h"
    55
    6 void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
     6void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
    77
    88        /*input: */
    9         double* index=NULL;
    10         int     index_rows;
    11         double* x=NULL;
    12         int     x_cols;
    13         double* y=NULL;
    14         int     y_rows;
    15         int     y_cols;
     9        int    *index      = NULL;
     10        double *x          = NULL;
     11        double *y          = NULL;
     12        int     nods,nels,test1,test2;
    1613
    1714        /*Output*/
    18         BamgMesh* bamgmesh=NULL;
    19         BamgGeom* bamggeom=NULL;
    20         mxArray* bamgmesh_mat=NULL;
    21         mxArray* bamggeom_mat=NULL;
    22 
    23         /*Intermediary*/
    24         int nods;
    25         int nels;
    26         int verbose=0;
     15        BamgMesh *bamgmesh     = NULL;
     16        BamgGeom *bamggeom     = NULL;
     17        mxArray  *bamgmesh_mat = NULL;
     18        mxArray  *bamggeom_mat = NULL;
    2719
    2820        /*Boot module: */
     
    3729
    3830        /*Input datasets: */
    39         if (verbose) printf("Fetching inputs\n");
    40         FetchData(&index,&nels,&index_rows,INDEXHANDLE);
    41         FetchData(&x,&nods,&x_cols,XHANDLE);
    42         FetchData(&y,&y_rows,&y_cols,YHANDLE);
     31        FetchData(&index,&nels,&test1,INDEXHANDLE);
     32        FetchData(&x,&nods,XHANDLE);
     33        FetchData(&y,&test2,YHANDLE);
    4334
    4435        /*Check inputs*/
    45         if (nels<0){
    46                 _error_("Number of elements must be positive, check index number of lines");
    47         }
    48         if (nods<0){
    49                 _error_("Number of nods must be positive, check x and y sizes");
    50         }
    51         if (index_rows!=3){
    52                 _error_("index should have 3 columns");
    53         }
    54         if (y_rows!=nods){
    55                 _error_("x and y do not have the same length");
    56         }
    57         if (x_cols>1 || y_cols>1){
    58                 _error_("x and y should have only one column");
    59         }
     36        if(nels<0) _error2_("Number of elements must be positive, check index number of lines");
     37        if(nods<0) _error2_("Number of nods must be positive, check x and y sizes");
     38        if(test1!=3) _error2_("index should have 3 columns");
     39        if(test2!=nods) _error2_("x and y do not have the same length");
    6040
    6141        /* Run core computations: */
    62         if (verbose) printf("Call core\n");
    6342        BamgConvertMeshx(bamgmesh,bamggeom,index,x,y,nods,nels);
    6443
     
    7554}
    7655
    77 void BamgConvertMeshUsage(void)
    78 {
    79         _printf_(true,"BAMGCONVERTMESH - convert [x y index] to a bamg geom and mesh geom");
    80         _printf_(true,"\n");
    81         _printf_(true,"   Usage:\n");
    82         _printf_(true,"      [bamggeom bamgmesh]=BamgConvertMesh(index,x,y);\n");
    83         _printf_(true,"      index: index of the mesh\n");
    84         _printf_(true,"      x,y: coordinates of the nodes\n");
    85         _printf_(true,"\n");
     56void BamgConvertMeshUsage(void){
     57        _pprintString_("BAMGCONVERTMESH - convert [x y index] to a bamg geom and mesh geom");
     58        _pprintLine_("");
     59        _pprintLine_("   Usage:");
     60        _pprintLine_("      [bamggeom bamgmesh]=BamgConvertMesh(index,x,y);");
     61        _pprintLine_("      index: index of the mesh");
     62        _pprintLine_("      x,y: coordinates of the nodes");
     63        _pprintLine_("");
    8664}
  • issm/branches/trunk-jpl-damage/src/modules/BamgMesher/BamgMesher.cpp

    r12054 r12878  
    5151
    5252void BamgMesherUsage(void){
    53         _printf_(true,"\n");
    54         _printf_(true,"   usage: [bamgmesh,bamggeom]=%s(bamgmesh,bamggeom,bamgoptions);\n",__FUNCT__);
    55         _printf_(true,"\n");
     53        _pprintLine_("");
     54        _pprintLine_("   usage: [bamgmesh,bamggeom]=" << __FUNCT__ << "(bamgmesh,bamggeom,bamgoptions);");
     55        _pprintLine_("");
    5656}
  • issm/branches/trunk-jpl-damage/src/modules/BamgTriangulate/BamgTriangulate.cpp

    r11933 r12878  
    2727
    2828        /*Input datasets: */
    29         if (verbose) printf("Fetching inputs\n");
     29        if (verbose) _printLine_("Fetching inputs");
    3030        FetchData(&x,&nods,&x_cols,XHANDLE);
    3131        FetchData(&y,&y_rows,&y_cols,YHANDLE);
    3232
    3333        /*Check inputs*/
    34         if(y_rows!=nods)         _error_("x and y do not have the same length");
    35         if(x_cols>1 || y_cols>1) _error_("x and y should have only one column");
    36         if(nods<3)               _error_("At least 3 points are required");
     34        if(y_rows!=nods)         _error2_("x and y do not have the same length");
     35        if(x_cols>1 || y_cols>1) _error2_("x and y should have only one column");
     36        if(nods<3)               _error2_("At least 3 points are required");
    3737
    3838        /* Run core computations: */
    39         if (verbose) printf("Call core\n");
     39        if (verbose) _printLine_("Call core");
    4040        BamgTriangulatex(&index,&nels,x,y,nods);
    4141
     
    4949void BamgTriangulateUsage(void)
    5050{
    51         _printf_(true,"BAMGTRIANGULATE - Delaunay Triangulation of a list of points");
    52         _printf_(true,"\n");
    53         _printf_(true,"   Usage:\n");
    54         _printf_(true,"      index=BamgTriangulate(x,y);\n");
    55         _printf_(true,"      index: index of the triangulation\n");
    56         _printf_(true,"      x,y: coordinates of the nodes\n");
    57         _printf_(true,"\n");
     51        _pprintString_("BAMGTRIANGULATE - Delaunay Triangulation of a list of points");
     52        _pprintLine_("");
     53        _pprintLine_("   Usage:");
     54        _pprintLine_("      index=BamgTriangulate(x,y);");
     55        _pprintLine_("      index: index of the triangulation");
     56        _pprintLine_("      x,y: coordinates of the nodes");
     57        _pprintLine_("");
    5858}
  • issm/branches/trunk-jpl-damage/src/modules/Chaco/Chaco.cpp

    r12068 r12878  
    4242
    4343        #ifndef _HAVE_CHACO_ //only works if dakota library has been compiled in.
    44         _error_(" Chaco not available! Cannot carry out Chaco partitioning!");
     44        _error2_("Chaco not available! Cannot carry out Chaco partitioning!");
    4545        #endif
    4646
     
    8282        /*Some debugging print: {{{*/
    8383        #ifdef _DEBUG_
    84         printf("nvtxs: %i\n",nvtxs);
    85         printf("options: [");
    86         for(i=0;i<10;i++)printf("%g|",options[i]);
    87         printf("]\n");
    88         printf("start: \n");
    89         for (i=0; i<nvtxs+1;i++)printf("%i ",start[i]);
    90         printf("\n");
    91         printf("adjacency: \n");
    92         for (i=0; i<mxGetNzmax(A_IN);i++)printf("%i ",adjacency[i]);
    93         printf("\n");
    94         printf("nedges: %i %p\n",nedges,ewgts);
    95         if(ewgts) for (i = 0; i < nedges; i++)printf("%g ",ewgts[i]);
    96         printf("\n");
    97         printf("vwgts:\n");
    98         for (i = 0; i < nvtxs; i++)printf("%g ",vwgts[i]);
    99         printf("\n");
    100         printf("nparts: %i\n",nparts[0]);
    101         printf("goal: %p\n",goal);
     84        _printLine_("nvtxs: " << nvtxs);
     85        _printString_("options: [");
     86        for(i=0;i<10;i++)_printString_(options[i] << "|");
     87        _printLine_("]");
     88        _printLine_("start: ");
     89        for (i=0; i<nvtxs+1;i++)_printString_(start[i] << " ");
     90        _printLine_("");
     91        _printLine_("adjacency: ");
     92        for (i=0; i<mxGetNzmax(A_IN);i++)_printString_("" <<adjacency[i]<< " ");i++)
     93        _printLine_("");
     94        _printLine_("nedges: " << nedges << " " << ewgts);
     95        if(ewgts) for (i = 0; i < nedges; i++)_printString_(ewgts[i] << " ");
     96        _printLine_("");
     97        _printLine_("vwgts:");
     98        for (i = 0; i < nvtxs; i++)_printString_(vwgts[i] << " ");
     99        _printLine_("");
     100        _printLine_("nparts: " << nparts[0]);
     101        _printLine_("goal: " << goal);
    102102        #endif
    103103        /*}}}*/
     
    132132
    133133void ChacoUsage(void){
    134         _printf_(true,"\n");
    135         _printf_(true,"Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);\n");
    136         _printf_(true,"\n");
     134        _pprintLine_("");
     135        _pprintLine_("Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);");
     136        _pprintLine_("");
    137137}
  • issm/branches/trunk-jpl-damage/src/modules/ContourToMesh/ContourToMesh.cpp

    r12127 r12878  
    4747        if(nlhs!=1 && nlhs!=2){
    4848                ContourToMeshUsage();
    49                 _error_(" usage. See above");
     49                _error2_("usage. See above");
    5050        }
    5151        #endif
     
    5353        if(nrhs!=NRHS){
    5454                ContourToMeshUsage();
    55                 _error_(" usage. See above");
     55                _error2_("usage. See above");
    5656        }
    5757
     
    8282                WriteData(PLHS1,in_elem);
    8383        }
    84         else _error_(" wrong interpolation type");
     84        else _error2_("wrong interpolation type");
    8585
    8686        /*end module: */
     
    9191void ContourToMeshUsage(void)//{{{1
    9292{
    93         printf("CONTOURTOMESH - Flag the elements or nodes inside a contour\n");
    94         printf("\n");
    95         printf("      Usage: \n");
    96         printf("         [in_nod,in_elem]=ContourToMesh(index,x,y,contourname,interptype,edgevalue)\n\n");
    97         printf("\n");
    98         printf("         index,x,y: mesh triangulation.\n");
    99         printf("         contourname: name of .exp file containing the contours.\n");
    100         printf("         interptype: string definining type of interpolation ('element', or 'node').\n");
    101         printf("         edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.\n");
    102         printf("         in_nod: vector of flags (0 or 1), of size nods if interptype is set to 'node' or 'element and node', \n");
    103         printf("            or of size 0 otherwise.\n");
    104         printf("         in_elem: vector of flags (0 or 1), of size nel if interptype is set to 'element' or 'element and node', \n");
    105         printf("            or of size 0 otherwise.\n");
    106         printf("\n");
    107         printf("      Example: \n");
    108         printf("         in_nod=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','node',1)\n");
    109         printf("         in_elements=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element',0)\n");
    110         printf("         [in_nodes,in_elements]=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element and node',0)\n");
    111         printf("\n");
     93        _printLine_("CONTOURTOMESH - Flag the elements or nodes inside a contour");
     94        _printLine_("");
     95        _printLine_("      Usage: ");
     96        _printLine_("         [in_nod,in_elem]=ContourToMesh(index,x,y,contourname,interptype,edgevalue)\n");
     97        _printLine_("");
     98        _printLine_("         index,x,y: mesh triangulation.");
     99        _printLine_("         contourname: name of .exp file containing the contours.");
     100        _printLine_("         interptype: string definining type of interpolation ('element', or 'node').");
     101        _printLine_("         edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.");
     102        _printLine_("         in_nod: vector of flags (0 or 1), of size nods if interptype is set to 'node' or 'element and node', ");
     103        _printLine_("            or of size 0 otherwise.");
     104        _printLine_("         in_elem: vector of flags (0 or 1), of size nel if interptype is set to 'element' or 'element and node', ");
     105        _printLine_("            or of size 0 otherwise.");
     106        _printLine_("");
     107        _printLine_("      Example: ");
     108        _printLine_("         in_nod=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','node',1)");
     109        _printLine_("         in_elements=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element',0)");
     110        _printLine_("         [in_nodes,in_elements]=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element and node',0)");
     111        _printLine_("");
    112112}
    113113//}}}
  • issm/branches/trunk-jpl-damage/src/modules/ContourToNodes/ContourToNodes.cpp

    r12060 r12878  
    8282        /* Debugging of contours :{{{1*/
    8383        /*for(i=0;i<numcontours;i++){
    84                 printf("\nContour echo: contour number  %i / %i\n",i+1,numcontours);
     84                _printLine_("\nContour echo: contour number  " << i+1 << " / " << numcontours);
    8585                contouri=*(contours+i);
    86                 printf("   Number of nodes %i\n",contouri->nods);
     86                _printLine_("   Number of nodes " << contouri->nods);
    8787                for (j=0;j<contouri->nods;j++){
    88                         printf("   %lf %lf\n",*(contouri->x+j),*(contouri->y+j));
     88                        _printLine_("   " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f");
    8989                }
    9090        }*/
     
    103103
    104104void ContourToNodesUsage(void){
    105         printf("   usage:\n");
    106         printf("   [flags]=ContourToNodes(x,y,contourname,edgevalue);\n\n");
    107         printf("   where:\n");
    108         printf("      x,y: list of nodes.\n");
    109         printf("      contourname: name of .exp file containing the contours, or resulting structure from call to expread.\n");
    110         printf("      interptype: string definining type of interpolation ('element', or 'node').\n");
    111         printf("      edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.\n");
    112         printf("      flags: vector of flags (0 or 1), of size nods.\n");
    113         printf("\n");
     105        _printLine_("   usage:");
     106        _printLine_("   [flags]=ContourToNodes(x,y,contourname,edgevalue);\n");
     107        _printLine_("   where:");
     108        _printLine_("      x,y: list of nodes.");
     109        _printLine_("      contourname: name of .exp file containing the contours, or resulting structure from call to expread.");
     110        _printLine_("      interptype: string definining type of interpolation ('element', or 'node').");
     111        _printLine_("      edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.");
     112        _printLine_("      flags: vector of flags (0 or 1), of size nods.");
     113        _printLine_("");
    114114}
  • issm/branches/trunk-jpl-damage/src/modules/ElementConnectivity/ElementConnectivity.cpp

    r12112 r12878  
    3737
    3838void ElementConnectivityUsage(void) {
    39         _printf_(true,"\n");
    40         _printf_(true,"   usage: elementconnectivity = %s(elements, nodeconnectivity);\n",__FUNCT__);
    41         _printf_(true,"\n");
     39        _pprintLine_("");
     40        _pprintLine_("   usage: elementconnectivity = " << __FUNCT__ << "(elements, nodeconnectivity);");
     41        _pprintLine_("");
    4242}
  • issm/branches/trunk-jpl-damage/src/modules/EnumToString/EnumToString.cpp

    r11933 r12878  
    1212        /*checks on arguments on the matlab side: */
    1313        if(nrhs!=NRHS){
    14                 EnumToStringUsage(); _error_(" usage. See above");
     14                EnumToStringUsage(); _error2_("usage. See above");
    1515        }
    1616
     
    2727void EnumToStringUsage(void)
    2828{
    29         _printf_(true,"\n");
    30         _printf_(true,"   usage: %sstring = EnumToString(enum);\n",__FUNCT__);
    31         _printf_(true,"\n");
     29        _pprintLine_("");
     30        _pprintLine_("   usage: " << __FUNCT__ << "string = EnumToString(enum);");
     31        _pprintLine_("");
    3232}
  • issm/branches/trunk-jpl-damage/src/modules/Exp2Kml/Exp2Kml.cpp

    r12049 r12878  
    2525        /*checks on arguments on the matlab side: */
    2626        if (nlhs > NLHS) {
    27                 Exp2KmlUsage(); _error_("Exp2Kml usage error");
     27                Exp2KmlUsage(); _error2_("Exp2Kml usage error");
    2828        }
    2929        if (nrhs < NRHS) {
    30                 Exp2KmlUsage(); _error_("Exp2Kml usage error");
     30                Exp2KmlUsage(); _error2_("Exp2Kml usage error");
    3131        }
    3232
     
    4343        if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
    4444                options->Get(&cm,"central_meridian");
    45                 if (verbose) printf("  cm=%g\n",cm);
     45                if (verbose) _printLine_("  cm=" << cm);
    4646                options->Get(&sp,"standard_parallel");
    47                 if (verbose) printf("  sp=%g\n",sp);
     47                if (verbose) _printLine_("  sp=" << sp);
    4848        }
    4949
    5050        /*some checks*/
    51         if (sgn !=+1 && sgn !=-1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);
    52         if (fabs(cm)      > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);
    53         if (sp < 0. || sp >  90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);
     51        if (sgn !=+1 && sgn !=-1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
     52        if (fabs(cm)      > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
     53        if (sp < 0. || sp >  90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
    5454
    5555        /* Run core computations: */
     
    7373
    7474void Exp2KmlUsage(void){
    75         _printf_(true,"Exp2Kml - exp to kml file conversion module:\n");
    76         _printf_(true,"\n");
    77         _printf_(true,"   This module converts a file from exp to kml format.\n");
    78         _printf_(true,"\n");
    79         _printf_(true,"   Usage:\n");
    80         _printf_(true,"      [ret]=Exp2Kml(filexp,filkml,sgn,'param name',param,...);\n");
    81         _printf_(true,"\n");
    82         _printf_(true,"      filexp      file name of exp file to be read (char)\n");
    83         _printf_(true,"      filkml      file name of kml file to be written (char)\n");
    84         _printf_(true,"      sgn         sign for hemisphere (double, +1 (north) or -1 (south))\n");
    85         _printf_(true,"\n");
    86         _printf_(true,"      central_meridian     central meridian (double, optional, but must specify with sp)\n");
    87         _printf_(true,"      standard_parallel    standard parallel (double, optional, but must specify with cm)\n");
    88         _printf_(true,"      holes       flag for treatment of multiple profiles (char, optional, 'yes' for holes))\n");
    89         _printf_(true,"\n");
    90         _printf_(true,"      ret         return code (non-zero for warning)\n");
    91         _printf_(true,"\n");
    92         _printf_(true,"   Examples:\n");
    93         _printf_(true,"      [ret]=Exp2Kml('file.exp','file.kml', 1);\n");
    94         _printf_(true,"      [ret]=Exp2Kml('file.exp','file.kml', 1,'central_meridian',45,'standard_parallel',70,'holes','yes');\n");
    95         _printf_(true,"      [ret]=Exp2Kml('file.exp','file.kml',-1,'central_meridian', 0,'standard_parallel',71,'holes','yes');\n");
    96         _printf_(true,"\n");
     75        _pprintLine_("Exp2Kml - exp to kml file conversion module:");
     76        _pprintLine_("");
     77        _pprintLine_("   This module converts a file from exp to kml format.");
     78        _pprintLine_("");
     79        _pprintLine_("   Usage:");
     80        _pprintLine_("      [ret]=Exp2Kml(filexp,filkml,sgn,'param name',param,...);");
     81        _pprintLine_("");
     82        _pprintLine_("      filexp      file name of exp file to be read (char)");
     83        _pprintLine_("      filkml      file name of kml file to be written (char)");
     84        _pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
     85        _pprintLine_("");
     86        _pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
     87        _pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
     88        _pprintLine_("      holes       flag for treatment of multiple profiles (char, optional, 'yes' for holes))");
     89        _pprintLine_("");
     90        _pprintLine_("      ret         return code (non-zero for warning)");
     91        _pprintLine_("");
     92        _pprintLine_("   Examples:");
     93        _pprintLine_("      [ret]=Exp2Kml('file.exp','file.kml', 1);");
     94        _pprintLine_("      [ret]=Exp2Kml('file.exp','file.kml', 1,'central_meridian',45,'standard_parallel',70,'holes','yes');");
     95        _pprintLine_("      [ret]=Exp2Kml('file.exp','file.kml',-1,'central_meridian', 0,'standard_parallel',71,'holes','yes');");
     96        _pprintLine_("");
    9797}
    9898
  • issm/branches/trunk-jpl-damage/src/modules/HoleFiller/HoleFiller.cpp

    r11933 r12878  
    6060void HoleFillerUsage(void)
    6161{
    62         printf("   HoleFiller usage:\n");
    63         printf("   [image_out]=HoleFiller(image_in,smooth);\n\n");
    64         printf("   where:\n");
    65         printf("      image_in in double format\n");
    66         printf("      smooth: 1 to smooth with a box filer, 0 to leave data raw\n");
    67         printf("      image_out in double format\n");
    68         printf("\n");
     62        _printLine_("   HoleFiller usage:");
     63        _printLine_("   [image_out]=HoleFiller(image_in,smooth);\n");
     64        _printLine_("   where:");
     65        _printLine_("      image_in in double format");
     66        _printLine_("      smooth: 1 to smooth with a box filer, 0 to leave data raw");
     67        _printLine_("      image_out in double format");
     68        _printLine_("");
    6969}
  • issm/branches/trunk-jpl-damage/src/modules/InternalFront/InternalFront.cpp

    r12060 r12878  
    2626        /*Fetch required fields*/
    2727        FetchData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements"));
    28         if(numberofelements<=0) _error_("No elements found in the model");
     28        if(numberofelements<=0) _error2_("No elements found in the model");
    2929        FetchData(&elements,&M,&N,mxGetAssignedField(MODEL,0,"elements"));
    30         if(M!=numberofelements || N!=3) _error_("Field 'elements' should be of size [md.numberofelements 3]");
     30        if(M!=numberofelements || N!=3) _error2_("Field 'elements' should be of size [md.numberofelements 3]");
    3131        FetchData(&elementonwater,&M,&N,mxGetAssignedField(MODEL,0,"elementonwater"));
    32         if(M!=numberofelements || N!=1) _error_("Field 'elementonwater' should be of size [md.numberofelements 1]");
     32        if(M!=numberofelements || N!=1) _error2_("Field 'elementonwater' should be of size [md.numberofelements 1]");
    3333        FetchData(&elementconnectivity,&M,&N,mxGetAssignedField(MODEL,0,"elementconnectivity"));
    34         if(M!=numberofelements || N!=3) _error_("Field 'elementconnectivity' should be of size [md.numberofelements 3]");
     34        if(M!=numberofelements || N!=3) _error2_("Field 'elementconnectivity' should be of size [md.numberofelements 3]");
    3535
    3636        /*Allocate and initialize all variables*/
     
    9494
    9595void InternalFrontUsage(void) {
    96         _printf_(true,"\n");
    97         _printf_(true,"   usage: icefront = %s(md);\n",__FUNCT__);
    98         _printf_(true,"\n");
     96        _pprintLine_("");
     97        _pprintLine_("   usage: icefront = " << __FUNCT__ << "(md);");
     98        _pprintLine_("");
    9999}
  • issm/branches/trunk-jpl-damage/src/modules/InterpFromGridToMesh/InterpFromGridToMesh.cpp

    r11933 r12878  
    4646        if((nlhs!=NLHS) || (nrhs!=6 && nrhs!=7)){
    4747                InterpFromGridToMeshUsage();
    48                 _error_(" usage. See above");
     48                _error2_("usage. See above");
    4949        }
    5050
     
    7575void InterpFromGridToMeshUsage(void)
    7676{
    77         _printf_(true,"INTERPFROMGRIDTOMESH - interpolation from a grid onto a list of points\n");
    78         _printf_(true,"\n");
    79         _printf_(true,"   This function is a multi-threaded mex file that interpolates a field\n");
    80         _printf_(true,"   defined on a grid onto a list of points\n");
    81         _printf_(true,"\n");
    82         _printf_(true,"   Usage:\n");
    83         _printf_(true,"      data_mesh=InterpFromGridToMesh(x,y,data,x_mesh,y_mesh,default_value);\n");
    84         _printf_(true,"\n");
    85         _printf_(true,"      data: matrix holding the data to be interpolated onto the mesh.\n");
    86         _printf_(true,"      x,y: coordinates of matrix data. (x and y must be in increasing order)\n");
    87         _printf_(true,"      x_mesh,y_mesh: coordinates of the points onto which we interpolate.\n");
    88         _printf_(true,"      default_value: default value if no data is found (holes).\n");
    89         _printf_(true,"      data_mesh: vector of mesh interpolated data.\n");
    90         _printf_(true,"\n");
    91         _printf_(true,"   Example:\n");
    92         _printf_(true,"      load('velocities.mat');\n");
    93         _printf_(true,"      md.inversion.vx_obs=InterpFromGridToMesh(x_n,y_m,vx,md.mesh.x,md.mesh.y,0);\n");
    94         _printf_(true,"\n");
     77        _pprintLine_("INTERPFROMGRIDTOMESH - interpolation from a grid onto a list of points");
     78        _pprintLine_("");
     79        _pprintLine_("   This function is a multi-threaded mex file that interpolates a field");
     80        _pprintLine_("   defined on a grid onto a list of points");
     81        _pprintLine_("");
     82        _pprintLine_("   Usage:");
     83        _pprintLine_("      data_mesh=InterpFromGridToMesh(x,y,data,x_mesh,y_mesh,default_value);");
     84        _pprintLine_("");
     85        _pprintLine_("      data: matrix holding the data to be interpolated onto the mesh.");
     86        _pprintLine_("      x,y: coordinates of matrix data. (x and y must be in increasing order)");
     87        _pprintLine_("      x_mesh,y_mesh: coordinates of the points onto which we interpolate.");
     88        _pprintLine_("      default_value: default value if no data is found (holes).");
     89        _pprintLine_("      data_mesh: vector of mesh interpolated data.");
     90        _pprintLine_("");
     91        _pprintLine_("   Example:");
     92        _pprintLine_("      load('velocities.mat');");
     93        _pprintLine_("      md.inversion.vx_obs=InterpFromGridToMesh(x_n,y_m,vx,md.mesh.x,md.mesh.y,0);");
     94        _pprintLine_("");
    9595}
  • issm/branches/trunk-jpl-damage/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp

    r12060 r12878  
    6969        if(nlhs!=NLHS){
    7070                InterpFromMesh2dUsage();
    71                 _error_("InterpFromMeshToMesh2dUsage usage error");
     71                _error2_("InterpFromMeshToMesh2dUsage usage error");
    7272        }
    7373        if((nrhs!=6) && (nrhs!=7) && (nrhs!=8)){
    7474                InterpFromMesh2dUsage();
    75                 _error_("InterpFromMeshToMesh2dUsage usage error");
     75                _error2_("InterpFromMeshToMesh2dUsage usage error");
    7676        }
    7777
     
    114114                /* Debugging of contours :{{{1*/
    115115                /*for(i=0;i<numcontours;i++){
    116                   printf("\nContour echo: contour number  %i / %i\n",i+1,numcontours);
     116                  _printLine_("\nContour echo: contour number  " << i+1 << " / " << numcontours);
    117117                  contouri=*(contours+i);
    118                   printf("   Number of vertices %i\n",contouri->nods);
     118                  _printLine_("   Number of vertices " << contouri->nods);
    119119                  for (j=0;j<contouri->nods;j++){
    120                   printf("   %lf %lf\n",*(contouri->x+j),*(contouri->y+j));
     120                  _printLine_("   " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f");
    121121                  }
    122122                  }*/
     
    131131        /*some checks*/
    132132        if (x_data_rows!=y_data_rows){
    133                 _error_("vectors x and y should have the same length!");
     133                _error2_("vectors x and y should have the same length!");
    134134        }
    135135        if (x_prime_rows!=y_prime_rows){
    136                 _error_("vectors x_prime and y_prime should have the same length!");
     136                _error2_("vectors x_prime and y_prime should have the same length!");
    137137        }
    138138       
     
    154154void InterpFromMesh2dUsage(void)
    155155{
    156         _printf_(true,"   usage:\n");
    157         _printf_(true,"         data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime);\n\n");
    158         _printf_(true,"      or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n\n");
    159         _printf_(true,"      or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value,contourname);\n\n");
    160         _printf_(true,"   where:\n");
    161         _printf_(true,"      x,y: coordinates of the nodes where data is defined\n");
    162         _printf_(true,"      index: index of the mesh where data is defined\n");
    163         _printf_(true,"      data - vector holding the data to be interpolated onto the points.\n");
    164         _printf_(true,"      x_prime,y_prime: coordinates of the mesh vertices onto which we interpolate.\n");
    165         _printf_(true,"      default_value: a scalar or vector of size length(x_prime).\n");
    166         _printf_(true,"      contourname: linear interpolation will happen on all x_interp,y_interp inside the contour, default value will be adopted on the rest of the mesh.\n");
    167         _printf_(true,"      data_prime:  vector of prime interpolated data.\n");
    168         _printf_(true,"\n");
     156        _pprintLine_("   usage:");
     157        _pprintLine_("         data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime);\n");
     158        _pprintLine_("      or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n");
     159        _pprintLine_("      or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value,contourname);\n");
     160        _pprintLine_("   where:");
     161        _pprintLine_("      x,y: coordinates of the nodes where data is defined");
     162        _pprintLine_("      index: index of the mesh where data is defined");
     163        _pprintLine_("      data - vector holding the data to be interpolated onto the points.");
     164        _pprintLine_("      x_prime,y_prime: coordinates of the mesh vertices onto which we interpolate.");
     165        _pprintLine_("      default_value: a scalar or vector of size length(x_prime).");
     166        _pprintLine_("      contourname: linear interpolation will happen on all x_interp,y_interp inside the contour, default value will be adopted on the rest of the mesh.");
     167        _pprintLine_("      data_prime:  vector of prime interpolated data.");
     168        _pprintLine_("");
    169169}
  • issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp

    r11933 r12878  
    6464void InterpFromMeshToGridUsage(void)
    6565{
    66         _printf_(true,"INTERPFROMMESHTOGRID - interpolation of a data defined on a mesh onto a grid\n");
    67         _printf_(true,"\n");
    68         _printf_(true,"   This function is a multi-threaded mex file that interpolates a field\n");
    69         _printf_(true,"   defined on a triangular mesh onto a regular grid\n");
    70         _printf_(true,"\n");
    71         _printf_(true,"   Usage:\n");
    72         _printf_(true,"      [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,xmin,ymax,xposting,yposting,nlines,ncols,default_value)\n");
    73         _printf_(true,"\n");
    74         _printf_(true,"      index,x,y: delaunay triangulation defining the mesh.\n");
    75         _printf_(true,"      meshdata: vertex values of data to be interpolated.\n");
    76         _printf_(true,"      xmin,ymax,posting,nlines,ncols: parameters that define the grid\n");
    77         _printf_(true,"      default_value: value of points located out of the mesh.\n");
    78         _printf_(true,"\n");
     66        _pprintLine_("INTERPFROMMESHTOGRID - interpolation of a data defined on a mesh onto a grid");
     67        _pprintLine_("");
     68        _pprintLine_("   This function is a multi-threaded mex file that interpolates a field");
     69        _pprintLine_("   defined on a triangular mesh onto a regular grid");
     70        _pprintLine_("");
     71        _pprintLine_("   Usage:");
     72        _pprintLine_("      [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,xmin,ymax,xposting,yposting,nlines,ncols,default_value)");
     73        _pprintLine_("");
     74        _pprintLine_("      index,x,y: delaunay triangulation defining the mesh.");
     75        _pprintLine_("      meshdata: vertex values of data to be interpolated.");
     76        _pprintLine_("      xmin,ymax,posting,nlines,ncols: parameters that define the grid");
     77        _pprintLine_("      default_value: value of points located out of the mesh.");
     78        _pprintLine_("");
    7979}
  • issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp

    r12118 r12878  
    77WRAPPER(InterpFromMeshToMesh2d){
    88
    9         /*input: */
    10         double* index=NULL;
    11         int     index_cols;
    12         double* x_data=NULL;
    13         int     x_data_rows;
    14         double* y_data=NULL;
    15         int     y_data_rows;
    16         double* data=NULL;
    17         int     data_rows;
    18         int     data_cols;
    19         double* x_interp=NULL;
    20         int     x_interp_rows;
    21         double* y_interp=NULL;
    22         int     y_interp_rows;
    23         char*   contourname=NULL;
    24         double* default_values=NULL;
    25         int     num_default_values=0;
    26         DataSet *contours = NULL;
    27 
    28         /*Intermediary*/
    29         int nels_data;
    30 
    31         /* output: */
    32         double* data_interp=NULL;
     9        /*Intermediaties*/
     10        int     *index              = NULL;
     11        double  *x_data             = NULL;
     12        double  *y_data             = NULL;
     13        double  *data               = NULL;
     14        int      nods_data,nels_data;
     15        int      M_data,N_data;
     16        double  *x_interp           = NULL;
     17        double  *y_interp           = NULL;
     18        int      N_interp;
     19        Options *options   = NULL;
     20        double  *data_interp = NULL;
     21        int      test1,test2,test;
    3322
    3423        /*Boot module: */
     
    3928        if(nlhs!=NLHS){
    4029                InterpFromMeshToMesh2dUsage();
    41                 _error_("InterpFromMeshToMesh2dUsage usage error");
     30                _error2_("InterpFromMeshToMesh2dUsage usage error");
    4231        }
    4332        #endif
    4433        /*check on input arguments: */
    45         if((nrhs!=6) & (nrhs!=8)){
     34        if(nrhs<NRHS){
    4635                InterpFromMeshToMesh2dUsage();
    47                 _error_("InterpFromMeshToMesh2dUsage usage error");
     36                _error2_("InterpFromMeshToMesh2dUsage usage error");
    4837        }
    4938
    50         /*Input datasets: */
    51         FetchData(&index,&nels_data,&index_cols,INDEX);
    52         FetchData(&x_data,&x_data_rows,NULL,X);
    53         FetchData(&y_data,&y_data_rows,NULL,Y);
    54         FetchData(&data,&data_rows,&data_cols,DATA);
    55         FetchData(&x_interp,&x_interp_rows,XINTERP);
    56         FetchData(&y_interp,&y_interp_rows,YINTERP);
     39        /*Fetch inputs: */
     40        FetchData(&index,&nels_data,&test,INDEX); if(test!=3) _error2_("index should have 3 columns");
     41        FetchData(&x_data,&nods_data,X);          if(nods_data<3) _error2_("there should be at least three points");
     42        FetchData(&y_data,&test,Y);               if(test!=nods_data) _error2_("vectors x and y should have the same length");
     43        FetchData(&data,&M_data,&N_data,DATA);    if(M_data*N_data<1) _error2_("data is empty");
     44        FetchData(&x_interp,&N_interp,XINTERP);   if(N_interp<1) _error2_("no interpolation requested");
     45        FetchData(&y_interp,&test,YINTERP);       if(test!=N_interp) _error2_("vectors x_interp and y_interp should have the same length");
     46        FetchData(&options,NRHS,nrhs,ARGUMENTS);
    5747
    58         /*Figure out contours and default values: */
    59         if(nrhs==8){
    60                 FetchData(&default_values,&num_default_values,DEFAULT);
    61                 FetchData(&contourname,CONTOURNAME);
    62                 contours=DomainOutlineRead(contourname);
    63         }
    64         else{
    65                 num_default_values=0;
    66                 default_values=NULL;
    67                 contours=new DataSet();
    68         }
    69 
    70 
    71         /*some checks*/
    72         if (x_data_rows!=y_data_rows){
    73                 _error_("vectors x and y should have the same length!");
    74         }
    75         if (x_interp_rows!=y_interp_rows){
    76                 _error_("vectors x_interp and y_interp should have the same length!");
    77         }
    78         if (index_cols!=3){
    79                 _error_("index should have 3 columns (input provided has %i columns)",index_cols);
    80         }
    81 
    82         /* Run core computations: */
    83         InterpFromMeshToMesh2dx(&data_interp,index,x_data,y_data,x_data_rows,nels_data,data,data_rows,data_cols,x_interp,y_interp,x_interp_rows,default_values,num_default_values,contours);
     48        /*Run core computations*/
     49        InterpFromMeshToMesh2dx(&data_interp,index,x_data,y_data,nods_data,nels_data,data,M_data,N_data,x_interp,y_interp,N_interp,options);
    8450
    8551        /*Write data: */
    86         WriteData(DATAINTERP,data_interp,x_interp_rows,data_cols);
     52        WriteData(DATAINTERP,data_interp,N_interp,N_data);
    8753
    8854        /*end module: */
     
    9056}
    9157
    92 void InterpFromMeshToMesh2dUsage(void)//{{{1
    93 
    94 {
    95         _printf_(true,"INTERFROMMESHTOMESH2D - interpolation from a 2d triangular mesh onto a list of point\n");
    96         _printf_(true,"\n");
    97         _printf_(true,"   This function is a multi-threaded mex file that interpolates a field\n");
    98         _printf_(true,"   defined on a triangular mesh onto a list of point\n");
    99         _printf_(true,"\n");
    100         _printf_(true,"   Usage:\n");
    101         _printf_(true,"         data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp);\n");
    102         _printf_(true,"      or data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp,default_value,contourname);\n");
    103         _printf_(true,"\n");
    104         _printf_(true,"      index: index of the mesh where data is defined\n");
    105         _printf_(true,"      x,y: coordinates of the nodes where data is defined\n");
    106         _printf_(true,"      data: matrix holding the data to be interpolated onto the mesh. (one column per field)\n");
    107         _printf_(true,"      x_interp,y_interp: coordinates of the points onto which we interpolate.\n");
    108         _printf_(true,"      if default_value and contourname not specified: linear interpolation will happen on all x_interp,y_interp.\n");
    109         _printf_(true,"      if (default_value,contourname) specified: linear interpolation will happen on all x_interp,y_interp inside the contour, default value will be adopted on the rest of the mesh.\n");
    110         _printf_(true,"      note that default_value is either a scalar, or a vector of size  length(x_interp)\n");
    111         _printf_(true,"      data_interp: vector of mesh interpolated data.\n");
    112         _printf_(true,"\n");
    113         _printf_(true,"   Example:\n");
    114         _printf_(true,"      load('temperature.mat');\n");
    115         _printf_(true,"      md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y);\n");
    116         _printf_(true,"      md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y,253,'Contour.exp');\n");
    117         _printf_(true,"\n");
     58void InterpFromMeshToMesh2dUsage(void){ /*{{{*/
     59        _pprintLine_("INTERFROMMESHTOMESH2D - interpolation from a 2d triangular mesh onto a list of point");
     60        _pprintLine_("");
     61        _pprintLine_("   This function is a multi-threaded mex file that interpolates a field");
     62        _pprintLine_("   defined on a Delaunay triangulation onto a list of point");
     63        _pprintLine_("");
     64        _pprintLine_("   Usage:");
     65        _pprintLine_("         data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp);");
     66        _pprintLine_("      or data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp,OPTIONS);");
     67        _pprintLine_("");
     68        _pprintLine_("      index             : index of the mesh where data is defined");
     69        _pprintLine_("      x,y               : coordinates of the nodes where data is defined");
     70        _pprintLine_("      data              : matrix holding the data to be interpolated onto the mesh. (one column per field)");
     71        _pprintLine_("      x_interp,y_interp : coordinates of the points onto which we interpolate.");
     72        _pprintLine_("      data_interp       : vector of mesh interpolated data.");
     73        _pprintLine_("      Available options :");
     74        _pprintLine_("         - 'default' : default value if point is outsite of triangulation (instead of linear interolation)");
     75        _pprintLine_("");
     76        _pprintLine_("   Example:");
     77        _pprintLine_("      load('temperature.mat');");
     78        _pprintLine_("      md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y);");
     79        _pprintLine_("      md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y,'default',253);");
     80        _pprintLine_("");
    11881}
    119 //}}}
     82/*}}}*/
  • issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h

    r12118 r12878  
    1212#endif
    1313
    14 /*Very important definition in case we are compiling a python module!: needs to come before header files inclusion*/
     14/* local prototypes: */
     15void InterpFromMeshToMesh2dUsage(void);
     16
     17/*If python: this macro needs to come before header files inclusion*/
    1518#ifdef _HAVE_PYTHON_
    1619#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
     
    2831#include "../../c/EnumDefinitions/EnumDefinitions.h"
    2932
     33#undef __FUNCT__
     34#define __FUNCT__  "InterpFromMeshToMesh2d"
     35
    3036#ifdef _HAVE_MATLAB_MODULES_
    3137/* serial input macros: */
     
    3642#define XINTERP prhs[4]
    3743#define YINTERP prhs[5]
    38 #define DEFAULT prhs[6]
    39 #define CONTOURNAME prhs[7]
     44#define ARGUMENTS prhs
    4045
    4146/* serial output macros: */
     
    5156#define XINTERP PyTuple_GetItem(args,4)
    5257#define YINTERP PyTuple_GetItem(args,5)
    53 #define DEFAULT PyTuple_GetItem(args,6)
    54 #define CONTOURNAME PyTuple_GetItem(args,7)
     58#define ARGUMENTS args
     59
    5560/* serial output macros: */
    5661#define DATAINTERP output,0
    5762#endif
    58 
    59 #undef __FUNCT__
    60 #define __FUNCT__  "InterpFromMeshToMesh2d"
    6163
    6264/* serial arg counts: */
     
    6466#define NLHS  1
    6567#undef NRHS
    66 #define NRHS  6 //can be 8 though
    67 
    68 /* local prototypes: */
    69 void InterpFromMeshToMesh2dUsage(void);
     68#define NRHS  6
    7069
    7170#endif
  • issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp

    r11933 r12878  
    7676        /*some checks*/
    7777        if (x_data_rows!=y_data_rows || x_data_rows!=z_data_rows){
    78                 _error_("vectors x, y and z should have the same length!");
     78                _error2_("vectors x, y and z should have the same length!");
    7979        }
    8080        if (x_prime_rows!=y_prime_rows || x_prime_rows!=z_prime_rows){
    81                 _error_("vectors x_prime, y_prime and z_prime should have the same length!");
     81                _error2_("vectors x_prime, y_prime and z_prime should have the same length!");
    8282        }
    8383        /*get number of elements and number of nodes in the data*/
     
    9898void InterpFromMeshToMesh3dUsage(void)
    9999{
    100         _printf_(true,"INTERPFROMMESHTOMESH3D - interpolation from a 3d hexahedron mesh onto a list of point\n");
    101         _printf_(true,"\n");
    102         _printf_(true,"   This function is a multi-threaded mex file that interpolates a field\n");
    103         _printf_(true,"   defined on a triangular mesh onto a list of point\n");
    104         _printf_(true,"\n");
    105         _printf_(true,"   Usage:\n");
    106         _printf_(true,"      data_prime=InterpFromMeshToMesh3d(index,x,y,z,data,x_prime,y_prime,z_prime,default_value);\n");
    107         _printf_(true,"\n");
    108         _printf_(true,"      index: index of the mesh where data is defined\n");
    109         _printf_(true,"      x,y,z: coordinates of the nodes where data is defined\n");
    110         _printf_(true,"      data: matrix holding the data to be interpolated onto the mesh.\n");
    111         _printf_(true,"      x_prime,y_prime,z_prime: coordinates of the points onto which we interpolate.\n");
    112         _printf_(true,"      default_value: default value if no data is found (holes).\n");
    113         _printf_(true,"      data_prime: vector of mesh interpolated data.\n");
    114         _printf_(true,"\n");
    115         _printf_(true,"   Example:\n");
    116         _printf_(true,"      load('temperature.mat');\n");
    117         _printf_(true,"      md.initialization.temperature=InterpFromMeshToMesh3d(index,x,y,z,temperature,md.mesh.x,md.mesh.y,md.mesh.z,253);\n");
    118         _printf_(true,"\n");
     100        _pprintLine_("INTERPFROMMESHTOMESH3D - interpolation from a 3d hexahedron mesh onto a list of point");
     101        _pprintLine_("");
     102        _pprintLine_("   This function is a multi-threaded mex file that interpolates a field");
     103        _pprintLine_("   defined on a triangular mesh onto a list of point");
     104        _pprintLine_("");
     105        _pprintLine_("   Usage:");
     106        _pprintLine_("      data_prime=InterpFromMeshToMesh3d(index,x,y,z,data,x_prime,y_prime,z_prime,default_value);");
     107        _pprintLine_("");
     108        _pprintLine_("      index: index of the mesh where data is defined");
     109        _pprintLine_("      x,y,z: coordinates of the nodes where data is defined");
     110        _pprintLine_("      data: matrix holding the data to be interpolated onto the mesh.");
     111        _pprintLine_("      x_prime,y_prime,z_prime: coordinates of the points onto which we interpolate.");
     112        _pprintLine_("      default_value: default value if no data is found (holes).");
     113        _pprintLine_("      data_prime: vector of mesh interpolated data.");
     114        _pprintLine_("");
     115        _pprintLine_("   Example:");
     116        _pprintLine_("      load('temperature.mat');");
     117        _pprintLine_("      md.initialization.temperature=InterpFromMeshToMesh3d(index,x,y,z,temperature,md.mesh.x,md.mesh.y,md.mesh.z,253);");
     118        _pprintLine_("");
    119119}
  • issm/branches/trunk-jpl-damage/src/modules/KMLFileRead/KMLFileRead.cpp

    r12049 r12878  
    4545        /*checks on arguments on the matlab side: */
    4646        if (nlhs > NLHS) {
    47                 KMLFileReadUsage(); _error_("KMLFileRead usage error");
     47                KMLFileReadUsage(); _error2_("KMLFileRead usage error");
    4848        }
    4949        if (nrhs < NRHS) {
    50                 KMLFileReadUsage(); _error_("KMLFileRead usage error");
     50                KMLFileReadUsage(); _error2_("KMLFileRead usage error");
    5151        }
    5252
     
    6363        if (!strlen(filnam)) strcpy(filnam,"stdout");
    6464
    65         if (verbose) printf("Opening file \"%s\".\n",filnam);
     65        if (verbose) _printLine_("Opening file \"" << filnam << "\".");
    6666        fidi=fopen(filnam,"r");
    6767
    6868        /* Run core computations: */
    69         if (verbose) printf("Calling core:\n");
     69        if (verbose) _printLine_("Calling core:");
    7070        kobj=KMLFileReadx(fidi);
    7171
    72         if (verbose) printf("Closing file \"%s\".\n",filnam);
     72        if (verbose) _printLine_("Closing file \"" << filnam << "\".");
    7373        fclose(fidi);
    7474
     
    8383                        }
    8484                        else {
    85                                 if (verbose) printf("Opening file \"%s\".\n",write);
     85                                if (verbose) _printLine_("Opening file \"" << write << "\".");
    8686                                fido=fopen(write,"w");
    8787                                kobj->Write(fido,"");
    88                                 if (verbose) printf("Closing file \"%s\".\n",write);
     88                                if (verbose) _printLine_("Closing file \"" << write << "\".");
    8989                                ierror=fclose(fido);
    9090                        }
     
    107107
    108108void KMLFileReadUsage(void){
    109         _printf_(true,"KMLFileRead - KML file reader module:\n");
    110         _printf_(true,"\n");
    111         _printf_(true,"   This module reads a KML file.\n");
    112         _printf_(true,"\n");
    113         _printf_(true,"   Usage:\n");
    114         _printf_(true,"      [ierror]=KMLFileRead(kmlfile,'param name',param,...);\n");
    115         _printf_(true,"\n");
    116         _printf_(true,"      kmlfile      file name of kml file to be read (char)\n");
    117         _printf_(true,"\n");
    118         _printf_(true,"      echo         echo command (char, optional, 'off'/'on')\n");
    119         _printf_(true,"      deepecho     deep echo command (char, optional, 'off'/'on')\n");
    120         _printf_(true,"      write        write command (char, optional, 'off'/'stdout'/kmlfile)\n");
    121         _printf_(true,"\n");
    122         _printf_(true,"      ierror       return code (non-zero for error)\n");
    123         _printf_(true,"\n");
    124         _printf_(true,"   Examples:\n");
    125         _printf_(true,"      [ierror]=KMLFileRead('file.kml','deepecho','on');\n");
    126         _printf_(true,"      [ierror]=KMLFileRead('filin.kml','echo','on','write','filout.kml');\n");
    127         _printf_(true,"\n");
     109        _pprintLine_("KMLFileRead - KML file reader module:");
     110        _pprintLine_("");
     111        _pprintLine_("   This module reads a KML file.");
     112        _pprintLine_("");
     113        _pprintLine_("   Usage:");
     114        _pprintLine_("      [ierror]=KMLFileRead(kmlfile,'param name',param,...);");
     115        _pprintLine_("");
     116        _pprintLine_("      kmlfile      file name of kml file to be read (char)");
     117        _pprintLine_("");
     118        _pprintLine_("      echo         echo command (char, optional, 'off'/'on')");
     119        _pprintLine_("      deepecho     deep echo command (char, optional, 'off'/'on')");
     120        _pprintLine_("      write        write command (char, optional, 'off'/'stdout'/kmlfile)");
     121        _pprintLine_("");
     122        _pprintLine_("      ierror       return code (non-zero for error)");
     123        _pprintLine_("");
     124        _pprintLine_("   Examples:");
     125        _pprintLine_("      [ierror]=KMLFileRead('file.kml','deepecho','on');");
     126        _pprintLine_("      [ierror]=KMLFileRead('filin.kml','echo','on','write','filout.kml');");
     127        _pprintLine_("");
    128128}
    129129
  • issm/branches/trunk-jpl-damage/src/modules/KMLMeshWrite/KMLMeshWrite.cpp

    r12060 r12878  
    4040        /*checks on arguments on the matlab side: */
    4141        if (nlhs > NLHS) {
    42                 KMLMeshWriteUsage(); _error_("KMLMeshWrite usage error");
     42                KMLMeshWriteUsage(); _error2_("KMLMeshWrite usage error");
    4343        }
    4444        if (nrhs < NRHS) {
    45                 KMLMeshWriteUsage(); _error_("KMLMeshWrite usage error");
     45                KMLMeshWriteUsage(); _error2_("KMLMeshWrite usage error");
    4646        }
    4747
     
    8787
    8888        if (nodecon && (mncon != nnodes))
    89                 _error_("Nodal connectivity table, if supplied, must be supplied for all nodes.");
     89          {_error2_("Nodal connectivity table, if supplied, must be supplied for all nodes.");}
    9090        else if (!nodecon)
    9191                mncon=nnodes;
    9292        if ((llat != nnodes) || (llng != nnodes) || (llat != llng))
    93                 _error_("Latitude and longitude vectors must be supplied for all nodes.");
     93                _error2_("Latitude and longitude vectors must be supplied for all nodes.");
    9494        if (part && (lprt != nnodes))
    95                 _error_("Partitioning vector, if supplied, must be supplied for all nodes.");
     95                _error2_("Partitioning vector, if supplied, must be supplied for all nodes.");
    9696        if (data && !((mdata == nnodes) || (mdata == melem)))
    97                 _error_("Data matrix, if supplied, must be supplied for all nodes or all elements.");
     97                _error2_("Data matrix, if supplied, must be supplied for all nodes or all elements.");
    9898        if (cmap && (ncmap != 3))
    99                 _error_("Colormap matrix, if supplied, must have three columns for rgb.");
     99                _error2_("Colormap matrix, if supplied, must have three columns for rgb.");
    100100        if (!strlen(filnam))
    101101                strcpy(filnam,"stdout");
     
    118118
    119119void KMLMeshWriteUsage(void){
    120         _printf_(true,"KMLMeshWrite - KML mesh writer module:\n");
    121         _printf_(true,"\n");
    122         _printf_(true,"   This module writes the mesh of a model as KML polygons into the specified KML file.\n");
    123         _printf_(true,"\n");
    124         _printf_(true,"   Usage:\n");
    125         _printf_(true,"      ierror=KMLMeshWrite(name,notes,elem,nodecon,lat,long,part,data,cmap,kmlfile);\n");
    126         _printf_(true,"\n");
    127         _printf_(true,"      name       model name (string, may be empty)\n");
    128         _printf_(true,"      notes      model notes (string or cell array of strings, may be empty)\n");
    129         _printf_(true,"      elem       elements (double array)\n");
    130         _printf_(true,"      nodecon    nodal connectivity array (double array, may be empty)\n");
    131         _printf_(true,"      lat        nodal latititudes (double vector)\n");
    132         _printf_(true,"      long       nodal longitudes (double vector)\n");
    133         _printf_(true,"      part       nodal partitions (double vector, may be empty)\n");
    134         _printf_(true,"      data       nodal or element data (double vector, may be empty)\n");
    135         _printf_(true,"      cmap       color map (double nx3 array, may be empty)\n");
    136         _printf_(true,"      kmlfile    KML file name (string)\n");
    137         _printf_(true,"\n");
    138         _printf_(true,"      ierror     error flag (double, non-zero for error)\n");
    139         _printf_(true,"\n");
    140         _printf_(true,"   Example:\n");
    141         _printf_(true,"      KMLMeshWrite(md.name,md.notes,md.elements,md.nodeconnectivity,md.lat,md.long,md.part,md.fm_criterion,options.cmap,filekml);\n");
    142         _printf_(true,"\n");
     120        _pprintLine_("KMLMeshWrite - KML mesh writer module:");
     121        _pprintLine_("");
     122        _pprintLine_("   This module writes the mesh of a model as KML polygons into the specified KML file.");
     123        _pprintLine_("");
     124        _pprintLine_("   Usage:");
     125        _pprintLine_("      ierror=KMLMeshWrite(name,notes,elem,nodecon,lat,long,part,data,cmap,kmlfile);");
     126        _pprintLine_("");
     127        _pprintLine_("      name       model name (string, may be empty)");
     128        _pprintLine_("      notes      model notes (string or cell array of strings, may be empty)");
     129        _pprintLine_("      elem       elements (double array)");
     130        _pprintLine_("      nodecon    nodal connectivity array (double array, may be empty)");
     131        _pprintLine_("      lat        nodal latititudes (double vector)");
     132        _pprintLine_("      long       nodal longitudes (double vector)");
     133        _pprintLine_("      part       nodal partitions (double vector, may be empty)");
     134        _pprintLine_("      data       nodal or element data (double vector, may be empty)");
     135        _pprintLine_("      cmap       color map (double nx3 array, may be empty)");
     136        _pprintLine_("      kmlfile    KML file name (string)");
     137        _pprintLine_("");
     138        _pprintLine_("      ierror     error flag (double, non-zero for error)");
     139        _pprintLine_("");
     140        _pprintLine_("   Example:");
     141        _pprintLine_("      KMLMeshWrite(md.name,md.notes,md.elements,md.nodeconnectivity,md.lat,md.long,md.part,md.fm_criterion,options.cmap,filekml);");
     142        _pprintLine_("");
    143143}
  • issm/branches/trunk-jpl-damage/src/modules/KMLOverlay/KMLOverlay.cpp

    r12049 r12878  
    3131        /*checks on arguments on the matlab side: */
    3232        if(nlhs>NLHS){
    33                 KMLOverlayUsage(); _error_("KMLOverlay usage error");
     33                KMLOverlayUsage(); _error2_("KMLOverlay usage error");
    3434        }
    3535        if(nrhs<NRHS){
    36                 KMLOverlayUsage(); _error_("KMLOverlay usage error");
     36                KMLOverlayUsage(); _error2_("KMLOverlay usage error");
    3737        }
    3838
     
    4242
    4343        options->Get(&lataxis ,&nlat ,"lataxis" );
    44         if (verbose && lataxis) for (i=0; i<nlat; i++) printf("  lataxis [%d]=%g\n",i,lataxis[i]);
     44        if (verbose && lataxis) for (i=0; i<nlat; i++) _printLine_("  lataxis [" << i << "]=" << lataxis[i]);
    4545        options->Get(&longaxis,&nlong,"longaxis");
    46         if (verbose && longaxis) for (i=0; i<nlong; i++) printf("  longaxis[%d]=%g\n",i,longaxis[i]);
     46        if (verbose && longaxis) for (i=0; i<nlong; i++) _printLine_("  longaxis[" << i << "]=" << longaxis[i]);
    4747        options->Get(&pimages,&nimages,"images");
    48         if (verbose && pimages) for (i=0; i<nimages; i++) printf("  pimages[%d]=\"%s\"\n",i,pimages[i]);
     48        if (verbose && pimages) for (i=0; i<nimages; i++) _printLine_("  pimages[" << i << "]=\"" << pimages[i] << "\"");
    4949        options->Get(&dzip,"zip",0.);
    50         if (verbose) printf("  dzip=%g\n",dzip);
     50        if (verbose) _printLine_("  dzip=" << dzip);
    5151
    5252        /*some checks*/
    53         if (nlat !=2) _error_("Latitudinal axes \"lataxis\" require two double values, not %d.",nlat);
    54         if (nlong!=2) _error_("Longitudinal axes \"longaxis\" require two double values, not %d.",nlong);
    55         if (!nimages) _error_("No image files provided.");
     53        if (nlat !=2) _error2_("Latitudinal axes \"lataxis\" require two double values, not " << nlat << ".");
     54        if (nlong!=2) _error2_("Longitudinal axes \"longaxis\" require two double values, not " << nlong << ".");
     55        if (!nimages) _error2_("No image files provided.");
    5656
    5757        if ((int)dzip){
     
    6363        if(!strlen(filkml)) strcpy(filkml,"stdout");
    6464
    65         if(verbose) printf("Opening kml overlay file \"%s\".\n",filkml);
     65        if(verbose) _printLine_("Opening kml overlay file \"" << filkml << "\".");
    6666        fid=fopen(filkml,"w");
    6767
    6868        /* Run core computations: */
    69         if (verbose) printf("Calling core:\n");
     69        if (verbose) _printLine_("Calling core:");
    7070        KMLOverlayx(&ierror,lataxis,longaxis,nimages,pimages,fid);
    7171
    72         if (verbose) printf("Closing file \"%s\".\n",filkml);
     72        if (verbose) _printLine_("Closing file \"" << filkml << "\".");
    7373        fclose(fid);
    7474
     
    8787                                strcat(czip,pimages[i]);
    8888                        }
    89                 if (verbose) printf("Zipping file \"%s\".\n",filkmz);
    90                 if (verbose) printf("%s\n",czip);
     89                if (verbose) _printLine_("Zipping file \"" << filkmz << "\".");
     90                if (verbose) _printLine_(czip);
    9191
    92                 if (mexEvalString(czip)) _error_("Error zipping file \"%s\".",filkmz);
     92                if (mexEvalString(czip)) _error2_("Error zipping file \"" << filkmz << "\".");
    9393                xfree((void**)&czip);
    9494                xfree((void**)&filkmz);
     
    113113
    114114void KMLOverlayUsage(void){
    115         _printf_(true,"KMLOverlay - KML file overlay module:\n");
    116         _printf_(true,"\n");
    117         _printf_(true,"   This module reads a list of image files and writes a KML or KMZ overlay file.\n");
    118         _printf_(true,"\n");
    119         _printf_(true,"   Usage:\n");
    120         _printf_(true,"      ierror=KMLOverlay(kmlfile,'param name',param,...);\n");
    121         _printf_(true,"\n");
    122         _printf_(true,"      kmlfile     KML or KMZ file name (string)\n");
    123         _printf_(true,"\n");
    124         _printf_(true,"      lataxis     latitude axis (double vector [south north], required)\n");
    125         _printf_(true,"      longaxis    longitude axis (double vector [west east], required)\n");
    126         _printf_(true,"      images      relative or http image file names (string or array of strings or cell array of strings, required)\n");
    127         _printf_(true,"      zip         flag to zip the doc.kml and image files into kmzfile (double, non-zero for kmz)\n");
    128         _printf_(true,"\n");
    129         _printf_(true,"      ierror     error flag (double, non-zero for error)\n");
    130         _printf_(true,"\n");
    131         _printf_(true,"   Example:\n");
    132         _printf_(true,"      KMLOverlay(kmlfile,'lataxis',[south north],'longaxis',[west east],'images',{'file1.png','http://issm/file2.png'},'zip',1);\n");
    133         _printf_(true,"\n");
     115        _pprintLine_("KMLOverlay - KML file overlay module:");
     116        _pprintLine_("");
     117        _pprintLine_("   This module reads a list of image files and writes a KML or KMZ overlay file.");
     118        _pprintLine_("");
     119        _pprintLine_("   Usage:");
     120        _pprintLine_("      ierror=KMLOverlay(kmlfile,'param name',param,...);");
     121        _pprintLine_("");
     122        _pprintLine_("      kmlfile     KML or KMZ file name (string)");
     123        _pprintLine_("");
     124        _pprintLine_("      lataxis     latitude axis (double vector [south north], required)");
     125        _pprintLine_("      longaxis    longitude axis (double vector [west east], required)");
     126        _pprintLine_("      images      relative or http image file names (string or array of strings or cell array of strings, required)");
     127        _pprintLine_("      zip         flag to zip the doc.kml and image files into kmzfile (double, non-zero for kmz)");
     128        _pprintLine_("");
     129        _pprintLine_("      ierror     error flag (double, non-zero for error)");
     130        _pprintLine_("");
     131        _pprintLine_("   Example:");
     132        _pprintLine_("      KMLOverlay(kmlfile,'lataxis',[south north],'longaxis',[west east],'images',{'file1.png','http://issm/file2.png'},'zip',1);");
     133        _pprintLine_("");
    134134}
  • issm/branches/trunk-jpl-damage/src/modules/Kml2Exp/Kml2Exp.cpp

    r12049 r12878  
    2222        /*checks on arguments on the matlab side: */
    2323        if (nlhs > NLHS) {
    24                 Kml2ExpUsage(); _error_("Kml2Exp usage error");
     24                Kml2ExpUsage(); _error2_("Kml2Exp usage error");
    2525        }
    2626        if (nrhs < NRHS) {
    27                 Kml2ExpUsage(); _error_("Kml2Exp usage error");
     27                Kml2ExpUsage(); _error2_("Kml2Exp usage error");
    2828        }
    2929
     
    3737        if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
    3838                options->Get(&cm,"central_meridian");
    39                 if (verbose) printf("  cm=%g\n",cm);
     39                if (verbose) _printLine_("  cm=" << cm);
    4040                options->Get(&sp,"standard_parallel");
    41                 if (verbose) printf("  sp=%g\n",sp);
     41                if (verbose) _printLine_("  sp=" << sp);
    4242        }
    4343
    4444        /*some checks*/
    45         if (sgn !=+1 && sgn!= -1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);
    46         if (fabs(cm)      > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);
    47         if (sp < 0. || sp >  90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);
     45        if (sgn !=+1 && sgn!= -1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
     46        if (fabs(cm)      > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
     47        if (sp < 0. || sp >  90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
    4848
    4949        /* Run core computations: */
     
    6666
    6767void Kml2ExpUsage(void){
    68         _printf_(true,"Kml2Exp - kml to exp file conversion module:\n");
    69         _printf_(true,"\n");
    70         _printf_(true,"   This module converts a file from kml to exp format.\n");
    71         _printf_(true,"\n");
    72         _printf_(true,"   Usage:\n");
    73         _printf_(true,"      [ret]=Kml2Exp(filexp,filkml,sgn,'param name',param,...);\n");
    74         _printf_(true,"\n");
    75         _printf_(true,"      filkml      file name of kml file to be read (char)\n");
    76         _printf_(true,"      filexp      file name of exp file to be written (char)\n");
    77         _printf_(true,"      sgn         sign for hemisphere (double, +1 (north) or -1 (south))\n");
    78         _printf_(true,"\n");
    79         _printf_(true,"      central_meridian     central meridian (double, optional, but must specify with sp)\n");
    80         _printf_(true,"      standard_parallel    standard parallel (double, optional, but must specify with cm)\n");
    81         _printf_(true,"\n");
    82         _printf_(true,"      ret         return code (non-zero for warning)\n");
    83         _printf_(true,"\n");
    84         _printf_(true,"   Examples:\n");
    85         _printf_(true,"      [ret]=Kml2Exp('file.kml','file.exp', 1);\n");
    86         _printf_(true,"      [ret]=Kml2Exp('file.kml','file.exp', 1,'central_meridian',45,'standard_parallel',70);\n");
    87         _printf_(true,"      [ret]=Kml2Exp('file.kml','file.exp',-1,'central_meridian', 0,'standard_parallel',71);\n");
    88         _printf_(true,"\n");
     68        _pprintLine_("Kml2Exp - kml to exp file conversion module:");
     69        _pprintLine_("");
     70        _pprintLine_("   This module converts a file from kml to exp format.");
     71        _pprintLine_("");
     72        _pprintLine_("   Usage:");
     73        _pprintLine_("      [ret]=Kml2Exp(filexp,filkml,sgn,'param name',param,...);");
     74        _pprintLine_("");
     75        _pprintLine_("      filkml      file name of kml file to be read (char)");
     76        _pprintLine_("      filexp      file name of exp file to be written (char)");
     77        _pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
     78        _pprintLine_("");
     79        _pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
     80        _pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
     81        _pprintLine_("");
     82        _pprintLine_("      ret         return code (non-zero for warning)");
     83        _pprintLine_("");
     84        _pprintLine_("   Examples:");
     85        _pprintLine_("      [ret]=Kml2Exp('file.kml','file.exp', 1);");
     86        _pprintLine_("      [ret]=Kml2Exp('file.kml','file.exp', 1,'central_meridian',45,'standard_parallel',70);");
     87        _pprintLine_("      [ret]=Kml2Exp('file.kml','file.exp',-1,'central_meridian', 0,'standard_parallel',71);");
     88        _pprintLine_("");
    8989}
    9090
  • issm/branches/trunk-jpl-damage/src/modules/Kriging/Kriging.cpp

    r12258 r12878  
    2222        /*checks on arguments on the matlab side: */
    2323        if (nrhs<NRHS || nlhs>NLHS){
    24                 KrigingUsage(); _error_("Kriging usage error");
     24                KrigingUsage(); _error2_("Kriging usage error");
    2525        }
    2626
    2727        /*Fetch inputs: */
    2828        FetchData(&x,&n_obs,X);
    29         FetchData(&y,&N,Y);                       if(n_obs!=N) _error_("x and y should have the same size");
    30         FetchData(&observations,&N,OBSERVATIONS); if(n_obs!=N) _error_("x and observations should have the same size");
     29        FetchData(&y,&N,Y);                       if(n_obs!=N) _error2_("x and y should have the same size");
     30        FetchData(&observations,&N,OBSERVATIONS); if(n_obs!=N) _error2_("x and observations should have the same size");
    3131        FetchData(&x_interp,&M_interp,&N_interp,XINTERP);
    32         FetchData(&y_interp,&M,&N,YINTERP);       if(N!=N_interp || M!=M_interp) _error_("x_interp and y_interp should have the same size");
     32        FetchData(&y_interp,&M,&N,YINTERP);       if(N!=N_interp || M!=M_interp) _error2_("x_interp and y_interp should have the same size");
    3333        FetchData(&options,NRHS,nrhs,prhs);
    3434
     
    5454
    5555void KrigingUsage(void){
    56         _printf_(true,"\n");
    57         _printf_(true,"   usage: predictions=%s(x,y,observations,x_interp,y_interp);\n",__FUNCT__);
    58         _printf_(true,"\n");
     56        _pprintLine_("");
     57        _pprintLine_("   usage: predictions=" << __FUNCT__ << "(x,y,observations,x_interp,y_interp,'options');");
     58        _pprintLine_("   available options:");
     59        _pprintLine_("      -'model': Available variogram models 'gaussian' (default),'spherical','power','exponential'");
     60        _pprintLine_("         -'nugget': nugget effect (default 0.2)");
     61        _pprintLine_("         -'range':  for gaussian, spherical and exponential models (default sqrt(3))");
     62        _pprintLine_("         -'sill':   for gaussian, spherical and exponential models (default 1)");
     63        _pprintLine_("         -'slope':  for power model (default 1)");
     64        _pprintLine_("         -'power':  for power model (default 1)");
     65        _pprintLine_("      -'searchradius': search radius for each prediction (default is observations span)");
     66        _pprintLine_("      -'boxlength':    minimum length of quadtree boxes (useful to decrease the number of observations)");
     67        _pprintLine_("      -'maxdata':      minimum number of observations for a prediction (default is 50)");
     68        _pprintLine_("      -'mindata':      maximum number of observations for a prediction (default is 1)");
     69        _pprintLine_("      -'maxtrimming':  maximum trimming value (default is -1.e+21)");
     70        _pprintLine_("      -'mintrimming':  minimum trimming value (default is +1.e+21)");
     71        _pprintLine_("      -'minspacing':   minimum distance between observation (default is 0.01)");
     72        _pprintLine_("");
    5973}
  • issm/branches/trunk-jpl-damage/src/modules/Ll2xy/Ll2xy.cpp

    r12049 r12878  
    2525        /*checks on arguments on the matlab side: */
    2626        if (nlhs > NLHS) {
    27                 Ll2xyUsage(); _error_("Ll2xy usage error");
     27                Ll2xyUsage(); _error2_("Ll2xy usage error");
    2828        }
    2929        if (nrhs < NRHS) {
    30                 Ll2xyUsage(); _error_("Ll2xy usage error");
     30                Ll2xyUsage(); _error2_("Ll2xy usage error");
    3131        }
    3232
     
    4040        if(options->GetOption("central_meridian") || options->GetOption("standard_parallel")){
    4141                options->Get(&cm,"central_meridian");
    42                 if (verbose) printf("  cm=%g\n",cm);
     42                if (verbose) _printLine_("  cm=" << cm);
    4343                options->Get(&sp,"standard_parallel");
    44                 if (verbose) printf("  sp=%g\n",sp);
     44                if (verbose) _printLine_("  sp=" << sp);
    4545        }
    4646
    4747        /*some checks*/
    48         if (verbose) printf("Checking inputs:\n");
    49         if (nlat != nlon) _error_("Must have same number of lat[%d] and lon[%d] coordinates.",nlat,nlon);
     48        if (verbose) _printLine_("Checking inputs:");
     49        if (nlat != nlon){_error2_("Must have same number of lat[" << nlat << "] and lon[" << nlon << "] coordinates.");}
    5050        else                ncoord=nlat;
    51         if (sgn != +1 && sgn != -1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);
    52         if (fabs(cm)      > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);
    53         if (sp < 0. || sp >  90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);
     51        if (sgn != +1 && sgn != -1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
     52        if (fabs(cm)      > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
     53        if (sp < 0. || sp >  90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
    5454
    5555        x=(double*)mxMalloc(ncoord*sizeof(double));
     
    7474
    7575void Ll2xyUsage(void){
    76         _printf_(true,"Ll2xy - lat/long to x/y coordinate transformation module:\n");
    77         _printf_(true,"\n");
    78         _printf_(true,"   This module transforms lat/long to x/y coordinates.\n");
    79         _printf_(true,"\n");
    80         _printf_(true,"   Usage:\n");
    81         _printf_(true,"      [x,y]=Ll2xy(lat,lon,sgn,'param name',param,...);\n");
    82         _printf_(true,"\n");
    83         _printf_(true,"      lat         latitude coordinates (double vector)\n");
    84         _printf_(true,"      lon         longitude coordinates (double vector)\n");
    85         _printf_(true,"      sgn         sign for hemisphere (double, +1 (north) or -1 (south))\n");
    86         _printf_(true,"\n");
    87         _printf_(true,"      central_meridian     central meridian (double, optional, but must specify with sp)\n");
    88         _printf_(true,"      standard_parallel    standard parallel (double, optional, but must specify with cm)\n");
    89         _printf_(true,"\n");
    90         _printf_(true,"      x           x coordinates (double vector)\n");
    91         _printf_(true,"      y           y coordinates (double vector)\n");
    92         _printf_(true,"\n");
    93         _printf_(true,"   Examples:\n");
    94         _printf_(true,"      [x,y]=Ll2xy(lat,lon, 1);\n");
    95         _printf_(true,"      [x,y]=Ll2xy(lat,lon, 1,'central_meridian',45,'standard_parallel',70);\n");
    96         _printf_(true,"      [x,y]=Ll2xy(lat,lon,-1,'central_meridian', 0,'standard_parallel',71);\n");
    97         _printf_(true,"\n");
     76        _pprintLine_("Ll2xy - lat/long to x/y coordinate transformation module:");
     77        _pprintLine_("");
     78        _pprintLine_("   This module transforms lat/long to x/y coordinates.");
     79        _pprintLine_("");
     80        _pprintLine_("   Usage:");
     81        _pprintLine_("      [x,y]=Ll2xy(lat,lon,sgn,'param name',param,...);");
     82        _pprintLine_("");
     83        _pprintLine_("      lat         latitude coordinates (double vector)");
     84        _pprintLine_("      lon         longitude coordinates (double vector)");
     85        _pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
     86        _pprintLine_("");
     87        _pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
     88        _pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
     89        _pprintLine_("");
     90        _pprintLine_("      x           x coordinates (double vector)");
     91        _pprintLine_("      y           y coordinates (double vector)");
     92        _pprintLine_("");
     93        _pprintLine_("   Examples:");
     94        _pprintLine_("      [x,y]=Ll2xy(lat,lon, 1);");
     95        _pprintLine_("      [x,y]=Ll2xy(lat,lon, 1,'central_meridian',45,'standard_parallel',70);");
     96        _pprintLine_("      [x,y]=Ll2xy(lat,lon,-1,'central_meridian', 0,'standard_parallel',71);");
     97        _pprintLine_("");
    9898}
  • issm/branches/trunk-jpl-damage/src/modules/MeshPartition/MeshPartition.cpp

    r12060 r12878  
    9696
    9797void MeshPartitionUsage(void){
    98         printf("   usage:\n");
    99         printf("   [element_partitioning,node_partitioning]=MeshPartition(md.mesh,numpartitions)");
    100         printf("   where:\n");
    101         printf("      element_partitioning is a vector of partitioning area numbers, for every element.\n");
    102         printf("      node_partitioning is a vector of partitioning area numbers, for every node.\n");
    103         printf("\n");
     98        _printLine_("   usage:");
     99        _printString_("   [element_partitioning,node_partitioning]=MeshPartition(md.mesh,numpartitions)");
     100        _printLine_("   where:");
     101        _printLine_("      element_partitioning is a vector of partitioning area numbers, for every element.");
     102        _printLine_("      node_partitioning is a vector of partitioning area numbers, for every node.");
     103        _printLine_("");
    104104}
  • issm/branches/trunk-jpl-damage/src/modules/MeshProfileIntersection/MeshProfileIntersection.cpp

    r12060 r12878  
    5454        //index
    5555        FetchData(&double_index,&nel,&dummy,INDEX);
    56         if(dummy!=3 && dummy!=6)_error_(" element triangulation should be of 3 or 6 column width!");
     56        if(dummy!=3 && dummy!=6)_error2_("element triangulation should be of 3 or 6 column width!");
    5757        index=(int*)xmalloc(nel*3*sizeof(int));
    5858        for(i=0;i<nel;i++){
     
    8181        /* Debugging of contours :{{{1*/
    8282        /*for(i=0;i<numcontours;i++){
    83                 printf("\nContour echo: contour number  %i / %i\n",i+1,numcontours);
     83                _printLine_("\nContour echo: contour number  " << i+1 << " / " << numcontours);
    8484                contouri=*(contours+i);
    85                 printf("   Number of vertices %i\n",contouri->nods);
     85                _printLine_("   Number of vertices " << contouri->nods);
    8686                for (j=0;j<contouri->nods;j++){
    87                         printf("   %lf %lf\n",*(contouri->x+j),*(contouri->y+j));
     87                        _printLine_("   " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f");
    8888                }
    8989        }*/
     
    102102
    103103void MeshProfileIntersectionUsage(void){
    104         printf("   usage:\n");
    105         printf("   [segments]=MeshProfileIntersection(index,x,y,filename);\n");
    106         printf("   where:\n");
    107         printf("   input:\n");
    108         printf("        index,x,y is a triangulation\n");
    109         printf("        filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)\n");
    110         printf("   output:\n");
    111         printf("        segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment \n");
    112         printf("        belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the \n");
    113         printf("        mesh.\n");
     104        _printLine_("   usage:");
     105        _printLine_("   [segments]=MeshProfileIntersection(index,x,y,filename);");
     106        _printLine_("   where:");
     107        _printLine_("   input:");
     108        _printLine_("        index,x,y is a triangulation");
     109        _printLine_("        filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)");
     110        _printLine_("   output:");
     111        _printLine_("        segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment ");
     112        _printLine_("        belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the ");
     113        _printLine_("        mesh.");
    114114}
  • issm/branches/trunk-jpl-damage/src/modules/NodeConnectivity/NodeConnectivity.cpp

    r12112 r12878  
    3737
    3838void NodeConnectivityUsage(void) {
    39         _printf_(true,"\n");
    40         _printf_(true,"   usage: connectivity = %s(elements, numnodes);\n",__FUNCT__);
    41         _printf_(true,"\n");
     39        _pprintLine_("");
     40        _pprintLine_("   usage: connectivity = " << __FUNCT__ << "(elements, numnodes);");
     41        _pprintLine_("");
    4242}
  • issm/branches/trunk-jpl-damage/src/modules/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp

    r11933 r12878  
    4242
    4343void PointCloudFindNeighborsUsage(void){
    44         printf("   usage:\n");
    45         printf("   [flags]=PointCloudFindNeighbors(x,y,mindistance,multithread);\n\n");
    46         printf("   where:\n");
    47         printf("      x,y: list of points.\n");
    48         printf("      mindistance: minimum distance that should exist between points in the cloud.\n");
    49         printf("      multithread: run multithreaded or not. with multithreads, flags can get 1 and 2 values in duplicates.\n");
    50         printf("      flags: array of flags (flag==1 means point is within mindistance of another point)\n");
    51         printf("\n");
     44        _printLine_("   usage:");
     45        _printLine_("   [flags]=PointCloudFindNeighbors(x,y,mindistance,multithread);\n");
     46        _printLine_("   where:");
     47        _printLine_("      x,y: list of points.");
     48        _printLine_("      mindistance: minimum distance that should exist between points in the cloud.");
     49        _printLine_("      multithread: run multithreaded or not. with multithreads, flags can get 1 and 2 values in duplicates.");
     50        _printLine_("      flags: array of flags (flag==1 means point is within mindistance of another point)");
     51        _printLine_("");
    5252}
  • issm/branches/trunk-jpl-damage/src/modules/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp

    r11933 r12878  
    4242
    4343void PropagateFlagsFromConnectivityUsage(void) {
    44         printf("\n");
    45         printf("   usage: [pool] = %s(connectivity,pool,index,flags);\n",__FUNCT__);
    46         printf("\n");
     44        _printLine_("");
     45        _printLine_("   usage: [pool] = " << __FUNCT__ << "(connectivity,pool,index,flags);");;
     46        _printLine_("");
    4747}
  • issm/branches/trunk-jpl-damage/src/modules/Scotch/Scotch.cpp

    r6412 r12878  
    2525
    2626#ifndef _HAVE_SCOTCH_ //only works if scotch library has been compiled in.
    27         _error_(" Scotch not available! Cannot carry out Scotch partitioning!");
     27        _error2_("Scotch not available! Cannot carry out Scotch partitioning!");
    2828        #else
    2929
  • issm/branches/trunk-jpl-damage/src/modules/Shp2Kml/Shp2Kml.cpp

    r12049 r12878  
    2525
    2626        #ifndef _HAVE_SHAPELIB_ //only works if shapelib library has been compiled in.
    27         _error_(" Shapelib not available! Cannot carry out shp file translation!");
     27        _error2_("Shapelib not available! Cannot carry out shp file translation!");
    2828        #endif
    2929
     
    3333        /*checks on arguments on the matlab side: */
    3434        if (nlhs > NLHS) {
    35                 Shp2KmlUsage(); _error_("Shp2Kml usage error");
     35                Shp2KmlUsage(); _error2_("Shp2Kml usage error");
    3636        }
    3737        if (nrhs < NRHS) {
    38                 Shp2KmlUsage(); _error_("Shp2Kml usage error");
     38                Shp2KmlUsage(); _error2_("Shp2Kml usage error");
    3939        }
    4040
     
    4848        if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
    4949                options->Get(&cm,"central_meridian");
    50                 if (verbose) printf("  cm=%g\n",cm);
     50                if (verbose) _printLine_("  cm=" << cm);
    5151                options->Get(&sp,"standard_parallel");
    52                 if (verbose) printf("  sp=%g\n",sp);
     52                if (verbose) _printLine_("  sp=" << sp);
    5353        }
    5454
    5555        /*some checks*/
    56         if (sgn < -1 || sgn > +1) _error_("Hemisphere sgn=%d must be +1 (north), -1 (south), or 0 (no translation).",sgn);
    57         if (fabs(cm)      > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);
    58         if (sp < 0. || sp >  90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);
     56        if (sgn < -1 || sgn > +1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north), -1 (south), or 0 (no translation).");
     57        if (fabs(cm)      > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
     58        if (sp < 0. || sp >  90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
    5959
    6060        /* Run core computations: */
     
    7777
    7878void Shp2KmlUsage(void){
    79         _printf_(true,"Shp2Kml - shp to kml file conversion module:\n");
    80         _printf_(true,"\n");
    81         _printf_(true,"   This module converts a file from shp to kml format.\n");
    82         _printf_(true,"\n");
    83         _printf_(true,"   Usage:\n");
    84         _printf_(true,"      [ret]=Shp2Kml(filshp,filkml,sgn,'param name',param,...);\n");
    85         _printf_(true,"\n");
    86         _printf_(true,"      filshp      file name of shp file to be read (char, extension optional)\n");
    87         _printf_(true,"      filkml      file name of kml file to be written (char)\n");
    88         _printf_(true,"      sgn         sign for hemisphere (double, +1 (north); -1 (south); or 0 (no translation))\n");
    89         _printf_(true,"\n");
    90         _printf_(true,"      central_meridian     central meridian (double, optional, but must specify with sp)\n");
    91         _printf_(true,"      standard_parallel    standard parallel (double, optional, but must specify with cm)\n");
    92         _printf_(true,"\n");
    93         _printf_(true,"      ret         return code (non-zero for warning)\n");
    94         _printf_(true,"\n");
    95         _printf_(true,"   Examples:\n");
    96         _printf_(true,"      [ret]=Shp2Kml('file.shp','file.kml', 0);\n");
    97         _printf_(true,"      [ret]=Shp2Kml('file.shp','file.kml', 1,'central_meridian',45,'standard_parallel',70);\n");
    98         _printf_(true,"      [ret]=Shp2Kml('file.shp','file.kml',-1,'central_meridian', 0,'standard_parallel',71);\n");
    99         _printf_(true,"\n");
     79        _pprintLine_("Shp2Kml - shp to kml file conversion module:");
     80        _pprintLine_("");
     81        _pprintLine_("   This module converts a file from shp to kml format.");
     82        _pprintLine_("");
     83        _pprintLine_("   Usage:");
     84        _pprintLine_("      [ret]=Shp2Kml(filshp,filkml,sgn,'param name',param,...);");
     85        _pprintLine_("");
     86        _pprintLine_("      filshp      file name of shp file to be read (char, extension optional)");
     87        _pprintLine_("      filkml      file name of kml file to be written (char)");
     88        _pprintLine_("      sgn         sign for hemisphere (double, +1 (north); -1 (south); or 0 (no translation))");
     89        _pprintLine_("");
     90        _pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
     91        _pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
     92        _pprintLine_("");
     93        _pprintLine_("      ret         return code (non-zero for warning)");
     94        _pprintLine_("");
     95        _pprintLine_("   Examples:");
     96        _pprintLine_("      [ret]=Shp2Kml('file.shp','file.kml', 0);");
     97        _pprintLine_("      [ret]=Shp2Kml('file.shp','file.kml', 1,'central_meridian',45,'standard_parallel',70);");
     98        _pprintLine_("      [ret]=Shp2Kml('file.shp','file.kml',-1,'central_meridian', 0,'standard_parallel',71);");
     99        _pprintLine_("");
    100100}
  • issm/branches/trunk-jpl-damage/src/modules/StringToEnum/StringToEnum.cpp

    r11933 r12878  
    1212        /*checks on arguments on the matlab side: */
    1313        if(nrhs!=NRHS){
    14                 StringToEnumUsage(); _error_(" usage. See above");
     14                StringToEnumUsage(); _error2_("usage. See above");
    1515        }
    1616
     
    2727void StringToEnumUsage(void)
    2828{
    29         _printf_(true,"\n");
    30         _printf_(true,"   usage: %senum = StringToEnum(string);\n",__FUNCT__);
    31         _printf_(true,"\n");
     29        _pprintLine_("");
     30        _pprintLine_("   usage: " << __FUNCT__ << "enum = StringToEnum(string);");
     31        _pprintLine_("");
    3232}
  • issm/branches/trunk-jpl-damage/src/modules/TriMesh/TriMesh.cpp

    r12112 r12878  
    5151        delete domain;
    5252        delete rifts;
    53         xdelete_module(&index);
    54         xdelete_module(&x);
    55         xdelete_module(&y);
    56         xdelete_module(&segments);
    57         xdelete_module(&segmentmarkerlist);
     53        delete index;
     54        delete x;
     55        delete y;
     56        delete segments;
     57        delete segmentmarkerlist;
    5858
    5959        /*end module: */
     
    6363void TriMeshUsage(void) //{{{1
    6464{
    65         printf("\n");
    66         printf("   usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,rifts,area) \n");
    67         printf("      where: index,x,y defines a triangulation, segments is an array made \n");
    68         printf("      of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, \n");
    69         printf("      outlinefilename an Argus domain outline file, \n");
    70         printf("      area is the maximum area desired for any element of the resulting mesh, \n");
    71         printf("\n");
     65        _printLine_("");
     66        _printLine_("   usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,rifts,area) ");
     67        _printLine_("      where: index,x,y defines a triangulation, segments is an array made ");
     68        _printLine_("      of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, ");
     69        _printLine_("      outlinefilename an Argus domain outline file, ");
     70        _printLine_("      area is the maximum area desired for any element of the resulting mesh, ");
     71        _printLine_("");
    7272}
    7373//}}}
  • issm/branches/trunk-jpl-damage/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp

    r12085 r12878  
    6666                mexPrintf("   %s format error.\n", __FUNCT__);
    6767                TriMeshProcessRiftsUsage();
    68                 printf("   ");
    69                 mexErrMsgTxt(" ");
     68                _error_("bad usage");
    7069        }
    7170
     
    8281        }
    8382        else{
    84                 printf("%s%s\n",__FUNCT__," error message: first argument should be the element list!");
    85                 mexErrMsgTxt(" ");
     83                _error_("first argument should be the element list");
    8684        }
    8785
     
    9694        }
    9795        else{
    98                 printf("%s%s\n",__FUNCT__," error message: second argument should be the x corrdinate list!");
    99                 mexErrMsgTxt(" ");
     96                _error_("second argument should be the x corrdinate list");
    10097        }
    10198
     
    109106        }
    110107        else{
    111                 printf("%s%s\n",__FUNCT__," error message: third argument should be the y corrdinate list!");
    112                 mexErrMsgTxt(" ");
     108                _error_("third argument should be the y corrdinate list");
    113109        }       
    114110
     
    125121        }
    126122        else{
    127                 printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segments list!");
    128                 mexErrMsgTxt(" ");
     123                _error_("fourth argument should be the segments list");
    129124        }
    130125
     
    138133        }
    139134        else{
    140                 printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segmentmarkers list!");
    141                 mexErrMsgTxt(" ");
    142         }
    143 
    144         /*
    145         printf("Index: \n");
    146         for (i=0;i<nel;i++){
    147                 for(j=0;j<3;j++){
    148                         printf("%lf ",*(index_in+3*i+j));
    149                 }
    150                 printf("\n");
    151         }
    152         printf("x,y: \n");
    153         for (i=0;i<nods;i++){
    154                 printf("%16.16lf %16.16lf\n",x_in[i],y_in[i]);
    155         }
    156         printf("segments:\n");
    157         for (i=0;i<num_seg;i++){
    158                 for(j=0;j<3;j++){
    159                         printf("%lf ",*(segments_in+3*i+j));
    160                 }
    161                 printf("%lf ",segmentmarkers_in[i]);
    162                 printf("\n");
    163         }
    164         */
     135                _error_("fourth argument should be the segmentmarkers list");
     136        }
    165137
    166138        /*First, do some fixing on the existing mesh: we do not want any element belonging entirely to the segment list (ie:
     
    325297void TriMeshProcessRiftsUsage(void)
    326298{
    327         printf("\n");
    328         printf("   usage: [index2,x2,y2,segments2,segmentmarkers2,rifts2]=TriMeshProcessrifts(index1,x1,y1,segments1,segmentmarkers1) \n");
    329         printf("      where: (index1,x1,y1,segments1,segmentmarkers1) is an initial triangulation.\n");
    330         printf("      index2,x2,y2,segments2,segmentmarkers2,rifts2 is the resulting triangulation where rifts have been processed.\n");
     299        _printLine_("");
     300        _printLine_("   usage: [index2,x2,y2,segments2,segmentmarkers2,rifts2]=TriMeshProcessrifts(index1,x1,y1,segments1,segmentmarkers1) ");
     301        _printLine_("      where: (index1,x1,y1,segments1,segmentmarkers1) is an initial triangulation.");
     302        _printLine_("      index2,x2,y2,segments2,segmentmarkers2,rifts2 is the resulting triangulation where rifts have been processed.");
    331303}
  • issm/branches/trunk-jpl-damage/src/modules/TriaSearch/TriaSearch.cpp

    r11933 r12878  
    99
    1010        /*input: */
    11         double* index=NULL;
     11        int*    index=NULL;
    1212        int     nel;
    1313        int     dummy;
     
    3737        FetchData(&y0,&numberofnodes,Y0HANDLE);
    3838
    39         /* Echo: {{{1*/
    40         //printf("(x0,y0)=(%g,%g)\n",x0,y0);
    41         /*}}}*/
    42 
    4339        /* Run core computations: */
    4440        TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes);
     
    5450}
    5551
    56 void TriaSearchUsage(void)
    57 {
    58         _printf_(true,"TriaSearch- find triangle holding a point (x0,y0) in a mesh\n");
    59         _printf_(true,"\n");
    60         _printf_(true,"   Usage:\n");
    61         _printf_(true,"         tria=TriaSearch(index,x,y,x0,y0);\n");
    62         _printf_(true,"      index,x,y: mesh triangulatrion\n");
    63         _printf_(true,"      x0,y0: coordinates of the point for which we are trying to find a triangle\n");
    64         _printf_(true,"      x0,y0 can be an array of points\n");
    65         _printf_(true,"\n");
     52void TriaSearchUsage(void){
     53        _pprintLine_("TriaSearch- find triangle holding a point (x0,y0) in a mesh");
     54        _pprintLine_("");
     55        _pprintLine_("   Usage:");
     56        _pprintLine_("         tria=TriaSearch(index,x,y,x0,y0);");
     57        _pprintLine_("      index,x,y: mesh triangulatrion");
     58        _pprintLine_("      x0,y0: coordinates of the point for which we are trying to find a triangle");
     59        _pprintLine_("      x0,y0 can be an array of points");
     60        _pprintLine_("");
    6661}
  • issm/branches/trunk-jpl-damage/src/modules/Xy2ll/Xy2ll.cpp

    r12049 r12878  
    2424        /*checks on arguments on the matlab side: */
    2525        if (nlhs > NLHS) {
    26                 Xy2llUsage(); _error_("Xy2ll usage error");
     26                Xy2llUsage(); _error2_("Xy2ll usage error");
    2727        }
    2828        if (nrhs < NRHS) {
    29                 Xy2llUsage(); _error_("Xy2ll usage error");
     29                Xy2llUsage(); _error2_("Xy2ll usage error");
    3030        }
    3131
     
    3939        if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
    4040                options->Get(&cm,"central_meridian");
    41                 if (verbose) printf("  cm=%g\n",cm);
     41                if (verbose) _printLine_("  cm=" << cm);
    4242                options->Get(&sp,"standard_parallel");
    43                 if (verbose) printf("  sp=%g\n",sp);
     43                if (verbose) _printLine_("  sp=" << sp);
    4444        }
    4545
    4646        /*some checks*/
    47         if   (nx != ny) _error_("Must have same number of x[%d] and y[%d] coordinates.",nx,ny);
     47        if   (nx != ny){_error2_("Must have same number of x[" << nx << "] and y[" << ny << "] coordinates.");}
    4848        else            ncoord=nx;
    49         if (sgn != +1 && sgn != -1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);
    50         if (fabs(cm)      > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);
    51         if (sp < 0. || sp >  90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);
     49        if (sgn != +1 && sgn != -1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
     50        if (fabs(cm)      > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
     51        if (sp < 0. || sp >  90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
    5252
    5353        lat=(double*)mxMalloc(ncoord*sizeof(double));
     
    5555
    5656        /* Run core computations: */
    57         if (verbose) printf("Calling core:\n");
     57        if (verbose) _printLine_("Calling core:");
    5858        if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
    5959                iret=Xy2llx(lat,lon,x,y,ncoord,sgn,cm,sp);
     
    7373
    7474void Xy2llUsage(void){
    75         _printf_(true,"Xy2ll - x/y to lat/long coordinate transformation module:\n");
    76         _printf_(true,"\n");
    77         _printf_(true,"   This module transforms x/y to lat/long coordinates.\n");
    78         _printf_(true,"\n");
    79         _printf_(true,"   Usage:\n");
    80         _printf_(true,"      [lat,lon]=Xy2ll(x,y,sgn,'param name',param,...);\n");
    81         _printf_(true,"\n");
    82         _printf_(true,"      x           x coordinates (double vector)\n");
    83         _printf_(true,"      y           y coordinates (double vector)\n");
    84         _printf_(true,"      sgn         sign for hemisphere (double, +1 (north) or -1 (south))\n");
    85         _printf_(true,"\n");
    86         _printf_(true,"      central_meridian     central meridian (double, optional, but must specify with sp)\n");
    87         _printf_(true,"      standard_parallel    standard parallel (double, optional, but must specify with cm)\n");
    88         _printf_(true,"\n");
    89         _printf_(true,"      lat         latitude coordinates (double vector)\n");
    90         _printf_(true,"      lon         longitude coordinates (double vector)\n");
    91         _printf_(true,"\n");
    92         _printf_(true,"   Examples:\n");
    93         _printf_(true,"      [lat,lon]=Xy2ll(x,y, 1);\n");
    94         _printf_(true,"      [lat,lon]=Xy2ll(x,y, 1,'central_meridian',45,'standard_parallel',70);\n");
    95         _printf_(true,"      [lat,lon]=Xy2ll(x,y,-1,'central_meridian', 0,'standard_parallel',71);\n");
    96         _printf_(true,"\n");
     75        _pprintLine_("Xy2ll - x/y to lat/long coordinate transformation module:");
     76        _pprintLine_("");
     77        _pprintLine_("   This module transforms x/y to lat/long coordinates.");
     78        _pprintLine_("");
     79        _pprintLine_("   Usage:");
     80        _pprintLine_("      [lat,lon]=Xy2ll(x,y,sgn,'param name',param,...);");
     81        _pprintLine_("");
     82        _pprintLine_("      x           x coordinates (double vector)");
     83        _pprintLine_("      y           y coordinates (double vector)");
     84        _pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
     85        _pprintLine_("");
     86        _pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
     87        _pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
     88        _pprintLine_("");
     89        _pprintLine_("      lat         latitude coordinates (double vector)");
     90        _pprintLine_("      lon         longitude coordinates (double vector)");
     91        _pprintLine_("");
     92        _pprintLine_("   Examples:");
     93        _pprintLine_("      [lat,lon]=Xy2ll(x,y, 1);");
     94        _pprintLine_("      [lat,lon]=Xy2ll(x,y, 1,'central_meridian',45,'standard_parallel',70);");
     95        _pprintLine_("      [lat,lon]=Xy2ll(x,y,-1,'central_meridian', 0,'standard_parallel',71);");
     96        _pprintLine_("");
    9797}
    9898
  • issm/branches/trunk-jpl-damage/src/modules/matlab

    • Property svn:ignore
      •  

        old new  
        22Makefile
        33*.lib
         4*.mexa64
        45*.mexw64
        56*.manifest
  • issm/branches/trunk-jpl-damage/src/modules/matlab/Makefile.am

    r12164 r12878  
    1 INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
     1INCLUDES = @DAKOTAINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
    22EXEEXT=$(MATLABWRAPPEREXT)
    33#Bin programs {{{1
     
    4141#}}}
    4242#Flags and libraries {{{1
    43 LDADD = ../../c/libISSMCore.a ../../c/libISSMModules.a $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)
     43LDADD = ../../c/libISSMCore.a ../../c/libISSMModules.a $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(SPOOLESLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)
    4444
    4545#Triangle library
     
    5050AM_CXXFLAGS +=  -D_HAVE_MATLAB_MODULES_ -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
    5151LDADD       += $(MEXLIB) ../../c/libISSMMatlab.a
    52 
    53 LDADD       += ../../c/libISSMCore.a ../../c/libISSMModules.a
     52LDADD       += ../../c/libISSMCore.a
     53if CIRCULAR_DEPENDENCIES
     54LDADD       += $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(SPOOLESLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)
     55endif
     56LDADD       += ../../c/libISSMModules.a
    5457
    5558#Optimization flags:
  • issm/branches/trunk-jpl-damage/src/modules/python

    • Property svn:ignore
      •  

        old new  
         1*.deps
         2Makefile.in
        13Makefile
  • issm/branches/trunk-jpl-damage/src/modules/python/Makefile.am

    r12118 r12878  
    1 INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
     1INCLUDES = @DAKOTAINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
    22EXEEXT=$(PYTHONWRAPPEREXT)
    33#Bin programs {{{1
     
    1717#Python part
    1818AM_LDFLAGS   = $(PYTHONLINK)
    19 AM_CXXFLAGS +=  -D_HAVE_PYTHON_MODULES_
     19AM_CXXFLAGS +=  -D_HAVE_PYTHON_MODULES_  -fPIC
    2020if PYTHON3
    2121AM_CXXFLAGS +=  -DNPY_NO_DEPRECATED_API
  • issm/branches/trunk-jpl-damage/src/py

    • Property svn:ignore
      •  

        old new  
        11Makefile
         2Makefile.in
  • issm/branches/trunk-jpl-damage/src/py/model

    • Property svn:ignore
      •  

        old new  
        11Makefile
         2Makefile.in
        23__pycache__
  • issm/branches/trunk-jpl-damage/startup.py

    r12168 r12878  
    2222#ISSM path. Go through src/py and load everything we find  that looks like a python file
    2323for root,dirs,files in os.walk(ISSM_DIR+ '/src/py'):
     24        if '.svn' in dirs:
     25                dirs.remove('.svn')
    2426        for file in files:
    2527                if file.find(".py") != -1:
     
    3133
    3234for root,dirs,files in os.walk(ISSM_DIR+ '/src/m'):
     35        if '.svn' in dirs:
     36                dirs.remove('.svn')
    3337        for file in files:
    3438                if file.find(".py") != -1:
     
    6468from settings import *
    6569from solver import *
    66 from issmtier  import *
    6770from ismumps  import *
    6871from pairoptions  import *
     
    7780from stokesoptions import *
    7881from generic import *
    79 from none import *
    80 from none import *
    8182from hydrology import *
    8283from miscellaneous import *
  • issm/branches/trunk-jpl-damage/test/NightlyRun/IdFromString.m

    r5111 r12878  
    2222%return if no test found
    2323if isempty(ids_raw),
    24         disp(['No test matches ''' string '' ]);
     24        disp(['No test matches ''' string '''' ]);
    2525        return
    2626end
  • issm/branches/trunk-jpl-damage/test/NightlyRun/runme.m

    r12168 r12878  
    4949if ~ismember(benchmark,{'all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing'})
    5050        disp('runme warning: benchmark not supported, defaulting to test ''nightly''')
    51         benchmark='nighlty';
     51        benchmark='nightly';
    5252end
    5353% }}}
     
    8787test_ids=intersect(test_ids,list_ids);
    8888% }}}
    89 %GET exculde {{{1
     89%GET exclude {{{1
    9090exclude_ids=getfieldvalue(options,'exclude',[]);
    9191exclude_ids=[exclude_ids];
     
    126126
    127127                        if ~strcmp(oshostname(),'larsen');
    128                                 error(['Nighlty run archives must be saved on "larsen" (hostname is "' oshostname() '")']);
     128                                error(['Nightly run archives must be saved on "larsen" (hostname is "' oshostname() '")']);
    129129                        end
    130130                        for k=1:length(field_names),
     
    135135                        disp(sprintf(['File ./../Archives/' archive_name ' saved\n']));
    136136
    137                         %ELSE: CHECK TEST
     137                %ELSE: CHECK TEST
    138138                else,
    139139
  • issm/branches/trunk-jpl-damage/test/NightlyRun/test1107.m

    r11323 r12878  
    131131};
    132132field_tolerances={...
    133         1e-08,1e-08,1e-06,...
     133        1e-07,1e-08,1e-06,...
    134134        1e-08,1e-08,1e-06,...
    135135        1e-08,1e-08,1e-07,...
  • issm/branches/trunk-jpl-damage/test/NightlyRun/test1108.m

    r11244 r12878  
    7474        1e-07,1e-07,1e-07,...
    7575        1e-08,1e-08,1e-08,...
    76         1e-08,1e-07,1e-08,...
     76        1e-08,1e-07,1e-07,...
    7777        1e-08,1e-08,1e-08,...
    7878        1e-08,1e-07,1e-07,...
  • issm/branches/trunk-jpl-damage/test/Par/SquareShelfConstrained.par

    r11467 r12878  
    5151md=SetIceShelfBC(md);
    5252
    53 %Change name so that no test have the same name
     53%Change name so that no tests have the same name
    5454A=dbstack;
    5555if (length(A)>2), md.miscellaneous.name=A(3).file(1:end-2); end
  • issm/branches/trunk-jpl-damage/test/Par/SquareShelfConstrained.py

    r12168 r12878  
    44import InterpFromMeshToMesh2d as im
    55from   paterson import  *
     6from SetIceShelfBC import *
     7import inspect
    68
    79#Start defining model parameters here
     
    1820#Initial velocity
    1921mat=matio.loadmat('../Data/SquareShelfConstrained.data')
     22#Reshape as Rank-1 arrays
     23x=reshape(mat['x'],(-1))
     24y=reshape(mat['y'],(-1))
     25vx=mat['vx']
     26vy=mat['vy']
    2027#deal with 'F' oriented matlab matrices!
    2128index=mat['index'].astype(float)
    2229index=reshape(index.T,(len(index),3),order='F')
    2330
    24 md.initialization.vx = im.InterpFromMeshToMesh2d(index, mat['x'], mat['y'], mat['vx'], md.mesh.x, md.mesh.y)
    25 md.initialization.vy = im.InterpFromMeshToMesh2d(index, mat['x'], mat['y'], mat['vy'], md.mesh.x, md.mesh.y)
     31md.initialization.vx = im.InterpFromMeshToMesh2d(index, x, y, vx, md.mesh.x, md.mesh.y)
     32md.initialization.vy = im.InterpFromMeshToMesh2d(index, x, y, vy, md.mesh.x, md.mesh.y)
    2633md.initialization.vz = zeros(md.mesh.numberofvertices)
    2734md.initialization.pressure = zeros(md.mesh.numberofvertices)
     
    5360#Deal with boundary conditions:
    5461md = SetIceShelfBC(md)
    55 #Change name so that no test have the same name
    56 A = dbstack
    57 if length(A) > 2.:
    58     md.miscellaneous.name = A[2].file[0:0-2.]
     62#Change name so that no tests have the same name
     63if len(inspect.stack()) > 2:
     64    md.miscellaneous.name = inspect.stack()[2][1].split('.')[0]
    5965
Note: See TracChangeset for help on using the changeset viewer.