Changeset 12878
- Timestamp:
- 08/02/12 17:13:12 (13 years ago)
- Location:
- issm/branches/trunk-jpl-damage
- Files:
-
- 243 deleted
- 770 edited
- 273 copied
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-jpl-damage
- Property svn:mergeinfo changed
-
issm/branches/trunk-jpl-damage/Makefile.am
r12004 r12878 1 EXTRA_DIST = reconf 1 EXTRA_DIST = reconf scripts test m4 examples cron etc doc packages contributors.txt 2 2 SUBDIRS = src bin 3 3 bin_SCRIPTS=config.h startup.m README.rtf -
issm/branches/trunk-jpl-damage/README
r11577 r12878 22 22 ------------------------------------------------------------------------------ 23 23 24 Website: ttp://issm.jpl.nasa.gov/ for additional information.24 Website: http://issm.jpl.nasa.gov/ for additional information. 25 25 26 26 ------------------------------------------------------------------------------ -
issm/branches/trunk-jpl-damage/bin
- Property svn:ignore
-
old new 1 *.exe 1 2 *.mexa64 2 3 *.mexw64
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/configs/config-arm-linux.sh
r12258 r12878 3 3 ./configure \ 4 4 --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 \ 6 9 --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/ csh1 #!/bin/sh 2 2 3 3 #PETSc 3.2 … … 10 10 --with-metis-dir=$ISSM_DIR/externalpackages/metis/install \ 11 11 --with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install \ 12 --with-tao-dir=$ISSM_DIR/externalpackages/tao/install \ 12 13 --with-mpi-include="/sopt/mpi/openmpi-1.5.4_psm/intel/include/" \ 13 14 --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 1 1 #!/bin/sh 2 2 3 #petsc 3.24 #mpich 1.45 6 3 ./configure \ 7 --with-serial=no\8 4 --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\ 22 6 --without-thermal \ 23 7 --without-control \ … … 31 15 --without-transient \ 32 16 --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 4 4 #mpich 1.4 5 5 6 pythonversion=2.7 7 6 8 ./configure \ 7 9 --prefix=$ISSM_DIR \ 8 10 --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \ 9 11 --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\ 11 14 --with-metis-dir=$ISSM_DIR/externalpackages/metis/install \ 12 15 --with-mpi-include=$ISSM_DIR/externalpackages/mpich2/install/include \ -
issm/branches/trunk-jpl-damage/configs/config-macosx64-larour.sh
r12168 r12878 24 24 --with-blacs-dir=$ISSM_DIR/externalpackages/petsc/install/ \ 25 25 --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 2 2 3 3 #AUTOCONF 4 AC_INIT([ISSM],[4. 1],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure4 AC_INIT([ISSM],[4.2.1],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure 5 5 AC_CONFIG_AUX_DIR([./aux-config]) #Put config files in aux-config 6 6 AC_CONFIG_MACRO_DIR([m4]) #m4 macros are located in m4 … … 10 10 AC_PROG_CPP 11 11 AC_PROG_CXX([cccl cl icl g++]) 12 #AC_PROG_F77([ifort g77 gfortran])12 AC_PROG_F77([ifort g77 gfortran]) 13 13 #Libraries and linking 14 AC_PROG_RANLIB15 14 AC_F77_LIBRARY_LDFLAGS 16 15 AC_PATH_XTRA #figure out X library and include paths … … 23 22 AM_PROG_CC_C_O 24 23 25 ##LIBTOOL? 26 #AC_PROG_LIBTOOL 24 AM_PROG_AR 25 AC_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 # 27 31 #LT_INIT 28 32 … … 31 35 32 36 #AM_PROG_AR must be placed after ISSM_OPTIONS 33 AM_PROG_AR34 37 35 38 #List all Makefiles -
issm/branches/trunk-jpl-damage/etc/environment.csh
r12168 r12878 127 127 setenv VALGRIND_DIR {$VALGRIND_DIR} 128 128 setenv PATH {$PATH}:{$VALGRIND_DIR} 129 130 #MERCURIAL 131 #setenv PYTHONPATH {$PYTHONPATH}:{$MERCURIAL_DIR}/mercurial/pure/ 132 setenv PYTHONPATH {$MERCURIAL_DIR}/mercurial/pure/ 133 setenv PATH {$PATH}:{$MERCURIAL_DIR} 134 135 #GSL 136 setenv GSL_DIR {$GSL_DIR} 137 setenv LD_LIBRARY_PATH {$LD_LIBRARY_PATH}:{$GSL_DIR}/lib 138 139 #CMAKE 140 setenv PATH {$PATH}:{$CMAKE_DIR}/bin -
issm/branches/trunk-jpl-damage/etc/environment.sh
r12258 r12878 39 39 #PETSC 40 40 export PETSC_DIR 41 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PETSC_DIR/lib/$ISSM_ARCH "41 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PETSC_DIR/lib/$ISSM_ARCH:$PETSC_DIR/lib" 42 42 export LD_RUN_PATH="$LD_RUN_PATH:$PETSC_DIR/lib/$ISSM_ARCH" 43 43 … … 262 262 export PATH="$PYTHON_DIR/bin:$PATH" 263 263 export PYTHONPATH="$PYTHONPATH:$ISSM_DIR/src/modules/python" 264 export LD_LIBRARY_PATH=$ISSM_DIR/src/modules/python:$ LD_LIBRARY_PATH264 export LD_LIBRARY_PATH=$ISSM_DIR/src/modules/python:$ISSM_DIR/externalpackages/python/install/lib:$LD_LIBRARY_PATH 265 265 export PYTHONSTARTUP 266 266 … … 270 270 #GIT 271 271 export PATH="$PATH:$GIT_DIR/install/bin" 272 273 #NCVIEW 274 export PATH="$PATH:$NCVIEW_DIR/install" 275 276 #TCLX 277 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TCLX_DIR" 278 export LD_RUN_PATH="$LD_RUN_PATH:$TCLX_DIR" 279 280 281 #ASPELL 282 export PATH="$ASPELL_DIR/install/bin:$PATH" 283 284 285 #ESMF 286 export ESMF_DIR=$ISSM_DIR/externalpackages/esmf/esmf 287 export ESMF_COMPILER=gfortran 288 export ESMF_COMM=mpich2 289 290 #HDF5 291 export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$HDF5_DIR/lib" 292 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HDF5_DIR/lib" 293 export LIBRARY_PATH="$LIBRARY_PATH:$HDF5_DIR/lib" 294 export C_INCLUDE_PATH="$C_INCLUDE_PATH:$HDF5_DIR/include" 295 -
issm/branches/trunk-jpl-damage/etc/environment_variables.csh
r12168 r12878 81 81 set SSH_DIR={$ISSM_DIR}/externalpackages/ssh 82 82 83 #mercurial 84 set MERCURIAL_DIR={$ISSM_DIR}/externalpackages/mercurial/install 85 83 86 #valgrind 84 87 set VALGRIND_DIR={$ISSM_DIR}/externalpackages/valgrind/install/bin 88 89 #gsl 90 set GSL_DIR={$ISSM_DIR}/externalpackages/gsl/install 91 92 #cmake 93 set CMAKE_DIR={$ISSM_DIR}/externalpackages/cmake/install -
issm/branches/trunk-jpl-damage/etc/environment_variables.sh
r12258 r12878 182 182 ANDROID_SDK_DIR="$ANDROID_DIR/android-sdk/install-sdk" 183 183 184 #android-ant185 ANDROID_ANT_DIR="$ANDROID_DIR/android-sdk/install-ant"186 187 184 #gsl 188 185 GSL_DIR="$ISSM_DIR/externalpackages/gsl/install" … … 192 189 193 190 #PYTHON 191 PYTHON_VER=2.7 194 192 PYTHON_DIR="$ISSM_DIR/externalpackages/python/install" 195 193 PYTHONSTARTUP="$ISSM_DIR/startup.py" … … 201 199 #GIT 202 200 GIT_DIR="$ISSM_DIR/externalpackages/git" 201 202 #NCVIEW 203 NCVIEW_DIR="$ISSM_DIR/externalpackages/ncview" 204 205 #TCLX 206 TCLX_DIR="$ISSM_DIR/externalpackages/tclx/install/lib/tclx8.4" 207 208 #ASPELL 209 ASPELL_DIR="$ISSM_DIR/externalpackages/aspell/" 210 211 #HDF5 212 export HDF5_DIR=$ISSM_DIR/externalpackages/hdf5/install -
issm/branches/trunk-jpl-damage/externalpackages
- Property svn:ignore
-
old new 1 1 MITgcm 2 2 OpenAD 3 ivins
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/adolc
- Property svn:ignore
-
old new 1 *.gz 1 2 install* 2 3 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/adolc/install.sh
r12258 r12878 22 22 cd src 23 23 24 export CC=gcc 25 export CXX=g++ 26 export CFLAGS="-arch x86_64" 27 export CXXFLAGS="-arch x86_64" 28 24 29 ./configure \ 25 30 --prefix=$ISSM_DIR/externalpackages/adolc/install \ -
issm/branches/trunk-jpl-damage/externalpackages/autoconf
- Property svn:ignore
-
old new 1 *.gz 1 2 install 2 3 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/automake
- Property svn:ignore
-
old new 2 2 src 3 3 .ignore.txt 4 *.gz
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/blas
-
Property svn:ignore
set to
src
install
*.tgz
-
Property svn:ignore
set to
-
issm/branches/trunk-jpl-damage/externalpackages/dakota
- Property svn:ignore
-
old new 1 *.gz 1 2 install 2 3 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/export_fig/export_fig.m
r12004 r12878 16 16 % export_fig ... -<colorspace> 17 17 % export_fig ... -append 18 % export_fig ... -bookmark 18 19 % export_fig(..., handle) 19 20 % … … 120 121 % exists, the figure is to be appended as a new page, instead 121 122 % 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). 122 125 % handle - The handle of the figure or axes (can be an array of handles 123 126 % of several axes, but these must be in the same figure) to be … … 159 162 % 14/03/12: Fix bug in fixing the axes limits (thanks to Tobias Lamour for 160 163 % 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. 161 168 162 169 function [im alpha] = export_fig(varargin) … … 194 201 Hlims = findall(fig, 'Type', 'axes'); 195 202 if ~cls 196 % Record the old axes limit modes203 % Record the old axes limit and tick modes 197 204 Xlims = make_cell(get(Hlims, 'XLimMode')); 198 205 Ylims = make_cell(get(Hlims, 'YLimMode')); 199 206 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')); 210 end 211 % Set all axes limit and tick modes to manual, so the limits and ticks can't change 212 set(Hlims, 'XLimMode', 'manual', 'YLimMode', 'manual', 'ZLimMode', 'manual', 'XTickMode', 'manual', 'YTickMode', 'manual', 'ZTickMode', 'manual'); 203 213 % Set to print exactly what is there 204 214 set(fig, 'InvertHardcopy', 'off'); … … 403 413 eps_remove_background(tmp_nam); 404 414 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 405 423 % Generate a pdf 406 424 eps2pdf(tmp_nam, pdf_nam, 1, options.append, options.colourspace==2, options.quality); … … 435 453 % Reset the hardcopy mode 436 454 set(fig, 'InvertHardcopy', old_mode); 437 % Reset the axes limit modes455 % Reset the axes limit and tick modes 438 456 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}); 440 458 end 441 459 end … … 462 480 'aa_factor', 3, ... 463 481 'magnify', 1, ... 482 'bookmark', false, ... 464 483 'quality', []); 465 484 native = false; % Set resolution to native of an image … … 504 523 case 'append' 505 524 options.append = true; 525 case 'bookmark' 526 options.bookmark = true; 506 527 case 'native' 507 528 native = true; … … 743 764 % Helper function 744 765 function A = make_cell(A) 745 if ~iscell(A) 746 A = {A}; 747 end 748 766 if ~iscell(A) 767 A = {A}; 768 end 769 return 770 771 function add_bookmark(fname, bookmark_text) 772 % Adds a bookmark to the temporary EPS file after %%EndPageSetup 773 % Read in the file 774 fh = fopen(fname, 'r'); 775 if fh == -1 776 error('File %s not found.', fname); 777 end 778 try 779 fstrm = fread(fh, '*char')'; 780 catch ex 781 fclose(fh); 782 rethrow(ex); 783 end 784 fclose(fh); 785 786 % Include standard pdfmark prolog to maximize compatibility 787 fstrm = strrep(fstrm, '%%BeginProlog', sprintf('%%%%BeginProlog\n/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse')); 788 % Add page bookmark 789 fstrm = strrep(fstrm, '%%EndPageSetup', sprintf('%%%%EndPageSetup\n[ /Title (%s) /OUT pdfmark',bookmark_text)); 790 791 % Write out the updated file 792 fh = fopen(fname, 'w'); 793 if fh == -1 794 error('Unable to open %s for writing.', fname); 795 end 796 try 797 fwrite(fh, fstrm, 'char*1'); 798 catch ex 799 fclose(fh); 800 rethrow(ex); 801 end 802 fclose(fh); 803 return -
issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2array.m
r12004 r12878 41 41 % 27/1/2012 Bug fix affecting painters rendering tall figures. Thanks to 42 42 % Ken Campbell for reporting it. 43 44 % 3/4/2012 Bug fix to median input. Thanks to Andy Matthews for reporting 45 % it. 43 46 44 47 function [A bcol] = print2array(fig, res, renderer) … … 119 122 end 120 123 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)); 122 125 for c = 1:size(A, 3) 123 126 A(:,[1:l-1, r+1:end],c) = bcol(c); -
issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2eps.m
r12004 r12878 45 45 % alias can lead to another font being swapped in. 46 46 47 % 10/4/2012 Make the font swapping case insensitive. 48 47 49 function print2eps(name, fig, varargin) 48 50 options = {'-depsc2'}; … … 57 59 end 58 60 % Find all the used fonts in the figure 59 fonts = get(findall(fig, '-property', 'FontName'), 'FontName'); 61 font_handles = findall(fig, '-property', 'FontName'); 62 fonts = get(font_handles, 'FontName'); 60 63 if ~iscell(fonts) 61 64 fonts = {fonts}; 62 65 end 63 fonts = unique(fonts);64 66 % Map supported font aliases onto the correct name 67 fontsl = lower(fonts); 65 68 for a = 1:numel(fonts) 66 f = lower(fonts{a});69 f = fontsl{a}; 67 70 f(f==' ') = []; 68 71 switch f 69 72 case {'times', 'timesnewroman', 'times-roman'} 70 fonts {a} = 'Times-Roman';73 fontsl{a} = 'times-roman'; 71 74 case {'arial', 'helvetica'} 72 fonts {a} = 'Helvetica';75 fontsl{a} = 'helvetica'; 73 76 case {'newcenturyschoolbook', 'newcenturyschlbk'} 74 fonts {a} = 'NewCenturySchlbk';77 fontsl{a} = 'newcenturyschlbk'; 75 78 otherwise 76 79 end 77 80 end 81 fontslu = unique(fontsl); 78 82 % Determine the font swap table 79 83 matlab_fonts = {'Helvetica', 'Times-Roman', 'Palatino', 'Bookman', 'Helvetica-Narrow', 'Symbol', ... 80 84 '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)]; 85 matlab_fontsl = lower(matlab_fonts); 86 require_swap = find(~ismember(fontslu, matlab_fontsl)); 87 unused_fonts = find(~ismember(matlab_fontsl, fontslu)); 88 font_swap = cell(3, 0); 89 for 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, []); 95 end 85 96 % Swap the fonts 86 97 for a = 1:size(font_swap, 2) 87 set(f indall(fig, 'FontName', font_swap{2,a}), 'FontName', font_swap{1,a});98 set(font_swap{1,a}, 'FontName', font_swap{2,a}); 88 99 end 89 100 % Set paper size … … 114 125 % Reset the font names in the figure 115 126 for a = 1:size(font_swap, 2) 116 set(f indall(fig, 'FontName', font_swap{1,a}), 'FontName', font_swap{2,a});127 set(font_swap{1,a}, 'FontName', font_swap{3,a}); 117 128 end 118 129 % Replace the font names in the eps file 130 font_swap = font_swap(2:3,:); 119 131 try 120 132 swap_fonts(name, font_swap{:}); -
issm/branches/trunk-jpl-damage/externalpackages/gdal
- Property svn:ignore
-
old new 1 *.gz 1 2 install* 2 3 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/gdal/install.sh
r12258 r12878 22 22 --prefix="$ISSM_DIR/externalpackages/gdal/install" \ 23 23 --without-python \ 24 --without-png \ 24 25 --with-netcdf=no \ 25 26 --with-jasper=no \ -
issm/branches/trunk-jpl-damage/externalpackages/git
-
Property svn:ignore
set to
install
src
*.gz
-
Property svn:ignore
set to
-
issm/branches/trunk-jpl-damage/externalpackages/gsl
- Property svn:ignore
-
old new 1 *.gz 1 2 install 2 3 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/ipython
- Property svn:ignore
-
old new 1 src 1 2 src-* 3 *.gz 2 4 install
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/ipython/install.sh
r12258 r12878 3 3 #Some cleanup 4 4 rm -rf src 5 rm -rf install6 5 rm -rf ipython-0.12 7 mkdir src install6 mkdir src 8 7 9 8 #Download from ISSM server -
issm/branches/trunk-jpl-damage/externalpackages/lapack
-
Property svn:ignore
set to
*.tgz
install
src
-
Property svn:ignore
set to
-
issm/branches/trunk-jpl-damage/externalpackages/lapack/configs/linux64/make.inc
r12239 r12878 16 16 OPTS = -fPIC -O2 17 17 DRVOPTS = $(OPTS) 18 NOOPT = - O018 NOOPT = -fPIC -O0 19 19 LOADER = gfortran 20 20 LOADOPTS = -
issm/branches/trunk-jpl-damage/externalpackages/libtool
- Property svn:ignore
-
old new 1 *.gz 1 2 install 2 3 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/libtool/install.sh
r12258 r12878 2 2 3 3 #Some cleanup 4 rm -rf install libtool -2.2.6bsrc4 rm -rf install libtool[\w.- ]* src 5 5 mkdir install 6 6 7 7 #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' 9 9 10 10 #Untar 11 tar -zxvf libtool-2.2.6b.tar.gz 11 tar -zxvf libtool[\w.-]*.tar.gz 12 rm libtool[\w.-]*.tar.gz 13 12 14 13 15 #Move libtool into src directory 14 mv libtool -2.2.6bsrc16 mv libtool[\w.-]* src 15 17 16 18 #Compile libtool -
issm/branches/trunk-jpl-damage/externalpackages/matlab/install.sh
r12168 r12878 6 6 #Select or create a new simlink 7 7 ln -s /usr/local/pkgs/matlab-7.6/ install 8 #ln -s /discover/vis/mathworks/matlab_r2011b/ install 8 9 #ln -s /usr/local/matlab704/ install 9 10 #ln -s /usr/local/matlab711/ install … … 15 16 #ln -s /Applications/MATLAB_R2010a.app/ install 16 17 #ln -s /Applications/MATLAB_R2012a.app/ install 18 #ln -s /Applications/MATLAB_R2011a.app/ install 17 19 #ln -s /Applications/MATLAB*.app/ install -
issm/branches/trunk-jpl-damage/externalpackages/mpich2
- Property svn:ignore
-
old new 1 *.gz 1 2 install 2 3 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/ncview
-
Property svn:ignore
set to
*.gz
udunits.tar
install
genoverlay
README
-
Property svn:ignore
set to
-
issm/branches/trunk-jpl-damage/externalpackages/ncview/install.sh
r12258 r12878 18 18 cd install 19 19 ./configure \ 20 --prefix 20 --prefix="$ISSM_DIR/externalpackages/ncview/install" \ 21 21 --x-libraries=/usr/X11/lib/ \ 22 22 --x-includes=/usr/X11/include/ \ -
issm/branches/trunk-jpl-damage/externalpackages/netcdf
- Property svn:ignore
-
old new 1 *.gz 1 2 install 3 install-* 4 src
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/nose
- Property svn:ignore
-
old new 1 *.gz 1 2 py3k 3 src 2 4 src-*
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/octave
-
Property svn:ignore
set to
*.gz
install
src
-
Property svn:ignore
set to
-
issm/branches/trunk-jpl-damage/externalpackages/octave/install.sh
r12260 r12878 2 2 3 3 #Some cleanup 4 version=3.6.1 5 rm -rf src install octave-$version octave-$version.tar.gz 4 rm -rf src install octave-3.6.2 6 5 mkdir install src 7 6 8 7 #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" 10 9 11 10 #Untar 12 tar -zxvf octave- $version.tar.gz11 tar -zxvf octave-3.6.2.tar.gz 13 12 14 13 #Move octave into install directory 15 mv octave- $version/* src16 rm -rf octave- $version14 mv octave-3.6.2/* src 15 rm -rf octave-3.6.2 17 16 18 17 #install 19 18 cd src 19 ./configure \ 20 --prefix=$ISSM_DIR/externalpackages/octave/install \ 21 --disable-readline 20 22 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 23 if [ -z $NUMCPUS ]; 24 then 25 make 26 make install 27 else 28 make -j $NUMCPUS 29 make -j $NUMCPUS install 30 fi -
issm/branches/trunk-jpl-damage/externalpackages/pcre
-
Property svn:ignore
set to
install
*.gz
-
Property svn:ignore
set to
-
issm/branches/trunk-jpl-damage/externalpackages/petsc
- Property svn:ignore
-
old new 1 *.tgz 2 *.gz 1 3 install 2 4 install-3.1
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/petsc/install-3.2-linux64.sh
r12258 r12878 22 22 --PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \ 23 23 --with-debugging=0 \ 24 --with-shared-libraries= 0\24 --with-shared-libraries=1 \ 25 25 --download-mumps=yes \ 26 26 --download-scalapack=yes \ -
issm/branches/trunk-jpl-damage/externalpackages/python
- Property svn:ignore
-
old new 1 install-* 1 2 install 3 install-python* 2 4 src 3 5 *.tgz
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/scipy/README
r12258 r12878 1 You will find instructions on scipy at:1 For OSX 10.7 (Lion), the instructions here can be followed: 2 2 http://www.scipy.org/Installing_SciPy/Mac_OS_X 3 4 For OSX 10.6 (Snow Leopard), the scipy folks recommend gcc and g++ version 4.0. 5 However, ISSM needs the gfortran version recommended in $ISSM_DIR/externalpackages/gfortran. 6 On the webpage listed above, make sure the "export CC" and "export CXX" commands point to the 7 binaries associated with this gfortran version (likely in /usr/local/gfortran/bin by default). 8 Once this gfortran is installed, the install script in this directory for Snow Leopard should 9 work. -
issm/branches/trunk-jpl-damage/externalpackages/scipy/install-linux64.sh
r12258 r12878 1 1 #!/bin/bash 2 PYVERSION=2.7 3 PYTHON=python${PYVERSION} 2 4 3 5 #1: install numpy … … 25 27 python setup.py build 26 28 python setup.py install 29 cd .. 30 ${PYTHON} -c "import numpy; print 'Installed NumPy', numpy.__version__" 31 ${PYTHON} -c "import numpy; numpy.test()" 27 32 28 33 … … 42 47 python setup.py build 43 48 python setup.py install 49 cd .. 50 ${PYTHON} -c "import scipy; print 'Installed SciPy', scipy.__version__" 51 ${PYTHON} -c "import scipy; scipy.test()" 44 52 45 53 elif [[ $install == "3" ]];then -
issm/branches/trunk-jpl-damage/externalpackages/scipy/install-macosx-snowleopard.sh
r12258 r12878 8 8 install=2 9 9 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 12 export CC=/usr/local/gfortran/bin/gcc 13 export CXX=/usr/local/gfortran/bin/g++ 12 14 13 15 if [[ $install == "1" ]];then … … 22 24 cd .. 23 25 ${PYTHON} -c "import numpy; print 'Installed NumPy', numpy.__version__" 26 ${PYTHON} -c "import numpy; numpy.test()" 24 27 25 28 elif [[ $install == "2" ]];then … … 34 37 cd .. 35 38 ${PYTHON} -c "import scipy; print 'Installed SciPy', scipy.__version__" 39 ${PYTHON} -c "import scipy; scipy.test()" 36 40 37 41 elif [[ $install == "3" ]];then -
issm/branches/trunk-jpl-damage/externalpackages/triangle
- Property svn:ignore
-
old new 1 *.zip 1 2 install 2 3 install-matlab
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/externalpackages/triangle/install-macosx64.sh
r12258 r12878 1 1 #!/bin/bash 2 3 #use matlab?4 matlab=05 6 2 7 3 #Some cleanup … … 22 18 23 19 #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 20 patch triangle.c ../triangle.c.patch 29 21 30 22 #Compile triangle -
issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch
r1 r12878 5 5 > * double precision activation in exactinit(); The rest is not changed. 6 6 > * 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> */ 9 9 > #define ANSI_DECLARATORS 10 10 > #define NO_TIMER … … 134 134 < memptr = (VOID *) malloc((unsigned int) size); 135 135 --- 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); 138 138 1447c1543,1544 139 139 < free(memptr); 140 140 --- 141 > //free(memptr);142 > mxFree(memptr);141 > free(memptr); 142 > //mxFree(memptr); 143 143 3665,3670c3762,3767 144 144 < 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 6 6 cat c.vim | sed "/ISSM's Enums begin/,/vim: ts=8/d" > temp 7 7 echo "\"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"}' >> temp8 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 9 9 echo "\"ISSM's Enums end" >> temp 10 10 cat c.vim | sed "1,/ISSM's Enums end/d" >> temp -
issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/c.vim
r12258 r12878 404 404 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 405 405 "ISSM containers: 406 syn keyword cType Constraints DataSet Elements Inputs Loads Materials Nodes Parameters Results Vertices 406 syn keyword cType Constraints DataSet Elements Inputs Loads Materials Nodes Parameters Results Vertices Options 407 407 "Petsc 408 syn keyword cType Vec Mat 408 syn keyword cType Vec Mat SeqVec SeqMat 409 409 "other ISSM's syntax 410 syn keyword cType mxArray ErrorException 410 syn keyword cType mxArray ErrorException QuadtreeBox IssmDouble IssmPDouble 411 411 412 412 "ISSM's objects begin … … 545 545 syn keyword cType Mesh 546 546 syn keyword cType Geometry 547 syn keyword cType QuadTree547 syn keyword cType BamgQuadtree 548 548 syn keyword cType SetOfE4 549 549 syn keyword cType Variogram … … 551 551 syn keyword cType ExponentialVariogram 552 552 syn keyword cType SphericalVariogram 553 syn keyword cType PowerVariogram 553 554 syn keyword cType Quadtree 554 555 syn keyword cType Observation … … 649 650 syn keyword cConstant MaterialsRhoIceEnum 650 651 syn keyword cConstant MaterialsRhoWaterEnum 652 syn keyword cConstant MaterialsRhoFreshwaterEnum 651 653 syn keyword cConstant MaterialsMuWaterEnum 652 654 syn keyword cConstant MaterialsThermalExchangeVelocityEnum … … 694 696 syn keyword cConstant SettingsResultsAsPatchesEnum 695 697 syn keyword cConstant SettingsWaitonlockEnum 696 syn keyword cConstant DebugPetscProfilingEnum 697 syn keyword cConstant PetscProfilingCurrentMemEnum 698 syn keyword cConstant PetscProfilingCurrentFlopsEnum 699 syn keyword cConstant PetscProfilingSolutionTimeEnum 698 syn keyword cConstant SurfaceforcingsDelta18oEnum 699 syn keyword cConstant SurfaceforcingsDelta18oTemperaturesPresentdayEnum 700 syn keyword cConstant SurfaceforcingsDelta18oTemperaturesLgmEnum 701 syn keyword cConstant SurfaceforcingsDelta18oSurfaceEnum 702 syn keyword cConstant SurfaceforcingsIsdelta18oEnum 703 syn keyword cConstant SurfaceforcingsPrecipitationsPresentdayEnum 704 syn keyword cConstant DebugProfilingEnum 705 syn keyword cConstant ProfilingCurrentMemEnum 706 syn keyword cConstant ProfilingCurrentFlopsEnum 707 syn keyword cConstant ProfilingSolutionTimeEnum 708 syn keyword cConstant MaxIterationConvergenceFlagEnum 700 709 syn keyword cConstant SteadystateMaxiterEnum 701 710 syn keyword cConstant SteadystateNumRequestedOutputsEnum … … 796 805 syn keyword cConstant IntParamEnum 797 806 syn keyword cConstant IntVecParamEnum 807 syn keyword cConstant TransientParamEnum 798 808 syn keyword cConstant MacAyeal2dIceFrontEnum 799 809 syn keyword cConstant MacAyeal3dIceFrontEnum … … 915 925 syn keyword cConstant StressTensorzzEnum 916 926 syn keyword cConstant IceVolumeEnum 927 syn keyword cConstant TotalSmbEnum 917 928 syn keyword cConstant P0Enum 918 929 syn keyword cConstant P1Enum -
issm/branches/trunk-jpl-damage/m4/issm_options.m4
r12258 r12878 12 12 AC_DEFINE([_ISSM_DEBUG_],[1],[Macro to enable debugging in ISSM]) 13 13 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 15 24 dnl Modules build {{{ 16 25 AC_ARG_WITH([modules], … … 60 69 export CFLAGS=" -D_INTEL_LINUX_" 61 70 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_ " 62 76 elif test $VENDOR = intel-pleiades; then 63 77 export CC=icc … … 65 79 export CXXFLAGS=" -O3 -xS -D_INTEL_LINUX_ " 66 80 export CFLAGS=" -O3 -xS -D_INTEL_LINUX_ " 67 elif test $VENDOR = arm-linux; then68 export CC=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-gcc69 export GCC=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-gcc70 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-ar72 export RANLIB=$ANDROID_DIR/arm-linux-android-4.0/bin/arm-linux-androideabi-ranlib73 81 else 74 82 AC_MSG_ERROR([unknow compiler vendor!]) … … 308 316 AC_MSG_RESULT($HAVE_BOOST) 309 317 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; then322 dnl are we running python 3?323 HAVE_PYTHON3="yes"324 fi325 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 }}}330 318 dnl python{{{ 331 319 AC_ARG_WITH([python-dir], … … 336 324 if test -d "$PYTHON_ROOT"; then 337 325 dnl defaults 326 HAVE_PYTHON3="no" 338 327 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 339 344 PYTHONINCL=-I$PYTHON_ROOT/include 340 345 PYTHONLIB="-L$PYTHON_ROOT/lib -lpython$PYTHONVERSION" 341 346 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 343 359 344 360 AC_DEFINE([_HAVE_PYTHON_],[1],[with Python in ISSM src]) … … 352 368 fi 353 369 AM_CONDITIONAL([PYTHON], [test x$HAVE_PYTHON = xyes]) 370 AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes]) 354 371 AC_MSG_RESULT($HAVE_PYTHON) 372 355 373 dnl }}} 356 374 dnl python-numpy{{{ … … 429 447 dnl defaults 430 448 HAVE_ADOLC=yes 431 ADOLCINCL="-I$ADOLC_ROOT/include /adolc -I$ADOLC_ROOT/include"449 ADOLCINCL="-I$ADOLC_ROOT/include" 432 450 ADOLCLIB="-L$ADOLC_ROOT/lib64 -ladolc" 433 451 … … 483 501 HAVE_GSL=yes 484 502 GSLINCL="-I$GSL_ROOT/include" 485 GSLLIB="- L$GSL_ROOT/lib/ -lgsl -lgslcblas -lm"503 GSLLIB="-dy -L$GSL_ROOT/lib/ -lgsl -lgslcblas -lm" 486 504 487 505 AC_DEFINE([_HAVE_GSL_],[1],[with gsl in ISSM src]) … … 523 541 [METIS_ROOT=$withval],[METIS_ROOT=""]) 524 542 543 AC_MSG_CHECKING(for metis headers and libraries in $METIS_ROOT) 544 525 545 if test -d "$METIS_ROOT"; then 526 527 AC_MSG_CHECKING(for metis headers and libraries in $METIS_ROOT)528 546 529 547 dnl first figure out version of metis: does the VERSION file exist? … … 579 597 fi 580 598 AM_CONDITIONAL([METIS], [test x$HAVE_METIS = xyes]) 599 AC_MSG_RESULT($HAVE_METIS) 581 600 dnl }}} 582 601 dnl mpi{{{ … … 746 765 dnl defaults 747 766 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 749 772 750 773 AC_DEFINE([_HAVE_SCALAPACK_],[1],[with Scalapack in ISSM src]) … … 766 789 HAVE_BLASLAPACK=yes 767 790 BLASLAPACKINCL="" 768 791 792 if test x$VENDOR = xintel-discover; then 793 BLASLAPACKLIB=-L"$BLASLAPACK_ROOT -lmkl_lapack -lmkl -lguide -lpthread" 794 else 769 795 dnl: branch on whether we are running on windows or linux. 770 796 case "${host_os}" in … … 779 805 ;; 780 806 esac 807 fi 781 808 782 809 AC_DEFINE([_HAVE_BLASLAPACK_],[1],[with blas lapack in ISSM src]) … … 853 880 MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps -lpord " 854 881 else 882 dnl MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps -lmumps_common -lpord -lparmetis -lzmumps" 855 883 MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps -lmumps_common -lpord -lparmetis" 856 884 fi … … 875 903 HAVE_BLACS=yes 876 904 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 878 910 879 911 AC_DEFINE([_HAVE_BLACS_],[1],[with Blacs in ISSM src]) … … 896 928 HAVE_HYPRE=yes 897 929 HYPREINCL="" 898 HYPRELIB=-L"$HYPRE_ROOT/ -lHYPRE"930 HYPRELIB=-L"$HYPRE_ROOT/lib -lHYPRE" 899 931 900 932 AC_DEFINE([_HAVE_HYPRE_],[1],[with Blacs in ISSM src]) … … 906 938 AC_MSG_RESULT($HAVE_HYPRE) 907 939 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 }}} 961 dnl 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 }}} 982 dnl 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 }}} 1003 dnl 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 }}} 1024 dnl 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 }}} 908 1045 dnl ml{{{ 909 1046 AC_ARG_WITH([ml-dir], … … 944 1081 dnl }}} 945 1082 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 967 1113 dnl }}} 968 1114 dnl graphics{{{ … … 981 1127 fi 982 1128 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) 983 1146 dnl }}} 984 1147 dnl with-steadystate{{{ … … 1301 1464 AC_MSG_RESULT($USE_64BIT_INDICES) 1302 1465 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 }}} 1303 1475 ]) -
issm/branches/trunk-jpl-damage/m4/libtool.m4
r11114 r12878 2 2 # 3 3 # 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. 5 6 # Written by Gordon Matzigkeit, 1996 6 7 # … … 11 12 m4_define([_LT_COPYING], [dnl 12 13 # 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. 14 16 # Written by Gordon Matzigkeit, 1996 15 17 # … … 38 40 ]) 39 41 40 # serial 5 6LT_INIT42 # serial 57 LT_INIT 41 43 42 44 … … 67 69 AC_DEFUN([LT_INIT], 68 70 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT 71 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 69 72 AC_BEFORE([$0], [LT_LANG])dnl 70 73 AC_BEFORE([$0], [LT_OUTPUT])dnl … … 82 85 AC_REQUIRE([LTOBSOLETE_VERSION])dnl 83 86 m4_require([_LT_PROG_LTMAIN])dnl 87 88 _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) 84 89 85 90 dnl Parse OPTIONS … … 119 124 esac 120 125 done 121 cc_basename=`$ECHO " X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`126 cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` 122 127 ]) 123 128 … … 139 144 [AC_REQUIRE([AC_CANONICAL_HOST])dnl 140 145 AC_REQUIRE([AC_CANONICAL_BUILD])dnl 146 AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl 147 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl 148 149 _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl 150 dnl 141 151 _LT_DECL([], [host_alias], [0], [The host system])dnl 142 152 _LT_DECL([], [host], [0])dnl … … 161 171 m4_require([_LT_FILEUTILS_DEFAULTS])dnl 162 172 m4_require([_LT_CHECK_SHELL_FEATURES])dnl 173 m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl 163 174 m4_require([_LT_CMD_RELOAD])dnl 164 175 m4_require([_LT_CHECK_MAGIC_METHOD])dnl 176 m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl 165 177 m4_require([_LT_CMD_OLD_ARCHIVE])dnl 166 178 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl 179 m4_require([_LT_WITH_SYSROOT])dnl 167 180 168 181 _LT_CONFIG_LIBTOOL_INIT([ … … 180 193 181 194 m4_require([_LT_TAG_COMPILER])dnl 182 _LT_PROG_ECHO_BACKSLASH183 195 184 196 case $host_os in … … 194 206 esac 195 207 196 # Sed substitution that helps us do robust quoting. It backslashifies197 # 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 a204 # 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 expressions211 no_glob_subst='s/\*/\\\*/g'212 213 208 # Global variables: 214 209 ofile=libtool … … 250 245 ])# _LT_SETUP 251 246 247 248 # _LT_PREPARE_SED_QUOTE_VARS 249 # -------------------------- 250 # Define a few sed substitution that help us do robust quoting. 251 m4_defun([_LT_PREPARE_SED_QUOTE_VARS], 252 [# Backslashify metacharacters that are still active within 253 # double-quoted strings. 254 sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' 255 256 # Same as above, but do not quote variable references. 257 double_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. 261 delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' 262 263 # Sed substitution to delay expansion of an escaped single quote. 264 delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' 265 266 # Sed substitution to avoid accidental globbing in evaled expressions 267 no_glob_subst='s/\*/\\\*/g' 268 ]) 252 269 253 270 # _LT_PROG_LTMAIN … … 409 426 # must have a single quote delimited value for this to work. 410 427 m4_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"`']) 412 429 413 430 … … 419 436 # each variable declared with _LT_DECL (and _LT_TAGDECL) into: 420 437 # 421 # <var>='`$ECHO " X$<var>" | $Xsed -e"$delay_single_quote_subst"`'438 # <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`' 422 439 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], 423 440 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), … … 518 535 compiler='$compiler_DEFAULT' 519 536 537 # A function that is used when there is no print builtin or printf. 538 func_fallback_echo () 539 { 540 eval 'cat <<_LTECHO_EOF 541 \$[]1 542 _LTECHO_EOF' 543 } 544 520 545 # Quote evaled strings. 521 546 for var in lt_decl_all_varnames([[ \ 522 547 ]], lt_decl_quote_varnames); do 523 case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in548 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in 524 549 *[[\\\\\\\`\\"\\\$]]*) 525 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\" X\\\$\$var\\" | \\\$Xsed -e\\"\\\$sed_quote_subst\\"\\\`\\\\\\""550 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" 526 551 ;; 527 552 *) … … 534 559 for var in lt_decl_all_varnames([[ \ 535 560 ]], lt_decl_dquote_varnames); do 536 case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in561 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in 537 562 *[[\\\\\\\`\\"\\\$]]*) 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\\"\\\`\\\\\\"" 539 564 ;; 540 565 *) … … 544 569 done 545 570 546 # Fix-up fallback echo if it was mangled by the above quoting rules.547 case \$lt_ECHO in548 *'\\\[$]0 --fallback-echo"')dnl "549 lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`550 ;;551 esac552 553 571 _LT_OUTPUT_LIBTOOL_INIT 554 572 ]) 555 573 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). 583 m4_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 589 cat >$1 <<_ASEOF || lt_write_fail=1 590 #! $SHELL 591 # Generated by $as_me. 592 $2 593 SHELL=\${CONFIG_SHELL-$SHELL} 594 export SHELL 595 _ASEOF 596 cat >>$1 <<\_ASEOF || lt_write_fail=1 597 AS_SHELL_SANITIZE 598 _AS_PREPARE 599 exec AS_MESSAGE_FD>&1 600 _ASEOF 601 test $lt_write_fail = 0 && chmod +x $1[]dnl 602 m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT 556 603 557 604 # LT_OUTPUT … … 563 610 [: ${CONFIG_LT=./config.lt} 564 611 AC_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 615 cat >>"$CONFIG_LT" <<\_LTEOF 570 616 lt_cl_silent=false 571 SHELL=\${CONFIG_SHELL-$SHELL}572 _LTEOF573 574 cat >>"$CONFIG_LT" <<\_LTEOF575 AS_SHELL_SANITIZE576 _AS_PREPARE577 578 exec AS_MESSAGE_FD>&1579 617 exec AS_MESSAGE_LOG_FD>>config.log 580 618 { … … 602 640 configured by $[0], generated by m4_PACKAGE_STRING. 603 641 604 Copyright (C) 20 08Free Software Foundation, Inc.642 Copyright (C) 2011 Free Software Foundation, Inc. 605 643 This config.lt script is free software; the Free Software Foundation 606 644 gives unlimited permision to copy, distribute and modify it." … … 647 685 # open by configure. Here we exec the FD to /dev/null, effectively closing 648 686 # 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 687 lt_cl_success=: 688 test "$silent" = yes && 689 lt_config_lt_args="$lt_config_lt_args --quiet" 690 exec AS_MESSAGE_LOG_FD>/dev/null 691 $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false 692 exec AS_MESSAGE_LOG_FD>>config.log 693 $lt_cl_success || AS_EXIT(1) 658 694 ])# LT_OUTPUT 659 695 … … 718 754 # text mode, it properly converts lines to CR/LF. This bash problem 719 755 # 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" || 729 762 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") 730 763 chmod +x "$ofile" … … 771 804 [C], [_LT_LANG(C)], 772 805 [C++], [_LT_LANG(CXX)], 806 [Go], [_LT_LANG(GO)], 773 807 [Java], [_LT_LANG(GCJ)], 774 808 [Fortran 77], [_LT_LANG(F77)], … … 790 824 _LT_LANG_$1_CONFIG($1)])dnl 791 825 ])# _LT_LANG 826 827 828 m4_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 ############################################################ 835 m4_defun([AC_PROG_GO], 836 [AC_LANG_PUSH(Go)dnl 837 AC_ARG_VAR([GOC], [Go compiler command])dnl 838 AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl 839 _AC_ARG_VAR_LDFLAGS()dnl 840 AC_CHECK_TOOL(GOC, gccgo) 841 if 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 845 fi 846 if test -z "$GOC"; then 847 AC_CHECK_PROG(GOC, gccgo, gccgo, false) 848 fi 849 ])#m4_defun 850 ])#m4_ifndef 792 851 793 852 … … 822 881 [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) 823 882 883 AC_PROVIDE_IFELSE([AC_PROG_GO], 884 [LT_LANG(GO)], 885 [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) 886 824 887 AC_PROVIDE_IFELSE([LT_PROG_RC], 825 888 [LT_LANG(RC)], … … 832 895 AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) 833 896 AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) 897 AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) 834 898 dnl aclocal-1.4 backwards compatibility: 835 899 dnl AC_DEFUN([AC_LIBTOOL_CXX], []) … … 837 901 dnl AC_DEFUN([AC_LIBTOOL_FC], []) 838 902 dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) 903 dnl AC_DEFUN([AC_LIBTOOL_RC], []) 839 904 840 905 … … 922 987 -dynamiclib -Wl,-single_module conftest.c 2>conftest.err 923 988 _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 925 996 lt_cv_apple_cc_single_mod=yes 926 997 else … … 930 1001 rm -f conftest.* 931 1002 fi]) 1003 932 1004 AC_CACHE_CHECK([for -exported_symbols_list linker flag], 933 1005 [lt_cv_ld_exported_symbols_list], … … 940 1012 [lt_cv_ld_exported_symbols_list=no]) 941 1013 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 1019 int 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 1028 int 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 942 1042 ]) 943 1043 case $host_os in … … 968 1068 _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' 969 1069 fi 970 if test "$DSYMUTIL" != ":" ; then1070 if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then 971 1071 _lt_dsymutil='~$DSYMUTIL $lib || :' 972 1072 else … … 978 1078 979 1079 980 # _LT_DARWIN_LINKER_FEATURES 981 # -------------------------- 1080 # _LT_DARWIN_LINKER_FEATURES([TAG]) 1081 # --------------------------------- 982 1082 # Checks for linker and compiler features on darwin 983 1083 m4_defun([_LT_DARWIN_LINKER_FEATURES], … … 988 1088 _LT_TAGVAR(hardcode_automatic, $1)=yes 989 1089 _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 991 1097 _LT_TAGVAR(link_all_deplibs, $1)=yes 992 1098 _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" … … 996 1102 esac 997 1103 if test "$_lt_dar_can_shared" = "yes"; then 998 output_verbose_link_cmd= echo1104 output_verbose_link_cmd=func_echo_all 999 1105 _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}" 1000 1106 _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" … … 1012 1118 ]) 1013 1119 1014 # _LT_SYS_MODULE_PATH_AIX 1015 # ----------------------- 1120 # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) 1121 # ---------------------------------- 1016 1122 # Links a minimal program and checks the executable 1017 1123 # for the system default hardcoded library path. In most cases, … … 1020 1126 # If we don't find anything, use the default library path according 1021 1127 # 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. 1022 1130 m4_defun([_LT_SYS_MODULE_PATH_AIX], 1023 1131 [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 1132 if test "${lt_cv_aix_libpath+set}" = set; then 1133 aix_libpath=$lt_cv_aix_libpath 1134 else 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]) 1154 fi 1038 1155 ])# _LT_SYS_MODULE_PATH_AIX 1039 1156 … … 1042 1159 # ------------------- 1043 1160 m4_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 1050 1164 1051 1165 1052 1166 # _LT_PROG_ECHO_BACKSLASH 1053 1167 # ----------------------- 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). 1056 1172 m4_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='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' 1174 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO 1175 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO 1176 1177 AC_MSG_CHECKING([how to print strings]) 1178 # Test print first, because it will be a builtin if present. 1179 if 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 --' 1182 elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then 1183 ECHO='printf %s\n' 1184 else 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' 1193 fi 1194 1195 # func_echo_all arg... 1196 # Invoke $ECHO with all args, space-separated. 1197 func_echo_all () 1198 { 1199 $ECHO "$*" 1200 } 1201 1202 case "$ECHO" in 1203 printf*) AC_MSG_RESULT([printf]) ;; 1204 print*) AC_MSG_RESULT([print -r]) ;; 1205 *) AC_MSG_RESULT([cat]) ;; 1066 1206 esac 1067 1207 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 ]) 1208 m4_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 1205 1218 _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]) 1208 1220 ])# _LT_PROG_ECHO_BACKSLASH 1209 1221 1222 1223 # _LT_WITH_SYSROOT 1224 # ---------------- 1225 AC_DEFUN([_LT_WITH_SYSROOT], 1226 [AC_MSG_CHECKING([for sysroot]) 1227 AC_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 1232 dnl lt_sysroot will always be passed unquoted. We quote it here 1233 dnl in case the user passed a directory name. 1234 lt_sysroot= 1235 case ${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 ;; 1250 esac 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.])]) 1210 1255 1211 1256 # _LT_ENABLE_LOCK … … 1237 1282 *-*-irix6*) 1238 1283 # Find out which ABI we are using. 1239 echo '[#]line __oline__"configure"' > conftest.$ac_ext1284 echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext 1240 1285 if AC_TRY_EVAL(ac_compile); then 1241 1286 if test "$lt_cv_prog_gnu_ld" = yes; then … … 1330 1375 fi 1331 1376 ;; 1332 sparc*-*solaris*)1377 *-*solaris*) 1333 1378 # Find out which ABI we are using. 1334 1379 echo 'int i;' > conftest.$ac_ext … … 1337 1382 *64-bit*) 1338 1383 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 ;; 1340 1398 *) 1341 1399 if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then … … 1355 1413 1356 1414 1415 # _LT_PROG_AR 1416 # ----------- 1417 m4_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 1424 AC_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 1442 if test "x$lt_cv_ar_at_file" = xno; then 1443 archiver_list_spec= 1444 else 1445 archiver_list_spec=$lt_cv_ar_at_file 1446 fi 1447 _LT_DECL([], [archiver_list_spec], [1], 1448 [How to feed a file listing to the archiver]) 1449 ])# _LT_PROG_AR 1450 1451 1357 1452 # _LT_CMD_OLD_ARCHIVE 1358 1453 # ------------------- 1359 1454 m4_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 1365 1456 1366 1457 AC_CHECK_TOOL(STRIP, strip, :) … … 1381 1472 case $host_os in 1382 1473 openbsd*) 1383 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$ oldlib"1474 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" 1384 1475 ;; 1385 1476 *) 1386 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$ oldlib"1477 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" 1387 1478 ;; 1388 1479 esac 1389 old_archive_cmds="$old_archive_cmds~\$RANLIB \$ oldlib"1480 old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" 1390 1481 fi 1482 1483 case $host_os in 1484 darwin*) 1485 lock_old_archive_extraction=yes ;; 1486 *) 1487 lock_old_archive_extraction=no ;; 1488 esac 1391 1489 _LT_DECL([], [old_postinstall_cmds], [2]) 1392 1490 _LT_DECL([], [old_postuninstall_cmds], [2]) 1393 1491 _LT_TAGDECL([], [old_archive_cmds], [2], 1394 1492 [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]) 1395 1495 ])# _LT_CMD_OLD_ARCHIVE 1396 1496 … … 1417 1517 -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ 1418 1518 -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) 1420 1520 (eval "$lt_compile" 2>conftest.err) 1421 1521 ac_status=$? 1422 1522 cat conftest.err >&AS_MESSAGE_LOG_FD 1423 echo "$as_me: __oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD1523 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD 1424 1524 if (exit $ac_status) && test -s "$ac_outfile"; then 1425 1525 # The compiler can only warn and ignore the option if not recognized 1426 1526 # So say no if there are warnings other than the usual output. 1427 $ECHO " X$_lt_compiler_boilerplate" | $Xsed -e'/^$/d' >conftest.exp1527 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp 1428 1528 $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 1429 1529 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then … … 1465 1565 # Append any errors to the config.log. 1466 1566 cat conftest.err 1>&AS_MESSAGE_LOG_FD 1467 $ECHO " X$_lt_linker_boilerplate" | $Xsed -e'/^$/d' > conftest.exp1567 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp 1468 1568 $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 1469 1569 if diff conftest.exp conftest.er2 >/dev/null; then … … 1525 1625 # Instead, let's just punt: use the minimum linelength reported by 1526 1626 # 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. 1527 1632 lt_cv_sys_max_cmd_len=8192; 1528 1633 ;; … … 1551 1656 # We know the value 262144 and hardcode it with a safety zone (like BSD) 1552 1657 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 1553 1663 ;; 1554 1664 … … 1592 1702 # maximum length that is only half of the actual maximum length, but 1593 1703 # we can't tell. 1594 while { test "X"` $SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \1595 = "X X$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 && 1596 1706 test $i != 17 # 1/2 MB should be enough 1597 1707 do … … 1644 1754 lt_status=$lt_dlunknown 1645 1755 cat > conftest.$ac_ext <<_LT_EOF 1646 [#line __oline__"configure"1756 [#line $LINENO "configure" 1647 1757 #include "confdefs.h" 1648 1758 … … 1685 1795 #endif 1686 1796 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)) 1800 int fnord () __attribute__((visibility("default"))); 1801 #endif 1802 1803 int fnord () { return 42; } 1688 1804 int main () 1689 1805 { … … 1694 1810 { 1695 1811 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 } 1697 1817 /* dlclose (self); */ 1698 1818 } … … 1870 1990 -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ 1871 1991 -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) 1873 1993 (eval "$lt_compile" 2>out/conftest.err) 1874 1994 ac_status=$? 1875 1995 cat out/conftest.err >&AS_MESSAGE_LOG_FD 1876 echo "$as_me: __oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD1996 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD 1877 1997 if (exit $ac_status) && test -s out/conftest2.$ac_objext 1878 1998 then 1879 1999 # The compiler can only warn and ignore the option if not recognized 1880 2000 # So say no if there are warnings 1881 $ECHO " X$_lt_compiler_boilerplate" | $Xsed -e'/^$/d' > out/conftest.exp2001 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp 1882 2002 $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 1883 2003 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then … … 2038 2158 m4_require([_LT_DECL_OBJDUMP])dnl 2039 2159 m4_require([_LT_DECL_SED])dnl 2160 m4_require([_LT_CHECK_SHELL_FEATURES])dnl 2040 2161 AC_MSG_CHECKING([dynamic linker characteristics]) 2041 2162 m4_if([$1], … … 2046 2167 *) lt_awk_arg="/^libraries:/" ;; 2047 2168 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 *\;*) 2050 2176 # if the path contains ";" then we assume it to be the separator 2051 2177 # otherwise default to the standard path separator (i.e. ":") - it is 2052 2178 # assumed that no part of a normal pathname contains ";" but that should 2053 2179 # 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 2058 2186 # Ok, now we have the path, separated by spaces, we can step through it 2059 2187 # and add multilib dir if necessary. … … 2068 2196 fi 2069 2197 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 ' 2071 2199 BEGIN {RS=" "; FS="/|\n";} { 2072 2200 lt_foo=""; … … 2088 2216 if (lt_freq[[lt_foo]] == 1) { print lt_foo; } 2089 2217 }'` 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` 2091 2225 else 2092 2226 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" … … 2114 2248 case $host_os in 2115 2249 aix3*) 2116 version_type=linux 2250 version_type=linux # correct to gnu/linux during the next big refactor 2117 2251 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' 2118 2252 shlibpath_var=LIBPATH … … 2123 2257 2124 2258 aix[[4-9]]*) 2125 version_type=linux 2259 version_type=linux # correct to gnu/linux during the next big refactor 2126 2260 need_lib_prefix=no 2127 2261 need_version=no … … 2176 2310 library_names_spec='$libname.ixlibrary $libname.a' 2177 2311 # 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' 2179 2313 ;; 2180 2314 esac … … 2188 2322 2189 2323 bsdi[[45]]*) 2190 version_type=linux 2324 version_type=linux # correct to gnu/linux during the next big refactor 2191 2325 need_version=no 2192 2326 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' … … 2207 2341 need_lib_prefix=no 2208 2342 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 2211 2346 library_names_spec='$libname.dll.a' 2212 2347 # DLL is installed to $(libdir)/../bin by postinstall_cmds … … 2229 2364 # Cygwin DLLs use 'cyg' prefix rather than 'lib' 2230 2365 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" 2366 m4_if([$1], [],[ 2367 sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) 2232 2368 ;; 2233 2369 mingw* | cegcc*) 2234 2370 # MinGW DLLs use traditional 'lib' prefix 2235 2371 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]; then2238 # It is most probably a Windows format PATH printed by2239 # mingw gcc, but we are running on Cygwin. Gcc prints its search2240 # path with ; separators, and with drive letters. We can handle the2241 # 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 else2246 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`2247 fi2248 2372 ;; 2249 2373 pw32*) … … 2252 2376 ;; 2253 2377 esac 2378 dynamic_linker='Win32 ld.exe' 2254 2379 ;; 2255 2380 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 2256 2437 *) 2438 # Assume MSVC wrapper 2257 2439 library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' 2440 dynamic_linker='Win32 ld.exe' 2258 2441 ;; 2259 2442 esac 2260 dynamic_linker='Win32 ld.exe'2261 2443 # FIXME: first we should search . and the directory the executable is in 2262 2444 shlibpath_var=PATH … … 2279 2461 2280 2462 dgux*) 2281 version_type=linux 2463 version_type=linux # correct to gnu/linux during the next big refactor 2282 2464 need_lib_prefix=no 2283 2465 need_version=no … … 2285 2467 soname_spec='${libname}${release}${shared_ext}$major' 2286 2468 shlibpath_var=LD_LIBRARY_PATH 2287 ;;2288 2289 freebsd1*)2290 dynamic_linker=no2291 2469 ;; 2292 2470 … … 2298 2476 else 2299 2477 case $host_os in 2300 freebsd[[ 123]]*) objformat=aout ;;2478 freebsd[[23]].*) objformat=aout ;; 2301 2479 *) objformat=elf ;; 2302 2480 esac … … 2316 2494 shlibpath_var=LD_LIBRARY_PATH 2317 2495 case $host_os in 2318 freebsd2 *)2496 freebsd2.*) 2319 2497 shlibpath_overrides_runpath=yes 2320 2498 ;; … … 2336 2514 2337 2515 gnu*) 2338 version_type=linux 2516 version_type=linux # correct to gnu/linux during the next big refactor 2339 2517 need_lib_prefix=no 2340 2518 need_version=no … … 2342 2520 soname_spec='${libname}${release}${shared_ext}$major' 2343 2521 shlibpath_var=LD_LIBRARY_PATH 2522 shlibpath_overrides_runpath=no 2523 hardcode_into_libs=yes 2524 ;; 2525 2526 haiku*) 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' 2344 2536 hardcode_into_libs=yes 2345 2537 ;; … … 2387 2579 ;; 2388 2580 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, ... 2390 2582 postinstall_cmds='chmod 555 $lib' 2583 # or fails outright, so override atomically: 2584 install_override_mode=555 2391 2585 ;; 2392 2586 2393 2587 interix[[3-9]]*) 2394 version_type=linux 2588 version_type=linux # correct to gnu/linux during the next big refactor 2395 2589 need_lib_prefix=no 2396 2590 need_version=no … … 2408 2602 *) 2409 2603 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 2411 2605 else 2412 2606 version_type=irix … … 2445 2639 ;; 2446 2640 2447 # This must be LinuxELF.2448 linux* | k*bsd*-gnu )2449 version_type=linux 2641 # This must be glibc/ELF. 2642 linux* | k*bsd*-gnu | kopensolaris*-gnu) 2643 version_type=linux # correct to gnu/linux during the next big refactor 2450 2644 need_lib_prefix=no 2451 2645 need_version=no … … 2455 2649 shlibpath_var=LD_LIBRARY_PATH 2456 2650 shlibpath_overrides_runpath=no 2651 2457 2652 # 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 2467 2666 2468 2667 # This implies no fast_install, which is unacceptable. … … 2473 2672 # Append ld.so.conf contents to the search path 2474 2673 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' ' '` 2476 2675 sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" 2477 2676 fi … … 2505 2704 2506 2705 newsos6) 2507 version_type=linux 2706 version_type=linux # correct to gnu/linux during the next big refactor 2508 2707 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' 2509 2708 shlibpath_var=LD_LIBRARY_PATH … … 2574 2773 2575 2774 solaris*) 2576 version_type=linux 2775 version_type=linux # correct to gnu/linux during the next big refactor 2577 2776 need_lib_prefix=no 2578 2777 need_version=no … … 2599 2798 2600 2799 sysv4 | sysv4.3*) 2601 version_type=linux 2800 version_type=linux # correct to gnu/linux during the next big refactor 2602 2801 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' 2603 2802 soname_spec='${libname}${release}${shared_ext}$major' … … 2623 2822 sysv4*MP*) 2624 2823 if test -d /usr/nec ;then 2625 version_type=linux 2824 version_type=linux # correct to gnu/linux during the next big refactor 2626 2825 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' 2627 2826 soname_spec='$libname${shared_ext}.$major' … … 2654 2853 tpf*) 2655 2854 # 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 2657 2856 need_lib_prefix=no 2658 2857 need_version=no … … 2664 2863 2665 2864 uts4*) 2666 version_type=linux 2865 version_type=linux # correct to gnu/linux during the next big refactor 2667 2866 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' 2668 2867 soname_spec='${libname}${release}${shared_ext}$major' … … 2706 2905 _LT_DECL([], [soname_spec], [1], 2707 2906 [[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]) 2708 2909 _LT_DECL([], [postinstall_cmds], [2], 2709 2910 [Command to use after installation of a shared archive]) … … 2818 3019 m4_require([_LT_DECL_SED])dnl 2819 3020 m4_require([_LT_DECL_EGREP])dnl 3021 m4_require([_LT_PROG_ECHO_BACKSLASH])dnl 2820 3022 2821 3023 AC_ARG_WITH([gnu-ld], … … 2939 3141 reload_cmds='$LD$reload_flag -o $output$reload_objs' 2940 3142 case $host_os in 3143 cygwin* | mingw* | pw32* | cegcc*) 3144 if test "$GCC" != yes; then 3145 reload_cmds=false 3146 fi 3147 ;; 2941 3148 darwin*) 2942 3149 if test "$GCC" = yes; then … … 2947 3154 ;; 2948 3155 esac 2949 _LT_ DECL([], [reload_flag], [1], [How to create reloadable object files])dnl2950 _LT_ DECL([], [reload_cmds], [2])dnl3156 _LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl 3157 _LT_TAGDECL([], [reload_cmds], [2])dnl 2951 3158 ])# _LT_CMD_RELOAD 2952 3159 … … 3000 3207 # func_win32_libid shell function, so use a weaker test based on 'objdump', 3001 3208 # 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 3003 3211 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' 3004 3212 lt_cv_file_magic_cmd='func_win32_libid' 3005 3213 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)' 3007 3216 lt_cv_file_magic_cmd='$OBJDUMP -f' 3008 3217 fi 3009 3218 ;; 3010 3219 3011 cegcc )3220 cegcc*) 3012 3221 # use the weaker test based on 'objdump'. See mingw*. 3013 3222 lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' … … 3039 3248 ;; 3040 3249 3250 haiku*) 3251 lt_cv_deplibs_check_method=pass_all 3252 ;; 3253 3041 3254 hpux10.20* | hpux11*) 3042 3255 lt_cv_file_magic_cmd=/usr/bin/file … … 3047 3260 ;; 3048 3261 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]'] 3050 3263 lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl 3051 3264 ;; 3052 3265 *) 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' 3054 3267 lt_cv_file_magic_test_file=/usr/lib/libc.sl 3055 3268 ;; … … 3072 3285 ;; 3073 3286 3074 # This must be LinuxELF.3075 linux* | k*bsd*-gnu )3287 # This must be glibc/ELF. 3288 linux* | k*bsd*-gnu | kopensolaris*-gnu) 3076 3289 lt_cv_deplibs_check_method=pass_all 3077 3290 ;; … … 3151 3364 esac 3152 3365 ]) 3366 3367 file_magic_glob= 3368 want_nocaseglob=no 3369 if 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 3379 fi 3380 3153 3381 file_magic_cmd=$lt_cv_file_magic_cmd 3154 3382 deplibs_check_method=$lt_cv_deplibs_check_method … … 3158 3386 [Method to check whether dependent libraries are shared objects]) 3159 3387 _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"]) 3161 3393 ])# _LT_CHECK_MAGIC_METHOD 3162 3394 … … 3215 3447 else 3216 3448 # 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 3218 3462 AC_SUBST([DUMPBIN]) 3219 3463 if test "$DUMPBIN" != ":"; then … … 3228 3472 [lt_cv_nm_interface="BSD nm" 3229 3473 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) 3231 3475 (eval "$ac_compile" 2>conftest.err) 3232 3476 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) 3234 3478 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) 3235 3479 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) 3237 3481 cat conftest.out >&AS_MESSAGE_LOG_FD 3238 3482 if $GREP 'External.*some_variable' conftest.out > /dev/null; then … … 3248 3492 dnl AC_DEFUN([AM_PROG_NM], []) 3249 3493 dnl 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 3500 m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], 3501 [m4_require([_LT_DECL_EGREP]) 3502 m4_require([_LT_DECL_OBJDUMP]) 3503 m4_require([_LT_DECL_DLLTOOL]) 3504 AC_CACHE_CHECK([how to associate runtime and link libraries], 3505 lt_cv_sharedlib_from_linklib_cmd, 3506 [lt_cv_sharedlib_from_linklib_cmd='unknown' 3507 3508 case $host_os in 3509 cygwin* | 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 ;; 3525 esac 3526 ]) 3527 sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd 3528 test -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 3538 m4_defun([_LT_PATH_MANIFEST_TOOL], 3539 [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) 3540 test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt 3541 AC_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*]) 3550 if test "x$lt_cv_path_mainfest_tool" != xyes; then 3551 MANIFEST_TOOL=: 3552 fi 3553 _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl 3554 ])# _LT_PATH_MANIFEST_TOOL 3250 3555 3251 3556 … … 3257 3562 LIBM= 3258 3563 case $host in 3259 *-*-beos* | *-*-c ygwin* | *-*-pw32* | *-*-darwin*)3564 *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) 3260 3565 # These system don't have libm, or don't need it 3261 3566 ;; … … 3285 3590 3286 3591 if 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 3288 3598 3289 3599 _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], … … 3302 3612 [AC_REQUIRE([AC_CANONICAL_HOST])dnl 3303 3613 AC_REQUIRE([AC_PROG_CC])dnl 3614 AC_REQUIRE([AC_PROG_AWK])dnl 3304 3615 AC_REQUIRE([LT_PATH_NM])dnl 3305 3616 AC_REQUIRE([LT_PATH_LD])dnl … … 3369 3680 3370 3681 # 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/^: \([[^ ]]*\) 3372 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) 3682 lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" 3683 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'" 3373 3684 3374 3685 # Handle CRLF in mingw tool chain … … 3394 3705 lt_cv_sys_global_symbol_pipe="$AWK ['"\ 3395 3706 " {last_section=section; section=\$ 3};"\ 3707 " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ 3396 3708 " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ 3397 3709 " \$ 0!~/External *\|/{next};"\ … … 3406 3718 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" 3407 3719 fi 3720 lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" 3408 3721 3409 3722 # Check to see that the pipe works correctly. … … 3427 3740 # Now try to grab the symbols. 3428 3741 nlist=conftest.nm 3429 if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe\> $nlist) && test -s "$nlist"; then3742 if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then 3430 3743 # Try sorting and uniquifying the output. 3431 3744 if sort "$nlist" | uniq > "$nlist"T; then … … 3439 3752 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then 3440 3753 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 3441 3766 #ifdef __cplusplus 3442 3767 extern "C" { … … 3450 3775 3451 3776 /* The mapping between symbol names and symbols. */ 3452 conststruct {3777 LT@&t@_DLSYM_CONST struct { 3453 3778 const char *name; 3454 3779 void *address; … … 3476 3801 # Now try linking the two files. 3477 3802 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 3480 3805 LIBS="conftstm.$ac_objext" 3481 3806 CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" … … 3483 3808 pipe_works=yes 3484 3809 fi 3485 LIBS= "$lt_save_LIBS"3486 CFLAGS= "$lt_save_CFLAGS"3810 LIBS=$lt_globsym_save_LIBS 3811 CFLAGS=$lt_globsym_save_CFLAGS 3487 3812 else 3488 3813 echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD … … 3517 3842 fi 3518 3843 3844 # Response file support. 3845 if test "$lt_cv_nm_interface" = "MS dumpbin"; then 3846 nm_file_list_spec='@' 3847 elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then 3848 nm_file_list_spec='@' 3849 fi 3850 3519 3851 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], 3520 3852 [Take the output of nm and produce a listing of raw symbols and C names]) … … 3527 3859 [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], 3528 3860 [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]) 3529 3863 ]) # _LT_CMD_GLOBAL_SYMBOLS 3530 3864 … … 3538 3872 _LT_TAGVAR(lt_prog_compiler_static, $1)= 3539 3873 3540 AC_MSG_CHECKING([for $compiler option to produce PIC])3541 3874 m4_if([$1], [CXX], [ 3542 3875 # C++ specific cases for pic, static, wl, etc. … … 3588 3921 # DJGPP does not support shared libraries at all 3589 3922 _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)= 3590 3928 ;; 3591 3929 interix[[3-9]]*) … … 3637 3975 ;; 3638 3976 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']) 3639 3983 ;; 3640 3984 dgux*) … … 3694 4038 esac 3695 4039 ;; 3696 linux* | k*bsd*-gnu )4040 linux* | k*bsd*-gnu | kopensolaris*-gnu) 3697 4041 case $cc_basename in 3698 4042 KCC*) … … 3727 4071 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' 3728 4072 ;; 3729 xlc* | xlC* )3730 # IBM XL 8.0 on PPC4073 xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) 4074 # IBM XL 8.0, 9.0 on PPC and BlueGene 3731 4075 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' 3732 4076 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' … … 3790 4134 solaris*) 3791 4135 case $cc_basename in 3792 CC* )4136 CC* | sunCC*) 3793 4137 # Sun C++ 4.2, 5.x and Centerline C++ 3794 4138 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' … … 3894 4238 ;; 3895 4239 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 3896 4246 hpux*) 3897 4247 # PIC is the default for 64-bit PA HP-UX, but not for 32-bit … … 3934 4284 *) 3935 4285 _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 3936 4295 ;; 3937 4296 esac … … 3978 4337 ;; 3979 4338 3980 linux* | k*bsd*-gnu )4339 linux* | k*bsd*-gnu | kopensolaris*-gnu) 3981 4340 case $cc_basename in 3982 4341 # old Intel for x86_64 which still supported -KPIC. … … 3999 4358 _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' 4000 4359 ;; 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*) 4002 4367 # Portland Group compilers (*not* the Pentium gcc compiler, 4003 4368 # which looks to be a dead project) … … 4011 4376 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' 4012 4377 ;; 4013 xl* )4014 # IBM XL C 8.0/Fortran 10.1 on PPC4378 xl* | bgxl* | bgf* | mpixl*) 4379 # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene 4015 4380 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' 4016 4381 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' … … 4019 4384 *) 4020 4385 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 ;; 4021 4397 *Sun\ C*) 4022 4398 # Sun C 5.9 … … 4025 4401 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' 4026 4402 ;; 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' 4030 4411 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' 4031 _LT_TAGVAR(lt_prog_compiler_wl, $1)=''4032 4412 ;; 4033 4413 esac … … 4061 4441 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' 4062 4442 case $cc_basename in 4063 f77* | f90* | f95* )4443 f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) 4064 4444 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; 4065 4445 *) … … 4118 4498 ;; 4119 4499 esac 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 4501 AC_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) 4123 4505 4124 4506 # … … 4139 4521 [Additional compiler flags for building library objects]) 4140 4522 4523 _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], 4524 [How to pass a linker flag through the compiler]) 4141 4525 # 4142 4526 # Check to make sure the static flag actually works. … … 4159 4543 [AC_REQUIRE([LT_PATH_LD])dnl 4160 4544 AC_REQUIRE([LT_PATH_NM])dnl 4545 m4_require([_LT_PATH_MANIFEST_TOOL])dnl 4161 4546 m4_require([_LT_FILEUTILS_DEFAULTS])dnl 4162 4547 m4_require([_LT_DECL_EGREP])dnl … … 4167 4552 m4_if([$1], [CXX], [ 4168 4553 _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]_.*'] 4169 4555 case $host_os in 4170 4556 aix[[4-9]]*) 4171 4557 # If we're using GNU nm, then we don't want the "-C" option. 4172 4558 # -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". 4173 4561 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' 4175 4563 else 4176 4564 _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' … … 4179 4567 pw32*) 4180 4568 _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" 4181 ;;4569 ;; 4182 4570 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 ;; 4185 4581 *) 4186 4582 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' 4187 ;;4583 ;; 4188 4584 esac 4189 _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']4190 4585 ], [ 4191 4586 runpath_var= … … 4202 4597 _LT_TAGVAR(hardcode_direct_absolute, $1)=no 4203 4598 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= 4204 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=4205 4599 _LT_TAGVAR(hardcode_libdir_separator, $1)= 4206 4600 _LT_TAGVAR(hardcode_minus_L, $1)=no … … 4250 4644 4251 4645 _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 4252 4650 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 4253 4673 # If archive_cmds runs LD, not CC, wlarc should be empty 4254 4674 wlarc='${wl}' … … 4268 4688 supports_anon_versioning=no 4269 4689 case `$LD -v 2>&1` in 4690 *GNU\ gold*) supports_anon_versioning=yes ;; 4270 4691 *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 4271 4692 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... … … 4283 4704 cat <<_LT_EOF 1>&2 4284 4705 4285 *** Warning: the GNU linker, at least up to release 2. 9.1, is reported4706 *** Warning: the GNU linker, at least up to release 2.19, is reported 4286 4707 *** to be unable to reliably create shared libraries on AIX. 4287 4708 *** 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. 4290 4712 4291 4713 _LT_EOF … … 4323 4745 # as there is no search path for DLLs. 4324 4746 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' 4747 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' 4325 4748 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported 4326 4749 _LT_TAGVAR(always_export_symbols, $1)=no 4327 4750 _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'] 4329 4753 4330 4754 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then … … 4344 4768 ;; 4345 4769 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 4346 4775 interix[[3-9]]*) 4347 4776 _LT_TAGVAR(hardcode_direct, $1)=no … … 4359 4788 ;; 4360 4789 4361 gnu* | linux* | tpf* | k*bsd*-gnu )4790 gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) 4362 4791 tmp_diet=no 4363 4792 if test "$host_os" = linux-dietlibc; then … … 4369 4798 && test "$tmp_diet" = no 4370 4799 then 4371 tmp_addflag= 4800 tmp_addflag=' $pic_flag' 4372 4801 tmp_sharedflag='-shared' 4373 4802 case $cc_basename,$host_cpu in 4374 4803 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' 4376 4805 tmp_addflag=' $pic_flag' 4377 4806 ;; 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' 4380 4810 tmp_addflag=' $pic_flag -Mnomain' ;; 4381 4811 ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 … … 4388 4818 _LT_TAGVAR(whole_archive_flag_spec, $1)= 4389 4819 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) 4391 4821 tmp_sharedflag='-qmkshrobj' 4392 4822 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 ;; 4393 4827 esac 4394 4828 case `$CC -V 2>&1 | sed 5q` in 4395 4829 *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' 4397 4831 _LT_TAGVAR(compiler_needs_object, $1)=yes 4398 4832 tmp_sharedflag='-G' ;; … … 4410 4844 4411 4845 case $cc_basename in 4412 xlf* )4846 xlf* | bgf* | bgxlf* | mpixlf*) 4413 4847 # IBM XL Fortran 10.1 on PPC cannot create shared libs itself 4414 4848 _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' 4418 4851 if test "x$supports_anon_versioning" = xyes; then 4419 4852 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ 4420 4853 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ 4421 4854 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' 4423 4856 fi 4424 4857 ;; … … 4434 4867 wlarc= 4435 4868 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' 4438 4871 fi 4439 4872 ;; … … 4453 4886 _LT_EOF 4454 4887 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' 4457 4890 else 4458 4891 _LT_TAGVAR(ld_shlibs, $1)=no … … 4500 4933 *) 4501 4934 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' 4504 4937 else 4505 4938 _LT_TAGVAR(ld_shlibs, $1)=no … … 4541 4974 # If we're using GNU nm, then we don't want the "-C" option. 4542 4975 # -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". 4543 4978 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' 4545 4980 else 4546 4981 _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' … … 4629 5064 # Determine the default libpath from the value encoded in an 4630 5065 # empty executable. 4631 _LT_SYS_MODULE_PATH_AIX 5066 _LT_SYS_MODULE_PATH_AIX([$1]) 4632 5067 _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" 4634 5069 else 4635 5070 if test "$host_cpu" = ia64; then … … 4640 5075 # Determine the default libpath from the value encoded in an 4641 5076 # empty executable. 4642 _LT_SYS_MODULE_PATH_AIX 5077 _LT_SYS_MODULE_PATH_AIX([$1]) 4643 5078 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" 4644 5079 # Warning - without using the other run time loading flags, … … 4646 5081 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' 4647 5082 _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 4650 5090 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes 4651 5091 # This is similar to how AIX traditionally builds its shared libraries. … … 4679 5119 # hardcode_libdir_flag_spec is actually meaningless, as there is 4680 5120 # 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 4695 5179 ;; 4696 5180 … … 4703 5187 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' 4704 5188 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no 4705 ;;4706 4707 freebsd1*)4708 _LT_TAGVAR(ld_shlibs, $1)=no4709 5189 ;; 4710 5190 … … 4721 5201 4722 5202 # Unfortunately, older versions of FreeBSD 2 do not have this feature. 4723 freebsd2 *)5203 freebsd2.*) 4724 5204 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' 4725 5205 _LT_TAGVAR(hardcode_direct, $1)=yes … … 4730 5210 # FreeBSD 3 and greater uses gcc -shared to do shared libraries. 4731 5211 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' 4733 5213 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' 4734 5214 _LT_TAGVAR(hardcode_direct, $1)=yes … … 4738 5218 hpux9*) 4739 5219 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' 4741 5221 else 4742 5222 _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' … … 4753 5233 4754 5234 hpux10*) 4755 if test "$GCC" = yes -a"$with_gnu_ld" = no; then4756 _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' 4757 5237 else 4758 5238 _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' … … 4760 5240 if test "$with_gnu_ld" = no; then 4761 5241 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' 4762 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'4763 5242 _LT_TAGVAR(hardcode_libdir_separator, $1)=: 4764 5243 _LT_TAGVAR(hardcode_direct, $1)=yes … … 4772 5251 4773 5252 hpux11*) 4774 if test "$GCC" = yes -a"$with_gnu_ld" = no; then5253 if test "$GCC" = yes && test "$with_gnu_ld" = no; then 4775 5254 case $host_cpu in 4776 5255 hppa*64*) … … 4778 5257 ;; 4779 5258 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' 4781 5260 ;; 4782 5261 *) 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' 4784 5263 ;; 4785 5264 esac … … 4793 5272 ;; 4794 5273 *) 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']) 4796 5282 ;; 4797 5283 esac … … 4821 5307 irix5* | irix6* | nonstopux*) 4822 5308 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' 4824 5310 # Try to use the -exported_symbol ld option, if it does not 4825 5311 # work, assume that -exports_file does not work either and 4826 5312 # 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 4833 5334 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' 4836 5337 fi 4837 5338 _LT_TAGVAR(archive_cmds_need_lc, $1)='no' … … 4895 5396 _LT_TAGVAR(hardcode_minus_L, $1)=yes 4896 5397 _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~$ECHOEXPORTS >> $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' 4898 5399 _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' 4899 5400 ;; … … 4902 5403 if test "$GCC" = yes; then 4903 5404 _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' 4905 5406 else 4906 5407 _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' 4908 5409 fi 4909 5410 _LT_TAGVAR(archive_cmds_need_lc, $1)='no' … … 4915 5416 if test "$GCC" = yes; then 4916 5417 _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' 4918 5419 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' 4919 5420 else 4920 5421 _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' 4922 5423 _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' 4924 5425 4925 5426 # Both c and cxx compiler support -rpath directly … … 4934 5435 if test "$GCC" = yes; then 4935 5436 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' 4937 5438 _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' 4939 5440 else 4940 5441 case `$CC -V 2>&1` in … … 5112 5613 # systems, -lgcc has to come before -lc. If gcc already passes -lc 5113 5614 # 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) 5144 5647 ;; 5145 5648 esac … … 5178 5681 [Flag to hardcode $libdir into a binary during linking. 5179 5682 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 binary5182 during linking. This must work even if $libdir does not exist]])5183 5683 _LT_TAGDECL([], [hardcode_libdir_separator], [1], 5184 5684 [Whether we need a single "-rpath" flag with a separated argument]) … … 5206 5706 _LT_TAGDECL([], [link_all_deplibs], [0], 5207 5707 [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])5210 5708 _LT_TAGDECL([], [always_export_symbols], [0], 5211 5709 [Set to "yes" if exported symbols are required]) … … 5218 5716 _LT_TAGDECL([], [prelink_cmds], [2], 5219 5717 [Commands necessary for linking programs (against libraries) with templates]) 5718 _LT_TAGDECL([], [postlink_cmds], [2], 5719 [Commands necessary for finishing linking programs]) 5220 5720 _LT_TAGDECL([], [file_list_spec], [1], 5221 5721 [Specify filename containing input files]) … … 5311 5811 5312 5812 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'. 5818 m4_defun([_LT_LANG_CXX_CONFIG], 5819 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl 5820 m4_require([_LT_DECL_EGREP])dnl 5821 m4_require([_LT_PATH_MANIFEST_TOOL])dnl 5321 5822 if test -n "$CXX" && ( test "X$CXX" != "Xno" && 5322 5823 ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || … … 5326 5827 _lt_caught_CXX_error=yes 5327 5828 fi 5328 popdef([AC_MSG_ERROR])5329 ])# _LT_PROG_CXX5330 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 suitably5338 # defined. These variables are subsequently used by _LT_CONFIG to write5339 # the compiler configuration to `libtool'.5340 m4_defun([_LT_LANG_CXX_CONFIG],5341 [AC_REQUIRE([_LT_PROG_CXX])dnl5342 m4_require([_LT_FILEUTILS_DEFAULTS])dnl5343 m4_require([_LT_DECL_EGREP])dnl5344 5829 5345 5830 AC_LANG_PUSH(C++) … … 5353 5838 _LT_TAGVAR(hardcode_direct_absolute, $1)=no 5354 5839 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= 5355 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=5356 5840 _LT_TAGVAR(hardcode_libdir_separator, $1)= 5357 5841 _LT_TAGVAR(hardcode_minus_L, $1)=no … … 5363 5847 _LT_TAGVAR(link_all_deplibs, $1)=unknown 5364 5848 _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 5365 5851 _LT_TAGVAR(no_undefined_flag, $1)= 5366 5852 _LT_TAGVAR(whole_archive_flag_spec, $1)= … … 5394 5880 # Allow CC to be a program name with arguments. 5395 5881 lt_save_CC=$CC 5882 lt_save_CFLAGS=$CFLAGS 5396 5883 lt_save_LD=$LD 5397 5884 lt_save_GCC=$GCC … … 5411 5898 test -z "${LDCXX+set}" || LD=$LDCXX 5412 5899 CC=${CXX-"c++"} 5900 CFLAGS=$CXXFLAGS 5413 5901 compiler=$CC 5414 5902 _LT_TAGVAR(compiler, $1)=$CC … … 5432 5920 # archiving commands below assume that GNU ld is being used. 5433 5921 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' 5436 5924 5437 5925 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' … … 5465 5953 # what "hidden" libraries, object files and flags are used when 5466 5954 # 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"' 5468 5956 5469 5957 else … … 5574 6062 # Determine the default libpath from the value encoded in an empty 5575 6063 # executable. 5576 _LT_SYS_MODULE_PATH_AIX 6064 _LT_SYS_MODULE_PATH_AIX([$1]) 5577 6065 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" 5578 6066 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" 5580 6068 else 5581 6069 if test "$host_cpu" = ia64; then … … 5586 6074 # Determine the default libpath from the value encoded in an 5587 6075 # empty executable. 5588 _LT_SYS_MODULE_PATH_AIX 6076 _LT_SYS_MODULE_PATH_AIX([$1]) 5589 6077 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" 5590 6078 # Warning - without using the other run time loading flags, … … 5592 6080 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' 5593 6081 _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 5596 6089 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes 5597 6090 # This is similar to how AIX traditionally builds its shared … … 5623 6116 5624 6117 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 ;; 5647 6187 darwin* | rhapsody*) 5648 6188 _LT_DARWIN_LINKER_FEATURES($1) … … 5667 6207 ;; 5668 6208 5669 freebsd [[12]]*)6209 freebsd2.*) 5670 6210 # C++ shared libraries reported to be fairly broken before 5671 6211 # switch to ELF … … 5684 6224 5685 6225 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 5686 6231 ;; 5687 6232 … … 5710 6255 # from the output so that they don't get included in the library 5711 6256 # 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"' 5713 6258 ;; 5714 6259 *) 5715 6260 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' 5717 6262 else 5718 6263 # FIXME: insert proper C++ library support … … 5775 6320 # from the output so that they don't get included in the library 5776 6321 # 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"' 5778 6323 ;; 5779 6324 *) … … 5785 6330 ;; 5786 6331 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' 5788 6333 ;; 5789 6334 *) 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' 5791 6336 ;; 5792 6337 esac … … 5818 6363 CC*) 5819 6364 # 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' 5821 6366 5822 6367 # Archives containing C++ object files must be created using … … 5829 6374 if test "$GXX" = yes; then 5830 6375 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' 5832 6377 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' 5834 6379 fi 5835 6380 fi … … 5842 6387 ;; 5843 6388 5844 linux* | k*bsd*-gnu )6389 linux* | k*bsd*-gnu | kopensolaris*-gnu) 5845 6390 case $cc_basename in 5846 6391 KCC*) … … 5860 6405 # from the output so that they don't get included in the library 5861 6406 # 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"' 5863 6408 5864 6409 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' … … 5897 6442 # Portland Group C++ compiler 5898 6443 case `$CC -V` in 5899 *pgCC\ [[1-5]] * | *pgcpp\ [[1-5]]*)6444 *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) 5900 6445 _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ 5901 6446 rm -rf $tpldir~ 5902 6447 $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`"' 5904 6449 _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ 5905 6450 rm -rf $tpldir~ 5906 6451 $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`~ 5908 6453 $RANLIB $oldlib' 5909 6454 _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ 5910 6455 rm -rf $tpldir~ 5911 6456 $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' 5913 6458 _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ 5914 6459 rm -rf $tpldir~ 5915 6460 $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' 5917 6462 ;; 5918 *) # Version 6 willuse weak symbols6463 *) # Version 6 and above use weak symbols 5919 6464 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' 5920 6465 _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' … … 5924 6469 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' 5925 6470 _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' 5927 6472 ;; 5928 6473 cxx*) … … 5943 6488 # from the output so that they don't get included in the library 5944 6489 # 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' 5946 6491 ;; 5947 xl* )6492 xl* | mpixl* | bgxl*) 5948 6493 # IBM XL 8.0 on PPC, with GNU ld 5949 6494 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' … … 5965 6510 _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' 5966 6511 _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' 5968 6513 _LT_TAGVAR(compiler_needs_object, $1)=yes 5969 6514 … … 5971 6516 # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 5972 6517 # would be better. 5973 output_verbose_link_cmd=' echo'6518 output_verbose_link_cmd='func_echo_all' 5974 6519 5975 6520 # Archives containing C++ object files must be created using … … 6040 6585 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' 6041 6586 fi 6042 output_verbose_link_cmd= echo6587 output_verbose_link_cmd=func_echo_all 6043 6588 else 6044 6589 _LT_TAGVAR(ld_shlibs, $1)=no … … 6075 6620 osf3*) 6076 6621 _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' 6078 6623 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' 6079 6624 ;; 6080 6625 *) 6081 6626 _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' 6083 6628 _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ 6084 6629 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~ 6086 6631 $RM $lib.exp' 6087 6632 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' … … 6099 6644 # from the output so that they don't get included in the library 6100 6645 # 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"' 6102 6647 ;; 6103 6648 *) … … 6106 6651 case $host in 6107 6652 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' 6109 6654 ;; 6110 6655 *) 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' 6112 6657 ;; 6113 6658 esac … … 6119 6664 # what "hidden" libraries, object files and flags are used when 6120 6665 # 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"' 6122 6667 6123 6668 else … … 6155 6700 solaris*) 6156 6701 case $cc_basename in 6157 CC* )6702 CC* | sunCC*) 6158 6703 # Sun C++ 4.2, 5.x and Centerline C++ 6159 6704 _LT_TAGVAR(archive_cmds_need_lc,$1)=yes … … 6176 6721 _LT_TAGVAR(link_all_deplibs, $1)=yes 6177 6722 6178 output_verbose_link_cmd=' echo'6723 output_verbose_link_cmd='func_echo_all' 6179 6724 6180 6725 # Archives containing C++ object files must be created using … … 6196 6741 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' 6197 6742 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' 6199 6744 _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' 6201 6746 6202 6747 # Commands to make compiler produce verbose output that lists 6203 6748 # what "hidden" libraries, object files and flags are used when 6204 6749 # 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"' 6206 6751 else 6207 6752 # g++ 2.7 appears to require `-G' NOT `-shared' on this … … 6214 6759 # what "hidden" libraries, object files and flags are used when 6215 6760 # 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"' 6217 6762 fi 6218 6763 … … 6268 6813 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' 6269 6814 _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)" 6270 6819 ;; 6271 6820 *) … … 6323 6872 6324 6873 CC=$lt_save_CC 6874 CFLAGS=$lt_save_CFLAGS 6325 6875 LDCXX=$LD 6326 6876 LD=$lt_save_LD … … 6337 6887 6338 6888 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. 6900 m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl 6901 AC_REQUIRE([_LT_DECL_SED]) 6902 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) 6903 func_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 6339 6912 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) 6340 6913 # --------------------------------- … … 6345 6918 m4_defun([_LT_SYS_HIDDEN_LIBDEPS], 6346 6919 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl 6920 AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl 6347 6921 # Dependencies to place before and after the object being linked: 6348 6922 _LT_TAGVAR(predep_objects, $1)= … … 6394 6968 }; 6395 6969 _LT_EOF 6970 ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF 6971 package foo 6972 func foo() { 6973 } 6974 _LT_EOF 6396 6975 ]) 6976 6977 _lt_libdeps_save_CFLAGS=$CFLAGS 6978 case "$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" ;; 6982 esac 6983 6397 6984 dnl Parse the compiler output and extract the necessary 6398 6985 dnl objects, libraries and library flags. … … 6406 6993 6407 6994 for p in `eval "$output_verbose_link_cmd"`; do 6408 case $ pin6995 case ${prev}${p} in 6409 6996 6410 6997 -L* | -R* | -l*) … … 6415 7002 prev=$p 6416 7003 continue 6417 else6418 prev=6419 7004 fi 6420 7005 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 6421 7017 if test "$pre_test_object_deps_done" = no; then 6422 case $ pin6423 -L * | -R*)7018 case ${prev} in 7019 -L | -R) 6424 7020 # Internal compiler library paths should come after those 6425 7021 # provided the user. The postdeps already come after the … … 6441 7037 fi 6442 7038 fi 7039 prev= 6443 7040 ;; 6444 7041 7042 *.lto.$objext) ;; # Ignore GCC LTO objects 6445 7043 *.$objext) 6446 7044 # This assumes that the test object file only shows up … … 6478 7076 6479 7077 $RM -f confest.$objext 7078 CFLAGS=$_lt_libdeps_save_CFLAGS 6480 7079 6481 7080 # PORTME: override above test on systems where it is broken … … 6514 7113 solaris*) 6515 7114 case $cc_basename in 6516 CC* )7115 CC* | sunCC*) 6517 7116 # The more standards-conforming stlport4 library is 6518 7117 # incompatible with the Cstd library. Avoid specifying … … 6558 7157 6559 7158 6560 # _LT_PROG_F776561 # ------------6562 # Since AC_PROG_F77 is broken, in that it returns the empty string6563 # 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_F776568 if test -z "$F77" || test "X$F77" = "Xno"; then6569 _lt_disable_F77=yes6570 fi6571 popdef([AC_MSG_ERROR])6572 ])# _LT_PROG_F776573 6574 dnl aclocal-1.4 backwards compatibility:6575 dnl AC_DEFUN([_LT_PROG_F77], [])6576 6577 6578 7159 # _LT_LANG_F77_CONFIG([TAG]) 6579 7160 # -------------------------- … … 6582 7163 # to write the compiler configuration to `libtool'. 6583 7164 m4_defun([_LT_LANG_F77_CONFIG], 6584 [AC_REQUIRE([_LT_PROG_F77])dnl 6585 AC_LANG_PUSH(Fortran 77) 7165 [AC_LANG_PUSH(Fortran 77) 7166 if test -z "$F77" || test "X$F77" = "Xno"; then 7167 _lt_disable_F77=yes 7168 fi 6586 7169 6587 7170 _LT_TAGVAR(archive_cmds_need_lc, $1)=no … … 6593 7176 _LT_TAGVAR(hardcode_direct_absolute, $1)=no 6594 7177 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= 6595 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=6596 7178 _LT_TAGVAR(hardcode_libdir_separator, $1)= 6597 7179 _LT_TAGVAR(hardcode_minus_L, $1)=no … … 6602 7184 _LT_TAGVAR(link_all_deplibs, $1)=unknown 6603 7185 _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 6604 7188 _LT_TAGVAR(no_undefined_flag, $1)= 6605 7189 _LT_TAGVAR(whole_archive_flag_spec, $1)= … … 6641 7225 lt_save_CC="$CC" 6642 7226 lt_save_GCC=$GCC 7227 lt_save_CFLAGS=$CFLAGS 6643 7228 CC=${F77-"f77"} 7229 CFLAGS=$FFLAGS 6644 7230 compiler=$CC 6645 7231 _LT_TAGVAR(compiler, $1)=$CC … … 6695 7281 GCC=$lt_save_GCC 6696 7282 CC="$lt_save_CC" 7283 CFLAGS="$lt_save_CFLAGS" 6697 7284 fi # test "$_lt_disable_F77" != yes 6698 7285 6699 7286 AC_LANG_POP 6700 7287 ])# _LT_LANG_F77_CONFIG 6701 6702 6703 # _LT_PROG_FC6704 # -----------6705 # Since AC_PROG_FC is broken, in that it returns the empty string6706 # 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_FC6711 if test -z "$FC" || test "X$FC" = "Xno"; then6712 _lt_disable_FC=yes6713 fi6714 popdef([AC_MSG_ERROR])6715 ])# _LT_PROG_FC6716 6717 dnl aclocal-1.4 backwards compatibility:6718 dnl AC_DEFUN([_LT_PROG_FC], [])6719 7288 6720 7289 … … 6725 7294 # to write the compiler configuration to `libtool'. 6726 7295 m4_defun([_LT_LANG_FC_CONFIG], 6727 [AC_REQUIRE([_LT_PROG_FC])dnl 6728 AC_LANG_PUSH(Fortran) 7296 [AC_LANG_PUSH(Fortran) 7297 7298 if test -z "$FC" || test "X$FC" = "Xno"; then 7299 _lt_disable_FC=yes 7300 fi 6729 7301 6730 7302 _LT_TAGVAR(archive_cmds_need_lc, $1)=no … … 6736 7308 _LT_TAGVAR(hardcode_direct_absolute, $1)=no 6737 7309 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= 6738 _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=6739 7310 _LT_TAGVAR(hardcode_libdir_separator, $1)= 6740 7311 _LT_TAGVAR(hardcode_minus_L, $1)=no … … 6745 7316 _LT_TAGVAR(link_all_deplibs, $1)=unknown 6746 7317 _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 6747 7320 _LT_TAGVAR(no_undefined_flag, $1)= 6748 7321 _LT_TAGVAR(whole_archive_flag_spec, $1)= … … 6784 7357 lt_save_CC="$CC" 6785 7358 lt_save_GCC=$GCC 7359 lt_save_CFLAGS=$CFLAGS 6786 7360 CC=${FC-"f95"} 7361 CFLAGS=$FCFLAGS 6787 7362 compiler=$CC 6788 7363 GCC=$ac_cv_fc_compiler_gnu … … 6840 7415 6841 7416 GCC=$lt_save_GCC 6842 CC="$lt_save_CC" 7417 CC=$lt_save_CC 7418 CFLAGS=$lt_save_CFLAGS 6843 7419 fi # test "$_lt_disable_FC" != yes 6844 7420 … … 6877 7453 6878 7454 # Allow CC to be a program name with arguments. 6879 lt_save_CC="$CC" 7455 lt_save_CC=$CC 7456 lt_save_CFLAGS=$CFLAGS 6880 7457 lt_save_GCC=$GCC 6881 7458 GCC=yes 6882 7459 CC=${GCJ-"gcj"} 7460 CFLAGS=$GCJFLAGS 6883 7461 compiler=$CC 6884 7462 _LT_TAGVAR(compiler, $1)=$CC … … 6890 7468 6891 7469 _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 6892 7472 6893 7473 ## CAVEAT EMPTOR: … … 6909 7489 6910 7490 GCC=$lt_save_GCC 6911 CC="$lt_save_CC" 7491 CC=$lt_save_CC 7492 CFLAGS=$lt_save_CFLAGS 6912 7493 ])# _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'. 7501 m4_defun([_LT_LANG_GO_CONFIG], 7502 [AC_REQUIRE([LT_PROG_GO])dnl 7503 AC_LANG_SAVE 7504 7505 # Source file extension for Go test sources. 7506 ac_ext=go 7507 7508 # Object file extension for compiled Go test sources. 7509 objext=o 7510 _LT_TAGVAR(objext, $1)=$objext 7511 7512 # Code to be used in simple compile tests 7513 lt_simple_compile_test_code="package main; func main() { }" 7514 7515 # Code to be used in simple link tests 7516 lt_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. 7526 lt_save_CC=$CC 7527 lt_save_CFLAGS=$CFLAGS 7528 lt_save_GCC=$GCC 7529 GCC=yes 7530 CC=${GOC-"gccgo"} 7531 CFLAGS=$GOFLAGS 7532 compiler=$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... 7548 if 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) 7557 fi 7558 7559 AC_LANG_RESTORE 7560 7561 GCC=$lt_save_GCC 7562 CC=$lt_save_CC 7563 CFLAGS=$lt_save_CFLAGS 7564 ])# _LT_LANG_GO_CONFIG 6913 7565 6914 7566 … … 6944 7596 # Allow CC to be a program name with arguments. 6945 7597 lt_save_CC="$CC" 7598 lt_save_CFLAGS=$CFLAGS 6946 7599 lt_save_GCC=$GCC 6947 7600 GCC= 6948 7601 CC=${RC-"windres"} 7602 CFLAGS= 6949 7603 compiler=$CC 6950 7604 _LT_TAGVAR(compiler, $1)=$CC … … 6959 7613 GCC=$lt_save_GCC 6960 7614 AC_LANG_RESTORE 6961 CC="$lt_save_CC" 7615 CC=$lt_save_CC 7616 CFLAGS=$lt_save_CFLAGS 6962 7617 ])# _LT_LANG_RC_CONFIG 6963 7618 … … 6977 7632 dnl aclocal-1.4 backwards compatibility: 6978 7633 dnl AC_DEFUN([LT_AC_PROG_GCJ], []) 7634 7635 7636 # LT_PROG_GO 7637 # ---------- 7638 AC_DEFUN([LT_PROG_GO], 7639 [AC_CHECK_TOOL(GOC, gccgo,) 7640 ]) 6979 7641 6980 7642 … … 7018 7680 ]) 7019 7681 7682 # _LT_DECL_DLLTOOL 7683 # ---------------- 7684 # Ensure DLLTOOL variable is set. 7685 m4_defun([_LT_DECL_DLLTOOL], 7686 [AC_CHECK_TOOL(DLLTOOL, dlltool, false) 7687 test -z "$DLLTOOL" && DLLTOOL=dlltool 7688 _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) 7689 AC_SUBST([DLLTOOL]) 7690 ]) 7020 7691 7021 7692 # _LT_DECL_SED … … 7111 7782 xsi_shell=no 7112 7783 ( _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, \ 7115 7786 && eval 'test $(( 1 + 1 )) -eq 2 \ 7116 7787 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ … … 7151 7822 7152 7823 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. 7828 m4_defun([_LT_PROG_FUNCTION_REPLACE], 7829 [dnl { 7830 sed -e '/^$1 ()$/,/^} # $1 /c\ 7831 $1 ()\ 7832 {\ 7833 m4_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") 7837 test 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.. 7845 m4_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}]) 7889 fi 7890 7891 if 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}" 7896 dnl 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=: 7904 else 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=: 7910 fi 7911 7912 if test x"$_lt_function_replace_fail" = x":"; then 7913 AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) 7914 fi 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. 7922 m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], 7923 [AC_REQUIRE([AC_CANONICAL_HOST])dnl 7924 AC_REQUIRE([AC_CANONICAL_BUILD])dnl 7925 AC_MSG_CHECKING([how to convert $build file names to $host format]) 7926 AC_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 7249 7940 ;; 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 ;; 7330 7957 esac 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 ]) 7959 to_host_file_cmd=$lt_cv_to_host_file_cmd 7960 AC_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 7964 AC_MSG_CHECKING([how to convert $build file names to toolchain format]) 7965 AC_CACHE_VAL(lt_cv_to_tool_file_cmd, 7966 [#assume ordinary cross tools, or native build. 7967 lt_cv_to_tool_file_cmd=func_convert_file_noop 7968 case $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 7343 7975 ;; 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 7976 esac 7357 7977 ]) 7978 to_tool_file_cmd=$lt_cv_to_tool_file_cmd 7979 AC_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 1 1 # Helper functions for option handling. -*- Autoconf -*- 2 2 # 3 # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 3 # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, 4 # Inc. 4 5 # Written by Gary V. Vaughan, 2004 5 6 # … … 8 9 # modifications, as long as this notice is preserved. 9 10 10 # serial 6ltoptions.m411 # serial 7 ltoptions.m4 11 12 12 13 # This is to help aclocal find these macros, as it can't see m4_define. … … 126 127 127 128 case $host in 128 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *- cegcc*)129 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 129 130 AC_CHECK_TOOL(AS, as, false) 130 131 AC_CHECK_TOOL(DLLTOOL, dlltool, false) … … 134 135 135 136 test -z "$AS" && AS=as 136 _LT_DECL([], [AS], [ 0], [Assembler program])dnl137 _LT_DECL([], [AS], [1], [Assembler program])dnl 137 138 138 139 test -z "$DLLTOOL" && DLLTOOL=dlltool 139 _LT_DECL([], [DLLTOOL], [ 0], [DLL creation program])dnl140 _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 140 141 141 142 test -z "$OBJDUMP" && OBJDUMP=objdump 142 _LT_DECL([], [OBJDUMP], [ 0], [Object dumper program])dnl143 _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 143 144 ])# win32-dll 144 145 … … 326 327 m4_define([_LT_WITH_PIC], 327 328 [AC_ARG_WITH([pic], 328 [AS_HELP_STRING([--with-pic ],329 [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], 329 330 [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], 331 347 [pic_mode=default]) 332 348 -
issm/branches/trunk-jpl-damage/m4/ltversion.m4
r11114 r12878 8 8 # modifications, as long as this notice is preserved. 9 9 10 # Generated from ltversion.in.10 # @configure_input@ 11 11 12 # serial 3 017 ltversion.m412 # serial 3337 ltversion.m4 13 13 # This file is part of GNU Libtool 14 14 15 m4_define([LT_PACKAGE_VERSION], [2. 2.6b])16 m4_define([LT_PACKAGE_REVISION], [1.3 017])15 m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 17 18 18 AC_DEFUN([LTVERSION_VERSION], 19 [macro_version='2. 2.6b'20 macro_revision='1.3 017'19 [macro_version='2.4.2' 20 macro_revision='1.3337' 21 21 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 22 _LT_DECL(, macro_revision, 0) -
issm/branches/trunk-jpl-damage/m4/lt~obsolete.m4
r11114 r12878 1 1 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 2 2 # 3 # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.3 # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. 4 4 # Written by Scott James Remnant, 2004. 5 5 # … … 8 8 # modifications, as long as this notice is preserved. 9 9 10 # serial 4lt~obsolete.m410 # serial 5 lt~obsolete.m4 11 11 12 12 # These exist entirely to fool aclocal when bootstrapping libtool. … … 78 78 m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 79 79 m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 80 m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])81 80 m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 82 81 m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) … … 91 90 m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 92 91 m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 92 m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) 93 m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) 94 m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) 95 m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) 96 m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) 97 m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) 98 m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) -
issm/branches/trunk-jpl-damage/scripts/DownloadExternalPackage.py
r12258 r12878 2 2 # -*- coding: ISO-8859-1 -*- 3 3 4 import os,sys 4 import os,sys,re 5 5 import urllib 6 from HTMLParser import HTMLParser 7 from urllib import FancyURLopener 6 8 7 # Check inputs8 if(len(sys.argv)!=3): raise NameError('usage: ./DownloadExternalPackage.py URL localfile') 9 # Start class myHTMLParser 10 class MyHTMLParser(HTMLParser): 9 11 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 23 pivot = sys.argv[1].rfind("/") 24 url = (sys.argv[1])[:pivot] 11 25 localFile=sys.argv[2] 12 26 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() 27 pivot += 1; 28 find = (sys.argv[1])[pivot:]; 29 print "Looking for " + find 30 pattern = find + "[\w.-]*(\.tar\.gz|tar\.gz2|tgz|zip|exe)?" 31 parser = MyHTMLParser(pattern) 17 32 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 33 urlObject = FancyURLopener() 34 obj = urlObject.open(url) 35 parser.feed(obj.read()) 26 36 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) 37 if 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 43 elif 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 58 else: 59 print "No matches found!" 60 61 obj.close() -
issm/branches/trunk-jpl-damage/scripts/automakererun.sh
r12168 r12878 3 3 # archive. 4 4 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. 5 9 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 10 cd $ISSM_DIR 11 autoreconf -iv -I m4 -
issm/branches/trunk-jpl-damage/scripts/getloc.sh
r12168 r12878 1 1 #!/bin/bash 2 2 #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=temp3 cloc-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 4 4 cat temp 5 5 ./cloc2html.py -
issm/branches/trunk-jpl-damage/scripts/report.sh
r12168 r12878 19 19 #Process matlab_log.log 20 20 cat matlab_log.log | egrep 'ERROR|SUCCESS|FAILURE' | grep -v "PETSC" | sed -e "s/>/\>/g" | sed -e "s/</\</g" > matlab.log 21 cat matlab.log | grep -v "SUCCESS" > matlab_short.log 21 22 cat matlab_log.log | grep "PETSC" | sed -e "s/>/\>/g" | sed -e "s/</\</g" > petscerror.log 22 23 NUM_TOT=`wc -l matlab.log | awk '{print $1}'` … … 48 49 BODY_FONTL=`echo $BODY_FONT | sed -e "s/style=\"/style=\"text-align:left; /g"` 49 50 50 #create some variables 51 if [ $(ls -1 $ISSM_DIR/bin | wc -l) -le 20 ]; 52 then 51 #Did installation work? 52 if [ $(ls -1 $ISSM_DIR/bin | wc -l) -le 20 ]; then 53 53 IS_INSTALL=0 54 54 else 55 55 IS_INSTALL=1 56 fi 57 58 #display table ONLY if installation worked and there has been at leat one FAILURE or ERROR 59 IS_TABLE=0 60 if [ $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 56 66 fi 57 67 … … 96 106 97 107 #update status 98 if [ $IS_INSTALL -eq 1 ] 99 then 100 if [ $CRASH -eq 0 ] 108 if [ $IS_INSTALL -eq 1 ]; 109 then 110 if [ $CRASH -eq 0 ]; 101 111 then 102 112 cat summary.html | sed -e "s/STATUS/<span style=\"color:#008000\">all test desks have been run<\/span>/g" > summary2.html … … 110 120 111 121 #report table 112 if [ $IS_ INSTALL-eq 1 ];122 if [ $IS_TABLE -eq 1 ]; 113 123 then 114 124 cat << END > content.html … … 122 132 <th $(echo $BODY_FONT)>Field checked</th> 123 133 </tr> 124 $(cat matlab .log | while read line134 $(cat matlab_short.log | while read line 125 135 do 126 136 echo "<tr>" … … 137 147 echo $line | awk -v FONTC="$FONTC" -v FONTL="$FONTL" ' 138 148 { 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 149 '; 150 151 else 142 152 143 153 #SUCCESS … … 146 156 FONTC=$(echo "$BODY_FONTC bgcolor=#ddffdd") 147 157 FONTL=$(echo "$BODY_FONTL bgcolor=#ddffdd") 158 #do not write anything 148 159 #ERROR 149 160 else 150 161 FONTC=$(echo "$BODY_FONTC bgcolor=#ffdddd id=ERROR") 151 162 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 '; 152 166 fi 153 167 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 ';158 168 fi 159 160 169 echo "</tr>" 161 162 170 done 163 171 ) -
issm/branches/trunk-jpl-damage/src/Makefile.am
r12168 r12878 1 EXTRA_DIST = perl pro 2 SUBDIRS = c modules m py1 EXTRA_DIST = perl pro py 2 SUBDIRS = c modules m -
issm/branches/trunk-jpl-damage/src/ad/todo
r11120 r12878 29 29 amatrix will be used in adolc. pmatrix will be used in Petsc routines. Matrix will 30 30 have routines to map one into the other. 31 32 33 Ad: 34 Eric: 35 Create ISSM namespace. 36 Make Matrix Assembly one homogeneous block. 37 Make Validation suite for Jean for his prognostic capabilities. 38 Jean: 39 typedef all double to ISSM_DOUBLE 40 41 Create an alloc layer with template functions for new and delete. 42 Check that the new code is modular --without-kml, options are up to date. 43 44 Replace 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 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Constraints::Constraints(){{{ 1*/27 /*FUNCTION Constraints::Constraints(){{{*/ 28 28 Constraints::Constraints(){ 29 29 enum_type=ConstraintsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Constraints::~Constraints(){{{ 1*/33 /*FUNCTION Constraints::~Constraints(){{{*/ 34 34 Constraints::~Constraints(){ 35 35 return; … … 38 38 39 39 /*Numerics: */ 40 /*FUNCTION Constraints::NumberOfConstraints{{{ 1*/40 /*FUNCTION Constraints::NumberOfConstraints{{{*/ 41 41 int Constraints::NumberOfConstraints(void){ 42 42 -
issm/branches/trunk-jpl-damage/src/c/Container/Constraints.h
r10522 r12878 21 21 public: 22 22 23 /*constructors, destructors: {{{ 1*/23 /*constructors, destructors: {{{*/ 24 24 Constraints(); 25 25 ~Constraints(); 26 26 /*}}}*/ 27 /*numerics: {{{ 1*/27 /*numerics: {{{*/ 28 28 int NumberOfConstraints(void); 29 29 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/Container/Container.h
r7737 r12878 6 6 #define _CONTAINER_CONTAINER_H_ 7 7 8 #include "../include/include.h" 8 9 #include "./DataSet.h" 9 10 #include "./Constraints.h" … … 17 18 #include "./Results.h" 18 19 #include "./Vertices.h" 20 #include "./Observations.h" 19 21 20 22 #endif //ifndef _CONTAINER_H_ -
issm/branches/trunk-jpl-damage/src/c/Container/DataSet.cpp
r12168 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 11 11 #endif 12 12 13 #include <cstring> 13 14 #include <vector> 14 15 #include <functional> … … 17 18 18 19 #include "./DataSet.h" 19 #include "../ objects/objects.h"20 #include "../classes/objects/objects.h" 20 21 #include "../shared/shared.h" 21 22 #include "../io/io.h" … … 27 28 28 29 /*Constructors/Destructors*/ 29 /*FUNCTION DataSet::DataSet(){{{ 1*/30 /*FUNCTION DataSet::DataSet(){{{*/ 30 31 DataSet::DataSet(){ 31 32 … … 36 37 } 37 38 /*}}}*/ 38 /*FUNCTION DataSet::DataSet(int dataset_enum){{{ 1*/39 /*FUNCTION DataSet::DataSet(int dataset_enum){{{*/ 39 40 DataSet::DataSet(int dataset_enum){ 40 41 enum_type=dataset_enum; … … 46 47 } 47 48 /*}}}*/ 48 /*FUNCTION DataSet::Copy{{{ 1*/49 /*FUNCTION DataSet::Copy{{{*/ 49 50 DataSet* DataSet::Copy(void){ 50 51 … … 58 59 copy->presorted=presorted; 59 60 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()); 62 63 } 63 64 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()); 66 67 } 67 68 … … 76 77 } 77 78 /*}}}*/ 78 /*FUNCTION DataSet::~DataSet{{{ 1*/79 /*FUNCTION DataSet::~DataSet{{{*/ 79 80 DataSet::~DataSet(){ 80 81 clear(); 81 x free((void**)&sorted_ids);82 x free((void**)&id_offsets);82 xDelete<int>(sorted_ids); 83 xDelete<int>(id_offsets); 83 84 } 84 85 /*}}}*/ 85 86 86 87 /*Specific methods*/ 87 /*FUNCTION DataSet::AddObject{{{ 1*/88 /*FUNCTION DataSet::AddObject{{{*/ 88 89 int DataSet::AddObject(Object* object){ 89 90 … … 93 94 } 94 95 /*}}}*/ 95 /*FUNCTION DataSet::clear{{{ 1*/96 /*FUNCTION DataSet::clear{{{*/ 96 97 void DataSet::clear(){ 97 98 … … 111 112 } 112 113 /*}}}*/ 113 /*FUNCTION DataSet::DeleteObject{{{ 1*/114 /*FUNCTION DataSet::DeleteObject{{{*/ 114 115 int DataSet::DeleteObject(Object* object){ 115 116 … … 126 127 } 127 128 /*}}}*/ 128 /*FUNCTION DataSet::DeepEcho{{{ 1*/129 /*FUNCTION DataSet::DeepEcho{{{*/ 129 130 void DataSet::DeepEcho(){ 130 131 … … 132 133 vector<Object*>::iterator object; 133 134 134 if(this==NULL)_error _("trying to echo a NULL dataset");135 136 _p rintf_(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"); 137 138 138 139 for ( object=objects.begin() ; object < objects.end(); object++ ){ … … 144 145 } 145 146 /*}}}*/ 146 /*FUNCTION DataSet::Echo{{{ 1*/147 /*FUNCTION DataSet::Echo{{{*/ 147 148 void DataSet::Echo(){ 148 149 149 150 vector<Object*>::iterator object; 150 151 151 if(this==NULL)_error _("trying to echo a NULL dataset");152 153 _p rintf_(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"); 154 155 155 156 for ( object=objects.begin() ; object < objects.end(); object++ ){ … … 162 163 } 163 164 /*}}}*/ 164 /*FUNCTION DataSet::GetEnum(){{{ 1*/165 /*FUNCTION DataSet::GetEnum(){{{*/ 165 166 int DataSet::GetEnum(){ 166 167 return enum_type; 167 168 } 168 169 /*}}}*/ 169 /*FUNCTION DataSet::GetEnum(int offset){{{ 1*/170 /*FUNCTION DataSet::GetEnum(int offset){{{*/ 170 171 int DataSet::GetEnum(int offset){ 171 172 … … 174 175 } 175 176 /*}}}*/ 176 /*FUNCTION DataSet::GetObjectByOffset{{{ 1*/177 /*FUNCTION DataSet::GetObjectByOffset{{{*/ 177 178 Object* DataSet::GetObjectByOffset(int offset){ 178 179 … … 185 186 } 186 187 /*}}}*/ 187 /*FUNCTION DataSet::GetObjectById{{{ 1*/188 /*FUNCTION DataSet::GetObjectById{{{*/ 188 189 Object* DataSet::GetObjectById(int* poffset,int eid){ 189 190 … … 193 194 194 195 _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!"); 196 197 197 198 /*Carry out a binary search on the sorted_ids: */ 198 199 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)); 200 201 } 201 202 … … 210 211 } 211 212 /*}}}*/ 212 /*FUNCTION DataSet::Presort{{{ 1*/213 /*FUNCTION DataSet::Presort{{{*/ 213 214 void DataSet::Presort(){ 214 215 … … 220 221 221 222 /*Delete existing ids*/ 222 x free((void**)&sorted_ids);223 x free((void**)&id_offsets);223 xDelete<int>(sorted_ids); 224 xDelete<int>(id_offsets); 224 225 225 226 /*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()); 228 229 229 230 /*Build id_offsets and sorted_ids*/ … … 238 239 } 239 240 /*}}}*/ 240 /*FUNCTION DataSet::SetSorting{{{ 1*/241 /*FUNCTION DataSet::SetSorting{{{*/ 241 242 void DataSet::SetSorting(int* in_sorted_ids,int* in_id_offsets){ 242 243 … … 246 247 } 247 248 /*}}}*/ 248 /*FUNCTION DataSet::Size{{{ 1*/249 /*FUNCTION DataSet::Size{{{*/ 249 250 int DataSet::Size(void){ 250 251 _assert_(this!=NULL); … … 253 254 } 254 255 /*}}}*/ 255 /*FUNCTION DataSet::Sort{{{ 1*/256 /*FUNCTION DataSet::Sort{{{*/ 256 257 void DataSet::Sort(){ 257 258 258 259 /*Only sort if we are not already sorted: */ 259 260 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 7 7 8 8 #include <vector> 9 #include "../ objects/Object.h"9 #include "../classes/objects/Object.h" 10 10 #include "../toolkits/toolkits.h" 11 11 #include "../EnumDefinitions/EnumDefinitions.h" 12 12 13 13 /*forward declarations */ 14 15 14 class Elements; 16 15 class Loads; … … 39 38 int* id_offsets; 40 39 41 /*constructors, destructors: {{{ 1*/40 /*constructors, destructors: {{{*/ 42 41 DataSet(); 43 42 DataSet(int enum_type); 44 43 ~DataSet(); 45 44 /*}}}*/ 46 /*management: {{{ 1*/45 /*management: {{{*/ 47 46 int GetEnum(); 48 47 int GetEnum(int offset); -
issm/branches/trunk-jpl-damage/src/c/Container/Elements.cpp
r12168 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Elements::Elements(){{{ 1*/27 /*FUNCTION Elements::Elements(){{{*/ 28 28 Elements::Elements(){ 29 29 enum_type=MeshElementsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Elements::~Elements(){{{ 1*/33 /*FUNCTION Elements::~Elements(){{{*/ 34 34 Elements::~Elements(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Elements::Configure{{{ 1*/40 /*FUNCTION Elements::Configure{{{*/ 41 41 void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 … … 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION Elements::ProcessResultsUnits{{{ 1*/55 /*FUNCTION Elements::ProcessResultsUnits{{{*/ 56 56 void Elements::ProcessResultsUnits(void){ 57 57 … … 63 63 } 64 64 /*}}}*/ 65 /*FUNCTION Elements::DeleteResults{{{ 1*/65 /*FUNCTION Elements::DeleteResults{{{*/ 66 66 void Elements::DeleteResults(void){ 67 67 … … 72 72 } 73 73 /*}}}*/ 74 /*FUNCTION Elements::ResultsToPatch{{{ 1*/74 /*FUNCTION Elements::ResultsToPatch{{{*/ 75 75 Patch* Elements::ResultsToPatch(void){ 76 76 … … 148 148 } 149 149 /*}}}*/ 150 /*FUNCTION Elements::SetCurrentConfiguration{{{ 1*/150 /*FUNCTION Elements::SetCurrentConfiguration{{{*/ 151 151 void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 152 152 … … 163 163 } 164 164 /*}}}*/ 165 /*FUNCTION Elements::ToResults{{{ 1*/165 /*FUNCTION Elements::ToResults{{{*/ 166 166 void Elements::ToResults(Results* results,Parameters* parameters){ 167 167 … … 173 173 int *resultssizes = NULL; 174 174 int *resultssteps = NULL; 175 double *resultstimes = NULL;176 double *vector_serial= NULL;175 IssmDouble *resultstimes = NULL; 176 IssmDouble *vector_serial= NULL; 177 177 Vector* vector = NULL; 178 178 bool io_gather; … … 203 203 /*see what the first element of this partition has in stock (this is common to all partitions)*/ 204 204 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??"); 206 206 Element* element=(Element*)this->GetObjectByOffset(0); 207 207 element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults); … … 215 215 #ifdef _HAVE_MPI_ 216 216 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); 221 221 } 222 222 MPI_Bcast(resultsenums,numberofresults,MPI_INT,minrank,MPI_COMM_WORLD); … … 232 232 if(resultssizes[i]==P1Enum) vectorsize=numberofvertices; 233 233 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])); 235 235 vector=new Vector(vectorsize); 236 236 237 237 for(int j=0;j<this->Size();j++){ 238 238 Element* element=(Element*)this->GetObjectByOffset(j); 239 element->GetVectorFromResults(vector,i,results sizes[i]);239 element->GetVectorFromResults(vector,i,resultsenums[i],resultssizes[i]); 240 240 } 241 241 vector->Assemble(); … … 250 250 /*clean up*/ 251 251 xdelete(&vector); 252 x free((void**)&vector_serial);252 xDelete<IssmDouble>(vector_serial); 253 253 } 254 254 } … … 269 269 270 270 /*Free ressources:*/ 271 x free((void**)&resultsenums);272 x free((void**)&resultssizes);273 x free((void**)&resultstimes);274 x free((void**)&resultssteps);271 xDelete<int>(resultsenums); 272 xDelete<int>(resultssizes); 273 xDelete<int>(resultssteps); 274 xDelete<IssmDouble>(resultstimes); 275 275 delete patch; 276 276 } 277 277 /*}}}*/ 278 /*FUNCTION Elements::NumberOfElements{{{ 1*/278 /*FUNCTION Elements::NumberOfElements{{{*/ 279 279 int Elements::NumberOfElements(void){ 280 280 … … 292 292 } 293 293 /*}}}*/ 294 /*FUNCTION Elements::InputCopy{{{ 1*/294 /*FUNCTION Elements::InputCopy{{{*/ 295 295 void Elements::InputDuplicate(int input_enum,int output_enum){ 296 296 -
issm/branches/trunk-jpl-damage/src/c/Container/Elements.h
r10989 r12878 16 16 class Inputs; 17 17 18 19 18 class Elements: public DataSet{ 20 19 21 20 public: 22 21 23 /*constructors, destructors: {{{ 1*/22 /*constructors, destructors: {{{*/ 24 23 Elements(); 25 24 ~Elements(); 26 25 /*}}}*/ 27 /*numerics: {{{ 1*/26 /*numerics: {{{*/ 28 27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 29 28 void DeleteResults(void); -
issm/branches/trunk-jpl-damage/src/c/Container/Inputs.cpp
r10522 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Inputs::Inputs(){{{ 1*/27 /*FUNCTION Inputs::Inputs(){{{*/ 28 28 Inputs::Inputs(){ 29 29 return; 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION Inputs::~Inputs(){{{ 1*/32 /*FUNCTION Inputs::~Inputs(){{{*/ 33 33 Inputs::~Inputs(){ 34 34 return; … … 37 37 38 38 /*Object management*/ 39 /*FUNCTION Inputs::GetInputValue(bool* pvalue,int enum-type){{{ 1*/39 /*FUNCTION Inputs::GetInputValue(bool* pvalue,int enum-type){{{*/ 40 40 void Inputs::GetInputValue(bool* pvalue,int enum_type){ 41 41 … … 57 57 /*we could not find an input with the correct enum type. No defaults values were provided, 58 58 * 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) << ")"); 60 60 } 61 61 … … 65 65 } 66 66 /*}}}*/ 67 /*FUNCTION Inputs::GetInputValue(int* pvalue,int enum-type){{{ 1*/67 /*FUNCTION Inputs::GetInputValue(int* pvalue,int enum-type){{{*/ 68 68 void Inputs::GetInputValue(int* pvalue,int enum_type){ 69 69 … … 85 85 /*we could not find an input with the correct enum type. No defaults values were provided, 86 86 * 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) << ")"); 88 88 } 89 89 … … 93 93 } 94 94 /*}}}*/ 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){{{*/ 96 void Inputs::GetInputValue(IssmDouble* pvalue,int enum_type){ 97 97 98 98 vector<Object*>::iterator object; … … 113 113 /*we could not find an input with the correct enum type. No defaults values were provided, 114 114 * 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) << ")"); 116 116 } 117 117 … … 121 121 } 122 122 /*}}}*/ 123 /*FUNCTION Inputs::GetInputAverage{{{ 1*/124 void Inputs::GetInputAverage( double* pvalue,int enum_type){123 /*FUNCTION Inputs::GetInputAverage{{{*/ 124 void Inputs::GetInputAverage(IssmDouble* pvalue,int enum_type){ 125 125 126 126 vector<Object*>::iterator object; … … 141 141 /*we could not find an input with the correct enum type. No defaults values were provided, 142 142 * 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) << ")"); 144 144 } 145 145 … … 149 149 } 150 150 /*}}}*/ 151 /*FUNCTION Inputs::AddInput{{{ 1*/151 /*FUNCTION Inputs::AddInput{{{*/ 152 152 int Inputs::AddInput(Input* in_input){ 153 153 … … 175 175 } 176 176 /*}}}*/ 177 /*FUNCTION Inputs::ChangeEnum{{{ 1*/177 /*FUNCTION Inputs::ChangeEnum{{{*/ 178 178 void Inputs::ChangeEnum(int oldenumtype,int newenumtype){ 179 179 … … 205 205 } 206 206 /*}}}*/ 207 /*FUNCTION Inputs::ConstrainMin{{{ 1*/208 void Inputs::ConstrainMin(int constrain_enum, double minimum){207 /*FUNCTION Inputs::ConstrainMin{{{*/ 208 void Inputs::ConstrainMin(int constrain_enum, IssmDouble minimum){ 209 209 210 210 Input* constrain_input=NULL; … … 213 213 214 214 /*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!"); 216 216 217 217 /*Apply ContrainMin: */ … … 219 219 } 220 220 /*}}}*/ 221 /*FUNCTION Inputs::InfinityNorm{{{ 1*/222 double Inputs::InfinityNorm(int enumtype){223 224 /*Output*/ 225 double norm;221 /*FUNCTION Inputs::InfinityNorm{{{*/ 222 IssmDouble Inputs::InfinityNorm(int enumtype){ 223 224 /*Output*/ 225 IssmDouble norm; 226 226 227 227 /*Get input*/ … … 240 240 } 241 241 /*}}}*/ 242 /*FUNCTION Inputs::Max{{{ 1*/243 double Inputs::Max(int enumtype){244 245 /*Output*/ 246 double max;242 /*FUNCTION Inputs::Max{{{*/ 243 IssmDouble Inputs::Max(int enumtype){ 244 245 /*Output*/ 246 IssmDouble max; 247 247 248 248 /*Get input*/ … … 254 254 } 255 255 else{ 256 _error _("Input %s not found",EnumToStringx(enumtype));256 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 257 257 } 258 258 … … 261 261 } 262 262 /*}}}*/ 263 /*FUNCTION Inputs::MaxAbs{{{ 1*/264 double Inputs::MaxAbs(int enumtype){265 266 /*Output*/ 267 double max;263 /*FUNCTION Inputs::MaxAbs{{{*/ 264 IssmDouble Inputs::MaxAbs(int enumtype){ 265 266 /*Output*/ 267 IssmDouble max; 268 268 269 269 /*Get input*/ … … 275 275 } 276 276 else{ 277 _error _("Input %s not found",EnumToStringx(enumtype));277 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 278 278 } 279 279 … … 282 282 } 283 283 /*}}}*/ 284 /*FUNCTION Inputs::Min{{{ 1*/285 double Inputs::Min(int enumtype){286 287 /*Output*/ 288 double min;284 /*FUNCTION Inputs::Min{{{*/ 285 IssmDouble Inputs::Min(int enumtype){ 286 287 /*Output*/ 288 IssmDouble min; 289 289 290 290 /*Get input*/ … … 296 296 } 297 297 else{ 298 _error _("Input %s not found",EnumToStringx(enumtype));298 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 299 299 } 300 300 … … 303 303 } 304 304 /*}}}*/ 305 /*FUNCTION Inputs::MinAbs{{{ 1*/306 double Inputs::MinAbs(int enumtype){307 308 /*Output*/ 309 double min;305 /*FUNCTION Inputs::MinAbs{{{*/ 306 IssmDouble Inputs::MinAbs(int enumtype){ 307 308 /*Output*/ 309 IssmDouble min; 310 310 311 311 /*Get input*/ … … 317 317 } 318 318 else{ 319 _error _("Input %s not found",EnumToStringx(enumtype));319 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 320 320 } 321 321 … … 324 324 } 325 325 /*}}}*/ 326 /*FUNCTION Inputs::GetInput{{{ 1*/326 /*FUNCTION Inputs::GetInput{{{*/ 327 327 Input* Inputs::GetInput(int enum_name){ 328 328 … … 341 341 } 342 342 /*}}}*/ 343 /*FUNCTION Inputs::DeleteInput{{{ 1*/343 /*FUNCTION Inputs::DeleteInput{{{*/ 344 344 int Inputs::DeleteInput(int enum_type){ 345 345 … … 361 361 } 362 362 /*}}}*/ 363 /*FUNCTION Inputs::DuplicateInput{{{ 1*/363 /*FUNCTION Inputs::DuplicateInput{{{*/ 364 364 void Inputs::DuplicateInput(int original_enum,int new_enum){ 365 365 … … 369 369 /*Make a copy of the original input: */ 370 370 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)); 372 372 copy=(Input*)original->copy(); 373 373 … … 379 379 } 380 380 /*}}}*/ 381 /*FUNCTION Inputs::SpawnTriaInputs{{{ 1*/381 /*FUNCTION Inputs::SpawnTriaInputs{{{*/ 382 382 Inputs* Inputs::SpawnTriaInputs(int* indices){ 383 383 … … 405 405 } 406 406 /*}}}*/ 407 /*FUNCTION Inputs::AXPY{{{ 1*/408 void Inputs::AXPY(int MeshYEnum, double scalar, int MeshXEnum){407 /*FUNCTION Inputs::AXPY{{{*/ 408 void Inputs::AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum){ 409 409 410 410 Input* xinput=NULL; … … 416 416 417 417 /*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!"); 420 420 421 421 /*Apply AXPY: */ … … 423 423 } 424 424 /*}}}*/ 425 /*FUNCTION Inputs::Configure{{{ 1*/425 /*FUNCTION Inputs::Configure{{{*/ 426 426 void Inputs::Configure(Parameters* parameters){ 427 427 -
issm/branches/trunk-jpl-damage/src/c/Container/Inputs.h
r10522 r12878 23 23 public: 24 24 25 /*constructors, destructors: {{{ 1*/25 /*constructors, destructors: {{{*/ 26 26 Inputs(); 27 27 ~Inputs(); 28 28 29 29 /*}}}*/ 30 /*numerics: {{{ 1*/30 /*numerics: {{{*/ 31 31 int AddInput(Input* in_input); 32 32 void ChangeEnum(int enumtype,int new_enumtype); 33 void ConstrainMin(int constrain_enum, double minimum);33 void ConstrainMin(int constrain_enum, IssmDouble minimum); 34 34 int DeleteInput(int enum_type); 35 35 void DuplicateInput(int original_enum,int new_enum); 36 36 Input* GetInput(int enum_name); 37 37 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); 44 44 45 void GetInputAverage( double* pvalue, int enum_type);45 void GetInputAverage(IssmDouble* pvalue, int enum_type); 46 46 void GetInputValue(bool* pvalue,int enum_type); 47 47 void GetInputValue(int* pvalue,int enum_type); 48 void GetInputValue( double* pvalue,int enum_type);48 void GetInputValue(IssmDouble* pvalue,int enum_type); 49 49 50 50 void Configure(Parameters* parameters); -
issm/branches/trunk-jpl-damage/src/c/Container/Loads.cpp
r12168 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Loads::Loads(){{{ 1*/27 /*FUNCTION Loads::Loads(){{{*/ 28 28 Loads::Loads(){ 29 29 enum_type=LoadsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Loads::~Loads(){{{ 1*/33 /*FUNCTION Loads::~Loads(){{{*/ 34 34 Loads::~Loads(){ 35 35 return; … … 38 38 39 39 /*Numerics:*/ 40 /*FUNCTION Loads::Configure{{{ 1*/40 /*FUNCTION Loads::Configure{{{*/ 41 41 void Loads::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 … … 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION Loads::NumberOfLoads{{{ 1*/55 /*FUNCTION Loads::NumberOfLoads{{{*/ 56 56 int Loads::NumberOfLoads(void){ 57 57 … … 74 74 } 75 75 /*}}}*/ 76 /*FUNCTION Loads::SetCurrentConfiguration{{{ 1*/76 /*FUNCTION Loads::SetCurrentConfiguration{{{*/ 77 77 void Loads::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 78 78 -
issm/branches/trunk-jpl-damage/src/c/Container/Loads.h
r10522 r12878 20 20 public: 21 21 22 /*constructors, destructors: {{{ 1*/22 /*constructors, destructors: {{{*/ 23 23 Loads(); 24 24 ~Loads(); 25 25 /*}}}*/ 26 /*numerics: {{{ 1*/26 /*numerics: {{{*/ 27 27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 28 28 int NumberOfLoads(void); -
issm/branches/trunk-jpl-damage/src/c/Container/Materials.cpp
r10522 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Materials::Materials(){{{ 1*/27 /*FUNCTION Materials::Materials(){{{*/ 28 28 Materials::Materials(){ 29 29 enum_type=MaterialsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Materials::~Materials(){{{ 1*/33 /*FUNCTION Materials::~Materials(){{{*/ 34 34 Materials::~Materials(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Materials::Configure{{{ 1*/40 /*FUNCTION Materials::Configure{{{*/ 41 41 void Materials::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 -
issm/branches/trunk-jpl-damage/src/c/Container/Materials.h
r10522 r12878 19 19 public: 20 20 21 /*constructors, destructors: {{{ 1*/21 /*constructors, destructors: {{{*/ 22 22 Materials(); 23 23 ~Materials(); 24 24 /*}}}*/ 25 /*numerics: {{{ 1*/25 /*numerics: {{{*/ 26 26 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 27 27 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/Container/Nodes.cpp
r12168 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Nodes::Nodes(){{{ 1*/27 /*FUNCTION Nodes::Nodes(){{{*/ 28 28 Nodes::Nodes(){ 29 29 enum_type=NodesEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Nodes::~Nodes(){{{ 1*/33 /*FUNCTION Nodes::~Nodes(){{{*/ 34 34 Nodes::~Nodes(){ 35 35 return; … … 38 38 39 39 /*Numerics*/ 40 /*FUNCTION Nodes::Configure{{{ 1*/40 /*FUNCTION Nodes::Configure{{{*/ 41 41 void Nodes::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 … … 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION Nodes::DistributeDofs{{{ 1*/55 /*FUNCTION Nodes::DistributeDofs{{{*/ 56 56 void Nodes::DistributeDofs(int analysis_type,int setenum){ 57 57 … … 84 84 * cpus by the total last dofs of the previus cpu, starting from 0. 85 85 * First: get number of dofs for each cpu*/ 86 alldofcount= (int*)xmalloc(num_procs*sizeof(int));86 alldofcount=xNew<int>(num_procs); 87 87 #ifdef _HAVE_MPI_ 88 88 MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD); … … 113 113 numnodes=this->NumberOfNodes(analysis_type); 114 114 if(numnodes*maxdofspernode){ 115 truedofs= (int*)xcalloc(numnodes*maxdofspernode,sizeof(int)); //initialize to 0, so that we can pick up the max116 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); 117 117 } 118 118 … … 139 139 140 140 /* Free ressources: */ 141 x free((void**)&alldofcount);142 x free((void**)&truedofs);143 x free((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{{{*/ 147 147 void Nodes::FlagClones(int analysis_type){ 148 148 … … 158 158 159 159 /*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); 162 162 163 163 for(i=0;i<numnodes;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit. … … 190 190 191 191 /*Free ressources: */ 192 x free((void**)&ranks);193 x free((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{{{*/ 198 198 int Nodes::MaxNumDofs(int analysis_type,int setenum){ 199 199 … … 225 225 } 226 226 /*}}}*/ 227 /*FUNCTION Nodes::NumberOfDofs{{{ 1*/227 /*FUNCTION Nodes::NumberOfDofs{{{*/ 228 228 int Nodes::NumberOfDofs(int analysis_type,int setenum){ 229 229 … … 259 259 } 260 260 /*}}}*/ 261 /*FUNCTION Nodes::NumberOfNodes(){{{ 1*/261 /*FUNCTION Nodes::NumberOfNodes(){{{*/ 262 262 int Nodes::NumberOfNodes(void){ 263 263 … … 287 287 } 288 288 /*}}}*/ 289 /*FUNCTION Nodes::NumberOfNodes(analysis){{{ 1*/289 /*FUNCTION Nodes::NumberOfNodes(analysis){{{*/ 290 290 int Nodes::NumberOfNodes(int analysis_type){ 291 291 … … 326 326 } 327 327 /*}}}*/ 328 /*FUNCTION Nodes::Ranks{{{ 1*/328 /*FUNCTION Nodes::Ranks{{{*/ 329 329 void Nodes::Ranks(int* ranks,int analysis_type){ 330 330 … … 352 352 } 353 353 /*}}}*/ 354 /*FUNCTION Nodes::SetCurrentConfiguration{{{ 1*/354 /*FUNCTION Nodes::SetCurrentConfiguration{{{*/ 355 355 void Nodes::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 356 356 -
issm/branches/trunk-jpl-damage/src/c/Container/Nodes.h
r10522 r12878 13 13 public: 14 14 15 /*constructors, destructors: {{{ 1*/15 /*constructors, destructors: {{{*/ 16 16 Nodes(); 17 17 ~Nodes(); 18 18 /*}}}*/ 19 /*numerics: {{{ 1*/19 /*numerics: {{{*/ 20 20 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 21 21 void DistributeDofs(int analysis_type,int SETENUM); -
issm/branches/trunk-jpl-damage/src/c/Container/Observations.cpp
r12280 r12878 20 20 #include "../shared/shared.h" 21 21 #include "../include/include.h" 22 #include "../modules/modules.h" 22 23 #include "../EnumDefinitions/EnumDefinitions.h" 24 #include "../io/io.h" 23 25 24 26 using namespace std; … … 32 34 } 33 35 /*}}}*/ 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){{{*/ 37 Observations::Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options){ 36 38 37 39 /*Intermediaries*/ 38 int i, maxdepth,level,counter;40 int i,j,maxdepth,level,counter,index; 39 41 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; 42 44 Observation *observation = NULL; 43 45 … … 52 54 offset=0.05*(ymax-ymin); ymin-=offset; ymax+=offset; 53 55 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 54 62 /*Get Minimum box size*/ 55 63 if(options->GetOption("boxlength")){ 56 64 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"); 58 66 maxdepth=int(log(max(xmax-xmin,ymax-ymin)/minlength +1)/log(2.0)); 59 67 } 60 68 else{ 61 69 maxdepth = 30; 62 minlength=max(xmax-xmin,ymax-ymin)/ double((1L<<maxdepth)-1);70 minlength=max(xmax-xmin,ymax-ymin)/IssmDouble((1L<<maxdepth)-1); 63 71 } 64 72 65 73 /*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 << ")... "); 67 75 this->quadtree = new Quadtree(xmin,xmax,ymin,ymax,maxdepth); 68 76 … … 70 78 counter = 0; 71 79 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 72 92 this->quadtree->IntergerCoordinates(&xi,&yi,x[i],y[i]); 73 93 this->quadtree->QuadtreeDepth2(&level,xi,yi); … … 82 102 } 83 103 } 84 printf("done\n"); 104 _pprintLine_("done"); 105 _pprintLine_("Initial number of observations: " << n); 106 _pprintLine_(" Final number of observations: " << this->quadtree->NbObs); 85 107 } 86 108 /*}}}*/ … … 93 115 94 116 /*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{{{*/ 118 void Observations::ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius){ 97 119 98 120 /*Output and Intermediaries*/ 121 bool stop; 99 122 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; 103 125 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){{{*/ 167 void 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; 104 173 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){ 122 230 /*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); 126 234 127 235 /*Loop over all observations and fill in x, y and obs*/ … … 133 241 134 242 /*Assign output pointer*/ 135 x free((void**)&indices);243 xDelete<int>(indices); 136 244 *px=x; 137 245 *py=y; … … 139 247 *pnobs=nobs; 140 248 }/*}}}*/ 249 /*FUNCTION Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs){{{*/ 250 void 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{{{*/ 278 void 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{{{*/ 327 void 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{{{*/ 414 void 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 }/*}}}*/ 141 425 /*FUNCTION Observations::QuadtreeColoring{{{*/ 142 void Observations::QuadtreeColoring( double* A,double *x,double *y,int n){426 void Observations::QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n){ 143 427 144 428 int xi,yi,level; … … 147 431 this->quadtree->IntergerCoordinates(&xi,&yi,x[i],y[i]); 148 432 this->quadtree->QuadtreeDepth(&level,xi,yi); 149 A[i]=( double)level;433 A[i]=(IssmDouble)level; 150 434 } 151 435 152 436 }/*}}}*/ 153 437 /*FUNCTION Observations::Variomap{{{*/ 154 void Observations::Variomap( double* gamma,double *x,int n){438 void Observations::Variomap(IssmDouble* gamma,IssmDouble *x,int n){ 155 439 156 440 /*Output and Intermediaries*/ 157 int nobs,i,j,k;158 double range;441 int i,j,k; 442 IssmDouble distance; 159 443 Observation *observation1 = NULL; 160 444 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; 165 448 for(j=0;j<n;j++) gamma[j] = 0.0; 166 449 … … 168 451 observation1=(Observation*)this->GetObjectByOffset(i); 169 452 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.; 183 465 } 184 466 } 185 467 186 468 /*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]; 189 472 } 190 473 191 474 /*Assign output pointer*/ 192 x free((void**)&counter);193 }/*}}}*/ 475 xDelete<IssmDouble>(counter); 476 }/*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/Container/Observations.h
r12258 r12878 6 6 #define _CONTAINER_OBSERVATIONS_H_ 7 7 8 class Obsevration; 8 #include "../include/include.h" 9 9 10 class Quadtree; 11 class Variogram; 10 12 class Options; 11 13 … … 19 21 /*constructors, destructors*/ 20 22 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); 22 24 ~Observations(); 23 25 24 26 /*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); 28 35 29 36 }; -
issm/branches/trunk-jpl-damage/src/c/Container/Options.cpp
r12168 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 13 13 #include <vector> 14 14 #include <algorithm> 15 #include <cstring> 15 16 16 17 #include "./DataSet.h" … … 24 25 25 26 /*Object constructors and destructor*/ 26 /*FUNCTION Options::Options(){{{ 1*/27 /*FUNCTION Options::Options(){{{*/ 27 28 Options::Options(){ 28 29 return; 29 30 } 30 31 /*}}}*/ 31 /*FUNCTION Options::~Options(){{{ 1*/32 /*FUNCTION Options::~Options(){{{*/ 32 33 Options::~Options(){ 33 34 return; … … 36 37 37 38 /*Object management*/ 38 /*FUNCTION Options::AddOption{{{ 1*/39 /*FUNCTION Options::AddOption{{{*/ 39 40 int Options::AddOption(Option* in_option){ 40 41 … … 46 47 47 48 /*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 \"]\""); 52 53 53 54 /*Finally, check that no option of the same name already exists in the dataset*/ … … 56 57 option=(Option*)(*object); 57 58 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"); 59 60 break; 60 61 } … … 67 68 } 68 69 /*}}}*/ 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,doubledefault_value){70 /*FUNCTION Options::Get(int* pvalue, char* name){{{*/ 71 void 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){{{*/ 90 void Options::Get(int* pvalue,const char* name,int default_value){ 90 91 91 92 vector<Object*>::iterator object; … … 105 106 } 106 107 /*}}}*/ 107 /*FUNCTION Options::Get(bool* pvalue, char* name){{{1*/ 108 /*FUNCTION Options::Get(IssmDouble* pvalue, char* name){{{*/ 109 void 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){{{*/ 128 void 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){{{*/ 108 147 void Options::Get(bool* pvalue,const char* name){ 109 148 … … 120 159 /*Else, the Option does not exist, no default provided*/ 121 160 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){{{*/ 127 166 void Options::Get(bool* pvalue,const char* name,bool default_value){ 128 167 … … 143 182 } 144 183 /*}}}*/ 145 /*FUNCTION Options::Get(char** pvalue, char* name){{{ 1*/184 /*FUNCTION Options::Get(char** pvalue, char* name){{{*/ 146 185 void Options::Get(char** pvalue,const char* name){ 147 186 … … 160 199 /*Else, the Option does not exist, no default provided*/ 161 200 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){{{*/ 168 207 void Options::Get(char** pvalue,const char* name,const char* default_value){ 169 208 … … 183 222 else{ 184 223 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); 187 226 *pvalue=outstring; 188 227 } … … 190 229 } 191 230 /*}}}*/ 192 /*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{ 1*/231 /*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{*/ 193 232 void Options::Get(char*** ppvalue,int* numel,const char* name){ 194 233 … … 207 246 if(option->ObjectEnum()==OptionCellEnum){ 208 247 if (option->NumEl()) { 209 *ppvalue= (char **) xmalloc(option->NumEl()*sizeof(char *));248 *ppvalue=xNew<char*>(option->NumEl()); 210 249 if (numel) *numel=option->NumEl(); 211 250 option->Get(&options); … … 225 264 /*Else: not supported*/ 226 265 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())); 228 267 } 229 268 } … … 236 275 } 237 276 /*}}}*/ 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){{{*/ 278 void Options::Get(IssmDouble** pvalue,int* numel,const char* name){ 240 279 241 280 vector<Object*>::iterator object; … … 251 290 /*Else, the Option does not exist, no default provided*/ 252 291 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{{{*/ 258 297 Option* Options::GetOption(const char* name){ 259 298 … … 285 324 /*Else: not supported*/ 286 325 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())); 288 327 } 289 328 } -
issm/branches/trunk-jpl-damage/src/c/Container/Options.h
r12168 r12878 20 20 int AddOption(Option* in_oobject); 21 21 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); 24 26 void Get(bool* pvalue,const char* name); 25 27 void Get(bool* pvalue,const char* name,bool default_value); … … 27 29 void Get(char** pvalue,const char* name,const char* default_value); 28 30 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); 30 32 }; 31 33 -
issm/branches/trunk-jpl-damage/src/c/Container/Parameters.cpp
r11708 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Parameters::Parameters(){{{ 1*/27 /*FUNCTION Parameters::Parameters(){{{*/ 28 28 Parameters::Parameters(){ 29 29 enum_type=ParametersEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Parameters::~Parameters(){{{ 1*/33 /*FUNCTION Parameters::~Parameters(){{{*/ 34 34 Parameters::~Parameters(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Parameters::Exist{{{ 1*/40 /*FUNCTION Parameters::Exist{{{*/ 41 41 bool Parameters::Exist(int enum_type){ 42 42 … … 51 51 } 52 52 /*}}}*/ 53 /*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{ 1*/53 /*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{*/ 54 54 void Parameters::FindParam(bool* pbool,int enum_type){ _assert_(this); 55 55 … … 65 65 } 66 66 } 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){{{*/ 71 71 void Parameters::FindParam(int* pinteger,int enum_type){ _assert_(this); 72 72 … … 82 82 } 83 83 } 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){{{*/ 88 void Parameters::FindParam(IssmDouble* pscalar, int enum_type){ _assert_(this); 89 89 90 90 vector<Object*>::iterator object; … … 99 99 } 100 100 } 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){{{*/ 105 void 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){{{*/ 105 122 void Parameters::FindParam(char** pstring,int enum_type){ _assert_(this); 106 123 … … 116 133 } 117 134 } 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){{{*/ 123 140 void Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){ _assert_(this); 124 141 … … 134 151 } 135 152 } 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){{{*/ 141 158 void Parameters::FindParam(int** pintarray,int* pM, int enum_type){ _assert_(this); 142 159 … … 152 169 } 153 170 } 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){{{*/ 159 176 void Parameters::FindParam(int** pintarray,int* pM,int *pN,int enum_type){ _assert_(this); 160 177 … … 170 187 } 171 188 } 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(p doublearray,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(p doublearray,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){{{*/ 194 void 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){{{*/ 212 void 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){{{*/ 230 void Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this); 214 231 215 232 vector<Object*>::iterator object; … … 224 241 } 225 242 } 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){{{*/ 230 247 void Parameters::FindParam(Vector** pvec,int enum_type){ _assert_(this); 231 248 … … 241 258 } 242 259 } 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){{{*/ 248 265 void Parameters::FindParam(Matrix** pmat,int enum_type){ _assert_(this); 249 266 … … 259 276 } 260 277 } 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){{{*/ 266 283 void Parameters::FindParam(FILE** pfid,int enum_type){ _assert_(this); 267 284 … … 277 294 } 278 295 } 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);{{{*/ 284 301 void Parameters::SetParam(bool boolean,int enum_type){ 285 302 … … 293 310 } 294 311 /*}}}*/ 295 /*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{ 1*/312 /*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{*/ 296 313 void Parameters::SetParam(int integer,int enum_type){ 297 314 … … 305 322 } 306 323 /*}}}*/ 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);{{{*/ 325 void Parameters::SetParam(IssmDouble scalar,int enum_type){ 309 326 310 327 Param* param=NULL; … … 317 334 } 318 335 /*}}}*/ 319 /*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{ 1*/336 /*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{*/ 320 337 void Parameters::SetParam(char* string,int enum_type){ 321 338 … … 329 346 } 330 347 /*}}}*/ 331 /*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{ 1*/348 /*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{*/ 332 349 void Parameters::SetParam(char** stringarray,int M, int enum_type){ 333 350 … … 341 358 } 342 359 /*}}}*/ 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);{{{*/ 361 void 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);{{{*/ 373 void 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);{{{*/ 368 385 void Parameters::SetParam(int* intarray,int M, int enum_type){ 369 386 … … 377 394 } 378 395 /*}}}*/ 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);{{{*/ 380 397 void Parameters::SetParam(int* intarray,int M, int N, int enum_type){ 381 398 … … 389 406 } 390 407 /*}}}*/ 391 /*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{ 1*/408 /*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{*/ 392 409 void Parameters::SetParam(Vector* vector,int enum_type){ 393 410 … … 401 418 } 402 419 /*}}}*/ 403 /*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{ 1*/420 /*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{*/ 404 421 void Parameters::SetParam(Matrix* matrix,int enum_type){ 405 422 … … 413 430 } 414 431 /*}}}*/ 415 /*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{ 1*/432 /*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{*/ 416 433 void Parameters::SetParam(FILE* fid,int enum_type){ 417 434 … … 425 442 } 426 443 /*}}}*/ 427 /*FUNCTION Parameters::UnitConversion(int direction_enum);{{{ 1*/444 /*FUNCTION Parameters::UnitConversion(int direction_enum);{{{*/ 428 445 void Parameters::UnitConversion(int direction_enum){ 429 446 … … 439 456 /*}}}*/ 440 457 441 /*FUNCTION Parameters::FindParamObject{{{ 1*/458 /*FUNCTION Parameters::FindParamObject{{{*/ 442 459 Object* Parameters::FindParamObject(int enum_type){ 443 460 -
issm/branches/trunk-jpl-damage/src/c/Container/Parameters.h
r12258 r12878 23 23 public: 24 24 25 /*constructors, destructors : {{{1*/25 /*constructors, destructors*/ 26 26 Parameters(); 27 27 ~Parameters(); 28 /*}}}*/ 29 /*numerics : {{{1*/28 29 /*numerics*/ 30 30 bool Exist(int enum_type); 31 31 32 32 void FindParam(bool* pinteger,int enum_type); 33 33 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); 35 36 void FindParam(char** pstring,int enum_type); 36 37 void FindParam(char*** pstringarray,int* pM,int enum_type); 37 38 void FindParam(int** pintarray,int* pM,int enum_type); 38 39 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); 42 43 void FindParam(Vector** pvec,int enum_type); 43 44 void FindParam(Matrix** pmat,int enum_type); … … 46 47 void SetParam(bool boolean,int enum_type); 47 48 void SetParam(int integer,int enum_type); 48 void SetParam( double scalar, int enum_type);49 void SetParam(IssmDouble scalar, int enum_type); 49 50 void SetParam(char* string,int enum_type); 50 51 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); 53 54 void SetParam(int* intarray,int M,int enum_type); 54 55 void SetParam(int* intarray,int M,int N,int enum_type); … … 59 60 60 61 Object* FindParamObject(int enum_type); 61 /*}}}*/62 62 63 63 }; -
issm/branches/trunk-jpl-damage/src/c/Container/Results.cpp
r12168 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Results::Results(){{{ 1*/27 /*FUNCTION Results::Results(){{{*/ 28 28 Results::Results(){ 29 29 enum_type=ResultsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Results::~Results(){{{ 1*/33 /*FUNCTION Results::~Results(){{{*/ 34 34 Results::~Results(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Results::SpawnTriaResults{{{ 1*/40 /*FUNCTION Results::SpawnTriaResults{{{*/ 41 41 Results* Results::SpawnTriaResults(int* indices){ 42 42 … … 64 64 } 65 65 /*}}}*/ 66 /*FUNCTION Results::Write{{{ 1*/66 /*FUNCTION Results::Write{{{*/ 67 67 void Results::Write(Parameters* parameters){ 68 68 -
issm/branches/trunk-jpl-damage/src/c/Container/Results.h
r12168 r12878 20 20 public: 21 21 22 /*constructors, destructors: {{{ 1*/22 /*constructors, destructors: {{{*/ 23 23 Results(); 24 24 ~Results(); 25 25 /*}}}*/ 26 /*numerics: {{{ 1*/26 /*numerics: {{{*/ 27 27 Results* SpawnTriaResults(int* indices); 28 28 void Write(Parameters* parameters); -
issm/branches/trunk-jpl-damage/src/c/Container/Vertices.cpp
r12168 r12878 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Vertices::Vertices(){{{ 1*/27 /*FUNCTION Vertices::Vertices(){{{*/ 28 28 Vertices::Vertices(){ 29 29 enum_type=VerticesEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Vertices::~Vertices(){{{ 1*/33 /*FUNCTION Vertices::~Vertices(){{{*/ 34 34 Vertices::~Vertices(){ 35 35 return; … … 38 38 39 39 /*Numerics management*/ 40 /*FUNCTION Vertices::DistributeDofs{{{ 1*/40 /*FUNCTION Vertices::DistributeDofs{{{*/ 41 41 void Vertices::DistributeDofs(int numberofobjects,int numberofdofsperobject){ 42 42 … … 60 60 * cpus by the total last dofs of the previus cpu, starting from 0. 61 61 * First: bet number of dofs for each cpu*/ 62 alldofcount= (int*)xmalloc(num_procs*sizeof(int));62 alldofcount=xNew<int>(num_procs); 63 63 #ifdef _HAVE_MPI_ 64 64 MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD); … … 83 83 * object that is not a clone, tell them to show their dofs, so that later on, they can get picked 84 84 * 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); 87 87 for (i=0;i<this->Size();i++){ 88 88 Vertex* vertex=(Vertex*)this->GetObjectByOffset(i); … … 102 102 103 103 /* Free ressources: */ 104 x free((void**)&alldofcount);105 x free((void**)&truedofs);106 x free((void**)&alltruedofs);104 xDelete<int>(alldofcount); 105 xDelete<int>(truedofs); 106 xDelete<int>(alltruedofs); 107 107 } 108 108 /*}}}*/ 109 /*FUNCTION Vertices::FlagClones{{{ 1*/109 /*FUNCTION Vertices::FlagClones{{{*/ 110 110 void Vertices::FlagClones(int numberofobjects){ 111 111 … … 117 117 118 118 /*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); 121 121 122 122 for(i=0;i<numberofobjects;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit. … … 143 143 144 144 /*Free ressources: */ 145 x free((void**)&ranks);146 x free((void**)&minranks);145 xDelete<int>(ranks); 146 xDelete<int>(minranks); 147 147 148 148 } 149 149 /*}}}*/ 150 /*FUNCTION Vertices::NumberOfVertices{{{ 1*/150 /*FUNCTION Vertices::NumberOfVertices{{{*/ 151 151 int Vertices::NumberOfVertices(void){ 152 152 … … 174 174 } 175 175 /*}}}*/ 176 /*FUNCTION Vertices::Ranks{{{ 1*/176 /*FUNCTION Vertices::Ranks{{{*/ 177 177 void Vertices::Ranks(int* ranks){ 178 178 -
issm/branches/trunk-jpl-damage/src/c/Container/Vertices.h
r12258 r12878 19 19 public: 20 20 21 /*constructors, destructors: {{{ 1*/21 /*constructors, destructors: {{{*/ 22 22 Vertices(); 23 23 ~Vertices(); 24 24 /*}}}*/ 25 /*numerics: {{{ 1*/25 /*numerics: {{{*/ 26 26 void DistributeDofs(int numberofnodes,int numdofspernode); 27 27 void FlagClones(int numberofnodes); -
issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/EnumDefinitions.h
r12872 r12878 105 105 MaterialsRhoIceEnum, 106 106 MaterialsRhoWaterEnum, 107 MaterialsRhoFreshwaterEnum, 107 108 MaterialsMuWaterEnum, 108 109 MaterialsThermalExchangeVelocityEnum, … … 150 151 SettingsResultsAsPatchesEnum, 151 152 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, 156 163 MaxIterationConvergenceFlagEnum, 157 164 SteadystateMaxiterEnum, … … 162 169 SurfaceforcingsPrecipitationEnum, 163 170 SurfaceforcingsMassBalanceEnum, 171 SurfaceforcingsIspddEnum, 172 SurfaceforcingsIssmbgradientsEnum, 173 SurfaceforcingsMonthlytemperaturesEnum, 174 SurfaceforcingsHcEnum, 175 SurfaceforcingsSmbPosMaxEnum, 176 SurfaceforcingsSmbPosMinEnum, 177 SurfaceforcingsAPosEnum, 178 SurfaceforcingsBPosEnum, 179 SurfaceforcingsANegEnum, 180 SurfaceforcingsBNegEnum, 164 181 ThermalMaxiterEnum, 165 182 ThermalPenaltyFactorEnum, … … 261 278 IntParamEnum, 262 279 IntVecParamEnum, 280 TransientParamEnum, 263 281 MacAyeal2dIceFrontEnum, 264 282 MacAyeal3dIceFrontEnum, … … 386 404 StressTensorzzEnum, 387 405 IceVolumeEnum, 406 TotalSmbEnum, 388 407 /*}}}*/ 389 408 /*Element Interpolations{{{1*/ -
issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/Synchronize.sh
r12280 r12878 2 2 #Synchronize EnumToStringx.cpp and StringToEnumx.cpp and matlab Enums 3 3 4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all com as > put everything in file temp4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all commas > put everything in file temp 5 5 cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,/ /g" | awk '{print $1}' > temp 6 6 7 7 #Removed existing files 8 8 rm $ISSM_DIR/src/m/enum/*.m 9 rm $ISSM_DIR/src/m/enum/*.py 9 10 rm $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp 10 11 rm $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp … … 25 26 */ 26 27 28 #include <cstring> 27 29 #include "../../shared/shared.h" 28 30 #include "../../include/include.h" … … 47 49 48 50 len=strlen(EnumToStringx(enum_in)); 49 string= (char*)xmalloc((len+1)*sizeof(char));51 string=xNew<char>(len+1); 50 52 memcpy(string,EnumToStringx(enum_in),(len+1)*sizeof(char)); 51 53 … … 55 57 END 56 58 #}}} 57 #Build StringToEnumx.cpp {{{ 159 #Build StringToEnumx.cpp {{{ 58 60 #Header 59 61 cat <<END > $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp … … 67 69 */ 68 70 71 #include <cstring> 69 72 #include "../../shared/shared.h" 70 73 #include "../../include/include.h" … … 95 98 cat <<END >> $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp 96 99 /*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"); 98 101 } 99 102 END … … 102 105 # go through the lines of temp 103 106 ENUM=0; 107 #Add header to pythonenum file{{{ 108 cat <<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 117 END 118 #}}} 119 104 120 for NAMEENUM in $(cat temp); do 105 121 … … 140 156 END 141 157 #}}} 158 #Add case to pythonenum file{{{ 159 cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py 160 def $(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 170 END 171 #}}} 142 172 143 173 done 144 #MaximumNumberOfEnums {{{174 #MaximumNumberOfEnums (matlab){{{ 145 175 cat <<END > $ISSM_DIR/src/m/enum/MaximumNumberOfEnums.m 146 176 function macro=MaximumNumberOfEnums() … … 159 189 END 160 190 #}}} 191 #MaximumNumberOfEnums (python){{{ 192 cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py 193 def 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 205 END 206 #}}} 161 207 162 208 #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@1 INCLUDES = @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@ 2 2 3 3 EXEEXT=$(ISSMEXT) 4 4 5 #Library declaration {{{1 6 lib_LIBRARIES = libISSMCore.a libISSMModules.a libISSMOverload.a 5 #Library declaration {{{ 6 lib_LIBRARIES = libISSMCore.a libISSMOverload.a 7 8 #if SHARED 9 #lib_LTLIBRARIES = libISSM.la libISSMCore.la libISSMOverload.la 10 #endif 7 11 if PYTHON 8 12 lib_LIBRARIES += libISSMPython.a … … 11 15 lib_LIBRARIES += libISSMMatlab.a 12 16 endif 17 if MODULES 18 lib_LIBRARIES += libISSMModules.a 19 endif 13 20 #}}} 14 21 15 22 #sources 16 #Core sources{{{ 123 #Core sources{{{ 17 24 core_sources = ./issm.h\ 18 25 ./issm-binding.h\ … … 21 28 ./include/types.h\ 22 29 ./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\ 149 160 ./Container/Container.h\ 150 161 ./Container/Constraints.h\ … … 173 184 ./shared/Alloc/alloc.h\ 174 185 ./shared/Alloc/alloc.cpp\ 186 ./shared/Alloc/xNewDelete.h\ 187 ./shared/MemOps/xMemCpy.h\ 175 188 ./shared/Matrix/matrix.h\ 176 189 ./shared/Matrix/MatrixUtils.cpp\ 177 ./shared/Dofs/dofs.h\178 ./shared/Dofs/dofsetgen.cpp\179 190 ./shared/Numerics/numerics.h\ 180 191 ./shared/Numerics/Verbosity.h\ … … 202 213 ./shared/Elements/GetGlobalDofList.cpp\ 203 214 ./shared/Elements/GetNumberOfDofs.cpp\ 215 ./shared/Elements/PrintArrays.cpp\ 216 ./shared/Elements/PddSurfaceMassBalance.cpp\ 217 ./shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp\ 204 218 ./shared/String/sharedstring.h\ 205 219 ./shared/Wrapper/wrappershared.h\ 206 220 ./shared/Wrapper/ModuleBoot.cpp\ 207 221 ./shared/Wrapper/ModuleEnd.cpp\ 222 ./shared/Sys/sys.h\ 223 ./shared/Sys/ProfilingStart.cpp\ 224 ./shared/Sys/ProfilingEnd.cpp\ 208 225 ./toolkits/metis/metisincludes.h\ 209 226 ./toolkits/issm/issmtoolkit.h\ … … 281 298 ./modules/PositiveDegreeDayx/PositiveDegreeDayx.h\ 282 299 ./modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp\ 300 ./modules/Delta18oParameterizationx/Delta18oParameterizationx.h\ 301 ./modules/Delta18oParameterizationx/Delta18oParameterizationx.cpp\ 302 ./modules/SmbGradientsx/SmbGradientsx.h\ 303 ./modules/SmbGradientsx/SmbGradientsx.cpp\ 283 304 ./modules/UpdateConstraintsx/UpdateConstraintsx.h\ 284 305 ./modules/UpdateConstraintsx/UpdateConstraintsx.cpp\ … … 310 331 ./modules/Solverx/Solverx.cpp\ 311 332 ./modules/Solverx/Solverx.h\ 333 ./modules/Solverx/SolverxSeq.cpp\ 312 334 ./modules/VecMergex/VecMergex.cpp\ 313 335 ./modules/VecMergex/VecMergex.h\ … … 326 348 ./solvers/solver_linear.cpp\ 327 349 ./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 {{{ 368 dakota_sources = ./classes/dakota/DakotaPlugin.h\ 369 ./classes/dakota/DakotaPlugin.cpp\ 333 370 ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h\ 334 371 ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\ … … 352 389 ./modules/Dakotax/SpawnCoreParallel.cpp 353 390 #}}} 354 #Transient sources {{{ 1391 #Transient sources {{{ 355 392 transient_sources = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \ 356 393 ./solutions/transient_core.cpp 357 394 #}}} 358 #Steadystate sources {{{ 1395 #Steadystate sources {{{ 359 396 steadystate_sources = ./solutions/steadystate_core.cpp\ 360 397 ./solutions/steadystateconvergence.cpp 361 398 #}}} 362 #Prognostic sources {{{ 1399 #Prognostic sources {{{ 363 400 prognostic_sources = ./modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp\ 364 401 ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\ … … 367 404 ./solutions/prognostic_core.cpp 368 405 #}}} 369 #Thermal sources {{{ 1406 #Thermal sources {{{ 370 407 thermal_sources = ./modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp\ 371 408 ./modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp\ … … 387 424 ./solvers/solver_thermal_nonlinear.cpp 388 425 #}}} 389 #Control sources {{{ 1426 #Control sources {{{ 390 427 control_sources= ./modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp\ 391 428 ./modules/ControlInputGetGradientx/ControlInputGetGradientx.h\ … … 426 463 ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\ 427 464 ./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\ 430 467 ./shared/Numerics/BrentSearch.cpp\ 431 468 ./shared/Numerics/OptimalSearch.cpp \ … … 442 479 443 480 #}}} 444 #Hydrology sources {{{ 1481 #Hydrology sources {{{ 445 482 hydrology_sources = ./modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp\ 446 483 ./modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp\ … … 450 487 ./solutions/hydrology_core_step.cpp 451 488 #}}} 452 #Diagnostic sources {{{ 1489 #Diagnostic sources {{{ 453 490 diagnostic_sources = ./modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp\ 454 491 ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp \ … … 471 508 ./solvers/solver_stokescoupling_nonlinear.cpp 472 509 #}}} 473 #Balanced sources {{{ 1510 #Balanced sources {{{ 474 511 balanced_sources = ./modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp\ 475 512 ./modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp\ … … 478 515 ./solutions/balancethickness_core.cpp 479 516 #}}} 480 #Responses sources {{{ 1517 #Responses sources {{{ 481 518 responses_sources = ./modules/MinVelx/MinVelx.h\ 482 519 ./modules/MinVelx/MinVelx.cpp\ … … 501 538 ./modules/MinVzx/MinVzx.h\ 502 539 ./modules/MinVzx/MinVzx.cpp\ 540 ./modules/TotalSmbx/TotalSmbx.h\ 541 ./modules/TotalSmbx/TotalSmbx.cpp\ 503 542 ./modules/IceVolumex/IceVolumex.h\ 504 543 ./modules/IceVolumex/IceVolumex.cpp\ … … 508 547 ./modules/MassFluxx/MassFluxx.h 509 548 #}}} 510 #Slope sources {{{ 1549 #Slope sources {{{ 511 550 slope_sources = ./modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp\ 512 551 ./modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp \ … … 520 559 ./solutions/bedslope_core.cpp 521 560 #}}} 522 #Groundingline sources {{{ 1561 #Groundingline sources {{{ 523 562 groundingline_sources= ./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\ 524 563 ./modules/GroundinglineMigrationx/GroundinglineMigrationx.h 525 564 #}}} 526 #Rifts sources {{{ 1527 rifts_sources = ./ objects/Loads/Riftfront.cpp\528 ./ objects/Loads/Riftfront.h\565 #Rifts sources {{{ 566 rifts_sources = ./classes/objects/Loads/Riftfront.cpp\ 567 ./classes/objects/Loads/Riftfront.h\ 529 568 ./modules/ConstraintsStatex/RiftConstraintsState.cpp 530 569 #}}} 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 {{{ 571 threed_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 {{{ 585 bamg_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\ 595 635 ./shared/Bamg/Abs.h \ 596 636 ./shared/Bamg/BigPrimeNumber.h\ … … 609 649 ./modules/BamgTriangulatex/BamgTriangulatex.h 610 650 #}}} 611 #Kriging sources {{{ 1651 #Kriging sources {{{ 612 652 kriging_sources = ./Container/Observations.h\ 613 653 ./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\ 627 667 ./modules/Krigingx/Krigingx.cpp\ 628 668 ./modules/Krigingx/Krigingx.h 629 669 630 #}}} 631 #Kml sources {{{1 670 #For parallel kriging, only difference is ./modules/Krigingx/pKrigingx.cpp with no multithreading 671 pkriging_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 {{{ 632 691 kml_sources = ./modules/Exp2Kmlx/Exp2Kmlx.h\ 633 692 ./modules/Exp2Kmlx/Exp2Kmlx.cpp\ … … 642 701 ./modules/KMLOverlayx/KMLOverlayx.h\ 643 702 ./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.h698 #}}} 699 #Petsc sources {{{ 1703 ./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 {{{ 700 759 petsc_sources= ./toolkits/petsc\ 701 760 ./toolkits/petsc/patches\ … … 726 785 ./toolkits/petsc/patches/ISSMToPetscInsertMode.cpp\ 727 786 ./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\ 728 792 ./toolkits/petsc/petscincludes.h\ 729 793 ./shared/Numerics/PetscOptionsFromAnalysis.cpp\ … … 732 796 733 797 #}}} 734 #Gsl sources {{{1 735 gsl_sources= ./modules/Solverx/SolverxGsl.cpp 736 737 #}}} 738 #Mpi sources {{{1 798 #Mpi sources {{{ 739 799 mpi_sources= ./toolkits/mpi/mpiincludes.h\ 740 800 ./toolkits/mpi/patches/mpipatches.h\ … … 744 804 ./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp 745 805 #}}} 746 #Metis sources {{{ 1806 #Metis sources {{{ 747 807 metis_sources= ./toolkits/metis/patches/metispatches.h\ 748 808 ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp 749 809 #}}} 750 #Python sources {{{ 1810 #Python sources {{{ 751 811 python_sources= ./python/io/pythonio.h\ 752 812 ./python/python-binding.h\ … … 756 816 757 817 #}}} 758 #Matlab sources {{{ 1818 #Matlab sources {{{ 759 819 matlab_sources= ./toolkits/matlab/matlabincludes.h\ 760 820 ./matlab/matlab-binding.h\ … … 773 833 ./matlab/io/MatlabVectorToSeqVec.cpp 774 834 #}}} 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 {{{ 836 matlabpetsc_sources= ./matlab/io/MatlabMatrixToPetscMat.cpp\ 837 ./matlab/io/MatlabVectorToPetscVec.cpp 838 839 #}}} 840 #Modules sources{{{ 841 module_sources= ./shared/Threads/issm_threads.h\ 798 842 ./shared/Threads/LaunchThread.cpp\ 799 843 ./shared/Threads/PartitionRange.cpp\ … … 866 910 #}}} 867 911 868 #{{{ 1Conditional build-up of sources912 #{{{ Conditional build-up of sources 869 913 #ISSM sources are a combination of core sources and sources related to specific capabilities (which can 870 914 #be activated by autotools conditionals 871 872 915 873 916 #First the core … … 883 926 endif 884 927 885 if GSL886 issm_sources += $(gsl_sources)887 endif888 889 928 if TRANSIENT 890 929 issm_sources += $(transient_sources) … … 953 992 endif 954 993 955 956 #}}} 957 #Library flags and sources {{{1 994 if KRIGING 995 issm_sources += $(pkriging_sources) 996 endif 997 #}}} 998 #Library flags and sources {{{ 958 999 ALLCXXFLAGS= -fPIC -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_ $(CXXFLAGS) $(CXXOPTFLAGS) 959 1000 960 1001 libISSMCore_a_SOURCES = $(issm_sources) 961 1002 libISSMCore_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 962 1012 963 1013 if MODULES … … 967 1017 libISSMModules_a_SOURCES += $(kml_sources) 968 1018 libISSMModules_a_CXXFLAGS = $(ALLCXXFLAGS) 1019 endif 969 1020 970 1021 if PYTHON … … 977 1028 libISSMMatlab_a_CXXFLAGS= $(ALLCXXFLAGS) 978 1029 endif 979 endif 980 #}}} 981 #Overload library, to overload any non-standard symbols. {{{ 11030 1031 #}}} 1032 #Overload library, to overload any non-standard symbols. {{{ 982 1033 libISSMOverload_a_SOURCES = ./shared/String/stricmp.c 983 1034 libISSMOverload_a_CFLAGS = -fPIC -D_C_ $(COPTFLAGS) $(CFLAGS) 984 1035 #}}} 985 1036 986 #Executable {{{ 11037 #Executable {{{ 987 1038 bin_PROGRAMS = issm 988 1039 … … 991 1042 992 1043 #External packages 993 LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(S CALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)1044 LDADD += $(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) 994 1045 995 1046 if FORTRAN … … 999 1050 issm_SOURCES = solutions/issm.cpp 1000 1051 issm_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 1052 1053 if KRIGING 1054 bin_PROGRAMS += kriging 1055 kriging_SOURCES = solutions/kriging.cpp 1056 kriging_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 1057 endif 1001 1058 #}}} 1002 1059 #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 10 10 #include "./types.h" 11 11 12 13 12 #endif //ifndef _INCLUDE_H_ 14 -
issm/branches/trunk-jpl-damage/src/c/include/macros.h
r12168 r12878 3 3 */ 4 4 5 /*Header {{{ 1*/5 /*Header {{{*/ 6 6 #ifndef _MACROS_H_ 7 7 #define _MACROS_H_ 8 8 9 #include <iostream> 10 #include <sstream> 11 #include <iomanip> 9 12 #include "./typedefs.h" 10 13 … … 16 19 /*}}}*/ 17 20 18 /* _printf_ {{{ 1*/21 /* _printf_ {{{*/ 19 22 /*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) 21 24 /*}}}*/ 22 /* _error_ {{{ 1*/25 /* _error_ {{{*/ 23 26 /*Error exception macro*/ 24 27 #ifdef _INTEL_WIN_ … … 30 33 #endif 31 34 /*}}}*/ 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_ {{{*/ 33 74 /*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/ 34 75 #ifdef _ISSM_DEBUG_ … … 40 81 #endif 41 82 /*}}}*/ 42 /* ISSMBOOT/ISSMEND {{{ 1*/83 /* ISSMBOOT/ISSMEND {{{*/ 43 84 44 85 /*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 16 16 #define NDOF3 3 17 17 #define NDOF4 4 18 19 18 20 19 #define DIM2 2 … … 40 39 #endif 41 40 42 43 44 45 41 #endif //ifndef _ISSMTYPEDEFS_H_ -
issm/branches/trunk-jpl-damage/src/c/include/types.h
r12168 r12878 27 27 #endif 28 28 29 typedef double IssmDouble; 29 #ifdef _HAVE_ADOLC_ 30 #include "adolc/adolc.h" 31 // for active variables 32 typedef adouble IssmDouble; 33 // for passive variables 34 typedef double IssmPDouble; 35 #else 36 // see above 37 typedef double IssmDouble; 38 // see above 39 typedef IssmDouble IssmPDouble; 40 #endif 41 30 42 typedef bool IssmBool; 31 43 32 33 44 #endif //ifndef _TYPES_H_ -
issm/branches/trunk-jpl-damage/src/c/io/Disk/diskio.h
r11202 r12878 6 6 #define _DISK_IO_H_ 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 #include "../../include/include.h" 11 12 class DataSet;13 class Parameters;14 11 15 12 FILE* pfopen(char* filename,const char* format); -
issm/branches/trunk-jpl-damage/src/c/io/Disk/pfclose.cpp
r9320 r12878 18 18 extern int my_rank; 19 19 _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); 21 21 } -
issm/branches/trunk-jpl-damage/src/c/io/Disk/pfopen.cpp
r11202 r12878 20 20 /*Open handle to data on disk: */ 21 21 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"); 23 23 24 24 return fid; -
issm/branches/trunk-jpl-damage/src/c/io/PrintfFunction.cpp
r12168 r12878 25 25 26 26 /*allocate buffer for given string size*/ 27 buffer= (char*)xmalloc(size*sizeof(char));27 buffer=xNew<char>(size); 28 28 29 29 /* Try to print in the allocated space. */ 30 30 va_start(args, format); 31 #ifndef WIN3232 31 n=vsnprintf(buffer,size,format,args); 33 #else34 n=vsnprintf(buffer,size,format,args);35 #endif36 32 va_end(args); 37 33 … … 45 41 size*=2; /* twice the old size */ 46 42 47 x free((void**)&buffer);43 xDelete<char>(buffer); 48 44 } 49 45 50 46 /*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); 52 48 53 49 /*Clean up and return*/ 54 x free((void**)&buffer);50 xDelete<char>(buffer); 55 51 return 1; 56 52 } 53 int 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 } 60 int 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 6 6 #define _ISSM_IO_H_ 7 7 8 #ifdef HAVE_CONFIG_H //config.h {{{18 #ifdef HAVE_CONFIG_H 9 9 #include <config.h> 10 10 #else 11 11 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 12 12 #endif 13 //}}}14 15 13 #include "./Disk/diskio.h" 16 14 17 15 /*printf: */ 18 16 int PrintfFunction(const char* format,...); 17 int PrintfFunction(const string & message); 18 int PrintfFunction2(const string & message); 19 19 20 20 #endif /* _IO_H_ */ -
issm/branches/trunk-jpl-damage/src/c/issm.h
r9761 r12878 4 4 5 5 #ifndef _ISSM_H_ 6 #define 6 #define _ISSM_H_ 7 7 8 8 #ifdef HAVE_CONFIG_H … … 14 14 #include "./include/include.h" 15 15 #include "./shared/shared.h" 16 #include "./ objects/objects.h"16 #include "./classes/classes.h" 17 17 #include "./Container/Container.h" 18 18 #include "./EnumDefinitions/EnumDefinitions.h" … … 22 22 #include "./modules/modules.h" 23 23 24 25 24 #endif //ifndef _ISSM_H_ -
issm/branches/trunk-jpl-damage/src/c/matlab/include/matlab_macros.h
r12078 r12878 3 3 */ 4 4 5 /*Header {{{ 1*/5 /*Header {{{*/ 6 6 #ifndef _MATLAB_MACROS_H_ 7 7 #define _MATLAB_MACROS_H_ … … 15 15 16 16 #ifdef _HAVE_MATLAB_ 17 /* MODULEBOOT/MODULEEND {{{ 1*/17 /* MODULEBOOT/MODULEEND {{{*/ 18 18 19 19 /*The following macros hide the error exception handling in a matlab module. Just put … … 36 36 } 37 37 //}}} 38 /* WRAPPER {{{ 1*/38 /* WRAPPER {{{*/ 39 39 #define WRAPPER(modulename,...) void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) 40 40 41 41 /*}}}*/ 42 /* CHECKARGUMENTS {{{ 1*/42 /* CHECKARGUMENTS {{{*/ 43 43 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,functionpointer) 44 44 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/matlab/io/CheckNumMatlabArguments.cpp
r12013 r12878 22 22 /* special case: */ 23 23 function(); 24 _error _("usage: see above");24 _error2_("usage: see above"); 25 25 } 26 26 else if (nlhs!=NLHS || nrhs!=NRHS ) { 27 27 function(); 28 _error _("usage error.");28 _error2_("usage error."); 29 29 } 30 30 return 1; -
issm/branches/trunk-jpl-damage/src/c/matlab/io/FetchMatlabData.cpp
r12258 r12878 15 15 16 16 /*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){{{*/ 18 18 void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){ 19 19 … … 27 27 outmatrix=NULL; 28 28 } 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")){ 30 34 /*Check dataref is not pointing to NaN: */ 31 35 if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetM(dataref)==1) && (mxGetN(dataref)==1) ){ … … 35 39 } 36 40 else{ 41 if(!mxIsClass(dataref,"double") && !mxIsClass(dataref,"single")){ 42 _printLine_("Warning: converting matlab data from '" << mxGetClassName(dataref) << "' to 'double'"); 43 } 37 44 /*Convert matlab matrix to double* matrix: */ 38 45 MatlabMatrixToDoubleMatrix(&outmatrix,&outmatrix_rows,&outmatrix_cols,dataref); … … 41 48 else{ 42 49 /*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"); 44 51 } 45 52 … … 51 58 } 52 59 /*}}}*/ 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){{{*/ 54 61 void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){ 55 62 … … 82 89 else{ 83 90 /*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"); 85 92 } 86 93 … … 90 97 if (pndims)*pndims=outmatrix_ndims; 91 98 if (psize )*psize =outmatrix_size; 92 else x free((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){{{*/ 97 104 void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){ 98 105 … … 121 128 122 129 /*Convert double matrix into integer matrix: */ 123 outmatrix= (int*)xmalloc(outmatrix_rows*outmatrix_cols*sizeof(int));130 outmatrix=xNew<int>(outmatrix_rows*outmatrix_cols); 124 131 for(i=0;i<outmatrix_rows*outmatrix_cols;i++)outmatrix[i]=(int)doublematrix[i]; 125 132 } … … 127 134 else{ 128 135 /*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"); 130 137 } 131 138 … … 136 143 } 137 144 /*}}}*/ 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){{{*/ 139 146 void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){ 140 147 … … 163 170 164 171 /*Convert double matrix into integer matrix: */ 165 outmatrix= (bool*)xmalloc(outmatrix_rows*outmatrix_cols*sizeof(bool));172 outmatrix=xNew<bool>(outmatrix_rows*outmatrix_cols); 166 173 for(i=0;i<outmatrix_rows;i++)outmatrix[i]=(bool)doublematrix[i]; 167 174 } … … 169 176 else{ 170 177 /*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"); 172 179 } 173 180 … … 178 185 } 179 186 /*}}}*/ 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){{{*/ 181 188 void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){ 182 189 … … 224 231 225 232 /*Convert double matrix into bool matrix: */ 226 outmatrix= (bool*)xmalloc(outmatrix_numel*sizeof(bool));233 outmatrix=xNew<bool>(outmatrix_numel); 227 234 for(i=0;i<outmatrix_numel;i++)outmatrix[i]=(bool)doublematrix[i]; 228 x free((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"); 234 241 } 235 242 … … 239 246 if (pndims)*pndims=outmatrix_ndims; 240 247 if (psize )*psize =outmatrix_size; 241 else x free((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){{{*/ 246 253 void FetchData(double** pvector,int* pM,const mxArray* dataref){ 247 254 … … 262 269 else{ 263 270 /*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"); 265 272 } 266 273 … … 270 277 } 271 278 /*}}}*/ 272 /*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{ 1*/279 /*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{*/ 273 280 void FetchData(int** pvector,int* pM,const mxArray* dataref){ 274 281 … … 289 296 290 297 /*Convert double vector into integer vector: */ 291 outvector= (int*)xmalloc(outvector_rows*sizeof(int));298 outvector=xNew<int>(outvector_rows); 292 299 for(i=0;i<outvector_rows;i++)outvector[i]=(int)doublevector[i]; 293 300 } 294 301 else{ 295 302 /*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"); 297 304 } 298 305 … … 302 309 } 303 310 /*}}}*/ 304 /*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{ 1*/311 /*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{*/ 305 312 void FetchData(bool** pvector,int* pM,const mxArray* dataref){ 306 313 … … 321 328 322 329 /*Convert double vector into integer vector: */ 323 outvector= (bool*)xmalloc(outvector_rows*sizeof(bool));330 outvector=xNew<bool>(outvector_rows); 324 331 for(i=0;i<outvector_rows;i++)outvector[i]=(bool)doublevector[i]; 325 332 } 326 333 else{ 327 334 /*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"); 329 336 } 330 337 … … 334 341 } 335 342 /*}}}*/ 336 /*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{ 1*/343 /*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{*/ 337 344 void FetchData(float** pvector,int* pM,const mxArray* dataref){ 338 345 … … 353 360 354 361 /*Convert double vector into float vector: */ 355 outvector= (float*)xmalloc(outvector_rows*sizeof(float));362 outvector=xNew<float>(outvector_rows); 356 363 for(i=0;i<outvector_rows;i++)outvector[i]=(float)doublevector[i]; 357 364 } 358 365 else{ 359 366 /*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"); 361 368 } 362 369 … … 366 373 } 367 374 /*}}}*/ 368 /*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{ 1*/375 /*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{*/ 369 376 void FetchData(char** pstring,const mxArray* dataref){ 370 377 … … 374 381 /*Ok, the string should be coming directly from the matlab workspace: */ 375 382 if (!mxIsClass(dataref,"char")){ 376 _error _("input data_type is not a string!");383 _error2_("input data_type is not a string!"); 377 384 } 378 385 else{ … … 381 388 382 389 stringlen = mxGetM(dataref)*mxGetN(dataref)+1; 383 outstring = (char*)xmalloc(sizeof(mxChar)*stringlen);390 outstring =xNew<char>(stringlen); 384 391 mxGetString(dataref,outstring,stringlen); 385 392 } … … 387 394 /*Assign output pointers:*/ 388 395 *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){{{*/ 391 398 void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){ 392 399 … … 409 416 else{ 410 417 /*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"); 412 419 } 413 420 … … 417 424 if (pndims)*pndims=outmatrix_ndims; 418 425 if (psize )*psize =outmatrix_size; 419 else x free((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){{{*/ 424 431 void FetchData(double* pscalar,const mxArray* dataref){ 425 432 … … 427 434 428 435 if (!mxIsClass(dataref,"double")){ 429 _error _("input data_type is not a double!");436 _error2_("input data_type is not a double!"); 430 437 } 431 438 else{ … … 438 445 } 439 446 /*}}}*/ 440 /*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{ 1*/447 /*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{*/ 441 448 void FetchData(int* pinteger,const mxArray* dataref){ 442 449 … … 444 451 445 452 if (!mxIsClass(dataref,"double")){ 446 _error _("input data_type is not a scalar!");453 _error2_("input data_type is not a scalar!"); 447 454 } 448 455 else{ … … 455 462 } 456 463 /*}}}*/ 457 /*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{ 1*/464 /*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{*/ 458 465 void FetchData(bool* pboolean,const mxArray* dataref){ 459 466 … … 461 468 462 469 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"); 465 472 mxbool_ptr=mxGetLogicals(dataref); 466 473 } 467 474 else{ 468 _error _("input data_type is not a bool!");475 _error2_("input data_type is not a bool!"); 469 476 } 470 477 … … 474 481 475 482 /*ISSM objects*/ 476 /*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{ 1*/483 /*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{*/ 477 484 void FetchData(Matrix** pmatrix,const mxArray* dataref){ 478 485 … … 488 495 else{ 489 496 /*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"); 491 498 } 492 499 … … 495 502 } 496 503 /*}}}*/ 497 /*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{ 1*/504 /*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{*/ 498 505 void FetchData(Vector** pvector,const mxArray* dataref){ 499 506 … … 512 519 else{ 513 520 /*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"); 515 522 } 516 523 … … 519 526 } 520 527 /*}}}*/ 521 /*FUNCTION FetchData(BamgGeom** pbamggeom,const mxArray* dataref){{{ 1*/528 /*FUNCTION FetchData(BamgGeom** pbamggeom,const mxArray* dataref){{{*/ 522 529 void FetchData(BamgGeom** pbamggeom,const mxArray* dataref){ 523 530 … … 538 545 } 539 546 /*}}}*/ 540 /*FUNCTION FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){{{ 1*/547 /*FUNCTION FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){{{*/ 541 548 void FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){ 542 549 … … 558 565 } 559 566 /*}}}*/ 560 /*FUNCTION FetchData(BamgOpts** pbamgopts,const mxArray* dataref){{{ 1*/567 /*FUNCTION FetchData(BamgOpts** pbamgopts,const mxArray* dataref){{{*/ 561 568 void FetchData(BamgOpts** pbamgopts,const mxArray* dataref){ 562 569 … … 602 609 } 603 610 /*}}}*/ 604 /*FUNCTION FetchData(Options** poptions,const mxArray* dataref){{{ 1*/611 /*FUNCTION FetchData(Options** poptions,const mxArray* dataref){{{*/ 605 612 void FetchData(Options** poptions,int istart, int nrhs,const mxArray** pdataref){ 606 613 … … 613 620 /*Fetch all options*/ 614 621 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"); 616 623 617 624 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 << "\"."); 619 626 620 627 option=(Option*)OptionParse(name,&pdataref[i+1]); -
issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabMatrixToDoubleMatrix.cpp
r12011 r12878 2 2 * \brief: convert a sparse or dense matlab matrix to a double* pointer 3 3 */ 4 5 4 6 5 #ifdef HAVE_CONFIG_H … … 10 9 #endif 11 10 12 13 11 /*Matlab includes: */ 14 12 #include "mex.h" 15 16 13 #include "../../shared/shared.h" 17 14 18 15 int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix){ 19 16 20 int i,j,count,rows,cols; 21 double *pmxdoublematrix = NULL; 22 float *pmxsinglematrix = NULL; 17 int i,j,count,rows,cols; 23 18 24 19 /*output: */ … … 33 28 34 29 /*Dealing with sparse matrix: recover size first: */ 35 pmxdoublematrix=(double*)mxGetPr(mxmatrix);30 double* pmxmatrix=(double*)mxGetPr(mxmatrix); 36 31 rows=mxGetM(mxmatrix); 37 32 cols=mxGetN(mxmatrix); 38 33 39 34 if(rows*cols){ 40 matrix= (double*)xcalloc(rows*cols,sizeof(double));35 matrix=xNewZeroInit<double>(rows*cols); 41 36 42 37 /*Now, get ir,jc and pr: */ … … 48 43 for(i=0;i<cols;i++){ 49 44 for(j=0;j<(jc[i+1]-jc[i]);j++){ 50 matrix[rows*ir[count]+i]=pmx doublematrix[count];45 matrix[rows*ir[count]+i]=pmxmatrix[count]; 51 46 count++; 52 47 } … … 57 52 else if(mxIsClass(mxmatrix,"double")){ 58 53 /*Dealing with dense matrix: recover pointer and size: */ 59 pmxdoublematrix=(double*)mxGetPr(mxmatrix);54 double* pmxmatrix=(double*)mxGetPr(mxmatrix); 60 55 rows=mxGetM(mxmatrix); 61 56 cols=mxGetN(mxmatrix); … … 63 58 /*Create serial matrix: */ 64 59 if(rows*cols){ 65 matrix= (double*)xcalloc(rows*cols,sizeof(double));60 matrix=xNewZeroInit<double>(rows*cols); 66 61 67 62 for(i=0;i<rows;i++){ 68 63 for(j=0;j<cols;j++){ 69 matrix[cols*i+j]=(double)pmx doublematrix[rows*j+i];64 matrix[cols*i+j]=(double)pmxmatrix[rows*j+i]; 70 65 } 71 66 } … … 74 69 else if(mxIsClass(mxmatrix,"single")){ 75 70 /*Dealing with dense matrix: recover pointer and size: */ 76 pmxsinglematrix=(float*)mxGetPr(mxmatrix);71 float *pmxmatrix=(float*)mxGetPr(mxmatrix); 77 72 rows=mxGetM(mxmatrix); 78 73 cols=mxGetN(mxmatrix); … … 80 75 /*Create serial matrix: */ 81 76 if(rows*cols){ 82 matrix= (double*)xcalloc(rows*cols,sizeof(double));77 matrix=xNewZeroInit<double>(rows*cols); 83 78 84 79 for(i=0;i<rows;i++){ 85 80 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]; 87 116 } 88 117 } … … 90 119 } 91 120 else{ 92 _error _("Matlab matrix type Not implemented yet");121 _error2_("Matlab matrix type Not implemented yet"); 93 122 } 94 123 -
issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabMatrixToMatrix.cpp
r12013 r12878 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 14 14 #include <string.h> 15 15 #include "./matlabio.h" 16 #include "../../ objects/objects.h"16 #include "../../classes/classes.h" 17 17 #include "../../shared/shared.h" 18 18 #include "../../Container/Container.h" … … 31 31 32 32 #ifdef _HAVE_PETSC_ 33 MatlabMatrixToPetscMatrix(&matrix->matrix,NULL,NULL,mxmatrix);33 matrix->pmatrix=MatlabMatrixToPetscMat(mxmatrix); 34 34 #else 35 matrix-> matrix=MatlabMatrixToSeqMat(mxmatrix);35 matrix->smatrix=MatlabMatrixToSeqMat(mxmatrix); 36 36 #endif 37 37 -
issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabMatrixToSeqMat.cpp
r12013 r12878 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> -
issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabNArrayToNArray.cpp
r12013 r12878 15 15 #include <mex.h> 16 16 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){{{*/ 18 18 int MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){ 19 19 … … 39 39 ndims=mxGetNumberOfDimensions(mxmatrix); 40 40 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]; 43 43 44 44 /*Ok, first check if we are dealing with a sparse or full matrix: */ … … 51 51 nz=(int)((double)nnz/(double)rows); 52 52 53 matrix= (double*)xcalloc(rows*cols,sizeof(double));53 matrix=xNewZeroInit<double>(rows*cols); 54 54 55 55 /*Now, get ir,jc and pr: */ … … 74 74 75 75 /*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); 79 79 for(i=0;i<numel;i++){ 80 80 ColumnWiseDimsFromIndex(dims,i,size,ndims); … … 82 82 *(matrix+j)=*(mxmatrix_ptr+i); 83 83 } 84 x free((void**)&dims);84 xDelete<int>(dims); 85 85 86 86 } … … 95 95 } 96 96 /*}}}*/ 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){{{*/ 98 98 int MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){ 99 99 … … 119 119 ndims=mxGetNumberOfDimensions(mxmatrix); 120 120 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]; 123 123 124 124 /*Ok, first check if we are dealing with a sparse or full matrix: */ … … 131 131 nz=(int)((double)nnz/(double)rows); 132 132 133 matrix= (bool*)xcalloc(rows*cols,sizeof(bool));133 matrix=xNewZeroInit<bool>(rows*cols); 134 134 135 135 /*Now, get ir,jc and pm: */ … … 154 154 155 155 /*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); 159 158 for(i=0;i<numel;i++){ 160 159 ColumnWiseDimsFromIndex(dims,i,size,ndims); … … 162 161 *(matrix+j)=(bool)*(mxmatrix_ptr+i); 163 162 } 164 xfree((void**)&dims); 165 163 xDelete<int>(dims); 166 164 } 167 165 … … 175 173 } 176 174 /*}}}*/ 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){{{*/ 178 176 int MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){ 179 177 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; 185 183 186 184 /*output: */ … … 188 186 189 187 /*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; 196 194 197 195 /*get Matlab matrix information: */ … … 199 197 ndims=mxGetNumberOfDimensions(mxmatrix); 200 198 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]; 203 201 204 202 /*Ok, first check if we are dealing with a sparse or full matrix: */ … … 211 209 nz=(int)((double)nnz/(double)rows); 212 210 213 matrix= (char*)xcalloc(rows*cols,sizeof(double));211 matrix=xNew<char>(rows*cols); 214 212 215 213 /*Now, get ir,jc and pm: */ … … 234 232 235 233 /*Create serial matrix: */ 236 matrix=(char*)xcalloc(numel+1,sizeof(mxChar)); 234 matrix=xNew<char>(numel+1); 235 matrix[numel]='\0'; 237 236 238 237 /*looping code adapted from Matlab example explore.c: */ … … 259 258 } 260 259 } 261 262 260 } 263 261 -
issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabVectorToDoubleVector.cpp
r12011 r12878 46 46 47 47 /*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"); 49 49 50 50 nz=(int)((double)nnz/(double)rows); 51 51 52 52 if(rows){ 53 vector= (double*)xcalloc(rows,sizeof(double));53 vector=xNewZeroInit<double>(rows); 54 54 55 55 /*Now, get ir,jc and pr: */ … … 77 77 78 78 /*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"); 80 80 81 81 /*allocate and memcpy*/ 82 82 if(rows){ 83 vector= (double*)xmalloc(rows*sizeof(double));83 vector=xNew<double>(rows); 84 84 memcpy(vector,mxvector_ptr,rows*sizeof(double)); 85 85 } -
issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabVectorToSeqVec.cpp
r12013 r12878 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> -
issm/branches/trunk-jpl-damage/src/c/matlab/io/MatlabVectorToVector.cpp
r12013 r12878 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 14 14 #include <string.h> 15 15 #include "./matlabio.h" 16 #include "../../ objects/objects.h"16 #include "../../classes/classes.h" 17 17 #include "../../shared/shared.h" 18 18 #include "../../Container/Container.h" … … 31 31 32 32 #ifdef _HAVE_PETSC_ 33 MatlabVectorToPetscVector(&vector->vector,&dummy,mxvector);33 vector->pvector=MatlabVectorToPetscVec(mxvector); 34 34 #else 35 vector-> vector=MatlabVectorToSeqVec(mxvector);35 vector->svector=MatlabVectorToSeqVec(mxvector); 36 36 #endif 37 37 -
issm/branches/trunk-jpl-damage/src/c/matlab/io/OptionParse.cpp
r12258 r12878 8 8 #endif 9 9 10 #include <cstring> 11 #include <mex.h> 10 12 #include "../../shared/shared.h" 11 13 #include "../../io/io.h" … … 13 15 #include "./matlabio.h" 14 16 15 #include <mex.h> 16 17 /*FUNCTION OptionDoubleParse {{{1*/ 17 /*FUNCTION OptionDoubleParse {{{*/ 18 18 OptionDouble* OptionDoubleParse( char* name, const mxArray* prhs[]){ 19 19 … … 22 22 /*check and parse the name */ 23 23 odouble=new OptionDouble; 24 odouble->name = (char *) xmalloc((strlen(name)+1)*sizeof(char));24 odouble->name =xNew<char>(strlen(name)+1); 25 25 memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char)); 26 26 27 27 /*check and parse the value */ 28 28 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]) <<"\"."); 30 30 } 31 32 31 FetchData(&odouble->values,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]); 33 32 34 33 return(odouble); 35 34 }/*}}}*/ 36 /*FUNCTION OptionLogicalParse {{{ 1*/35 /*FUNCTION OptionLogicalParse {{{*/ 37 36 OptionLogical* OptionLogicalParse( char* name, const mxArray* prhs[]){ 38 37 … … 41 40 /*check and parse the name */ 42 41 ological=new OptionLogical; 43 ological->name = (char*)xmalloc((strlen(name)+1)*sizeof(char));42 ological->name =xNew<char>(strlen(name)+1); 44 43 memcpy(ological->name,name,(strlen(name)+1)*sizeof(char)); 45 44 46 45 /*check and parse the value */ 47 46 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]) <<"\"."); 49 48 } 50 51 49 FetchData(&ological->values,&ological->numel,&ological->ndims,&ological->size,prhs[0]); 52 50 53 51 return(ological); 54 52 }/*}}}*/ 55 /*FUNCTION OptionCharParse {{{ 1*/53 /*FUNCTION OptionCharParse {{{*/ 56 54 OptionChar* OptionCharParse( char* name, const mxArray* prhs[]){ 57 55 … … 60 58 /*check and parse the name */ 61 59 ochar=new OptionChar(); 62 ochar->name = (char*)xmalloc((strlen(name)+1)*sizeof(char));60 ochar->name =xNew<char>(strlen(name)+1); 63 61 memcpy(ochar->name,name,(strlen(name)+1)*sizeof(char)); 64 62 65 63 /*check and parse the value */ 66 64 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]) <<"\"."); 68 66 } 69 70 67 FetchData(&ochar->values,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]); 71 68 72 69 return(ochar); 73 70 }/*}}}*/ 74 /*FUNCTION OptionStructParse {{{ 1*/71 /*FUNCTION OptionStructParse {{{*/ 75 72 OptionStruct* OptionStructParse( char* name, const mxArray* prhs[]){ 76 73 … … 85 82 /*check and parse the name */ 86 83 ostruct=new OptionStruct; 87 ostruct->name = (char*)xmalloc((strlen(name)+1)*sizeof(char));84 ostruct->name =xNew<char>(strlen(name)+1); 88 85 memcpy(ostruct->name,name,(strlen(name)+1)*sizeof(char)); 89 86 90 87 /*check and parse the value */ 91 88 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]) <<"\"."); 93 90 } 94 95 91 ostruct->numel=mxGetNumberOfElements(prhs[0]); 96 92 ostruct->ndims=mxGetNumberOfDimensions(prhs[0]); 97 93 ipt =mxGetDimensions(prhs[0]); 98 ostruct->size = (int *) xmalloc(ostruct->ndims*sizeof(int));94 ostruct->size =xNew<int>(ostruct->ndims); 99 95 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); 101 97 102 98 /*loop through and process each element of the struct array */ … … 117 113 return(ostruct); 118 114 }/*}}}*/ 119 /*FUNCTION OptionCellParse {{{ 1*/115 /*FUNCTION OptionCellParse {{{*/ 120 116 OptionCell* OptionCellParse( char* name, const mxArray* prhs[]){ 121 117 … … 132 128 /*check and parse the name */ 133 129 ocell=new OptionCell; 134 ocell->name = (char *) xmalloc((strlen(name)+1)*sizeof(char));130 ocell->name =xNew<char>(strlen(name)+1); 135 131 memcpy(ocell->name,name,(strlen(name)+1)*sizeof(char)); 136 132 137 133 /*check and parse the value */ 138 134 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]) <<"\"."); 140 136 } 141 137 … … 143 139 ocell->ndims=mxGetNumberOfDimensions(prhs[0]); 144 140 ipt =mxGetDimensions(prhs[0]); 145 ocell->size = (int *) xmalloc(ocell->ndims*sizeof(int));141 ocell->size =xNew<int>(ocell->ndims); 146 142 for (i=0; i<ocell->ndims; i++) ocell->size[i]=(int)ipt[i]; 147 143 ocell->values=new Options; 148 144 149 145 /*loop through and process each element of the cell array */ 150 dims= (int *) xmalloc(ocell->ndims*sizeof(int));146 dims=xNew<int>(ocell->ndims); 151 147 for (cindex=0; cindex<ocell->numel; cindex++) { 152 148 ColumnWiseDimsFromIndex(dims,(int)cindex,ocell->size,ocell->ndims); … … 163 159 option=NULL; 164 160 } 165 x free((void**)&dims);161 xDelete<int>(dims); 166 162 167 163 return(ocell); 168 164 }/*}}}*/ 169 /*FUNCTION OptionParse{{{ 1*/165 /*FUNCTION OptionParse{{{*/ 170 166 Option* OptionParse(char* name, const mxArray* prhs[]){ 171 167 … … 180 176 else if(mxIsClass(prhs[0],"cell")) option=(Option*)OptionCellParse(name,prhs); 181 177 else { 182 _p rintf_(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" << "\"."); 183 179 if (!mexCallMATLAB(1,lhs,1,(mxArray**)prhs,"struct")) { 184 180 option=(Option*)OptionStructParse(name,(const mxArray**)lhs); 185 181 mxDestroyArray(lhs[0]); 186 182 } 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]) <<"\"."); 188 184 } 189 185 -
issm/branches/trunk-jpl-damage/src/c/matlab/io/PrintfFunction.cpp
r12016 r12878 27 27 28 28 /*allocate buffer for given string size*/ 29 buffer= (char*)xmalloc(size*sizeof(char));29 buffer=xNew<char>(size); 30 30 31 31 /* Try to print in the allocated space. */ … … 47 47 size*=2; /* twice the old size */ 48 48 49 x free((void**)&buffer);49 xDelete<char>(buffer); 50 50 } 51 51 52 52 /*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); 54 54 55 55 /*Clean up and return*/ 56 x free((void**)&buffer);56 xDelete<char>(buffer); 57 57 return 1; 58 58 } -
issm/branches/trunk-jpl-damage/src/c/matlab/io/WriteMatlabData.cpp
r12102 r12878 17 17 18 18 /*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){{{*/ 20 20 void WriteData(mxArray** pdataref,double* matrix, int M,int N){ 21 21 … … 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION WriteData(mxArray** pdataref,int* matrix, int M,int N){{{ 1*/44 /*FUNCTION WriteData(mxArray** pdataref,int* matrix, int M,int N){{{*/ 45 45 void WriteData(mxArray** pdataref,int* matrix, int M,int N){ 46 46 … … 67 67 } 68 68 /*}}}*/ 69 /*FUNCTION WriteData(mxArray** pdataref,double* vector, int M){{{ 1*/69 /*FUNCTION WriteData(mxArray** pdataref,double* vector, int M){{{*/ 70 70 void WriteData(mxArray** pdataref,double* vector, int M){ 71 71 … … 90 90 } 91 91 /*}}}*/ 92 /*FUNCTION WriteData(mxArray** pdataref,double scalar){{{ 1*/92 /*FUNCTION WriteData(mxArray** pdataref,double scalar){{{*/ 93 93 void WriteData(mxArray** pdataref,double scalar){ 94 94 … … 96 96 } 97 97 /*}}}*/ 98 /*FUNCTION WriteData(mxArray** pdataref,int integer){{{ 1*/98 /*FUNCTION WriteData(mxArray** pdataref,int integer){{{*/ 99 99 void WriteData(mxArray** pdataref,int integer){ 100 100 … … 103 103 } 104 104 /*}}}*/ 105 /*FUNCTION WriteData(mxArray** pdataref,int boolean){{{ 1*/105 /*FUNCTION WriteData(mxArray** pdataref,int boolean){{{*/ 106 106 void WriteData(mxArray** pdataref,bool boolean){ 107 107 … … 110 110 } 111 111 /*}}}*/ 112 /*FUNCTION WriteData(mxArray** pdataref,char* string){{{ 1*/112 /*FUNCTION WriteData(mxArray** pdataref,char* string){{{*/ 113 113 void WriteData(mxArray** pdataref,char* string){ 114 114 … … 118 118 119 119 /*ISSM objects*/ 120 /*FUNCTION WriteData(mxArray** pdataref,BamgGeom* bamggeom){{{ 1*/120 /*FUNCTION WriteData(mxArray** pdataref,BamgGeom* bamggeom){{{*/ 121 121 void WriteData(mxArray** pdataref,BamgGeom* bamggeom){ 122 122 … … 158 158 } 159 159 /*}}}*/ 160 /*FUNCTION WriteData(mxArray** pdataref,BamgMesh* bamgmesh){{{ 1*/160 /*FUNCTION WriteData(mxArray** pdataref,BamgMesh* bamgmesh){{{*/ 161 161 void WriteData(mxArray** pdataref,BamgMesh* bamgmesh){ 162 162 … … 216 216 } 217 217 /*}}}*/ 218 /*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{ 1*/218 /*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{*/ 219 219 void WriteData(mxArray** pdataref,Matrix* matrix){ 220 220 … … 227 227 if(matrix){ 228 228 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); 235 231 236 232 /*Now transpose the matrix and allocate with Matlab's memory manager: */ … … 249 245 250 246 /*Free ressources:*/ 251 x free((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){{{*/ 262 258 void WriteData(mxArray** pdataref,Vector* vector){ 263 259 … … 269 265 if(vector){ 270 266 /*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); 277 269 278 270 /*now create the matlab vector with Matlab's memory manager */ … … 290 282 291 283 /*Clean-up and return*/ 292 x free((void**)&vector_ptr);284 xDelete<double>(vector_ptr); 293 285 *pdataref=dataref; 294 286 } … … 296 288 297 289 /*Toolkit*/ 298 /*FUNCTION SetStructureField{{{ 1*/290 /*FUNCTION SetStructureField{{{*/ 299 291 void SetStructureField(mxArray* dataref,const char* fieldname,int M,int N,double* fieldpointer){ 300 292 -
issm/branches/trunk-jpl-damage/src/c/matlab/io/matlabio.h
r12102 r12878 12 12 #endif 13 13 14 #include "../../ objects/objects.h"14 #include "../../classes/classes.h" 15 15 #include "../../Container/Container.h" 16 16 #include "../../include/include.h" … … 79 79 /*Matlab to Petsc routines: */ 80 80 #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); 81 int MatlabMatrixToPetscMat(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix); 82 PetscMat* MatlabMatrixToPetscMat(const mxArray* mxmatrix); 83 int MatlabVectorToPetscVec(Vec* pvector,int* pvector_rows,const mxArray* mxvector); 84 PetscVec* MatlabVectorToPetscVec(const mxArray* mxvector); 83 85 #endif 84 86 -
issm/branches/trunk-jpl-damage/src/c/modules/AddExternalResultx/AddExternalResultx.cpp
r4554 r12878 7 7 #include "../../Container/Container.h" 8 8 #include "../../io/io.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 void AddExternalResultx( DataSet* results, int enumtype, double value){ -
issm/branches/trunk-jpl-damage/src/c/modules/AverageFilterx/AverageFilterx.cpp
r3913 r12878 18 18 19 19 /*output: */ 20 double* 20 double* imageout=NULL; 21 21 22 imageout= (double*)xmalloc(samps*lines*sizeof(double));22 imageout=xNew<double>(samps*lines); 23 23 24 24 for ( i = 0; i < lines; i++ ){ -
issm/branches/trunk-jpl-damage/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp
r11708 r12878 65 65 66 66 /*Free ressources:*/ 67 x free((void**)&qmu_part);67 xDelete<double>(qmu_part); 68 68 xdelete(&partition_contributions); 69 69 xdelete(&partition_areas); -
issm/branches/trunk-jpl-damage/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.h
r6231 r12878 6 6 #define _AVERAGEONTOPARTITIONXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp
r5208 r12878 7 7 #include "../../include/include.h" 8 8 #include "../../toolkits/toolkits.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/bamg/bamgobjects.h" 10 10 11 11 using namespace bamg; 12 12 using namespace std; 13 13 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; 14 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,int* index,double* x,double* y,int nods,int nels){ 20 15 21 16 /*Options*/ 22 BamgOpts* bamgopts=NULL; 23 bamgopts=new BamgOpts(); 17 BamgOpts* bamgopts=new BamgOpts(); 24 18 25 // read mesh 26 if(verbose) printf("Reading mesh\n"); 19 /*read mesh*/ 27 20 Mesh Th(index,x,y,nods,nels); 28 21 29 //write mesh and geometry 30 if (verbose) printf("Write Geometry\n"); 22 /*write mesh and geometry*/ 31 23 Th.Gh.WriteGeometry(bamggeom,bamgopts); 32 if (verbose) printf("Write Mesh\n");33 24 Th.WriteMesh(bamgmesh,bamgopts); 34 25 35 / /clean up26 /*clean up and return*/ 36 27 delete bamgopts; 37 38 /*No error return*/ 39 return noerr; 28 return 1; 40 29 41 30 } -
issm/branches/trunk-jpl-damage/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.h
r3913 r12878 6 6 #define _BAMGCONVERTMESHX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ 11 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom, double* index,double* x,double* y,int nods,int nels);11 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,int* index,double* x,double* y,int nods,int nels); 12 12 13 13 #endif -
issm/branches/trunk-jpl-damage/src/c/modules/BamgTriangulatex/BamgTriangulatex.cpp
r11401 r12878 7 7 #include "../../include/include.h" 8 8 #include "../../toolkits/toolkits.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 using namespace bamg; -
issm/branches/trunk-jpl-damage/src/c/modules/BamgTriangulatex/BamgTriangulatex.h
r10205 r12878 6 6 #define _BAMGTRIANGULATEX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Bamgx/Bamgx.cpp
r12258 r12878 3 3 */ 4 4 #include "./Bamgx.h" 5 #include "../../ objects/objects.h"5 #include "../../classes/bamg/bamgobjects.h" 6 6 #include "../../shared/shared.h" 7 7 #include "../../include/include.h" … … 38 38 /*If no mesh in input, generate one*/ 39 39 if(bamgmesh_in->TrianglesSize[0]==0){ 40 /*Mesh generation {{{ 1*/40 /*Mesh generation {{{*/ 41 41 42 42 //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..."); 45 45 Geometry Gh(bamggeom_in,bamgopts); 46 46 … … 50 50 51 51 //build metric using geometry 52 if (verbosity>1) printf(" Generating Metric...\n");52 if (verbosity>1) _printLine_(" Generating Metric..."); 53 53 for(i=0;i<Gh.nbv;i++){ 54 54 Metric M=Gh[i]; … … 60 60 61 61 //generate mesh 62 if (verbosity>1) printf(" Generating Mesh...\n");62 if (verbosity>1) _printLine_(" Generating Mesh..."); 63 63 Mesh Th(maxnbv,Gh,bamgopts); 64 64 … … 73 73 74 74 //Build output 75 if (verbosity>1) printf(" Write Mesh...\n");75 if (verbosity>1) _printLine_(" Write Mesh..."); 76 76 Th.WriteMesh(bamgmesh_out,bamgopts); 77 if (verbosity>1) printf(" Write Geometry...\n");77 if (verbosity>1) _printLine_(" Write Geometry..."); 78 78 Gh.WriteGeometry(bamggeom_out,bamgopts); 79 79 … … 84 84 } 85 85 else{ 86 /*Anisotropic mesh adaptation {{{ 1*/86 /*Anisotropic mesh adaptation {{{*/ 87 87 88 88 // 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..."); 91 91 Mesh BTh(bamggeom_in,bamgmesh_in,bamgopts); 92 92 … … 100 100 //Generate initial metric 101 101 if (bamgopts->metric){ 102 if (verbosity>1) printf(" Processing Metric...\n");102 if (verbosity>1) _printLine_(" Processing Metric..."); 103 103 BTh.ReadMetric(bamgopts); 104 104 } 105 105 else { 106 if (verbosity>1) printf(" Generating initial Metric...\n");106 if (verbosity>1) _printLine_(" Generating initial Metric..."); 107 107 Metric Mhmax(bamgopts->hmax); 108 108 for (int iv=0;iv<BTh.nbv;iv++) BTh[iv].m = Mhmax; … … 111 111 //use present fields to generate metric if present 112 112 if (bamgopts->field){ 113 if (verbosity>1) printf(" Merge metric with field provided...\n");113 if (verbosity>1) _printLine_(" Merge metric with field provided..."); 114 114 BTh.AddMetric(bamgopts); 115 115 } … … 117 117 // change using hVertices if provided 118 118 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..."); 120 120 for (i=0;i<BTh.nbv;i++){ 121 if (! isnan(bamgopts->hVertices[i])){121 if (!xIsNan<IssmDouble>(bamgopts->hVertices[i])){ 122 122 BTh[i].m=Metric((float)bamgopts->hVertices[i]); 123 123 } … … 127 127 // change using hminVertices if provided 128 128 if (bamgopts->hminVertices){ 129 if (verbosity>1) printf(" Merging Metric with hminVertices...\n");129 if (verbosity>1) _printLine_(" Merging Metric with hminVertices..."); 130 130 for (i=0;i<BTh.nbv;i++){ 131 if (! isnan(bamgopts->hminVertices[i])){131 if (!xIsNan<IssmDouble>(bamgopts->hminVertices[i])){ 132 132 Metric M=BTh.vertices[i].m; 133 133 EigenMetric Vp(M/coef); … … 140 140 // change using hmaxVertices if provided 141 141 if (bamgopts->hmaxVertices){ 142 if (verbosity>1) printf(" Merging Metric with hmaxVertices...\n");142 if (verbosity>1) _printLine_(" Merging Metric with hmaxVertices..."); 143 143 for (i=0;i<BTh.nbv;i++){ 144 if (! isnan(bamgopts->hmaxVertices[i])){144 if (!xIsNan<IssmDouble>(bamgopts->hmaxVertices[i])){ 145 145 Metric M=BTh.vertices[i].m; 146 146 EigenMetric Vp(M/coef); … … 164 164 165 165 //Build new mesh 166 if (verbosity>1) printf(" Generating Mesh...\n");166 if (verbosity>1) _printLine_(" Generating Mesh..."); 167 167 Thr=&BTh,Thb=0; 168 168 Mesh & Th( *(0 ? new Mesh(*Thr,&Thr->Gh,Thb,maxnbv) : new Mesh(maxnbv,BTh,bamgopts,bamgopts->KeepVertices))); … … 185 185 if(verbosity>0) { 186 186 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)); 188 188 } 189 189 if (Th.nbq ){ 190 printf(" new number of quads = %i\n",Th.nbq);190 _printLine_(" new number of quads = " << Th.nbq); 191 191 } 192 192 } 193 193 194 194 //Build output 195 if (verbosity>1) printf(" Write Mesh...\n");195 if (verbosity>1) _printLine_(" Write Mesh..."); 196 196 Th.WriteMesh(bamgmesh_out,bamgopts); 197 if (verbosity>1) printf(" Write Geometry...\n");197 if (verbosity>1) _printLine_(" Write Geometry..."); 198 198 Th.Gh.WriteGeometry(bamggeom_out,bamgopts); 199 if (verbosity>1) printf(" Write Metric...\n");199 if (verbosity>1) _printLine_(" Write Metric..."); 200 200 BTh.WriteMetric(bamgopts); 201 201 … … 207 207 208 208 /*No error return*/ 209 if (verbosity>1) printf(" Exiting Bamg.\n");209 if (verbosity>1) _printLine_(" Exiting Bamg."); 210 210 return noerr; 211 211 -
issm/branches/trunk-jpl-damage/src/c/modules/Bamgx/Bamgx.h
r3910 r12878 6 6 #define _BAMGX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/bamg/bamgobjects.h" 9 9 10 10 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Chacox/Chacox.cpp
r11401 r12878 66 66 67 67 if (DEBUG_TRACE > 0) { 68 printf("<Entering main>\n");68 _printLine_("<Entering main>"); 69 69 } 70 70 71 71 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"); 74 74 } 75 75 … … 177 177 178 178 if (DEBUG_MEMORY > 0) { 179 printf("\n");179 _printLine_(""); 180 180 smalloc_stats(); 181 181 } … … 185 185 186 186 if (DEBUG_TRACE > 1) { 187 printf("<Leaving main>\n");187 _printLine_("<Leaving main>"); 188 188 } 189 189 -
issm/branches/trunk-jpl-damage/src/c/modules/Chacox/Chacox.h
r9320 r12878 33 33 34 34 #include "../../Container/Container.h" 35 #include "../../ objects/objects.h"35 #include "../../classes/objects/objects.h" 36 36 37 37 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Chacox/input_parse.cpp
r11401 r12878 38 38 39 39 if (DEBUG_TRACE > 0) { 40 printf("<Entering input_parse>\n");40 _printLine_("<Entering input_parse>"); 41 41 } 42 42 43 43 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"); 49 49 } 50 50 *architecture = (int)options[OPT_ARCH]; … … 57 57 /* Name output assignment file. */ 58 58 if (PROMPT) 59 printf("Assignment output file: ");59 _printString_("Assignment output file: "); 60 60 outassignname = NULL; 61 61 62 62 /* Name output results file. */ 63 63 if (PROMPT) 64 printf("File name for saving run results: ");64 _printString_("File name for saving run results: "); 65 65 outfilename = NULL; 66 66 … … 75 75 else { 76 76 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"); 85 85 } 86 86 *global_method = (int)options[OPT_GLOBAL]; … … 94 94 if (*global_method == 7) { /* Name and open input assignment file. */ 95 95 if (PROMPT) 96 printf("Assignment input file: ");96 _printString_("Assignment input file: "); 97 97 } 98 98 99 99 else if (*global_method == 3) { 100 100 if (PROMPT) 101 printf("Geometry input file name: ");101 _printString_("Geometry input file name: "); 102 102 } 103 103 104 104 else if (*global_method == 2) { 105 105 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"); 109 109 } 110 110 eigensolver = (int)options[OPT_RQI]; … … 117 117 if (MATCH_TYPE == 5) { /* geometric matching */ 118 118 if (PROMPT) 119 printf("Geometry input file name: ");119 _printString_("Geometry input file name: "); 120 120 } 121 121 *rqi_flag = 1; 122 122 if (PROMPT) 123 printf("Number of vertices to coarsen down to: ");123 _printString_("Number of vertices to coarsen down to: "); 124 124 *vmax = (int)options[OPT_VMAX]; 125 125 if (*vmax <= 0) { … … 137 137 if (MATCH_TYPE == 5) { /* geometric matching */ 138 138 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: "); 143 143 *vmax = (int)options[OPT_VMAX]; 144 144 if (*vmax <= 0) { … … 168 168 else { 169 169 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"); 173 173 } 174 174 *local_method = (int)options[OPT_LOCAL]; … … 185 185 *ndims_tot = 0; 186 186 if (PROMPT) 187 printf("Total number of target hypercube dimensions: ");187 _printString_("Total number of target hypercube dimensions: "); 188 188 *ndims_tot = nparts[0]; 189 189 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"); 191 191 printf("%s -- Number of divisions %d must be at least 1.\n", 192 192 __FUNCT__,nparts[0]); … … 200 200 if (*architecture == 2) { 201 201 if (PROMPT) 202 printf("X and Y extent of of 2-D mesh: ");202 _printString_("X and Y extent of of 2-D mesh: "); 203 203 mesh_dims[0] = nparts[0]; 204 204 mesh_dims[1] = nparts[1]; … … 206 206 else if (*architecture == 3) { 207 207 if (PROMPT) 208 printf("X, Y and Z extent of 3-D mesh: ");208 _printString_("X, Y and Z extent of 3-D mesh: "); 209 209 mesh_dims[0] = nparts[0]; 210 210 mesh_dims[1] = nparts[1]; … … 213 213 else { /* Anything else => 1-D mesh */ 214 214 if (PROMPT) 215 printf("Size of 1-D mesh: ");215 _printString_("Size of 1-D mesh: "); 216 216 mesh_dims[0] = nparts[0]; 217 217 *architecture = 1; … … 227 227 else if (*nprocs <= 7) { 228 228 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"); 232 232 } 233 233 *ndims = (int)options[OPT_NDIMS]; … … 240 240 else { 241 241 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"); 246 246 } 247 247 *ndims = (int)options[OPT_NDIMS]; -
issm/branches/trunk-jpl-damage/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp
r11708 r12878 15 15 int i; 16 16 int found=0; 17 double numberofelements;17 IssmDouble numberofelements; 18 18 Element* element=NULL; 19 19 … … 25 25 26 26 /*Allocate sigma on numberofelements: */ 27 sigma=new Vector( (int)numberofelements);27 sigma=new Vector(reCast<int>(numberofelements)); 28 28 29 29 /*Compute basal stress for each element: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h
r11708 r12878 6 6 #define _COMPUTEBASALSTRESSX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h
r11708 r12878 6 6 #define _COMPUTESTRAINRATEX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp
r9761 r12878 25 25 parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 26 26 27 _printf_(VerboseMProcessor()," Configuring elements...\n");27 if(VerboseMProcessor()) _pprintLine_(" Configuring elements..."); 28 28 for (i=0;i<elements->Size();i++){ 29 29 element=(Element*)elements->GetObjectByOffset(i); 30 30 element->Configure(elements,loads,nodes,materials,parameters); 31 31 } 32 _printf_(VerboseMProcessor()," Configuring loads...\n");32 if(VerboseMProcessor()) _pprintLine_(" Configuring loads..."); 33 33 for (i=0;i<loads->Size();i++){ 34 34 load=(Load*)loads->GetObjectByOffset(i); … … 37 37 } 38 38 } 39 _printf_(VerboseMProcessor()," Configuring nodes...\n");39 if(VerboseMProcessor()) _pprintLine_(" Configuring nodes..."); 40 40 for (i=0;i<nodes->Size();i++){ 41 41 node=(Node*)nodes->GetObjectByOffset(i); … … 45 45 } 46 46 47 _printf_(VerboseMProcessor()," Configuring materials...\n");47 if(VerboseMProcessor()) _pprintLine_(" Configuring materials..."); 48 48 for (i=0;i<materials->Size();i++){ 49 49 material=(Material*)materials->GetObjectByOffset(i); -
issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/ConstraintsStateLocal.h
r9127 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /*melting: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp
r9761 r12878 25 25 26 26 /*Display message*/ 27 _printf_(VerboseModule()," Constraining penalties\n");27 if(VerboseModule()) _pprintLine_(" Constraining penalties"); 28 28 29 29 /*recover parameters: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/ConstraintsStatex.h
r9127 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp
r12168 r12878 12 12 13 13 /*current module: */ 14 /*RiftIsPresent(Loads* loads,int configuration_type){{{ 1*/14 /*RiftIsPresent(Loads* loads,int configuration_type){{{*/ 15 15 int RiftIsPresent(Loads* loads,int configuration_type){ 16 16 … … 41 41 } 42 42 /*}}}*/ 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){{{*/ 44 44 void RiftConstraintsState(int* pconverged, int* pnum_unstable_constraints,Loads* loads,int min_mechanical_constraints,int configuration_type){ 45 45 … … 56 56 } 57 57 else if(num_unstable_constraints<=min_mechanical_constraints){ 58 _printf_(VerboseModule()," freezing constraints\n");58 if(VerboseModule()) _pprintLine_(" freezing constraints"); 59 59 RiftFreezeConstraints(loads,configuration_type); 60 60 } … … 65 65 } 66 66 /*}}}*/ 67 /*RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){{{ 1*/67 /*RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){{{*/ 68 68 void RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){ 69 69 … … 106 106 } 107 107 /*}}}*/ 108 /*RiftIsFrozen(Loads* loads,int configuration_type){{{ 1*/108 /*RiftIsFrozen(Loads* loads,int configuration_type){{{*/ 109 109 int RiftIsFrozen(Loads* loads,int configuration_type){ 110 110 … … 144 144 } 145 145 /*}}}*/ 146 /*RiftFreezeConstraints(Loads* loads,int configuration_type){{{ 1*/146 /*RiftFreezeConstraints(Loads* loads,int configuration_type){{{*/ 147 147 void RiftFreezeConstraints(Loads* loads,int configuration_type){ 148 148 … … 172 172 173 173 /*diverse trials and errors: */ 174 /*RiftIsMaterialStable(Loads* loads){{{ 1*/174 /*RiftIsMaterialStable(Loads* loads){{{*/ 175 175 int RiftIsMaterialStable(Loads* loads){ 176 176 … … 204 204 } 205 205 /*}}}*/ 206 /*RiftIsPreStable(Loads* loads){{{ 1*/206 /*RiftIsPreStable(Loads* loads){{{*/ 207 207 int RiftIsPreStable(Loads* loads){ 208 208 … … 243 243 } 244 244 /*}}}*/ 245 /*RiftSetPreStable(Loads* loads){{{ 1*/245 /*RiftSetPreStable(Loads* loads){{{*/ 246 246 void RiftSetPreStable(Loads* loads){ 247 247 … … 264 264 } 265 265 /*}}}*/ 266 /*RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){{{ 1*/266 /*RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){{{*/ 267 267 void RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){ 268 268 … … 300 300 } 301 301 /*}}}*/ 302 /*RiftMaxPenetrationInInputs(Loads* loads){{{ 1*/302 /*RiftMaxPenetrationInInputs(Loads* loads){{{*/ 303 303 void RiftMaxPenetrationInInputs(Loads* loads){ 304 304 … … 309 309 310 310 /*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; 314 314 315 315 /*Ok, we are going to find the node pairs which are not penetrating, even though they … … 342 342 } 343 343 /*}}}*/ 344 /*RiftPotentialUnstableConstraints(Loads* loads){{{ 1*/344 /*RiftPotentialUnstableConstraints(Loads* loads){{{*/ 345 345 int RiftPotentialUnstableConstraints(Loads* loads){ 346 346 -
issm/branches/trunk-jpl-damage/src/c/modules/ContourToMeshx/ContourToMeshx.cpp
r12168 r12878 70 70 71 71 /*Free ressources:*/ 72 x free((void**)&in_nod_serial);72 xDelete<double>(in_nod_serial); 73 73 74 74 return noerr; -
issm/branches/trunk-jpl-damage/src/c/modules/ContourToMeshx/ContourToMeshx.h
r12168 r12878 8 8 9 9 #include "../../shared/shared.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /*threading: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ContourToNodesx/ContourToNodesx.h
r12168 r12878 8 8 9 9 #include "../../shared/shared.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp
r11708 r12878 33 33 34 34 /*Clean up and return*/ 35 x free((void**)&control_type);35 xDelete<int>(control_type); 36 36 *pgradient=gradient; 37 37 } -
issm/branches/trunk-jpl-damage/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.h
r11708 r12878 5 5 #define _CONTROLINPUTGETGRADIENTX_H 6 6 7 #include "../../ objects/objects.h"7 #include "../../classes/objects/objects.h" 8 8 #include "../../Container/Container.h" 9 9 -
issm/branches/trunk-jpl-damage/src/c/modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp
r11313 r12878 37 37 38 38 /*Clean up and return*/ 39 x free((void**)&control_type);40 x free((void**)&scalar_list);39 xDelete<int>(control_type); 40 xDelete<double>(scalar_list); 41 41 } -
issm/branches/trunk-jpl-damage/src/c/modules/ControlInputScaleGradientx/ControlInputScaleGradientx.h
r11313 r12878 5 5 #define _CONTROLINPUTSSCALEGRADIENTX_H 6 6 7 #include "../../ objects/objects.h"7 #include "../../classes/objects/objects.h" 8 8 #include "../../Container/Container.h" 9 9 -
issm/branches/trunk-jpl-damage/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp
r11708 r12878 27 27 28 28 /*Clean up and return*/ 29 x free((void**)&control_type);29 xDelete<int>(control_type); 30 30 31 31 } … … 39 39 40 40 /*Clean up and return*/ 41 x free((void**)&serial_gradient);41 xDelete<double>(serial_gradient); 42 42 } -
issm/branches/trunk-jpl-damage/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.h
r11708 r12878 5 5 #define _CONTROLINPUTSSETGRADIENTX_H 6 6 7 #include "../../ objects/objects.h"7 #include "../../classes/objects/objects.h" 8 8 #include "../../Container/Container.h" 9 9 -
issm/branches/trunk-jpl-damage/src/c/modules/CostFunctionx/CostFunctionx.cpp
r12004 r12878 35 35 36 36 /*Assign output pointers: */ 37 x free((void**)&responses);37 xDelete<int>(responses); 38 38 *pJ=J; 39 39 } -
issm/branches/trunk-jpl-damage/src/c/modules/CostFunctionx/CostFunctionx.h
r8607 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp
r11684 r12878 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters, double kmax){12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax){ 13 13 14 14 int i,connectivity; -
issm/branches/trunk-jpl-damage/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h
r11684 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ 12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters, double kmax);12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax); 13 13 14 14 #endif /* _CREATEJACOBIANMATRIXX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h
r11684 r12878 6 6 7 7 #include "../../Container/Container.h" 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp
r9650 r12878 30 30 double femmodel_response; 31 31 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; 36 35 37 36 /*retrieve npart: */ … … 66 65 67 66 /*Free ressources:*/ 68 x free((void**)&vertex_response);69 x free((void**)&qmu_response);67 xDelete<double>(vertex_response); 68 xDelete<double>(qmu_response); 70 69 71 70 } … … 87 86 } 88 87 else if (flag==NodalEnum){ 89 _error _("nodal response functions not supported yet!");88 _error2_("nodal response functions not supported yet!"); 90 89 91 90 /*increment response_pointer :*/ … … 105 104 } 106 105 } 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"); 108 107 } 109 108 … … 111 110 /*Synthesize echo: {{{*/ 112 111 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_(""); 117 116 } 118 117 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/modules/DakotaResponsesx/DakotaResponsesx.h
r6231 r12878 6 6 #define _DAKOTARESPONSESXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/DakotaFree.cpp
r9761 r12878 22 22 extern int my_rank; 23 23 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; 28 28 29 29 /*recover pointers: */ … … 35 35 /*Free variables and variables_descriptors only on cpu !=0*/ 36 36 if(my_rank!=0){ 37 x free((void**)&variables);37 xDelete<double>(variables); 38 38 for(i=0;i<numvariables;i++){ 39 39 string=variables_descriptors[i]; 40 x free((void**)&string);40 xDelete<char>(string); 41 41 } 42 x free((void**)&variables_descriptors);42 xDelete<char*>(variables_descriptors); 43 43 } 44 44 … … 46 46 for(i=0;i<numresponses;i++){ 47 47 string=responses_descriptors[i]; 48 x free((void**)&string);48 xDelete<char>(string); 49 49 } 50 50 //rest of dynamic allocations. 51 x free((void**)&responses_descriptors);51 xDelete<char*>(responses_descriptors); 52 52 53 53 /*Assign output pointers:*/ … … 56 56 *presponses_descriptors=responses_descriptors; 57 57 } 58 -
issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/DakotaMPI_Bcast.cpp
r9761 r12878 38 38 39 39 /*variables:*/ 40 if(my_rank!=0)variables= (double*)xmalloc(numvariables*sizeof(double));40 if(my_rank!=0)variables=xNew<double>(numvariables); 41 41 MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,MPI_COMM_WORLD); 42 42 43 43 /*variables_descriptors: */ 44 44 if(my_rank!=0){ 45 variables_descriptors= (char**)xmalloc(numvariables*sizeof(char*));45 variables_descriptors=xNew<char*>(numvariables); 46 46 } 47 47 for(i=0;i<numvariables;i++){ … … 51 51 } 52 52 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); 54 54 MPI_Bcast(string,string_length,MPI_CHAR,0,MPI_COMM_WORLD); 55 55 if(my_rank!=0)variables_descriptors[i]=string; -
issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.cpp
r12168 r12878 40 40 #include "../../toolkits/toolkits.h" 41 41 #include "../../EnumDefinitions/EnumDefinitions.h" 42 #include "../../ objects/DakotaPlugin.h"42 #include "../../classes/dakota/DakotaPlugin.h" 43 43 44 44 #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in. … … 121 121 122 122 /*Free ressources:*/ 123 x free((void**)&dakota_input_file);124 x free((void**)&dakota_error_file);125 x free((void**)&dakota_output_file);123 xDelete<char>(dakota_input_file); 124 xDelete<char>(dakota_error_file); 125 xDelete<char>(dakota_output_file); 126 126 127 127 #endif //#ifdef _HAVE_DAKOTA_ -
issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.h
r12168 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/classes.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/DescriptorIndex.cpp
r9761 r12878 23 23 /*retrieve first token, separated by underscore: */ 24 24 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!"); 26 26 27 27 if (strncmp(pch,"scaled",6)==0){ 28 28 /*we have a scaled variable. recover the root: */ 29 29 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!"); 31 31 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 32 32 … … 44 44 /*we have an indexed variable. recover the root: */ 45 45 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!"); 47 47 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 48 48 /*now recover the index: */ 49 49 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!"); 51 51 sscanf(pch,"%i",pindex); 52 52 return IndexedEnum; … … 55 55 /*we have an indexed variable. recover the root: */ 56 56 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!"); 58 58 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 59 59 /*now recover the index: */ 60 60 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!"); 62 62 sscanf(pch,"%i",pindex); 63 63 return NodalEnum; -
issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCore.cpp
r12168 r12878 10 10 11 11 12 #include "../../ objects/objects.h"12 #include "../../classes/objects/objects.h" 13 13 #include "../../io/io.h" 14 14 #include "../../EnumDefinitions/EnumDefinitions.h" -
issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCoreParallel.cpp
r9775 r12878 26 26 27 27 28 #include "../../ objects/objects.h"28 #include "../../classes/objects/objects.h" 29 29 #include "../../io/io.h" 30 30 #include "../../EnumDefinitions/EnumDefinitions.h" … … 53 53 /*synchronize all cpus, as CPU 0 is probably late (it is starting the entire dakota strategy!) : */ 54 54 MPI_Barrier(MPI_COMM_WORLD); 55 _printf_(VerboseQmu(),"qmu iteration: %i\n",counter);55 if(VerboseQmu()) _pprintLine_("qmu iteration: " << counter); 56 56 57 57 /*retrieve parameters: */ … … 67 67 68 68 /*Determine solution sequence: */ 69 _printf_(VerboseQmu(),"%s%s%s\n","Starting ",EnumToStringx(solution_type)," core:");69 if(VerboseQmu()) _pprintLine_("Starting " << EnumToStringx(solution_type) << " core:"); 70 70 CorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type); 71 71 #ifdef _HAVE_CONTROL_ 72 72 if(control_analysis)solutioncore=&control_core; 73 73 #else 74 _error _("ISSM was not compiled with control capabilities, exiting!");74 _error2_("ISSM was not compiled with control capabilities, exiting!"); 75 75 #endif 76 76 … … 79 79 80 80 /*compute responses: */ 81 _printf_(VerboseQmu(),"compute dakota responses:\n");81 if(VerboseQmu()) _pprintLine_("compute dakota responses:"); 82 82 DakotaResponsesx(d_responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponsedescriptors,d_numresponses); 83 83 -
issm/branches/trunk-jpl-damage/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h
r8608 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ElementConnectivityx/ElementConnectivityx.cpp
r3913 r12878 36 36 maxels=width-1; 37 37 /*Allocate connectivity: */ 38 elementconnectivity= (double*)xcalloc(nel*3,sizeof(double));38 elementconnectivity=xNewZeroInit<double>(nel*3); 39 39 40 40 /*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 39 39 #ifdef _HAVE_MPI_ 40 40 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"); 42 42 #endif 43 43 -
issm/branches/trunk-jpl-damage/src/c/modules/ElementResponsex/ElementResponsex.h
r10703 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/EnumToStringx/EnumToStringx.cpp
r12872 r12878 8 8 */ 9 9 10 #include <cstring> 10 11 #include "../../shared/shared.h" 11 12 #include "../../include/include.h" … … 109 110 case MaterialsRhoIceEnum : return "MaterialsRhoIce"; 110 111 case MaterialsRhoWaterEnum : return "MaterialsRhoWater"; 112 case MaterialsRhoFreshwaterEnum : return "MaterialsRhoFreshwater"; 111 113 case MaterialsMuWaterEnum : return "MaterialsMuWater"; 112 114 case MaterialsThermalExchangeVelocityEnum : return "MaterialsThermalExchangeVelocity"; … … 154 156 case SettingsResultsAsPatchesEnum : return "SettingsResultsAsPatches"; 155 157 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"; 160 168 case MaxIterationConvergenceFlagEnum : return "MaxIterationConvergenceFlag"; 161 169 case SteadystateMaxiterEnum : return "SteadystateMaxiter"; … … 166 174 case SurfaceforcingsPrecipitationEnum : return "SurfaceforcingsPrecipitation"; 167 175 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"; 168 186 case ThermalMaxiterEnum : return "ThermalMaxiter"; 169 187 case ThermalPenaltyFactorEnum : return "ThermalPenaltyFactor"; … … 257 275 case IntParamEnum : return "IntParam"; 258 276 case IntVecParamEnum : return "IntVecParam"; 277 case TransientParamEnum : return "TransientParam"; 259 278 case MacAyeal2dIceFrontEnum : return "MacAyeal2dIceFront"; 260 279 case MacAyeal3dIceFrontEnum : return "MacAyeal3dIceFront"; … … 376 395 case StressTensorzzEnum : return "StressTensorzz"; 377 396 case IceVolumeEnum : return "IceVolume"; 397 case TotalSmbEnum : return "TotalSmb"; 378 398 case P0Enum : return "P0"; 379 399 case P1Enum : return "P1"; … … 464 484 465 485 len=strlen(EnumToStringx(enum_in)); 466 string= (char*)xmalloc((len+1)*sizeof(char));486 string=xNew<char>(len+1); 467 487 memcpy(string,EnumToStringx(enum_in),(len+1)*sizeof(char)); 468 488 -
issm/branches/trunk-jpl-damage/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp
r12168 r12878 11 11 #include "../modules.h" 12 12 13 int Exp2Kmlx(char* filexp,char* filkml, 14 int sgn, 15 bool holes){ 13 int Exp2Kmlx(char* filexp,char* filkml,int sgn,bool holes){ 16 14 17 15 double cm,sp; 18 16 19 17 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)); 24 19 } 25 20 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; 21 int 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; 38 31 39 32 char indent[81]=""; … … 57 50 clock0=clock(); 58 51 time0 =time(NULL); 59 _p rintf_(true,"\nExp2Kmlx Module -- %s",ctime(&time0));60 61 /*read exp file */52 _pprintString_("\nExp2Kmlx Module -- " << ctime(&time0)); 53 54 /*read exp file */ 62 55 63 56 if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,&closed,filexp)) 64 _error _("Error reading exp file.");65 _p rintf_(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 << "\"."); 66 59 // 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]); 68 61 69 62 /* construct kml file */ … … 128 121 129 122 if (holes && nprof && (pnvert[0] <= 1 || pprofx[0][pnvert[0]-1] != pprofx[0][0] || pprofy[0][pnvert[0]-1] != pprofy[0][0])) { 130 _p rintf_(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."); 131 124 holes=false; 132 125 } … … 143 136 144 137 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); 147 140 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); 149 142 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.; 153 146 } 154 x free((void**)&lon);155 x free((void**)&lat);147 xDelete<double>(lon); 148 xDelete<double>(lat); 156 149 157 150 (kpoly ->outer )->AddObject((Object*)kring); … … 160 153 for (i=1; i<nprof; i++) { 161 154 if (pnvert[i] <= 1 || pprofx[i][pnvert[i]-1] != pprofx[i][0] || pprofy[i][pnvert[i]-1] != pprofy[i][0]) { 162 _p rintf_(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."); 163 156 continue; 164 157 } … … 167 160 168 161 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); 171 164 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); 173 166 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 x free((void**)&lon);179 x free((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); 180 173 181 174 (kpoly ->inner )->AddObject((Object*)kring); … … 204 197 205 198 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); 208 201 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); 210 203 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.; 214 207 } 215 x free((void**)&lon);216 x free((void**)&lat);208 xDelete<double>(lon); 209 xDelete<double>(lat); 217 210 218 211 (kpoly ->outer )->AddObject((Object*)kring); … … 231 224 232 225 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); 235 228 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); 237 230 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.; 241 234 } 242 x free((void**)&lon);243 x free((void**)&lat);235 xDelete<double>(lon); 236 xDelete<double>(lat); 244 237 245 238 (kplace->geometry )->AddObject((Object*)kline); … … 251 244 kplace->visibility=true; 252 245 sprintf(kplace->styleurl ,"#RandomLineEmptyPoly"); 246 int one=1; 253 247 254 248 kpoint=new KML_Point(); 255 249 256 lat= (double *) xmalloc(sizeof(double));257 lon= (double *) xmalloc(sizeof(double));250 lat=xNew<double>(one); 251 lon=xNew<double>(one); 258 252 Xy2llx(lat,lon,pprofx[i],pprofy[i],1,sgn,cm,sp); 259 253 kpoint->coords[0]=lon[0]; 260 254 kpoint->coords[1]=lat[0]; 261 255 kpoint->coords[2]=0.; 262 x free((void**)&lon);263 x free((void**)&lat);256 xDelete<double>(lon); 257 xDelete<double>(lat); 264 258 265 259 (kplace->geometry )->AddObject((Object*)kpoint); … … 281 275 /* write kml file */ 282 276 283 _p rintf_(true,"Exp2Kmlx -- Writing kml document to file \"%s\".\n",filkml);277 _pprintLine_("Exp2Kmlx -- Writing kml document to file \"" << filkml << "\"."); 284 278 fid=fopen(filkml,"w"); 285 279 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); … … 289 283 delete kfile; 290 284 for (i=nprof-1; i>=0; i--) { 291 x free((void**)&(pprofy[i]));292 x free((void**)&(pprofx[i]));293 } 294 x free((void**)&pnvert);285 xDelete<double>(pprofy[i]); 286 xDelete<double>(pprofx[i]); 287 } 288 xDelete<int>(pnvert); 295 289 296 290 clock1=clock(); -
issm/branches/trunk-jpl-damage/src/c/modules/Exp2Kmlx/Exp2Kmlx.h
r8716 r12878 8 8 #include <float.h> /* DBL_MAX */ 9 9 #include "../../Container/Container.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp
r11684 r12878 26 26 /*Get size of vector: */ 27 27 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)); 29 29 30 30 /*Initialize solution: */ -
issm/branches/trunk-jpl-damage/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h
r11684 r12878 6 6 #define _GETSOLUTIONFROMINPUTSXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp
r11708 r12878 32 32 33 33 /*Assign output pointers:*/ 34 x free((void**)&control_type);34 xDelete<int>(control_type); 35 35 *pvector=vector; 36 36 } -
issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.h
r11708 r12878 5 5 #define _GETVECTORFROMCONTROLINPUTSXX_H 6 6 7 #include "../../ objects/objects.h"7 #include "../../classes/objects/objects.h" 8 8 #include "../../Container/Container.h" 9 9 -
issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp
r11708 r12878 32 32 } 33 33 else{ 34 _error _("%s%s%s"," vector type: ",EnumToStringx(type)," not supported yet!");34 _error2_("vector type: " << EnumToStringx(type) << " not supported yet!"); 35 35 } 36 36 … … 41 41 } 42 42 43 void GetVectorFromInputsx( double** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){43 void GetVectorFromInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){ 44 44 45 45 /*output: */ 46 double* vector=NULL;46 IssmDouble* vector=NULL; 47 47 48 48 /*intermediary: */ -
issm/branches/trunk-jpl-damage/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h
r11708 r12878 5 5 #define _GETVECTORFROMINPUTSXX_H 6 6 7 #include "../../ objects/objects.h"7 #include "../../classes/objects/objects.h" 8 8 #include "../../Container/Container.h" 9 9 10 10 /* local prototypes: */ 11 11 void 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);12 void GetVectorFromInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int name,int type); 13 13 14 14 #endif /* _GETVECTORFROMINPUTSXX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/Gradjx/Gradjx.cpp
r11708 r12878 14 14 int i,j,numberofvertices; 15 15 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; 21 21 22 22 /*retrieve some parameters: */ … … 26 26 27 27 /*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); 30 30 for(i=0;i<num_controls;i++){ 31 31 gradient_list[i]=new Vector(num_controls*numberofvertices); … … 54 54 /*Check that gradient is clean*/ 55 55 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"); 58 58 59 59 /*Clean-up and assign output pointer*/ … … 62 62 } 63 63 else{ 64 x free((void**)&norm_list);64 xDelete<double>(norm_list); 65 65 } 66 66 if(pgradient) *pgradient=gradient; 67 x free((void**)&gradient_list);68 x free((void**)&control_type);67 xDelete<Vector*>(gradient_list); 68 xDelete<int>(control_type); 69 69 } -
issm/branches/trunk-jpl-damage/src/c/modules/Gradjx/Gradjx.h
r11708 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r12168 r12878 20 20 Element* element = NULL; 21 21 22 _printf_(VerboseModule()," Migrating grounding line\n");22 if(VerboseModule()) _pprintLine_(" Migrating grounding line"); 23 23 24 24 /*retrieve parameters: */ … … 27 27 28 28 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!"); 30 30 31 31 if(migration_style==SoftMigrationEnum){ … … 49 49 /*free ressouces: */ 50 50 xdelete(&vec_old_floatingice); 51 x free((void**)&vertices_potentially_ungrounding);52 x free((void**)&vertices_ungrounding);53 x free((void**)&old_floatingice);51 xDelete<double>(vertices_potentially_ungrounding); 52 xDelete<double>(vertices_ungrounding); 53 xDelete<double>(old_floatingice); 54 54 } 55 55 56 /*FUNCTION CreateNodesOnFloatingIce {{{ 1*/56 /*FUNCTION CreateNodesOnFloatingIce {{{*/ 57 57 Vector* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){ 58 58 … … 81 81 } 82 82 /*%}}}*/ 83 /*FUNCTION PotentialSheetUngrounding {{{ 1*/83 /*FUNCTION PotentialSheetUngrounding {{{*/ 84 84 double* PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){ 85 85 … … 108 108 } 109 109 /*}}}*/ 110 /*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{ 1*/110 /*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{*/ 111 111 double* PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding){ 112 112 … … 158 158 #ifdef _HAVE_MPI_ 159 159 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); 161 161 #else 162 162 nflipped=local_nflipped; … … 164 164 165 165 /*Avoid leaks: */ 166 x free((void**)&elements_neighboring_floatingce);167 x free((void**)&nodes_on_floatingice);166 xDelete<double>(elements_neighboring_floatingce); 167 xDelete<double>(nodes_on_floatingice); 168 168 169 169 /*Assemble and serialize:*/ … … 174 174 /*Free ressources:*/ 175 175 xdelete(&vec_nodes_on_floatingice); 176 x free((void**)&elements_neighboring_floatingce);176 xDelete<double>(elements_neighboring_floatingce); 177 177 178 178 return nodes_on_floatingice; -
issm/branches/trunk-jpl-damage/src/c/modules/HoleFillerx/HoleFillerx.cpp
r9313 r12878 43 43 44 44 /*^^^^^^^^^^^^^ Remove pixels close to the holes ^^^^^^^^^^^^^*/ 45 image2 = (double*) xmalloc( lines*samps*sizeof(double));45 image2 = xNew<double>(lines*samps); 46 46 memcpy(image2,image,lines*samps*sizeof(double)); 47 47 … … 64 64 } 65 65 66 image3 = (double*) xmalloc( lines*samps*sizeof(double));66 image3 = xNew<double>(lines*samps); 67 67 memcpy(image3,image2,lines*samps*sizeof(double)); 68 68 … … 76 76 } 77 77 } 78 printf( "\n" );79 printf("Number of zeroes remaining: %10ld",lines*samps-counter);78 _printLine_( "" ); 79 _printString_("Number of zeroes remaining: " << lines*samps-counter); 80 80 fflush( stdout ); 81 81 #endif … … 95 95 } 96 96 // 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); 99 99 fflush( stdout ); 100 100 #endif … … 104 104 /***************** FIRST RUN *********************/ 105 105 /* 106 fprintf ( stdout, "First Application: " ); time(&t2); printf( ctime(&t2) );106 fprintf ( stdout, "First Application: " ); time(&t2); _printString_( ctime(&t2) ); 107 107 */ 108 108 for ( i = 0; i < lines; i++ ){ … … 277 277 278 278 #ifdef _DEBUG2_ 279 // printf("%g %g %g \n",temp,elev,range);279 //_printLine_(temp << " " << elev << " " << range << " "); 280 280 #endif 281 281 … … 304 304 /************************ SMOOTH THE RESULT ***********************/ 305 305 306 image4 = (double*) xmalloc( lines*samps*sizeof(double));306 image4 = xNew<double>(lines*samps); 307 307 memcpy(image4,image3,lines*samps*sizeof(double)); 308 308 … … 348 348 349 349 /*Allocate output image: */ 350 imageout= (double*)xmalloc(samps*lines*sizeof(double));350 imageout=xNew<double>(samps*lines); 351 351 memcpy(imageout,image3,lines*samps*sizeof(double)); 352 352 … … 354 354 355 355 #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"); 358 358 printf ( "\n"); 359 359 #endif … … 363 363 /*Assign output pointers: */ 364 364 *pimageout=imageout; 365 366 365 return 1; 367 368 366 } -
issm/branches/trunk-jpl-damage/src/c/modules/IceVolumex/IceVolumex.h
r9880 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/InputArtificialNoisex/InputArtificialNoisex.cpp
r5578 r12878 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,int enum_name, double min,double max){11 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,int enum_name,IssmDouble min,IssmDouble max){ 12 12 13 13 int i; -
issm/branches/trunk-jpl-damage/src/c/modules/InputArtificialNoisex/InputArtificialNoisex.h
r5578 r12878 6 6 #define _INPUTARTIFICIALNOISEX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 11 11 /* local prototypes: */ 12 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int enum_name, double min,double max);12 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int enum_name,IssmDouble min,IssmDouble max); 13 13 14 14 #endif /* _UPDATEINPUTSFROMVECTORXX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/InputConvergencex/InputConvergencex.cpp
r12168 r12878 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 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){11 bool 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){ 12 12 13 13 /*intermediary:*/ 14 int 15 bool 16 int num_notconverged=0;17 int 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; 20 20 21 21 /*allocate dynamic memory: */ 22 eps= (double*)xmalloc(num_criterionenums*sizeof(double));22 eps=xNew<IssmDouble>(num_criterionenums); 23 23 24 24 /*Go through elements, and ask them to do the job: */ … … 34 34 num_notconverged=total_notconverged; 35 35 #endif 36 _printf_(VerboseConvergence()," #elements above convergence criterion = %i\n",num_notconverged);36 if(VerboseConvergence()) _pprintLine_(" #elements above convergence criterion = " << num_notconverged); 37 37 38 38 /*Free ressources:*/ 39 x free((void**)&eps);39 xDelete<IssmDouble>(eps); 40 40 41 41 /*return: */ -
issm/branches/trunk-jpl-damage/src/c/modules/InputConvergencex/InputConvergencex.h
r4778 r12878 8 8 9 9 /* 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);10 bool 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); 11 11 12 12 #endif /* _INPUTCONVERGENCEX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/InputScalex/InputScalex.cpp
r4573 r12878 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, double scale_factor){11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, IssmDouble scale_factor){ 12 12 13 13 /*intermediary:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/InputScalex/InputScalex.h
r4236 r12878 9 9 10 10 /* local prototypes: */ 11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, double scale_factor);11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, IssmDouble scale_factor); 12 12 13 13 #endif /* _SCALEINPUTX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.cpp
r12004 r12878 13 13 /*intermediary:*/ 14 14 int step; 15 double time;15 IssmDouble time; 16 16 Element *element = NULL; 17 17 -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp
r4573 r12878 49 49 } 50 50 } 51 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double constant, int name){51 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble constant, int name){ 52 52 53 53 int i; -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h
r4236 r12878 6 6 #define _UPDATEINPUTSFROMCONSTANTXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 … … 12 12 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters, bool constant, int name); 13 13 void 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);14 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters, IssmDouble constant, int name); 15 15 16 16 #endif /* _UPDATEINPUTSFROMCONSTANTXX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
r10571 r12878 21 21 double *qmu_part = NULL; 22 22 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; 26 26 char root[50]; //root name of variable, ex: DragCoefficent, RhoIce, etc ... 27 27 … … 49 49 50 50 51 distributed_values= (double*)xmalloc(npart*sizeof(double));51 distributed_values=xNew<double>(npart); 52 52 for(j=0;j<npart;j++){ 53 53 distributed_values[j]=variables[i+j]; … … 91 91 92 92 /*Free allocations: */ 93 x free((void**)¶meter);94 x free((void**)&distributed_values);93 xDelete<double>(parameter); 94 xDelete<double>(distributed_values); 95 95 } 96 96 else if (strncmp(descriptor,"indexed_",8)==0){ 97 _error _("indexed variables not supported yet!");97 _error2_("indexed variables not supported yet!"); 98 98 } 99 99 else if (strncmp(descriptor,"nodal_",8)==0){ 100 _error _("nodal variables not supported yet!");100 _error2_("nodal variables not supported yet!"); 101 101 } 102 102 else{ … … 107 107 108 108 /*Free ressources:*/ 109 xfree((void**)&qmu_part); 110 109 xDelete<double>(qmu_part); 111 110 } -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h
r6231 r12878 6 6 #define _INPUTUPDATEFROMDAKOTAXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromMatrixDakotax/InputUpdateFromMatrixDakotax.h
r10576 r12878 6 6 #define _UPDATEINPUTSFROMMATRIXDAKOTAXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
r11684 r12878 11 11 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* solution){ 12 12 13 double* serial_solution=NULL;13 IssmDouble* serial_solution=NULL; 14 14 15 15 /*Serialize solution, so that elements can index into it on every CPU: */ … … 20 20 21 21 /*Free ressources:*/ 22 xfree((void**)&serial_solution); 23 22 xDelete<IssmDouble>(serial_solution); 24 23 } 25 24 26 25 27 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double* solution){26 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution){ 28 27 29 28 /*Intermediary*/ … … 36 35 element->InputUpdateFromSolution(solution); 37 36 } 38 39 37 } -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h
r11684 r12878 6 6 #define _UPDATEINPUTSFROMSOLUTIONXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 11 11 /* local prototypes: */ 12 12 void 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);13 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution); 14 14 15 15 //with timestep 16 16 void 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);17 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution, int timestep); 18 18 19 19 #endif /* _UPDATEINPUTSFROMSOLUTIONXX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp
r11708 r12878 18 18 19 19 /*Free ressources:*/ 20 x free((void**)&serial_vector);20 xDelete<double>(serial_vector); 21 21 } 22 22 -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h
r11708 r12878 6 6 #define _UPDATEINPUTSFROMVECTORDAKOTAXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp
r11708 r12878 11 11 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* vector, int name, int type){ 12 12 13 double* serial_vector=NULL;13 IssmDouble* serial_vector=NULL; 14 14 15 15 serial_vector=vector->ToMPISerial(); … … 18 18 19 19 /*Free ressources:*/ 20 x free((void**)&serial_vector);20 xDelete<IssmDouble>(serial_vector); 21 21 } 22 22 23 23 24 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double* vector, int name, int type){24 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* vector, int name, int type){ 25 25 26 26 int i; -
issm/branches/trunk-jpl-damage/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h
r11708 r12878 6 6 #define _UPDATEINPUTSFROMVECTORXX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 11 11 /* local prototypes: */ 12 12 void 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);13 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* vector, int name,int type); 14 14 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int* vector, int name,int type); 15 15 void 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 13 13 #include "../../shared/shared.h" 14 14 #include "../../include/include.h" 15 #include "../../io/io.h" 15 16 /*}}}*/ 16 17 … … 36 37 /*Some checks on arguments: */ 37 38 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."); 39 40 } 40 41 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)"); 42 43 } 43 44 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)"); 45 46 } 46 47 … … 52 53 53 54 /*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); 56 57 for (i=0;i<N;i++) x[i]=(x_in[i]+x_in[i+1])/2; 57 58 for (i=0;i<M;i++) y[i]=(y_in[i]+y_in[i+1])/2; … … 62 63 63 64 /*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); 66 67 for (i=0;i<N;i++) x[i]=x_in[i]; 67 68 for (i=0;i<M;i++) y[i]=y_in[i]; 68 69 } 69 70 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."); 71 72 } 72 73 … … 81 82 gate.data_mesh=data_mesh; 82 83 gate.data=data; 84 gate.default_value=default_value; 85 gate.interp=interpenum; 83 86 gate.M=M; 84 87 gate.N=N; 85 gate.interp=interpenum;86 88 87 89 /*launch the thread manager with InterpFromGridToMeshxt as a core: */ 88 90 LaunchThread(InterpFromGridToMeshxt,(void*)&gate,num); 91 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 89 92 90 93 /*Assign output pointers:*/ … … 92 95 } 93 96 /*}}}*/ 94 /*InterpFromGridToMeshxt {{{ 1*/97 /*InterpFromGridToMeshxt {{{*/ 95 98 void* InterpFromGridToMeshxt(void* vpthread_handle){ 96 99 … … 124 127 double *y = gate->y; 125 128 int nods = gate->nods; 126 Vector *data_mesh = gate->data_mesh;129 Vector *data_mesh = gate->data_mesh; 127 130 double *data = gate->data; 128 131 double default_value = gate->default_value; … … 131 134 int N = gate->N; 132 135 136 bool debug = M*N>1? true:false; 137 debug = true; 138 133 139 /*partition loop across threads: */ 134 140 PartitionRange(&i0,&i1,nods,num_threads,my_thread); 135 141 for (i=i0;i<i1;i++) { 136 142 143 if(debug && my_thread==0) 144 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%"); 137 145 x_grid=*(x_mesh+i); 138 146 y_grid=*(y_mesh+i); … … 170 178 break; 171 179 default: 172 printf("Interpolation %s not supported yet\n",EnumToStringx(interpenum));180 _printLine_("Interpolation " << EnumToStringx(interpenum) << " not supported yet"); 173 181 return NULL; /*WARNING: no error because it would blow up the multithreading!*/ 174 182 } 175 if( isnan(data_value)) data_value=default_value;183 if(xIsNan<IssmDouble>(data_value)) data_value=default_value; 176 184 } 177 185 else{ … … 183 191 }/*}}}*/ 184 192 185 /*findindices {{{ 1*/193 /*findindices {{{*/ 186 194 bool findindices(int* pn,int* pm,double* x,int x_rows, double* y,int y_rows, double xgrid,double ygrid){ 187 195 … … 218 226 return (foundx && foundy); 219 227 }/*}}}*/ 220 /*triangleinterp{{{ 1*/228 /*triangleinterp{{{*/ 221 229 double triangleinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){ 222 230 /*split the rectangle in 2 triangle and … … 259 267 } 260 268 }/*}}}*/ 261 /*bilinearinterp{{{ 1*/269 /*bilinearinterp{{{*/ 262 270 double bilinearinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){ 263 271 /*Bilinear interpolation: (http://en.wikipedia.org/wiki/Bilinear_interpolation) */ … … 286 294 } 287 295 /*}}}*/ 288 /*nearestinterp{{{ 1*/296 /*nearestinterp{{{*/ 289 297 double nearestinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){ 290 298 /*Nearest neighbor interpolation*/ -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h
r12004 r12878 6 6 #define _INTERPFROMGRIDTOMESHX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../toolkits/toolkits.h" 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp
r11708 r12878 7 7 #include "../../include/include.h" 8 8 #include "../../toolkits/toolkits.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 #include "../modules.h" 11 11 12 12 int 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, 13 13 double* default_values,int num_default_values,Contour** contours,int numcontours){ 14 15 14 16 15 /*Output*/ … … 41 40 /*some checks*/ 42 41 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"); 44 43 } 45 44 … … 55 54 } 56 55 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)!"); 58 57 } 59 58 60 59 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!"); 62 61 } 63 62 … … 72 71 73 72 /*Initialize output*/ 74 data_prime=new Vector(nods_prime );73 data_prime=new Vector(nods_prime,false,SeqVecType); 75 74 if(num_default_values){ 76 75 if(num_default_values==1)for (i=0;i<nods_prime;i++) data_prime->SetValue(i,default_values[0],INS_VAL); … … 84 83 } 85 84 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; 88 87 } 89 88 … … 112 111 113 112 /*Assign output pointers:*/ 114 x free((void**)&incontour);113 xDelete<double>(incontour); 115 114 *pdata_prime=data_prime; 116 115 } -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.h
r11708 r12878 6 6 #define _INTERPFROMMESH2DX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../toolkits/toolkits.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp
r11708 r12878 8 8 void* InterpFromMesh2dxt(void* vpthread_handle){ 9 9 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 33 10 /*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; 39 13 double data_value; 40 14 41 15 /*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; 46 20 47 21 /*recover parameters :*/ 48 int erpolation_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 d ata=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 d efault_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; 66 40 67 41 /*partition loop across threads: */ … … 69 43 70 44 /*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++){ 74 46 75 47 /*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<<"%"); 77 50 78 51 /*if there is no point inside the domain, go to next iteration*/ … … 114 87 data_value=data[i]; 115 88 } 116 if ( isnan(data_value)){89 if (xIsNan<IssmDouble>(data_value)){ 117 90 if(num_default_values==1) data_value=default_values[0]; 118 91 else data_value=default_values[j]; … … 125 98 } 126 99 } 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.<<"%"); 129 102 return NULL; 130 131 103 } -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
r12004 r12878 30 30 /*some checks*/ 31 31 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"); 33 33 } 34 34 … … 41 41 } 42 42 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)!"); 44 44 } 45 45 46 46 /*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); 50 50 51 51 /*Set debug to 1 if there are lots of elements*/ … … 85 85 86 86 /*Loop over the elements*/ 87 if (debug) printf(" interpolation progress: %5.2lf %%",0.0);88 87 for (n=0;n<nels;n++){ 89 88 90 89 /*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<<"%"); 92 92 93 93 /*Get extrema coordinates of current elements*/ … … 160 160 data_value=data_mesh[n]; 161 161 } 162 if ( isnan(data_value)) data_value=default_value;162 if (xIsNan<IssmDouble>(data_value)) data_value=default_value; 163 163 164 164 /*insert value and go to the next point*/ … … 168 168 } 169 169 } 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.<<"%"); 171 172 172 173 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
r12168 r12878 7 7 #include "../../include/include.h" 8 8 #include "../../toolkits/toolkits.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 #include "../modules.h" 11 11 … … 13 13 using namespace std; 14 14 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){15 int 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){ 17 17 18 18 /*Output*/ … … 20 20 21 21 /*Intermediary*/ 22 double xmin,xmax,ymin,ymax; 23 bool isdefault; 24 double defaultvalue; 22 25 R2 r; 23 26 I2 I; … … 29 32 double data_value; 30 33 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;37 34 38 35 /*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 << ")"); 41 38 } 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"); 44 44 } 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; 53 47 } 54 48 55 49 /*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); 58 51 59 // read background mesh 60 if (verbose) printf("Reading mesh\n"); 52 /*read background mesh*/ 61 53 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); 62 58 Th.CreateSingleVertexToTriangleConnectivity(); 63 59 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 } 70 69 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; 76 78 } 77 79 } 78 80 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); 80 84 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); 84 87 85 //Find triangle holding r/I86 Triangle &tb=*Th.TriangleFindFromCoord(I,dete);88 /*point inside convex*/ 89 if (tb.det>0){ 87 90 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; 100 106 } 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{ 103 115 //Get closest adjacent triangle (inside the mesh) 104 116 AdjacentTriangle ta=CloseBoundaryEdge(I,&tb,aa,bb).Adj(); … … 116 128 it=Th.GetId(tc); 117 129 } 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]; 131 135 } 132 136 } 133 137 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 } 136 144 } 137 145 } 146 //if(N_interp>=100) _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 138 147 139 /* Assign output pointers:*/140 if (verbose) printf("Assigning output\n");148 /*clean-up and return*/ 149 xDelete<long>(reft); 141 150 *pdata_interp=data_interp; 142 143 /*No error return*/144 151 return 1; 145 152 } -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h
r12168 r12878 6 6 #define _INTERPFROMMESHTOMESH2DX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/classes.h" 9 9 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); 10 int 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); 13 12 14 13 #endif -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp
r11708 r12878 27 27 /*some checks*/ 28 28 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"); 30 30 } 31 31 … … 41 41 } 42 42 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)!"); 44 44 } 45 45 … … 58 58 59 59 /*Loop over the elements*/ 60 if (debug) printf(" interpolation progress: %5.2lf %%",0.0);61 60 for (i=0;i<nels_data;i++){ 62 61 63 62 /*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<<"%"); 65 65 66 66 /*Get extrema coordinates of current elements*/ … … 124 124 data_value=data[i]; 125 125 } 126 if ( isnan(data_value)) data_value=default_value;126 if (xIsNan<IssmDouble>(data_value)) data_value=default_value; 127 127 128 128 /*insert value and go to the next point*/ … … 132 132 } 133 133 } 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.<<"%"); 135 136 136 137 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h
r12004 r12878 7 7 8 8 #include "../../toolkits/toolkits.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 int 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 22 22 int counter; 23 23 int nods; 24 double* times=NULL;25 double* values=NULL;24 IssmDouble* times=NULL; 25 IssmDouble* values=NULL; 26 26 bool spcpresent=false; 27 27 int count=0; … … 29 29 30 30 /*variables being fetched: */ 31 double *doublevector = NULL;31 IssmDouble *IssmDoublevector = NULL; 32 32 int M,N; 33 33 … … 38 38 fid=iomodel->SetFilePointerToData(&code, &vector_layout,vector_enum); 39 39 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)); 42 42 43 43 /*Fetch vector:*/ 44 iomodel->FetchData(& doublevector,&M,&N,vector_enum);44 iomodel->FetchData(&IssmDoublevector,&M,&N,vector_enum); 45 45 46 46 /*Transient or static?:*/ … … 55 55 if((iomodel->my_vertices[i])){ 56 56 57 if (! isnan(doublevector[i])){57 if (!xIsNan<IssmDouble>(IssmDoublevector[i])){ 58 58 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)); 60 60 count++; 61 61 } … … 69 69 70 70 /*figure out times: */ 71 times= (double*)xmalloc(N*sizeof(double));71 times=xNew<IssmDouble>(N); 72 72 for(j=0;j<N;j++){ 73 times[j]= doublevector[(M-1)*N+j];73 times[j]=IssmDoublevector[(M-1)*N+j]; 74 74 } 75 75 /*unit conversion: */ … … 83 83 84 84 /*figure out times and values: */ 85 values= (double*)xmalloc(N*sizeof(double));85 values=xNew<IssmDouble>(N); 86 86 spcpresent=false; 87 87 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 default88 values[j]=IssmDoublevector[i*N+j]; 89 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 90 90 } 91 91 … … 94 94 count++; 95 95 } 96 x free((void**)&values);96 xDelete<IssmDouble>(values); 97 97 } 98 98 } 99 99 } 100 100 else{ 101 _error _("Size of field %s not supported",EnumToStringx(vector_enum));101 _error2_("Size of field " << EnumToStringx(vector_enum) << " not supported"); 102 102 } 103 103 104 104 /*Free ressources:*/ 105 x free((void**)&doublevector);106 x free((void**)×);107 x free((void**)&values);105 xDelete<IssmDouble>(IssmDoublevector); 106 xDelete<IssmDouble>(times); 107 xDelete<IssmDouble>(values); 108 108 } -
issm/branches/trunk-jpl-damage/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h
r9340 r12878 6 6 7 7 #include "../../Container/Container.h" 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/KMLFileReadx/KMLFileReadx.cpp
r11295 r12878 21 21 clock0=clock(); 22 22 time0 =time(NULL); 23 _p rintf_(true,"\nKMLFileReadx Module -- %s",ctime(&time0));23 _pprintString_("\nKMLFileReadx Module -- " << ctime(&time0)); 24 24 25 25 /* read kml file */ … … 43 43 } 44 44 45 // _p rintf_(true,"%s\n",kstr);46 x free((void**)&kstr);45 // _pprintLine_(kstr); 46 xDelete<char>(kstr); 47 47 } 48 48 49 49 if (kxml) { 50 _p rintf_(true,"XML declaration:\n");50 _pprintLine_("XML declaration:"); 51 51 kxml->DeepEcho(" "); 52 52 delete kxml; 53 53 } 54 54 if (kdtd) { 55 _p rintf_(true,"DTD declaration (not yet implemented):\n");55 _pprintLine_("DTD declaration (not yet implemented):"); 56 56 kdtd->DeepEcho(" "); 57 57 delete kdtd; -
issm/branches/trunk-jpl-damage/src/c/modules/KMLFileReadx/KMLFileReadx.h
r11295 r12878 8 8 #include <float.h> /* DBL_MAX */ 9 9 #include "../../Container/Container.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/KMLMeshWritex/KMLMeshWritex.cpp
r9761 r12878 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 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; 11 void 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; 35 25 36 26 clock_t clock0,clock1,clock0a,clock0b,clock0c; … … 39 29 clock0=clock(); 40 30 time0 =time(NULL); 41 _p rintf_(true,"\nKMLMeshWritex Module -- %s",ctime(&time0));31 _pprintString_("\nKMLMeshWritex Module -- " << ctime(&time0)); 42 32 43 33 /* construct kml document */ … … 93 83 94 84 if (cmap) { 95 _p rintf_(true,"Writing %d Matlab colors as KML style templates.\n",mcmap);85 _pprintLine_("Writing " << mcmap << " Matlab colors as KML style templates."); 96 86 ipt=0; 97 87 for (i=0; i<mcmap; i++) { … … 128 118 129 119 if (!nodecon) { 130 _p rintf_(true,"Creating the node connectivity table.\n");120 _pprintLine_("Creating the node connectivity table."); 131 121 nncon=mxepg+1; 132 nodecon= (int *) xcalloc(mncon*nncon,sizeof(int));122 nodecon=xNewZeroInit<int>(mncon*nncon); 133 123 ncfree=true; 134 124 … … 143 133 } 144 134 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"); 146 136 } 147 137 jpt++; … … 159 149 160 150 else if (mdata == mncon) { 161 _p rintf_(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); 163 153 edfree=true; 164 154 … … 183 173 184 174 else 185 _error _("Data matrix has incorrect number of %d rows.\n",mdata);175 _error2_("Data matrix has incorrect number of " << mdata << " rows.\n"); 186 176 } 187 177 … … 194 184 cmap,mcmap,ncmap)); 195 185 196 if (edfree) xfree((void**)&edata);197 if (ncfree) xfree((void**)&nodecon);186 if(edfree) xDelete<double>(edata); 187 if(ncfree) xDelete<int>(nodecon); 198 188 clock0a=clock(); 199 189 time0a =time(NULL); … … 203 193 /* write kml file */ 204 194 205 _p rintf_(true,"Writing kml document to file.\n");195 _pprintLine_("Writing kml document to file."); 206 196 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 207 197 fprintf(fid,"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n"); … … 213 203 ((double)(clock0b-clock0a))/CLOCKS_PER_SEC,difftime(time0b,time0a)); 214 204 215 _p rintf_(true,"Deleting kml document.\n");205 _pprintLine_("Deleting kml document."); 216 206 delete kdoc; 217 207 clock0c=clock(); … … 314 304 /* write each element as a polygon placemark */ 315 305 316 _p rintf_(true,"Writing %d tria elements as KML polygons.\n",melem);306 _pprintLine_("Writing " << melem << " tria elements as KML polygons."); 317 307 318 308 for (i=0; i<melem; i++) { … … 344 334 kring=new KML_LinearRing(); 345 335 kring->ncoord =nelem+1; 346 kring->coords =(double (*)[3]) xmalloc((nelem+1)*3*sizeof(double));336 kring->coords =xNew<double>((nelem+1)*3); 347 337 348 338 /* write the nodal coordinates as a linear ring */ 349 339 350 340 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; 354 344 ipt++; 355 345 } 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]; 359 349 // kring->DeepEcho(); 360 350 361 351 /* assemble the linear ring into polygon into placemark into folder */ 362 352 363 (kpoly ->outer 364 (kplace->geometry 365 (kfold ->feature 353 (kpoly ->outer )->AddObject((Object*)kring); 354 (kplace->geometry)->AddObject((Object*)kpoly); 355 (kfold ->feature )->AddObject((Object*)kplace); 366 356 367 357 // if (!(int)fmod((double)(i+1),1000)) 368 // _p rintf_(true," %d tria elements written.\n",(i+1));358 // _pprintLine_(" " << (i+1) << " tria elements written."); 369 359 } 370 _p rintf_(true," %d tria elements written.\n",melem);360 _pprintLine_(" " << melem << " tria elements written."); 371 361 372 362 return(kfold); -
issm/branches/trunk-jpl-damage/src/c/modules/KMLMeshWritex/KMLMeshWritex.h
r8461 r12878 8 8 #include <float.h> /* DBL_MAX */ 9 9 #include "../../Container/Container.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/KMLOverlayx/KMLOverlayx.cpp
r9761 r12878 28 28 clock0=clock(); 29 29 time0 =time(NULL); 30 _p rintf_(true,"\nKMLOverlayx Module -- %s",ctime(&time0));30 _pprintString_("\nKMLOverlayx Module -- " << ctime(&time0)); 31 31 32 32 /* construct kml file */ … … 82 82 /* write kml file */ 83 83 84 _p rintf_(true,"Writing kml document to file.\n");84 _pprintLine_("Writing kml document to file."); 85 85 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 86 86 kfile->Write(fid,indent); -
issm/branches/trunk-jpl-damage/src/c/modules/KMLOverlayx/KMLOverlayx.h
r8605 r12878 8 8 #include <float.h> /* DBL_MAX */ 9 9 #include "../../Container/Container.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Kml2Expx/Kml2Expx.cpp
r9761 r12878 38 38 clock0=clock(); 39 39 time0 =time(NULL); 40 _p rintf_(true,"\nKml2Expx Module -- %s",ctime(&time0));40 _pprintString_("\nKml2Expx Module -- " << ctime(&time0)); 41 41 42 42 /* read kml file */ … … 44 44 fidi=fopen(filkml,"r"); 45 45 if (!(kobj=KMLFileReadx(fidi))) 46 _error _("Error reading kml file.");46 _error2_("Error reading kml file."); 47 47 fclose(fidi); 48 48 49 49 /* open exp file */ 50 50 51 _p rintf_(true,"Writing exp profiles to file.\n");51 _pprintLine_("Writing exp profiles to file."); 52 52 fido=fopen(filexp,"w"); 53 53 -
issm/branches/trunk-jpl-damage/src/c/modules/Kml2Expx/Kml2Expx.h
r9259 r12878 8 8 #include <float.h> /* DBL_MAX */ 9 9 #include "../../Container/Container.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Krigingx/Krigingx.cpp
r12258 r12878 7 7 #include "../../include/include.h" 8 8 #include "../../toolkits/toolkits.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 #include "../../Container/Observations.h" 11 11 #include "../modules.h" 12 13 12 #ifdef _HAVE_GSL_ 14 13 #include <gsl/gsl_linalg.h> 15 14 #endif 16 17 #include "../../objects/Kriging/GaussianVariogram.h"18 15 /*FUNCTION Krigingx{{{*/ 19 16 int 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){ … … 24 21 25 22 /*Intermediaries*/ 26 double range; 23 int mindata,maxdata; 24 double radius; 27 25 char *output = NULL; 28 26 Variogram *variogram = NULL; … … 38 36 /*Get Variogram from Options*/ 39 37 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); 41 41 42 42 /*Process observation dataset*/ … … 44 44 45 45 /*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); 48 48 49 49 /*Get output*/ … … 56 56 observations->Variomap(predictions,x_interp,n_interp); 57 57 } 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){ 60 79 /*initialize thread parameters: */ 61 80 gate.n_interp = n_interp; 62 81 gate.x_interp = x_interp; 63 82 gate.y_interp = y_interp; 64 gate.range = range; 83 gate.radius = radius; 84 gate.mindata = mindata; 85 gate.maxdata = maxdata; 65 86 gate.variogram = variogram; 66 87 gate.observations = observations; 67 88 gate.predictions = predictions; 68 89 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); 70 133 71 134 /*launch the thread manager with Krigingxt as a core: */ 72 135 LaunchThread(Krigingxt,(void*)&gate,num); 73 printf("\r interpolation progress: 100.00%%\n");74 x free((void**)&gate.percent);136 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 137 xDelete<double>(gate.percent); 75 138 } 76 139 else{ 77 _error _("output '%s' not supported yet",output);140 _error2_("output '" << output << "' not supported yet"); 78 141 } 79 142 … … 81 144 delete variogram; 82 145 delete observations; 83 x free((void**)&output);146 xDelete<char>(output); 84 147 *ppredictions = predictions; 85 148 *perror = error; … … 106 169 double *x_interp = gate->x_interp; 107 170 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; 109 174 Variogram *variogram = gate->variogram; 110 175 Observations *observations = gate->observations; … … 114 179 115 180 /*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{{{*/ 200 void* 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; 127 231 128 232 /*partition loop across threads: */ … … 134 238 localpercent=percent[0]; 135 239 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{{{*/ 248 void* 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 } 186 292 return NULL; 187 293 }/*}}}*/ … … 199 305 else if(strcmp(model,"spherical")==0) variogram = new SphericalVariogram(options); 200 306 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)"); 202 308 } 203 309 else variogram = new GaussianVariogram(options); 204 310 205 311 /*Assign output pointer*/ 206 x free((void**)&model);312 xDelete<char>(model); 207 313 *pvariogram = variogram; 208 314 }/*}}}*/ 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 #else246 _error_("GSL support required");247 #endif248 }/*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/modules/Krigingx/Krigingx.h
r12258 r12878 6 6 #define _KRIGINGX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../toolkits/toolkits.h" 10 10 … … 13 13 14 14 int 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); 15 int 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); 15 16 void ProcessVariogram(Variogram **pvariogram,Options* options); 16 void GslSolve(double** pX,double* A,double* B,int n);17 17 18 18 /*threading: */ … … 21 21 double *x_interp; 22 22 double *y_interp; 23 double range; 23 double radius; 24 int mindata; 25 int maxdata; 24 26 Variogram *variogram; 25 27 Observations *observations; … … 27 29 double *error; 28 30 double *percent; 31 double power;//for idw 29 32 }KrigingxThreadStruct; 30 33 31 34 void* Krigingxt(void*); 35 void* NearestNeighbort(void*); 36 void* idwt(void*); 32 37 #endif /* _KRIGINGX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/Ll2xyx/Ll2xyx.cpp
r9761 r12878 52 52 double T,rho,sl,tc,mc; 53 53 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"); 55 55 56 56 delta = central_meridian; … … 116 116 *pdelta= 45; 117 117 *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)."); 119 119 } 120 120 else if (sgn == -1) { 121 121 *pdelta= 0; 122 122 *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)."); 124 124 } 125 else _error _("Sign should be either +1 or -1.\n");125 else _error2_("Sign should be either +1 or -1.\n"); 126 126 127 127 return; -
issm/branches/trunk-jpl-damage/src/c/modules/MassFluxx/MassFluxx.cpp
r12168 r12878 67 67 for(j=0;j<M;j++){ 68 68 double* matrix=array[j]; 69 x free((void**)&matrix);69 xDelete<double>(matrix); 70 70 } 71 x free((void**)&mdims_array);72 x free((void**)&ndims_array);73 x free((void**)&array);71 xDelete<int>(mdims_array); 72 xDelete<int>(ndims_array); 73 xDelete<double*>(array); 74 74 75 75 /*Assign output pointers: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MassFluxx/MassFluxx.h
r5475 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MaxAbsVxx/MaxAbsVxx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MaxAbsVyx/MaxAbsVyx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MaxAbsVzx/MaxAbsVzx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MaxVelx/MaxVelx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MaxVxx/MaxVxx.h
r4974 r12878 6 6 7 7 #include "../../Container/Container.h" 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MaxVyx/MaxVyx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MaxVzx/MaxVzx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp
r11684 r12878 17 17 18 18 /*Display message*/ 19 _printf_(VerboseModule()," Merging solution vector from fset to gset\n");19 if(VerboseModule()) _pprintLine_(" Merging solution vector from fset to gset"); 20 20 21 21 /*first, get gsize, fsize and ssize: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.h
r11684 r12878 6 6 #define _MERGESOLUTIONFROMFTOGX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MeshPartitionx/MeshPartitionx.cpp
r12168 r12878 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 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){11 int 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){ 13 13 14 14 int noerr=1; … … 31 31 32 32 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); 36 36 for (i=0;i<numberofelements;i++){ 37 37 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 Metis38 *(index+elements_width*i+j)=reCast<int>(*(elements+elements_width*i+j))-1; //-1 for C indexing in Metis 39 39 } 40 40 } … … 51 51 for (i=0;i<numberofnodes;i++) npart[i]=0; 52 52 } 53 else _error _("At least one processor is required");53 else _error2_("At least one processor is required"); 54 54 } 55 55 else{ … … 57 57 58 58 /*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); 62 62 63 63 for (i=0;i<numberofelements2d;i++){ 64 64 for (j=0;j<3;j++){ 65 *(index2d+3*i+j)= (int)*(elements2d+3*i+j)-1; //-1 for C indexing in Metis65 *(index2d+3*i+j)=reCast<int>(*(elements2d+3*i+j))-1; //-1 for C indexing in Metis 66 66 } 67 67 } … … 78 78 for (i=0;i<numberofnodes2d;i++) npart2d[i]=0; 79 79 } 80 else _error _("At least one processor is required");80 else _error2_("At least one processor is required"); 81 81 82 82 /*Extrude epart2d to epart, using numlayers: */ 83 epart= (int*)xmalloc(numberofelements*sizeof(int));83 epart=xNew<int>(numberofelements); 84 84 85 85 count=0; … … 92 92 93 93 /*Extrude npart2d to npart, using numlayers: */ 94 npart= (int*)xmalloc(numberofnodes*sizeof(int));94 npart=xNew<int>(numberofnodes); 95 95 96 96 count=0; … … 108 108 109 109 /*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); 115 114 return noerr; 116 117 115 } -
issm/branches/trunk-jpl-damage/src/c/modules/MeshPartitionx/MeshPartitionx.h
r8303 r12878 6 6 #define _MESHPARTITIONX_H 7 7 8 #include "../../include/include.h" 9 8 10 /* 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);11 int 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); 11 13 12 14 #endif /* _MESHPARTITIONX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/MeshProfileIntersectionx/ElementSegment.cpp
r8303 r12878 38 38 if( (edge1==IntersectEnum) && (edge2==IntersectEnum) && (edge3==IntersectEnum) ){ 39 39 /*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!"); 41 41 } 42 42 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 5 5 6 6 void MeshProfileIntersectionx( double** psegments, int* pnumsegs, int* index, double* x, double* y, int nel, int nods, Contour** contours,int numcontours){ 7 8 7 9 8 int i,j,k; … … 28 27 29 28 /*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); 32 31 33 32 /*Loop through all contours: */ … … 53 52 54 53 /*Out of all segments, create one common array of segments: */ 55 segments= (double*)xmalloc(5*numsegs*sizeof(double));54 segments=xNew<double>(5*numsegs); 56 55 count=0; 57 56 for(i=0;i<numcontours;i++){ -
issm/branches/trunk-jpl-damage/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.h
r8303 r12878 8 8 9 9 #include "../../shared/shared.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MeshProfileIntersectionx/MeshSegmentsIntersection.cpp
r8303 r12878 32 32 /*Using the segments_dataset dataset, create segments: */ 33 33 numsegs=segments_dataset->Size(); 34 segments= (double*)xmalloc(5*numsegs*sizeof(double));34 segments=xNew<double>(5*numsegs); 35 35 for(i=0;i<numsegs;i++){ 36 36 Segment* segment=(Segment*)segments_dataset->GetObjectByOffset(i); -
issm/branches/trunk-jpl-damage/src/c/modules/MinVelx/MinVelx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MinVxx/MinVxx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MinVyx/MinVyx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/MinVzx/MinVzx.h
r4974 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp
r10522 r12878 4 4 #include "../../../toolkits/toolkits.h" 5 5 #include "../../../EnumDefinitions/EnumDefinitions.h" 6 #include "../../../ objects/objects.h"6 #include "../../../classes/classes.h" 7 7 #include "../../../shared/shared.h" 8 8 #include "../ModelProcessorx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp
r10522 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../../../include/include.h" … … 46 46 47 47 /*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"); 49 49 50 50 /*First fetch data: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp
r11577 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/CreateConstraintsBedSlope.cpp
r10522 r12878 7 7 #include "../../../toolkits/toolkits.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../ModelProcessorx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/CreateLoadsBedSlope.cpp
r10522 r12878 6 6 #include "../../../toolkits/toolkits.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp
r10522 r12878 7 7 #include "../../../toolkits/toolkits.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp
r9733 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
r11577 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../../../include/include.h" … … 63 63 parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps)); 64 64 65 x free((void**)&control_type);66 x free((void**)&cm_responses);67 x free((void**)&cm_jump);68 x free((void**)&optscal);69 x free((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); 70 70 } 71 71 -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
r12872 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateDataSets.cpp
r9775 r12878 9 9 #endif 10 10 11 #include "../../ objects/objects.h"11 #include "../../classes/objects/objects.h" 12 12 #include "../../shared/shared.h" 13 13 #include "../../include/include.h" … … 124 124 125 125 default: 126 _error _("%s%s%s"," analysis_type: ",EnumToStringx(analysis_type)," not supported yet!");126 _error2_("analysis_type: " << EnumToStringx(analysis_type) << " not supported yet!"); 127 127 } 128 128 -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r12872 r12878 7 7 #include "../../io/io.h" 8 8 #include "../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 #include "../../shared/shared.h" 11 11 #include "../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
r11001 r12878 23 23 int numberofelements; 24 24 int numberofvertices; 25 double* elements=NULL;25 IssmDouble* elements=NULL; 26 26 27 27 /*output*/ … … 43 43 44 44 /*Allocate ouput*/ 45 connectivity= (int*)xcalloc(numberofvertices,sizeof(int));45 connectivity=xNewZeroInit<int>(numberofvertices); 46 46 47 47 /*Get element width (3 or 6)*/ … … 56 56 for (i=0;i<numberofelements;i++){ 57 57 for (j=0;j<elementswidth;j++){ 58 vertexid= (int)elements[elementswidth*i+j];58 vertexid=reCast<int>(elements[elementswidth*i+j]); 59 59 _assert_(vertexid>0 && vertexid-1<numberofvertices); 60 60 connectivity[vertexid-1]+=1; -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateParameters.cpp
r12004 r12878 13 13 #include "../../toolkits/toolkits.h" 14 14 #include "../../EnumDefinitions/EnumDefinitions.h" 15 #include "../../ objects/objects.h"15 #include "../../classes/objects/objects.h" 16 16 #include "../../shared/shared.h" 17 17 #include "../MeshPartitionx/MeshPartitionx.h" … … 24 24 int numoutputs; 25 25 Parameters *parameters = NULL; 26 double *requestedoutputs = NULL; 27 26 IssmDouble *requestedoutputs = NULL; 27 bool isdelta18o; 28 28 29 if(*pparameters)return; //do not create parameters twice! 29 30 … … 57 58 parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum)); 58 59 parameters->AddObject(iomodel->CopyConstantObject(SettingsLowmemEnum)); 59 parameters->AddObject(iomodel->CopyConstantObject(DebugP etscProfilingEnum));60 parameters->AddObject(iomodel->CopyConstantObject(DebugProfilingEnum)); 60 61 parameters->AddObject(iomodel->CopyConstantObject(MeshAverageVertexConnectivityEnum)); 61 62 parameters->AddObject(iomodel->CopyConstantObject(ConstantsReferencetemperatureEnum)); … … 89 90 parameters->AddObject(iomodel->CopyConstantObject(InversionIscontrolEnum)); 90 91 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 } 91 114 92 115 /*some parameters that did not come with the iomodel: */ … … 104 127 parameters->AddObject(new IntParam(DiagnosticNumRequestedOutputsEnum,numoutputs)); 105 128 if(numoutputs)parameters->AddObject(new IntVecParam(DiagnosticRequestedOutputsEnum,requestedoutputs,numoutputs)); 106 x free((void**)&requestedoutputs);129 xDelete<IssmDouble>(requestedoutputs); 107 130 iomodel->FetchData(&requestedoutputs,&numoutputs,NULL,TransientRequestedOutputsEnum); 108 131 parameters->AddObject(new IntParam(TransientNumRequestedOutputsEnum,numoutputs)); 109 132 if(numoutputs)parameters->AddObject(new IntVecParam(TransientRequestedOutputsEnum,requestedoutputs,numoutputs)); 110 x free((void**)&requestedoutputs);133 xDelete<IssmDouble>(requestedoutputs); 111 134 iomodel->FetchData(&requestedoutputs,&numoutputs,NULL,SteadystateRequestedOutputsEnum); 112 135 parameters->AddObject(new IntParam(SteadystateNumRequestedOutputsEnum,numoutputs)); 113 136 if(numoutputs)parameters->AddObject(new IntVecParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs)); 114 x free((void**)&requestedoutputs);137 xDelete<IssmDouble>(requestedoutputs); 115 138 116 139 /*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 23 23 int numberofelements; 24 24 int numberofvertices; 25 double* elements=NULL;25 IssmDouble* elements=NULL; 26 26 27 27 /*output*/ … … 44 44 45 45 /*Allocate ouput*/ 46 connectivity= (int*)xcalloc(numberofvertices,sizeof(int));46 connectivity=xNewZeroInit<int>(numberofvertices); 47 47 48 48 /*Get element width (3 or 6)*/ … … 59 59 if(iomodel->my_elements[i]){ 60 60 for (j=0;j<elementswidth;j++){ 61 vertexid= (int)elements[elementswidth*i+j];61 vertexid=reCast<int>(elements[elementswidth*i+j]); 62 62 _assert_(vertexid>0 && vertexid-1<numberofvertices); 63 63 connectivity[vertexid-1]=i+1; -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp
r10660 r12878 6 6 #include "../../../toolkits/toolkits.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../io/io.h" … … 15 15 void CreateParametersDakota(Parameters** pparameters,IoModel* iomodel,int solution_type,int analysis_type){ 16 16 17 /*variable declarations: {{{ 1*/17 /*variable declarations: {{{*/ 18 18 int i,j,k; 19 19 … … 73 73 iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum); 74 74 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)); 77 77 sprintf(qmuinname,"%s%s",name,".qmu.in"); 78 78 parameters->AddObject(new StringParam(QmuInNameEnum,qmuinname)); 79 79 80 qmuoutname= (char*)xmalloc((strlen(name)+strlen(".qmu.out")+1)*sizeof(char));80 qmuoutname=xNew<char>((strlen(name)+strlen(".qmu.out")+1)); 81 81 sprintf(qmuoutname,"%s%s",name,".qmu.out"); 82 82 parameters->AddObject(new StringParam(QmuOutNameEnum,qmuoutname)); 83 83 84 qmuerrname= (char*)xmalloc((strlen(name)+strlen(".qmu.err")+1)*sizeof(char));84 qmuerrname=xNew<char>((strlen(name)+strlen(".qmu.err")+1)); 85 85 sprintf(qmuerrname,"%s%s",name,".qmu.err"); 86 86 parameters->AddObject(new StringParam(QmuErrNameEnum,qmuerrname)); 87 87 /*}}}*/ 88 /*Fetch variable descriptors: {{{ 1*/88 /*Fetch variable descriptors: {{{*/ 89 89 iomodel->FetchData(&variabledescriptors,&numvariabledescriptors,QmuVariabledescriptorsEnum); 90 90 … … 93 93 94 94 /*}}}*/ 95 /*Fetch response descriptors: {{{ 1*/95 /*Fetch response descriptors: {{{*/ 96 96 iomodel->FetchData(&responsedescriptors,&numresponsedescriptors,QmuResponsedescriptorsEnum); 97 97 … … 100 100 parameters->AddObject(new IntParam(QmuNumberofresponsesEnum,numberofresponses)); 101 101 /*}}}*/ 102 /*Deal with partitioning: {{{ 1*/102 /*Deal with partitioning: {{{*/ 103 103 /*partition vertices in iomodel->qmu_npart parts, unless a partition is already present: */ 104 104 … … 111 111 ElementsAndVerticesPartitioning(&iomodel->my_elements,&iomodel->my_vertices,iomodel); 112 112 113 dpart= (double*)xmalloc(numberofvertices*sizeof(double));113 dpart=xNew<double>(numberofvertices); 114 114 for(i=0;i<numberofvertices;i++)dpart[i]=iomodel->my_vertices[i]; 115 115 } 116 116 parameters->AddObject(new DoubleVecParam(QmuPartitionEnum,dpart,numberofvertices)); 117 117 /*}}}*/ 118 /*Deal with data needed because of qmu variables: {{{ 1*/118 /*Deal with data needed because of qmu variables: {{{*/ 119 119 120 120 for(i=0;i<numvariabledescriptors;i++){ … … 136 136 137 137 /*Free ressources:*/ 138 x free((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: {{{*/ 143 143 for(i=0;i<numresponsedescriptors;i++){ 144 144 … … 153 153 /*Fetch the mass flux segments necessary to compute the mass fluxes. Build a DoubleMatArrayParam object out of them: */ 154 154 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!"); 156 156 157 157 /*Go through segments, and extract those that belong to this cpu: */ … … 166 166 } 167 167 if(m){ 168 matrix= (double*)xcalloc(5*m,sizeof(double));168 matrix=xNewZeroInit<double>(5*m); 169 169 count=0; 170 170 for(j=0;j<temp_m;j++){ … … 185 185 186 186 /*Free temporary matrix: */ 187 x free((void**)&temp_matrix);187 xDelete<double>(temp_matrix); 188 188 } 189 189 … … 194 194 for(i=0;i<qmu_mass_flux_num_profiles;i++){ 195 195 double* matrix=array[i]; 196 x free((void**)&matrix);197 } 198 x free((void**)&mdims_array);199 x free((void**)&ndims_array);200 x free((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: {{{*/ 204 204 for(i=0;i<numresponsedescriptors;i++){ 205 205 descriptor=responsedescriptors[i]; 206 x free((void**)&descriptor);207 } 208 x free((void**)&responsedescriptors);206 xDelete<char>(descriptor); 207 } 208 xDelete<char*>(responsedescriptors); 209 209 210 210 for(i=0;i<numvariabledescriptors;i++){ 211 211 descriptor=variabledescriptors[i]; 212 x free((void**)&descriptor);213 } 214 x free((void**)&variabledescriptors);215 x free((void**)&part);216 x free((void**)&dpart);217 x free((void**)&qmuinname);218 x free((void**)&qmuerrname);219 x free((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); 220 220 /*}}}*/ 221 221 } //if(dakota_analysis) 222 222 223 223 /*Free data*/ 224 x free((void**)&name);224 xDelete<char>(name); 225 225 226 226 /*Assign output pointer: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
r10544 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../ModelProcessorx.h" … … 87 87 88 88 /*figure out times: */ 89 timesx= (double*)xmalloc(Nx*sizeof(double));89 timesx=xNew<double>(Nx); 90 90 for(j=0;j<Nx;j++){ 91 91 timesx[j]=spcvx[(Mx-1)*Nx+j]; … … 94 94 UnitConversion(timesx,Nx,ExtToIuEnum,TimeEnum); 95 95 /*figure out times: */ 96 timesy= (double*)xmalloc(Ny*sizeof(double));96 timesy=xNew<double>(Ny); 97 97 for(j=0;j<Ny;j++){ 98 98 timesy[j]=spcvy[(My-1)*Ny+j]; … … 101 101 UnitConversion(timesy,Ny,ExtToIuEnum,TimeEnum); 102 102 /*figure out times: */ 103 timesz= (double*)xmalloc(Nz*sizeof(double));103 timesz=xNew<double>(Nz); 104 104 for(j=0;j<Nz;j++){ 105 105 timesz[j]=spcvz[(Mz-1)*Nz+j]; … … 107 107 /*unit conversion: */ 108 108 UnitConversion(timesz,Nz,ExtToIuEnum,TimeEnum); 109 110 109 111 110 /*Create spcs from x,y,z, as well as the spc values on those spcs: */ … … 121 120 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. 122 121 count++; 123 if (! isnan(spcvx[i])){122 if (!xIsNan<IssmDouble>(spcvx[i])){ 124 123 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. 125 124 count++; 126 125 } 127 if (! isnan(spcvy[i])){126 if (!xIsNan<IssmDouble>(spcvy[i])){ 128 127 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. 129 128 count++; … … 136 135 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. 137 136 count++; 138 if (! isnan(spcvx[i])){137 if (!xIsNan<IssmDouble>(spcvx[i])){ 139 138 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. 140 139 count++; 141 140 } 142 if (! isnan(spcvy[i])){141 if (!xIsNan<IssmDouble>(spcvy[i])){ 143 142 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. 144 143 count++; … … 146 145 147 146 } 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"); 149 148 } 150 149 /*Also add spcs of coupling: zero at the border pattyn/stokes for the appropriate dofs*/ … … 158 157 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. 159 158 count++; 160 if (! isnan(spcvx[i])){159 if (!xIsNan<IssmDouble>(spcvx[i])){ 161 160 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. 162 161 count++; 163 162 } 164 if (! isnan(spcvy[i])){163 if (!xIsNan<IssmDouble>(spcvy[i])){ 165 164 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. 166 165 count++; … … 173 172 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. 174 173 count++; 175 if (! isnan(spcvx[i])){174 if (!xIsNan<IssmDouble>(spcvx[i])){ 176 175 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. 177 176 count++; 178 177 } 179 if (! isnan(spcvy[i])){178 if (!xIsNan<IssmDouble>(spcvy[i])){ 180 179 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. 181 180 count++; 182 181 } 183 if (! isnan(spcvz[i])){182 if (!xIsNan<IssmDouble>(spcvz[i])){ 184 183 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. 185 184 count++; 186 185 } 187 186 } 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"); 189 188 } 190 189 /*Also add spcs of coupling: zero at the border pattyn/stokes for the appropriate dofs*/ … … 198 197 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. 199 198 count++; 200 if (! isnan(spcvx[i])){199 if (!xIsNan<IssmDouble>(spcvx[i])){ 201 200 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. 202 201 count++; 203 202 } 204 if (! isnan(spcvy[i])){203 if (!xIsNan<IssmDouble>(spcvy[i])){ 205 204 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. 206 205 count++; … … 213 212 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. 214 213 count++; 215 if (! isnan(spcvx[i])){214 if (!xIsNan<IssmDouble>(spcvx[i])){ 216 215 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. 217 216 count++; 218 217 } 219 if (! isnan(spcvy[i])){218 if (!xIsNan<IssmDouble>(spcvy[i])){ 220 219 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. 221 220 count++; 222 221 } 223 if (! isnan(spcvz[i])){222 if (!xIsNan<IssmDouble>(spcvz[i])){ 224 223 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. 225 224 count++; 226 225 } 227 226 } 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"); 229 228 } 230 229 /*Now add the regular spcs*/ 231 230 else{ 232 if (Mx==numberofvertices && ! isnan(spcvx[i])){231 if (Mx==numberofvertices && !xIsNan<IssmDouble>(spcvx[i])){ 233 232 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. 234 233 count++; … … 236 235 else if (Mx==numberofvertices+1) { 237 236 /*figure out times and values: */ 238 values= (double*)xmalloc(Nx*sizeof(double));237 values=xNew<double>(Nx); 239 238 spcpresent=false; 240 239 for(j=0;j<Nx;j++){ 241 240 values[j]=spcvx[i*Nx+j]/yts; 242 if(! isnan(values[j]))spcpresent=true; //NaN means no spc by default241 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 243 242 } 244 243 … … 247 246 count++; 248 247 } 249 x free((void**)&values);248 xDelete<double>(values); 250 249 } 251 250 else if (vertices_type[i]==HutterApproximationEnum){ … … 254 253 } 255 254 256 if (My==numberofvertices && ! isnan(spcvy[i])){255 if (My==numberofvertices && !xIsNan<IssmDouble>(spcvy[i])){ 257 256 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. 258 257 count++; … … 260 259 else if (My==numberofvertices+1){ 261 260 /*figure out times and values: */ 262 values= (double*)xmalloc(Ny*sizeof(double));261 values=xNew<double>(Ny); 263 262 spcpresent=false; 264 263 for(j=0;j<Ny;j++){ 265 264 values[j]=spcvy[i*Ny+j]/yts; 266 if(! isnan(values[j]))spcpresent=true; //NaN means no spc by default265 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 267 266 } 268 267 if(spcpresent){ … … 270 269 count++; 271 270 } 272 x free((void**)&values);271 xDelete<double>(values); 273 272 } 274 273 else if (vertices_type[i]==HutterApproximationEnum){ … … 278 277 279 278 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])){ 281 280 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 282 281 count++; … … 284 283 else if (Mz==numberofvertices+1){ 285 284 /*figure out times and values: */ 286 values= (double*)xmalloc(Nz*sizeof(double));285 values=xNew<double>(Nz); 287 286 spcpresent=false; 288 287 for(j=0;j<Nz;j++){ 289 288 values[j]=spcvz[i*Nz+j]/yts; 290 if(! isnan(values[j]))spcpresent=true; //NaN means no spc by default289 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 291 290 } 292 291 if(spcpresent){ … … 294 293 count++; 295 294 } 296 x free((void**)&values);295 xDelete<double>(values); 297 296 } 298 297 … … 319 318 count++; 320 319 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"); 322 321 } 323 322 } … … 326 325 327 326 /*Free data: */ 328 x free((void**)&spcvx);329 x free((void**)&spcvy);330 x free((void**)&spcvz);331 x free((void**)&nodeonmacayeal);332 x free((void**)&nodeonpattyn);333 x free((void**)&nodeonstokes);334 x free((void**)&nodeonicesheet);335 x free((void**)&nodeonbed);336 x free((void**)&vertices_type);337 x free((void**)&surface);338 x free((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); 339 338 340 339 /*Free resources:*/ 341 x free((void**)×x);342 x free((void**)×y);343 x free((void**)×z);344 x free((void**)&values);340 xDelete<double>(timesx); 341 xDelete<double>(timesy); 342 xDelete<double>(timesz); 343 xDelete<double>(values); 345 344 346 345 /*Assign output pointer: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" … … 120 120 /*Free data: */ 121 121 iomodel->DeleteData(3,DiagnosticIcefrontEnum,ThicknessEnum,BedEnum); 122 x free((void**)&elements_type);123 x free((void**)&pressureload);122 xDelete<double>(elements_type); 123 xDelete<double>(pressureload); 124 124 125 125 /*Create Penpair for penalties: */ … … 144 144 145 145 /*free ressources: */ 146 x free((void**)&penalties);146 xDelete<double>(penalties); 147 147 148 148 /*Create Riffront loads for rifts: */ … … 157 157 } 158 158 iomodel->DeleteData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskVertexonfloatingiceEnum); 159 x free((void**)&riftfront);159 xDelete<Riftfront>(riftfront); 160 160 } 161 161 -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp
r10522 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
r11577 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp
r10522 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../ModelProcessorx.h" … … 60 60 } 61 61 else{ 62 if (! isnan(iomodel->Data(DiagnosticSpcvxEnum)[i])){62 if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvxEnum)[i])){ 63 63 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. 64 64 count++; 65 65 } 66 66 67 if (! isnan(iomodel->Data(DiagnosticSpcvyEnum)[i])){67 if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvyEnum)[i])){ 68 68 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 69 69 count++; -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp
r11001 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticHutter/UpdateElementsDiagnosticHutter.cpp
r9733 r12878 8 8 #include "../../../modules/modules.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp
r11197 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../ModelProcessorx.h" … … 56 56 count++; 57 57 } 58 else if (! isnan(iomodel->Data(DiagnosticSpcvzEnum)[i])){58 else if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvzEnum)[i])){ 59 59 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1, 60 60 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 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticVert/CreateNodesDiagnosticVert.cpp
r10522 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DiagnosticVert/UpdateElementsDiagnosticVert.cpp
r11577 r12878 8 8 #include "../../../modules/modules.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/DistributeNumDofs.cpp
r9218 r12878 7 7 #include "../../EnumDefinitions/EnumDefinitions.h" 8 8 9 void DistributeNumDofs(DofIndexing* index,int analysis_type, double* vertices_type){9 void DistributeNumDofs(DofIndexing* index,int analysis_type,IssmDouble* vertices_type){ 10 10 11 11 /*For now, we distribute by analysis_type, later, we will distribute using the analysis_type, … … 35 35 else if (vertices_type[0]==MacAyealPattynApproximationEnum){ 36 36 numdofs=4; 37 doftype= (int*)xmalloc(numdofs*sizeof(int));37 doftype=xNew<int>(numdofs); 38 38 doftype[0]=MacAyealApproximationEnum; 39 39 doftype[1]=MacAyealApproximationEnum; … … 43 43 else if (vertices_type[0]==PattynStokesApproximationEnum){ 44 44 numdofs=6; 45 doftype= (int*)xmalloc(numdofs*sizeof(int));45 doftype=xNew<int>(numdofs); 46 46 doftype[0]=PattynApproximationEnum; 47 47 doftype[1]=PattynApproximationEnum; … … 53 53 else if (vertices_type[0]==MacAyealStokesApproximationEnum){ 54 54 numdofs=6; 55 doftype= (int*)xmalloc(numdofs*sizeof(int));55 doftype=xNew<int>(numdofs); 56 56 doftype[0]=MacAyealApproximationEnum; 57 57 doftype[1]=MacAyealApproximationEnum; … … 61 61 doftype[5]=StokesApproximationEnum; 62 62 } 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"); 64 64 } 65 65 else if (analysis_type==DiagnosticVertAnalysisEnum){ … … 90 90 numdofs=1; 91 91 } 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"); 93 93 94 94 /*Now initialize the index*/ … … 96 96 97 97 /*Clean up*/ 98 x free((void**)&doftype);98 xDelete<int>(doftype); 99 99 } -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
r12168 r12878 10 10 11 11 #include <string.h> 12 #include "../../ objects/objects.h"12 #include "../../classes/objects/objects.h" 13 13 #include "../../shared/shared.h" 14 14 #include "../../EnumDefinitions/EnumDefinitions.h" … … 42 42 int el1,el2; 43 43 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; 48 48 49 49 /*Fetch parameters: */ … … 76 76 77 77 /*Free elements and elements2d: */ 78 x free((void**)&elements);79 x free((void**)&elements2d);78 xDelete<IssmDouble>(elements); 79 xDelete<IssmDouble>(elements2d); 80 80 81 81 /*Deal with rifts, they have to be included into one partition only, not several: */ … … 83 83 iomodel->FetchData(&riftinfo,&numrifts,NULL,RiftsRiftstructEnum); 84 84 for(i=0;i<numrifts;i++){ 85 el1= (int)*(riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing86 el2= (int)*(riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing85 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 87 87 epart[el2]=epart[el1]; //ensures that this pair of elements will be in the same partition, as well as the corresponding vertices; 88 88 } 89 x free((void**)&riftinfo);89 xDelete<IssmDouble>(riftinfo); 90 90 } 91 91 92 92 /*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); 95 95 96 96 /*Start figuring out, out of the partition, which elements belong to this cpu: */ … … 107 107 into the vertices coordinates. If we start plugging 1 into my_vertices for each index[n][i] (i=0:2), then my_vertices 108 108 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; 112 112 113 113 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; 117 117 } 118 118 } 119 119 }//for (i=0;i<numberofelements;i++) 120 120 /*Free data : */ 121 x free((void**)&elements);121 xDelete<IssmDouble>(elements); 122 122 123 123 /*We might have vertex_pairing in which case, some vertices have to be cloned: … … 126 126 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,DiagnosticVertexPairingEnum); 127 127 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 partition128 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 130 130 } 131 131 } 132 x free((void**)&vertex_pairing);132 xDelete<IssmDouble>(vertex_pairing); 133 133 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,PrognosticVertexPairingEnum); 134 134 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 partition135 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 137 137 } 138 138 } 139 x free((void**)&vertex_pairing);139 xDelete<IssmDouble>(vertex_pairing); 140 140 141 141 /*Free ressources:*/ 142 x free((void**)&npart);143 x free((void**)&epart);142 xDelete<int>(npart); 143 xDelete<int>(epart); 144 144 145 145 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp
r11270 r12878 7 7 #include "../../../toolkits/toolkits.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 #include "../../../include/include.h" 11 12 #include "../ModelProcessorx.h" 12 13 … … 14 15 15 16 /*Intermediary*/ 16 int i;17 int count;17 int i,j; 18 int count; 18 19 int dim; 20 int M,N; 19 21 int numberofvertices; 22 bool spcpresent=false; 20 23 double heatcapacity; 21 24 double referencetemperature; 22 25 23 26 /*Output*/ 27 IssmDouble *spcvector = NULL; 28 IssmDouble* times=NULL; 29 IssmDouble* values=NULL; 24 30 Constraints* constraints = NULL; 25 SpcStatic* spcstatic = NULL;26 31 27 32 /*Fetch parameters: */ … … 44 49 45 50 /*Fetch data: */ 46 double *spctemperature=NULL; 47 iomodel->FetchData(&spctemperature,NULL,NULL,ThermalSpctemperatureEnum); 51 iomodel->FetchData(&spcvector,&M,&N,ThermalSpctemperatureEnum); 48 52 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; 51 58 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])){ 56 62 57 if (!isnan(spctemperature[i])){63 if (!xIsNan<IssmDouble>(spcvector[i])){ 58 64 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++; 61 67 68 } 62 69 } 63 70 } 64 71 } 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; 65 76 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 69 116 /*Assign output pointer: */ 70 117 *pconstraints=constraints; -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/CreateLoadsEnthalpy.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/CreateNodesEnthalpy.cpp
r10522 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../include/include.h" 11 11 #include "../../../shared/shared.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp
r11261 r12878 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 9 #include "../../../modules/modules.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/CreateConstraintsHydrology.cpp
r10522 r12878 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 9 #include "../../../io/io.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../ModelProcessorx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/CreateLoadsHydrology.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp
r10522 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../include/include.h" 11 11 #include "../../../shared/shared.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp
r9733 r12878 8 8 #include "../../../modules/modules.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/CreateConstraintsMelting.cpp
r10522 r12878 7 7 #include "../../../toolkits/toolkits.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../ModelProcessorx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" … … 26 26 27 27 /*if 2d: Error*/ 28 if (dim==2) _error _("2d meshes not supported yet");28 if (dim==2) _error2_("2d meshes not supported yet"); 29 29 30 30 /*Recover pointer: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/CreateNodesMelting.cpp
r10522 r12878 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 9 #include "../../../include/include.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Melting/UpdateElementsMelting.cpp
r11577 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
r11684 r12878 9 9 #endif 10 10 11 #include "../../ objects/objects.h"11 #include "../../classes/objects/objects.h" 12 12 #include "../../shared/shared.h" 13 13 #include "../../io/io.h" … … 68 68 if(solution_type==SteadystateSolutionEnum && analysis_type==EnthalpyAnalysisEnum && isenthalpy==false) continue; 69 69 70 _printf_(VerboseMProcessor()," creating datasets for analysis %s\n",EnumToStringx(analysis_type));70 if(VerboseMProcessor()) _pprintLine_(" creating datasets for analysis " << EnumToStringx(analysis_type)); 71 71 CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,¶meters,iomodel,solution_type,analysis_type,nummodels,i); 72 72 } -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/ModelProcessorx.h
r10576 r12878 108 108 109 109 /*Distribution of dofs: */ 110 void DistributeNumDofs(DofIndexing* index,int analysis_type, double* vertices_type);110 void DistributeNumDofs(DofIndexing* index,int analysis_type,IssmDouble* vertices_type); 111 111 112 112 #endif -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
r9733 r12878 10 10 11 11 #include <string.h> 12 #include "../../ objects/objects.h"12 #include "../../classes/objects/objects.h" 13 13 #include "../../shared/shared.h" 14 14 #include "../../EnumDefinitions/EnumDefinitions.h" … … 24 24 25 25 /*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 x free((void**)pmy_nodes);26 xDelete<bool>(*pmy_nodes); 27 27 28 28 /*Now, depending on whether we are running galerkin discontinous or continuous elements, carry out a different partition of the nodes: */ … … 44 44 iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum); 45 45 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]; 48 48 49 49 /*Assign output pointers:*/ … … 69 69 bool* my_nodes=NULL; 70 70 71 int 72 int 73 doublee1,e2;74 int 75 int 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; 78 78 79 79 /*Fetch parameters: */ … … 90 90 91 91 /*Allocate*/ 92 my_nodes= (bool*)xcalloc(3*numberofelements,sizeof(int));92 my_nodes=xNewZeroInit<bool>(3*numberofelements); 93 93 94 94 /*First: add all the nodes of all the elements belonging to this cpu*/ … … 96 96 for (i=0;i<numberofelements;i++){ 97 97 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; 101 101 } 102 102 } 103 103 } 104 104 else{ 105 _error _("not implemented yet");105 _error2_("not implemented yet"); 106 106 } 107 107 … … 111 111 iomodel->FetchData(&edges,&numberofedges,&cols,MeshEdgesEnum); 112 112 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"); 114 114 115 115 /*!All elements have been partitioned above, only create elements for this CPU: */ … … 125 125 * we must clone the nodes on this partition so that the loads (Numericalflux) 126 126 * 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]){ 128 128 129 129 /*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]; 132 132 133 133 /*2: Get the column where these ids are located in the index*/ 134 134 pos=UNDEF; 135 135 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; 137 137 } 138 138 … … 140 140 * we can now create the corresponding nodes:*/ 141 141 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; 144 144 } 145 145 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; 148 148 } 149 149 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; 152 152 } 153 153 else{ 154 _error _("Problem in edges creation");154 _error2_("Problem in edges creation"); 155 155 } 156 156 } … … 158 158 159 159 /*Free data: */ 160 x free((void**)&elements);161 x free((void**)&edges);160 xDelete<int>(elements); 161 xDelete<int>(edges); 162 162 163 163 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
r10522 r12878 4 4 #include "../../../EnumDefinitions/EnumDefinitions.h" 5 5 #include "../../../io/io.h" 6 #include "../../../ objects/objects.h"6 #include "../../../classes/objects/objects.h" 7 7 #include "../../../shared/shared.h" 8 8 #include "../ModelProcessorx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" … … 47 47 48 48 /*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] 50 50 51 51 /*Now, if this element is not in the partition, pass: */ … … 61 61 62 62 /*Create Penpair for vertex_pairing: */ 63 double *vertex_pairing=NULL;64 double *nodeonbed=NULL;63 IssmDouble *vertex_pairing=NULL; 64 IssmDouble *nodeonbed=NULL; 65 65 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,PrognosticVertexPairingEnum); 66 66 iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum); … … 68 68 for(i=0;i<numvertex_pairing;i++){ 69 69 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]){ 71 71 72 72 /*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]); 74 74 75 75 /*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; 77 77 78 78 /*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]); 81 81 82 82 /*Create Load*/ … … 90 90 91 91 /*free ressources: */ 92 xfree((void**)&vertex_pairing); 93 xfree((void**)&nodeonbed); 94 92 xDelete<IssmDouble>(vertex_pairing); 93 xDelete<IssmDouble>(nodeonbed); 95 94 96 95 /*Assign output pointer: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp
r10522 r12878 6 6 #include "../../../toolkits/toolkits.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../io/io.h" … … 46 46 47 47 /*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"); 49 49 50 50 /*First fetch data: */ … … 72 72 73 73 //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) 75 75 io_index=vertex_id-1; //(C indexing) 76 76 _assert_(vertex_id>0 && vertex_id<=numberofvertices); -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
r12004 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" … … 20 20 int stabilization; 21 21 bool dakota_analysis; 22 bool issmbgradients; 23 bool ispdd; 24 bool isdelta18o; 25 IssmDouble *size, Delta18oTimeSerie,Delta18oSurfaceTimeSerie ; 22 26 23 27 /*Fetch data needed: */ … … 26 30 iomodel->Constant(&stabilization,PrognosticStabilizationEnum); 27 31 iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum); 32 iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum); 33 iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum); 34 iomodel->Constant(&issmbgradients,SurfaceforcingsIssmbgradientsEnum); 28 35 iomodel->FetchData(1,MeshElementsEnum); 29 36 … … 44 51 iomodel->FetchDataToInput(elements,MaskElementonfloatingiceEnum); 45 52 iomodel->FetchDataToInput(elements,MaskElementonwaterEnum); 46 iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);47 53 iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum); 48 54 iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateCorrectionEnum); … … 66 72 iomodel->FetchDataToInput(elements,TemperatureEnum); 67 73 } 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 } 68 98 69 99 /*Free data: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SortDataSets.cpp
r9320 r12878 9 9 #endif 10 10 11 #include "../../ objects/objects.h"11 #include "../../classes/objects/objects.h" 12 12 #include "../../shared/shared.h" 13 13 #include "../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/CreateConstraintsSurfaceSlope.cpp
r10522 r12878 7 7 #include "../../../toolkits/toolkits.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../ModelProcessorx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/CreateLoadsSurfaceSlope.cpp
r10522 r12878 6 6 #include "../../../toolkits/toolkits.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/CreateNodesSurfaceSlope.cpp
r10522 r12878 7 7 #include "../../../toolkits/toolkits.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 11 #include "../../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/SurfaceSlope/UpdateElementsSurfaceSlope.cpp
r9733 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp
r10522 r12878 8 8 #include "../../../toolkits/toolkits.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../ModelProcessorx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
r10522 r12878 6 6 #include "../../../io/io.h" 7 7 #include "../../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../../ objects/objects.h"8 #include "../../../classes/objects/objects.h" 9 9 #include "../../../shared/shared.h" 10 10 #include "../../../include/include.h" … … 33 33 34 34 /*return if 2d mesh*/ 35 if (dim==2) _error _("2d meshes not supported yet");35 if (dim==2) _error2_("2d meshes not supported yet"); 36 36 37 37 //create penalties for nodes: no node can have a temperature over the melting point … … 43 43 /*keep only this partition's nodes:*/ 44 44 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! 46 46 loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,ThermalAnalysisEnum)); 47 47 } -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp
r10522 r12878 7 7 #include "../../../io/io.h" 8 8 #include "../../../EnumDefinitions/EnumDefinitions.h" 9 #include "../../../ objects/objects.h"9 #include "../../../classes/objects/objects.h" 10 10 #include "../../../include/include.h" 11 11 #include "../../../shared/shared.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp
r10653 r12878 8 8 #include "../../../io/io.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp
r9340 r12878 8 8 #include "../../../modules/modules.h" 9 9 #include "../../../EnumDefinitions/EnumDefinitions.h" 10 #include "../../../ objects/objects.h"10 #include "../../../classes/objects/objects.h" 11 11 #include "../../../shared/shared.h" 12 12 #include "../../MeshPartitionx/MeshPartitionx.h" … … 15 15 16 16 void UpdateElementsTransient(Elements* elements, Parameters* parameters,IoModel* iomodel,int analysis_counter,int analysis_type){ 17 18 /*nothing for now: */19 20 17 } -
issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/UpdateCounters.cpp
r9320 r12878 9 9 #endif 10 10 11 #include "../../ objects/objects.h"11 #include "../../classes/objects/objects.h" 12 12 #include "../../shared/shared.h" 13 13 #include "../../include/include.h" -
issm/branches/trunk-jpl-damage/src/c/modules/NodalValuex/NodalValuex.cpp
r12168 r12878 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 void NodalValuex( double* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units){12 void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units){ 13 13 14 14 extern int my_rank; … … 16 16 int index; 17 17 Element* element=NULL; 18 double value;18 IssmDouble value; 19 19 int found; 20 20 int sumfound; … … 38 38 #ifdef _HAVE_MPI_ 39 39 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)); 41 41 #endif 42 42 -
issm/branches/trunk-jpl-damage/src/c/modules/NodalValuex/NodalValuex.h
r9206 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ 12 void NodalValuex( double* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units);12 void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units); 13 13 14 14 #endif /* _NODALVALUEX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp
r6412 r12878 37 37 38 38 /*Allocate connectivity: */ 39 connectivity= (double*)xcalloc(nods*width,sizeof(double));39 connectivity=xNewZeroInit<double>(nods*width); 40 40 41 41 /*Go through all elements, and for each elements, plug into the connectivity, all the nodes. … … 71 71 * warn the user to increase the connectivity width: */ 72 72 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"); 74 74 } 75 75 -
issm/branches/trunk-jpl-damage/src/c/modules/NodesDofx/NodesDofx.h
r4236 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Orthx/Orthx.h
r11708 r12878 6 6 #define _ORTHX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../include/include.h" 10 10 #include "../../shared/shared.h" -
issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.cpp
r12168 r12878 14 14 #include "../../Container/Container.h" 15 15 #include "../../io/io.h" 16 #include "../../ objects/objects.h"16 #include "../../classes/objects/objects.h" 17 17 18 void OutputResultsx( 18 void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){ 19 19 20 20 extern int my_rank; … … 46 46 EnumToStringx(&solutiontypestring,solutiontype); 47 47 results->AddObject(new StringExternalResult(results->Size()+1,SolutionTypeEnum,solutiontypestring,1,0)); 48 x free((void**)&solutiontypestring);48 xDelete<char>(solutiontypestring); 49 49 } 50 50 … … 68 68 fid=pfopen(cpu_outputfilename ,"wb"); 69 69 } 70 x free((void**)&outputfilename);70 xDelete<char>(outputfilename); 71 71 72 72 /*Add file pointer in parameters for further calls to OutputResultsx: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp
r12168 r12878 10 10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 11 11 #endif 12 13 #include <cstring> 12 14 13 15 #include "./ParsePetscOptionsx.h" … … 25 27 26 28 /*intermediary: */ 27 double* analyses=NULL;29 IssmDouble* analyses=NULL; 28 30 char** strings=NULL; 29 31 int numanalyses; … … 46 48 47 49 /*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); 50 52 for(i=0;i<numanalyses;i++)strings[i]=NULL; 51 53 … … 68 70 to the already existing options*/ 69 71 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)); 72 74 73 75 strings[numanalyses-1]=string; … … 75 77 else{ 76 78 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)); 79 81 80 82 /*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)); 83 85 84 86 strcat(catstring," "); 85 87 strcat(catstring,newstring); 86 88 strings[numanalyses-1]=catstring; 87 x free((void**)&newstring);88 x free((void**)&string);89 xDelete<char>(newstring); 90 xDelete<char>(string); 89 91 } 90 92 } … … 96 98 MPI_Bcast(&numanalyses,1,MPI_INT,0,MPI_COMM_WORLD); 97 99 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); 100 102 } 101 103 MPI_Bcast(analyses,numanalyses,MPI_DOUBLE,0,MPI_COMM_WORLD); … … 104 106 char* string=strings[i]; 105 107 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"); 107 109 } 108 110 if(my_rank==0)stringlength=(strlen(string)+1)*sizeof(char); 109 111 #ifdef _HAVE_MPI_ 110 112 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); 112 114 MPI_Bcast(string,stringlength,MPI_CHAR,0,MPI_COMM_WORLD); 113 115 if(my_rank!=0)strings[i]=string; … … 120 122 121 123 /*Clean up and return*/ 122 for(i=0;i<numanalyses;i++) x free((void**)&strings[i]);123 x free((void**)&strings);124 x free((void**)&analyses);124 for(i=0;i<numanalyses;i++) xDelete<char>(strings[i]); 125 xDelete<char*>(strings); 126 xDelete<IssmDouble>(analyses); 125 127 return; 126 128 } 127 -
issm/branches/trunk-jpl-damage/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.h
r8330 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.h
r11708 r12878 8 8 9 9 #include "../../shared/shared.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp
r11708 r12878 39 39 40 40 /*allocate: */ 41 already= (bool*)xcalloc(nods,sizeof(bool));41 already=xNewZeroInit<bool>(nods); 42 42 43 43 /*partition loop across threads: */ … … 45 45 46 46 /*Loop over the nodes*/ 47 if (my_thread==0) printf(" loop progress: %5.2lf %%",0.0);48 49 47 for (i=i0;i<i1;i++){ 50 48 51 49 /*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<<"%"); 53 52 54 53 distance=mindistance+100; //make sure initialization respects min distance criterion. … … 70 69 } 71 70 } 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.<<"%"); 73 73 74 74 /*Free ressources:*/ 75 x free((void**)&already);75 xDelete<bool>(already); 76 76 77 77 return NULL; -
issm/branches/trunk-jpl-damage/src/c/modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp
r12168 r12878 23 23 24 24 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 day27 double siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm28 double signormc; // sigma of the temperature distribution for cloudy day29 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; 31 31 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 snow35 double PDup, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)36 double tstar; // monthly mean surface temp32 //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 37 37 38 double* pdds=NULL;39 double* pds=NULL;38 IssmDouble* pdds=NULL; 39 IssmDouble* pds=NULL; 40 40 Element* element = NULL; 41 41 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); 48 44 49 45 // initialize PDD (creation of a lookup table) … … 53 49 snormfac = 1.0/(signorm*sqrt(2.0*acos(-1.0))); 54 50 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)); 56 57 57 58 if (itm >= NPDMAX){ 58 printf("increase NPDMAX in massBalance.cpp\n");59 _printLine_("increase NPDMAX in massBalance.cpp"); 59 60 exit (1); 60 61 } … … 63 64 tstar = it*DT-siglim; 64 65 tint = tsint; 65 pddt = 0 ;66 pddt = 0.; 66 67 for ( jj = 0; jj < 600; jj++){ 67 68 if (tint > (tstar+siglim)){break;} … … 80 81 snormfac = 1.0/(signormc*sqrt(2.0*acos(-1.0))); 81 82 siglimc = 2.5*signormc ; 82 itm = (int)((PDCUT+2.*siglimc)/DT + 1.5);83 itm = reCast<int,IssmDouble>((PDCUT+2.*siglimc)/DT + 1.5); 83 84 if (itm >= NPDCMAX){ 84 printf("'increase NPDCMAX in p35com'\n");85 _printLine_("'increase NPDCMAX in p35com'"); 85 86 exit (1); 86 87 } … … 89 90 // tstar = REAL(it)*DT-siglimc; 90 91 tint = tsint; // start against upper bound 91 pd = 0 ;92 pd = 0.; 92 93 for (jj = 0; jj < 600; jj++){ 93 94 if (tint<(tstar-siglimc)) {break;} … … 97 98 pds[it] = pd*snormfac; // gaussian integral lookup table for snow fraction 98 99 } 99 pds[itm+1] = 0 ;100 pds[itm+1] = 0.; 100 101 // *******END initialize PDD 101 102 … … 105 106 } 106 107 /*free ressouces: */ 107 x free((void**)&pdds);108 x free((void**)&pds);108 xDelete<IssmDouble>(pdds); 109 xDelete<IssmDouble>(pds); 109 110 110 111 } -
issm/branches/trunk-jpl-damage/src/c/modules/PositiveDegreeDayx/PositiveDegreeDayx.h
r11577 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Reduceloadx/Reduceloadx.cpp
r11708 r12878 22 22 int verbose; 23 23 24 _printf_(VerboseModule()," Dirichlet lifting applied to load vector\n");24 if(VerboseModule()) _pprintLine_(" Dirichlet lifting applied to load vector"); 25 25 26 26 Kfs->GetSize(&global_m,&global_n); -
issm/branches/trunk-jpl-damage/src/c/modules/Reduceloadx/Reduceloadx.h
r11684 r12878 6 6 #define _REDUCELOADX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp
r11684 r12878 15 15 int configuration_type; 16 16 int fsize; 17 double* ug_serial=NULL;17 IssmDouble* ug_serial=NULL; 18 18 19 19 /*first figure out fsize: */ … … 51 51 52 52 /*Free ressources:*/ 53 x free((void**)&ug_serial);53 xDelete<IssmDouble>(ug_serial); 54 54 55 55 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h
r11684 r12878 7 7 #define _REDUCEVECTORGTOFX_H 8 8 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp
r11684 r12878 51 51 52 52 /*Free ressources:*/ 53 x free((void**)&yg_serial);53 xDelete<double>(yg_serial); 54 54 55 55 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h
r11684 r12878 7 7 #define _REDUCEVECTORGTOSX_H 8 8 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.cpp
r12004 r12878 13 13 int output_enum; 14 14 int step; 15 double time;16 double output_value;15 IssmDouble time; 16 IssmDouble output_value; 17 17 Element *element = NULL; 18 18 … … 32 32 results->AddObject(new DoubleExternalResult(results->Size()+1,IceVolumeEnum,output_value,step,time)); 33 33 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; 34 38 default: 35 39 /*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 22 22 23 23 /*Display message*/ 24 _printf_(VerboseModule()," Resetting penalties\n");24 if(VerboseModule()) _pprintLine_(" Resetting penalties"); 25 25 26 26 /*recover parameters: */ … … 30 30 * management routine, otherwise, skip : */ 31 31 if (RiftIsPresent(loads,analysis_type)){ 32 _error _("rift constraints reset not supported yet!");32 _error2_("rift constraints reset not supported yet!"); 33 33 } 34 34 else if(ThermalIsPresent(loads,analysis_type)){ -
issm/branches/trunk-jpl-damage/src/c/modules/ResetConstraintsx/ResetConstraintsx.h
r9127 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h
r10440 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Responsex/Responsex.cpp
r11202 r12878 16 16 #include "../modules.h" 17 17 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){18 void 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){ 19 19 20 20 switch (StringToEnumx(response_descriptor)){ … … 41 41 case ThicknessAbsMisfitEnum: ThicknessAbsMisfitx( responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; 42 42 case ThicknessAbsGradientEnum: ThicknessAbsGradientx( responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; 43 case TotalSmbEnum: TotalSmbx( responses, elements,nodes, vertices, loads, materials, parameters,process_units); break; 43 44 case RheologyBbarAbsGradientEnum:RheologyBbarAbsGradientx( responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; 44 45 case DragCoefficientAbsGradientEnum:DragCoefficientAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; … … 46 47 case VelEnum:ElementResponsex(responses, elements,nodes, vertices, loads, materials, parameters,VelEnum,process_units); break; 47 48 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; 49 50 #else 50 default: _error _("ISSM was not compiled with responses capabilities, exiting!");51 default: _error2_("ISSM was not compiled with responses capabilities, exiting!"); 51 52 #endif 52 53 } -
issm/branches/trunk-jpl-damage/src/c/modules/Responsex/Responsex.h
r11202 r12878 6 6 #define _RESPONSESX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 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);11 void 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); 12 12 13 13 #endif /* _RESPONSESXX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h
r8608 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Scotchx/Scotchx.h
r9320 r12878 20 20 21 21 #include "../../Container/Container.h" 22 #include "../../ objects/objects.h"22 #include "../../classes/objects/objects.h" 23 23 24 24 #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 25 25 } 26 26 27 x free((void**)&control_type);27 xDelete<int>(control_type); 28 28 } 29 29 … … 37 37 38 38 /*Free ressources:*/ 39 x free((void**)&serial_vector);39 xDelete<double>(serial_vector); 40 40 } -
issm/branches/trunk-jpl-damage/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.h
r11708 r12878 5 5 #define _SETCONTROLINPUTSXFROMVECTOR_H 6 6 7 #include "../../ objects/objects.h"7 #include "../../classes/objects/objects.h" 8 8 #include "../../Container/Container.h" 9 9 -
issm/branches/trunk-jpl-damage/src/c/modules/Shp2Kmlx/Shp2Kmlx.cpp
r11401 r12878 39 39 int nshape,ncoord; 40 40 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; 44 44 45 45 SHPHandle hSHP; … … 49 49 50 50 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; 65 64 66 65 clock_t clock0,clock1; … … 69 68 clock0=clock(); 70 69 time0 =time(NULL); 71 _p rintf_(true,"\nShp2Kmlx Module -- %s",ctime(&time0));70 _pprintString_("\nShp2Kmlx Module -- " << ctime(&time0)); 72 71 73 72 /* note that much of the following code is taken from shpdump.c in shapelib. */ … … 76 75 77 76 hSHP = SHPOpen( filshp, "rb" ); 78 if (!hSHP) _error _("Error opening shp/shx files.");77 if (!hSHP) _error2_("Error opening shp/shx files."); 79 78 80 79 /* read header and print out file bounds */ … … 97 96 98 97 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); 108 107 109 108 /* loop over the list of shapes */ … … 129 128 pnpart[i]=psShape->nParts; 130 129 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]); 133 132 } 134 133 else { … … 138 137 pnvert[i]=psShape->nVertices; 139 138 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]); 144 143 } 145 144 else { … … 296 295 kpoint=new KML_Point(); 297 296 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]); 300 299 if (sgn) { 301 300 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 310 309 kpoint->coords[2]=pshapz[i][0]; 311 310 312 x free((void**)&lon);313 x free((void**)&lat);311 xDelete<double>(lon); 312 xDelete<double>(lat); 314 313 315 314 (kplace->geometry )->AddObject((Object*)kpoint); … … 337 336 /* convert to lat/lon, if necessary */ 338 337 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]); 341 340 if (sgn) { 342 341 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 353 352 354 353 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); 356 355 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]; 360 359 } 361 362 360 (kmulti->geometry )->AddObject((Object*)kline); 363 kline = NULL;364 } 365 366 x free((void**)&lon);367 x free((void**)&lat);368 369 (kplace->geometry 361 kline = NULL; 362 } 363 364 xDelete<double>(lon); 365 xDelete<double>(lat); 366 367 (kplace->geometry)->AddObject((Object*)kmulti); 370 368 kmulti=NULL; 371 (kfold ->feature 369 (kfold ->feature )->AddObject((Object*)kplace); 372 370 kplace=NULL; 373 371 } … … 401 399 /* convert to lat/lon, if necessary */ 402 400 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]); 405 403 if (sgn) { 406 404 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 438 436 439 437 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); 441 439 if (cpsum < 0) 442 440 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]; 446 444 } 447 445 else 448 446 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]; 452 450 } 453 451 … … 470 468 471 469 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); 473 471 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]; 477 475 } 478 476 … … 487 485 } 488 486 489 x free((void**)&lon);490 x free((void**)&lat);487 xDelete<double>(lon); 488 xDelete<double>(lat); 491 489 492 490 (kplace->geometry )->AddObject((Object*)kmulti); … … 518 516 /* convert to lat/lon, if necessary */ 519 517 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]); 522 520 if (sgn) { 523 521 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 541 539 } 542 540 543 x free((void**)&lon);544 x free((void**)&lat);541 xDelete<double>(lon); 542 xDelete<double>(lat); 545 543 546 544 (kplace->geometry )->AddObject((Object*)kmulti); … … 575 573 /* write kml file */ 576 574 577 _p rintf_(true,"Writing kml document to file.\n");575 _pprintLine_("Writing kml document to file."); 578 576 fid=fopen(filkml,"w"); 579 577 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); … … 583 581 delete kfile; 584 582 for (i=nshape-1; i>=0; i--) { 585 x free((void**)&(pshapm[i]));586 x free((void**)&(pshapz[i]));587 x free((void**)&(pshapy[i]));588 x free((void**)&(pshapx[i]));589 } 590 x free((void**)&pshapm);591 x free((void**)&pshapz);592 x free((void**)&pshapy);593 x free((void**)&pshapx);594 x free((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); 595 593 for (i=nshape-1; i>=0; i--) { 596 x free((void**)&(pptype[i]));597 x free((void**)&(ppstrt[i]));598 } 599 x free((void**)&pptype);600 x free((void**)&ppstrt);601 x free((void**)&pnpart);602 x free((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); 603 601 604 602 clock1=clock(); -
issm/branches/trunk-jpl-damage/src/c/modules/Shp2Kmlx/Shp2Kmlx.h
r12258 r12878 19 19 20 20 #include "../../Container/Container.h" 21 #include "../../ objects/objects.h"21 #include "../../classes/objects/objects.h" 22 22 23 23 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/SmearFunctionx/SmearFunctionx.h
r11258 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Solverx/DofTypesToIndexSet.cpp
r9826 r12878 20 20 21 21 int start,end; 22 double* df_local=NULL;22 IssmDouble* df_local=NULL; 23 23 int df_local_size; 24 24 int i; … … 46 46 47 47 /*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); 50 50 51 51 pressure_count=0; … … 74 74 75 75 /*Free ressources:*/ 76 x free((void**)&pressure_indices);77 x free((void**)&velocity_indices);76 xDelete<int>(pressure_indices); 77 xDelete<int>(velocity_indices); 78 78 79 79 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.cpp
r12168 r12878 26 26 _assert_(pf); 27 27 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(); 34 30 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; 36 37 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!"); 60 44 61 45 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.h
r12004 r12878 12 12 #endif 13 13 14 #include "../../ objects/objects.h"14 #include "../../classes/objects/objects.h" 15 15 16 16 /* local prototypes: */ … … 18 18 19 19 #ifdef _HAVE_PETSC_ 20 void SolverxPetsc(PetscVec** puf, PetscMat* Kff, PetscVec* pf, PetscVec* uf0,PetscVec* df, Parameters* parameters); 20 21 void SolverxPetsc(Vec* puf, Mat Kff, Vec pf, Vec uf0,Vec df, Parameters* parameters); 21 void 22 void DofTypesToIndexSet(IS* pisv, IS* pisp, Vec df,int typeenum); 22 23 #endif 23 24 24 #ifdef _HAVE_GSL_ 25 void SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf); 26 #endif 25 void SolverxSeq(SeqVec** puf,SeqMat* Kff, SeqVec* pf); 26 void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n); 27 27 28 28 #endif /* _SOLVERX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/Solverx/SolverxPetsc.cpp
r12168 r12878 14 14 #endif 15 15 16 void 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 } 16 31 void SolverxPetsc(Vec* puf, Mat Kff, Vec pf, Vec uf0,Vec df, Parameters* parameters){ 17 32 … … 44 59 45 60 /*Display message*/ 46 _printf_(VerboseModule()," Solving\n");61 if(VerboseModule()) _pprintLine_(" Solving"); 47 62 #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2) 48 63 if(VerboseSolver())PetscOptionsPrint(stdout); … … 55 70 MatGetSize(Kff,&global_m,&global_n); _assert_(global_m==global_m); 56 71 if(!global_n){ 57 *puf=N ULL; return;72 *puf=NewVec(0); return; 58 73 } 59 74 … … 81 96 #if _PETSC_MAJOR_ >=3 82 97 #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"); 84 99 #endif 85 100 #endif … … 105 120 if (solver_type==StokesSolverEnum){ 106 121 /*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"); 108 123 DofTypesToIndexSet(&isv,&isp,df,StokesSolverEnum); 109 124 … … 136 151 /*Check convergence*/ 137 152 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); 139 154 140 155 /*Free resources:*/ -
issm/branches/trunk-jpl-damage/src/c/modules/SpcNodesx/SpcNodesx.h
r9002 r12878 6 6 #define _SPCNODESX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 #include "../../toolkits/toolkits.h" -
issm/branches/trunk-jpl-damage/src/c/modules/StringToEnumx/StringToEnumx.cpp
r12872 r12878 8 8 */ 9 9 10 #include <cstring> 10 11 #include "../../shared/shared.h" 11 12 #include "../../include/include.h" … … 110 111 else if (strcmp(name,"MaterialsRhoIce")==0) return MaterialsRhoIceEnum; 111 112 else if (strcmp(name,"MaterialsRhoWater")==0) return MaterialsRhoWaterEnum; 113 else if (strcmp(name,"MaterialsRhoFreshwater")==0) return MaterialsRhoFreshwaterEnum; 112 114 else if (strcmp(name,"MaterialsMuWater")==0) return MaterialsMuWaterEnum; 113 115 else if (strcmp(name,"MaterialsThermalExchangeVelocity")==0) return MaterialsThermalExchangeVelocityEnum; … … 136 138 else if (strcmp(name,"MiscellaneousName")==0) return MiscellaneousNameEnum; 137 139 else if (strcmp(name,"PrognosticHydrostaticAdjustment")==0) return PrognosticHydrostaticAdjustmentEnum; 138 else if (strcmp(name,"PrognosticMinThickness")==0) return PrognosticMinThicknessEnum;139 140 else stage=2; 140 141 } 141 142 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; 143 145 else if (strcmp(name,"PrognosticSpcthickness")==0) return PrognosticSpcthicknessEnum; 144 146 else if (strcmp(name,"PrognosticStabilization")==0) return PrognosticStabilizationEnum; … … 158 160 else if (strcmp(name,"SettingsResultsAsPatches")==0) return SettingsResultsAsPatchesEnum; 159 161 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; 164 172 else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum; 165 173 else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum; … … 170 178 else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum; 171 179 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; 172 190 else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum; 173 191 else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum; … … 243 261 else if (strcmp(name,"BoolParam")==0) return BoolParamEnum; 244 262 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; 246 267 else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum; 247 268 else if (strcmp(name,"DofIndexing")==0) return DofIndexingEnum; … … 260 281 else if (strcmp(name,"IntInput")==0) return IntInputEnum; 261 282 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; 266 285 else if (strcmp(name,"MacAyeal2dIceFront")==0) return MacAyeal2dIceFrontEnum; 267 286 else if (strcmp(name,"MacAyeal3dIceFront")==0) return MacAyeal3dIceFrontEnum; … … 365 384 else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum; 366 385 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; 368 390 else if (strcmp(name,"TransientInput")==0) return TransientInputEnum; 369 391 else if (strcmp(name,"Outputfilename")==0) return OutputfilenameEnum; … … 383 405 else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum; 384 406 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; 389 409 else if (strcmp(name,"P1")==0) return P1Enum; 390 410 else if (strcmp(name,"P1DG")==0) return P1DGEnum; … … 468 488 } 469 489 /*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"); 471 491 } -
issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h
r8607 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAreax/SurfaceAreax.cpp
r12168 r12878 11 11 #include "../InputUpdateFromConstantx/InputUpdateFromConstantx.h" 12 12 13 void SurfaceAreax( double* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){13 void SurfaceAreax( IssmDouble* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){ 14 14 15 15 /*Intermediary*/ … … 18 18 19 19 /*output: */ 20 double S=0;21 double S_sum;20 IssmDouble S=0; 21 IssmDouble S_sum; 22 22 23 23 /*Compute gradients: */ -
issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAreax/SurfaceAreax.h
r4236 r12878 6 6 #define _SURFACEAREAX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 11 11 /* local prototypes: */ 12 void SurfaceAreax( double* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);12 void SurfaceAreax( IssmDouble* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters); 13 13 14 14 #endif /* _SURFACEAREAX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h
r8607 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h
r8607 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h
r8607 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h
r8607 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
r11708 r12878 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 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){12 void 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){ 13 13 14 14 /*intermediary: */ … … 25 25 Vector* pf = NULL; 26 26 Vector* df=NULL; 27 double kmax = 0;27 IssmDouble kmax = 0; 28 28 29 29 /*Display message*/ 30 _printf_(VerboseModule()," Generating matrices\n");30 if(VerboseModule()) _pprintLine_(" Generating matrices"); 31 31 32 32 /*retrive parameters: */ … … 41 41 numberofdofspernode=nodes->MaxNumDofs(configuration_type,GsetEnum); 42 42 43 /*Checks in debugging mode {{{ 1*/43 /*Checks in debugging mode {{{*/ 44 44 if(penalty_kflag)_assert_(kflag); 45 45 if(penalty_pflag)_assert_(pflag); -
issm/branches/trunk-jpl-damage/src/c/modules/SystemMatricesx/SystemMatricesx.h
r11684 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* 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,12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters, 13 13 bool kflag=true,bool pflag=true,bool penalty_kflag=true,bool penalty_pflag=true); 14 14 -
issm/branches/trunk-jpl-damage/src/c/modules/ThicknessAbsGradientx/ThicknessAbsGradientx.h
r8608 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h
r8607 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/TimeAdaptx/TimeAdaptx.cpp
r12168 r12878 10 10 #include "../../Container/Container.h" 11 11 12 void TimeAdaptx( double* pdt, Elements* elements, Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters){12 void TimeAdaptx(IssmDouble* pdt, Elements* elements, Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters){ 13 13 14 14 int i; 15 15 16 16 /*output: */ 17 double dt;17 IssmDouble dt; 18 18 19 19 /*intermediary: */ 20 20 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; 23 23 24 24 /*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 6 6 7 7 #include "../../Container/Container.h" 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ 11 void TimeAdaptx( double* pdt, Elements* elements, Nodes* nodes,Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters);11 void TimeAdaptx(IssmDouble* pdt, Elements* elements, Nodes* nodes,Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters); 12 12 13 13 #endif /* _TIMEADAPTX_H */ -
issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.cpp
r12168 r12878 57 57 58 58 /*fill in the point list: */ 59 in.pointlist = (REAL *) xmalloc(in.numberofpoints * 2 * sizeof(REAL));59 in.pointlist = xNew<REAL>(in.numberofpoints*2); 60 60 61 61 counter=0; … … 78 78 79 79 /*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); 81 81 for (i=0;i<in.numberofpoints;i++) in.pointattributelist[i] = 0.0; 82 82 83 83 /*fill in the point marker list: */ 84 in.pointmarkerlist = (int *) xmalloc(in.numberofpoints * sizeof(int));84 in.pointmarkerlist = xNew<int>(in.numberofpoints); 85 85 for(i=0;i<in.numberofpoints;i++) in.pointmarkerlist[i] = 0; 86 86 … … 97 97 } 98 98 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); 101 101 counter=0; 102 102 backcounter=0; … … 135 135 in.numberofholes = domain->Size()-1; /*everything is a hole, but for the first profile.*/ 136 136 if(in.numberofholes){ 137 in.holelist = (REAL *) xmalloc(in.numberofholes * 2 * sizeof(REAL));137 in.holelist = xNew<REAL>(in.numberofholes*2); 138 138 for (i=0;i<domain->Size()-1;i++){ 139 139 contour=(Contour*)domain->GetObjectByOffset(i+1); … … 164 164 165 165 /*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); 171 171 172 172 for (i = 0; i< out.numberoftriangles; i++) { … … 192 192 193 193 /*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); 196 195 *pindex=index_matrix; 197 196 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); 199 198 *psegments=segments_matrix; 200 199 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); 204 203 } -
issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.h
r12168 r12878 8 8 #include "string.h" 9 9 #include "../../Container/Container.h" 10 #include "../../ objects/objects.h"10 #include "../../classes/objects/objects.h" 11 11 12 12 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/TriaSearchx/TriaSearchx.cpp
r8303 r12878 7 7 #include "../../include/include.h" 8 8 #include "../../toolkits/toolkits.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 #include "../modules.h" 11 11 … … 13 13 using namespace std; 14 14 15 void TriaSearchx(double** ptria, double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes){15 void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes){ 16 16 17 17 /*Output*/ … … 19 19 20 20 /*allocate: */ 21 tria= (double*)xmalloc(numberofnodes*sizeof(double));21 tria=xNew<double>(numberofnodes); 22 22 23 23 /*Intermediary*/ … … 52 52 } 53 53 54 55 54 /*Assign output pointers:*/ 56 55 *ptria=tria; -
issm/branches/trunk-jpl-damage/src/c/modules/TriaSearchx/TriaSearchx.h
r8303 r12878 6 6 #define _TRIASEARCHX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 /* local prototypes: */ 11 void TriaSearchx(double** ptria, double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes);11 void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes); 12 12 13 13 #endif -
issm/branches/trunk-jpl-damage/src/c/modules/UpdateConstraintsx/UpdateConstraintsx.cpp
r9761 r12878 14 14 void UpdateConstraintsx(Nodes* nodes,Constraints* constraints,Parameters* parameters){ 15 15 16 double time;16 IssmDouble time; 17 17 int analysis_type; 18 18 … … 22 22 23 23 /*start module: */ 24 _printf_(VerboseModule(),"%s%g\n"," Updating constraints for time: ",time);24 if(VerboseModule()) _pprintLine_(" Updating constraints for time: " << time); 25 25 26 26 /*First, update dof constraints in nodes, using constraints: */ -
issm/branches/trunk-jpl-damage/src/c/modules/UpdateConstraintsx/UpdateConstraintsx.h
r9002 r12878 6 6 #define _UPDATECONSTRAINTSX_H 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 #include "../../toolkits/toolkits.h" -
issm/branches/trunk-jpl-damage/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp
r11684 r12878 13 13 14 14 int configuration_type; 15 double* yg_serial=NULL;15 IssmDouble* yg_serial=NULL; 16 16 17 17 /*Get current configuration*/ … … 34 34 35 35 /*Free ressources:*/ 36 x free((void**)&yg_serial);36 xDelete<IssmDouble>(yg_serial); 37 37 } -
issm/branches/trunk-jpl-damage/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h
r11684 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vector* yg); -
issm/branches/trunk-jpl-damage/src/c/modules/UpdateVertexPositionsx/UpdateVertexPositionsx.cpp
r11708 r12878 15 15 Vector* vz = NULL; 16 16 Vertex *vertex = NULL; 17 double *thickness = NULL;18 double *bed = NULL;17 IssmDouble *thickness = NULL; 18 IssmDouble *bed = NULL; 19 19 20 20 /*get vertex vectors for bed and thickness: */ … … 38 38 39 39 /*Free ressources:*/ 40 x free((void**)&thickness);41 x free((void**)&bed);40 xDelete<IssmDouble>(thickness); 41 xDelete<IssmDouble>(bed); 42 42 xdelete(&vz); 43 43 return 1; -
issm/branches/trunk-jpl-damage/src/c/modules/VecMergex/VecMergex.cpp
r11684 r12878 15 15 int i; 16 16 int configuration_type; 17 double* uf_serial=NULL;17 IssmDouble* uf_serial=NULL; 18 18 19 19 /*retrieve parameters: */ … … 41 41 } 42 42 /*Free ressources:*/ 43 x free((void**)&uf_serial);43 xDelete<IssmDouble>(uf_serial); 44 44 45 45 /*Assemble vector: */ -
issm/branches/trunk-jpl-damage/src/c/modules/VecMergex/VecMergex.h
r11684 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/VerticesDofx/VerticesDofx.h
r6231 r12878 7 7 8 8 #include "../../Container/Container.h" 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 11 11 /* local prototypes: */ -
issm/branches/trunk-jpl-damage/src/c/modules/Xy2llx/Xy2llx.cpp
r9761 r12878 53 53 double sl,rho,cm,T,chi; 54 54 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"); 56 56 57 57 delta = central_meridian; … … 124 124 *pdelta= 45; 125 125 *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)."); 127 127 } 128 128 else if (sgn == -1) { 129 129 *pdelta= 0; 130 130 *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)."); 132 132 } 133 else _error _("Sign should be either +1 or -1.\n");133 else _error2_("Sign should be either +1 or -1.\n"); 134 134 135 135 return; -
issm/branches/trunk-jpl-damage/src/c/modules/modules.h
r12168 r12878 25 25 #include "./CreateNodalConstraintsx/CreateNodalConstraintsx.h" 26 26 #include "./DakotaResponsesx/DakotaResponsesx.h" 27 #include "./Delta18oParameterizationx/Delta18oParameterizationx.h" 27 28 #include "./DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h" 28 29 #include "./ElementConnectivityx/ElementConnectivityx.h" … … 36 37 #include "./GroundinglineMigrationx/GroundinglineMigrationx.h" 37 38 #include "./HoleFillerx/HoleFillerx.h" 39 #include "./TotalSmbx/TotalSmbx.h" 38 40 #include "./IceVolumex/IceVolumex.h" 39 41 #include "./InputControlUpdatex/InputControlUpdatex.h" … … 94 96 #include "./ConstraintsStatex/ConstraintsStatex.h" 95 97 #include "./PointCloudFindNeighborsx/PointCloudFindNeighborsx.h" 98 #include "./PositiveDegreeDayx/PositiveDegreeDayx.h" 96 99 #include "./PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.h" 97 100 #include "./Dakotax/Dakotax.h" … … 105 108 #include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h" 106 109 #include "./Scotchx/Scotchx.h" 110 #include "./SmbGradientsx/SmbGradientsx.h" 107 111 #include "./Solverx/Solverx.h" 108 112 #include "./SpcNodesx/SpcNodesx.h" … … 120 124 #include "./VerticesDofx/VerticesDofx.h" 121 125 #include "./VecMergex/VecMergex.h" 122 123 126 #endif -
issm/branches/trunk-jpl-damage/src/c/python/include/python_macros.h
r12119 r12878 6 6 #define _PYTHON_MACROS_H_ 7 7 8 /*Header {{{ 1*/8 /*Header {{{*/ 9 9 10 10 #ifdef HAVE_CONFIG_H … … 16 16 17 17 #ifdef _HAVE_PYTHON_ 18 /* MODULEBOOT/MODULEEND {{{ 1*/18 /* MODULEBOOT/MODULEEND {{{*/ 19 19 20 20 /*The following macros hide the error exception handling in a matlab module. Just put … … 30 30 //}}} 31 31 #if _PYTHON_MAJOR_ >=3 32 /* WRAPPER 3.2 {{{ 1*/32 /* WRAPPER 3.2 {{{*/ 33 33 #define WRAPPER(modulename,...) \ 34 34 \ … … 57 57 /*}}}*/ 58 58 #else 59 /* WRAPPER 2.7 {{{ 1*/59 /* WRAPPER 2.7 {{{*/ 60 60 #define WRAPPER(modulename,...) \ 61 61 \ … … 75 75 /*}}}*/ 76 76 #endif 77 /* CHECKARGUMENTS {{{ 1*/77 /* CHECKARGUMENTS {{{*/ 78 78 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumPythonArguments(args, NRHS,functionpointer) 79 79 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/python/io/CheckNumPythonArguments.cpp
r12017 r12878 27 27 if (size==0){ 28 28 function(); 29 _error _("usage: see above");29 _error2_("usage: see above"); 30 30 } 31 31 else if (size!=NRHS ) { 32 32 function(); 33 _error _("usage error.");33 _error2_("usage error."); 34 34 } 35 35 return 1; -
issm/branches/trunk-jpl-damage/src/c/python/io/FetchPythonData.cpp
r12120 r12878 15 15 #include "../../include/include.h" 16 16 #include "../../shared/shared.h" 17 #include "../../io/io.h" 17 18 18 19 /*Primitive data types*/ 19 /*FUNCTION FetchData(double* pscalar,PyObject* py_float){{{ 1*/20 /*FUNCTION FetchData(double* pscalar,PyObject* py_float){{{*/ 20 21 void FetchData(double* pscalar,PyObject* py_float){ 21 22 … … 29 30 } 30 31 /*}}}*/ 31 /*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{ 1*/32 /*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{*/ 32 33 void FetchData(int* pinteger, PyObject* py_long){ 33 34 … … 41 42 } 42 43 /*}}}*/ 43 /*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{ 1*/44 /*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{*/ 44 45 void FetchData(bool* pboolean,PyObject* py_boolean){ 45 46 … … 47 48 48 49 /*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!"); 50 51 51 52 /*extract boolean: */ … … 57 58 } 58 59 /*}}}*/ 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){{{*/ 60 61 void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_matrix){ 61 62 … … 68 69 /*retrive dimensions: */ 69 70 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!"); 71 72 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 72 73 M=dims[0]; N=dims[1]; … … 81 82 } 82 83 /*}}}*/ 83 /*FUNCTION FetchData(double** pvector,int* pM, PyObject* py_vector){{{1*/ 84 /*FUNCTION FetchData(int** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{*/ 85 void 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){{{*/ 84 117 void FetchData(double** pvector,int* pM,PyObject* py_vector){ 85 118 … … 92 125 /*retrive dimensions: */ 93 126 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!"); 95 128 dims=PyArray_DIMS((PyArrayObject*)py_vector); 96 129 M=dims[0]; … … 104 137 } 105 138 /*}}}*/ 139 /*FUNCTION FetchData(Options** poptions,int istart, int nrhs,PyObject* arguments){{{*/ 140 void 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 /*}}}*/ 106 152 107 153 /*Python version dependent: */ 108 154 #if _PYTHON_MAJOR_ >= 3 109 /*FUNCTION FetchData(char** pstring,PyObject* py_unicode){{{ 1*/155 /*FUNCTION FetchData(char** pstring,PyObject* py_unicode){{{*/ 110 156 void FetchData(char** pstring,PyObject* py_unicode){ 111 157 … … 124 170 /*}}}*/ 125 171 #else 126 /*FUNCTION FetchData(char** pstring,PyObject* py_string){{{ 1*/172 /*FUNCTION FetchData(char** pstring,PyObject* py_string){{{*/ 127 173 void FetchData(char** pstring,PyObject* py_string){ 128 174 -
issm/branches/trunk-jpl-damage/src/c/python/io/WritePythonData.cpp
r12112 r12878 21 21 22 22 23 /*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{ 1*/23 /*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{*/ 24 24 void WriteData(PyObject* py_tuple, int index, char* string){ 25 25 26 26 PyTuple_SetItem(py_tuple, index, PyUnicode_FromString(string)); 27 27 28 } 29 /*}}}*/ 30 /*FUNCTION WriteData(PyObject* tuple,int index,Matrix* matrix){{{1*/ 28 }/*}}}*/ 29 /*FUNCTION WriteData(PyObject* tuple,int index,Matrix* matrix){{{*/ 31 30 void WriteData(PyObject* tuple,int index,Matrix* matrix){ 32 31 … … 45 44 46 45 47 } 48 /*FUNCTION WriteData(PyObject* py_tuple,int index,Vector* vector){{{ 1*/46 }/*}}}*/ 47 /*FUNCTION WriteData(PyObject* py_tuple,int index,Vector* vector){{{*/ 49 48 void WriteData(PyObject* tuple,int index,Vector* vector){ 50 49 … … 64 63 } 65 64 /*}}}*/ 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){{{*/ 67 66 void WriteData(PyObject* tuple, int index, double* matrix, int M,int N){ 68 67 … … 76 75 PyTuple_SetItem(tuple, index, array); 77 76 78 } 77 }/*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/python/io/pythonio.h
r12120 r12878 13 13 14 14 15 #include "../../ objects/objects.h"15 #include "../../classes/classes.h" 16 16 #include "../../Container/Container.h" 17 17 #include "../../include/include.h" … … 47 47 void FetchData(double** pvector,int* pM,PyObject* py_ref); 48 48 void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_array); 49 void FetchData(int** pmatrix,int* pM,int *pN,PyObject* py_matrix); 49 50 void FetchData(char** pstring,PyObject* py_unicode); 50 51 void FetchData(double* pscalar,PyObject* py_float); 51 52 void FetchData(int* pinteger,PyObject* py_long); 52 53 void FetchData(bool* pbool,PyObject* py_boolean); 54 void FetchData(Options** poptions,int istart, int nrhs,PyObject* arguments); 53 55 54 56 int CheckNumPythonArguments(PyObject* inputs,int NRHS, void (*function)( void )); -
issm/branches/trunk-jpl-damage/src/c/shared/Alloc/alloc.cpp
r12168 r12878 25 25 #include "../Exceptions/exceptions.h" 26 26 #include "../../include/include.h" 27 #include "../../ objects/objects.h"27 #include "../../classes/objects/objects.h" 28 28 29 29 void* xmalloc(int size){ … … 31 31 void* memptr=NULL; 32 32 33 if(!size)_error _("attempting to 0 size allocation!");33 if(!size)_error2_("attempting to 0 size allocation!"); 34 34 35 35 /* Use the c library to do the allocation: */ 36 36 memptr=malloc(size); 37 if(!memptr) _error _("memory allocation failed!");37 if(!memptr) _error2_("memory allocation failed!"); 38 38 39 39 return memptr; … … 44 44 void* memptr=NULL; 45 45 46 if(!size)_error _("attempting to 0 size allocation!");46 if(!size)_error2_("attempting to 0 size allocation!"); 47 47 48 48 /* Use the c library to do the allocation: */ 49 49 memptr=calloc(n,size); 50 if(!memptr) _error _("memory allocation failed!");50 if(!memptr) _error2_("memory allocation failed!"); 51 51 52 52 return memptr; … … 84 84 } 85 85 86 87 86 void* xrealloc( void* pv, int size){ 88 87 89 88 register void* value=NULL; 90 89 91 if(!size)_error _("attempting to realloc to zero");90 if(!size)_error2_("attempting to realloc to zero"); 92 91 value = (void*)realloc(pv,size); 93 92 94 93 if (value == NULL) { 95 _error _("virtual memory exhausted");94 _error2_("virtual memory exhausted"); 96 95 } 97 96 return value; -
issm/branches/trunk-jpl-damage/src/c/shared/Bamg/OppositeAngle.h
r3913 r12878 2 2 #define _OPPOSITEANGLE_H_ 3 3 4 #include "../../ objects/Bamg/include.h"4 #include "../../classes/bamg/include.h" 5 5 6 6 /*Return the opposite angle modulo 2 Pi*/ -
issm/branches/trunk-jpl-damage/src/c/shared/Bamg/det.h
r5581 r12878 2 2 #define _BAMGDET_H_ 3 3 4 #include "../../ objects/Bamg/include.h"4 #include "../../classes/bamg/include.h" 5 5 6 6 namespace bamg { -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/Arrhenius.cpp
r7848 r12878 6 6 #include <math.h> 7 7 8 double Arrhenius(double temperature,double depth,double n){8 IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n){ 9 9 /*Use EISMINT Parameterization for the rheology: Payne2000 10 10 * … … 25 25 26 26 /*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; 29 29 30 30 /*Intermediaries*/ 31 double A,B,Tstar;31 IssmDouble A,B,Tstar; 32 32 33 33 /*convert temperature to absolute temperature*/ -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/CoordinateSystemTransform.cpp
r10532 r12878 5 5 #include <math.h> 6 6 7 void CoordinateSystemTransform( double** ptransform,Node** nodes,int numnodes,int* cs_array){7 void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array){ 8 8 9 9 int i,counter; 10 10 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]; 15 15 16 16 /*Some checks in debugging mode*/ … … 22 22 case XYEnum: numdofs+=2; break; 23 23 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"); 25 25 } 26 26 } 27 27 28 28 /*Allocate and initialize transform matrix*/ 29 transform= (double*)xmalloc(numdofs*numdofs*sizeof(double));29 transform=xNew<IssmDouble>(numdofs*numdofs); 30 30 for(i=0;i<numdofs*numdofs;i++) transform[i]=0.0; 31 31 … … 67 67 break; 68 68 default: 69 _error _("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));69 _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet"); 70 70 } 71 71 } -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/GetGlobalDofList.cpp
r10116 r12878 14 14 15 15 /*Allocate:*/ 16 ndof_list= (int*)xmalloc(numnodes*sizeof(int));16 ndof_list=xNew<int>(numnodes); 17 17 18 18 /*First, figure out size of doflist: */ … … 25 25 if(numdof){ 26 26 /*Allocate: */ 27 doflist= (int*)xmalloc(numdof*sizeof(int));27 doflist=xNew<int>(numdof); 28 28 29 29 /*Populate: */ … … 37 37 } 38 38 /*Free ressources:*/ 39 x free((void**)&ndof_list);39 xDelete<int>(ndof_list); 40 40 41 41 return doflist; -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/GetLocalDofList.cpp
r10104 r12878 13 13 if(numnodes){ 14 14 /*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); 17 17 18 18 … … 33 33 if(numdof){ 34 34 /*Allocate: */ 35 doflist= (int*)xmalloc(numdof*sizeof(int));35 doflist=xNew<int>(numdof); 36 36 37 37 /*Populate: */ … … 55 55 56 56 /*Free ressources:*/ 57 x free((void**)&ndof_list);58 x free((void**)&ngdof_list_cumulative);57 xDelete<int>(ndof_list); 58 xDelete<int>(ngdof_list_cumulative); 59 59 60 60 /*CLean-up and return*/ -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/GetVerticesCoordinates.cpp
r11197 r12878 5 5 #include "./elements.h" 6 6 7 void GetVerticesCoordinates( double* xyz, Node** nodes, int numvertices){7 void GetVerticesCoordinates(IssmDouble* xyz, Node** nodes, int numvertices){ 8 8 9 9 /*In debugging mode, check that nodes is not a NULL pointer*/ -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/Paterson.cpp
r6966 r12878 7 7 #include <math.h> 8 8 9 double Paterson(double temperature){ 9 #include "../../include/include.h" 10 11 IssmDouble Paterson(IssmDouble temperature){ 10 12 11 13 /*output: */ 12 double B;13 double T;14 IssmDouble B; 15 IssmDouble T; 14 16 15 17 /*Switch to celsius from Kelvin: */ … … 30 32 31 33 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); 33 35 } 34 36 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); 36 38 } 37 39 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); 39 41 } 40 42 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); 42 44 } 43 45 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); 45 47 } 46 48 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); 48 50 } 49 51 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); 51 53 } 52 54 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); 54 56 } 55 57 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); 57 59 } 58 60 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); 60 62 } 61 63 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); 63 65 } 64 66 65 67 /*B cannot be negative!*/ 66 if(B<0) B=pow(( double)10,(double)6);68 if(B<0) B=pow((IssmPDouble)10,(IssmPDouble)6); 67 69 68 70 return B; -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp
r10529 r12878 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 … … 23 23 int i,j; 24 24 int numdofs = 0; 25 double *transform = NULL;26 double *values = NULL;25 IssmDouble *transform = NULL; 26 IssmDouble *values = NULL; 27 27 28 28 /*Get total number of dofs*/ … … 31 31 case XYEnum: numdofs+=2; break; 32 32 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"); 34 34 } 35 35 } 36 36 37 37 /*Copy current stiffness matrix*/ 38 values= (double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));38 values=xNew<IssmDouble>(Ke->nrows*Ke->ncols); 39 39 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]; 40 40 … … 49 49 50 50 /*Free Matrix*/ 51 x free((void**)&transform);52 x free((void**)&values);51 xDelete<IssmDouble>(transform); 52 xDelete<IssmDouble>(values); 53 53 } -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformLoadVectorCoord.cpp
r10523 r12878 8 8 9 9 /*All nodes have the same Coordinate System*/ 10 cs_array= (int*)xmalloc(numnodes*sizeof(int));10 cs_array=xNew<int>(numnodes); 11 11 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 12 12 … … 15 15 16 16 /*Clean-up*/ 17 x free((void**)&cs_array);17 xDelete<int>(cs_array); 18 18 } 19 19 … … 22 22 int i,j; 23 23 int numdofs = 0; 24 double *transform = NULL;25 double *values = NULL;24 IssmDouble *transform = NULL; 25 IssmDouble *values = NULL; 26 26 27 27 /*Get total number of dofs*/ … … 30 30 case XYEnum: numdofs+=2; break; 31 31 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"); 33 33 } 34 34 } 35 35 36 36 /*Copy current load vector*/ 37 values= (double*)xmalloc(pe->nrows*sizeof(double));37 values=xNew<IssmDouble>(pe->nrows); 38 38 for(i=0;i<pe->nrows;i++) values[i]=pe->values[i]; 39 39 … … 46 46 &pe->values[0],0); 47 47 48 /*Free Matri x*/49 x free((void**)&transform);50 x free((void**)&values);48 /*Free Matrices*/ 49 xDelete<IssmDouble>(transform); 50 xDelete<IssmDouble>(values); 51 51 } -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformSolutionCoord.cpp
r10523 r12878 4 4 #include "./elements.h" 5 5 6 void TransformSolutionCoord( double* solution,Node** nodes,int numnodes,int cs_enum){6 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum){ 7 7 8 8 int* cs_array=NULL; 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 21 void TransformSolutionCoord( double* solution,Node** nodes,int numnodes,int* cs_array){21 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array){ 22 22 23 23 int i,j; 24 24 int numdofs = 0; 25 double *transform = NULL;26 double *values = NULL;25 IssmDouble *transform = NULL; 26 IssmDouble *values = NULL; 27 27 28 28 /*Get total number of dofs*/ … … 31 31 case XYEnum: numdofs+=2; break; 32 32 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"); 34 34 } 35 35 } 36 36 37 37 /*Copy current solution vector*/ 38 values= (double*)xmalloc(numdofs*sizeof(double));38 values=xNew<IssmDouble>(numdofs); 39 39 for(i=0;i<numdofs;i++) values[i]=solution[i]; 40 40 … … 47 47 &solution[0],0); 48 48 49 /*Free Matri x*/50 x free((void**)&transform);51 x free((void**)&values);49 /*Free Matrices*/ 50 xDelete<IssmDouble>(transform); 51 xDelete<IssmDouble>(values); 52 52 } -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/TransformStiffnessMatrixCoord.cpp
r10523 r12878 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 … … 23 23 int i,j; 24 24 int numdofs = 0; 25 double *transform = NULL;26 double *values = NULL;25 IssmDouble *transform = NULL; 26 IssmDouble *values = NULL; 27 27 28 28 /*Get total number of dofs*/ … … 31 31 case XYEnum: numdofs+=2; break; 32 32 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"); 34 34 } 35 35 } 36 36 37 37 /*Copy current stiffness matrix*/ 38 values= (double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));38 values=xNew<IssmDouble>(Ke->nrows*Ke->ncols); 39 39 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]; 40 40 … … 49 49 50 50 /*Free Matrix*/ 51 x free((void**)&transform);52 x free((void**)&values);51 xDelete<IssmDouble>(transform); 52 xDelete<IssmDouble>(values); 53 53 } -
issm/branches/trunk-jpl-damage/src/c/shared/Elements/elements.h
r12258 r12878 4 4 5 5 #ifndef _SHARED_ELEMENTS_H_ 6 #define 6 #define _SHARED_ELEMENTS_H_ 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 #include "../../Container/Container.h" 10 10 class ElementMatrix; 11 11 class ElementVector; 12 12 13 double Paterson(double temperature); 14 double Arrhenius(double temperature,double depth,double n); 15 void GetVerticesCoordinates(double* xyz, Node** nodes, int numvertices); 13 IssmDouble Paterson(IssmDouble temperature); 14 IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n); 15 IssmDouble PddSurfaceMassBlance(IssmDouble* monthlytemperatures, IssmDouble* monthlyprec, IssmDouble* pdds, IssmDouble* pds, 16 IssmDouble signorm, IssmDouble yts, IssmDouble h, IssmDouble s, IssmDouble rho_ice, IssmDouble rho_water); 17 void 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); 22 void GetVerticesCoordinates(IssmDouble* xyz, Node** nodes, int numvertices); 16 23 int GetNumberOfDofs( Node** nodes,int numnodes,int setenum,int approximation_enum); 17 24 int* GetLocalDofList( Node** nodes,int numnodes,int setenum,int approximation_enum); 18 25 int* GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation_enum); 26 19 27 #ifdef _HAVE_DIAGNOSTIC_ 20 void CoordinateSystemTransform( double** ptransform,Node** nodes,int numnodes,int* cs_array);28 void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array); 21 29 void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum); 22 30 void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array); … … 25 33 void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int cs_enum); 26 34 void 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);35 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum); 36 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array); 29 37 #endif 30 38 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*/ 40 void printarray(IssmPDouble* array,int lines,int cols=1); 41 void printarray(int* array,int lines,int cols=1); 42 void printbinary(int n); 61 43 #endif //ifndef _SHARED_ELEMENTS_H_ -
issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/Exceptions.cpp
r12168 r12878 20 20 } 21 21 22 ErrorException::ErrorException( string what_file,string what_function,int what_line,stringwhat_arg){22 ErrorException::ErrorException(const string& what_file, const string& what_function,int what_line, const string& what_arg){ 23 23 24 24 what_str=what_arg; … … 44 44 45 45 if (function_name=="" || file_line==0){ //WINDOWS 46 printf("%s%s","Error message: ",what());46 _printString_("Error message: " << what()); 47 47 } 48 48 else{ 49 49 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"); 52 52 } 53 53 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"); 56 56 } 57 57 } -
issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/exceptions.h
r12168 r12878 24 24 public: 25 25 ErrorException(const string &what_arg); //for windows 26 ErrorException( string what_file,string what_function,int what_line,stringwhat_arg);//UNIX26 ErrorException(const string& what_file,const string& what_function,int what_line,const string& what_arg);//UNIX 27 27 ~ErrorException() throw(); 28 28 virtual const char *what() const throw(); -
issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/exprintf.cpp
r11199 r12878 9 9 #include <stdarg.h> 10 10 #include <stdio.h> 11 #include "../Alloc/xNewDelete.h" 11 12 #include "../Alloc/alloc.h" 12 13 … … 14 15 15 16 /*returned string: */ 16 char* string=NULL; 17 char *buffer = NULL; 18 int n,size = 100; 19 int string_size; 17 20 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 21 21 //variable list of arguments 22 va_list a p;22 va_list args; 23 23 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){ 28 25 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; 30 51 } -
issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineRead.cpp
r12168 r12878 7 7 8 8 #include <stdio.h> 9 #include <cstring> 9 10 #include "../Alloc/alloc.h" 10 11 #include "../../include/include.h" 11 #include "../../ objects/objects.h"12 #include "../../classes/classes.h" 12 13 #include "../Exceptions/exceptions.h" 13 14 #include "../../Container/DataSet.h" … … 19 20 20 21 /*I/O: */ 21 FILE * fid=NULL;22 char chardummy[256];22 FILE *fid = NULL; 23 char chardummy[256]; 23 24 double ddummy; 24 25 25 26 /*output: */ 26 int nprof;//number of profiles in the domainname file27 int * profnvertices=NULL; //array holding the number of vertices for the nprof profiles28 double ** pprofx=NULL; //array of profiles x coordinates29 double ** pprofy=NULL; //array of profiles y coordinates30 bool * closed=NULL; //array holding closed flags for the nprof profiles27 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 31 32 32 33 /*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; 37 38 38 39 /*open domain outline file for reading: */ 39 40 if ((fid=fopen(domainname,"r"))==NULL){ 40 _error _("%s%s","could not find domain file ",domainname);41 _error2_("could not find domain file " << domainname); 41 42 } 42 43 … … 61 62 62 63 /*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); 66 67 for (i=0;i<nprof;i++){ 67 68 pprofx[i]=NULL; 68 69 pprofy[i]=NULL; 69 70 } 70 closed= (bool*)xmalloc(nprof*sizeof(bool));71 closed=xNew<bool>(nprof); 71 72 72 73 /*Reaset file pointer to beginning of file: */ … … 88 89 89 90 /*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); 92 93 93 94 94 /*Read vertices: */ 95 95 for (i=0;i<n;i++){ … … 118 118 *ppprofx=pprofx; 119 119 *ppprofy=pprofy; 120 if(pclosed)*pclosed=closed; 121 else xfree((void**)&closed); 120 if(pclosed) 121 *pclosed=closed; 122 else 123 xDelete<bool>(closed); 122 124 } 123 125 -
issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineWrite.cpp
r12168 r12878 23 23 /*open domain outline file for writing: */ 24 24 if ((fid=fopen(domainname,"w"))==NULL){ 25 _error _("%s%s","could not open domain file ",domainname);25 _error2_("could not open domain file " << domainname); 26 26 noerr=0; goto cleanupandreturn; 27 27 } -
issm/branches/trunk-jpl-damage/src/c/shared/Exp/IsInPoly.cpp
r11708 r12878 14 14 #endif 15 15 16 /*IsInPoly {{{ 1*/16 /*IsInPoly {{{*/ 17 17 int IsInPoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){ 18 18 … … 55 55 return 1; 56 56 }/*}}}*/ 57 /*IsOutsidePoly {{{ 1*/57 /*IsOutsidePoly {{{*/ 58 58 int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){ 59 59 … … 96 96 return 1; 97 97 }/*}}}*/ 98 /*pnpoly{{{ 1*/98 /*pnpoly{{{*/ 99 99 int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue) { 100 100 int i, j, c = 0; -
issm/branches/trunk-jpl-damage/src/c/shared/Exp/exp.h
r12168 r12878 7 7 #define _EXP_H_ 8 8 9 #include "../../ objects/objects.h"9 #include "../../classes/objects/objects.h" 10 10 #include "../../toolkits/toolkits.h" 11 11 -
issm/branches/trunk-jpl-damage/src/c/shared/Matrix/MatrixUtils.cpp
r12004 r12878 4 4 5 5 /*Headers*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #include "./matrix.h" 8 8 #include "../Exceptions/exceptions.h" … … 16 16 /*}}}*/ 17 17 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 {{{*/ 19 int 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){ 20 20 /*TripleMultiply Perform triple matrix product a*b*c+d.*/ 21 21 22 22 int idima,idimb,idimc,idimd; 23 double* dtemp;23 IssmDouble* dtemp; 24 24 25 25 /* set up dimensions for triple product */ … … 36 36 if (!itrnb) { 37 37 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."); 39 39 } 40 40 idimc=ncolb; … … 42 42 else { 43 43 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."); 45 45 } 46 46 idimc=nrowb; … … 49 49 if (!itrnc) { 50 50 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."); 52 52 } 53 53 idimd=ncolc; … … 55 55 else { 56 56 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."); 58 58 } 59 59 idimd=nrowc; … … 62 62 /* perform the matrix triple product in the order that minimizes the 63 63 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 for64 (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 66 66 a symmetric triple product) */ 67 67 … … 69 69 70 70 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); 81 76 } 82 77 … … 84 79 85 80 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); 96 86 } 97 87 98 88 return 1; 99 89 }/*}}}*/ 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 {{{*/ 91 int MatrixMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int iaddc ){ 102 92 /*MatrixMultiply Perform matrix multiplication a*b+c.*/ 103 93 int noerr=1; … … 134 124 135 125 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"); 137 127 noerr=0; 138 128 return noerr; … … 167 157 return noerr; 168 158 }/*}}}*/ 169 /*FUNCTION MatrixInverse {{{ 1*/170 int MatrixInverse( double* a, int ndim, int nrow, double* b, int nvec, double* pdet ){159 /*FUNCTION MatrixInverse {{{*/ 160 int MatrixInverse( IssmDouble* a, int ndim, int nrow, IssmDouble* b, int nvec, IssmDouble* pdet ){ 171 161 /* MatrixInverse Perform matrix inversion and linear equation solution. 172 162 … … 181 171 int noerr=1; 182 172 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; 185 175 186 176 if (!b && nvec) { 187 _error _("No right-hand side for nvec=%d.",nvec);177 _error2_("No right-hand side for nvec=" << nvec << "."); 188 178 noerr=0; 189 179 return noerr; … … 198 188 ncol=nrow; 199 189 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); 203 193 204 194 /* loop over the rows/columns of the matrix */ … … 221 211 222 212 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"); 226 217 noerr=0; 227 218 return noerr; 228 219 } 229 220 230 pivrc [i][0]=irow;231 pivrc [i][1]=icol;221 pivrc1[i]=irow; 222 pivrc2[i]=icol; 232 223 233 224 ipiv=icol; … … 319 310 j=(nrow-1)-i; 320 311 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]; 324 315 325 316 // _printf_(true,"column switch back for j=%d: irow=%d, icol=%d\n", … … 336 327 } 337 328 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); 344 333 return noerr; 345 334 }/*}}}*/ 346 /*FUNCTION Matrix2x2Determinant( double* Adet,double* A) {{{1*/347 void Matrix2x2Determinant( double* Adet,double* A){335 /*FUNCTION Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A) {{{*/ 336 void Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A){ 348 337 /*Compute determinant of a 2x2 matrix*/ 349 338 … … 352 341 } 353 342 /*}}}*/ 354 /*FUNCTION Matrix2x2Invert( double* Ainv,double* A) {{{1*/355 void Matrix2x2Invert( double* Ainv,double* A){343 /*FUNCTION Matrix2x2Invert(IssmDouble* Ainv,IssmDouble* A) {{{*/ 344 void Matrix2x2Invert(IssmDouble* Ainv,IssmDouble* A){ 356 345 357 346 /*Intermediaries*/ 358 double det;347 IssmDouble det; 359 348 360 349 /*Compute determinant*/ 361 350 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"); 363 352 364 353 /*Compute invert*/ … … 369 358 370 359 }/*}}}*/ 371 /*FUNCTION Matrix3x3Determinant( double* Adet,double* A) {{{1*/372 void Matrix3x3Determinant( double* Adet,double* A){360 /*FUNCTION Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A) {{{*/ 361 void Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A){ 373 362 /*Compute determinant of a 3x3 matrix*/ 374 363 … … 377 366 } 378 367 /*}}}*/ 379 /*FUNCTION Matrix3x3Invert( double* Ainv,double* A) {{{1*/380 void Matrix3x3Invert( double* Ainv,double* A){368 /*FUNCTION Matrix3x3Invert(IssmDouble* Ainv,IssmDouble* A) {{{*/ 369 void Matrix3x3Invert(IssmDouble* Ainv,IssmDouble* A){ 381 370 382 371 /*Intermediaries*/ 383 double det;372 IssmDouble det; 384 373 385 374 /*Compute determinant*/ 386 375 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"); 388 377 389 378 /*Compute invert*/ … … 399 388 400 389 }/*}}}*/ 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) {{{*/ 391 void MatrixTranspose(IssmDouble* tA,IssmDouble* A, int nrows, int ncols){ 403 392 /*Transpose a n*m matrix*/ 404 393 -
issm/branches/trunk-jpl-damage/src/c/shared/Matrix/matrix.h
r5371 r12878 6 6 #define _MATRIXUTILS_H_ 7 7 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 10 int 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); 11 int MatrixMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int iaddc ); 12 int MatrixInverse( IssmDouble* a, int ndim, int nrow, IssmDouble* b, int nvec, IssmDouble* pdet ); 13 void Matrix2x2Invert(IssmDouble* Ainv, IssmDouble* A); 14 void Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A); 15 void Matrix3x3Invert(IssmDouble* Ainv, IssmDouble* A); 16 void Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A); 17 void MatrixTranspose(IssmDouble* tA,IssmDouble* A,int nrows, int ncols); 16 18 17 19 #endif //ifndef _MATRIXUTILS_H_ -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/BrentSearch.cpp
r9761 r12878 10 10 11 11 #include "./numerics.h" 12 #include "../../ objects/objects.h"12 #include "../../classes/objects/objects.h" 13 13 #include "../../include/include.h" 14 14 #include "../../io/io.h" 15 15 #include "../../shared/shared.h" 16 16 #include <float.h> 17 18 void BrentSearch(double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs){ 17 #include <iomanip> 18 19 void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){ 19 20 20 21 /* This routine is optimizing a given function using Brent's method … … 22 23 23 24 /*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; 35 36 36 37 /*Recover parameters:*/ … … 43 44 iter=0; 44 45 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"); 48 52 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"); 51 55 52 56 /*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){ 54 58 *psearch_scalar=xmax; 55 59 *pJ=fxmax; … … 58 62 59 63 /*initialize optimization variables*/ 60 seps=sqrt(DBL_EPSILON); //precision of a double64 seps=sqrt(DBL_EPSILON); //precision of a IssmDouble 61 65 distance=0.0; //new_x=old_x + distance 62 66 gold=0.5*(3.0-sqrt(5.0)); //gold = 1 - golden ratio … … 71 75 /*2: call the function to be evaluated*/ 72 76 fxbest = (*f)(x,optargs); 73 if( isnan(fxbest)) _error_("Function evaluation returned NaN");77 if(xIsNan<IssmDouble>(fxbest)) _error2_("Function evaluation returned NaN"); 74 78 iter=iter+1; 75 79 … … 84 88 85 89 /*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); 89 94 loop=false; 90 95 } … … 154 159 //evaluate function on x 155 160 fx = (*f)(x,optargs); 156 if( isnan(fx)) _error_("Function evaluation returned NaN");161 if(xIsNan<IssmDouble>(fx)) _error2_("Function evaluation returned NaN"); 157 162 iter=iter+1; 158 163 … … 179 184 tol1=seps*pow(pow(xbest,2),0.5)+tolerance/3.0; 180 185 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")); 182 189 183 190 /*Stop the optimization?*/ 184 191 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); 186 193 loop=false; 187 194 } 188 195 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 << ")"); 190 197 loop=false; 191 198 } 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); 194 201 loop=false; 195 202 } -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/GaussPoints.cpp
r12004 r12878 1 1 /* Gauss point structures and prototypes */ 2 2 3 #include "../../include/include.h" 3 4 #include "./GaussPoints.h" 4 5 #include "../Alloc/alloc.h" 5 #include "../../include/include.h"6 6 #include "../../io/io.h" 7 7 #include "../Exceptions/exceptions.h" … … 10 10 11 11 /*General Gauss points*/ 12 /*FUNCTION GaussLegendreLinear {{{ 1*/13 void GaussLegendreLinear( double** pxgaus, double** pxwgt, int ngaus){12 /*FUNCTION GaussLegendreLinear {{{*/ 13 void GaussLegendreLinear( IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus){ 14 14 /* Gauss-Legendre quadrature points. 15 15 … … 25 25 /*Intermediaries*/ 26 26 int i; 27 double *alpha,*beta;27 IssmPDouble *alpha,*beta; 28 28 29 29 /*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}; 32 32 33 33 /*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}; 36 36 37 37 /*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}; 40 40 41 41 /*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 // _p rintf_(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); 56 56 57 57 /* check to see if Gauss points need to be calculated */ … … 70 70 71 71 /* 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); 74 74 75 75 /* calculate the Legendre recurrence coefficients */ … … 84 84 /* calculate the Gauss points */ 85 85 GaussRecur(*pxgaus, *pxwgt, ngaus, alpha, beta ); 86 x free((void **)&beta);87 x free((void **)&alpha);86 xDelete<IssmPDouble>(beta); 87 xDelete<IssmPDouble>(alpha); 88 88 } 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{{{*/ 91 void GaussLegendreTria( int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pwgt, int iord ) { 92 92 /*Gauss quadrature points for the triangle. 93 93 … … 98 98 /*Intermediaries*/ 99 99 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; 102 102 103 103 /*Hardcoded Gauss points declaration*/ 104 /*p= 1, npoint= 1{{{ 2*/105 static double wgt1[]={104 /*p= 1, npoint= 1{{{*/ 105 static IssmPDouble wgt1[]={ 106 106 1.732050807568877}; 107 static double l11[]={107 static IssmPDouble l11[]={ 108 108 0.333333333333333}; 109 static double l21[]={109 static IssmPDouble l21[]={ 110 110 0.333333333333333}; 111 static double l31[]={111 static IssmPDouble l31[]={ 112 112 0.333333333333333}; 113 /*}}} 2*/114 /*p= 2, npoint= 3 {{{ 2*/115 static double wgt2[]={113 /*}}}*/ 114 /*p= 2, npoint= 3 {{{*/ 115 static IssmPDouble wgt2[]={ 116 116 0.577350269189625, 0.577350269189625, 0.577350269189625}; 117 static double l12[]={117 static IssmPDouble l12[]={ 118 118 0.666666666666667, 0.166666666666667, 0.166666666666667}; 119 static double l22[]={119 static IssmPDouble l22[]={ 120 120 0.166666666666667, 0.666666666666667, 0.166666666666667}; 121 static double l32[]={121 static IssmPDouble l32[]={ 122 122 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[]={ 126 126 -0.974278579257493, 0.902109795608790, 0.902109795608790, 127 127 0.902109795608790}; 128 static double l13[]={128 static IssmPDouble l13[]={ 129 129 0.333333333333333, 0.600000000000000, 0.200000000000000, 130 130 0.200000000000000}; 131 static double l23[]={131 static IssmPDouble l23[]={ 132 132 0.333333333333333, 0.200000000000000, 0.600000000000000, 133 133 0.200000000000000}; 134 static double l33[]={134 static IssmPDouble l33[]={ 135 135 0.333333333333333, 0.200000000000000, 0.200000000000000, 136 136 0.600000000000000}; 137 /*}}} 2*/138 /*p= 4, npoint= 6 {{{ 2*/139 static double wgt4[]={137 /*}}}*/ 138 /*p= 4, npoint= 6 {{{*/ 139 static IssmPDouble wgt4[]={ 140 140 0.386908262797819, 0.386908262797819, 0.386908262797819, 141 141 0.190442006391807, 0.190442006391807, 0.190442006391807}; 142 static double l14[]={142 static IssmPDouble l14[]={ 143 143 0.108103018168070, 0.445948490915965, 0.445948490915965, 144 144 0.816847572980459, 0.091576213509771, 0.091576213509771}; 145 static double l24[]={145 static IssmPDouble l24[]={ 146 146 0.445948490915965, 0.108103018168070, 0.445948490915965, 147 147 0.091576213509771, 0.816847572980459, 0.091576213509771}; 148 static double l34[]={148 static IssmPDouble l34[]={ 149 149 0.445948490915965, 0.445948490915965, 0.108103018168070, 150 150 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[]={ 154 154 0.389711431702997, 0.229313399254729, 0.229313399254729, 155 155 0.229313399254729, 0.218133059367230, 0.218133059367230, 156 156 0.218133059367230}; 157 static double l15[]={157 static IssmPDouble l15[]={ 158 158 0.333333333333333, 0.059715871789770, 0.470142064105115, 159 159 0.470142064105115, 0.797426985353087, 0.101286507323456, 160 160 0.101286507323456}; 161 static double l25[]={161 static IssmPDouble l25[]={ 162 162 0.333333333333333, 0.470142064105115, 0.059715871789770, 163 163 0.470142064105115, 0.101286507323456, 0.797426985353087, 164 164 0.101286507323456}; 165 static double l35[]={165 static IssmPDouble l35[]={ 166 166 0.333333333333333, 0.470142064105115, 0.470142064105115, 167 167 0.059715871789770, 0.101286507323456, 0.101286507323456, 168 168 0.797426985353087}; 169 /*}}} 2*/170 /*p= 6, npoint=12 {{{ 2*/171 static double wgt6[]={169 /*}}}*/ 170 /*p= 6, npoint=12 {{{*/ 171 static IssmPDouble wgt6[]={ 172 172 0.202279763184836, 0.202279763184836, 0.202279763184836, 173 173 0.088065961139281, 0.088065961139281, 0.088065961139281, 174 174 0.143502272432755, 0.143502272432755, 0.143502272432755, 175 175 0.143502272432755, 0.143502272432755, 0.143502272432755}; 176 static double l16[]={176 static IssmPDouble l16[]={ 177 177 0.501426509658179, 0.249286745170910, 0.249286745170910, 178 178 0.873821971016996, 0.063089014491502, 0.063089014491502, 179 179 0.053145049844817, 0.053145049844817, 0.310352451033784, 180 180 0.636502499121399, 0.310352451033784, 0.636502499121399}; 181 static double l26[]={181 static IssmPDouble l26[]={ 182 182 0.249286745170910, 0.501426509658179, 0.249286745170910, 183 183 0.063089014491502, 0.873821971016996, 0.063089014491502, 184 184 0.310352451033784, 0.636502499121399, 0.053145049844817, 185 185 0.053145049844817, 0.636502499121399, 0.310352451033784}; 186 static double l36[]={186 static IssmPDouble l36[]={ 187 187 0.249286745170910, 0.249286745170910, 0.501426509658179, 188 188 0.063089014491502, 0.063089014491502, 0.873821971016996, 189 189 0.636502499121399, 0.310352451033784, 0.636502499121399, 190 190 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[]={ 194 194 -0.259062916308362, 0.304174548458604, 0.304174548458604, 195 195 0.304174548458604, 0.092400122517855, 0.092400122517855, … … 197 197 0.133564951824643, 0.133564951824643, 0.133564951824643, 198 198 0.133564951824643}; 199 static double l17[]={199 static IssmPDouble l17[]={ 200 200 0.333333333333333, 0.479308067841920, 0.260345966079040, 201 201 0.260345966079040, 0.869739794195568, 0.065130102902216, … … 203 203 0.312865496004874, 0.638444188569810, 0.312865496004874, 204 204 0.638444188569810}; 205 static double l27[]={205 static IssmPDouble l27[]={ 206 206 0.333333333333333, 0.260345966079040, 0.479308067841920, 207 207 0.260345966079040, 0.065130102902216, 0.869739794195568, … … 209 209 0.048690315425316, 0.048690315425316, 0.638444188569810, 210 210 0.312865496004874}; 211 static double l37[]={211 static IssmPDouble l37[]={ 212 212 0.333333333333333, 0.260345966079040, 0.260345966079040, 213 213 0.479308067841920, 0.065130102902216, 0.065130102902216, … … 215 215 0.638444188569810, 0.312865496004874, 0.048690315425316, 216 216 0.048690315425316}; 217 /*}}} 2*/218 /*p= 8, npoint=16 {{{ 2*/219 static double wgt8[]={217 /*}}}*/ 218 /*p= 8, npoint=16 {{{*/ 219 static IssmPDouble wgt8[]={ 220 220 0.249961964823104, 0.164703541925695, 0.164703541925695, 221 221 0.164703541925695, 0.178777729989794, 0.178777729989794, … … 224 224 0.047164287656184, 0.047164287656184, 0.047164287656184, 225 225 0.047164287656184}; 226 static double l18[]={226 static IssmPDouble l18[]={ 227 227 0.333333333333333, 0.081414823414554, 0.459292588292723, 228 228 0.459292588292723, 0.658861384496480, 0.170569307751760, … … 231 231 0.263112829634638, 0.728492392955404, 0.263112829634638, 232 232 0.728492392955404}; 233 static double l28[]={233 static IssmPDouble l28[]={ 234 234 0.333333333333333, 0.459292588292723, 0.081414823414554, 235 235 0.459292588292723, 0.170569307751760, 0.658861384496480, … … 238 238 0.008394777409958, 0.008394777409958, 0.728492392955404, 239 239 0.263112829634638}; 240 static double l38[]={240 static IssmPDouble l38[]={ 241 241 0.333333333333333, 0.459292588292723, 0.459292588292723, 242 242 0.081414823414554, 0.170569307751760, 0.170569307751760, … … 245 245 0.728492392955404, 0.263112829634638, 0.008394777409958, 246 246 0.008394777409958}; 247 /*}}} 2*/248 /*p= 9, npoint=19 {{{ 2*/249 static double wgt9[]={247 /*}}}*/ 248 /*p= 9, npoint=19 {{{*/ 249 static IssmPDouble wgt9[]={ 250 250 0.168244134395468, 0.054273292833345, 0.054273292833345, 251 251 0.054273292833345, 0.134801255248419, 0.134801255248419, … … 255 255 0.074969289332873, 0.074969289332873, 0.074969289332873, 256 256 0.074969289332873}; 257 static double l19[]={257 static IssmPDouble l19[]={ 258 258 0.333333333333333, 0.020634961602525, 0.489682519198738, 259 259 0.489682519198738, 0.125820817014127, 0.437089591492937, … … 263 263 0.221962989160766, 0.741198598784498, 0.221962989160766, 264 264 0.741198598784498}; 265 static double l29[]={265 static IssmPDouble l29[]={ 266 266 0.333333333333333, 0.489682519198738, 0.020634961602525, 267 267 0.489682519198738, 0.437089591492937, 0.125820817014127, … … 271 271 0.036838412054736, 0.036838412054736, 0.741198598784498, 272 272 0.221962989160766}; 273 static double l39[]={273 static IssmPDouble l39[]={ 274 274 0.333333333333333, 0.489682519198738, 0.489682519198738, 275 275 0.020634961602525, 0.437089591492937, 0.437089591492937, … … 279 279 0.741198598784498, 0.221962989160766, 0.036838412054736, 280 280 0.036838412054736}; 281 /*}}} 2*/282 /*p=10, npoint=25 {{{ 2*/283 static double wgt10[]={281 /*}}}*/ 282 /*p=10, npoint=25 {{{*/ 283 static IssmPDouble wgt10[]={ 284 284 0.157301373584232, 0.063611224790829, 0.063611224790829, 285 285 0.063611224790829, 0.078498377595183, 0.078498377595183, … … 291 291 0.016318805873179, 0.016318805873179, 0.016318805873179, 292 292 0.016318805873179}; 293 static double l110[]={293 static IssmPDouble l110[]={ 294 294 0.333333333333333, 0.028844733232685, 0.485577633383657, 295 295 0.485577633383657, 0.781036849029926, 0.109481575485037, … … 301 301 0.066803251012200, 0.923655933587500, 0.066803251012200, 302 302 0.923655933587500}; 303 static double l210[]={303 static IssmPDouble l210[]={ 304 304 0.333333333333333, 0.485577633383657, 0.028844733232685, 305 305 0.485577633383657, 0.109481575485037, 0.781036849029926, … … 311 311 0.009540815400299, 0.009540815400299, 0.923655933587500, 312 312 0.066803251012200}; 313 static double l310[]={313 static IssmPDouble l310[]={ 314 314 0.333333333333333, 0.485577633383657, 0.485577633383657, 315 315 0.028844733232685, 0.109481575485037, 0.109481575485037, … … 321 321 0.923655933587500, 0.066803251012200, 0.009540815400299, 322 322 0.009540815400299}; 323 /*}}} 2*/324 /*p=11, npoint=27 {{{ 2*/325 static double wgt11[]={323 /*}}}*/ 324 /*p=11, npoint=27 {{{*/ 325 static IssmPDouble wgt11[]={ 326 326 0.001605622060698, 0.001605622060698, 0.001605622060698, 327 327 0.133626914252765, 0.133626914252765, 0.133626914252765, … … 333 333 0.035866718600836, 0.035866718600836, 0.035866718600836, 334 334 0.035866718600836, 0.035866718600836, 0.035866718600836}; 335 static double l111[]={335 static IssmPDouble l111[]={ 336 336 -0.069222096541517, 0.534611048270758, 0.534611048270758, 337 337 0.202061394068290, 0.398969302965855, 0.398969302965855, … … 343 343 0.021022016536166, 0.021022016536166, 0.171488980304042, 344 344 0.807489003159792, 0.171488980304042, 0.807489003159792}; 345 static double l211[]={345 static IssmPDouble l211[]={ 346 346 0.534611048270758,-0.069222096541517, 0.534611048270758, 347 347 0.398969302965855, 0.202061394068290, 0.398969302965855, … … 353 353 0.171488980304042, 0.807489003159792, 0.021022016536166, 354 354 0.021022016536166, 0.807489003159792, 0.171488980304042}; 355 static double l311[]={355 static IssmPDouble l311[]={ 356 356 0.534611048270758, 0.534611048270758,-0.069222096541517, 357 357 0.398969302965855, 0.398969302965855, 0.202061394068290, … … 363 363 0.807489003159792, 0.171488980304042, 0.807489003159792, 364 364 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[]={ 368 368 0.044567514407799, 0.044567514407799, 0.044567514407799, 369 369 0.075677707051848, 0.075677707051848, 0.075677707051848, … … 377 377 0.029992592075802, 0.029992592075802, 0.029992592075802, 378 378 0.029992592075802, 0.029992592075802, 0.029992592075802}; 379 static double l112[]={379 static IssmPDouble l112[]={ 380 380 0.023565220452390, 0.488217389773805, 0.488217389773805, 381 381 0.120551215411079, 0.439724392294460, 0.439724392294460, … … 389 389 0.025734050548330, 0.025734050548330, 0.116251915907597, 390 390 0.858014033544073, 0.116251915907597, 0.858014033544073}; 391 static double l212[]={391 static IssmPDouble l212[]={ 392 392 0.488217389773805, 0.023565220452390, 0.488217389773805, 393 393 0.439724392294460, 0.120551215411079, 0.439724392294460, … … 401 401 0.116251915907597, 0.858014033544073, 0.025734050548330, 402 402 0.025734050548330, 0.858014033544073, 0.116251915907597}; 403 static double l312[]={403 static IssmPDouble l312[]={ 404 404 0.488217389773805, 0.488217389773805, 0.023565220452390, 405 405 0.439724392294460, 0.439724392294460, 0.120551215411079, … … 413 413 0.858014033544073, 0.116251915907597, 0.858014033544073, 414 414 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[]={ 418 418 0.090968907790622, 0.019537784619314, 0.019537784619314, 419 419 0.019537784619314, 0.054427130356344, 0.054427130356344, … … 429 429 0.026884523429480, 0.026884523429480, 0.026884523429480, 430 430 0.026884523429480}; 431 static double l113[]={431 static IssmPDouble l113[]={ 432 432 0.333333333333333, 0.009903630120591, 0.495048184939705, 433 433 0.495048184939705, 0.062566729780852, 0.468716635109574, … … 443 443 0.126357385491669, 0.851409537834241, 0.126357385491669, 444 444 0.851409537834241}; 445 static double l213[]={445 static IssmPDouble l213[]={ 446 446 0.333333333333333, 0.495048184939705, 0.009903630120591, 447 447 0.495048184939705, 0.468716635109574, 0.062566729780852, … … 457 457 0.022233076674090, 0.022233076674090, 0.851409537834241, 458 458 0.126357385491669}; 459 static double l313[]={459 static IssmPDouble l313[]={ 460 460 0.333333333333333, 0.495048184939705, 0.495048184939705, 461 461 0.009903630120591, 0.468716635109574, 0.468716635109574, … … 471 471 0.851409537834241, 0.126357385491669, 0.022233076674090, 472 472 0.022233076674090}; 473 /*}}} 2*/474 /*p=14, npoint=42{{{ 2*/475 static double wgt14[]={473 /*}}}*/ 474 /*p=14, npoint=42{{{*/ 475 static IssmPDouble wgt14[]={ 476 476 0.037903474783419, 0.037903474783419, 0.037903474783419, 477 477 0.056791094234956, 0.056791094234956, 0.056791094234956, … … 488 488 0.008677970905831, 0.008677970905831, 0.008677970905831, 489 489 0.008677970905831, 0.008677970905831, 0.008677970905831}; 490 static double l114[]={490 static IssmPDouble l114[]={ 491 491 0.022072179275643, 0.488963910362179, 0.488963910362179, 492 492 0.164710561319092, 0.417644719340454, 0.417644719340454, … … 503 503 0.001268330932872, 0.001268330932872, 0.118974497696957, 504 504 0.879757171370171, 0.118974497696957, 0.879757171370171}; 505 static double l214[]={505 static IssmPDouble l214[]={ 506 506 0.488963910362179, 0.022072179275643, 0.488963910362179, 507 507 0.417644719340454, 0.164710561319092, 0.417644719340454, … … 518 518 0.118974497696957, 0.879757171370171, 0.001268330932872, 519 519 0.001268330932872, 0.879757171370171, 0.118974497696957}; 520 static double l314[]={520 static IssmPDouble l314[]={ 521 521 0.488963910362179, 0.488963910362179, 0.022072179275643, 522 522 0.417644719340454, 0.417644719340454, 0.164710561319092, … … 533 533 0.879757171370171, 0.118974497696957, 0.879757171370171, 534 534 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[]={ 538 538 0.003320126005206, 0.003320126005206, 0.003320126005206, 539 539 0.076641563419124, 0.076641563419124, 0.076641563419124, … … 552 552 0.013291658531346, 0.013291658531346, 0.013291658531346, 553 553 0.013291658531346, 0.013291658531346, 0.013291658531346}; 554 static double l115[]={554 static IssmPDouble l115[]={ 555 555 -0.013945833716486, 0.506972916858243, 0.506972916858243, 556 556 0.137187291433955, 0.431406354283023, 0.431406354283023, … … 569 569 0.012459809331199, 0.012459809331199, 0.103575616576386, 570 570 0.883964574092416, 0.103575616576386, 0.883964574092416}; 571 static double l215[]={571 static IssmPDouble l215[]={ 572 572 0.506972916858243,-0.013945833716486, 0.506972916858243, 573 573 0.431406354283023, 0.137187291433955, 0.431406354283023, … … 586 586 0.103575616576386, 0.883964574092416, 0.012459809331199, 587 587 0.012459809331199, 0.883964574092416, 0.103575616576386}; 588 static double l315[]={588 static IssmPDouble l315[]={ 589 589 0.506972916858243, 0.506972916858243,-0.013945833716486, 590 590 0.431406354283023, 0.431406354283023, 0.137187291433955, … … 603 603 0.883964574092416, 0.103575616576386, 0.883964574092416, 604 604 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[]={ 608 608 0.081191089584902, 0.011095307165226, 0.011095307165226, 609 609 0.011095307165226, 0.072244353151393, 0.072244353151393, … … 624 624 0.011864642509229, 0.011864642509229, 0.011864642509229, 625 625 0.011864642509229}; 626 static double l116[]={626 static IssmPDouble l116[]={ 627 627 0.333333333333333, 0.005238916103123, 0.497380541948438, 628 628 0.497380541948438, 0.173061122901295, 0.413469438549352, … … 643 643 0.085283615682657, 0.900399064086661, 0.085283615682657, 644 644 0.900399064086661}; 645 static double l216[]={645 static IssmPDouble l216[]={ 646 646 0.333333333333333, 0.497380541948438, 0.005238916103123, 647 647 0.497380541948438, 0.413469438549352, 0.173061122901295, … … 662 662 0.014317320230681, 0.014317320230681, 0.900399064086661, 663 663 0.085283615682657}; 664 static double l316[]={664 static IssmPDouble l316[]={ 665 665 0.333333333333333, 0.497380541948438, 0.497380541948438, 666 666 0.005238916103123, 0.413469438549352, 0.413469438549352, … … 681 681 0.900399064086661, 0.085283615682657, 0.014317320230681, 682 682 0.014317320230681}; 683 /*}}} 2*/684 /*p=17, npoint=61{{{ 2*/685 static double wgt17[]={683 /*}}}*/ 684 /*p=17, npoint=61{{{*/ 685 static IssmPDouble wgt17[]={ 686 686 0.057914928034477, 0.008822054327014, 0.008822054327014, 687 687 0.008822054327014, 0.025410682752829, 0.025410682752829, … … 705 705 0.011545213295771, 0.011545213295771, 0.011545213295771, 706 706 0.011545213295771}; 707 static double l117[]={707 static IssmPDouble l117[]={ 708 708 0.333333333333333, 0.005658918886452, 0.497170540556774, 709 709 0.497170540556774, 0.035647354750751, 0.482176322624625, … … 727 727 0.080711313679564, 0.904625504095608, 0.080711313679564, 728 728 0.904625504095608}; 729 static double l217[]={729 static IssmPDouble l217[]={ 730 730 0.333333333333333, 0.497170540556774, 0.005658918886452, 731 731 0.497170540556774, 0.482176322624625, 0.035647354750751, … … 749 749 0.014663182224828, 0.014663182224828, 0.904625504095608, 750 750 0.080711313679564}; 751 static double l317[]={751 static IssmPDouble l317[]={ 752 752 0.333333333333333, 0.497170540556774, 0.497170540556774, 753 753 0.005658918886452, 0.482176322624625, 0.482176322624625, … … 771 771 0.904625504095608, 0.080711313679564, 0.014663182224828, 772 772 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[]={ 777 777 0.053364381350150, 0.015713921277179, 0.015713921277179, 778 778 0.015713921277179, 0.032495554156279, 0.032495554156279, … … 799 799 0.000079999375178, 0.000079999375178, 0.000079999375178, 800 800 0.000079999375178}; 801 static double l118[]={801 static IssmPDouble l118[]={ 802 802 0.333333333333333, 0.013310382738157, 0.493344808630921, 803 803 0.493344808630921, 0.061578811516086, 0.469210594241957, … … 824 824 0.020874755282586, 1.014347260005363, 0.020874755282586, 825 825 1.014347260005363}; 826 static double l218[]={826 static IssmPDouble l218[]={ 827 827 0.333333333333333, 0.493344808630921, 0.013310382738157, 828 828 0.493344808630921, 0.469210594241957, 0.061578811516086, … … 849 849 -0.035222015287949,-0.035222015287949, 1.014347260005363, 850 850 0.020874755282586}; 851 static double l318[]={851 static IssmPDouble l318[]={ 852 852 0.333333333333333, 0.493344808630921, 0.493344808630921, 853 853 0.013310382738157, 0.469210594241957, 0.469210594241957, … … 874 874 1.014347260005363, 0.020874755282586,-0.035222015287949, 875 875 -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[]={ 880 880 0.056995437856306, 0.017893352515055, 0.017893352515055, 881 881 0.017893352515055, 0.038775849701151, 0.038775849701151, … … 903 903 0.006581669842530, 0.006581669842530, 0.006581669842530, 904 904 0.006581669842530}; 905 static double l119[]={905 static IssmPDouble l119[]={ 906 906 0.333333333333333, 0.020780025853987, 0.489609987073006, 907 907 0.489609987073006, 0.090926214604215, 0.454536892697893, … … 929 929 0.065494628082938, 0.924344252620784, 0.065494628082938, 930 930 0.924344252620784}; 931 static double l219[]={931 static IssmPDouble l219[]={ 932 932 0.333333333333333, 0.489609987073006, 0.020780025853987, 933 933 0.489609987073006, 0.454536892697893, 0.090926214604215, … … 955 955 0.010161119296278, 0.010161119296278, 0.924344252620784, 956 956 0.065494628082938}; 957 static double l319[]={957 static IssmPDouble l319[]={ 958 958 0.333333333333333, 0.489609987073006, 0.489609987073006, 959 959 0.020780025853987, 0.454536892697893, 0.454536892697893, … … 981 981 0.924344252620784, 0.065494628082938, 0.010161119296278, 982 982 0.010161119296278}; 983 /*}}} 2*/984 /*p=20, npoint=79 {{{ 2*/985 static double wgt20[]={983 /*}}}*/ 984 /*p=20, npoint=79 {{{*/ 985 static IssmPDouble wgt20[]={ 986 986 0.057256499746719, 0.001501721280705, 0.001501721280705, 987 987 0.001501721280705, 0.020195803723819, 0.020195803723819, … … 1011 1011 0.006190192638113, 0.006190192638113, 0.006190192638113, 1012 1012 0.006190192638113}; 1013 static double l120[]={1013 static IssmPDouble l120[]={ 1014 1014 0.333333333333333,-0.001900928704400, 0.500950464352200, 1015 1015 0.500950464352200, 0.023574084130543, 0.488212957934729, … … 1039 1039 0.059696109149007, 0.929756171556853, 0.059696109149007, 1040 1040 0.929756171556853}; 1041 static double l220[]={1041 static IssmPDouble l220[]={ 1042 1042 0.333333333333333, 0.500950464352200,-0.001900928704400, 1043 1043 0.500950464352200, 0.488212957934729, 0.023574084130543, … … 1067 1067 0.010547719294141, 0.010547719294141, 0.929756171556853, 1068 1068 0.059696109149007}; 1069 static double l320[]={1069 static IssmPDouble l320[]={ 1070 1070 0.333333333333333, 0.500950464352200, 0.500950464352200, 1071 1071 -0.001900928704400, 0.488212957934729, 0.488212957934729, … … 1095 1095 0.929756171556853, 0.059696109149007, 0.010547719294141, 1096 1096 0.010547719294141}; 1097 /*}}} 2*/1098 1099 static double* wgtp[MAX_TRIA_SYM_ORD]={1097 /*}}}*/ 1098 1099 static IssmPDouble* wgtp[MAX_TRIA_SYM_ORD]={ 1100 1100 wgt1 ,wgt2 ,wgt3 ,wgt4 ,wgt5 , 1101 1101 wgt6 ,wgt7 ,wgt8 ,wgt9 ,wgt10, 1102 1102 wgt11,wgt12,wgt13,wgt14,wgt15, 1103 1103 wgt16,wgt17,wgt18,wgt19,wgt20}; 1104 static double* l1p [MAX_TRIA_SYM_ORD]={1104 static IssmPDouble* l1p [MAX_TRIA_SYM_ORD]={ 1105 1105 l11 ,l12 ,l13 ,l14 ,l15 , 1106 1106 l16 ,l17 ,l18 ,l19 ,l110 , 1107 1107 l111 ,l112 ,l113 ,l114 ,l115 , 1108 1108 l116 ,l117 ,l118 ,l119 ,l120 }; 1109 static double* l2p [MAX_TRIA_SYM_ORD]={1109 static IssmPDouble* l2p [MAX_TRIA_SYM_ORD]={ 1110 1110 l21 ,l22 ,l23 ,l24 ,l25 , 1111 1111 l26 ,l27 ,l28 ,l29 ,l210 , 1112 1112 l211 ,l212 ,l213 ,l214 ,l215 , 1113 1113 l216 ,l217 ,l218 ,l219 ,l220 }; 1114 static double* l3p [MAX_TRIA_SYM_ORD]={1114 static IssmPDouble* l3p [MAX_TRIA_SYM_ORD]={ 1115 1115 l31 ,l32 ,l33 ,l34 ,l35 , 1116 1116 l36 ,l37 ,l38 ,l39 ,l310 , … … 1118 1118 l316 ,l317 ,l318 ,l319 ,l320 }; 1119 1119 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 // _p rintf_(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); 1142 1142 1143 1143 /* check to see if Gauss points need to be calculated */ … … 1150 1150 *pngaus=np[iord-1]; 1151 1151 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); 1156 1156 1157 1157 for (i=0; i<*pngaus; i++) { … … 1168 1168 *pngaus=nigaus*nigaus; 1169 1169 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); 1174 1174 1175 1175 /* get the gauss points in each direction */ … … 1195 1195 } 1196 1196 } 1197 x free((void **)&xwgt );1198 x free((void **)&xgaus);1197 xDelete<IssmPDouble>(xwgt ); 1198 xDelete<IssmPDouble>(xgaus); 1199 1199 } 1200 1200 1201 // _p rintf_(true,"GaussLegendreTria - ngaus=%d\n",*pngaus);1201 // _pprintLine_("GaussLegendreTria - ngaus=" << *pngaus); 1202 1202 // for (i=0; i<*pngaus; i++) 1203 1203 // _printf_(true,"i=%d: l1gaus=%f,l2gaus=%f,l3gaus=%f,wgt=%f\n", … … 1205 1205 1206 1206 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{{{*/ 1209 void GaussLegendreTetra( int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord ) { 1210 1210 /* Gauss quadrature points for the tetrahedron. 1211 1211 … … 1220 1220 /*Intermediaries*/ 1221 1221 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; 1224 1224 1225 1225 /*Hardcoded Gauss points definition*/ 1226 /*p= 1, npoint= 1 {{{ 2*/1227 static double wgt1[]={1226 /*p= 1, npoint= 1 {{{*/ 1227 static IssmPDouble wgt1[]={ 1228 1228 1.000000000000000}; 1229 static double l11[]={1229 static IssmPDouble l11[]={ 1230 1230 0.250000000000000}; 1231 static double l21[]={1231 static IssmPDouble l21[]={ 1232 1232 0.250000000000000}; 1233 static double l31[]={1233 static IssmPDouble l31[]={ 1234 1234 0.250000000000000}; 1235 static double l41[]={1235 static IssmPDouble l41[]={ 1236 1236 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[]={ 1241 1241 0.250000000000000, 0.250000000000000, 0.250000000000000, 1242 1242 0.250000000000000}; 1243 static double l12[]={1243 static IssmPDouble l12[]={ 1244 1244 0.585410196624969, 0.138196601125011, 0.138196601125011, 1245 1245 0.138196601125011}; 1246 static double l22[]={1246 static IssmPDouble l22[]={ 1247 1247 0.138196601125011, 0.585410196624969, 0.138196601125011, 1248 1248 0.138196601125011}; 1249 static double l32[]={1249 static IssmPDouble l32[]={ 1250 1250 0.138196601125011, 0.138196601125011, 0.585410196624969, 1251 1251 0.138196601125011}; 1252 static double l42[]={1252 static IssmPDouble l42[]={ 1253 1253 0.138196601125011, 0.138196601125011, 0.138196601125011, 1254 1254 0.585410196624969}; 1255 /*}}} 2*/1256 /*p= 3, npoint= 5 {{{ 2*/1257 static double wgt3[]={1255 /*}}}*/ 1256 /*p= 3, npoint= 5 {{{*/ 1257 static IssmPDouble wgt3[]={ 1258 1258 -0.800000000000000, 0.450000000000000, 0.450000000000000, 1259 1259 0.450000000000000, 0.450000000000000}; 1260 static double l13[]={1260 static IssmPDouble l13[]={ 1261 1261 0.250000000000000, 0.500000000000000, 0.166666666666667, 1262 1262 0.166666666666667, 0.166666666666667}; 1263 static double l23[]={1263 static IssmPDouble l23[]={ 1264 1264 0.250000000000000, 0.166666666666667, 0.500000000000000, 1265 1265 0.166666666666667, 0.166666666666667}; 1266 static double l33[]={1266 static IssmPDouble l33[]={ 1267 1267 0.250000000000000, 0.166666666666667, 0.166666666666667, 1268 1268 0.500000000000000, 0.166666666666667}; 1269 static double l43[]={1269 static IssmPDouble l43[]={ 1270 1270 0.250000000000000, 0.166666666666667, 0.166666666666667, 1271 1271 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[]={ 1276 1276 -0.013155555555556, 0.007622222222222, 0.007622222222222, 1277 1277 0.007622222222222, 0.007622222222222, 0.024888888888889, 1278 1278 0.024888888888889, 0.024888888888889, 0.024888888888889, 1279 1279 0.024888888888889, 0.024888888888889}; 1280 static double l14[]={1280 static IssmPDouble l14[]={ 1281 1281 0.250000000000000, 0.785714285714286, 0.071428571428571, 1282 1282 0.071428571428571, 0.071428571428571, 0.399403576166799, 1283 1283 0.399403576166799, 0.399403576166799, 0.100596423833201, 1284 1284 0.100596423833201, 0.100596423833201}; 1285 static double l24[]={1285 static IssmPDouble l24[]={ 1286 1286 0.250000000000000, 0.071428571428571, 0.785714285714286, 1287 1287 0.071428571428571, 0.071428571428571, 0.399403576166799, 1288 1288 0.100596423833201, 0.100596423833201, 0.399403576166799, 1289 1289 0.399403576166799, 0.100596423833201}; 1290 static double l34[]={1290 static IssmPDouble l34[]={ 1291 1291 0.250000000000000, 0.071428571428571, 0.071428571428571, 1292 1292 0.785714285714286, 0.071428571428571, 0.100596423833201, 1293 1293 0.399403576166799, 0.100596423833201, 0.399403576166799, 1294 1294 0.100596423833201, 0.399403576166799}; 1295 static double l44[]={1295 static IssmPDouble l44[]={ 1296 1296 0.250000000000000, 0.071428571428571, 0.071428571428571, 1297 1297 0.071428571428571, 0.785714285714286, 0.100596423833201, 1298 1298 0.100596423833201, 0.399403576166799, 0.100596423833201, 1299 1299 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[]={ 1304 1304 0.030283678097089, 0.006026785714286, 0.006026785714286, 1305 1305 0.006026785714286, 0.006026785714286, 0.011645249086029, … … 1307 1307 0.010949141561386, 0.010949141561386, 0.010949141561386, 1308 1308 0.010949141561386, 0.010949141561386, 0.010949141561386}; 1309 static double l15[]={1309 static IssmPDouble l15[]={ 1310 1310 0.250000000000000, 0.000000000000000, 0.333333333333333, 1311 1311 0.333333333333333, 0.333333333333333, 0.727272727272727, … … 1313 1313 0.066550153573664, 0.066550153573664, 0.066550153573664, 1314 1314 0.433449846426336, 0.433449846426336, 0.433449846426336}; 1315 static double l25[]={1315 static IssmPDouble l25[]={ 1316 1316 0.250000000000000, 0.333333333333333, 0.000000000000000, 1317 1317 0.333333333333333, 0.333333333333333, 0.090909090909091, … … 1319 1319 0.066550153573664, 0.433449846426336, 0.433449846426336, 1320 1320 0.066550153573664, 0.066550153573664, 0.433449846426336}; 1321 static double l35[]={1321 static IssmPDouble l35[]={ 1322 1322 0.250000000000000, 0.333333333333333, 0.333333333333333, 1323 1323 0.000000000000000, 0.333333333333333, 0.090909090909091, … … 1325 1325 0.433449846426336, 0.066550153573664, 0.433449846426336, 1326 1326 0.066550153573664, 0.433449846426336, 0.066550153573664}; 1327 static double l45[]={1327 static IssmPDouble l45[]={ 1328 1328 0.250000000000000, 0.333333333333333, 0.333333333333333, 1329 1329 0.333333333333333, 0.000000000000000, 0.090909090909091, … … 1331 1331 0.433449846426336, 0.433449846426336, 0.066550153573664, 1332 1332 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[]={ 1337 1337 0.006653791709695, 0.006653791709695, 0.006653791709695, 1338 1338 0.006653791709695, 0.001679535175887, 0.001679535175887, … … 1343 1343 0.008035714285714, 0.008035714285714, 0.008035714285714, 1344 1344 0.008035714285714, 0.008035714285714, 0.008035714285714}; 1345 static double l16[]={1345 static IssmPDouble l16[]={ 1346 1346 0.356191386222545, 0.214602871259152, 0.214602871259152, 1347 1347 0.214602871259152, 0.877978124396166, 0.040673958534611, … … 1353 1353 0.269672331458316, 0.603005664791649, 0.269672331458316, 1354 1354 0.603005664791649, 0.269672331458316, 0.603005664791649}; 1355 static double l26[]={1355 static IssmPDouble l26[]={ 1356 1356 0.214602871259152, 0.356191386222545, 0.214602871259152, 1357 1357 0.214602871259152, 0.040673958534611, 0.877978124396166, … … 1363 1363 0.063661001875018, 0.063661001875018, 0.063661001875018, 1364 1364 0.063661001875018, 0.603005664791649, 0.269672331458316}; 1365 static double l36[]={1365 static IssmPDouble l36[]={ 1366 1366 0.214602871259152, 0.214602871259152, 0.356191386222545, 1367 1367 0.214602871259152, 0.040673958534611, 0.040673958534611, … … 1373 1373 0.063661001875018, 0.063661001875018, 0.603005664791649, 1374 1374 0.269672331458316, 0.063661001875018, 0.063661001875018}; 1375 static double l46[]={1375 static IssmPDouble l46[]={ 1376 1376 0.214602871259152, 0.214602871259152, 0.214602871259152, 1377 1377 0.356191386222545, 0.040673958534611, 0.040673958534611, … … 1383 1383 0.603005664791649, 0.269672331458316, 0.063661001875018, 1384 1384 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 // _p rintf_(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); 1401 1401 1402 1402 /* check to see if Gauss points need to be calculated */ … … 1410 1410 *pngaus=np[iord-1]; 1411 1411 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); 1417 1417 1418 1418 for (i=0; i<*pngaus; i++) { … … 1430 1430 *pngaus=nigaus*nigaus*nigaus; 1431 1431 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); 1437 1437 1438 1438 /* get the gauss points in each direction */ … … 1467 1467 } 1468 1468 } 1469 x free((void **)&xwgt );1470 x free((void **)&xgaus);1469 xDelete<IssmPDouble>(xwgt ); 1470 xDelete<IssmPDouble>(xgaus); 1471 1471 } 1472 }/*}}} 1*/1473 /*FUNCTION GaussLobatto{{{ 1*/1474 void GaussLobatto( double** pxgaus, double** pxwgt, int ngaus ) {1472 }/*}}}*/ 1473 /*FUNCTION GaussLobatto{{{*/ 1474 void GaussLobatto( IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus ) { 1475 1475 /*Gauss-Lobatto quadrature points. 1476 1476 … … 1488 1488 1489 1489 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; 1493 1493 1494 1494 /*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}; 1497 1497 1498 1498 /*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}; 1501 1501 1502 1502 /*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}; 1505 1505 1506 1506 /*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}; 1509 1509 1510 1510 /*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 // _p rintf_(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); 1526 1526 1527 1527 /* check to see if Gauss points need to be calculated */ … … 1539 1539 1540 1540 /* 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); 1543 1543 1544 1544 /* calculate the Legendre recurrence coefficients */ … … 1575 1575 /* calculate the Gauss points */ 1576 1576 GaussRecur(*pxgaus, *pxwgt, ngaus, alpha, beta ); 1577 x free((void **)&beta );1578 x free((void **)&alpha);1577 xDelete<IssmPDouble>(beta ); 1578 xDelete<IssmPDouble>(alpha); 1579 1579 } 1580 1580 1581 }/*}}} 1*/1582 /*FUNCTION GaussRecur{{{ 1*/1583 void GaussRecur( double* zero, double* weight, int n, double* alpha, double* beta ) {1581 }/*}}}*/ 1582 /*FUNCTION GaussRecur{{{*/ 1583 void GaussRecur( IssmPDouble* zero, IssmPDouble* weight, int n, IssmPDouble* alpha, IssmPDouble* beta ) { 1584 1584 /*Gauss quadrature points from recursion coefficients. 1585 1585 * … … 1589 1589 /*Intermediaries*/ 1590 1590 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; 1593 1593 1594 1594 if (n==1){ … … 1598 1598 } 1599 1599 1600 work= (double*)xmalloc(n*sizeof(double));1600 work=xNew<IssmPDouble>(n); 1601 1601 1602 1602 zero[0] =alpha[0]; … … 1669 1669 } while (iter < MAX_GAUS_ITER); 1670 1670 if (iter >= MAX_GAUS_ITER) { 1671 x free((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); 1673 1673 } 1674 1674 } … … 1698 1698 1699 1699 /*Cleanup*/ 1700 x free((void **)&work);1701 1702 }/*}}} 1*/1700 xDelete<IssmPDouble>(work); 1701 1702 }/*}}}*/ 1703 1703 1704 1704 /*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{{{*/ 1706 void gaussQuad( IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, int nigaus, int njgaus ) { 1707 1707 /*Gauss quadrature points for the quadrilaterial.*/ 1708 1708 … … 1710 1710 GaussLegendreLinear(pxgaus, pxwgt, nigaus); 1711 1711 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{{{*/ 1714 void gaussHexa( IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, IssmPDouble** pzgaus, IssmPDouble ** pzwgt, int nigaus, int njgaus, int nkgaus ) { 1715 1715 /*Gauss quadrature points for the hexahedron.*/ 1716 1716 … … 1719 1719 GaussLegendreLinear(pegaus, pewgt, njgaus); 1720 1720 GaussLegendreLinear(pzgaus, pzwgt, nkgaus); 1721 }/*}}} 1*/1721 }/*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/GaussPoints.h
r5808 r12878 3 3 */ 4 4 5 #include "../../include/types.h" 5 6 #ifndef _GAUSSPOINTS_H 6 7 #define _GAUSSPOINTS_H 7 8 8 9 #define MAX_LINE_GAUS_PTS 4 9 void GaussLegendreLinear( double** pxgaus, double** pxwgt, int ngaus );10 void GaussLegendreLinear(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus); 10 11 #define MAX_TRIA_SYM_ORD 20 11 void GaussLegendreTria( int* pngaus, double** pl1, double** pl2, double** pl3, double** pwgt, int iord);12 void GaussLegendreTria(int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pwgt, int iord); 12 13 #define MAX_TETRA_SYM_ORD 6 13 void GaussLegendreTetra( int* pngaus, double** pl1, double** pl2, double** pl3, double** pl4, double** pwgt, int iord);14 void GaussLegendreTetra(int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord); 14 15 #define MAX_LINE_GLOB_PTS 5 15 void GaussLobatto( double** pxgaus, double** pxwgt, int ngaus );16 void GaussLobatto(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus); 16 17 #define MAX_GAUS_ITER 30 17 void GaussRecur( double* zero, double* weight, int n, double* alpha, double* beta);18 void GaussRecur(IssmPDouble* zero, IssmPDouble* weight, int n, IssmPDouble* alpha, IssmPDouble* beta); 18 19 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);20 void gaussQuad(IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, int nigaus, int njgaus); 21 void gaussHexa(IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, IssmPDouble** pzgaus, IssmPDouble ** pzwgt, int nigaus, int njgaus, int nkgaus); 21 22 22 23 #endif -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/IsInputConverged.cpp
r9883 r12878 12 12 #endif 13 13 14 #include "../../ objects/objects.h"14 #include "../../classes/objects/objects.h" 15 15 16 void IsInputConverged( double* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){16 void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){ 17 17 18 18 int i,j; 19 19 20 20 /*output: */ 21 double eps;21 IssmDouble eps; 22 22 23 23 /*intermediary: */ 24 double *newvalues = NULL;25 double *oldvalues = NULL;24 IssmDouble *newvalues = NULL; 25 IssmDouble *oldvalues = NULL; 26 26 int num_values; 27 double ndu = 0;28 double nu = 0;27 IssmDouble ndu = 0; 28 IssmDouble nu = 0; 29 29 30 30 if(criterion_enum==RelativeEnum){ … … 50 50 51 51 /*now, compute eps: */ 52 if( nu)eps=ndu/nu;52 if(reCast<bool>(nu))eps=ndu/nu; 53 53 else eps=0; 54 54 } 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!"); 56 56 57 57 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptimalSearch.cpp
r9761 r12878 10 10 11 11 #include "./numerics.h" 12 #include "../../ objects/objects.h"12 #include "../../classes/objects/objects.h" 13 13 #include "../../io/io.h" 14 14 #include "../../include/include.h" … … 16 16 #include <float.h> 17 17 18 void OptimalSearch( double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs){18 void OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){ 19 19 20 20 /* This routine is optimizing a given function*/ 21 21 22 22 /*function values: */ 23 double fx1,fx2,fxbest;24 double x1,x2,xmin,xbest;23 IssmDouble fx1,fx2,fxbest; 24 IssmDouble x1,x2,xmin,xbest; 25 25 26 26 /*tolerances: */ 27 double seps;28 double tolerance=1.e-4;27 IssmDouble seps; 28 IssmDouble tolerance=1.e-4; 29 29 int maxiter; 30 30 … … 41 41 //get the value of the function at the first boundary 42 42 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"); 46 49 47 50 //update tolerances … … 54 57 iter++; 55 58 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))); 58 62 59 63 //Stop the optimization? 60 64 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); 62 66 loop=false; 63 67 } 64 68 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'"); 66 70 loop=false; 67 71 } -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptionsFromAnalysis.cpp
r12168 r12878 9 9 #endif 10 10 11 #include "../../objects/objects.h" 11 #include <cstring> 12 13 #include "../../classes/objects/objects.h" 12 14 #include "../../Container/Parameters.h" 13 15 #include "../../EnumDefinitions/EnumDefinitions.h" … … 20 22 /*intermediary: */ 21 23 int dummy; 22 double* analyses=NULL;24 IssmDouble* analyses=NULL; 23 25 char** strings=NULL; 24 26 char* string=NULL; … … 55 57 if (found==-1){ 56 58 /*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)); 58 60 } 59 61 60 62 /*ok, grab the option string: */ 61 outstring= (char*)xmalloc((strlen(strings[found])+1)*sizeof(char));63 outstring=xNew<char>(strlen(strings[found])+1); 62 64 strcpy(outstring,strings[found]); 63 65 64 66 /*Free ressources*/ 65 x free((void**)&analyses);67 xDelete<IssmDouble>(analyses); 66 68 for(i=0;i<numanalyses;i++){ 67 69 string=strings[i]; 68 x free((void**)&string);70 xDelete<char>(string); 69 71 } 70 xfree((void**)&strings); 71 72 72 xDelete<char*>(strings); 73 73 return outstring; 74 74 } -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/PetscOptionsFromAnalysis.cpp
r11708 r12878 9 9 #endif 10 10 11 #include "../../ objects/objects.h"11 #include "../../classes/objects/objects.h" 12 12 #include "../../Container/Parameters.h" 13 13 #include "../../toolkits/toolkits.h" … … 39 39 40 40 /*Free ressources:*/ 41 x free((void**)&options);41 xDelete<char>(options); 42 42 } -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/Synchronize.sh
r12168 r12878 8 8 #Get all lines of Verbosity.cpp 9 9 cat 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 {{{ 110 #Build header of Verbosity.cpp {{{ 11 11 cat <<END > Verbosity.cpp 12 12 /* … … 127 127 done 128 128 129 #Add footer of Verbosity.cpp{{{ 1129 #Add footer of Verbosity.cpp{{{ 130 130 cat <<END >> Verbosity.cpp 131 131 … … 135 135 void SetVerbosityLevel(int level){ 136 136 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 << ")"); 138 138 139 139 verbositylevel = level; … … 147 147 END 148 148 #}}} 149 #Complete verbose.m {{{ 1149 #Complete verbose.m {{{ 150 150 VERBOSEPATH="$ISSM_DIR/src/m/classes/verbose.m" 151 151 cat $VERBOSEPATH | sed "/%BEGINFIELDS/,$ d" > temp_begin -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/UnitConversion.cpp
r12004 r12878 3 3 */ 4 4 5 /*headers {{{ 1*/5 /*headers {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 11 11 12 12 #include "../../Container/Container.h" 13 #include "../../ objects/objects.h"13 #include "../../classes/objects/objects.h" 14 14 #include "../../EnumDefinitions/EnumDefinitions.h" 15 15 #include "../../shared/shared.h" 16 16 17 double UnitConversionScaleFactor(int type_enum);17 IssmDouble UnitConversionScaleFactor(int type_enum); 18 18 /*}}}*/ 19 19 20 void UnitConversion( double* values, int numvalues,int direction_enum, int type_enum){20 void UnitConversion(IssmDouble* values, int numvalues,int direction_enum, int type_enum){ 21 21 22 double scale;22 IssmDouble scale; 23 23 int i; 24 24 … … 29 29 if(direction_enum==IuToExtEnum) for(i=0;i<numvalues;i++)values[i]=values[i]*scale; 30 30 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. "); 32 32 33 33 } 34 34 35 double UnitConversion(double value, int direction_enum, int type_enum){35 IssmDouble UnitConversion(IssmDouble value, int direction_enum, int type_enum){ 36 36 37 37 UnitConversion(&value,1,direction_enum,type_enum); … … 41 41 42 42 43 double UnitConversionScaleFactor(int type_enum){43 IssmDouble UnitConversionScaleFactor(int type_enum){ 44 44 45 double yts=365.0*24.0*3600.0;45 IssmDouble yts=365.0*24.0*3600.0; 46 46 47 double scale;47 IssmDouble scale; 48 48 switch(type_enum){ 49 49 case TimesteppingStartTimeEnum: scale=1.0/yts;break; //yr … … 66 66 case SurfaceforcingsPrecipitationEnum: scale=yts;break; //m/yr 67 67 case SurfaceforcingsMassBalanceEnum: scale=yts;break; //m/yr 68 case SurfaceforcingsSmbPosMaxEnum: scale=yts;break; //m/yr 69 case SurfaceforcingsSmbPosMinEnum: scale=yts;break; //m/yr 70 case SurfaceforcingsAPosEnum: scale=yts;break; //m/yr 71 case SurfaceforcingsBPosEnum: scale=yts;break; //m/yr 72 case SurfaceforcingsANegEnum: scale=yts;break; //m/yr 73 case SurfaceforcingsBNegEnum: scale=yts;break; //m/yr 68 74 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) 70 77 default: scale=1.0; break; 71 78 } -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/Verbosity.cpp
r12168 r12878 34 34 void SetVerbosityLevel(int level){ 35 35 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 << ")"); 37 37 38 38 verbositylevel = level; -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/XZvectorsToCoordinateSystem.cpp
r12168 r12878 5 5 #include <math.h> 6 6 7 void XZvectorsToCoordinateSystem( double* T,double* xzvectors){7 void XZvectorsToCoordinateSystem(IssmDouble* T,IssmDouble* xzvectors){ 8 8 9 9 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; 12 12 13 13 for(i=0;i<6;i++){ 14 if( isnan(xzvectors[i])){14 if(xIsNan<IssmDouble>(xzvectors[i])){ 15 15 /*At least one NaN found: default to Id*/ 16 16 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 9 9 #endif 10 10 11 void cross(double* result,double* vector1,double* vector2){ 11 #include "../../include/include.h" 12 13 void cross(IssmDouble* result,IssmDouble* vector1,IssmDouble* vector2){ 12 14 13 15 /*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 9 9 #endif 10 10 11 #include "../../include/include.h" 11 12 12 double min(double a,double b){13 IssmDouble min(IssmDouble a,IssmDouble b){ 13 14 if (a<b)return a; 14 15 else return b; … … 18 19 else return b; 19 20 } 20 double max(double a,double b){21 IssmDouble max(IssmDouble a,IssmDouble b){ 21 22 if (a>b)return a; 22 23 else return b; -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/isnan.cpp
r2241 r12878 1 1 /*This routine only used by Intel compler: */ 2 #ifdef _INTEL_WIN_3 2 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_ 7 template <> int xIsNan<adouble> (const adouble& X) { 8 return isnan(X.getValue()); 7 9 } 8 10 #endif 9 -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/isnan.h
r11092 r12878 3 3 */ 4 4 5 #ifndef _ ISNAN_INTEL_H_6 #define _ ISNAN_INTEL_H_5 #ifndef _XISNAN_H_ 6 #define _XISNAN_H_ 7 7 8 #include <cmath> 9 10 template <class T> int xIsNan(const T& X) { 8 11 #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_ 19 template <> int xIsNan<adouble> (const adouble& X); 10 20 #endif 11 21 12 22 #endif 13 -
issm/branches/trunk-jpl-damage/src/c/shared/Numerics/numerics.h
r11708 r12878 9 9 #include "./GaussPoints.h" 10 10 #include "./isnan.h" 11 #include "./recast.h" 11 12 12 13 class Input; … … 16 17 struct OptPars; 17 18 18 double min(double a,double b);19 double max(double a,double b);19 IssmDouble min(IssmDouble a,IssmDouble b); 20 IssmDouble max(IssmDouble a,IssmDouble b); 20 21 int min(int a,int b); 21 22 int 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);23 IssmDouble OptFunc(IssmDouble scalar, OptArgs* optargs); 24 void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs); 25 void OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs); 26 void cross(IssmDouble* result,IssmDouble* vector1,IssmDouble* vector2); 27 void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum); 28 void UnitConversion(IssmDouble* values, int numvalues,int direction_enum, int type_enum); 29 IssmDouble UnitConversion(IssmDouble value, int direction_enum, int type_enum); 29 30 char* OptionsFromAnalysis(Parameters* parameters,int analysis_type); 30 void XZvectorsToCoordinateSystem( double* T,double* xzvectors);31 void XZvectorsToCoordinateSystem(IssmDouble* T,IssmDouble* xzvectors); 31 32 #ifdef _HAVE_PETSC_ 32 33 void PetscOptionsFromAnalysis(Parameters* parameters,int analysis_type); -
issm/branches/trunk-jpl-damage/src/c/shared/Sorting/binary_search.cpp
r9320 r12878 11 11 #include <stdio.h> 12 12 13 int binary_search(int* poffset,int target, 13 int binary_search(int* poffset,int target,int* sorted_integers,int num_integers){ 14 14 15 15 /*output: */ 16 16 int offset; //offset, if found 17 int found=0; 17 int found=0; //found=0 if target is not found, 1 otherwise. 18 18 19 19 /*intermediary: */ … … 64 64 return found; 65 65 } 66 -
issm/branches/trunk-jpl-damage/src/c/shared/Sorting/sorting.h
r1 r12878 6 6 #define _SORTING_H_ 7 7 8 int binary_search(int* poffset,int target, int* sorted_integers,int num_integers); 9 8 int binary_search(int* poffset,int target,int* sorted_integers,int num_integers); 10 9 11 10 #endif //ifndef _SORTING_H_ 12 -
issm/branches/trunk-jpl-damage/src/c/shared/String/DescriptorIndex.cpp
r9336 r12878 23 23 /*retrieve first token, separated by underscore: */ 24 24 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!"); 26 26 27 27 if (strncmp(pch,"scaled",6)==0){ 28 28 /*we have a scaled variable. recover the root: */ 29 29 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!"); 31 31 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 32 32 … … 44 44 /*we have an indexed variable. recover the root: */ 45 45 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!"); 47 47 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 48 48 /*now recover the index: */ 49 49 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!"); 51 51 sscanf(pch,"%i",pindex); 52 52 return IndexedEnum; … … 55 55 /*we have an indexed variable. recover the root: */ 56 56 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!"); 58 58 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 59 59 /*now recover the index: */ 60 60 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!"); 62 62 sscanf(pch,"%i",pindex); 63 63 return NodalEnum; -
issm/branches/trunk-jpl-damage/src/c/shared/Threads/LaunchThread.cpp
r9320 r12878 20 20 21 21 #include "./issm_threads.h" 22 #include "../Alloc/ alloc.h"22 #include "../Alloc/xNewDelete.h" 23 23 #include "../Exceptions/exceptions.h" 24 24 #include "../../include/include.h" … … 28 28 #ifdef _MULTITHREADING_ 29 29 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; 34 33 35 34 /*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); 38 37 39 38 for(i=0;i<num_threads;i++){ … … 42 41 handles[i].num=num_threads; 43 42 } 44 45 43 for(i=0;i<num_threads;i++){ 46 44 47 45 if(pthread_create(threads+i,NULL,function,(void*)(handles+i))){ 48 _error _("pthread_create error");46 _error2_("pthread_create error"); 49 47 } 50 48 } 51 49 for(i=0;i<num_threads;i++){ 52 50 if(pthread_join(threads[i],(void**)&status)){ 53 _error _("pthread_join error");51 _error2_("pthread_join error"); 54 52 } 55 53 } 56 54 57 55 /*Free ressources:*/ 58 x free((void**)&threads);59 x free((void**)&handles);56 xDelete<pthread_t>(threads); 57 xDelete<pthread_handle>(handles); 60 58 61 59 #else … … 67 65 function((void*)&handle); 68 66 #endif 69 70 67 } -
issm/branches/trunk-jpl-damage/src/c/shared/TriMesh/SplitMeshForRifts.cpp
r12168 r12878 3 3 */ 4 4 #include "./trimesh.h" 5 5 #include "../Alloc/xNewDelete.h" 6 6 #include "../Alloc/alloc.h" 7 7 … … 52 52 53 53 /*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! 55 55 for (i=0;i<nriftsegs;i++){ 56 56 for (j=0;j<2;j++){ -
issm/branches/trunk-jpl-damage/src/c/shared/TriMesh/TriMeshUtils.cpp
r12168 r12878 7 7 #include "./trimesh.h" 8 8 #include "../Exceptions/exceptions.h" 9 #include "../Alloc/xNewDelete.h" 9 10 #include "../Alloc/alloc.h" 10 11 #include "../../include/include.h" … … 53 54 current_size=max_number_elements; 54 55 NumGridElements=0; 55 GridElements= (int*)xmalloc(max_number_elements*sizeof(int));56 GridElements=xNew<int>(max_number_elements); 56 57 57 58 for (i=0;i<nel;i++){ … … 65 66 else{ 66 67 /*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)); 68 69 if (!GridElementsRealloc){ 69 70 noerr=0; … … 81 82 cleanup_and_return: 82 83 if(!noerr){ 83 x free((void**)&GridElements);84 xDelete<int>(GridElements); 84 85 } 85 86 /*Allocate return pointers: */ … … 128 129 129 130 /*Allocate segmentflags: */ 130 riftsegments_uncompressed= (int*)xcalloc(nsegs*5,sizeof(int));131 riftsegments_uncompressed=xNewZeroInit<int>(nsegs*5); 131 132 132 133 /*Find the segments that belong to a rift: they are the ones that see two elements. The other ones belong to a boundary … … 165 166 166 167 /*Compress riftsegments_uncompressed:*/ 167 riftsegments= (int*)xmalloc(nriftsegs*4*sizeof(int));168 riftsegments=xNew<int>(nriftsegs*4); 168 169 counter=0; 169 170 for (i=0;i<nsegs;i++){ … … 177 178 } 178 179 179 x free((void**)&riftsegments_uncompressed);180 xDelete<int>(riftsegments_uncompressed); 180 181 181 182 /*Assign output pointers: */ … … 202 203 /*Figure out the list of elements that are on the same side of the rift. To do so, we start from one 203 204 * side of the rift and keep rotating in the same direction:*/ 204 GridElementListOnOneSideOfRift= (int*)xmalloc(NumGridElements*sizeof(int));205 GridElementListOnOneSideOfRift=xNew<int>(NumGridElements); 205 206 //bootstrap the GridElementListOnOneSideOfRift by filling elements from riftsegments: */ 206 207 GridElementListOnOneSideOfRift[0]=*(riftsegments+4*segmentnumber+0); /*this one does not belong to the same side, but is just there … … 241 242 242 243 /*Free ressources: */ 243 x free((void**)&GridElements);244 xDelete<int>(GridElements); 244 245 /*Assign output pointers: */ 245 246 *pNumGridElementListOnOneSideOfRift=NumGridElementListOnOneSideOfRift; … … 380 381 381 382 /*input: */ 382 double * segments=NULL;383 double * segmentmarkerlist=NULL;383 double *segments = NULL; 384 double *segmentmarkerlist = NULL; 384 385 int numsegs; 385 386 386 387 /*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; 392 393 393 394 /*intermediary: */ … … 406 407 /*Allocate new segments: */ 407 408 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); 410 411 411 412 /*Copy new segments info : */ … … 422 423 423 424 /*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); 426 427 for (i=0;i<numrifts;i++){ 427 428 /*Figure out how many segments for rift i: */ … … 431 432 } 432 433 riftsnumsegs[i]=counter; 433 riftsegment= (double*)xmalloc(counter*3*sizeof(double));434 riftsegment=xNew<double>(counter*3); 434 435 /*Copy new segments info :*/ 435 436 counter=0; … … 446 447 447 448 /*Free ressources: */ 448 x free((void**)&segments);449 xDelete<double>(segments); 449 450 450 451 /*Assign output pointers: */ … … 465 466 466 467 /*output: */ 467 int * riftsnumpairs=NULL;468 double ** riftspairs=NULL;468 int *riftsnumpairs = NULL; 469 double **riftspairs = NULL; 469 470 470 471 /*intermediary :*/ … … 474 475 int node1,node2,node3,node4; 475 476 476 riftsnumpairs= (int*)xmalloc(numrifts*sizeof(int));477 riftspairs= (double**)xmalloc(numrifts*sizeof(double*));477 riftsnumpairs=xNew<int>(numrifts); 478 riftspairs=xNew<double*>(numrifts); 478 479 for (i=0;i<numrifts;i++){ 479 480 segments=riftssegments[i]; 480 481 numsegs=riftsnumsegments[i]; 481 482 riftsnumpairs[i]=numsegs; 482 pairs= (double*)xmalloc(2*numsegs*sizeof(double));483 pairs=xNew<double>(2*numsegs); 483 484 for (j=0;j<numsegs;j++){ 484 485 *(pairs+2*j+0)=*(segments+3*j+2); //retrieve element to which this segment belongs. … … 500 501 } 501 502 502 503 503 /*Assign output pointers: */ 504 504 *priftsnumpairs=riftsnumpairs; 505 505 *priftspairs=riftspairs; 506 507 506 return noerr; 508 507 }/*}}}*/ … … 522 521 523 522 /*intermediary: */ 524 double * riftsegments=NULL;525 double * riftpairs=NULL;523 double *riftsegments = NULL; 524 double *riftpairs = NULL; 526 525 int node1,node2,node3,node4,temp_node; 527 526 double el2; 528 527 int newnods; //temporary # node counter. 529 528 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; 534 533 int max_size; 535 534 int redundant; 536 537 535 538 536 /*Recover input: */ … … 562 560 max_size+=rifts1numsegs[i]; 563 561 } 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); 566 564 567 565 /*Go through the rifts segments, and identify which node we are going to merge with its counterpart on the other side … … 678 676 } 679 677 } 680 x free((void**)&x); x=xreal;681 x free((void**)&y); y=yreal;678 xDelete<double>(x); x=xreal; 679 xDelete<double>(y); y=yreal; 682 680 683 681 /*Assign output pointers:*/ … … 688 686 *psegments=segments; 689 687 *pnumsegs=numsegs; 690 691 688 return noerr; 692 689 }/*}}}*/ … … 716 713 *priftflag=riftflag; 717 714 *pnumrifts=numrifts; 718 719 715 return noerr; 720 716 }/*}}}*/ … … 726 722 727 723 /*intermediary: */ 728 double * riftsegments=NULL;729 double * riftpairs=NULL;724 double *riftsegments = NULL; 725 double *riftpairs = NULL; 730 726 int numsegs; 731 727 732 728 /*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; 736 732 737 733 /*node and element manipulation: */ … … 744 740 745 741 /*Allocate byproduct of this routine, riftstips: */ 746 riftstips= (double*)xmalloc(numrifts*2*sizeof(double));742 riftstips=xNew<double>(numrifts*2); 747 743 748 744 /*Go through all rifts: */ … … 754 750 /*Allocate copy of riftsegments and riftpairs, 755 751 *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); 759 755 760 756 /*First find the tips, using the pairs. If a pair of elements has one node in common, this node is a rift tip: */ … … 814 810 *(riftstips+2*i+0)=(double)tip1; 815 811 *(riftstips+2*i+1)=(double)tip2; 816 817 812 818 813 /*We have the two tips for this rift. Go from tip1 to tip2, and figure out the order in which segments are sequential. … … 865 860 } 866 861 867 x free((void**)&order);868 x free((void**)&riftsegments_copy);869 x free((void**)&riftpairs_copy);862 xDelete<int>(order); 863 xDelete<double>(riftsegments_copy); 864 xDelete<double>(riftpairs_copy); 870 865 871 866 } … … 887 882 888 883 /*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; 892 887 893 888 /*intermediary: */ … … 901 896 902 897 /*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); 905 900 906 901 for(i=0;i<numrifts;i++){ … … 910 905 911 906 /*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); 913 908 914 909 /*Go through only one flank of the rifts, not counting the tips: */ … … 1006 1001 riftsnumpenaltypairs[i]=(numsegs/2-1); 1007 1002 } 1008 1009 1010 1003 1011 1004 /*Assign output pointers: */ 1012 1005 *priftspenaltypairs=riftspenaltypairs; 1013 1006 *priftsnumpenaltypairs=riftsnumpenaltypairs; 1014 1015 1007 return noerr; 1016 1008 } … … 1143 1135 *py=y; 1144 1136 *pnods=nods; 1145 1146 1137 return noerr; 1147 1138 } -
issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/wrappershared.h
r12168 r12878 6 6 #define _WRAPPER_SHARED_H_ 7 7 8 #include "../../ objects/objects.h"8 #include "../../classes/objects/objects.h" 9 9 10 10 int ModuleBoot(void); -
issm/branches/trunk-jpl-damage/src/c/shared/shared.h
r12168 r12878 6 6 #define _SHARED_H_ 7 7 8 9 8 #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" 11 12 #include "Exceptions/exceptions.h" 12 13 #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" 13 20 #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"21 21 #include "Wrapper/wrappershared.h" 22 22 -
issm/branches/trunk-jpl-damage/src/c/solutions/AdjointCorePointerFromSolutionEnum.cpp
r9320 r12878 10 10 11 11 #include "../toolkits/toolkits.h" 12 #include "../ objects/objects.h"12 #include "../classes/objects/objects.h" 13 13 #include "../shared/shared.h" 14 14 #include "../EnumDefinitions/EnumDefinitions.h" … … 35 35 break; 36 36 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"); 38 38 break; 39 39 } -
issm/branches/trunk-jpl-damage/src/c/solutions/AnalysisConfiguration.cpp
r11684 r12878 10 10 11 11 #include "../toolkits/toolkits.h" 12 #include "../ objects/objects.h"12 #include "../classes/objects/objects.h" 13 13 #include "../shared/shared.h" 14 14 #include "../EnumDefinitions/EnumDefinitions.h" … … 29 29 case DiagnosticSolutionEnum: 30 30 numanalyses=5; 31 analyses= (int*)xmalloc(numanalyses*sizeof(int));31 analyses=xNew<int>(numanalyses); 32 32 analyses[0]=DiagnosticHorizAnalysisEnum; 33 33 analyses[1]=DiagnosticVertAnalysisEnum; … … 39 39 case SteadystateSolutionEnum: 40 40 numanalyses=8; 41 analyses= (int*)xmalloc(numanalyses*sizeof(int));41 analyses=xNew<int>(numanalyses); 42 42 analyses[0]=DiagnosticHorizAnalysisEnum; 43 43 analyses[1]=DiagnosticVertAnalysisEnum; … … 52 52 case ThermalSolutionEnum: 53 53 numanalyses=2; 54 analyses= (int*)xmalloc(numanalyses*sizeof(int));54 analyses=xNew<int>(numanalyses); 55 55 analyses[0]=ThermalAnalysisEnum; 56 56 analyses[1]=MeltingAnalysisEnum; … … 59 59 case EnthalpySolutionEnum: 60 60 numanalyses=1; 61 analyses= (int*)xmalloc(numanalyses*sizeof(int));61 analyses=xNew<int>(numanalyses); 62 62 analyses[0]=EnthalpyAnalysisEnum; 63 63 break; … … 65 65 case HydrologySolutionEnum: 66 66 numanalyses=3; 67 analyses= (int*)xmalloc(numanalyses*sizeof(int));67 analyses=xNew<int>(numanalyses); 68 68 analyses[0]=HydrologyAnalysisEnum; 69 69 analyses[1]=SurfaceSlopeAnalysisEnum; … … 73 73 case PrognosticSolutionEnum: 74 74 numanalyses=1; 75 analyses= (int*)xmalloc(numanalyses*sizeof(int));75 analyses=xNew<int>(numanalyses); 76 76 analyses[0]=PrognosticAnalysisEnum; 77 77 break; … … 79 79 case BalancethicknessSolutionEnum: 80 80 numanalyses=1; 81 analyses= (int*)xmalloc(numanalyses*sizeof(int));81 analyses=xNew<int>(numanalyses); 82 82 analyses[0]=BalancethicknessAnalysisEnum; 83 83 break; … … 85 85 case SurfaceSlopeSolutionEnum: 86 86 numanalyses=1; 87 analyses= (int*)xmalloc(numanalyses*sizeof(int));87 analyses=xNew<int>(numanalyses); 88 88 analyses[0]=SurfaceSlopeAnalysisEnum; 89 89 break; … … 91 91 case BedSlopeSolutionEnum: 92 92 numanalyses=1; 93 analyses= (int*)xmalloc(numanalyses*sizeof(int));93 analyses=xNew<int>(numanalyses); 94 94 analyses[0]=BedSlopeAnalysisEnum; 95 95 break; … … 97 97 case TransientSolutionEnum: 98 98 numanalyses=9; 99 analyses= (int*)xmalloc(numanalyses*sizeof(int));99 analyses=xNew<int>(numanalyses); 100 100 analyses[0]=DiagnosticHorizAnalysisEnum; 101 101 analyses[1]=DiagnosticVertAnalysisEnum; … … 110 110 111 111 default: 112 _error _("%s%s%s"," solution type: ",EnumToStringx(solutiontype)," not supported yet!");112 _error2_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!"); 113 113 break; 114 114 } … … 117 117 if(pnumanalyses) *pnumanalyses=numanalyses; 118 118 if(panalyses) *panalyses=analyses; 119 else x free((void**)&analyses);119 else xDelete<int>(analyses); 120 120 } -
issm/branches/trunk-jpl-damage/src/c/solutions/CorePointerFromSolutionEnum.cpp
r10287 r12878 10 10 11 11 #include "../toolkits/toolkits.h" 12 #include "../ objects/objects.h"12 #include "../classes/objects/objects.h" 13 13 #include "../shared/shared.h" 14 14 #include "../EnumDefinitions/EnumDefinitions.h" … … 29 29 solutioncore=&diagnostic_core; 30 30 #else 31 _error _("ISSM was not compiled with diagnostic capabilities. Exiting");31 _error2_("ISSM was not compiled with diagnostic capabilities. Exiting"); 32 32 #endif 33 33 break; … … 36 36 solutioncore=&steadystate_core; 37 37 #else 38 _error _("ISSM was not compiled with steady state capabilities. Exiting");38 _error2_("ISSM was not compiled with steady state capabilities. Exiting"); 39 39 #endif 40 40 break; … … 43 43 solutioncore=&thermal_core; 44 44 #else 45 _error _("ISSM was not compiled with thermal capabilities. Exiting");45 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 46 46 #endif 47 47 break; … … 50 50 solutioncore=&enthalpy_core; 51 51 #else 52 _error _("ISSM was not compiled with thermal capabilities. Exiting");52 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 53 53 #endif 54 54 break; … … 57 57 solutioncore=&balancethickness_core; 58 58 #else 59 _error _("ISSM was not compiled with balanced capabilities. Exiting");59 _error2_("ISSM was not compiled with balanced capabilities. Exiting"); 60 60 #endif 61 61 break; … … 64 64 solutioncore=&hydrology_core; 65 65 #else 66 _error _("ISSM was not compiled with hydrology capabilities. Exiting");66 _error2_("ISSM was not compiled with hydrology capabilities. Exiting"); 67 67 #endif 68 68 break; … … 71 71 solutioncore=&surfaceslope_core; 72 72 #else 73 _error _("ISSM was not compiled with slope capabilities. Exiting");73 _error2_("ISSM was not compiled with slope capabilities. Exiting"); 74 74 #endif 75 75 break; … … 78 78 solutioncore=&bedslope_core; 79 79 #else 80 _error _("ISSM was not compiled with slope capabilities. Exiting");80 _error2_("ISSM was not compiled with slope capabilities. Exiting"); 81 81 #endif 82 82 break; … … 85 85 solutioncore=&transient_core; 86 86 #else 87 _error _("ISSM was not compiled with transient capabilities. Exiting");87 _error2_("ISSM was not compiled with transient capabilities. Exiting"); 88 88 #endif 89 89 break; … … 92 92 solutioncore=&prognostic_core; 93 93 #else 94 _error _("ISSM was not compiled with prognostic capabilities. Exiting");94 _error2_("ISSM was not compiled with prognostic capabilities. Exiting"); 95 95 #endif 96 96 break; 97 97 default: 98 _error _("%s%s%s"," solution type: ",EnumToStringx(solutiontype)," not supported yet!");98 _error2_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!"); 99 99 break; 100 100 } -
issm/branches/trunk-jpl-damage/src/c/solutions/ProcessArguments.cpp
r10568 r12878 4 4 5 5 #include <stdio.h> 6 #include <cstring> 7 6 8 #include "../shared/shared.h" 7 9 #include "../include/include.h" … … 15 17 char *lockfilename = NULL; 16 18 17 if(argc<2)_error _("Usage error: no solution requested");19 if(argc<2)_error2_("Usage error: no solution requested"); 18 20 *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"); 20 22 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"); 25 27 26 28 /*Clean up and assign output pointer*/ -
issm/branches/trunk-jpl-damage/src/c/solutions/ResetBoundaryConditions.cpp
r11684 r12878 3 3 */ 4 4 5 #include "../ objects/objects.h"5 #include "../classes/objects/objects.h" 6 6 #include "../modules/modules.h" 7 7 #include "../io/io.h" … … 15 15 int i; 16 16 17 _printf_(VerboseSolution(),"%s\n"," updating boundary conditions...");17 if(VerboseSolution()) _pprintLine_(" updating boundary conditions..."); 18 18 19 19 /*set current analysis: */ -
issm/branches/trunk-jpl-damage/src/c/solutions/WriteLockFile.cpp
r9320 r12878 17 17 if(my_rank==0){ 18 18 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); 20 20 21 21 /*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); 23 23 } 24 24 -
issm/branches/trunk-jpl-damage/src/c/solutions/adjointbalancethickness_core.cpp
r12004 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 22 22 23 23 /*compute thickness */ 24 _printf_(VerboseSolution(),"%s\n"," computing thickness");24 if(VerboseSolution()) _pprintLine_(" computing thickness"); 25 25 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum); 26 26 solver_linear(femmodel); … … 30 30 31 31 /*compute adjoint*/ 32 _printf_(VerboseSolution(),"%s\n"," computing adjoint");32 if(VerboseSolution()) _pprintLine_(" computing adjoint"); 33 33 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum,AdjointBalancethicknessAnalysisEnum); 34 34 solver_adjoint_linear(femmodel); … … 36 36 /*Save results*/ 37 37 if(save_results){ 38 _printf_(VerboseSolution()," saving results\n");38 if(VerboseSolution()) _pprintLine_(" saving results"); 39 39 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointEnum); 40 40 } -
issm/branches/trunk-jpl-damage/src/c/solutions/adjointdiagnostic_core.cpp
r12004 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 25 25 26 26 /*Compute velocities*/ 27 _printf_(VerboseSolution(),"%s\n"," computing velocities");27 if(VerboseSolution()) _pprintLine_(" computing velocities"); 28 28 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum); 29 29 solver_nonlinear(femmodel,conserve_loads); … … 33 33 34 34 /*Compute adjoint*/ 35 _printf_(VerboseSolution(),"%s\n"," computing adjoint");35 if(VerboseSolution()) _pprintLine_(" computing adjoint"); 36 36 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum,AdjointHorizAnalysisEnum); 37 37 solver_adjoint_linear(femmodel); … … 39 39 /*Save results*/ 40 40 if(save_results){ 41 _printf_(VerboseSolution()," saving results\n");41 if(VerboseSolution()) _pprintLine_(" saving results"); 42 42 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointxEnum); 43 43 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 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 24 24 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 25 25 26 _printf_(VerboseSolution(),"call computational core:\n");26 if(VerboseSolution()) _pprintLine_("call computational core:"); 27 27 solver_linear(femmodel); 28 28 29 29 if(save_results){ 30 _printf_(VerboseSolution()," saving results\n");30 if(VerboseSolution()) _pprintLine_(" saving results"); 31 31 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum); 32 32 } -
issm/branches/trunk-jpl-damage/src/c/solutions/bedslope_core.cpp
r12004 r12878 5 5 #include "./solutions.h" 6 6 #include "../toolkits/toolkits.h" 7 #include "../ objects/objects.h"7 #include "../classes/objects/objects.h" 8 8 #include "../io/io.h" 9 9 #include "../EnumDefinitions/EnumDefinitions.h" … … 19 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 20 21 _printf_(VerboseSolution(),"%s\n"," computing slope");21 if(VerboseSolution()) _pprintLine_(" computing slope"); 22 22 23 23 /*Call on core computations: */ … … 28 28 29 29 if(save_results){ 30 _printf_(VerboseSolution()," saving results\n");30 if(VerboseSolution()) _pprintLine_(" saving results"); 31 31 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedSlopeXEnum); 32 32 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 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 20 20 int num_controls,num_responses; 21 21 int nsteps; 22 double tol_cm;22 IssmDouble tol_cm; 23 23 bool cm_gradient; 24 24 int dim; … … 28 28 29 29 int* control_type = NULL; 30 double* responses=NULL;30 IssmDouble* responses=NULL; 31 31 int* step_responses=NULL; 32 double* maxiter=NULL;33 double* cm_jump=NULL;32 IssmDouble* maxiter=NULL; 33 IssmDouble* cm_jump=NULL; 34 34 35 35 /*intermediary: */ 36 double search_scalar=1;36 IssmDouble search_scalar=1; 37 37 OptArgs optargs; 38 38 OptPars optpars; … … 43 43 44 44 /*output: */ 45 double* J=NULL;45 IssmDouble* J=NULL; 46 46 47 47 /*Recover parameters used throughout the solution*/ … … 66 66 67 67 /*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"); 69 69 if(isstokes) solutioncore(femmodel); 70 70 71 71 /*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); 74 74 75 75 /*Initialize some of the BrentSearch arguments: */ … … 81 81 82 82 /*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); 84 84 for(i=0;i<num_responses;i++) step_responses[i]=(int)responses[n*num_responses+i]; 85 85 femmodel->parameters->SetParam(step_responses,1,num_responses,StepResponsesEnum); … … 88 88 if(solution_type==SteadystateSolutionEnum) solutioncore(femmodel); 89 89 90 _printf_(VerboseControl(),"%s\n"," compute adjoint state:");90 if(VerboseControl()) _pprintLine_(" compute adjoint state:"); 91 91 adjointcore(femmodel); 92 92 gradient_core(femmodel,n,search_scalar==0); … … 98 98 } 99 99 100 _printf_(VerboseControl(),"%s\n"," optimizing along gradient direction");100 if(VerboseControl()) _pprintLine_(" optimizing along gradient direction"); 101 101 optpars.maxiter=(int)maxiter[n]; optpars.cm_jump=cm_jump[n]; 102 102 BrentSearch(&search_scalar,J+n,&optpars,&objectivefunction,&optargs); 103 103 104 _printf_(VerboseControl(),"%s\n"," updating parameter using optimized search scalar"); //true means update save controls104 if(VerboseControl()) _pprintLine_(" updating parameter using optimized search scalar"); //true means update save controls 105 105 InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,true); 106 106 … … 108 108 } 109 109 110 _printf_(VerboseControl(),"%s\n"," preparing final solution");110 if(VerboseControl()) _pprintLine_(" preparing final solution"); 111 111 femmodel->parameters->SetParam(true,SaveResultsEnum); 112 112 solutioncore(femmodel); … … 120 120 cleanup_and_return: 121 121 /*Free ressources: */ 122 x free((void**)&control_type);123 x free((void**)&responses);124 x free((void**)&step_responses);125 x free((void**)&maxiter);126 x free((void**)&cm_jump);127 x free((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); 128 128 } -
issm/branches/trunk-jpl-damage/src/c/solutions/controlconvergence.cpp
r10197 r12878 8 8 #endif 9 9 10 #include "../ objects/objects.h"10 #include "../classes/objects/objects.h" 11 11 #include "../shared/shared.h" 12 12 #include "../io/io.h" … … 17 17 #include "./solutions.h" 18 18 19 bool controlconvergence( double J, double tol_cm){19 bool controlconvergence(IssmDouble J, IssmDouble tol_cm){ 20 20 21 21 int i; … … 23 23 24 24 /*Has convergence been reached?*/ 25 if (! isnan(tol_cm) && J<tol_cm){25 if (!xIsNan<IssmDouble>(tol_cm) && J<tol_cm){ 26 26 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); 28 28 } 29 29 -
issm/branches/trunk-jpl-damage/src/c/solutions/controlrestart.cpp
r12004 r12878 7 7 #include "../EnumDefinitions/EnumDefinitions.h" 8 8 9 void controlrestart(FemModel* femmodel, double* J){9 void controlrestart(FemModel* femmodel,IssmDouble* J){ 10 10 11 11 int num_controls; … … 33 33 34 34 /*Clean up and return*/ 35 x free((void**)&control_type);35 xDelete<int>(control_type); 36 36 } -
issm/branches/trunk-jpl-damage/src/c/solutions/controltao_core.cpp
r12004 r12878 4 4 #include <config.h> 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 17 17 18 18 /*Local prototype*/ 19 int FormFunctionGradient(TaoSolver,Vec, double*,Vec,void*);19 int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*); 20 20 int IssmMonitor(TaoSolver,void*); 21 21 typedef struct { … … 30 30 int nsteps,maxiter; 31 31 AppCtx user; 32 TaoSolver tao ;33 double *dummy = NULL;32 TaoSolver tao = 0; 33 IssmDouble *dummy = NULL; 34 34 int *control_list = NULL; 35 35 Vector *X = NULL; … … 41 41 PetscGetArgs(&argc,&args); 42 42 ierr = TaoInitialize(&argc,&args,(char*)0,""); 43 if(ierr) _error _("Could not initialize Tao");43 if(ierr) _error2_("Could not initialize Tao"); 44 44 45 45 /*Recover some parameters*/ … … 50 50 femmodel->parameters->FindParam(&dummy,NULL,NULL,InversionMaxiterPerStepEnum); 51 51 femmodel->parameters->SetParam(false,SaveResultsEnum); 52 maxiter=nsteps*(int)dummy[0]; x free((void**)&dummy);52 maxiter=nsteps*(int)dummy[0]; xDelete<IssmDouble>(dummy); 53 53 54 54 /*Initialize TAO*/ 55 _printf_(VerboseControl(),"%s\n"," Initializing the Toolkit for Advanced Optimization (TAO)");56 55 TaoCreate(PETSC_COMM_WORLD,&tao); 56 if(VerboseControl()) _pprintLine_(" Initializing the Toolkit for Advanced Optimization (TAO)"); 57 57 TaoSetFromOptions(tao); 58 58 TaoSetType(tao,"tao_blmvm"); … … 78 78 79 79 /*Solver optimization problem*/ 80 _printf_(VerboseControl(),"%s\n"," Starting optimization");80 if(VerboseControl()) _pprintLine_(" Starting optimization"); 81 81 TaoSolve(tao); 82 82 TaoView(tao,PETSC_VIEWER_STDOUT_WORLD); … … 88 88 89 89 /*Finalize*/ 90 _printf_(VerboseControl(),"%s\n"," preparing final solution");90 if(VerboseControl()) _pprintLine_(" preparing final solution"); 91 91 femmodel->parameters->SetParam(true,SaveResultsEnum); 92 92 void (*solutioncore)(FemModel*)=NULL; … … 95 95 96 96 /*Clean up and return*/ 97 x free((void**)&control_list);97 xDelete<int>(control_list); 98 98 xdelete(&X); 99 99 TaoDestroy(&tao); 100 100 TaoFinalize(); 101 101 } 102 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, double *fcn,Vec G,void *userCtx){102 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *userCtx){ 103 103 104 104 /*Retreive arguments*/ … … 107 107 FemModel *femmodel = user->femmodel; 108 108 int *cost_functions = NULL; 109 double *cost_functionsd= NULL;109 IssmDouble *cost_functionsd= NULL; 110 110 Vector *gradient = NULL; 111 111 Vector *X = NULL; … … 125 125 126 126 /*Prepare objective function*/ 127 cost_functions= (int*)xmalloc(num_cost_functions*sizeof(int));127 cost_functions=xNew<int>(num_cost_functions); 128 128 for(int i=0;i<num_cost_functions;i++) cost_functions[i]=(int)cost_functionsd[i]; //FIXME 129 129 femmodel->parameters->SetParam(cost_functions,1,num_cost_functions,StepResponsesEnum); … … 146 146 147 147 /*Clean-up and return*/ 148 x free((void**)&cost_functions);149 x free((void**)&cost_functionsd);148 xDelete<int>(cost_functions); 149 xDelete<IssmDouble>(cost_functionsd); 150 150 return 0; 151 151 } … … 153 153 154 154 int i,its,num_responses; 155 double f,gnorm,cnorm,xdiff;155 IssmDouble f,gnorm,cnorm,xdiff; 156 156 AppCtx *user = (AppCtx *)userCtx; 157 157 FemModel *femmodel = user->femmodel; … … 163 163 164 164 TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, NULL); 165 if(its==0) _p rintf_(true,"Iter Function Residual | List of contributions\n");166 if(its==0) _p rintf_(true,"-----------------------------------+-----------------------\n");167 _p rintf_(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<<" | "); 168 168 169 169 /*Retrieve objective functions independently*/ 170 170 for(i=0;i<num_responses;i++){ 171 171 Responsex(&f,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnumToStringx(responses[i]),false,i); 172 _p rintf_(true," %12.7g ","",f);172 _pprintString_(" "<<setw(12)<<setprecision(7)<<f); 173 173 } 174 _p rintf_(true,"\n");174 _pprintLine_(""); 175 175 176 176 /*Clean-up and return*/ 177 x free((void**)&responses);177 xDelete<int>(responses); 178 178 return 0; 179 179 } … … 181 181 #else 182 182 void controltao_core(FemModel* femmodel){ 183 _error _("TAO not installed or PETSc version not supported");183 _error2_("TAO not installed or PETSc version not supported"); 184 184 } 185 185 #endif //_HAVE_TAO_ -
issm/branches/trunk-jpl-damage/src/c/solutions/convergence.cpp
r12004 r12878 3 3 */ 4 4 5 #include "../ objects/objects.h"5 #include "../classes/objects/objects.h" 6 6 #include "../modules/modules.h" 7 7 #include "../io/io.h" … … 19 19 Vector* KUoldF=NULL; 20 20 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; 26 26 27 27 /*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; 32 32 33 33 /*If uf is NULL in input, f-set is nil, model is fully constrained, therefore converged from … … 55 55 nF=pf->Norm(NORM_TWO); 56 56 solver_residue=nKUF/nF; 57 _p rintf_(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); 58 58 59 59 //clean up … … 70 70 nF=pf->Norm(NORM_TWO); 71 71 res=nKUoldF/nF; 72 if ( isnan(res)){73 _p rintf_(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!"); 75 75 } 76 76 … … 81 81 //print 82 82 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 << " %"); 84 84 converged=true; 85 85 } 86 86 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 << " %"); 88 88 converged=false; 89 89 } 90 90 91 91 /*Relative criterion (optional)*/ 92 if (! isnan(eps_rel) || (VerboseConvergence())){92 if (!xIsNan<IssmDouble>(eps_rel) || (VerboseConvergence())){ 93 93 94 94 //compute norm(du)/norm(u) … … 96 96 ndu=duf->Norm(NORM_TWO); nu=old_uf->Norm(NORM_TWO); 97 97 98 if ( isnan(ndu) || isnan(nu)) _error_("convergence criterion is NaN!");98 if (xIsNan<IssmDouble>(ndu) || xIsNan<IssmDouble>(nu)) _error2_("convergence criterion is NaN!"); 99 99 100 100 //clean up … … 102 102 103 103 //print 104 if (! isnan(eps_rel)){104 if (!xIsNan<IssmDouble>(eps_rel)){ 105 105 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 << " %"); 107 107 } 108 108 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 << " %"); 110 110 converged=false; 111 111 } 112 112 } 113 else _p rintf_(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 << " %"); 114 114 115 115 } 116 116 117 117 /*Absolute criterion (Optional) = max(du)*/ 118 if (! isnan(eps_abs) || (VerboseConvergence())){118 if (!xIsNan<IssmDouble>(eps_abs) || (VerboseConvergence())){ 119 119 120 120 //compute max(du) 121 121 duf=old_uf->Duplicate(); old_uf->Copy(duf); duf->AYPX(uf,-1.0); 122 122 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!"); 124 124 125 125 //clean up … … 127 127 128 128 //print 129 if (! isnan(eps_abs)){129 if (!xIsNan<IssmDouble>(eps_abs)){ 130 130 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"); 132 132 } 133 133 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"); 135 135 converged=false; 136 136 } 137 137 } 138 else _p rintf_(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"); 139 139 140 140 } -
issm/branches/trunk-jpl-damage/src/c/solutions/diagnostic_core.cpp
r12004 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 59 59 if(ishutter){ 60 60 61 _printf_(VerboseSolution(),"%s\n"," computing hutter velocities");61 if(VerboseSolution()) _pprintLine_(" computing hutter velocities"); 62 62 63 63 //Take the last velocity into account so that the velocity on the MacAyeal domain is not zero … … 72 72 if (ismacayealpattyn ^ isstokes){ // ^ = xor 73 73 74 _printf_(VerboseSolution(),"%s\n"," computing velocities");74 if(VerboseSolution()) _pprintLine_(" computing velocities"); 75 75 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum); 76 76 if(isnewton) … … 82 82 if (ismacayealpattyn && isstokes){ 83 83 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 "); 85 85 solver_stokescoupling_nonlinear(femmodel,conserve_loads); 86 86 } … … 88 88 if (dim==3 & (ishutter || ismacayealpattyn)){ 89 89 90 _printf_(VerboseSolution(),"%s\n"," computing vertical velocities");90 if(VerboseSolution()) _pprintLine_(" computing vertical velocities"); 91 91 femmodel->SetCurrentConfiguration(DiagnosticVertAnalysisEnum); 92 92 solver_linear(femmodel); … … 95 95 96 96 if(save_results){ 97 _printf_(VerboseSolution()," saving results\n");97 if(VerboseSolution()) _pprintLine_(" saving results"); 98 98 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum); 99 99 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum); … … 105 105 106 106 /*Free ressources:*/ 107 x free((void**)&requested_outputs);107 xDelete<int>(requested_outputs); 108 108 } -
issm/branches/trunk-jpl-damage/src/c/solutions/enthalpy_core.cpp
r12004 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../EnumDefinitions/EnumDefinitions.h" … … 21 21 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 22 22 23 _printf_(VerboseSolution()," computing enthalpy\n");23 if(VerboseSolution()) _pprintLine_(" computing enthalpy"); 24 24 femmodel->SetCurrentConfiguration(EnthalpyAnalysisEnum); 25 25 solver_nonlinear(femmodel,true); … … 29 29 30 30 if(save_results){ 31 _printf_(VerboseSolution()," saving results\n");31 if(VerboseSolution()) _pprintLine_(" saving results"); 32 32 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum); 33 33 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 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 16 16 17 17 /*Intermediaries*/ 18 double norm_inf;19 double *norm_list = NULL;18 IssmDouble norm_inf; 19 IssmDouble *norm_list = NULL; 20 20 Vector* new_gradient = NULL; 21 21 Vector* gradient = NULL; … … 23 23 24 24 /*Compute gradient*/ 25 _printf_(VerboseControl()," compute cost function gradient\n");25 if(VerboseControl()) _pprintLine_(" compute cost function gradient"); 26 26 Gradjx(&gradient,&norm_list,femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters); 27 27 28 28 if (orthogonalize){ 29 _printf_(VerboseControl()," orthogonalization\n");29 if(VerboseControl()) _pprintLine_(" orthogonalization"); 30 30 ControlInputGetGradientx(&old_gradient,femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters); 31 31 Orthx(&new_gradient,gradient,old_gradient); xdelete(&old_gradient); xdelete(&gradient); … … 37 37 /*Check that gradient is clean*/ 38 38 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"); 41 41 42 42 /*plug back into inputs: */ … … 48 48 49 49 /*Clean up and return*/ 50 x free((void**)&norm_list);50 xDelete<IssmDouble>(norm_list); 51 51 } -
issm/branches/trunk-jpl-damage/src/c/solutions/hydrology_core.cpp
r12004 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 17 17 18 18 /*intermediary*/ 19 double time;19 IssmDouble time; 20 20 int nsteps; 21 double starttime,final_time;22 double dt;21 IssmDouble starttime,final_time; 22 IssmDouble dt; 23 23 bool save_results; 24 24 int output_frequency; … … 45 45 for(i=0;i<nsteps;i++){ 46 46 47 if(nsteps) _printf_(VerboseSolution(),"time step:%i/%i\n",i+1,nsteps);47 if(nsteps)if(VerboseSolution()) _pprintLine_("time step:" << i+1 << "/" << nsteps); 48 48 time+=dt; 49 49 femmodel->parameters->SetParam(time,TimeEnum); … … 53 53 54 54 if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){ 55 _printf_(VerboseSolution()," saving results \n");55 if(VerboseSolution()) _pprintLine_(" saving results "); 56 56 //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WatercolumnEnum,i+1,time); 57 57 //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVxEnum,i+1,time); … … 59 59 60 60 /*unload results*/ 61 _printf_(VerboseSolution()," saving temporary results\n");61 if(VerboseSolution()) _pprintLine_(" saving temporary results"); 62 62 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results); 63 63 } -
issm/branches/trunk-jpl-damage/src/c/solutions/hydrology_core_step.cpp
r9761 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 13 13 #include "../solvers/solvers.h" 14 14 15 void hydrology_core_step(FemModel* femmodel,int step, double time){15 void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time){ 16 16 17 17 bool modify_loads=true; 18 18 19 _printf_(VerboseSolution()," computing water column\n");19 if(VerboseSolution()) _pprintLine_(" computing water column"); 20 20 femmodel->SetCurrentConfiguration(HydrologyAnalysisEnum); 21 21 solver_nonlinear(femmodel,modify_loads); -
issm/branches/trunk-jpl-damage/src/c/solutions/issm.cpp
r12168 r12878 30 30 31 31 /*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; 35 35 int ierr; 36 37 /*profiling*/ 38 bool profiling = false; 39 IssmPDouble Time_start, Flops_start; 40 IssmPDouble Solution_time, Memory_use, Current_flops; 36 41 37 42 ISSMBOOT(); … … 40 45 #ifdef _HAVE_PETSC_ 41 46 ierr=PetscInitialize(&argc,&argv,(char*)0,""); 42 if(ierr) _error _("Could not initialize Petsc");47 if(ierr) _error2_("Could not initialize Petsc"); 43 48 #else 44 49 #ifdef _HAVE_MPI_ … … 50 55 MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime(); 51 56 #else 52 start=( double)clock();57 start=(IssmPDouble)clock(); 53 58 #endif 54 59 … … 60 65 61 66 /*First process inputs*/ 62 _p rintf_(true,"\n");63 _p rintf_(true,"Ice Sheet System Model (%s) version %s\n",PACKAGE_NAME,PACKAGE_VERSION);64 _p rintf_(true,"(website: %s contact: %s)\n",PACKAGE_URL,PACKAGE_BUGREPORT);65 _p rintf_(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_(""); 66 71 ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,argc,argv); 67 72 … … 73 78 MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime(); 74 79 #else 75 start_init=( double)clock();80 start_init=(IssmPDouble)clock(); 76 81 #endif 77 82 femmodel=new FemModel(binfilename,outbinfilename,solution_type,analyses,numanalyses); … … 94 99 femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum); 95 100 femmodel->parameters->FindParam(&tao_analysis,InversionTaoEnum); 101 femmodel->parameters->FindParam(&profiling,DebugProfilingEnum); 102 96 103 #ifdef _HAVE_MPI_ 97 104 MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime(); 98 105 #else 99 finish_init=( double)clock();100 #endif 101 102 _p rintf_(true,"call computational core:\n");106 finish_init=(IssmPDouble)clock(); 107 #endif 108 109 _pprintLine_("call computational core:"); 103 110 #ifdef _HAVE_MPI_ 104 111 MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( ); 105 112 #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 109 118 if(dakota_analysis){ 110 119 #ifdef _HAVE_DAKOTA_ 111 120 Dakotax(femmodel); 112 121 #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!"); 114 123 #endif 115 124 } … … 121 130 control_core(femmodel); 122 131 #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!"); 124 133 #endif 125 134 } … … 127 136 solutioncore(femmodel); 128 137 } 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 129 147 #ifdef _HAVE_MPI_ 130 148 MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( ); 131 149 #else 132 finish_core=( double)clock();133 #endif 134 135 _p rintf_(true,"write results to disk:\n");150 finish_core=(IssmPDouble)clock(); 151 #endif 152 153 _pprintLine_("write results to disk:"); 136 154 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results); 137 155 … … 139 157 pfclose(output_fid,lockfilename); 140 158 if (waitonlock>0){ 141 _p rintf_(true,"write lock file:\n");159 _pprintLine_("write lock file:"); 142 160 WriteLockFile(lockfilename); 143 161 } 144 162 145 /*Free res sources */146 x free((void**)&analyses);147 x free((void**)&lockfilename);148 x free((void**)&binfilename);149 x free((void**)&outbinfilename);150 x free((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); 151 169 delete femmodel; 152 170 … … 154 172 #ifdef _HAVE_MPI_ 155 173 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 167 192 168 193 #ifdef _HAVE_PETSC_ 169 _p rintf_(true,"closing MPI and Petsc\n");194 _pprintLine_("closing MPI and Petsc"); 170 195 PetscFinalize(); 171 196 #else 172 197 #ifdef _HAVE_MPI_ 173 _p rintf_(true,"closing MPI and Petsc\n");198 _pprintLine_("closing MPI and Petsc"); 174 199 MPI_Finalize(); 175 200 #endif -
issm/branches/trunk-jpl-damage/src/c/solutions/objectivefunction.cpp
r12004 r12878 3 3 */ 4 4 5 /*include files: {{{ 1*/5 /*include files: {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 11 11 12 12 #include "../toolkits/toolkits.h" 13 #include "../ objects/objects.h"13 #include "../classes/objects/objects.h" 14 14 #include "../shared/shared.h" 15 15 #include "../EnumDefinitions/EnumDefinitions.h" … … 20 20 /*}}}*/ 21 21 22 double objectivefunction(double search_scalar,OptArgs* optargs){22 IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs){ 23 23 24 24 int i; 25 25 26 26 /*output: */ 27 double J;27 IssmDouble J; 28 28 29 29 /*parameters: */ … … 49 49 } 50 50 else{ 51 _error _("Solution %s not implemented yet",EnumToStringx(solution_type));51 _error2_("Solution " << EnumToStringx(solution_type) << " not implemented yet"); 52 52 } 53 53 … … 66 66 } 67 67 else{ 68 _error _("Solution %s not implemented yet",EnumToStringx(solution_type));68 _error2_("Solution " << EnumToStringx(solution_type) << " not implemented yet"); 69 69 } 70 70 -
issm/branches/trunk-jpl-damage/src/c/solutions/prognostic_core.cpp
r12004 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 16 16 /*parameters: */ 17 17 bool save_results; 18 bool issmbgradients,ispdd,isdelta18o; 18 19 19 20 /*activate formulation: */ … … 22 23 /*recover parameters: */ 23 24 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 25 femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum); 26 femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum); 27 femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum); 24 28 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"); 26 42 solver_linear(femmodel); 27 43 28 44 if(save_results){ 29 _printf_(VerboseSolution()," saving results\n");45 if(VerboseSolution()) _pprintLine_(" saving results"); 30 46 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum); 31 47 } -
issm/branches/trunk-jpl-damage/src/c/solutions/solutions.h
r12004 r12878 6 6 #define SOLUTIONS_H_ 7 7 8 #include "../ objects/objects.h"8 #include "../classes/objects/objects.h" 9 9 #include "../io/io.h" 10 10 … … 18 18 void diagnostic_core(FemModel* femmodel); 19 19 void hydrology_core(FemModel* femmodel); 20 void hydrology_core_step(FemModel* femmodel,int step, double time);20 void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time); 21 21 void thermal_core(FemModel* femmodel); 22 22 void enthalpy_core(FemModel* femmodel); … … 30 30 void steadystate_core(FemModel* femmodel); 31 31 void transient_core(FemModel* femmodel); 32 double objectivefunction(double search_scalar,OptArgs* optargs);32 IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs); 33 33 34 34 //convergence: 35 35 void 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);36 bool controlconvergence(IssmDouble J,IssmDouble tol_cm); 37 37 bool steadystateconvergence(FemModel* femmodel); 38 38 39 39 //optimization 40 int GradJSearch( double* search_vector,FemModel* femmodel,int step);40 int GradJSearch(IssmDouble* search_vector,FemModel* femmodel,int step); 41 41 42 42 //diverse 43 43 void ProcessArguments(int* solution,char** pbinname,char** poutbinname,char** ppetscname,char** plockname,int argc,char **argv); 44 44 void WriteLockFile(char* filename); 45 void controlrestart(FemModel* femmodel, double* J);45 void controlrestart(FemModel* femmodel,IssmDouble* J); 46 46 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type); 47 47 -
issm/branches/trunk-jpl-damage/src/c/solutions/steadystate_core.cpp
r12004 r12878 9 9 #endif 10 10 11 #include "../include/include.h" 11 12 #include "../toolkits/toolkits.h" 12 #include "../ objects/objects.h"13 #include "../classes/objects/objects.h" 13 14 #include "../shared/shared.h" 14 15 #include "../io/io.h" … … 16 17 #include "./solutions.h" 17 18 #include "../modules/modules.h" 18 #include "../include/include.h"19 19 #include "../solvers/solvers.h" 20 20 … … 43 43 for(;;){ 44 44 45 _printf_(VerboseSolution(),"%s%i\n"," computing temperature and velocity for step: ",step);45 if(VerboseSolution()) _pprintLine_(" computing temperature and velocity for step: " << step); 46 46 #ifdef _HAVE_THERMAL_ 47 47 if(isenthalpy==0){ … … 52 52 } 53 53 #else 54 _error _("ISSM was not compiled with thermal capabilities. Exiting");54 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 55 55 #endif 56 56 57 _printf_(VerboseSolution(),"%s\n"," computing new velocity");57 if(VerboseSolution()) _pprintLine_(" computing new velocity"); 58 58 diagnostic_core(femmodel); 59 59 60 60 if (step>1){ 61 _printf_(VerboseSolution(),"%s\n"," checking velocity, temperature and pressure convergence");61 if(VerboseSolution()) _pprintLine_(" checking velocity, temperature and pressure convergence"); 62 62 if(steadystateconvergence(femmodel)) break; 63 63 } 64 64 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"); 66 66 break; 67 67 } 68 68 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"); 70 70 InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum,VxPicardEnum); 71 71 InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum,VyPicardEnum); … … 79 79 80 80 if(save_results){ 81 _printf_(VerboseSolution()," saving results\n");81 if(VerboseSolution()) _pprintLine_(" saving results"); 82 82 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum); 83 83 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum); … … 93 93 94 94 /*Free ressources:*/ 95 x free((void**)&requested_outputs);95 xDelete<int>(requested_outputs); 96 96 } -
issm/branches/trunk-jpl-damage/src/c/solutions/steadystateconvergence.cpp
r9677 r12878 9 9 #endif 10 10 11 #include "../ objects/objects.h"11 #include "../classes/objects/objects.h" 12 12 #include "../shared/shared.h" 13 13 #include "../Container/Container.h" … … 28 28 int temperatureenums[2]={TemperatureEnum,TemperatureOldEnum}; 29 29 int convergencecriterion[1]={RelativeEnum}; //criterions for convergence, RelativeEnum or AbsoluteEnum 30 double convergencecriterionvalue[1]; //value of criterion to be respected30 IssmDouble convergencecriterionvalue[1]; //value of criterion to be respected 31 31 32 32 /*retrieve parameters: */ -
issm/branches/trunk-jpl-damage/src/c/solutions/surfaceslope_core.cpp
r12004 r12878 5 5 #include "./solutions.h" 6 6 #include "../toolkits/toolkits.h" 7 #include "../ objects/objects.h"7 #include "../classes/objects/objects.h" 8 8 #include "../io/io.h" 9 9 #include "../EnumDefinitions/EnumDefinitions.h" … … 19 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 20 21 _printf_(VerboseSolution(),"%s\n","computing slope...");21 if(VerboseSolution()) _pprintLine_("computing slope..."); 22 22 23 23 /*Call on core computations: */ … … 28 28 29 29 if(save_results){ 30 _printf_(VerboseSolution(),"saving results:\n");30 if(VerboseSolution()) _pprintLine_("saving results:"); 31 31 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceSlopeXEnum); 32 32 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 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../shared/shared.h" 8 8 #include "../io/io.h" … … 16 16 17 17 /*intermediary*/ 18 double melting_offset;18 IssmDouble melting_offset; 19 19 bool save_results; 20 20 bool dakota_analysis = false; … … 29 29 } 30 30 31 _printf_(VerboseSolution()," computing temperatures\n");31 if(VerboseSolution()) _pprintLine_(" computing temperatures"); 32 32 femmodel->SetCurrentConfiguration(ThermalAnalysisEnum); 33 33 solver_thermal_nonlinear(femmodel); 34 34 35 _printf_(VerboseSolution()," computing melting\n");35 if(VerboseSolution()) _pprintLine_(" computing melting"); 36 36 femmodel->SetCurrentConfiguration(MeltingAnalysisEnum); 37 37 solver_linear(femmodel); 38 38 39 39 if(save_results){ 40 _printf_(VerboseSolution()," saving results\n");40 if(VerboseSolution()) _pprintLine_(" saving results"); 41 41 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum); 42 42 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 10 10 11 11 #include "../toolkits/toolkits.h" 12 #include "../ objects/objects.h"12 #include "../classes/objects/objects.h" 13 13 #include "../shared/shared.h" 14 14 #include "../io/io.h" … … 23 23 24 24 /*parameters: */ 25 double starttime,finaltime,dt,yts;25 IssmDouble starttime,finaltime,dt,yts; 26 26 bool isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy; 27 27 bool save_results,dakota_analysis; … … 34 34 /*intermediary: */ 35 35 int step; 36 double time;36 IssmDouble time; 37 37 38 38 //first recover parameters common to all solutions … … 86 86 femmodel->parameters->SetParam(step,StepEnum); 87 87 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 << ")"); 89 89 if(step%output_frequency==0 || time==finaltime) 90 90 save_results=true; … … 94 94 95 95 if(isthermal && dim==3){ 96 _printf_(VerboseSolution()," computing temperatures\n");96 if(VerboseSolution()) _pprintLine_(" computing temperatures"); 97 97 #ifdef _HAVE_THERMAL_ 98 98 if(isenthalpy==0){ … … 103 103 } 104 104 #else 105 _error _("ISSM was not compiled with thermal capabilities. Exiting");105 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 106 106 #endif 107 107 } 108 108 109 109 if(isdiagnostic){ 110 _printf_(VerboseSolution()," computing new velocity\n");110 if(VerboseSolution()) _pprintLine_(" computing new velocity"); 111 111 #ifdef _HAVE_DIAGNOSTIC_ 112 112 diagnostic_core(femmodel); 113 113 #else 114 _error _("ISSM was not compiled with diagnostic capabilities. Exiting");114 _error2_("ISSM was not compiled with diagnostic capabilities. Exiting"); 115 115 #endif 116 116 } 117 117 118 118 if(isprognostic){ 119 _printf_(VerboseSolution()," computing new thickness\n");119 if(VerboseSolution()) _pprintLine_(" computing new thickness"); 120 120 prognostic_core(femmodel); 121 _printf_(VerboseSolution()," updating vertices positions\n");121 if(VerboseSolution()) _pprintLine_(" updating vertices positions"); 122 122 UpdateVertexPositionsx(femmodel->elements, femmodel->nodes,femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters); 123 123 } 124 124 125 125 if(isgroundingline){ 126 _printf_(VerboseSolution()," computing new grounding line position\n");126 if(VerboseSolution()) _pprintLine_(" computing new grounding line position"); 127 127 #ifdef _HAVE_GROUNDINGLINE_ 128 128 GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 129 129 #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"); 131 131 #endif 132 132 } … … 134 134 /*unload results*/ 135 135 if(save_results){ 136 _printf_(VerboseSolution()," saving transient results\n");136 if(VerboseSolution()) _pprintLine_(" saving transient results"); 137 137 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceEnum); 138 138 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum); … … 141 141 RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs); 142 142 143 _printf_(VerboseSolution()," saving temporary results\n");143 if(VerboseSolution()) _pprintLine_(" saving temporary results"); 144 144 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results); 145 145 } … … 147 147 148 148 /*Free ressources:*/ 149 x free((void**)&requested_outputs);149 xDelete<int>(requested_outputs); 150 150 } -
issm/branches/trunk-jpl-damage/src/c/solvers/solver_adjoint_linear.cpp
r11684 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../EnumDefinitions/EnumDefinitions.h" 8 8 #include "../modules/modules.h" -
issm/branches/trunk-jpl-damage/src/c/solvers/solver_linear.cpp
r11684 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../EnumDefinitions/EnumDefinitions.h" 8 8 #include "../modules/modules.h" -
issm/branches/trunk-jpl-damage/src/c/solvers/solver_newton.cpp
r12280 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../io/io.h" 8 8 #include "../EnumDefinitions/EnumDefinitions.h" … … 17 17 int num_unstable_constraints; 18 18 int count; 19 double kmax;19 IssmDouble kmax; 20 20 Matrix* Kff = NULL; 21 21 Matrix* Kfs = NULL; … … 70 70 bool max_iteration_state=false; 71 71 int tempStep=1; 72 double tempTime=1.0;72 IssmDouble tempTime=1.0; 73 73 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 74 74 break; 75 75 } 76 76 if(count>=max_nonlinear_iterations){ 77 _p rintf_(true," maximum number of Newton iterations (%i) exceeded\n",max_nonlinear_iterations);77 _pprintLine_(" maximum number of Newton iterations (" << max_nonlinear_iterations << ") exceeded"); 78 78 bool max_iteration_state=true; 79 79 int tempStep=1; 80 double tempTime=1.0;80 IssmDouble tempTime=1.0; 81 81 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 82 82 break; … … 100 100 } 101 101 102 _printf_(VerboseConvergence(),"\n total number of iterations: %i\n",count-1);102 if(VerboseConvergence()) _pprintLine_("\n total number of iterations: " << count-1); 103 103 104 104 /*clean-up*/ -
issm/branches/trunk-jpl-damage/src/c/solvers/solver_nonlinear.cpp
r12280 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../io/io.h" 8 8 #include "../EnumDefinitions/EnumDefinitions.h" … … 73 73 74 74 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); 76 76 77 77 //rift convergence … … 88 88 bool max_iteration_state=false; 89 89 int tempStep=1; 90 double tempTime=1.0;90 IssmDouble tempTime=1.0; 91 91 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 92 92 break; 93 93 } 94 94 if(count>=max_nonlinear_iterations){ 95 _p rintf_(true," maximum number of nonlinear iterations (%i) exceeded\n",max_nonlinear_iterations);95 _pprintLine_(" maximum number of nonlinear iterations (" << max_nonlinear_iterations << ") exceeded"); 96 96 converged=true; 97 97 InputUpdateFromConstantx( femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,converged,ConvergedEnum); … … 99 99 bool max_iteration_state=true; 100 100 int tempStep=1; 101 double tempTime=1.0;101 IssmDouble tempTime=1.0; 102 102 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 103 103 break; … … 105 105 } 106 106 107 _printf_(VerboseConvergence(),"\n total number of iterations: %i\n",count-1);107 if(VerboseConvergence()) _pprintLine_("\n total number of iterations: " << count-1); 108 108 109 109 /*clean-up*/ -
issm/branches/trunk-jpl-damage/src/c/solvers/solver_stokescoupling_nonlinear.cpp
r11684 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../EnumDefinitions/EnumDefinitions.h" 8 8 #include "../io/io.h" … … 91 91 if(converged==true)break; 92 92 if(count>=max_nonlinear_iterations){ 93 _p rintf_(true," maximum number of iterations (%i) exceeded\n",max_nonlinear_iterations);93 _pprintLine_(" maximum number of iterations (" << max_nonlinear_iterations << ") exceeded"); 94 94 break; 95 95 } -
issm/branches/trunk-jpl-damage/src/c/solvers/solver_thermal_nonlinear.cpp
r11684 r12878 4 4 5 5 #include "../toolkits/toolkits.h" 6 #include "../ objects/objects.h"6 #include "../classes/objects/objects.h" 7 7 #include "../io/io.h" 8 8 #include "../EnumDefinitions/EnumDefinitions.h" … … 16 16 Vector* tf_old=NULL; 17 17 Vector* ys=NULL; 18 double melting_offset;18 IssmDouble melting_offset; 19 19 20 20 /*intermediary: */ … … 47 47 converged=false; 48 48 49 _printf_(VerboseSolution(),"%s\n","starting direct shooting method");49 if(VerboseSolution()) _pprintLine_("starting direct shooting method"); 50 50 InputUpdateFromConstantx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,true,ResetPenaltiesEnum); 51 51 InputUpdateFromConstantx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,false,ConvergedEnum); … … 66 66 67 67 if (!converged){ 68 _printf_(VerboseConvergence(),"%s%i\n"," #unstable constraints = ",num_unstable_constraints);68 if(VerboseConvergence()) _pprintLine_(" #unstable constraints = " << num_unstable_constraints); 69 69 if (num_unstable_constraints <= thermal_penalty_threshold)converged=true; 70 70 if (count>=thermal_maxiter){ 71 71 converged=true; 72 _p rintf_(true," maximum number of iterations (%i) exceeded\n",thermal_maxiter);72 _pprintLine_(" maximum number of iterations (" << thermal_maxiter << ") exceeded"); 73 73 } 74 74 } -
issm/branches/trunk-jpl-damage/src/c/solvers/solvers.h
r11322 r12878 6 6 #define SOLVERS_H_ 7 7 8 #include "../ objects/objects.h"8 #include "../classes/objects/objects.h" 9 9 #include "../io/io.h" 10 10 -
issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.cpp
r12168 r12878 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 19 19 20 20 /*SeqMat constructors and destructor*/ 21 /*FUNCTION SeqMat::SeqMat(){{{ 1*/21 /*FUNCTION SeqMat::SeqMat(){{{*/ 22 22 SeqMat::SeqMat(){ 23 23 … … 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION SeqMat::SeqMat(int M,int N){{{ 1*/29 /*FUNCTION SeqMat::SeqMat(int M,int N){{{*/ 30 30 SeqMat::SeqMat(int pM,int pN){ 31 31 … … 33 33 this->N=pN; 34 34 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){{{*/ 39 SeqMat::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){{{*/ 48 SeqMat::SeqMat(IssmDouble* serial_mat,int pM,int pN,IssmDouble sparsity){ 49 49 50 50 int i,j; … … 54 54 this->matrix=NULL; 55 55 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){{{*/ 63 63 SeqMat::SeqMat(int pM,int pN, int connectivity,int numberofdofspernode){ 64 64 … … 66 66 this->N=pN; 67 67 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(){{{*/ 72 72 SeqMat::~SeqMat(){ 73 73 74 x free((void**)&this->matrix);74 xDelete<IssmDouble>(this->matrix); 75 75 M=0; 76 76 N=0; … … 79 79 80 80 /*SeqMat specific routines: */ 81 /*FUNCTION SeqMat::Echo{{{ 1*/81 /*FUNCTION SeqMat::Echo{{{*/ 82 82 void SeqMat::Echo(void){ 83 83 84 84 int i,j; 85 printf("SeqMat size %i-%i\n",this->M,this->N);85 _printLine_("SeqMat size " << this->M << "-" << this->N); 86 86 for(i=0;i<M;i++){ 87 87 for(j=0;j<N;j++){ 88 printf("%g ",this->matrix[N*i+j]);88 _printString_(this->matrix[N*i+j] << " "); 89 89 } 90 printf("\n");91 } 92 } 93 /*}}}*/ 94 /*FUNCTION SeqMat::Assemble{{{ 1*/90 _printLine_(""); 91 } 92 } 93 /*}}}*/ 94 /*FUNCTION SeqMat::Assemble{{{*/ 95 95 void SeqMat::Assemble(void){ 96 96 … … 99 99 } 100 100 /*}}}*/ 101 /*FUNCTION SeqMat::Norm{{{ 1*/102 double SeqMat::Norm(NormMode mode){103 104 double norm;105 double absolute;101 /*FUNCTION SeqMat::Norm{{{*/ 102 IssmDouble SeqMat::Norm(NormMode mode){ 103 104 IssmDouble norm; 105 IssmDouble absolute; 106 106 int i,j; 107 107 … … 119 119 break; 120 120 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{{{*/ 127 127 void SeqMat::GetSize(int* pM,int* pN){ 128 128 … … 132 132 } 133 133 /*}}}*/ 134 /*FUNCTION SeqMat::GetLocalSize{{{ 1*/134 /*FUNCTION SeqMat::GetLocalSize{{{*/ 135 135 void SeqMat::GetLocalSize(int* pM,int* pN){ 136 136 … … 140 140 } 141 141 /*}}}*/ 142 /*FUNCTION SeqMat::MatMult{{{ 1*/142 /*FUNCTION SeqMat::MatMult{{{*/ 143 143 void SeqMat::MatMult(SeqVec* X,SeqVec* AX){ 144 144 145 145 int i,j; 146 146 int XM,AXM; 147 double dummy;147 IssmDouble dummy; 148 148 149 149 X->GetSize(&XM); 150 150 AX->GetSize(&AXM); 151 151 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!"); 154 154 155 155 for(i=0;i<M;i++){ … … 163 163 } 164 164 /*}}}*/ 165 /*FUNCTION SeqMat::Duplicate{{{ 1*/165 /*FUNCTION SeqMat::Duplicate{{{*/ 166 166 SeqMat* SeqMat::Duplicate(void){ 167 167 168 double dummy=0;168 IssmDouble dummy=0; 169 169 170 170 return new SeqMat(this->matrix,this->M,this->N,dummy); … … 172 172 } 173 173 /*}}}*/ 174 /*FUNCTION SeqMat::ToSerial{{{ 1*/175 double* SeqMat::ToSerial(void){176 177 double* buffer=NULL;174 /*FUNCTION SeqMat::ToSerial{{{*/ 175 IssmDouble* SeqMat::ToSerial(void){ 176 177 IssmDouble* buffer=NULL; 178 178 179 179 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); 182 182 } 183 183 return buffer; … … 185 185 } 186 186 /*}}}*/ 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{{{*/ 188 void SeqMat::SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){ 189 189 190 190 int i,j; … … 197 197 break; 198 198 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{{{*/ 206 206 void SeqMat::Convert(MatrixType type){ 207 207 -
issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.h
r12168 r12878 1 1 /*!\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. 3 3 */ 4 4 … … 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #ifdef HAVE_CONFIG_H 11 11 #include <config.h> … … 24 24 25 25 int M,N; 26 double* matrix;26 IssmDouble* matrix; 27 27 28 /*SeqMat constructors, destructors {{{ 1*/28 /*SeqMat constructors, destructors {{{*/ 29 29 SeqMat(); 30 30 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); 33 33 SeqMat(int M,int N,int connectivity,int numberofdofspernode); 34 34 ~SeqMat(); 35 35 /*}}}*/ 36 /*SeqMat specific routines {{{ 1*/36 /*SeqMat specific routines {{{*/ 37 37 void Echo(void); 38 38 void Assemble(void); 39 double Norm(NormMode norm_type);39 IssmDouble Norm(NormMode norm_type); 40 40 void GetSize(int* pM,int* pN); 41 41 void GetLocalSize(int* pM,int* pN); 42 42 void MatMult(SeqVec* X,SeqVec* AX); 43 43 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); 46 46 void Convert(MatrixType type); 47 47 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.cpp
r12168 r12878 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 19 19 20 20 /*SeqVec constructors and destructor*/ 21 /*FUNCTION SeqVec::SeqVec(){{{ 1*/21 /*FUNCTION SeqVec::SeqVec(){{{*/ 22 22 SeqVec::SeqVec(){ 23 23 … … 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION SeqVec::SeqVec(int M,bool fromlocalsize){{{ 1*/28 /*FUNCTION SeqVec::SeqVec(int M,bool fromlocalsize){{{*/ 29 29 SeqVec::SeqVec(int pM,bool fromlocalsize){ 30 30 31 31 this->M=pM; 32 32 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){{{*/ 37 SeqVec::SeqVec(IssmDouble* buffer,int pM){ 38 38 39 39 int i,j; … … 42 42 this->vector=NULL; 43 43 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(){{{*/ 50 50 SeqVec::~SeqVec(){ 51 x free((void**)&this->vector);51 xDelete<IssmDouble>(this->vector); 52 52 M=0; 53 53 } … … 55 55 56 56 /*SeqVec specific routines: */ 57 /*FUNCTION SeqVec::Echo{{{ 1*/57 /*FUNCTION SeqVec::Echo{{{*/ 58 58 void SeqVec::Echo(void){ 59 59 60 60 int i; 61 printf("SeqVec size %i\n",this->M);61 _printLine_("SeqVec size " << this->M); 62 62 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{{{*/ 69 69 void SeqVec::Assemble(void){ 70 70 … … 73 73 } 74 74 /*}}}*/ 75 /*FUNCTION SeqVec::SetValues{{{ 1*/76 void SeqVec::SetValues(int ssize, int* list, double* values, InsMode mode){75 /*FUNCTION SeqVec::SetValues{{{*/ 76 void SeqVec::SetValues(int ssize, int* list, IssmDouble* values, InsMode mode){ 77 77 78 78 int i; … … 85 85 break; 86 86 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{{{*/ 94 void SeqVec::SetValue(int dof, IssmDouble value, InsMode mode){ 95 95 96 96 switch(mode){ … … 102 102 break; 103 103 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{{{*/ 110 void SeqVec::GetValue(IssmDouble* pvalue,int dof){ 111 111 112 112 *pvalue=this->vector[dof]; … … 115 115 /*}}}*/ 116 116 117 /*FUNCTION SeqVec::GetSize{{{ 1*/117 /*FUNCTION SeqVec::GetSize{{{*/ 118 118 void SeqVec::GetSize(int* pM){ 119 119 … … 122 122 } 123 123 /*}}}*/ 124 /*FUNCTION SeqVec::GetLocalSize{{{ 1*/124 /*FUNCTION SeqVec::GetLocalSize{{{*/ 125 125 void SeqVec::GetLocalSize(int* pM){ 126 126 … … 129 129 } 130 130 /*}}}*/ 131 /*FUNCTION SeqVec::Duplicate{{{ 1*/131 /*FUNCTION SeqVec::Duplicate{{{*/ 132 132 SeqVec* SeqVec::Duplicate(void){ 133 133 … … 136 136 } 137 137 /*}}}*/ 138 /*FUNCTION SeqVec::Set{{{ 1*/139 void SeqVec::Set( double value){138 /*FUNCTION SeqVec::Set{{{*/ 139 void SeqVec::Set(IssmDouble value){ 140 140 141 141 int i; … … 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION SeqVec::AXPY{{{ 1*/147 void SeqVec::AXPY(SeqVec* X, double a){146 /*FUNCTION SeqVec::AXPY{{{*/ 147 void SeqVec::AXPY(SeqVec* X, IssmDouble a){ 148 148 149 149 int i; … … 154 154 } 155 155 /*}}}*/ 156 /*FUNCTION SeqVec::AYPX{{{ 1*/157 void SeqVec::AYPX(SeqVec* X, double a){156 /*FUNCTION SeqVec::AYPX{{{*/ 157 void SeqVec::AYPX(SeqVec* X, IssmDouble a){ 158 158 159 159 int i; … … 164 164 } 165 165 /*}}}*/ 166 /*FUNCTION SeqVec::ToMPISerial{{{ 1*/167 double* SeqVec::ToMPISerial(void){168 169 double* buffer=NULL;166 /*FUNCTION SeqVec::ToMPISerial{{{*/ 167 IssmDouble* SeqVec::ToMPISerial(void){ 168 169 IssmDouble* buffer=NULL; 170 170 171 171 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); 174 174 } 175 175 return buffer; … … 177 177 } 178 178 /*}}}*/ 179 /*FUNCTION SeqVec::Copy{{{ 1*/179 /*FUNCTION SeqVec::Copy{{{*/ 180 180 void SeqVec::Copy(SeqVec* to){ 181 181 … … 187 187 } 188 188 /*}}}*/ 189 /*FUNCTION SeqVec::Norm{{{ 1*/190 double SeqVec::Norm(NormMode mode){191 192 double norm;189 /*FUNCTION SeqVec::Norm{{{*/ 190 IssmDouble SeqVec::Norm(NormMode mode){ 191 192 IssmDouble norm; 193 193 int i; 194 194 … … 204 204 break; 205 205 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{{{*/ 212 void SeqVec::Scale(IssmDouble scale_factor){ 213 213 214 214 int i; … … 217 217 } 218 218 /*}}}*/ 219 /*FUNCTION SeqVec::Dot{{{ 1*/220 double SeqVec::Dot(SeqVec* input){221 222 int i; 223 224 double dot=0;219 /*FUNCTION SeqVec::Dot{{{*/ 220 IssmDouble SeqVec::Dot(SeqVec* input){ 221 222 int i; 223 224 IssmDouble dot=0; 225 225 for(i=0;i<this->M;i++)dot+=this->vector[i]*input->vector[i]; 226 226 return dot; … … 228 228 } 229 229 /*}}}*/ 230 /*FUNCTION SeqVec::PointwiseDivide{{{ 1*/230 /*FUNCTION SeqVec::PointwiseDivide{{{*/ 231 231 void SeqVec::PointwiseDivide(SeqVec* x,SeqVec* y){ 232 232 -
issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.h
r12168 r12878 1 1 /*!\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* 3 3 */ 4 4 … … 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #ifdef HAVE_CONFIG_H 11 11 #include <config.h> … … 22 22 public: 23 23 24 double* vector;24 IssmDouble* vector; 25 25 int M; 26 26 27 /*SeqVec constructors, destructors {{{ 1*/27 /*SeqVec constructors, destructors {{{*/ 28 28 SeqVec(); 29 29 SeqVec(int M,bool fromlocalsize=false); 30 SeqVec( double* buffer, int M);30 SeqVec(IssmDouble* buffer, int M); 31 31 ~SeqVec(); 32 32 /*}}}*/ 33 /*SeqVec specific routines {{{ 1*/33 /*SeqVec specific routines {{{*/ 34 34 void Echo(void); 35 35 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); 39 39 void GetSize(int* pM); 40 40 void GetLocalSize(int* pM); 41 41 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); 46 46 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); 49 49 void PointwiseDivide(SeqVec* x,SeqVec* y); 50 double Dot(SeqVec* vector);50 IssmDouble Dot(SeqVec* vector); 51 51 /*}}}*/ 52 52 }; -
issm/branches/trunk-jpl-damage/src/c/toolkits/issm/issmtoolkit.h
r11733 r12878 6 6 #define _ISSM_TOOLKIT_H_ 7 7 8 #include "../../include/include.h" 9 8 10 #include "./SeqMat.h" 9 11 #include "./SeqVec.h" -
issm/branches/trunk-jpl-damage/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
r10087 r12878 13 13 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart); 14 14 #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 ...: */ 16 16 int i; 17 17 … … 21 21 idx_t k=0; 22 22 real_t* tpwgts=NULL; 23 24 25 23 26 24 /*setup options: */ … … 40 38 options[METIS_OPTION_NCUTS] = 1; 41 39 42 43 40 /*create eptr: */ 44 eptr= (idx_t*)xmalloc((*pnumberofelements+1)*sizeof(idx_t));41 eptr=xNew<idx_t>((*pnumberofelements+1)); 45 42 eptr[0]=0; 46 43 for(i=0;i<*pnumberofelements;i++){ … … 49 46 } 50 47 51 52 48 /*create tpwgts: */ 53 tpwgts= (real_t*)xmalloc(*pnum_procs*sizeof(real_t));49 tpwgts=xNew<real_t>(*pnum_procs); 54 50 for(i=0;i<*pnum_procs;i++){ 55 51 tpwgts[i]=1.0/(*pnum_procs); 56 52 } 57 53 54 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index, 55 NULL, NULL, pnum_procs, tpwgts, options, &objval,epart, npart); 58 56 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); 63 60 64 61 #else 65 _error _("METIS version not supported yet");62 _error2_("METIS version not supported yet"); 66 63 #endif 67 64 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp
r11708 r12878 5 5 #include <stdio.h> 6 6 #include <math.h> 7 8 9 7 #include "../../../shared/shared.h" 10 8 … … 24 22 25 23 /*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); 27 25 28 26 for (i=0;i<num_procs;i++){ 29 30 27 /*Here, we use floor. We under distribute rows. The rows 31 28 left are then redistributed, therefore resulting in a … … 39 36 num_local_rows[i]++; 40 37 } 41 42 38 local_size=num_local_rows[my_rank]; 43 39 44 40 /*free ressources: */ 45 x free((void**)&num_local_rows);41 xDelete<int>(num_local_rows); 46 42 47 43 /*return size: */ -
issm/branches/trunk-jpl-damage/src/c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp
r11708 r12878 20 20 21 21 /*Gather all range values into allranges, for all nodes*/ 22 allranges= (int*)xmalloc(num_procs*sizeof(int));22 allranges=xNew<int>(num_procs); 23 23 MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD); 24 25 24 26 25 /*From all ranges, get lower row and upper row*/ … … 31 30 upper_row=upper_row+allranges[i]; 32 31 } 33 34 /*free: */35 xfree((void**)&allranges);36 32 37 33 /*Assign output pointers: */ 34 xDelete<int>(allranges); 38 35 *plower_row=lower_row; 39 36 *pupper_row=upper_row; 40 41 37 return 1; 42 38 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/GetOwnershipBoundariesFromRange.cpp
r9320 r12878 28 28 29 29 /*Gather all range values into allranges, for all nodes*/ 30 allranges= (int*)xmalloc(num_procs*sizeof(int));30 allranges=xNew<int>(num_procs); 31 31 MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD); 32 32 … … 42 42 *plower_row=lower_row; 43 43 *pupper_row=upper_row; 44 45 /*Free ressources:*/ 46 xfree((void**)&allranges); 47 44 xDelete<int>(allranges); 48 45 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscInsertMode.cpp
r11708 r12878 30 30 break; 31 31 default: 32 _error _("unknown insert mode!");32 _error2_("unknown insert mode!"); 33 33 break; 34 34 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscMatrixType.cpp
r12004 r12878 30 30 break; 31 31 default: 32 _error _("unknown matrix type !");32 _error2_("unknown matrix type !"); 33 33 break; 34 34 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscNormMode.cpp
r11708 r12878 30 30 break; 31 31 default: 32 _error _("unknown norm !");32 _error2_("unknown norm !"); 33 33 break; 34 34 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatInvert.cpp
r12168 r12878 29 29 /*Some checks: */ 30 30 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!"); 32 32 33 33 /*Create identitiy matrix: */ -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatMultPatch.cpp
r9826 r12878 64 64 } 65 65 else{ 66 result=1; \66 result=1; 67 67 } 68 68 return result; … … 89 89 range=upper_row-lower_row+1; 90 90 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); 93 93 for (int i=0;i<range;i++){ 94 94 *(index+i)=lower_row+i; … … 103 103 104 104 /*Free ressources:*/ 105 x free((void**)&index);106 x free((void**)&values);105 xDelete<int>(index); 106 xDelete<double>(values); 107 107 108 108 /*Assign output pointers:*/ -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatPartition.cpp
r12004 r12878 48 48 d_nz=0; 49 49 o_nz=0; 50 #if def _HAVE_PETSCDEV_50 #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2 51 51 MatCreateAIJ(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,d_nz,PETSC_NULL,o_nz,PETSC_NULL,&outmatrix); 52 52 #else … … 55 55 } 56 56 else if (strcmp(type,"mpidense")==0){ 57 #if def _HAVE_PETSCDEV_57 #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2 58 58 MatCreateDense(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,PETSC_NULL,&outmatrix); 59 59 #else … … 62 62 } 63 63 else{ 64 _error _("MatType %s not supported yet",type);64 _error2_("MatType " << type << " not supported yet"); 65 65 } 66 66 /*Assemble*/ … … 77 77 count=0; 78 78 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. 80 80 81 81 for (i=0;i<row_partition_vector_size;i++){ … … 98 98 99 99 /*Same deal for columns*/ 100 node_cols= (int*)xmalloc(col_partition_vector_size*sizeof(int));100 node_cols=xNew<int>(col_partition_vector_size); 101 101 for (i=0;i<col_partition_vector_size;i++){ 102 102 *(node_cols+i)=(int)*(col_partition_vector+i)-1; … … 128 128 129 129 /*Free ressources:*/ 130 x free((void**)&node_rows);131 x free((void**)&node_cols);130 xDelete<int>(node_rows); 131 xDelete<int>(node_cols); 132 132 ISFree(&col_index); 133 133 ISFree(&row_index); -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatToSerial.cpp
r11708 r12878 32 32 double* outmatrix=NULL; 33 33 34 35 34 /*get matrix size: */ 36 35 MatGetSize(matrix,&M,&N); … … 42 41 43 42 /*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); 45 44 46 45 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); 50 49 51 50 for (i=0;i<N;i++){ … … 78 77 //Still have the local_matrix on node 0 to take care of. 79 78 memcpy(outmatrix,local_matrix,N*range*sizeof(double)); 80 81 79 } 82 80 83 81 /*Assign output pointer: */ 84 82 *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); 90 86 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/NewMat.cpp
r12168 r12878 20 20 #include "../../mpi/patches/mpipatches.h" 21 21 22 /*NewMat(int M,int N){{{ 1*/22 /*NewMat(int M,int N){{{*/ 23 23 Mat NewMat(int M,int N){ 24 24 … … 39 39 o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2 40 40 41 #if def _HAVE_PETSCDEV_41 #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2 42 42 MatCreateAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix); 43 43 #else … … 48 48 } 49 49 /*}}}*/ 50 /*NewMat(int M,int N,double sparsity){{{ 1*/50 /*NewMat(int M,int N,double sparsity){{{*/ 51 51 Mat NewMat(int M,int N,double sparsity){ 52 52 … … 67 67 o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2 68 68 69 #if def _HAVE_PETSCDEV_69 #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2 70 70 if(sparsity==1){ 71 71 MatCreateDense(MPI_COMM_WORLD,m,n,M,N,NULL,&outmatrix); … … 81 81 } 82 82 /*}}}*/ 83 /*NewMat(int M,int N,int connectivity,int numberofdofspernode){{{ 1*/83 /*NewMat(int M,int N,int connectivity,int numberofdofspernode){{{*/ 84 84 Mat NewMat(int M,int N,int connectivity,int numberofdofspernode){ 85 85 -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscMatrixToDoubleMatrix.cpp
r12168 r12878 36 36 MatGetSize(petsc_matrix,&rows,&cols); 37 37 38 idxm= (int*)xmalloc(rows*sizeof(int));39 idxn= (int*)xmalloc(cols*sizeof(int));38 idxm=xNew<int>(rows); 39 idxn=xNew<int>(cols); 40 40 41 41 for(i=0;i<rows;i++)idxm[i]=i; 42 42 for(i=0;i<cols;i++)idxn[i]=i; 43 43 44 matrix= (double*)xmalloc(rows*cols*sizeof(double));44 matrix=xNew<double>(rows*cols); 45 45 MatGetValues(petsc_matrix,rows,idxm,cols,idxn,matrix); 46 47 xDelete<int>(idxm); 48 xDelete<int>(idxn); 46 49 47 50 /*Assign output pointers: */ -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp
r12004 r12878 55 55 if(first[0]!='-'){ 56 56 /*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 '-'!"); 58 58 } 59 59 /*Reduce first to bare option value*/ … … 90 90 } 91 91 92 #if def _HAVE_PETSCDEV_92 #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2 93 93 PetscTokenDestroy(&token); 94 94 #else -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscVectorToDoubleVector.cpp
r12168 r12878 28 28 VecGetSize(petsc_vector,&rows); 29 29 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); 32 32 for(i=0;i<rows;i++)idxm[i]=i; 33 34 33 VecGetValues(petsc_vector,rows,idxm,vector); 34 xDelete<int>(idxm); 35 35 } 36 36 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/SerialToVec.cpp
r12004 r12878 38 38 39 39 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); 42 42 for (i=0;i<range;i++){ 43 43 idxn[i]=lower_row+i; … … 54 54 55 55 /*Free ressources:*/ 56 x free((void**)&idxn);57 x free((void**)&values);56 xDelete<int>(idxn); 57 xDelete<double>(values); 58 58 59 59 return outvector; -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecMerge.cpp
r9320 r12878 35 35 /*If the dimension of the partitioning vector is not the same as that of vector B, we have a problem: */ 36 36 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"); 38 38 } 39 39 … … 45 45 if (range){ 46 46 /*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); 49 49 for (i=0;i<range;i++){ 50 50 *(idxm+i)=lower_row+i; … … 63 63 64 64 /*Free ressources:*/ 65 xfree((void**)&idxm); 66 xfree((void**)&values); 67 65 xDelete<int>(idxm); 66 xDelete<double>(values); 68 67 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecPartition.cpp
r9320 r12878 56 56 57 57 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. 59 59 60 60 count=0; … … 71 71 72 72 if (count){ 73 values= (double*)xmalloc(count*sizeof(double)); //holder for the values to be extracted from vectorA73 values=xNew<double>(count); //holder for the values to be extracted from vectorA 74 74 } 75 75 else{ 76 x free((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. 77 77 values=NULL; 78 78 } … … 110 110 VecAssemblyBegin(outvector); 111 111 VecAssemblyEnd(outvector); 112 113 112 } 114 113 115 114 /*Assign output pointers:*/ 116 115 *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); 122 118 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecToMPISerial.cpp
r11708 r12878 42 42 43 43 /*Allocate gathered vector on all nodes .*/ 44 gathered_vector= (double*)xmalloc(vector_size*sizeof(double));44 gathered_vector=xNew<double>(vector_size); 45 45 46 46 /*Allocate local vectors*/ … … 50 50 51 51 if (range){ 52 idxn= (int*)xmalloc(range*sizeof(int));52 idxn=xNew<int>(range); 53 53 for (i=0;i<range;i++){ 54 54 *(idxn+i)=lower_row+i; 55 55 } 56 local_vector= (double*)xmalloc(range*sizeof(double));56 local_vector=xNew<double>(range); 57 57 /*Extract values from MPI vector to serial local_vector on each node*/ 58 58 VecGetValues(vector,range,idxn,local_vector); … … 87 87 88 88 /*free ressources: */ 89 x free((void**)&idxn);90 x free((void**)&local_vector);89 xDelete<int>(idxn); 90 xDelete<double>(local_vector); 91 91 92 92 return 1; -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/VecTranspose.cpp
r1 r12878 33 33 34 34 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); 37 37 for (i=0;i<range;i++){ 38 38 *(idxm+i)=lower_row+i; 39 39 } 40 values= (double*)xmalloc(range*sizeof(double));41 tvalues= (double*)xmalloc(range*sizeof(double));40 values=xNew<double>(range); 41 tvalues=xNew<double>(range); 42 42 43 43 VecGetValues(vector,range,idxm,values); … … 56 56 57 57 /*Free ressources: */ 58 x free((void**)&idxm);59 x free((void**)&values);60 x free((void**)&tidxm);61 x free((void**)&tvalues);58 xDelete<int>(idxm); 59 xDelete<double>(values); 60 xDelete<int>(tidxm); 61 xDelete<double>(tvalues); 62 62 63 63 /*Assign output pointers: */ -
issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/petscincludes.h
r11708 r12878 16 16 /*our own patches: */ 17 17 #include "patches/petscpatches.h" 18 #include "objects/petscobjects.h" 18 19 19 20 #endif -
issm/branches/trunk-jpl-damage/src/c/toolkits/plapack/patches/CyclicalFactorization.cpp
r3595 r12878 44 44 int i; 45 45 46 decomp=x malloc(input*sizeof(int));46 decomp=xNew<int>(input); 47 47 *decomp=input; 48 48 for (i=0;i<input;i++){ … … 57 57 } 58 58 } 59 60 59 *pdecomp=decomp; 61 60 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/plapack/patches/PlapackInvertMatrix.cpp
r6412 r12878 13 13 #include "../../scalapack/FortranMapping.h" 14 14 15 void PlapackInvertMatrixLocalCleanup(PLA_Obj* pa,PLA_Template* ptempl,double** parrayA, 16 int** pidxnA,MPI_Comm* pcomm_2d); 15 void PlapackInvertMatrixLocalCleanup(PLA_Obj* pa,PLA_Template* ptempl,double** parrayA,int** pidxnA,MPI_Comm* pcomm_2d); 17 16 18 17 int 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*/ 20 19 21 20 /*Error management*/ 22 21 int i,j; 23 24 22 25 23 /*input*/ … … 53 51 54 52 /*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!"); 56 54 57 55 /* Set default Plapack parameters */ … … 94 92 /* Set the datatype */ 95 93 datatype = MPI_DOUBLE; 96 97 94 98 95 /* Copy A into a*/ … … 104 101 upper_row--; 105 102 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); 108 105 for (i=0;i<nA;i++){ 109 106 *(idxnA+i)=i; … … 128 125 PLA_Obj_free(&a); 129 126 PLA_Temp_free(&templ); 130 x free((void**)&arrayA);131 x free((void**)&idxnA);127 xDelete<double>(arrayA); 128 xDelete<int>(idxnA); 132 129 133 130 /*Finalize PLAPACK*/ 134 131 PLA_Finalize(); 135 132 MPI_Comm_free(&comm_2d); 136 137 133 } -
issm/branches/trunk-jpl-damage/src/c/toolkits/plapack/patches/PlapackToPetsc.cpp
r3332 r12878 45 45 46 46 /*Vector physically based block cyclic distribution: */ 47 row_nodes=x malloc(mA*sizeof(int));48 col_nodes=x malloc(nA*sizeof(int));47 row_nodes=xNew<int>(mA); 48 col_nodes=xNew<int>(nA); 49 49 for (i=0;i<mA;i++){ 50 50 i0=i/nb; … … 60 60 PLA_Temp_comm_col_rank(templ,&myrow); 61 61 62 idxm=x malloc(mA*sizeof(int));62 idxm=xNew<int>(mA); 63 63 count=0; 64 64 for (i=0;i<mA;i++){ … … 70 70 idxm_count=count; 71 71 72 idxn=x malloc(nA*sizeof(int));72 idxn=xNew<int>(nA); 73 73 count=0; 74 74 for (i=0;i<nA;i++){ … … 92 92 93 93 /*Free ressources:*/ 94 x free((void**)&row_nodes);95 x free((void**)&col_nodes);96 x free((void**)&idxm);97 x free((void**)&idxn);94 xDelete<int>(row_nodes); 95 xDelete<int>(col_nodes); 96 xDelete<int>(idxm); 97 xDelete<int>(idxn); 98 98 } -
issm/branches/trunk-jpl-damage/src/dox/issm.dox
r12168 r12878 46 46 </th> 47 47 <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> 49 49 </tr> 50 50 <tr> 51 <th bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td bgcolor=#C6E2FF style="text-align:right;">9 19</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> 52 52 </tr> 53 53 <tr> 54 <th bgcolor=#FFFFFF style="text-align:left;"> C/C++ Header </th><td bgcolor=#FFFFFF style="text-align:right;">3 66</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> 55 55 </tr> 56 56 <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;">99 3</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> 58 58 </tr> 59 59 <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> 61 61 </tr> 62 62 <tr> … … 67 67 </tr> 68 68 <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;">4 6</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> 70 70 </tr> 71 71 <tr> … … 73 73 </tr> 74 74 <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> 76 76 </tr> 77 77 <tr> 78 <th bgcolor=#FFFFFF style="text-align:left;"> SUM: </th><td bgcolor=#FFFFFF style="text-align:right;">18 58</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> 79 79 </tr> 80 80 </table> -
issm/branches/trunk-jpl-damage/src/m/classes/autodiff.m
r12004 r12878 22 22 23 23 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{24 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 25 26 26 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/balancethickness.m
r12004 r12878 25 25 26 26 end % }}} 27 function checkconsistency(obj,md,solution,analyses) % {{{27 function md = checkconsistency(obj,md,solution,analyses) % {{{ 28 28 %Early return 29 29 if solution~=BalancethicknessSolutionEnum, return; end 30 30 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]); 34 34 end % }}} 35 35 function disp(obj) % {{{ -
issm/branches/trunk-jpl-damage/src/m/classes/bamggeom.m
r8587 r12878 6 6 classdef bamggeom 7 7 properties (SetAccess=public) 8 % {{{ 18 % {{{ 9 9 Vertices=[]; 10 10 Edges=[]; … … 18 18 end 19 19 methods 20 function bg = bamggeom(varargin)% {{{ 120 function bg = bamggeom(varargin)% {{{ 21 21 %BAMGGEOM - constructor for bamggeom object 22 22 % … … 44 44 end 45 45 end%}}} 46 function display(bg)% {{{ 146 function display(bg)% {{{ 47 47 disp(sprintf('\n%s = \n',inputname(1))); 48 48 disp(struct(bg)) -
issm/branches/trunk-jpl-damage/src/m/classes/bamgmesh.m
r8587 r12878 6 6 classdef bamgmesh 7 7 properties (SetAccess=public) 8 % {{{ 18 % {{{ 9 9 Vertices=[]; 10 10 Edges=[]; … … 26 26 end 27 27 methods 28 function bg = bamgmesh(varargin)% {{{ 128 function bg = bamgmesh(varargin)% {{{ 29 29 30 30 switch nargin … … 48 48 end 49 49 end%}}} 50 function display(bm)% {{{ 150 function display(bm)% {{{ 51 51 disp(sprintf('\n%s = \n',inputname(1))); 52 52 disp(struct(bm)) -
issm/branches/trunk-jpl-damage/src/m/classes/basalforcings.m
r12004 r12878 22 22 23 23 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{24 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 25 26 26 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); 28 28 end 29 29 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]); 31 31 end 32 32 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); 35 35 end 36 36 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/castor.m
r12004 r12878 8 8 classdef castor 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='castor' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=castor(varargin) % {{{ 122 function cluster=castor(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'shortc','longc'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster, md) % {{{148 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 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 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/sh\n'); 58 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. … … 64 62 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 65 63 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 66 67 64 fprintf(fid,'export PBS_O_WORKDIR=%s\n',cluster.executionpath); 68 65 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 69 66 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 70 67 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 file73 68 fclose(fid); 74 69 75 70 end 76 71 %}}} 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)% {{{ 82 73 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); 97 83 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']}); 102 86 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)% {{{ 106 93 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); 111 97 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 %}}} 132 99 end 133 100 end -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/cosmos.m
r12004 r12878 8 8 classdef cosmos 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='cosmos' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=cosmos(varargin) % {{{ 122 function cluster=cosmos(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'debug','shortq','longq'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster, md) % {{{148 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 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 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/bash\n'); 58 56 fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np); … … 68 66 fprintf(fid,'ulimit -c 0\n'); 69 67 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 file72 68 fclose(fid); 73 69 74 70 end 75 71 %}}} 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)% {{{ 81 73 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); 96 83 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']}); 101 86 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)% {{{ 105 93 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); 110 97 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 %}}} 131 99 end 132 100 end -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/gemini.m
r12004 r12878 8 8 classdef gemini 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='gemini' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=gemini(varargin) % {{{ 122 function cluster=gemini(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'debug','shortg','longg'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster, md) % {{{148 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 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 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/sh\n'); 58 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. … … 69 67 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 70 68 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 file73 69 fclose(fid); 74 70 75 71 end 76 72 %}}} 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)% {{{ 82 74 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); 97 84 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']}); 102 87 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)% {{{ 106 94 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); 111 98 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 %}}} 132 100 end 133 101 end -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.m
r12168 r12878 6 6 7 7 classdef generic 8 9 % {{{110 11 12 13 14 15 16 17 18 19 20 21 22 23 function cluster=generic(varargin) % {{{18 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) % {{{ 24 24 25 26 25 %use provided options to change fields 26 options=pairoptions(varargin{:}); 27 27 28 29 28 %get name 29 cluster.name=getfieldvalue(options,'name',oshostname()); 30 30 31 32 31 %initialize cluster using user settings if provided 32 if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end 33 33 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) % {{{ 68 62 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, 75 65 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); 107 86 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 114 88 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); 163 93 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); 166 96 end 167 else 168 %launch right here, do not compress or archive. 169 system([md.miscellaneous.name '.bat']); 97 fclose(fid); 170 98 end 171 99 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); 172 172 end %}}} 173 function Download(cluster,md)% {{{1173 function Download(cluster,dirname,filelist)% {{{ 174 174 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 180 179 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); 203 183 end %}}} 204 184 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'); 1 import socket 2 import os 3 import math 4 import platform 5 import subprocess 6 from issmdir import * 7 from pairoptions import * 8 from issmssh import * 9 from issmscpin import * 10 from issmscpout import * 7 11 12 class 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 """ 8 20 9 class generic: 10 #properties 11 def __init__(self): 12 # {{{ Properties 21 def __init__(self,*args): # {{{ 22 13 23 self.name='' 14 24 self.login='' … … 16 26 self.port=0 17 27 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' 39 33 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 8 8 classdef greenplanet 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='greenplanet' 12 12 login=''; … … 24 24 end 25 25 methods 26 function cluster=greenplanet(varargin) % {{{ 126 function cluster=greenplanet(varargin) % {{{ 27 27 28 28 %initialize cluster using default settings if provided … … 33 33 end 34 34 %}}} 35 function disp(cluster) % {{{ 135 function disp(cluster) % {{{ 36 36 % display the object 37 37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 48 48 end 49 49 %}}} 50 function checkconsistency(cluster,md,solution,analyses) % {{{150 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 51 51 52 52 available_queues={'rignot','default'}; … … 57 57 58 58 %Miscelaneous 59 if isempty(cluster.login), checkmessage('login empty'); end60 if isempty(cluster.codepath), checkmessage('codepath empty'); end61 if isempty(cluster.executionpath), checkmessage('executionpath empty'); end59 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 62 62 63 63 end 64 64 %}}} 65 function BuildQueueScript(cluster, md) % {{{165 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 66 66 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 71 69 72 70 %compute number of processors 73 71 cluster.np=cluster.numnodes*cluster.cpuspernode; 74 72 75 % open file for writing:73 %write queuing script 76 74 fid=fopen([modelname '.queue'],'w'); 77 78 75 fprintf(fid,'#PBS -S /bin/bash\n'); 79 76 fprintf(fid,'#PBS -N %s\n',modelname); … … 84 81 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 85 82 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); 88 84 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: 92 86 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 93 87 end 94 95 %close file96 88 fclose(fid); 97 89 … … 100 92 fid=fopen([modelname '.run'],'w'); 101 93 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: 105 95 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 106 96 end … … 112 102 end 113 103 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)% {{{ 123 105 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); 147 115 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']}); 155 118 156 %some check157 if isempty(md.private.runtimename),158 if ~cluster.interactive,159 error('greenplanet Download error message: supply runtime name for results to be loaded!');160 end161 end119 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)% {{{ 162 125 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); 169 129 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 %}}} 192 131 end 193 132 end -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/pfe.m
r12004 r12878 8 8 classdef pfe 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='pfe' 12 12 login=''; … … 29 29 end 30 30 methods 31 function cluster=pfe(varargin) % {{{ 131 function cluster=pfe(varargin) % {{{ 32 32 33 33 %initialize cluster using default settings if provided … … 38 38 end 39 39 %}}} 40 function disp(cluster) % {{{ 140 function disp(cluster) % {{{ 41 41 % display the object 42 42 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 56 56 end 57 57 %}}} 58 function checkconsistency(cluster,md,solution,analyses) % {{{158 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 59 59 60 60 available_queues={'long','normal','debug'}; … … 68 68 if cluster.hyperthreading, 69 69 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'); 71 71 end 72 72 else 73 73 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'); 75 75 end 76 76 end … … 78 78 if cluster.hyperthreading, 79 79 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'); 81 81 end 82 82 else 83 83 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'''); 89 89 end 90 90 91 91 %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 104 101 105 102 %compute number of processors 106 103 cluster.np=cluster.numnodes*cluster.cpuspernode; 107 104 108 % open file for writing:105 %write queuing script 109 106 fid=fopen([modelname '.queue'],'w'); 110 111 107 fprintf(fid,'#PBS -S /bin/bash\n'); 112 108 % fprintf(fid,'#PBS -N %s\n',modelname); … … 118 114 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 119 115 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname); 120 121 116 fprintf(fid,'. /usr/share/modules/init/bash\n\n'); 122 123 117 fprintf(fid,'module load comp-intel/11.1.046\n'); 124 118 fprintf(fid,'module load mpi/mpt.1.25\n'); 125 119 fprintf(fid,'module load math/intel_mkl_64_10.0.011\n\n'); 126 127 120 fprintf(fid,'export PATH="$PATH:."\n\n'); 128 121 fprintf(fid,'export MPI_GROUP_MAX=64\n\n'); 129 130 122 fprintf(fid,'cd $PBS_O_WORKDIR\n\n'); 131 132 123 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: 136 125 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 137 126 end 138 139 %close file140 127 fclose(fid); 141 128 … … 148 135 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); 149 136 end 150 151 if ~md.settings.io_gather, 152 %concatenate the output files: 137 if ~io_gather, %concatenate the output files: 153 138 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 154 139 end … … 160 145 end 161 146 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 164 172 %lauch command, to be executed via ssh 165 173 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 %}}} 248 200 end 249 201 end -
issm/branches/trunk-jpl-damage/src/m/classes/clusters/pollux.m
r12004 r12878 8 8 classdef pollux 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='pollux' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=pollux(varargin) % {{{ 122 function cluster=pollux(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'shortp','longp'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster, md) % {{{148 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 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 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/sh\n'); 58 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. … … 64 62 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 65 63 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 66 67 64 fprintf(fid,'export PBS_O_WORKDIR=%s\n',cluster.executionpath); 68 65 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 69 66 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 70 67 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 file73 68 fclose(fid); 74 69 75 70 end 76 71 %}}} 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)% {{{ 82 73 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); 97 83 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']}); 102 86 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)% {{{ 106 93 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); 111 97 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 %}}} 132 99 end 133 100 end -
issm/branches/trunk-jpl-damage/src/m/classes/constants.m
r12004 r12878 31 31 32 32 end % }}} 33 function flag= checkconsistency(obj,md,solution,analyses) % {{{33 function md = checkconsistency(obj,md,solution,analyses) % {{{ 34 34 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]); 38 38 39 39 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/debug.m
r12004 r12878 8 8 valgrind = false; 9 9 gprof = false; 10 p etsc_profiling = false;10 profiling = false; 11 11 end 12 12 methods … … 27 27 fielddisplay(obj,'valgrind','use Valgrind to debug (0 or 1)'); 28 28 fielddisplay(obj,'gprof','use gnu-profiler to find out where the time is spent'); 29 fielddisplay(obj,'p etsc_profiling','enables PETScprofiling (memory, flops, time)');29 fielddisplay(obj,'profiling','enables profiling (memory, flops, time)'); 30 30 31 31 end % }}} 32 32 function marshall(obj,fid) % {{{ 33 WriteData(fid,'object',obj,'fieldname','p etsc_profiling','format','Boolean');33 WriteData(fid,'object',obj,'fieldname','profiling','format','Boolean'); 34 34 end % }}} 35 35 end -
issm/branches/trunk-jpl-damage/src/m/classes/diagnostic.m
r12168 r12878 64 64 65 65 end % }}} 66 function checkconsistency(obj,md,solution,analyses) % {{{66 function md = checkconsistency(obj,md,solution,analyses) % {{{ 67 67 68 68 %Early return … … 70 70 %if ~ismember(DiagnosticHorizAnalysisEnum,analyses) | (solution==TransientSolutionEnum & md.transient.isdiagnostic==0), return; end 71 71 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); end75 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); 81 81 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); 83 83 else 84 checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1);84 md = checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1); 85 85 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]); 89 89 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]); 91 91 end 92 92 93 93 %singular solution 94 94 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!']); 96 96 end 97 97 %CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES 98 98 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']); 100 100 end 101 101 %CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL … … 103 103 pos=find(sum(isnan(md.diagnostic.referential),2)==0); 104 104 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']); 106 106 end 107 107 end … … 110 110 pos=find(md.mask.vertexongroundedice & md.mesh.vertexonbed); 111 111 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']); 113 113 end 114 114 end -
issm/branches/trunk-jpl-damage/src/m/classes/flaim.m
r12004 r12878 32 32 33 33 end % }}} 34 function checkconsistency(obj,md,solution,analyses) % {{{34 function md = checkconsistency(obj,md,solution,analyses) % {{{ 35 35 36 36 %Early return 37 37 if solution~=FlaimSolutionEnum, return; end 38 38 39 checkfield(md,'flaim.tracks','file',1);39 md = checkfield(md,'flaim.tracks','file',1); 40 40 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); 42 42 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]); 44 44 end 45 45 -
issm/branches/trunk-jpl-damage/src/m/classes/flowequation.m
r12004 r12878 27 27 28 28 end % }}} 29 function checkconsistency(obj,md,solution,analyses) % {{{29 function md = checkconsistency(obj,md,solution,analyses) % {{{ 30 30 31 31 if ismember(DiagnosticHorizAnalysisEnum,analyses), 32 32 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]); 39 39 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]); 42 42 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]); 45 45 end 46 46 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']); 48 48 end 49 49 end 50 50 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 53 55 end 54 56 end -
issm/branches/trunk-jpl-damage/src/m/classes/friction.m
r12004 r12878 22 22 23 23 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{24 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 25 26 26 %Early return 27 27 if ~ismember(DiagnosticHorizAnalysisEnum,analyses) & ~ismember(ThermalAnalysisEnum,analyses), return; end 28 28 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]); 32 32 end % }}} 33 33 function disp(obj) % {{{ -
issm/branches/trunk-jpl-damage/src/m/classes/geometry.m
r12004 r12878 24 24 25 25 end % }}} 26 function checkconsistency(obj,md,solution,analyses) % {{{26 function md = checkconsistency(obj,md,solution,analyses) % {{{ 27 27 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); 31 31 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']); 33 33 end 34 34 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]); 36 36 end 37 37 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/groundingline.m
r12168 r12878 28 28 29 29 end % }}} 30 function checkconsistency(obj,md,solution,analyses) % {{{30 function md = checkconsistency(obj,md,solution,analyses) % {{{ 31 31 32 checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'});32 md = checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'}); 33 33 34 34 if ~strcmp(obj.migration,'None'), 35 35 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!']); 37 37 end 38 38 pos=find(md.mask.vertexongroundedice); 39 39 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 !']); 41 41 end 42 42 pos=find(md.mask.vertexonfloatingice); 43 43 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 !']); 45 45 end 46 46 end -
issm/branches/trunk-jpl-damage/src/m/classes/hydrology.m
r12004 r12878 35 35 obj.stabilization=1; 36 36 end % }}} 37 function checkconsistency(obj,md,solution,analyses) % {{{37 function md = checkconsistency(obj,md,solution,analyses) % {{{ 38 38 39 39 %Early return 40 40 if ~ismember(HydrologyAnalysisEnum,analyses), return; end 41 41 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); 44 44 end % }}} 45 45 function disp(obj) % {{{ -
issm/branches/trunk-jpl-damage/src/m/classes/initialization.m
r12004 r12878 27 27 28 28 end % }}} 29 function checkconsistency(obj,md,solution,analyses) % {{{29 function md = checkconsistency(obj,md,solution,analyses) % {{{ 30 30 if ismember(DiagnosticHorizAnalysisEnum,analyses) 31 31 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]); 34 34 end 35 35 end 36 36 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]); 39 39 end 40 40 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]); 42 42 end 43 43 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]); 46 46 %Triangle with zero velocity 47 47 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'); 49 49 end 50 50 end 51 51 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]); 56 56 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]); 59 59 end 60 60 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/inversion.m
r12872 r12878 75 75 76 76 end % }}} 77 function checkconsistency(obj,md,solution,analyses) % {{{77 function md = checkconsistency(obj,md,solution,analyses) % {{{ 78 78 79 79 %Early return … … 98 98 99 99 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); 101 101 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); 104 104 end 105 105 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/mask.m
r12004 r12878 25 25 26 26 end % }}} 27 function checkconsistency(obj,md,solution,analyses) % {{{27 function md = checkconsistency(obj,md,solution,analyses) % {{{ 28 28 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]); 35 35 end % }}} 36 36 function disp(obj) % {{{ -
issm/branches/trunk-jpl-damage/src/m/classes/materials.m
r12004 r12878 8 8 rho_ice = 0; 9 9 rho_water = 0; 10 rho_freshwater = 0; 10 11 mu_water = 0; 11 12 heatcapacity = 0; … … 35 36 obj.rho_ice=917; 36 37 37 % water density (kg/m^3)38 %ocean water density (kg/m^3) 38 39 obj.rho_water=1023; 40 41 %fresh water density (kg/m^3) 42 obj.rho_freshwater=1000; 39 43 40 44 %water viscosity (N.s/m^2) … … 66 70 obj.rheology_law='Paterson'; 67 71 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'}); 76 80 end % }}} 77 81 function disp(obj) % {{{ … … 79 83 80 84 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]'); 82 87 fielddisplay(obj,'mu_water','water viscosity [N s/m^2]'); 83 88 fielddisplay(obj,'heatcapacity','heat capacity [J/kg/K]'); … … 96 101 WriteData(fid,'object',obj,'fieldname','rho_ice','format','Double'); 97 102 WriteData(fid,'object',obj,'fieldname','rho_water','format','Double'); 103 WriteData(fid,'object',obj,'fieldname','rho_freshwater','format','Double'); 98 104 WriteData(fid,'object',obj,'fieldname','mu_water','format','Double'); 99 105 WriteData(fid,'object',obj,'fieldname','heatcapacity','format','Double'); -
issm/branches/trunk-jpl-damage/src/m/classes/mesh.m
r12004 r12878 64 64 obj.average_vertex_connectivity=25; 65 65 end % }}} 66 function checkconsistency(obj,md,solution,analyses) % {{{66 function md = checkconsistency(obj,md,solution,analyses) % {{{ 67 67 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); 72 72 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]); 74 74 else 75 checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]);75 md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]); 76 76 end 77 77 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'); 79 79 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); 84 84 %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]); 89 89 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'); 91 91 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'); 93 93 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); 95 95 96 96 %Solution specific checks … … 98 98 case PrognosticSolutionEnum, 99 99 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); 103 103 end 104 104 case BalancethicknessSolutionEnum, 105 105 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); 109 109 end 110 110 case TransientSolutionEnum, 111 111 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); 115 115 end 116 116 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'); 118 118 end 119 119 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/miscellaneous.m
r12004 r12878 19 19 end 20 20 end % }}} 21 function checkconsistency(obj,md,solution,analyses) % {{{21 function md = checkconsistency(obj,md,solution,analyses) % {{{ 22 22 23 checkfield(md,'miscellaneous.name','empty',1);23 md = checkfield(md,'miscellaneous.name','empty',1); 24 24 25 25 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/model/model.m
r12872 r12878 6 6 classdef model 7 7 properties (SetAccess=public) %Model fields 8 % {{{ 18 % {{{ 9 9 %Careful here: no other class should be used as default value this is a bug of matlab 10 10 mesh = 0; … … 75 75 end 76 76 methods 77 function md = model(varargin) % {{{ 177 function md = model(varargin) % {{{ 78 78 79 79 switch nargin … … 83 83 error('model constructor error message: 0 of 1 argument only in input.'); 84 84 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; 85 91 end 86 92 %}}} … … 244 250 if isfield(structmd,'pressureload'), md.diagnostic.icefront=structmd.pressureload; end 245 251 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 248 255 %Field changes 249 256 if (isfield(structmd,'type') & ischar(structmd.type)), … … 352 359 md.mesh.lowerelements(1:md.mesh.numberofelements2d)=NaN; 353 360 end 361 354 362 if ~isfield(structmd,'diagnostic_ref'); 355 363 md.diagnostic.referential=NaN*ones(md.mesh.numberofvertices,6); 356 364 end 365 357 366 end% }}} 358 function md = setdefaultparameters(md) % {{{ 1367 function md = setdefaultparameters(md) % {{{ 359 368 360 369 %initialize subclasses -
issm/branches/trunk-jpl-damage/src/m/classes/model/planet.m
r9548 r12878 6 6 classdef planet < model 7 7 properties (SetAccess=public) %Planet fields 8 % {{{ 18 % {{{ 9 9 %Planet specific fields 10 10 r=NaN; … … 14 14 end 15 15 methods 16 function md=planetmesh(md,varargin) % {{{ 116 function md=planetmesh(md,varargin) % {{{ 17 17 %PLANETMESH: build 2d shell mesh 18 18 % -
issm/branches/trunk-jpl-damage/src/m/classes/organizer.m
r9423 r12878 16 16 classdef organizer 17 17 properties (SetAccess=private) 18 % {{{ 118 % {{{ 19 19 currentstep =0; 20 20 end … … 28 28 end 29 29 methods 30 function org=organizer(varargin) % {{{ 130 function org=organizer(varargin) % {{{ 31 31 32 32 %process options … … 57 57 end 58 58 %}}} 59 function disp(org) % {{{ 159 function disp(org) % {{{ 60 60 disp(sprintf(' Repository: ''%s''',org.repository)); 61 61 disp(sprintf(' Prefix: ''%s''',org.prefix)); … … 69 69 end 70 70 %}}} 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),% {{{ 72 90 73 91 %Get model path … … 76 94 77 95 %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'), 79 97 md=loadmodel(path); 80 98 return; … … 95 113 end 96 114 end%}}} 97 function bool=perform(org,string) % {{{ 1115 function bool=perform(org,string) % {{{ 98 116 99 117 bool=false; … … 129 147 130 148 end%}}} 131 function savemodel(org,md) % {{{ 1149 function savemodel(org,md) % {{{ 132 150 133 151 %check … … 139 157 140 158 %check that md is a model 141 if ~isa(md,'model'), error('savemodel error message:third argument is not a model'); end159 if ~isa(md,'model'), warning('third argument is not a model'); end 142 160 if (org.currentstep>length(org.steps)), error(['organizer error message: element with id ' num2str(org.currentstep) ' not found']); end 143 161 -
issm/branches/trunk-jpl-damage/src/m/classes/pairoptions.m
r12004 r12878 223 223 end 224 224 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 % }}} 225 244 end 226 245 end -
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]]) 1 from WriteData import * 2 3 class 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]) 16 106 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 6 6 classdef plotoptions 7 7 properties (SetAccess=public) 8 % {{{ 18 % {{{ 9 9 numberofplots = 0; 10 10 figurenumber = 1; … … 13 13 end 14 14 methods 15 function opt=plotoptions(varargin) % {{{ 115 function opt=plotoptions(varargin) % {{{ 16 16 opt=buildlist(opt,varargin{:}); 17 17 end 18 18 %}}} 19 function disp(opt) % {{{ 119 function disp(opt) % {{{ 20 20 disp(sprintf('\n%s = \n',inputname(1))); 21 21 disp(sprintf(' numberofplots: %i',opt.numberofplots)); … … 41 41 end 42 42 %}}} 43 function opt=buildlist(opt,varargin) % {{{ 143 function opt=buildlist(opt,varargin) % {{{ 44 44 45 45 %check length of input -
issm/branches/trunk-jpl-damage/src/m/classes/private.m
r12004 r12878 6 6 classdef private 7 7 properties (SetAccess=public) 8 runtimename = ''; 9 bamg = struct(); 10 solution = ''; 8 isconsistent = true; 9 runtimename = ''; 10 bamg = struct(); 11 solution = ''; 11 12 end 12 13 methods … … 22 23 23 24 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{25 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 26 26 27 end % }}} … … 28 29 disp(sprintf(' private parameters: do not change')); 29 30 31 fielddisplay(obj,'isconsistent','is model self consistent'); 30 32 fielddisplay(obj,'runtimename','name of the run launched'); 31 33 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 36 36 obj.hydrostatic_adjustment='Absolute'; 37 37 end % }}} 38 function checkconsistency(obj,md,solution,analyses) % {{{38 function md = checkconsistency(obj,md,solution,analyses) % {{{ 39 39 40 40 %Early return, 41 41 if ~ismember(PrognosticAnalysisEnum,analyses) | (solution==TransientSolutionEnum & md.transient.isprognostic==0), return; end 42 42 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); 47 47 48 48 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/qmu.m
r12004 r12878 35 35 36 36 end % }}} 37 function checkconsistency(obj,md,solution,analyses) % {{{37 function md = checkconsistency(obj,md,solution,analyses) % {{{ 38 38 39 39 %Early return … … 41 41 42 42 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']); 44 44 end 45 45 if ~isempty(md.qmu.partition), 46 46 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 ']); 48 48 end 49 49 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)']); 51 51 end 52 52 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']); 54 54 end 55 55 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']); 57 57 end 58 58 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']); 60 60 end 61 61 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']); 63 63 end 64 64 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']); 66 66 end 67 67 end … … 69 69 if ~strcmpi(md.cluster.name,'none'), 70 70 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!']); 72 72 end 73 73 end -
issm/branches/trunk-jpl-damage/src/m/classes/rifts.m
r12004 r12878 21 21 22 22 end % }}} 23 function checkconsistency(obj,md,solution,analyses) % {{{23 function md = checkconsistency(obj,md,solution,analyses) % {{{ 24 24 if isempty(obj.riftstruct) | isnans(obj.riftstruct), 25 25 numrifts=0; … … 29 29 if numrifts, 30 30 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!']); 32 32 end 33 33 if ~isstruct(obj.riftstruct), 34 checkmessage(['rifts.riftstruct should be a structure!']);34 md = checkmessage(md,['rifts.riftstruct should be a structure!']); 35 35 end 36 36 if ~isempty(find(md.mesh.segmentmarkers>=2)), 37 37 %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)!']); 39 39 end 40 checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);40 md = checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]); 41 41 else 42 42 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!']); 44 44 end 45 45 end -
issm/branches/trunk-jpl-damage/src/m/classes/settings.m
r12004 r12878 41 41 obj.waitonlock=Inf; 42 42 end % }}} 43 function checkconsistency(obj,md,solution,analyses) % {{{43 function md = checkconsistency(obj,md,solution,analyses) % {{{ 44 44 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); 50 50 51 51 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/solver.m
r12168 r12878 18 18 end 19 19 end % }}} 20 function obj = addoptions(obj,analysis,varargin) % {{{ 120 function obj = addoptions(obj,analysis,varargin) % {{{ 21 21 % Usage example: 22 22 % md.solver=addoptions(md.solver,DiagnosticHorizAnalysisEnum,stokesoptions()); … … 54 54 end 55 55 end % }}} 56 function checkconsistency(obj,md,solution,analyses) % {{{56 function md = checkconsistency(obj,md,solution,analyses) % {{{ 57 57 analyses=properties(obj); 58 58 for i=1:numel(analyses), 59 59 if isempty(fieldnames(obj.(analyses{i}))) 60 checkmessage(['md.solver.' analyses{i} ' is empty']);60 md = checkmessage(md,['md.solver.' analyses{i} ' is empty']); 61 61 end 62 62 end -
issm/branches/trunk-jpl-damage/src/m/classes/steadystate.m
r12004 r12878 26 26 obj.reltol=0.01; 27 27 end % }}} 28 function checkconsistency(obj,md,solution,analyses) % {{{28 function md = checkconsistency(obj,md,solution,analyses) % {{{ 29 29 30 30 %Early return … … 32 32 33 33 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.']); 35 35 end 36 36 37 37 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!']); 39 39 end 40 40 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/surfaceforcings.m
r12004 r12878 8 8 precipitation = NaN; 9 9 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; 10 26 end 11 27 methods … … 19 35 end % }}} 20 36 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; 21 42 22 43 end % }}} 23 function checkconsistency(obj,md,solution,analyses) % {{{44 function md = checkconsistency(obj,md,solution,analyses) % {{{ 24 45 25 46 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 27 71 end 28 72 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); 30 74 end 31 75 end % }}} … … 33 77 disp(sprintf(' surface forcings parameters:')); 34 78 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'); 35 83 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'); 37 97 38 98 end % }}} … … 40 100 WriteData(fid,'object',obj,'fieldname','precipitation','format','DoubleMat','mattype',1); 41 101 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 42 127 end % }}} 43 128 end -
issm/branches/trunk-jpl-damage/src/m/classes/thermal.m
r12004 r12878 40 40 obj.isenthalpy=0; 41 41 end % }}} 42 function checkconsistency(obj,md,solution,analyses) % {{{42 function md = checkconsistency(obj,md,solution,analyses) % {{{ 43 43 44 44 %Early return 45 45 if (~ismember(ThermalAnalysisEnum,analyses) & ~ismember(EnthalpyAnalysisEnum,analyses)) | (solution==TransientSolutionEnum & md.transient.isthermal==0), return; end 46 46 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]); 52 52 end 53 53 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/timestepping.m
r12004 r12878 33 33 obj.cfl_coefficient=.5; 34 34 end % }}} 35 function checkconsistency(obj,md,solution,analyses) % {{{35 function md = checkconsistency(obj,md,solution,analyses) % {{{ 36 36 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); 42 42 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'); 44 44 end 45 45 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/transient.m
r12004 r12878 30 30 31 31 end % }}} 32 function checkconsistency(obj,md,solution,analyses) % {{{32 function md = checkconsistency(obj,md,solution,analyses) % {{{ 33 33 34 34 %Early return 35 35 if solution~=TransientSolutionEnum, return; end 36 36 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]); 41 42 42 43 end % }}} -
issm/branches/trunk-jpl-damage/src/m/classes/verbose.m
r12004 r12878 21 21 classdef verbose 22 22 properties (SetAccess=public) 23 % {{{ 123 % {{{ 24 24 %BEGINFIELDS 25 25 mprocessor = false; … … 35 35 %}}} 36 36 methods 37 function verbose=verbose(varargin) % {{{ 137 function verbose=verbose(varargin) % {{{ 38 38 39 39 switch(nargin), … … 70 70 end 71 71 %}}} 72 function binary=VerboseToBinary(verbose) % {{{ 172 function binary=VerboseToBinary(verbose) % {{{ 73 73 74 74 %BEGINVERB2BIN … … 85 85 end 86 86 %}}} 87 function verbose=BinaryToVerbose(verbose,binary) % {{{ 187 function verbose=BinaryToVerbose(verbose,binary) % {{{ 88 88 89 89 %BEGINBIN2VERB … … 99 99 end 100 100 %}}} 101 function checkconsistency(obj,md,solution,analyses) % {{{101 function md = checkconsistency(obj,md,solution,analyses) % {{{ 102 102 103 103 end % }}} 104 function disp(verbose) % {{{ 1104 function disp(verbose) % {{{ 105 105 106 106 %BEGINDISP -
issm/branches/trunk-jpl-damage/src/m/enum/EnumDefinitions.py
r12877 r12878 897 897 return StringToEnum('MaterialsRheologyN') 898 898 899 def MaterialsRheologyZEnum(): 900 """ 901 MATERIALSRHEOLOGYZENUM - Enum of MaterialsRheologyZ 902 903 Usage: 904 macro=MaterialsRheologyZEnum() 905 """ 906 907 return StringToEnum('MaterialsRheologyZ') 908 909 def MaterialsRheologyZbarEnum(): 910 """ 911 MATERIALSRHEOLOGYZBARENUM - Enum of MaterialsRheologyZbar 912 913 Usage: 914 macro=MaterialsRheologyZbarEnum() 915 """ 916 917 return StringToEnum('MaterialsRheologyZbar') 918 899 919 def MaterialsRhoIceEnum(): 900 920 """ … … 4575 4595 """ 4576 4596 4577 return 45 64578 4597 return 458 4598 -
issm/branches/trunk-jpl-damage/src/m/enum/MaximumNumberOfEnums.m
r12872 r12878 9 9 % macro=MaximumNumberOfEnums() 10 10 11 macro=4 39;11 macro=458; -
issm/branches/trunk-jpl-damage/src/m/model/MatlabProcessPatch.m
r12168 r12878 5 5 % Result=ProcessPatch(Result); 6 6 7 %return if there is no fiel Patch7 %return if there is no field Patch 8 8 if (~isfield(structure,'Patch')), 9 9 return; -
issm/branches/trunk-jpl-damage/src/m/model/SectionValues.m
r12004 r12878 12 12 if ischar(infile), 13 13 %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; 18 18 else 19 19 %read infile: -
issm/branches/trunk-jpl-damage/src/m/model/WriteData.m
r10969 r12878 35 35 %Step 2: write the data itself. 36 36 if strcmpi(format,'Boolean'),% {{{ 37 if(numel(data)~=1), error(['field ' field' cannot be marshalled as it has more than one element!']); end37 if(numel(data)~=1), error(['field ' EnumToString(enum) ' cannot be marshalled as it has more than one element!']); end 38 38 39 39 %first write length of record … … 59 59 % }}} 60 60 elseif strcmpi(format,'Double'), % {{{ 61 if(numel(data)~=1), error(['field ' field' cannot be marshalled as it has more than one element!']); end61 if(numel(data)~=1), error(['field ' EnumToString(enum) ' cannot be marshalled as it has more than one element!']); end 62 62 63 63 %first write length of record … … 233 233 enum=eval([string 'Enum();']); 234 234 end % }}} 235 function code=FormatToCode(format) % {{{ 1235 function code=FormatToCode(format) % {{{ 236 236 %This routine takes the format string, and hardcodes it into an integer, which 237 237 %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): 1 def 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 """ 2 11 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): 20 18 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 )1 function average=averaging(md,data,iterations,varargin) 2 2 %AVERAGING - smooths the input over the mesh 3 3 % … … 8 8 % by taking the average of the element around a node weighted by the 9 9 % elements volume 10 % For 3d mesh, a last argument can be added to specify the layer to be averaged on. 10 11 % 11 12 % Usage: 12 13 % smoothdata=averaging(md,data,iterations) 14 % smoothdata=averaging(md,data,iterations,layer) 13 15 % 14 16 % Examples: 15 17 % velsmoothed=averaging(md,md.initialization.vel,4); 16 18 % pressure=averaging(md,md.initialization.pressure,0); 19 % temperature=averaging(md,md.initialization.temperature,1,1); 17 20 18 if length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices 21 if ((nargin~=4) & (nargin~=3)), 22 error('averaging error message'); 23 end 24 if (length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices), 19 25 error('averaging error message: data not supported yet'); 26 end 27 if 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}; 32 else 33 layer=0; 20 34 end 21 35 22 36 %initialization 23 weights=zeros(md.mesh.numberofvertices,1); 24 data=data(:); 37 if layer==0, 38 weights=zeros(md.mesh.numberofvertices,1); 39 data=data(:); 40 else 41 weights=zeros(md.mesh.numberofvertices2d,1); 42 data=data((layer-1)*md.mesh.numberofvertices2d+1:layer*md.mesh.numberofvertices2d,:); 43 end 25 44 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) 46 if layer==0, 47 index=md.mesh.elements; 48 numberofnodes=md.mesh.numberofvertices; 49 numberofelements=md.mesh.numberofelements; 50 else 51 index=md.mesh.elements2d; 52 numberofnodes=md.mesh.numberofvertices2d; 53 numberofelements=md.mesh.numberofelements2d; 54 end 30 55 31 56 %build some variables 32 57 line=index(:); 33 if md.mesh.dimension==3 58 if md.mesh.dimension==3 & layer==0, 34 59 rep=6; 35 60 areas=GetAreas(index,md.mesh.x,md.mesh.y,md.mesh.z); 61 elseif md.mesh.dimension==2, 62 rep=3; 63 areas=GetAreas(index,md.mesh.x,md.mesh.y); 36 64 else 37 65 rep=3; 38 areas=GetAreas(index,md.mesh.x ,md.mesh.y);66 areas=GetAreas(index,md.mesh.x2d,md.mesh.y2d); 39 67 end 40 68 summation=1/rep*ones(rep,1); -
issm/branches/trunk-jpl-damage/src/m/model/collapse.m
r12258 r12878 42 42 if ~isnan(md.initialization.vz),md.initialization.vz=DepthAverage(md,md.initialization.vz);end; 43 43 if ~isnan(md.initialization.vel),md.initialization.vel=DepthAverage(md,md.initialization.vel);end; 44 if ~isnan(md.initialization.temperature),md.initialization.temperature=DepthAverage(md,md.initialization.temperature);end; 44 45 45 46 %bedinfo and surface info … … 92 93 md.geometry.thickness=project2d(md,md.geometry.thickness,1); 93 94 md.geometry.bed=project2d(md,md.geometry.bed,1); 95 md.geometry.bathymetry=project2d(md,md.geometry.bathymetry,1); 94 96 md.mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1); 95 97 md.mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1); -
issm/branches/trunk-jpl-damage/src/m/model/contourenvelope.m
r9734 r12878 35 35 %Now, build the connectivity tables for this mesh. 36 36 %Computing connectivity 37 if size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices,37 if (size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices & size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices2d), 38 38 md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices); 39 39 end 40 if size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements,40 if (size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements & size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements2d), 41 41 md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity); 42 42 end … … 44 44 %get nodes inside profile 45 45 mesh.elementconnectivity=md.mesh.elementconnectivity; 46 if 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; 52 else 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; 58 end 59 46 60 if nargin==2, 61 47 62 if isfile, 48 63 %get flag list of elements and nodes inside the contour 49 nodein=ContourToMesh(m d.mesh.elements,md.mesh.x,md.mesh.y,file,'node',1);50 elemin=(sum(nodein(m d.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)); 51 66 %modify element connectivity 52 67 elemout=find(~elemin); … … 55 70 else 56 71 %get flag list of elements and nodes inside the contour 57 nodein=zeros(m d.mesh.numberofvertices,1);58 elemin=zeros(m d.mesh.numberofelements,1);72 nodein=zeros(mesh.numberofvertices,1); 73 elemin=zeros(mesh.numberofelements,1); 59 74 60 75 pos=find(flags); 61 76 elemin(pos)=1; 62 nodein(m d.mesh.elements(pos,:))=1;77 nodein(mesh.elements(pos,:))=1; 63 78 64 79 %modify element connectivity … … 87 102 els2=mesh.elementconnectivity(el1,find(mesh.elementconnectivity(el1,:))); 88 103 if length(els2)>1, 89 flag=intersect(m d.mesh.elements(els2(1),:),md.mesh.elements(els2(2),:));90 nods1=m d.mesh.elements(el1,:);104 flag=intersect(mesh.elements(els2(1),:),mesh.elements(els2(2),:)); 105 nods1=mesh.elements(el1,:); 91 106 nods1(find(nods1==flag))=[]; 92 107 segments(count,:)=[nods1 el1]; 93 108 94 ord1=find(nods1(1)==m d.mesh.elements(el1,:));95 ord2=find(nods1(2)==m d.mesh.elements(el1,:));109 ord1=find(nods1(1)==mesh.elements(el1,:)); 110 ord2=find(nods1(2)==mesh.elements(el1,:)); 96 111 97 112 %swap segment nodes if necessary … … 104 119 count=count+1; 105 120 else 106 nods1=m d.mesh.elements(el1,:);107 flag=setdiff(nods1,m d.mesh.elements(els2,:));121 nods1=mesh.elements(el1,:); 122 flag=setdiff(nods1,mesh.elements(els2,:)); 108 123 for j=1:3, 109 124 nods=nods1; nods(j)=[]; 110 125 if any(ismember(flag,nods)), 111 126 segments(count,:)=[nods el1]; 112 ord1=find(nods(1)==m d.mesh.elements(el1,:));113 ord2=find(nods(2)==m d.mesh.elements(el1,:));127 ord1=find(nods(1)==mesh.elements(el1,:)); 128 ord2=find(nods(2)==mesh.elements(el1,:)); 114 129 if ( (ord1==1 & ord2==2) | (ord1==2 & ord2==3) | (ord1==3 & ord2==1) ), 115 130 temp=segments(count,1); -
issm/branches/trunk-jpl-damage/src/m/model/extrude.m
r12004 r12878 143 143 md.surfaceforcings.precipitation=project3d(md,'vector',md.surfaceforcings.precipitation,'type','node'); 144 144 md.balancethickness.thickening_rate=project3d(md,'vector',md.balancethickness.thickening_rate,'type','node'); 145 md.surfaceforcings.monthlytemperatures=project3d(md,'vector',md.surfaceforcings.monthlytemperatures,'type','node'); 145 146 146 147 %results … … 223 224 if ~isnan(md.inversion.max_parameters),md.inversion.max_parameters=project3d(md,'vector',md.inversion.max_parameters,'type','node');end; 224 225 if ~isnan(md.qmu.partition),md.qmu.partition=project3d(md,'vector',md.qmu.partition','type','node');end 226 if(md.surfaceforcings.isdelta18o),md.surfaceforcings.temperatures_lgm=project3d(md,'vector',md.surfaceforcings.temperatures_lgm,'type','node');end 227 if(md.surfaceforcings.isdelta18o),md.surfaceforcings.temperatures_presentday=project3d(md,'vector',md.surfaceforcings.temperatures_presentday,'type','node');end 228 if(md.surfaceforcings.isdelta18o),md.surfaceforcings.precipitations_presentday=project3d(md,'vector',md.surfaceforcings.precipitations_presentday,'type','node');end 225 229 226 230 %Put lithostatic pressure if there is an existing pressure -
issm/branches/trunk-jpl-damage/src/m/model/ismodelselfconsistent.m
r11224 r12878 6 6 7 7 %initialize consistency as true 8 m odelconsistency(true);8 md.private.isconsistent=true; 9 9 10 10 %Get solution and associated analyses … … 12 12 [analyses,numanalyses]=AnalysisConfiguration(solution); 13 13 14 %Go through a l model field check that it is a classand call checkconsistency14 %Go through a model field, check that it is a class, and call checkconsistency 15 15 fields=properties('model'); 16 16 for i=1:length(fields), … … 24 24 %Check that current field is an object 25 25 if ~isobject(md.(field)) 26 checkmessage(['field ''' char(field) ''' is not an object']);26 md=checkmessage(md,['field ''' char(field) ''' is not an object']); 27 27 end 28 28 29 29 %Check consistency of the object 30 30 if verLessThan('matlab', '7.6') 31 checkconsistency(md.(field),md,solution,analyses);31 md=checkconsistency(md.(field),md,solution,analyses); 32 32 else 33 md .(field).checkconsistency(md,solution,analyses);33 md=md.(field).checkconsistency(md,solution,analyses); 34 34 end 35 35 end 36 36 37 37 %error message if mode is not consistent 38 if m odelconsistency==false,39 error(' 38 if md.private.isconsistent==false, 39 error('Model not consistent, see messages above'); 40 40 end -
issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromcluster.m
r11577 r12878 13 13 14 14 %Download outputs from the cluster 15 if verLessThan('matlab', '7.6'); 16 Download(cluster,md); 15 filelist={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 16 if 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 17 24 else 18 cluster.Download(md);25 filelist{end+1}=[md.miscellaneous.name '.outbin']; 19 26 end 27 Download(cluster,md.private.runtimename,filelist); 20 28 21 29 %If we are here, no errors in the solution sequence, call loadresultsfromdisk. -
issm/branches/trunk-jpl-damage/src/m/model/loadresultsfromdisk.m
r11333 r12878 59 59 md=postqmu(md); 60 60 cd .. 61 62 61 end -
issm/branches/trunk-jpl-damage/src/m/model/marshall.m
r12280 r12878 16 16 end 17 17 18 %First, rightMaximumNumberOfEnum to make sure that the Enums are synchronized18 %First, write MaximumNumberOfEnum to make sure that the Enums are synchronized 19 19 WriteData(fid,'enum',MaximumNumberOfEnums(),'data',true,'format','Boolean'); 20 20 … … 31 31 %Check that current field is an object 32 32 if ~isobject(md.(field)) 33 checkmessage(['field ''' char(field) ''' is not an object']);33 error(['field ''' char(field) ''' is not an object']); 34 34 end 35 35 -
issm/branches/trunk-jpl-damage/src/m/model/mesh/bamg.m
r11684 r12878 58 58 bamg_mesh=bamgmesh; 59 59 60 % Bamg Geometry parameters {{{ 160 % Bamg Geometry parameters {{{ 61 61 if exist(options,'domain'), 62 62 … … 259 259 end 260 260 %}}} 261 % Bamg Mesh parameters {{{ 1261 % Bamg Mesh parameters {{{ 262 262 if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & md.mesh.dimension==2), 263 263 … … 274 274 end 275 275 %}}} 276 % Bamg Options {{{ 1276 % Bamg Options {{{ 277 277 bamg_options.Crack=getfieldvalue(options,'Crack',0); 278 278 bamg_options.anisomax=getfieldvalue(options,'anisomax',10^30); -
issm/branches/trunk-jpl-damage/src/m/model/modelextract.m
r11142 r12878 166 166 if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs... 167 167 %renumber first two columns 168 pos=find( ~isnan(md2.mesh.edges(:,4)));168 pos=find(md2.mesh.edges(:,4)~=-1); 169 169 md2.mesh.edges(: ,1)=Pnode(md2.mesh.edges(:,1)); 170 170 md2.mesh.edges(: ,2)=Pnode(md2.mesh.edges(:,2)); … … 173 173 %remove edges when the 2 vertices are not in the domain. 174 174 md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:); 175 %Replace all zeros by NaNin the last two columns;175 %Replace all zeros by -1 in the last two columns; 176 176 pos=find(md2.mesh.edges(:,3)==0); 177 md2.mesh.edges(pos,3)= NaN;177 md2.mesh.edges(pos,3)=-1; 178 178 pos=find(md2.mesh.edges(:,4)==0); 179 md2.mesh.edges(pos,4)= NaN;180 %Invert NaN ofthe 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); 182 182 md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4); 183 md2.mesh.edges(pos,4)= NaN;183 md2.mesh.edges(pos,4)=-1; 184 184 values=md2.mesh.edges(pos,2); 185 185 md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1); 186 186 md2.mesh.edges(pos,1)=values; 187 187 %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); 189 189 md2.mesh.edges(pos,:)=[]; 190 190 end … … 210 210 md2.mesh.segments=contourenvelope(md2); 211 211 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); 212 222 end 213 223 -
issm/branches/trunk-jpl-damage/src/m/model/parameterization/parameterize.m
r11235 r12878 4 4 % from a parameter matlab file, start filling in all the @model fields that were not 5 5 % filled in by the mesh.m and mask.m @model methods. 6 % Warning: the param ter file must be able to be run in Matlab6 % Warning: the parameter file must be able to be run in Matlab 7 7 % 8 8 % Usage: … … 14 14 %some checks 15 15 if ~exist(parametername), 16 error(['parameterize error message: file ' parametername ' not found 16 error(['parameterize error message: file ' parametername ' not found!']); 17 17 end 18 18 -
issm/branches/trunk-jpl-damage/src/m/model/parameterization/parameterize.py
r12168 r12878 1 1 import 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'); 2 import datetime 3 from addnote import * 4 5 def 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 """ 14 19 15 20 #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) 19 23 20 24 #Try and run parameter file. 21 25 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 172 172 % }}} 173 173 function 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. 175 175 % 176 176 % Usage: -
issm/branches/trunk-jpl-damage/src/m/model/plot/applyoptions.m
r12254 r12878 31 31 end 32 32 33 %xlabel 33 %xlabel, ylabel and zlabel 34 34 if exist(options,'xlabel'); 35 35 xlabel(getfieldvalue(options,'xlabel'),'FontSize',fontsize,'FontWeight',fontweight); 36 36 end 37 38 %ylabel39 37 if exist(options,'ylabel'); 40 38 ylabel(getfieldvalue(options,'ylabel'),'FontSize',fontsize,'FontWeight',fontweight); 41 39 end 42 43 %zlabel44 40 if exist(options,'zlabel'); 45 41 zlabel(getfieldvalue(options,'zlabel'),'FontSize',fontsize,'FontWeight',fontweight); 46 42 end 47 43 48 %xti kcs44 %xticks, yticks and zticks 49 45 if exist(options,'xtick'), set(gca,'XTick',getfieldvalue(options,'xtick')); end 50 46 if exist(options,'ytick'), set(gca,'YTick',getfieldvalue(options,'ytick')); end … … 75 71 end 76 72 77 %xlim 73 %xlim, ylim and zlim 78 74 if exist(options,'xlim'); 79 75 xlim(getfieldvalue(options,'xlim')); … … 83 79 if exist(options,'ylim'); 84 80 ylim(getfieldvalue(options,'ylim')); 81 end 82 if exist(options,'zlim'); 83 zlim(getfieldvalue(options,'zlim')); 85 84 end 86 85 … … 92 91 end 93 92 94 95 %zlim96 if exist(options,'zlim');97 zlim(getfieldvalue(options,'zlim'));98 end99 100 93 %Basinzoom 101 94 if exist(options,'basin'); … … 107 100 showbasins(options); 108 101 end 109 110 102 111 103 %Caxis … … 127 119 128 120 %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(:)]; 121 c = getcolormap(options); 122 h = colormap(c); 141 123 142 124 c = hsv(64); … … 302 284 textpositioni=textposition{i}; 303 285 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); 305 287 set(h,'Clipping','on'); %prevent text from appearing outside of the box 306 288 end … … 359 341 if exist(options,'axispos'), 360 342 Axis=getfieldvalue(options,'axispos'); 343 hold on 361 344 set(gca,'pos',Axis); 362 345 end … … 384 367 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25; 385 368 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])); 386 373 elseif strcmpi(figposition,'portrait'), 387 374 %reformat with letter paper size (8.5" x 11") … … 426 413 A=expread([ jplsvn() '/projects/Exp/GreenlandBoxFront.exp']); 427 414 [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); 428 417 elseif strcmpi(md.mesh.hemisphere,'s') | strcmpi(md.mesh.hemisphere,'south'), 429 418 %A=expread([ jplsvn() '/projects/Exp/Antarctica.exp']); … … 444 433 line(A.x,A.y,ones(size(A.x)),'color','b'); 445 434 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( 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) 447 436 colorbar('off'); 448 437 %back to main gca … … 452 441 %flag edges of a partition 453 442 if 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 452 end 453 454 %Scatter 455 if 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); 463 459 end 464 460 -
issm/branches/trunk-jpl-damage/src/m/model/plot/plot_gridded.m
r12168 r12878 6 6 % 7 7 % See also: PLOTMODEL 8 9 whitepos=getfieldvalue(options,'whitepos',2); %1: up, 2: down, else: none10 8 11 9 %process mesh and data … … 29 27 end 30 28 29 %Get and change colormap 30 map = getcolormap(options); 31 lenmap = size(map,1); 32 map = [1 1 1; map]; 33 options=changefieldvalue(options,'colormap',map); 34 31 35 %Process data_grid: add white in NaN and correct caxis accordingly 32 36 if exist(options,'caxis'), … … 40 44 data_max=max(data_grid(:)); 41 45 end 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 46 options = changefieldvalue(options,'cbYLim',[data_min data_max]); 47 white = data_min - (data_max-data_min)/(lenmap); 48 options = changefieldvalue(options,'caxis',[white data_max]); 49 data_grid(isnan(data_grid))=white; 52 50 53 51 %Select plot area 54 subplot (plotlines,plotcols,i);52 subplotmodel(plotlines,plotcols,i,options); 55 53 56 54 %shading interp; 57 55 h=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 end64 options=changefieldvalue(options,'colormap',map);65 56 66 57 %last step: mesh gridded? -
issm/branches/trunk-jpl-damage/src/m/model/plot/plot_manager.m
r11249 r12878 165 165 if exist(options,'sectionvalue') 166 166 plot_section(md,data,options,nlines,ncols,i); 167 return; 168 end 169 170 %Figure out if this is a Profile plot 171 if exist(options,'profile') 172 plot_profile(md,data,options,nlines,ncols,i); 167 173 return; 168 174 end -
issm/branches/trunk-jpl-damage/src/m/model/plot/plot_overlay.m
r12168 r12878 41 41 md=radarpower(md,options); 42 42 end 43 contrast = getfieldvalue(options,'contrast',1); 44 radar = (md.radaroverlay.pwr).^(contrast); 45 radar = radar./max(radar(:)); 46 %radar(find(radar==0))=1; %Change background from black to white 43 47 44 48 %InterpFromMeshToGrid … … 50 54 ncols =length(md.radaroverlay.x); 51 55 disp('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); 56 if radaronly, 57 x_m=xmin:xspacing:xmin+ncols*xspacing; 58 y_m=ymax-nlines*yspacing:yspacing:ymax; 59 data_grid=NaN*ones(nlines,ncols); 60 else 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); 63 end 54 64 55 %Process data_grid 65 %Process data_grid (For processing, it is better not to have nan) 56 66 pos=find(isinf(data_grid)); 57 67 if ~isempty(pos), … … 70 80 end 71 81 data_nan=find(isnan(data_grid)); 72 73 %Generate HSV image74 contrast=getfieldvalue(options,'contrast',1);75 transparency=getfieldvalue(options,'alpha',1);76 82 data_grid(data_nan)=data_min; 77 83 84 %Special colormaps that require hsv treatment 78 85 colorm=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); 86 if 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); 101 116 else 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; 103 131 end 104 132 105 %Saturation is 0 in NaNs106 s_data(data_nan)=0;107 %intensity (V)108 radar=(md.radaroverlay.pwr).^(contrast);109 v_data=radar/max(radar(:)); %use radar power as intensity110 111 %Change background from black to white112 %pos=find(v_data==0);v_data(pos)=1;113 114 %Transform HSV to RGB115 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 121 133 %Select plot area 122 subplot (plotlines,plotcols,i);134 subplotmodel(plotlines,plotcols,i,options); 123 135 124 136 %Plot: … … 134 146 135 147 %Apply options, without colorbar and without grid 136 options=changefieldvalue(options,'colormap',colorm); %We used an HSV colorbar148 options=changefieldvalue(options,'colormap',colorm); % We used an HSV colorbar 137 149 if ~isnan(data_min), 138 options=changefieldvalue(options,'caxis',[data_min data_max]); % force caxis so that the colorbar is ready150 options=changefieldvalue(options,'caxis',[data_min data_max]); % force caxis so that the colorbar is ready 139 151 end 140 options=addfielddefault(options,'axis','equal off'); %default axis152 options=addfielddefault(options,'axis','equal off'); % default axis 141 153 applyoptions(md,data,options); 154 drawnow -
issm/branches/trunk-jpl-damage/src/m/model/plot/plotdoc.m
r12194 r12878 94 94 disp(' ''showsection'': show section used by ''sectionvalue'' (string ''on'' or a number of labels)'); 95 95 disp(' ''sectionvalue'': give the value of data on a profile given by an Argus file (string ''Argusfile_name.exp'')'); 96 disp(' ''profile'': give the value of data along a vertical profile ([xlocation ylocation])'); 96 97 disp(' ''smooth'': smooth element data (string ''yes'' or integer)'); 97 98 disp(' ''title'': same as standard matlab option'); -
issm/branches/trunk-jpl-damage/src/m/model/plot/plotmodel.m
r12004 r12878 48 48 for i=1:numberofplots, 49 49 plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i); 50 %cbfreeze;51 50 end 52 51 catch me, -
issm/branches/trunk-jpl-damage/src/m/model/radarpower.m
r12197 r12878 37 37 error(['radarpower error message: file ' jplsvn() '/projects/ModelData/MOG/mog150_greenland_map.jpg not found.']); 38 38 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'); 41 44 42 45 %geom: xposting nbcols nbrows yposting xmin ymax 43 46 xmin=max(geom(5),x0); 44 47 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); 46 49 ymax=min(geom(6),y1); 47 50 … … 106 109 toplefty=floor((overlay_ylim(2)-y1)/overlay_yposting); % y max 107 110 108 109 111 %Read and crop file 110 112 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 106 106 thickness=PatchToVec(md1.results.TransientSolution(t).Thickness); 107 107 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,v x,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)]; 109 109 spct=[spct InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,thickness,md2.mesh.x,md2.mesh.y)]; 110 110 steps=[steps t*md1.timestepping.time_step]; -
issm/branches/trunk-jpl-damage/src/m/model/setmask.m
r11234 r12878 25 25 elements=md.mesh.elements; 26 26 27 %Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 127 %Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 28 28 elementonfloatingice=FlagElements(md,floatingicename); 29 29 elementongroundedice=FlagElements(md,groundedicename); -
issm/branches/trunk-jpl-damage/src/m/model/setmask.py
r12168 r12878 22 22 elements = md.mesh.elements 23 23 24 #Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 124 #Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 25 25 elementonfloatingice = fe.FlagElements(md, floatingicename) 26 26 elementongroundedice = fe.FlagElements(md, groundedicename) -
issm/branches/trunk-jpl-damage/src/m/model/solve.m
r10969 r12878 24 24 % md=solve(md,DiagnosticSolutionEnum); 25 25 26 %recover options26 %recover and process solve options 27 27 options=pairoptions(varargin{:},'solution_type',solutionenum); 28 29 %add default options30 28 options=process_solve_options(options); 31 29 32 30 %recover some fields 33 31 md.private.solution=options.solution_type; 32 cluster=md.cluster; 34 33 35 34 %check model consistency 36 35 disp('checking model consistency'); 37 36 if (solutionenum == FlaimSolutionEnum) 38 m odelconsistency(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'); 43 42 end 44 43 else … … 46 45 end 47 46 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 48 c=clock; 49 md.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. 50 53 if md.qmu.isdakota, 51 54 md=preqmu(md,options); 52 55 end 53 56 54 %Save model as is (in case of a crash)55 assignin('base',inputname(1),md);56 57 57 %flaim analysis 58 if ( md.private.solution== FlaimSolutionEnum)58 if (options.solution_type == FlaimSolutionEnum) 59 59 md=flaim_sol(md,options); 60 60 md.private.solution=EnumToString(options.solution_type); … … 62 62 end 63 63 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? 65 if options.loadonly, 66 md=loadresultsfromcluster(md); 74 67 return; 75 68 end 76 69 77 %Launch correct solution sequence 78 md=issm(md,md.private.solution); 70 %Wite all input files 71 marshall(md); % bin file 72 PetscFile(md.solver,[md.miscellaneous.name '.petsc']); % petsc file 73 BuildQueueScript(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: 76 if ~ispetsc, 77 disp('PETSC support not included, running on 1 cpu only!'); 78 cluster.np=1; 79 end 80 81 %Stop here if batch mode 82 if 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; 86 end 87 88 %Launch job 89 modelname = md.miscellaneous.name; 90 filelist = {[modelname '.bin '] [modelname '.petsc '] [modelname '.queue ']}; 91 if md.qmu.isdakota, 92 filelist{end+1} = [modelname '.qmu.in']; 93 end 94 LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist); 95 96 %did we even try to run? if so, wait on lock 97 if strcmpi(options.upload,'on'), 98 disp('solve done uploading test decks'); 99 return; 100 end 101 102 %wait on lock 103 if 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 112 end 79 113 80 114 %post processes qmu results if necessary 81 115 if md.qmu.isdakota, 82 md=postqmu(md);83 cd ..84 116 if ~strncmpi(options.keep,'y',1) 85 117 system(['rm -rf qmu' num2str(feature('GetPid'))]); 86 118 end 87 119 end 88 89 %convert analysis type to string finally90 md.private.solution=EnumToString(options.solution_type); -
issm/branches/trunk-jpl-damage/src/m/model/solvers/stokesoptions.m
r12004 r12878 6 6 7 7 %retrieve options provided in varargin 8 arguments=pairoptions(varargin{:});8 options=pairoptions(varargin{:}); 9 9 stokes=struct(); 10 10 -
issm/branches/trunk-jpl-damage/src/m/qmu/preqmu.m
r9668 r12878 44 44 responses=expandresponses(md,responses); 45 45 46 %go through variables and responses, and check they don't have more than md.qmu.numberofpartitions values. Also determine numvariables and numresponses{{{ 146 %go through variables and responses, and check they don't have more than md.qmu.numberofpartitions values. Also determine numvariables and numresponses{{{ 47 47 numvariables=0; 48 48 variable_fieldnames=fieldnames(variables); … … 76 76 system(['rm -rf ' md.miscellaneous.name '.m']); 77 77 78 %build a list of variables and responses descriptors. the list is not expanded. {{{ 178 %build a list of variables and responses descriptors. the list is not expanded. {{{ 79 79 variabledescriptors={}; 80 80 variable_fieldnames=fieldnames(md.qmu.variables(options.ivar)); -
issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceShelfBC.py
r12258 r12878 1 from numpy import * 1 import os 2 import numpy 3 2 4 def 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 """ 17 21 18 22 #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) 21 28 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)) 36 40 37 41 #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] 43 46 else: 44 47 print ' boundary conditions for diagnostic model: spc set as zero' … … 46 49 #segment on Ice Front 47 50 #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,:] 54 55 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) 59 62 60 63 #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) 62 66 63 67 #plug onto model 64 md.diagnostic.icefront=pressureload ;68 md.diagnostic.icefront=pressureload 65 69 66 70 #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) 69 73 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) 72 76 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) 75 79 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) 78 82 print ' no balancethickness.thickening_rate specified: values set as zero' 79 83 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) 82 86 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) 88 94 else: 89 95 print ' no thermal boundary conditions created: no observed temperature found' 90 96 91 97 return md 98 -
issm/branches/trunk-jpl-damage/src/m/utils/Basins/isbasin.m
r7140 r12878 9 9 10 10 %First, load basin names: 11 load([ issmdir'/projects/ModelData/Names/Names.mat']);11 load([jplsvn '/projects/ModelData/Names/Names.mat']); 12 12 13 13 -
issm/branches/trunk-jpl-damage/src/m/utils/Exp/expcoarsen.m
r1264 r12878 26 26 %Get exp oldfile 27 27 [path root ext ver]=fileparts(oldfile); 28 A=expread(oldfile ,1);28 A=expread(oldfile); 29 29 numprofiles=size(A,2); 30 30 -
issm/branches/trunk-jpl-damage/src/m/utils/Exp/expcontract.m
r8298 r12878 8 8 9 9 10 contour=expread(oldfile ,1);10 contour=expread(oldfile); 11 11 num=numel(contour.x); 12 12 -
issm/branches/trunk-jpl-damage/src/m/utils/Exp/manipulation/cutarea.m
r8662 r12878 87 87 A(selection).x=x(1:p1); 88 88 A(selection).y=y(1:p1); 89 closed(selection)=0; 89 90 A(end+1).x=x(p2:end); 90 91 A(end).y=y(p2:end); 91 92 A(end).density=A(selection).density; 92 93 A(end).name=A(selection).name; 94 closed(end+1)=0; 93 95 numprofiles=numprofiles+1; 94 96 numpoints=numpoints-(p2-p1-1); … … 113 115 else 114 116 %cut in 2 profiles 117 closed(selection)=0; 115 118 A(selection).x=x(1:p2); 116 119 A(selection).y=y(1:p2); … … 119 122 A(end).density=A(selection).density; 120 123 A(end).name=A(selection).name; 124 closed(end+1)=0; 121 125 numprofiles=numprofiles+1; 122 126 numpoints=numpoints-(p1-p2-1); -
issm/branches/trunk-jpl-damage/src/m/utils/Geometry/find_point.m
r1 r12878 8 8 % f=find_point(tabx,taby,pointx,pointy) 9 9 10 %Compute distance between point and cloud of points 10 11 distance=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 14 f=find(distance==min(min(distance)),1); -
issm/branches/trunk-jpl-damage/src/m/utils/Kml/exp2kml.m
r7148 r12878 8 8 9 9 %First, read exp file 10 domain=expread(input ,1);10 domain=expread(input); 11 11 12 12 -
issm/branches/trunk-jpl-damage/src/m/utils/Miscellaneous/issmdoc.m
r12168 r12878 9 9 disp(sprintf('%s',' md=model; %creates a new empty model structure')); 10 10 disp(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)'));11 disp(sprintf('%s',' md=setmask(md,''all'',''''); %defines the glacier system as an ice shelf (no island)')); 12 12 disp(sprintf('%s',' md=parameterize(md,''Square.par''); %fills all the other fields of the model')); 13 disp(sprintf('%s',' md=set elementstype(md,''macayeal'',''all''); %defines all elements as MacAyeal''s'));13 disp(sprintf('%s',' md=setflowequation(md,''macayeal'',''all''); %defines all elements as MacAyeal''s')); 14 14 disp(sprintf('%s',' md=solve(md,DiagnosticSolutionEnum); %generate the velocity field')); 15 15 disp(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 12 12 error('loadmodel usage error: md=loadmodel(path)'); 13 13 end 14 14 15 %check existence 15 if ~exist(path) 16 if exist(path,'file') 17 %do nothing 18 elseif exist([path '.mat'],'file') 19 %add extension 20 path = [path '.mat']; 21 else 16 22 error(['loadmodel error message: file ' path ' does not exist']); 17 23 end -
issm/branches/trunk-jpl-damage/src/m/utils/Numerics/cfl_step.m
r12004 r12878 8 8 % 9 9 % 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) 11 11 12 12 %Check length of velocities -
issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpin.m
r12168 r12878 35 35 [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]'); 36 36 if status, 37 error('scpin error message: could not find ISSM_DIR_WIN envir noment variable');37 error('scpin error message: could not find ISSM_DIR_WIN environment variable'); 38 38 end 39 39 ISSM_DIR=ISSM_DIR(2:end-2); -
issm/branches/trunk-jpl-damage/src/m/utils/OS/issmscpout.m
r12168 r12878 26 26 [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]'); 27 27 if status, 28 error('scpout error message: could not find ISSM_DIR_WIN envir noment variable');28 error('scpout error message: could not find ISSM_DIR_WIN environment variable'); 29 29 end 30 30 ISSM_DIR=ISSM_DIR(2:end-2); -
issm/branches/trunk-jpl-damage/src/m/utils/OS/issmssh.m
r12168 r12878 18 18 [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]'); 19 19 if status, 20 error('issmssh error message: could not find ISSM_DIR_WIN envir noment variable');20 error('issmssh error message: could not find ISSM_DIR_WIN environment variable'); 21 21 end 22 22 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)1 function md = checkfield(md,fieldname,varargin) 2 2 %CHECKFIELD - check field consistency 3 3 % … … 19 19 % 20 20 % Usage: 21 % checkfield(md,fieldname,options);21 % md = checkfield(md,fieldname,options); 22 22 % 23 23 % 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]); 27 27 28 28 %get options … … 35 35 if exist(options,'empty') 36 36 if isempty(field), 37 checkmessage(getfieldvalue(options,'message',...37 md = checkmessage(md,getfieldvalue(options,'message',... 38 38 ['field ''' fieldname ''' is empty'])); 39 39 end … … 45 45 if isnan(fieldsize(1)), 46 46 if (size(field,2)~=fieldsize(2)), 47 checkmessage(getfieldvalue(options,'message',...47 md = checkmessage(md,getfieldvalue(options,'message',... 48 48 ['field ''' fieldname ''' should have ' num2str(fieldsize(2)) ' columns'])); 49 49 end 50 50 elseif isnan(fieldsize(2)), 51 51 if (size(field,1)~=fieldsize(1)), 52 checkmessage(getfieldvalue(options,'message',...52 md = checkmessage(md,getfieldvalue(options,'message',... 53 53 ['field ''' fieldname ''' should have ' num2str(fieldsize(1)) ' lines'])); 54 54 end 55 55 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',... 58 58 ['field ''' fieldname ''' size should be ' num2str(fieldsize(1)) ' x ' num2str(fieldsize(2))])); 59 59 end … … 66 66 if ~ismember(numel(field),fieldnumel), 67 67 if length(fieldnumel)==1 68 checkmessage(getfieldvalue(options,'message',...68 md = checkmessage(md,getfieldvalue(options,'message',... 69 69 ['field ''' fieldname ''' size should be ' sprintf('%g ',fieldnumel) ])); 70 70 elseif length(fieldnumel)==2 71 checkmessage(getfieldvalue(options,'message',...71 md = checkmessage(md,getfieldvalue(options,'message',... 72 72 ['field ''' fieldname ''' size should be ' num2str(fieldnumel(1)) ' or ' num2str(fieldnumel(2)) ])); 73 73 else 74 checkmessage(getfieldvalue(options,'message',...74 md = checkmessage(md,getfieldvalue(options,'message',... 75 75 ['field ''' fieldname ''' size should be ' sprintf('%g, ',fieldnumel(1:end-1)) ' or ' num2str(fieldnumel(end)) ])); 76 76 end … … 82 82 field2=reshape(field,prod(size(field)),1); 83 83 if any(isnan(field2)), 84 checkmessage(getfieldvalue(options,'message',...84 md = checkmessage(md,getfieldvalue(options,'message',... 85 85 ['NaN values found in field ''' fieldname ''''])); 86 86 end 87 87 end 88 88 89 %check NaN89 %check cell 90 90 if getfieldvalue(options,'cell',0); 91 91 if ~iscell(field), 92 checkmessage(getfieldvalue(options,'message',...92 md = checkmessage(md,getfieldvalue(options,'message',... 93 93 ['field ''' fieldname ''' should be a cell'])); 94 94 end … … 99 99 fieldvalues=getfieldvalue(options,'values'); 100 100 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 112 113 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} ''''])); 113 117 end 114 118 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 end118 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 valuesin [' 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) ']'])); 124 128 end 125 else126 checkmessage(getfieldvalue(options,'message',...127 ['field ''' fieldname ''' should be a number in [' num2str(fieldvalues) ']']));128 end129 129 end 130 130 end … … 135 135 field2=reshape(field,prod(size(field)),1); 136 136 if any(field2<lowerbound), 137 checkmessage(getfieldvalue(options,'message',...137 md = checkmessage(md,getfieldvalue(options,'message',... 138 138 ['field ''' fieldname ''' should have values above ' num2str(lowerbound)])); 139 139 end … … 143 143 field2=reshape(field,prod(size(field)),1); 144 144 if any(field2<=lowerbound), 145 checkmessage(getfieldvalue(options,'message',...145 md = checkmessage(md,getfieldvalue(options,'message',... 146 146 ['field ''' fieldname ''' should have values above ' num2str(lowerbound)])); 147 147 end … … 153 153 field2=reshape(field,prod(size(field)),1); 154 154 if any(field2>upperbound), 155 checkmessage(getfieldvalue(options,'message',...155 md = checkmessage(md,getfieldvalue(options,'message',... 156 156 ['field ''' fieldname ''' should have values below ' num2str(upperbound)])); 157 157 end … … 161 161 field2=reshape(field,prod(size(field)),1); 162 162 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)])); 165 165 end 166 166 end … … 169 169 if getfieldvalue(options,'file',0), 170 170 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']); 172 172 end 173 173 end … … 177 177 if size(field,1)==md.mesh.numberofvertices, 178 178 if ~size(field,2)==1, 179 checkmessage(getfieldvalue(options,'message',...179 md = checkmessage(md,getfieldvalue(options,'message',... 180 180 ['field ''' fieldname ''' should have only one column as there are md.mesh.numberofvertices lines'])); 181 181 end 182 182 elseif size(field,1)==md.mesh.numberofvertices+1 183 183 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'])); 186 186 end 187 187 if any(field(end,1:end-1)==field(end,2:end)), 188 checkmessage(getfieldvalue(options,'message',...188 md = checkmessage(md,getfieldvalue(options,'message',... 189 189 ['field ''' fieldname ''' columns must not contain duplicate timesteps'])); 190 190 end 191 191 else 192 checkmessage(getfieldvalue(options,'message',...192 md = checkmessage(md,getfieldvalue(options,'message',... 193 193 ['field ''' fieldname ''' should have md.mesh.numberofvertices or md.mesh.numberofvertices+1 lines'])); 194 194 end -
issm/branches/trunk-jpl-damage/src/modules/AverageFilter/AverageFilter.cpp
r11933 r12878 53 53 void AverageFilterUsage(void) 54 54 { 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_(""); 62 62 } -
issm/branches/trunk-jpl-damage/src/modules/BamgConvertMesh/BamgConvertMesh.cpp
r12044 r12878 4 4 #include "./BamgConvertMesh.h" 5 5 6 void mexFunction( 6 void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){ 7 7 8 8 /*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; 16 13 17 14 /*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; 27 19 28 20 /*Boot module: */ … … 37 29 38 30 /*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); 43 34 44 35 /*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"); 60 40 61 41 /* Run core computations: */ 62 if (verbose) printf("Call core\n");63 42 BamgConvertMeshx(bamgmesh,bamggeom,index,x,y,nods,nels); 64 43 … … 75 54 } 76 55 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"); 56 void 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_(""); 86 64 } -
issm/branches/trunk-jpl-damage/src/modules/BamgMesher/BamgMesher.cpp
r12054 r12878 51 51 52 52 void BamgMesherUsage(void){ 53 _p rintf_(true,"\n");54 _p rintf_(true," usage: [bamgmesh,bamggeom]=%s(bamgmesh,bamggeom,bamgoptions);\n",__FUNCT__);55 _p rintf_(true,"\n");53 _pprintLine_(""); 54 _pprintLine_(" usage: [bamgmesh,bamggeom]=" << __FUNCT__ << "(bamgmesh,bamggeom,bamgoptions);"); 55 _pprintLine_(""); 56 56 } -
issm/branches/trunk-jpl-damage/src/modules/BamgTriangulate/BamgTriangulate.cpp
r11933 r12878 27 27 28 28 /*Input datasets: */ 29 if (verbose) printf("Fetching inputs\n");29 if (verbose) _printLine_("Fetching inputs"); 30 30 FetchData(&x,&nods,&x_cols,XHANDLE); 31 31 FetchData(&y,&y_rows,&y_cols,YHANDLE); 32 32 33 33 /*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"); 37 37 38 38 /* Run core computations: */ 39 if (verbose) printf("Call core\n");39 if (verbose) _printLine_("Call core"); 40 40 BamgTriangulatex(&index,&nels,x,y,nods); 41 41 … … 49 49 void BamgTriangulateUsage(void) 50 50 { 51 _p rintf_(true,"BAMGTRIANGULATE - Delaunay Triangulation of a list of points");52 _p rintf_(true,"\n");53 _p rintf_(true," Usage:\n");54 _p rintf_(true," index=BamgTriangulate(x,y);\n");55 _p rintf_(true," index: index of the triangulation\n");56 _p rintf_(true," x,y: coordinates of the nodes\n");57 _p rintf_(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_(""); 58 58 } -
issm/branches/trunk-jpl-damage/src/modules/Chaco/Chaco.cpp
r12068 r12878 42 42 43 43 #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!"); 45 45 #endif 46 46 … … 82 82 /*Some debugging print: {{{*/ 83 83 #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); 102 102 #endif 103 103 /*}}}*/ … … 132 132 133 133 void ChacoUsage(void){ 134 _p rintf_(true,"\n");135 _p rintf_(true,"Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);\n");136 _p rintf_(true,"\n");134 _pprintLine_(""); 135 _pprintLine_("Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);"); 136 _pprintLine_(""); 137 137 } -
issm/branches/trunk-jpl-damage/src/modules/ContourToMesh/ContourToMesh.cpp
r12127 r12878 47 47 if(nlhs!=1 && nlhs!=2){ 48 48 ContourToMeshUsage(); 49 _error _("usage. See above");49 _error2_("usage. See above"); 50 50 } 51 51 #endif … … 53 53 if(nrhs!=NRHS){ 54 54 ContourToMeshUsage(); 55 _error _("usage. See above");55 _error2_("usage. See above"); 56 56 } 57 57 … … 82 82 WriteData(PLHS1,in_elem); 83 83 } 84 else _error _("wrong interpolation type");84 else _error2_("wrong interpolation type"); 85 85 86 86 /*end module: */ … … 91 91 void ContourToMeshUsage(void)//{{{1 92 92 { 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_(""); 112 112 } 113 113 //}}} -
issm/branches/trunk-jpl-damage/src/modules/ContourToNodes/ContourToNodes.cpp
r12060 r12878 82 82 /* Debugging of contours :{{{1*/ 83 83 /*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); 85 85 contouri=*(contours+i); 86 printf(" Number of nodes %i\n",contouri->nods);86 _printLine_(" Number of nodes " << contouri->nods); 87 87 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"); 89 89 } 90 90 }*/ … … 103 103 104 104 void 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_(""); 114 114 } -
issm/branches/trunk-jpl-damage/src/modules/ElementConnectivity/ElementConnectivity.cpp
r12112 r12878 37 37 38 38 void ElementConnectivityUsage(void) { 39 _p rintf_(true,"\n");40 _p rintf_(true," usage: elementconnectivity = %s(elements, nodeconnectivity);\n",__FUNCT__);41 _p rintf_(true,"\n");39 _pprintLine_(""); 40 _pprintLine_(" usage: elementconnectivity = " << __FUNCT__ << "(elements, nodeconnectivity);"); 41 _pprintLine_(""); 42 42 } -
issm/branches/trunk-jpl-damage/src/modules/EnumToString/EnumToString.cpp
r11933 r12878 12 12 /*checks on arguments on the matlab side: */ 13 13 if(nrhs!=NRHS){ 14 EnumToStringUsage(); _error _("usage. See above");14 EnumToStringUsage(); _error2_("usage. See above"); 15 15 } 16 16 … … 27 27 void EnumToStringUsage(void) 28 28 { 29 _p rintf_(true,"\n");30 _p rintf_(true," usage: %sstring = EnumToString(enum);\n",__FUNCT__);31 _p rintf_(true,"\n");29 _pprintLine_(""); 30 _pprintLine_(" usage: " << __FUNCT__ << "string = EnumToString(enum);"); 31 _pprintLine_(""); 32 32 } -
issm/branches/trunk-jpl-damage/src/modules/Exp2Kml/Exp2Kml.cpp
r12049 r12878 25 25 /*checks on arguments on the matlab side: */ 26 26 if (nlhs > NLHS) { 27 Exp2KmlUsage(); _error _("Exp2Kml usage error");27 Exp2KmlUsage(); _error2_("Exp2Kml usage error"); 28 28 } 29 29 if (nrhs < NRHS) { 30 Exp2KmlUsage(); _error _("Exp2Kml usage error");30 Exp2KmlUsage(); _error2_("Exp2Kml usage error"); 31 31 } 32 32 … … 43 43 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 44 44 options->Get(&cm,"central_meridian"); 45 if (verbose) printf(" cm=%g\n",cm);45 if (verbose) _printLine_(" cm=" << cm); 46 46 options->Get(&sp,"standard_parallel"); 47 if (verbose) printf(" sp=%g\n",sp);47 if (verbose) _printLine_(" sp=" << sp); 48 48 } 49 49 50 50 /*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)."); 54 54 55 55 /* Run core computations: */ … … 73 73 74 74 void Exp2KmlUsage(void){ 75 _p rintf_(true,"Exp2Kml - exp to kml file conversion module:\n");76 _p rintf_(true,"\n");77 _p rintf_(true," This module converts a file from exp to kml format.\n");78 _p rintf_(true,"\n");79 _p rintf_(true," Usage:\n");80 _p rintf_(true," [ret]=Exp2Kml(filexp,filkml,sgn,'param name',param,...);\n");81 _p rintf_(true,"\n");82 _p rintf_(true," filexp file name of exp file to be read (char)\n");83 _p rintf_(true," filkml file name of kml file to be written (char)\n");84 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");85 _p rintf_(true,"\n");86 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");87 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");88 _p rintf_(true," holes flag for treatment of multiple profiles (char, optional, 'yes' for holes))\n");89 _p rintf_(true,"\n");90 _p rintf_(true," ret return code (non-zero for warning)\n");91 _p rintf_(true,"\n");92 _p rintf_(true," Examples:\n");93 _p rintf_(true," [ret]=Exp2Kml('file.exp','file.kml', 1);\n");94 _p rintf_(true," [ret]=Exp2Kml('file.exp','file.kml', 1,'central_meridian',45,'standard_parallel',70,'holes','yes');\n");95 _p rintf_(true," [ret]=Exp2Kml('file.exp','file.kml',-1,'central_meridian', 0,'standard_parallel',71,'holes','yes');\n");96 _p rintf_(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_(""); 97 97 } 98 98 -
issm/branches/trunk-jpl-damage/src/modules/HoleFiller/HoleFiller.cpp
r11933 r12878 60 60 void HoleFillerUsage(void) 61 61 { 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_(""); 69 69 } -
issm/branches/trunk-jpl-damage/src/modules/InternalFront/InternalFront.cpp
r12060 r12878 26 26 /*Fetch required fields*/ 27 27 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"); 29 29 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]"); 31 31 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]"); 33 33 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]"); 35 35 36 36 /*Allocate and initialize all variables*/ … … 94 94 95 95 void InternalFrontUsage(void) { 96 _p rintf_(true,"\n");97 _p rintf_(true," usage: icefront = %s(md);\n",__FUNCT__);98 _p rintf_(true,"\n");96 _pprintLine_(""); 97 _pprintLine_(" usage: icefront = " << __FUNCT__ << "(md);"); 98 _pprintLine_(""); 99 99 } -
issm/branches/trunk-jpl-damage/src/modules/InterpFromGridToMesh/InterpFromGridToMesh.cpp
r11933 r12878 46 46 if((nlhs!=NLHS) || (nrhs!=6 && nrhs!=7)){ 47 47 InterpFromGridToMeshUsage(); 48 _error _("usage. See above");48 _error2_("usage. See above"); 49 49 } 50 50 … … 75 75 void InterpFromGridToMeshUsage(void) 76 76 { 77 _p rintf_(true,"INTERPFROMGRIDTOMESH - interpolation from a grid onto a list of points\n");78 _p rintf_(true,"\n");79 _p rintf_(true," This function is a multi-threaded mex file that interpolates a field\n");80 _p rintf_(true," defined on a grid onto a list of points\n");81 _p rintf_(true,"\n");82 _p rintf_(true," Usage:\n");83 _p rintf_(true," data_mesh=InterpFromGridToMesh(x,y,data,x_mesh,y_mesh,default_value);\n");84 _p rintf_(true,"\n");85 _p rintf_(true," data: matrix holding the data to be interpolated onto the mesh.\n");86 _p rintf_(true," x,y: coordinates of matrix data. (x and y must be in increasing order)\n");87 _p rintf_(true," x_mesh,y_mesh: coordinates of the points onto which we interpolate.\n");88 _p rintf_(true," default_value: default value if no data is found (holes).\n");89 _p rintf_(true," data_mesh: vector of mesh interpolated data.\n");90 _p rintf_(true,"\n");91 _p rintf_(true," Example:\n");92 _p rintf_(true," load('velocities.mat');\n");93 _p rintf_(true," md.inversion.vx_obs=InterpFromGridToMesh(x_n,y_m,vx,md.mesh.x,md.mesh.y,0);\n");94 _p rintf_(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_(""); 95 95 } -
issm/branches/trunk-jpl-damage/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp
r12060 r12878 69 69 if(nlhs!=NLHS){ 70 70 InterpFromMesh2dUsage(); 71 _error _("InterpFromMeshToMesh2dUsage usage error");71 _error2_("InterpFromMeshToMesh2dUsage usage error"); 72 72 } 73 73 if((nrhs!=6) && (nrhs!=7) && (nrhs!=8)){ 74 74 InterpFromMesh2dUsage(); 75 _error _("InterpFromMeshToMesh2dUsage usage error");75 _error2_("InterpFromMeshToMesh2dUsage usage error"); 76 76 } 77 77 … … 114 114 /* Debugging of contours :{{{1*/ 115 115 /*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); 117 117 contouri=*(contours+i); 118 printf(" Number of vertices %i\n",contouri->nods);118 _printLine_(" Number of vertices " << contouri->nods); 119 119 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"); 121 121 } 122 122 }*/ … … 131 131 /*some checks*/ 132 132 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!"); 134 134 } 135 135 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!"); 137 137 } 138 138 … … 154 154 void InterpFromMesh2dUsage(void) 155 155 { 156 _p rintf_(true," usage:\n");157 _p rintf_(true," data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime);\n\n");158 _p rintf_(true," or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n\n");159 _p rintf_(true," or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value,contourname);\n\n");160 _p rintf_(true," where:\n");161 _p rintf_(true," x,y: coordinates of the nodes where data is defined\n");162 _p rintf_(true," index: index of the mesh where data is defined\n");163 _p rintf_(true," data - vector holding the data to be interpolated onto the points.\n");164 _p rintf_(true," x_prime,y_prime: coordinates of the mesh vertices onto which we interpolate.\n");165 _p rintf_(true," default_value: a scalar or vector of size length(x_prime).\n");166 _p rintf_(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 _p rintf_(true," data_prime: vector of prime interpolated data.\n");168 _p rintf_(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_(""); 169 169 } -
issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
r11933 r12878 64 64 void InterpFromMeshToGridUsage(void) 65 65 { 66 _p rintf_(true,"INTERPFROMMESHTOGRID - interpolation of a data defined on a mesh onto a grid\n");67 _p rintf_(true,"\n");68 _p rintf_(true," This function is a multi-threaded mex file that interpolates a field\n");69 _p rintf_(true," defined on a triangular mesh onto a regular grid\n");70 _p rintf_(true,"\n");71 _p rintf_(true," Usage:\n");72 _p rintf_(true," [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,xmin,ymax,xposting,yposting,nlines,ncols,default_value)\n");73 _p rintf_(true,"\n");74 _p rintf_(true," index,x,y: delaunay triangulation defining the mesh.\n");75 _p rintf_(true," meshdata: vertex values of data to be interpolated.\n");76 _p rintf_(true," xmin,ymax,posting,nlines,ncols: parameters that define the grid\n");77 _p rintf_(true," default_value: value of points located out of the mesh.\n");78 _p rintf_(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_(""); 79 79 } -
issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
r12118 r12878 7 7 WRAPPER(InterpFromMeshToMesh2d){ 8 8 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; 33 22 34 23 /*Boot module: */ … … 39 28 if(nlhs!=NLHS){ 40 29 InterpFromMeshToMesh2dUsage(); 41 _error _("InterpFromMeshToMesh2dUsage usage error");30 _error2_("InterpFromMeshToMesh2dUsage usage error"); 42 31 } 43 32 #endif 44 33 /*check on input arguments: */ 45 if( (nrhs!=6) & (nrhs!=8)){34 if(nrhs<NRHS){ 46 35 InterpFromMeshToMesh2dUsage(); 47 _error _("InterpFromMeshToMesh2dUsage usage error");36 _error2_("InterpFromMeshToMesh2dUsage usage error"); 48 37 } 49 38 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); 57 47 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); 84 50 85 51 /*Write data: */ 86 WriteData(DATAINTERP,data_interp, x_interp_rows,data_cols);52 WriteData(DATAINTERP,data_interp,N_interp,N_data); 87 53 88 54 /*end module: */ … … 90 56 } 91 57 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"); 58 void 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_(""); 118 81 } 119 / /}}}82 /*}}}*/ -
issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
r12118 r12878 12 12 #endif 13 13 14 /*Very important definition in case we are compiling a python module!: needs to come before header files inclusion*/ 14 /* local prototypes: */ 15 void InterpFromMeshToMesh2dUsage(void); 16 17 /*If python: this macro needs to come before header files inclusion*/ 15 18 #ifdef _HAVE_PYTHON_ 16 19 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol … … 28 31 #include "../../c/EnumDefinitions/EnumDefinitions.h" 29 32 33 #undef __FUNCT__ 34 #define __FUNCT__ "InterpFromMeshToMesh2d" 35 30 36 #ifdef _HAVE_MATLAB_MODULES_ 31 37 /* serial input macros: */ … … 36 42 #define XINTERP prhs[4] 37 43 #define YINTERP prhs[5] 38 #define DEFAULT prhs[6] 39 #define CONTOURNAME prhs[7] 44 #define ARGUMENTS prhs 40 45 41 46 /* serial output macros: */ … … 51 56 #define XINTERP PyTuple_GetItem(args,4) 52 57 #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 55 60 /* serial output macros: */ 56 61 #define DATAINTERP output,0 57 62 #endif 58 59 #undef __FUNCT__60 #define __FUNCT__ "InterpFromMeshToMesh2d"61 63 62 64 /* serial arg counts: */ … … 64 66 #define NLHS 1 65 67 #undef NRHS 66 #define NRHS 6 //can be 8 though 67 68 /* local prototypes: */ 69 void InterpFromMeshToMesh2dUsage(void); 68 #define NRHS 6 70 69 71 70 #endif -
issm/branches/trunk-jpl-damage/src/modules/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
r11933 r12878 76 76 /*some checks*/ 77 77 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!"); 79 79 } 80 80 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!"); 82 82 } 83 83 /*get number of elements and number of nodes in the data*/ … … 98 98 void InterpFromMeshToMesh3dUsage(void) 99 99 { 100 _p rintf_(true,"INTERPFROMMESHTOMESH3D - interpolation from a 3d hexahedron mesh onto a list of point\n");101 _p rintf_(true,"\n");102 _p rintf_(true," This function is a multi-threaded mex file that interpolates a field\n");103 _p rintf_(true," defined on a triangular mesh onto a list of point\n");104 _p rintf_(true,"\n");105 _p rintf_(true," Usage:\n");106 _p rintf_(true," data_prime=InterpFromMeshToMesh3d(index,x,y,z,data,x_prime,y_prime,z_prime,default_value);\n");107 _p rintf_(true,"\n");108 _p rintf_(true," index: index of the mesh where data is defined\n");109 _p rintf_(true," x,y,z: coordinates of the nodes where data is defined\n");110 _p rintf_(true," data: matrix holding the data to be interpolated onto the mesh.\n");111 _p rintf_(true," x_prime,y_prime,z_prime: coordinates of the points onto which we interpolate.\n");112 _p rintf_(true," default_value: default value if no data is found (holes).\n");113 _p rintf_(true," data_prime: vector of mesh interpolated data.\n");114 _p rintf_(true,"\n");115 _p rintf_(true," Example:\n");116 _p rintf_(true," load('temperature.mat');\n");117 _p rintf_(true," md.initialization.temperature=InterpFromMeshToMesh3d(index,x,y,z,temperature,md.mesh.x,md.mesh.y,md.mesh.z,253);\n");118 _p rintf_(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_(""); 119 119 } -
issm/branches/trunk-jpl-damage/src/modules/KMLFileRead/KMLFileRead.cpp
r12049 r12878 45 45 /*checks on arguments on the matlab side: */ 46 46 if (nlhs > NLHS) { 47 KMLFileReadUsage(); _error _("KMLFileRead usage error");47 KMLFileReadUsage(); _error2_("KMLFileRead usage error"); 48 48 } 49 49 if (nrhs < NRHS) { 50 KMLFileReadUsage(); _error _("KMLFileRead usage error");50 KMLFileReadUsage(); _error2_("KMLFileRead usage error"); 51 51 } 52 52 … … 63 63 if (!strlen(filnam)) strcpy(filnam,"stdout"); 64 64 65 if (verbose) printf("Opening file \"%s\".\n",filnam);65 if (verbose) _printLine_("Opening file \"" << filnam << "\"."); 66 66 fidi=fopen(filnam,"r"); 67 67 68 68 /* Run core computations: */ 69 if (verbose) printf("Calling core:\n");69 if (verbose) _printLine_("Calling core:"); 70 70 kobj=KMLFileReadx(fidi); 71 71 72 if (verbose) printf("Closing file \"%s\".\n",filnam);72 if (verbose) _printLine_("Closing file \"" << filnam << "\"."); 73 73 fclose(fidi); 74 74 … … 83 83 } 84 84 else { 85 if (verbose) printf("Opening file \"%s\".\n",write);85 if (verbose) _printLine_("Opening file \"" << write << "\"."); 86 86 fido=fopen(write,"w"); 87 87 kobj->Write(fido,""); 88 if (verbose) printf("Closing file \"%s\".\n",write);88 if (verbose) _printLine_("Closing file \"" << write << "\"."); 89 89 ierror=fclose(fido); 90 90 } … … 107 107 108 108 void KMLFileReadUsage(void){ 109 _p rintf_(true,"KMLFileRead - KML file reader module:\n");110 _p rintf_(true,"\n");111 _p rintf_(true," This module reads a KML file.\n");112 _p rintf_(true,"\n");113 _p rintf_(true," Usage:\n");114 _p rintf_(true," [ierror]=KMLFileRead(kmlfile,'param name',param,...);\n");115 _p rintf_(true,"\n");116 _p rintf_(true," kmlfile file name of kml file to be read (char)\n");117 _p rintf_(true,"\n");118 _p rintf_(true," echo echo command (char, optional, 'off'/'on')\n");119 _p rintf_(true," deepecho deep echo command (char, optional, 'off'/'on')\n");120 _p rintf_(true," write write command (char, optional, 'off'/'stdout'/kmlfile)\n");121 _p rintf_(true,"\n");122 _p rintf_(true," ierror return code (non-zero for error)\n");123 _p rintf_(true,"\n");124 _p rintf_(true," Examples:\n");125 _p rintf_(true," [ierror]=KMLFileRead('file.kml','deepecho','on');\n");126 _p rintf_(true," [ierror]=KMLFileRead('filin.kml','echo','on','write','filout.kml');\n");127 _p rintf_(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_(""); 128 128 } 129 129 -
issm/branches/trunk-jpl-damage/src/modules/KMLMeshWrite/KMLMeshWrite.cpp
r12060 r12878 40 40 /*checks on arguments on the matlab side: */ 41 41 if (nlhs > NLHS) { 42 KMLMeshWriteUsage(); _error _("KMLMeshWrite usage error");42 KMLMeshWriteUsage(); _error2_("KMLMeshWrite usage error"); 43 43 } 44 44 if (nrhs < NRHS) { 45 KMLMeshWriteUsage(); _error _("KMLMeshWrite usage error");45 KMLMeshWriteUsage(); _error2_("KMLMeshWrite usage error"); 46 46 } 47 47 … … 87 87 88 88 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.");} 90 90 else if (!nodecon) 91 91 mncon=nnodes; 92 92 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."); 94 94 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."); 96 96 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."); 98 98 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."); 100 100 if (!strlen(filnam)) 101 101 strcpy(filnam,"stdout"); … … 118 118 119 119 void KMLMeshWriteUsage(void){ 120 _p rintf_(true,"KMLMeshWrite - KML mesh writer module:\n");121 _p rintf_(true,"\n");122 _p rintf_(true," This module writes the mesh of a model as KML polygons into the specified KML file.\n");123 _p rintf_(true,"\n");124 _p rintf_(true," Usage:\n");125 _p rintf_(true," ierror=KMLMeshWrite(name,notes,elem,nodecon,lat,long,part,data,cmap,kmlfile);\n");126 _p rintf_(true,"\n");127 _p rintf_(true," name model name (string, may be empty)\n");128 _p rintf_(true," notes model notes (string or cell array of strings, may be empty)\n");129 _p rintf_(true," elem elements (double array)\n");130 _p rintf_(true," nodecon nodal connectivity array (double array, may be empty)\n");131 _p rintf_(true," lat nodal latititudes (double vector)\n");132 _p rintf_(true," long nodal longitudes (double vector)\n");133 _p rintf_(true," part nodal partitions (double vector, may be empty)\n");134 _p rintf_(true," data nodal or element data (double vector, may be empty)\n");135 _p rintf_(true," cmap color map (double nx3 array, may be empty)\n");136 _p rintf_(true," kmlfile KML file name (string)\n");137 _p rintf_(true,"\n");138 _p rintf_(true," ierror error flag (double, non-zero for error)\n");139 _p rintf_(true,"\n");140 _p rintf_(true," Example:\n");141 _p rintf_(true," KMLMeshWrite(md.name,md.notes,md.elements,md.nodeconnectivity,md.lat,md.long,md.part,md.fm_criterion,options.cmap,filekml);\n");142 _p rintf_(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_(""); 143 143 } -
issm/branches/trunk-jpl-damage/src/modules/KMLOverlay/KMLOverlay.cpp
r12049 r12878 31 31 /*checks on arguments on the matlab side: */ 32 32 if(nlhs>NLHS){ 33 KMLOverlayUsage(); _error _("KMLOverlay usage error");33 KMLOverlayUsage(); _error2_("KMLOverlay usage error"); 34 34 } 35 35 if(nrhs<NRHS){ 36 KMLOverlayUsage(); _error _("KMLOverlay usage error");36 KMLOverlayUsage(); _error2_("KMLOverlay usage error"); 37 37 } 38 38 … … 42 42 43 43 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]); 45 45 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]); 47 47 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] << "\""); 49 49 options->Get(&dzip,"zip",0.); 50 if (verbose) printf(" dzip=%g\n",dzip);50 if (verbose) _printLine_(" dzip=" << dzip); 51 51 52 52 /*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."); 56 56 57 57 if ((int)dzip){ … … 63 63 if(!strlen(filkml)) strcpy(filkml,"stdout"); 64 64 65 if(verbose) printf("Opening kml overlay file \"%s\".\n",filkml);65 if(verbose) _printLine_("Opening kml overlay file \"" << filkml << "\"."); 66 66 fid=fopen(filkml,"w"); 67 67 68 68 /* Run core computations: */ 69 if (verbose) printf("Calling core:\n");69 if (verbose) _printLine_("Calling core:"); 70 70 KMLOverlayx(&ierror,lataxis,longaxis,nimages,pimages,fid); 71 71 72 if (verbose) printf("Closing file \"%s\".\n",filkml);72 if (verbose) _printLine_("Closing file \"" << filkml << "\"."); 73 73 fclose(fid); 74 74 … … 87 87 strcat(czip,pimages[i]); 88 88 } 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); 91 91 92 if (mexEvalString(czip)) _error _("Error zipping file \"%s\".",filkmz);92 if (mexEvalString(czip)) _error2_("Error zipping file \"" << filkmz << "\"."); 93 93 xfree((void**)&czip); 94 94 xfree((void**)&filkmz); … … 113 113 114 114 void KMLOverlayUsage(void){ 115 _p rintf_(true,"KMLOverlay - KML file overlay module:\n");116 _p rintf_(true,"\n");117 _p rintf_(true," This module reads a list of image files and writes a KML or KMZ overlay file.\n");118 _p rintf_(true,"\n");119 _p rintf_(true," Usage:\n");120 _p rintf_(true," ierror=KMLOverlay(kmlfile,'param name',param,...);\n");121 _p rintf_(true,"\n");122 _p rintf_(true," kmlfile KML or KMZ file name (string)\n");123 _p rintf_(true,"\n");124 _p rintf_(true," lataxis latitude axis (double vector [south north], required)\n");125 _p rintf_(true," longaxis longitude axis (double vector [west east], required)\n");126 _p rintf_(true," images relative or http image file names (string or array of strings or cell array of strings, required)\n");127 _p rintf_(true," zip flag to zip the doc.kml and image files into kmzfile (double, non-zero for kmz)\n");128 _p rintf_(true,"\n");129 _p rintf_(true," ierror error flag (double, non-zero for error)\n");130 _p rintf_(true,"\n");131 _p rintf_(true," Example:\n");132 _p rintf_(true," KMLOverlay(kmlfile,'lataxis',[south north],'longaxis',[west east],'images',{'file1.png','http://issm/file2.png'},'zip',1);\n");133 _p rintf_(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_(""); 134 134 } -
issm/branches/trunk-jpl-damage/src/modules/Kml2Exp/Kml2Exp.cpp
r12049 r12878 22 22 /*checks on arguments on the matlab side: */ 23 23 if (nlhs > NLHS) { 24 Kml2ExpUsage(); _error _("Kml2Exp usage error");24 Kml2ExpUsage(); _error2_("Kml2Exp usage error"); 25 25 } 26 26 if (nrhs < NRHS) { 27 Kml2ExpUsage(); _error _("Kml2Exp usage error");27 Kml2ExpUsage(); _error2_("Kml2Exp usage error"); 28 28 } 29 29 … … 37 37 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 38 38 options->Get(&cm,"central_meridian"); 39 if (verbose) printf(" cm=%g\n",cm);39 if (verbose) _printLine_(" cm=" << cm); 40 40 options->Get(&sp,"standard_parallel"); 41 if (verbose) printf(" sp=%g\n",sp);41 if (verbose) _printLine_(" sp=" << sp); 42 42 } 43 43 44 44 /*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)."); 48 48 49 49 /* Run core computations: */ … … 66 66 67 67 void Kml2ExpUsage(void){ 68 _p rintf_(true,"Kml2Exp - kml to exp file conversion module:\n");69 _p rintf_(true,"\n");70 _p rintf_(true," This module converts a file from kml to exp format.\n");71 _p rintf_(true,"\n");72 _p rintf_(true," Usage:\n");73 _p rintf_(true," [ret]=Kml2Exp(filexp,filkml,sgn,'param name',param,...);\n");74 _p rintf_(true,"\n");75 _p rintf_(true," filkml file name of kml file to be read (char)\n");76 _p rintf_(true," filexp file name of exp file to be written (char)\n");77 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");78 _p rintf_(true,"\n");79 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");80 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");81 _p rintf_(true,"\n");82 _p rintf_(true," ret return code (non-zero for warning)\n");83 _p rintf_(true,"\n");84 _p rintf_(true," Examples:\n");85 _p rintf_(true," [ret]=Kml2Exp('file.kml','file.exp', 1);\n");86 _p rintf_(true," [ret]=Kml2Exp('file.kml','file.exp', 1,'central_meridian',45,'standard_parallel',70);\n");87 _p rintf_(true," [ret]=Kml2Exp('file.kml','file.exp',-1,'central_meridian', 0,'standard_parallel',71);\n");88 _p rintf_(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_(""); 89 89 } 90 90 -
issm/branches/trunk-jpl-damage/src/modules/Kriging/Kriging.cpp
r12258 r12878 22 22 /*checks on arguments on the matlab side: */ 23 23 if (nrhs<NRHS || nlhs>NLHS){ 24 KrigingUsage(); _error _("Kriging usage error");24 KrigingUsage(); _error2_("Kriging usage error"); 25 25 } 26 26 27 27 /*Fetch inputs: */ 28 28 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"); 31 31 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"); 33 33 FetchData(&options,NRHS,nrhs,prhs); 34 34 … … 54 54 55 55 void 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_(""); 59 73 } -
issm/branches/trunk-jpl-damage/src/modules/Ll2xy/Ll2xy.cpp
r12049 r12878 25 25 /*checks on arguments on the matlab side: */ 26 26 if (nlhs > NLHS) { 27 Ll2xyUsage(); _error _("Ll2xy usage error");27 Ll2xyUsage(); _error2_("Ll2xy usage error"); 28 28 } 29 29 if (nrhs < NRHS) { 30 Ll2xyUsage(); _error _("Ll2xy usage error");30 Ll2xyUsage(); _error2_("Ll2xy usage error"); 31 31 } 32 32 … … 40 40 if(options->GetOption("central_meridian") || options->GetOption("standard_parallel")){ 41 41 options->Get(&cm,"central_meridian"); 42 if (verbose) printf(" cm=%g\n",cm);42 if (verbose) _printLine_(" cm=" << cm); 43 43 options->Get(&sp,"standard_parallel"); 44 if (verbose) printf(" sp=%g\n",sp);44 if (verbose) _printLine_(" sp=" << sp); 45 45 } 46 46 47 47 /*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.");} 50 50 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)."); 54 54 55 55 x=(double*)mxMalloc(ncoord*sizeof(double)); … … 74 74 75 75 void Ll2xyUsage(void){ 76 _p rintf_(true,"Ll2xy - lat/long to x/y coordinate transformation module:\n");77 _p rintf_(true,"\n");78 _p rintf_(true," This module transforms lat/long to x/y coordinates.\n");79 _p rintf_(true,"\n");80 _p rintf_(true," Usage:\n");81 _p rintf_(true," [x,y]=Ll2xy(lat,lon,sgn,'param name',param,...);\n");82 _p rintf_(true,"\n");83 _p rintf_(true," lat latitude coordinates (double vector)\n");84 _p rintf_(true," lon longitude coordinates (double vector)\n");85 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");86 _p rintf_(true,"\n");87 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");88 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");89 _p rintf_(true,"\n");90 _p rintf_(true," x x coordinates (double vector)\n");91 _p rintf_(true," y y coordinates (double vector)\n");92 _p rintf_(true,"\n");93 _p rintf_(true," Examples:\n");94 _p rintf_(true," [x,y]=Ll2xy(lat,lon, 1);\n");95 _p rintf_(true," [x,y]=Ll2xy(lat,lon, 1,'central_meridian',45,'standard_parallel',70);\n");96 _p rintf_(true," [x,y]=Ll2xy(lat,lon,-1,'central_meridian', 0,'standard_parallel',71);\n");97 _p rintf_(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_(""); 98 98 } -
issm/branches/trunk-jpl-damage/src/modules/MeshPartition/MeshPartition.cpp
r12060 r12878 96 96 97 97 void 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_(""); 104 104 } -
issm/branches/trunk-jpl-damage/src/modules/MeshProfileIntersection/MeshProfileIntersection.cpp
r12060 r12878 54 54 //index 55 55 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!"); 57 57 index=(int*)xmalloc(nel*3*sizeof(int)); 58 58 for(i=0;i<nel;i++){ … … 81 81 /* Debugging of contours :{{{1*/ 82 82 /*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); 84 84 contouri=*(contours+i); 85 printf(" Number of vertices %i\n",contouri->nods);85 _printLine_(" Number of vertices " << contouri->nods); 86 86 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"); 88 88 } 89 89 }*/ … … 102 102 103 103 void 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."); 114 114 } -
issm/branches/trunk-jpl-damage/src/modules/NodeConnectivity/NodeConnectivity.cpp
r12112 r12878 37 37 38 38 void NodeConnectivityUsage(void) { 39 _p rintf_(true,"\n");40 _p rintf_(true," usage: connectivity = %s(elements, numnodes);\n",__FUNCT__);41 _p rintf_(true,"\n");39 _pprintLine_(""); 40 _pprintLine_(" usage: connectivity = " << __FUNCT__ << "(elements, numnodes);"); 41 _pprintLine_(""); 42 42 } -
issm/branches/trunk-jpl-damage/src/modules/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
r11933 r12878 42 42 43 43 void 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_(""); 52 52 } -
issm/branches/trunk-jpl-damage/src/modules/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp
r11933 r12878 42 42 43 43 void 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_(""); 47 47 } -
issm/branches/trunk-jpl-damage/src/modules/Scotch/Scotch.cpp
r6412 r12878 25 25 26 26 #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!"); 28 28 #else 29 29 -
issm/branches/trunk-jpl-damage/src/modules/Shp2Kml/Shp2Kml.cpp
r12049 r12878 25 25 26 26 #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!"); 28 28 #endif 29 29 … … 33 33 /*checks on arguments on the matlab side: */ 34 34 if (nlhs > NLHS) { 35 Shp2KmlUsage(); _error _("Shp2Kml usage error");35 Shp2KmlUsage(); _error2_("Shp2Kml usage error"); 36 36 } 37 37 if (nrhs < NRHS) { 38 Shp2KmlUsage(); _error _("Shp2Kml usage error");38 Shp2KmlUsage(); _error2_("Shp2Kml usage error"); 39 39 } 40 40 … … 48 48 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 49 49 options->Get(&cm,"central_meridian"); 50 if (verbose) printf(" cm=%g\n",cm);50 if (verbose) _printLine_(" cm=" << cm); 51 51 options->Get(&sp,"standard_parallel"); 52 if (verbose) printf(" sp=%g\n",sp);52 if (verbose) _printLine_(" sp=" << sp); 53 53 } 54 54 55 55 /*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)."); 59 59 60 60 /* Run core computations: */ … … 77 77 78 78 void Shp2KmlUsage(void){ 79 _p rintf_(true,"Shp2Kml - shp to kml file conversion module:\n");80 _p rintf_(true,"\n");81 _p rintf_(true," This module converts a file from shp to kml format.\n");82 _p rintf_(true,"\n");83 _p rintf_(true," Usage:\n");84 _p rintf_(true," [ret]=Shp2Kml(filshp,filkml,sgn,'param name',param,...);\n");85 _p rintf_(true,"\n");86 _p rintf_(true," filshp file name of shp file to be read (char, extension optional)\n");87 _p rintf_(true," filkml file name of kml file to be written (char)\n");88 _p rintf_(true," sgn sign for hemisphere (double, +1 (north); -1 (south); or 0 (no translation))\n");89 _p rintf_(true,"\n");90 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");91 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");92 _p rintf_(true,"\n");93 _p rintf_(true," ret return code (non-zero for warning)\n");94 _p rintf_(true,"\n");95 _p rintf_(true," Examples:\n");96 _p rintf_(true," [ret]=Shp2Kml('file.shp','file.kml', 0);\n");97 _p rintf_(true," [ret]=Shp2Kml('file.shp','file.kml', 1,'central_meridian',45,'standard_parallel',70);\n");98 _p rintf_(true," [ret]=Shp2Kml('file.shp','file.kml',-1,'central_meridian', 0,'standard_parallel',71);\n");99 _p rintf_(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_(""); 100 100 } -
issm/branches/trunk-jpl-damage/src/modules/StringToEnum/StringToEnum.cpp
r11933 r12878 12 12 /*checks on arguments on the matlab side: */ 13 13 if(nrhs!=NRHS){ 14 StringToEnumUsage(); _error _("usage. See above");14 StringToEnumUsage(); _error2_("usage. See above"); 15 15 } 16 16 … … 27 27 void StringToEnumUsage(void) 28 28 { 29 _p rintf_(true,"\n");30 _p rintf_(true," usage: %senum = StringToEnum(string);\n",__FUNCT__);31 _p rintf_(true,"\n");29 _pprintLine_(""); 30 _pprintLine_(" usage: " << __FUNCT__ << "enum = StringToEnum(string);"); 31 _pprintLine_(""); 32 32 } -
issm/branches/trunk-jpl-damage/src/modules/TriMesh/TriMesh.cpp
r12112 r12878 51 51 delete domain; 52 52 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; 58 58 59 59 /*end module: */ … … 63 63 void TriMeshUsage(void) //{{{1 64 64 { 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_(""); 72 72 } 73 73 //}}} -
issm/branches/trunk-jpl-damage/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp
r12085 r12878 66 66 mexPrintf(" %s format error.\n", __FUNCT__); 67 67 TriMeshProcessRiftsUsage(); 68 printf(" "); 69 mexErrMsgTxt(" "); 68 _error_("bad usage"); 70 69 } 71 70 … … 82 81 } 83 82 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"); 86 84 } 87 85 … … 96 94 } 97 95 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"); 100 97 } 101 98 … … 109 106 } 110 107 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"); 113 109 } 114 110 … … 125 121 } 126 122 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"); 129 124 } 130 125 … … 138 133 } 139 134 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 } 165 137 166 138 /*First, do some fixing on the existing mesh: we do not want any element belonging entirely to the segment list (ie: … … 325 297 void TriMeshProcessRiftsUsage(void) 326 298 { 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."); 331 303 } -
issm/branches/trunk-jpl-damage/src/modules/TriaSearch/TriaSearch.cpp
r11933 r12878 9 9 10 10 /*input: */ 11 double*index=NULL;11 int* index=NULL; 12 12 int nel; 13 13 int dummy; … … 37 37 FetchData(&y0,&numberofnodes,Y0HANDLE); 38 38 39 /* Echo: {{{1*/40 //printf("(x0,y0)=(%g,%g)\n",x0,y0);41 /*}}}*/42 43 39 /* Run core computations: */ 44 40 TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes); … … 54 50 } 55 51 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"); 52 void 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_(""); 66 61 } -
issm/branches/trunk-jpl-damage/src/modules/Xy2ll/Xy2ll.cpp
r12049 r12878 24 24 /*checks on arguments on the matlab side: */ 25 25 if (nlhs > NLHS) { 26 Xy2llUsage(); _error _("Xy2ll usage error");26 Xy2llUsage(); _error2_("Xy2ll usage error"); 27 27 } 28 28 if (nrhs < NRHS) { 29 Xy2llUsage(); _error _("Xy2ll usage error");29 Xy2llUsage(); _error2_("Xy2ll usage error"); 30 30 } 31 31 … … 39 39 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 40 40 options->Get(&cm,"central_meridian"); 41 if (verbose) printf(" cm=%g\n",cm);41 if (verbose) _printLine_(" cm=" << cm); 42 42 options->Get(&sp,"standard_parallel"); 43 if (verbose) printf(" sp=%g\n",sp);43 if (verbose) _printLine_(" sp=" << sp); 44 44 } 45 45 46 46 /*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.");} 48 48 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)."); 52 52 53 53 lat=(double*)mxMalloc(ncoord*sizeof(double)); … … 55 55 56 56 /* Run core computations: */ 57 if (verbose) printf("Calling core:\n");57 if (verbose) _printLine_("Calling core:"); 58 58 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 59 59 iret=Xy2llx(lat,lon,x,y,ncoord,sgn,cm,sp); … … 73 73 74 74 void Xy2llUsage(void){ 75 _p rintf_(true,"Xy2ll - x/y to lat/long coordinate transformation module:\n");76 _p rintf_(true,"\n");77 _p rintf_(true," This module transforms x/y to lat/long coordinates.\n");78 _p rintf_(true,"\n");79 _p rintf_(true," Usage:\n");80 _p rintf_(true," [lat,lon]=Xy2ll(x,y,sgn,'param name',param,...);\n");81 _p rintf_(true,"\n");82 _p rintf_(true," x x coordinates (double vector)\n");83 _p rintf_(true," y y coordinates (double vector)\n");84 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");85 _p rintf_(true,"\n");86 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");87 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");88 _p rintf_(true,"\n");89 _p rintf_(true," lat latitude coordinates (double vector)\n");90 _p rintf_(true," lon longitude coordinates (double vector)\n");91 _p rintf_(true,"\n");92 _p rintf_(true," Examples:\n");93 _p rintf_(true," [lat,lon]=Xy2ll(x,y, 1);\n");94 _p rintf_(true," [lat,lon]=Xy2ll(x,y, 1,'central_meridian',45,'standard_parallel',70);\n");95 _p rintf_(true," [lat,lon]=Xy2ll(x,y,-1,'central_meridian', 0,'standard_parallel',71);\n");96 _p rintf_(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_(""); 97 97 } 98 98 -
issm/branches/trunk-jpl-damage/src/modules/matlab
- Property svn:ignore
-
old new 2 2 Makefile 3 3 *.lib 4 *.mexa64 4 5 *.mexw64 5 6 *.manifest
-
- Property svn:ignore
-
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@1 INCLUDES = @DAKOTAINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ 2 2 EXEEXT=$(MATLABWRAPPEREXT) 3 3 #Bin programs {{{1 … … 41 41 #}}} 42 42 #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)43 LDADD = ../../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) 44 44 45 45 #Triangle library … … 50 50 AM_CXXFLAGS += -D_HAVE_MATLAB_MODULES_ -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread 51 51 LDADD += $(MEXLIB) ../../c/libISSMMatlab.a 52 53 LDADD += ../../c/libISSMCore.a ../../c/libISSMModules.a 52 LDADD += ../../c/libISSMCore.a 53 if CIRCULAR_DEPENDENCIES 54 LDADD += $(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) 55 endif 56 LDADD += ../../c/libISSMModules.a 54 57 55 58 #Optimization flags: -
issm/branches/trunk-jpl-damage/src/modules/python
- Property svn:ignore
-
old new 1 *.deps 2 Makefile.in 1 3 Makefile
-
- Property svn:ignore
-
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@1 INCLUDES = @DAKOTAINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ 2 2 EXEEXT=$(PYTHONWRAPPEREXT) 3 3 #Bin programs {{{1 … … 17 17 #Python part 18 18 AM_LDFLAGS = $(PYTHONLINK) 19 AM_CXXFLAGS += -D_HAVE_PYTHON_MODULES_ 19 AM_CXXFLAGS += -D_HAVE_PYTHON_MODULES_ -fPIC 20 20 if PYTHON3 21 21 AM_CXXFLAGS += -DNPY_NO_DEPRECATED_API -
issm/branches/trunk-jpl-damage/src/py
- Property svn:ignore
-
old new 1 1 Makefile 2 Makefile.in
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/src/py/model
- Property svn:ignore
-
old new 1 1 Makefile 2 Makefile.in 2 3 __pycache__
-
- Property svn:ignore
-
issm/branches/trunk-jpl-damage/startup.py
r12168 r12878 22 22 #ISSM path. Go through src/py and load everything we find that looks like a python file 23 23 for root,dirs,files in os.walk(ISSM_DIR+ '/src/py'): 24 if '.svn' in dirs: 25 dirs.remove('.svn') 24 26 for file in files: 25 27 if file.find(".py") != -1: … … 31 33 32 34 for root,dirs,files in os.walk(ISSM_DIR+ '/src/m'): 35 if '.svn' in dirs: 36 dirs.remove('.svn') 33 37 for file in files: 34 38 if file.find(".py") != -1: … … 64 68 from settings import * 65 69 from solver import * 66 from issmtier import *67 70 from ismumps import * 68 71 from pairoptions import * … … 77 80 from stokesoptions import * 78 81 from generic import * 79 from none import *80 from none import *81 82 from hydrology import * 82 83 from miscellaneous import * -
issm/branches/trunk-jpl-damage/test/NightlyRun/IdFromString.m
r5111 r12878 22 22 %return if no test found 23 23 if isempty(ids_raw), 24 disp(['No test matches ''' string '' ]);24 disp(['No test matches ''' string '''' ]); 25 25 return 26 26 end -
issm/branches/trunk-jpl-damage/test/NightlyRun/runme.m
r12168 r12878 49 49 if ~ismember(benchmark,{'all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing'}) 50 50 disp('runme warning: benchmark not supported, defaulting to test ''nightly''') 51 benchmark='nigh lty';51 benchmark='nightly'; 52 52 end 53 53 % }}} … … 87 87 test_ids=intersect(test_ids,list_ids); 88 88 % }}} 89 %GET exc ulde {{{189 %GET exclude {{{1 90 90 exclude_ids=getfieldvalue(options,'exclude',[]); 91 91 exclude_ids=[exclude_ids]; … … 126 126 127 127 if ~strcmp(oshostname(),'larsen'); 128 error(['Nigh lty run archives must be saved on "larsen" (hostname is "' oshostname() '")']);128 error(['Nightly run archives must be saved on "larsen" (hostname is "' oshostname() '")']); 129 129 end 130 130 for k=1:length(field_names), … … 135 135 disp(sprintf(['File ./../Archives/' archive_name ' saved\n'])); 136 136 137 137 %ELSE: CHECK TEST 138 138 else, 139 139 -
issm/branches/trunk-jpl-damage/test/NightlyRun/test1107.m
r11323 r12878 131 131 }; 132 132 field_tolerances={... 133 1e-0 8,1e-08,1e-06,...133 1e-07,1e-08,1e-06,... 134 134 1e-08,1e-08,1e-06,... 135 135 1e-08,1e-08,1e-07,... -
issm/branches/trunk-jpl-damage/test/NightlyRun/test1108.m
r11244 r12878 74 74 1e-07,1e-07,1e-07,... 75 75 1e-08,1e-08,1e-08,... 76 1e-08,1e-07,1e-0 8,...76 1e-08,1e-07,1e-07,... 77 77 1e-08,1e-08,1e-08,... 78 78 1e-08,1e-07,1e-07,... -
issm/branches/trunk-jpl-damage/test/Par/SquareShelfConstrained.par
r11467 r12878 51 51 md=SetIceShelfBC(md); 52 52 53 %Change name so that no test have the same name53 %Change name so that no tests have the same name 54 54 A=dbstack; 55 55 if (length(A)>2), md.miscellaneous.name=A(3).file(1:end-2); end -
issm/branches/trunk-jpl-damage/test/Par/SquareShelfConstrained.py
r12168 r12878 4 4 import InterpFromMeshToMesh2d as im 5 5 from paterson import * 6 from SetIceShelfBC import * 7 import inspect 6 8 7 9 #Start defining model parameters here … … 18 20 #Initial velocity 19 21 mat=matio.loadmat('../Data/SquareShelfConstrained.data') 22 #Reshape as Rank-1 arrays 23 x=reshape(mat['x'],(-1)) 24 y=reshape(mat['y'],(-1)) 25 vx=mat['vx'] 26 vy=mat['vy'] 20 27 #deal with 'F' oriented matlab matrices! 21 28 index=mat['index'].astype(float) 22 29 index=reshape(index.T,(len(index),3),order='F') 23 30 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)31 md.initialization.vx = im.InterpFromMeshToMesh2d(index, x, y, vx, md.mesh.x, md.mesh.y) 32 md.initialization.vy = im.InterpFromMeshToMesh2d(index, x, y, vy, md.mesh.x, md.mesh.y) 26 33 md.initialization.vz = zeros(md.mesh.numberofvertices) 27 34 md.initialization.pressure = zeros(md.mesh.numberofvertices) … … 53 60 #Deal with boundary conditions: 54 61 md = 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 63 if len(inspect.stack()) > 2: 64 md.miscellaneous.name = inspect.stack()[2][1].split('.')[0] 59 65
Note:
See TracChangeset
for help on using the changeset viewer.