Changeset 14310
- Timestamp:
- 02/04/13 08:01:04 (12 years ago)
- Location:
- issm/trunk
- Files:
-
- 42 deleted
- 252 edited
- 279 copied
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 14068-14070,14073-14074,14077-14095,14097-14112,14117,14134-14135,14138-14142,14144,14149-14151,14153,14156-14208,14210-14308
- Property svn:mergeinfo changed
-
issm/trunk/configs/config-arm-linux.sh
r13975 r14310 6 6 --host="arm-linux-androideabi" \ 7 7 --enable-shared \ 8 --with-android=jni\ 8 --with-android=jni \ 9 --with-android-ndk=$ISSM_DIR/externalpackages/android/android-ndk/install \ 9 10 --without-fortran \ 10 11 --without-wrappers \ -
issm/trunk/configure.ac
r14067 r14310 2 2 3 3 #AUTOCONF 4 AC_INIT([ISSM],[4.2. 4],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure4 AC_INIT([ISSM],[4.2.5],[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 -
issm/trunk/externalpackages/adolc/install-dev.sh
r13975 r14310 6 6 7 7 git clone -b 2.3.x_ISSM git://git.mcs.anl.gov/adol-c.git adolc_issm 8 #git reset --hard b254b2a001a1b7a024a9184cd087ae06eb975cad 8 9 9 10 #Compile ADOL-C -
issm/trunk/externalpackages/adolc/install-update-dev.sh
r13975 r14310 15 15 cd adolc_issm 16 16 git pull 17 #git reset --hard b254b2a001a1b7a024a9184cd087ae06eb975cad 17 18 18 19 autoreconf -f -i -
issm/trunk/externalpackages/export_fig/export_fig.m
r12707 r14310 123 123 % -bookmark - option to indicate that a bookmark with the name of the 124 124 % figure is to be created in the output file (pdf only). 125 % handle - The handle of the figure or axes (can be an array of handles126 % of several axes, but thesemust be in the same figure) to be125 % handle - The handle of the figure, axes or uipanels (can be an array of 126 % handles, but the objects must be in the same figure) to be 127 127 % saved. Default: gcf. 128 128 % … … 166 166 % 09/05/12: Incorporate patch of Arcelia Arrieta (many thanks), to keep 167 167 % tick marks fixed. 168 169 function [im alpha] = export_fig(varargin) 168 % 12/12/12: Add support for isolating uipanels. Thanks to michael for 169 % suggesting it. 170 171 function [im, alpha] = export_fig(varargin) 170 172 % Make sure the figure is rendered correctly _now_ so that properties like 171 173 % axes limits are up-to-date. 172 174 drawnow; 173 175 % Parse the input arguments 174 [fig options] = parse_args(nargout, varargin{:});176 [fig, options] = parse_args(nargout, varargin{:}); 175 177 % Isolate the subplot, if it is one 176 cls = strcmp(get(fig(1), 'Type'), 'axes');178 cls = all(ismember(get(fig, 'Type'), {'axes', 'uipanel'})); 177 179 if cls 178 180 % Given handles of one or more axes, so isolate them from the rest 179 181 fig = isolate_axes(fig); 180 182 else 183 % Check we have a figure 184 if ~isequal(get(fig, 'Type'), 'figure'); 185 error('Handle must be that of a figure, axes or uipanel'); 186 end 187 % Get the old InvertHardcopy mode 181 188 old_mode = get(fig, 'InvertHardcopy'); 182 189 end … … 198 205 end 199 206 end 200 % MATLAB "feature": axes limits can change when printing207 % MATLAB "feature": axes limits and tick marks can change when printing 201 208 Hlims = findall(fig, 'Type', 'axes'); 202 209 if ~cls … … 282 289 % Crop the background 283 290 if options.crop 284 [alpha v] = crop_background(alpha, 0);291 [alpha, v] = crop_background(alpha, 0); 285 292 A = A(v(1):v(2),v(3):v(4),:); 286 293 end … … 289 296 res = options.magnify * get(0, 'ScreenPixelsPerInch') / 25.4e-3; 290 297 % Save the png 291 imwrite(A, [options.name '.png'], 'Alpha', alpha, 'ResolutionUnit', 'meter', 'XResolution', res, 'YResolution', res);298 imwrite(A, [options.name '.png'], 'Alpha', double(alpha), 'ResolutionUnit', 'meter', 'XResolution', res, 'YResolution', res); 292 299 % Clear the png bit 293 300 options.png = false; … … 325 332 tcol = 255; 326 333 else 327 [A tcol] = print2array(fig, magnify, renderer);334 [A, tcol] = print2array(fig, magnify, renderer); 328 335 end 329 336 % Crop the background … … 460 467 return 461 468 462 function [fig options] = parse_args(nout, varargin)469 function [fig, options] = parse_args(nout, varargin) 463 470 % Parse the input arguments 464 471 % Set the defaults … … 542 549 end 543 550 else 544 [p options.nameext] = fileparts(varargin{a});551 [p, options.name, ext] = fileparts(varargin{a}); 545 552 if ~isempty(p) 546 553 options.name = [p filesep options.name]; … … 577 584 578 585 % Check whether transparent background is wanted (old way) 579 if isequal(get( fig, 'Color'), 'none')586 if isequal(get(ancestor(fig, 'figure'), 'Color'), 'none') 580 587 options.transparent = true; 581 588 end … … 667 674 return 668 675 669 function [A v] = crop_background(A, bcol)676 function [A, v] = crop_background(A, bcol) 670 677 % Map the foreground pixels 671 [h wc] = size(A);678 [h, w, c] = size(A); 672 679 if isscalar(bcol) && c > 1 673 680 bcol = bcol(ones(1, c)); -
issm/trunk/externalpackages/export_fig/ghostscript.m
r10635 r14310 1 function varargout = ghostscript(cmd)2 1 %GHOSTSCRIPT Calls a local GhostScript executable with the input command 3 2 % … … 25 24 % Thanks to Jonas Dorn for the fix for the title of the uigetdir window on 26 25 % Mac OS. 27 28 26 % Thanks to Nathan Childress for the fix to the default location on 64-bit 29 27 % Windows systems. 30 31 28 % 27/4/11 - Find 64-bit Ghostscript on Windows. Thanks to Paul Durack and 32 29 % Shaun Kline for pointing out the issue 33 34 30 % 4/5/11 - Thanks to David Chorlian for pointing out an alternative 35 31 % location for gs on linux. 32 % 12/12/12 - Add extra executable name on Windows. Thanks to Ratish 33 % Punnoose for highlighting the issue. 36 34 35 function varargout = ghostscript(cmd) 37 36 % Call ghostscript 38 37 [varargout{1:nargout}] = system(sprintf('"%s" %s', gs_path, cmd)); 39 38 return 40 39 41 function path = gs_path40 function path_ = gs_path 42 41 % Return a valid path 43 42 % Start with the currently set path 44 path = user_string('ghostscript');43 path_ = user_string('ghostscript'); 45 44 % Check the path works 46 if check_gs_path(path )45 if check_gs_path(path_) 47 46 return 48 47 end 49 48 % Check whether the binary is on the path 50 49 if ispc 51 bin = {'gswin32c.exe', 'gswin64c.exe' };50 bin = {'gswin32c.exe', 'gswin64c.exe', 'gs'}; 52 51 else 53 52 bin = {'gs'}; 54 53 end 55 54 for a = 1:numel(bin) 56 path = bin{a};57 if check_store_gs_path(path )55 path_ = bin{a}; 56 if check_store_gs_path(path_) 58 57 return 59 58 end … … 76 75 path2 = [default_location dir_list(a).name executable{b}]; 77 76 if exist(path2, 'file') == 2 78 path = path2;77 path_ = path2; 79 78 ver_num = ver_num2; 80 79 end … … 82 81 end 83 82 end 84 if check_store_gs_path(path )83 if check_store_gs_path(path_) 85 84 return 86 85 end … … 88 87 bin = {'/usr/bin/gs', '/usr/local/bin/gs'}; 89 88 for a = 1:numel(bin) 90 path = bin{a};91 if check_store_gs_path(path )89 path_ = bin{a}; 90 if check_store_gs_path(path_) 92 91 return 93 92 end … … 110 109 for a = 1:numel(bin_dir) 111 110 for b = 1:numel(bin) 112 path = [base bin_dir{a} bin{b}];113 if exist(path , 'file') == 2114 if check_store_gs_path(path )111 path_ = [base bin_dir{a} bin{b}]; 112 if exist(path_, 'file') == 2 113 if check_store_gs_path(path_) 115 114 return 116 115 end … … 121 120 error('Ghostscript not found. Have you installed it from www.ghostscript.com?'); 122 121 123 function good = check_store_gs_path(path )122 function good = check_store_gs_path(path_) 124 123 % Check the path is valid 125 good = check_gs_path(path );124 good = check_gs_path(path_); 126 125 if ~good 127 126 return 128 127 end 129 128 % Update the current default path to the path found 130 if ~user_string('ghostscript', path )129 if ~user_string('ghostscript', path_) 131 130 warning('Path to ghostscript installation could not be saved. Enter it manually in ghostscript.txt.'); 132 131 return … … 134 133 return 135 134 136 function good = check_gs_path(path )135 function good = check_gs_path(path_) 137 136 % Check the path is valid 138 [good message] = system(sprintf('"%s" -h', path));137 [good, message] = system(sprintf('"%s" -h', path_)); 139 138 good = good == 0; 140 139 return -
issm/trunk/externalpackages/export_fig/isolate_axes.m
r11995 r14310 5 5 % fh = isolate_axes(ah, vis) 6 6 % 7 % This function will create a new figure containing the axes specified, and8 % also their associated legends and colorbars. The axes specified must all9 % be in the same figure, but they will generally only be a subset of the10 % a xes in the figure.7 % This function will create a new figure containing the axes/uipanels 8 % specified, and also their associated legends and colorbars. The objects 9 % specified must all be in the same figure, but they will generally only be 10 % a subset of the objects in the figure. 11 11 % 12 12 % IN: 13 % ah - An array of axes handles, which must come from the same figure. 13 % ah - An array of axes and uipanel handles, which must come from the 14 % same figure. 14 15 % vis - A boolean indicating whether the new figure should be visible. 15 16 % Default: false. … … 23 24 % 16/3/2012 Moved copyfig to its own function. Thanks to Bob Fratantonio 24 25 % for pointing out that the function is also used in export_fig.m. 26 % 12/12/12 - Add support for isolating uipanels. Thanks to michael for 27 % suggesting it. 25 28 26 29 function fh = isolate_axes(ah, vis) … … 29 32 error('ah must be an array of handles'); 30 33 end 31 % Check that the handles are all for axes , and are all in the same figure34 % Check that the handles are all for axes or uipanels, and are all in the same figure 32 35 fh = ancestor(ah(1), 'figure'); 33 36 nAx = numel(ah); 34 37 for a = 1:nAx 35 if ~ strcmp(get(ah(a), 'Type'), 'axes')36 error('All handles must be axes handles.');38 if ~ismember(get(ah(a), 'Type'), {'axes', 'uipanel'}) 39 error('All handles must be axes or uipanel handles.'); 37 40 end 38 41 if ~isequal(ancestor(ah(a), 'figure'), fh) … … 40 43 end 41 44 end 42 % Tag the axes so we can find them in the copy45 % Tag the objects so we can find them in the copy 43 46 old_tag = get(ah, 'Tag'); 44 47 if nAx == 1 … … 51 54 set(fh, 'Visible', 'off'); 52 55 end 53 % Reset the axestags56 % Reset the object tags 54 57 for a = 1:nAx 55 58 set(ah(a), 'Tag', old_tag{a}); … … 59 62 if numel(ah) ~= nAx 60 63 close(fh); 61 error('Incorrect number of axes found.');64 error('Incorrect number of objects found.'); 62 65 end 63 66 % Set the axes tags to what they should be … … 87 90 % Get all the objects in the figure 88 91 axs = findall(fh); 89 % Delete everything except for the input axes and associated items92 % Delete everything except for the input objects and associated items 90 93 delete(axs(~ismember(axs, [ah; allchildren(ah); allancestors(ah)]))); 91 94 return -
issm/trunk/externalpackages/export_fig/pdftops.m
r10635 r14310 33 33 return 34 34 35 function path = xpdf_path35 function path_ = xpdf_path 36 36 % Return a valid path 37 37 % Start with the currently set path 38 path = user_string('pdftops');38 path_ = user_string('pdftops'); 39 39 % Check the path works 40 if check_xpdf_path(path )40 if check_xpdf_path(path_) 41 41 return 42 42 end … … 48 48 end 49 49 if check_store_xpdf_path(bin) 50 path = bin;50 path_ = bin; 51 51 return 52 52 end 53 53 % Search the obvious places 54 54 if ispc 55 path = 'C:\Program Files\xpdf\pdftops.exe';55 path_ = 'C:\Program Files\xpdf\pdftops.exe'; 56 56 else 57 path = '/usr/local/bin/pdftops';57 path_ = '/usr/local/bin/pdftops'; 58 58 end 59 if check_store_xpdf_path(path )59 if check_store_xpdf_path(path_) 60 60 return 61 61 end … … 75 75 bin_dir = {'', ['bin' filesep], ['lib' filesep]}; 76 76 for a = 1:numel(bin_dir) 77 path = [base bin_dir{a} bin];78 if exist(path , 'file') == 277 path_ = [base bin_dir{a} bin]; 78 if exist(path_, 'file') == 2 79 79 break; 80 80 end 81 81 end 82 if check_store_xpdf_path(path )82 if check_store_xpdf_path(path_) 83 83 return 84 84 end … … 86 86 error('pdftops executable not found.'); 87 87 88 function good = check_store_xpdf_path(path )88 function good = check_store_xpdf_path(path_) 89 89 % Check the path is valid 90 good = check_xpdf_path(path );90 good = check_xpdf_path(path_); 91 91 if ~good 92 92 return 93 93 end 94 94 % Update the current default path to the path found 95 if ~user_string('pdftops', path )95 if ~user_string('pdftops', path_) 96 96 warning('Path to pdftops executable could not be saved. Enter it manually in pdftops.txt.'); 97 97 return … … 99 99 return 100 100 101 function good = check_xpdf_path(path )101 function good = check_xpdf_path(path_) 102 102 % Check the path is valid 103 [good message] = system(sprintf('"%s" -h', path ));103 [good message] = system(sprintf('"%s" -h', path_)); 104 104 % system returns good = 1 even when the command runs 105 105 % Look for something distinct in the help text -
issm/trunk/externalpackages/export_fig/print2array.m
r12707 r14310 25 25 % bcol - 1x3 uint8 vector of the background color 26 26 27 % Copyright (C) Oliver Woodford 2008-201 127 % Copyright (C) Oliver Woodford 2008-2012 28 28 29 % 5/9/2011 Set EraseModes to normal when using opengl or zbuffer renderers. 30 % Thanks to Pawel Kocieniewski for reporting the issue. 29 % 05/09/11: Set EraseModes to normal when using opengl or zbuffer 30 % renderers. Thanks to Pawel Kocieniewski for reporting the 31 % issue. 32 % 21/09/11: Bug fix: unit8 -> uint8! Thanks to Tobias Lamour for reporting 33 % the issue. 34 % 14/11/11: Bug fix: stop using hardcopy(), as it interfered with figure 35 % size and erasemode settings. Makes it a bit slower, but more 36 % reliable. Thanks to Phil Trinh and Meelis Lootus for reporting 37 % the issues. 38 % 09/12/11: Pass font path to ghostscript. 39 % 27/01/12: Bug fix affecting painters rendering tall figures. Thanks to 40 % Ken Campbell for reporting it. 41 % 03/04/12: Bug fix to median input. Thanks to Andy Matthews for reporting 42 % it. 43 % 26/10/12: Set PaperOrientation to portrait. Thanks to Michael Watts for 44 % reporting the issue. 31 45 32 % 21/9/2011 Bug fix: unit8 -> uint8! 33 % Thanks to Tobias Lamour for reporting the issue. 34 35 % 14/11/2011 Bug fix: stop using hardcopy(), as it interfered with figure 36 % size and erasemode settings. Makes it a bit slower, but more reliable. 37 % Thanks to Phil Trinh and Meelis Lootus for reporting the issues. 38 39 % 9/12/2011 Pass font path to ghostscript. 40 41 % 27/1/2012 Bug fix affecting painters rendering tall figures. Thanks to 42 % Ken Campbell for reporting it. 43 44 % 3/4/2012 Bug fix to median input. Thanks to Andy Matthews for reporting 45 % it. 46 47 function [A bcol] = print2array(fig, res, renderer) 46 function [A, bcol] = print2array(fig, res, renderer) 48 47 % Generate default input arguments, if needed 49 48 if nargin < 2 … … 85 84 % Execute the ghostscript command 86 85 ghostscript(cmd_str); 87 catch 86 catch me 88 87 % Delete the intermediate file 89 88 delete(tmp_eps); 90 rethrow( lasterror);89 rethrow(me); 91 90 end 92 91 % Delete the intermediate file … … 134 133 err = false; 135 134 % Set paper size 136 old_mode = get(fig, 'PaperPositionMode'); 137 set(fig, 'PaperPositionMode', 'auto'); 135 old_pos_mode = get(fig, 'PaperPositionMode'); 136 old_orientation = get(fig, 'PaperOrientation'); 137 set(fig, 'PaperPositionMode', 'auto', 'PaperOrientation', 'portrait'); 138 138 try 139 139 % Print to tiff file … … 147 147 end 148 148 % Reset paper size 149 set(fig, 'PaperPositionMode', old_ mode);149 set(fig, 'PaperPositionMode', old_pos_mode, 'PaperOrientation', old_orientation); 150 150 % Throw any error that occurred 151 151 if err -
issm/trunk/externalpackages/export_fig/print2eps.m
r12707 r14310 28 28 % fex id: 5743, but the implementation is mine :) 29 29 30 % 14/11/2011 Fix a MATLAB bug rendering black or white text incorrectly. 31 % Thanks to Mathieu Morlighem for reporting the issue and obtaining a fix 32 % from TMW. 33 34 % 8/12/2011 Added ability to correct fonts. Several people have requested 35 % this at one time or another, and also pointed me to printeps (fex id: 36 % 7501), so thank you to them. My implementation (which was not inspired by 37 % printeps - I'd already had the idea for my approach) goes 38 % slightly further in that it allows multiple fonts to be swapped. 39 40 % 14/12/2011 Fix bug affecting font names containing spaces. Many thanks to 41 % David Szwer for reporting the issue. 42 43 % 25/1/2012 Add a font not to be swapped. Thanks to Anna Rafferty and Adam 44 % Jackson for reporting the issue. Also fix a bug whereby using a font 45 % alias can lead to another font being swapped in. 46 47 % 10/4/2012 Make the font swapping case insensitive. 30 % 14/11/2011: Fix a MATLAB bug rendering black or white text incorrectly. 31 % Thanks to Mathieu Morlighem for reporting the issue and 32 % obtaining a fix from TMW. 33 % 08/12/11: Added ability to correct fonts. Several people have requested 34 % this at one time or another, and also pointed me to printeps 35 % (fex id: 7501), so thank you to them. My implementation (which 36 % was not inspired by printeps - I'd already had the idea for my 37 % approach) goes slightly further in that it allows multiple 38 % fonts to be swapped. 39 % 14/12/11: Fix bug affecting font names containing spaces. Thanks to David 40 % Szwer for reporting the issue. 41 % 25/01/12: Add a font not to be swapped. Thanks to Anna Rafferty and Adam 42 % Jackson for reporting the issue. Also fix a bug whereby using a 43 % font alias can lead to another font being swapped in. 44 % 10/04/12: Make the font swapping case insensitive. 45 % 26/10/12: Set PaperOrientation to portrait. Thanks to Michael Watts for 46 % reporting the issue. 47 % 26/10/12: Fix issue to do with swapping fonts changing other fonts and 48 % sizes we don't want, due to listeners. Thanks to Malcolm Hudson 49 % for reporting the issue. 48 50 49 51 function print2eps(name, fig, varargin) … … 59 61 end 60 62 % Find all the used fonts in the figure 61 font_handles = find all(fig, '-property', 'FontName');63 font_handles = findobj(fig, '-property', 'FontName'); 62 64 fonts = get(font_handles, 'FontName'); 63 65 if ~iscell(fonts) … … 86 88 require_swap = find(~ismember(fontslu, matlab_fontsl)); 87 89 unused_fonts = find(~ismember(matlab_fontsl, fontslu)); 88 font_swap = cell(3, 0);89 fo r 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, []);90 font_swap = cell(3, min(numel(require_swap), numel(unused_fonts))); 91 fonts_new = fonts; 92 for a = 1:size(font_swap, 2) 93 font_swap{1,a} = find(strcmp(fontslu{require_swap(a)}, fontsl)); 94 font_swap{2,a} = matlab_fonts{unused_fonts(a)}; 95 font_swap{3,a} = fonts{font_swap{1,end}(1)}; 96 fonts_new(font_swap{1,a}) = {font_swap{2,a}}; 95 97 end 96 98 % Swap the fonts 97 for a = 1:size(font_swap, 2) 98 set(font_swap{1,a}, 'FontName', font_swap{2,a}); 99 if ~isempty(font_swap) 100 fonts_size = get(font_handles, 'FontSize'); 101 if iscell(fonts_size) 102 fonts_size = cell2mat(fonts_size); 103 end 104 M = false(size(font_handles)); 105 % Loop because some changes may not stick first time, due to listeners 106 c = 0; 107 update = zeros(1000, 1); 108 for b = 1:10 % Limit number of loops to avoid infinite loop case 109 for a = 1:numel(M) 110 M(a) = ~isequal(get(font_handles(a), 'FontName'), fonts_new{a}) || ~isequal(get(font_handles(a), 'FontSize'), fonts_size(a)); 111 if M(a) 112 set(font_handles(a), 'FontName', fonts_new{a}, 'FontSize', fonts_size(a)); 113 c = c + 1; 114 update(c) = a; 115 end 116 end 117 if ~any(M) 118 break; 119 end 120 end 121 % Compute the order to revert fonts later, without the need of a loop 122 [update, M] = unique(update(1:c)); 123 [M, M] = sort(M); 124 update = reshape(update(M), 1, []); 99 125 end 100 126 % Set paper size 101 old_mode = get(fig, 'PaperPositionMode'); 102 set(fig, 'PaperPositionMode', 'auto'); 127 old_pos_mode = get(fig, 'PaperPositionMode'); 128 old_orientation = get(fig, 'PaperOrientation'); 129 set(fig, 'PaperPositionMode', 'auto', 'PaperOrientation', 'portrait'); 103 130 % MATLAB bug fix - black and white text can come out inverted sometimes 104 131 % Find the white and black text … … 120 147 set(white_text_handles, 'Color', [1 1 1]); 121 148 % Reset paper size 122 set(fig, 'PaperPositionMode', old_ mode);149 set(fig, 'PaperPositionMode', old_pos_mode, 'PaperOrientation', old_orientation); 123 150 % Correct the fonts 124 151 if ~isempty(font_swap) 125 152 % Reset the font names in the figure 126 for a = 1:size(font_swap, 2)127 set(font_ swap{1,a}, 'FontName', font_swap{3,a});153 for a = update 154 set(font_handles(a), 'FontName', fonts{a}, 'FontSize', fonts_size(a)); 128 155 end 129 156 % Replace the font names in the eps file -
issm/trunk/externalpackages/gsl/install-android.sh
r14067 r14310 28 28 patch Makefile.am < Makefile.am.patch 29 29 30 autoreconf -i v --force -I $ISSM_DIR/externalpackages/autotools/install/share/aclocal30 autoreconf -i 31 31 32 32 ./configure \ 33 33 --build="i386-apple-darwin10.8.0" \ 34 34 --host=$host_triplet \ 35 --prefix="$ISSM_DIR/externalpackages/gsl/install/" \ 36 --disable-static 35 --prefix="$ISSM_DIR/externalpackages/gsl/install" 37 36 fi 38 37 -
issm/trunk/m4/issm_options.m4
r13975 r14310 163 163 fi 164 164 AC_MSG_RESULT($HAVE_TRIANGLE) 165 166 AC_MSG_CHECKING(for triangle and parallel status)167 if test $HAVE_TRIANGLE = no; then168 if test "$SERIAL_VALUE" = "yes" ; then169 AC_MSG_ERROR([--with-triangle-dir missing. Triangle is needed to run ISSM serially!])170 fi171 fi172 AC_MSG_RESULT(ok)173 165 dnl }}} 174 166 dnl dakota{{{ … … 182 174 dnl defaults 183 175 HAVE_DAKOTA=yes 176 AC_MSG_RESULT($HAVE_DAKOTA) 184 177 DAKOTAINCL=-I$DAKOTA_ROOT/include 178 AC_MSG_CHECKING(for dakota version) 179 DAKOTA_VERSION=`cat $DAKOTA_ROOT/include/dakota_config.h | grep "#define PACKAGE_VERSION" | sed 's/#define PACKAGE_VERSION//' | sed 's/ //g' | sed -e 's/\"//g' ` 180 AC_MSG_RESULT($DAKOTA_VERSION) 181 AC_DEFINE_UNQUOTED([DAKOTA_VERSION],"$DAKOTA_VERSION",[Dakota version number]) 185 182 case "${host_os}" in 186 183 *cygwin*) 187 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver" 184 if test x$DAKOTA_VERSION = x4.2; then 185 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver" 186 else if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then 187 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -llhs -lsparsegrid -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -loptpp -lpsuade -lncsuopt -lcolin -linterfaces -lmomh -lscolib -lpebbl -ltinyxml -lutilib -l3po -lhopspack -lnidr -lamplsolver -lboost_signals -lboost_regex -lboost_filesystem -lboost_system" 188 else 189 AC_MSG_ERROR([Dakota version not found or version ($DAKOTA_VERSION) not supported!]); 190 fi 191 fi 188 192 ;; 189 193 *linux*) 190 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver" 194 if test x$DAKOTA_VERSION = x4.2; then 195 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver" 196 else if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then 197 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -llhs -lsparsegrid -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -loptpp -lpsuade -lncsuopt -lcolin -linterfaces -lmomh -lscolib -lpebbl -ltinyxml -lutilib -l3po -lhopspack -lnidr -lamplsolver -lboost_signals -lboost_regex -lboost_filesystem -lboost_system" 198 else 199 AC_MSG_ERROR([Dakota version not found or version ($DAKOTA_VERSION) not supported!]); 200 fi 201 fi 191 202 ;; 192 203 *darwin*) 193 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver" 194 dnl DAKOTALIB+= "-lgslcblas -L/usr/lib -lblas -llapack" 204 if test x$DAKOTA_VERSION = x4.2; then 205 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver" 206 dnl DAKOTALIB+= "-lgslcblas -L/usr/lib -lblas -llapack" 207 else if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then 208 DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -llhs -lsparsegrid -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -loptpp -lpsuade -lncsuopt -lcolin -linterfaces -lmomh -lscolib -lpebbl -ltinyxml -lutilib -l3po -lhopspack -lnidr -lamplsolver -lboost_signals -lboost_regex -lboost_filesystem -lboost_system" 209 dnl DAKOTALIB+= "-lgslcblas -L/usr/lib -lblas -llapack" 210 else 211 AC_MSG_ERROR([Dakota version not found or version ($DAKOTA_VERSION) not supported!]); 212 fi 213 fi 195 214 ;; 196 215 esac … … 201 220 else 202 221 HAVE_DAKOTA=no 222 AC_MSG_RESULT($HAVE_DAKOTA) 203 223 fi 204 224 AM_CONDITIONAL([DAKOTA], [test x$HAVE_DAKOTA = xyes]) 205 AC_MSG_RESULT($HAVE_DAKOTA)206 225 dnl }}} 207 226 dnl boost{{{ … … 1045 1064 dnl check that --with-fortran-lib may have been provided 1046 1065 if test -n "$FORTRAN_LIB" ; then 1047 FORTRANLIB="$FORTRAN_LIB" 1048 AC_DEFINE([_HAVE_FORTRAN_],[1],[with FORTRAN in ISSM src]) 1049 AC_SUBST([FORTRANLIB]) 1066 dnl check that library provided EXISTS! 1067 FORTRAN_DIR=$(echo $FORTRAN_LIB | sed -e "s/-L//g" | awk '{print $[1]}') 1068 if test -d "$FORTRAN_DIR" || test -f "$FORTRAN_DIR"; then 1069 FORTRANLIB="$FORTRAN_LIB" 1070 AC_DEFINE([_HAVE_FORTRAN_],[1],[with FORTRAN in ISSM src]) 1071 AC_SUBST([FORTRANLIB]) 1072 else 1073 if test "x$HAVE_MPI" = "xyes"; then 1074 FORTRANLIB=$(mpif77 -print-file-name="libgfortran.a") 1075 if test -f "$FORTRANLIB"; then 1076 AC_MSG_ERROR([fortran library provided ($FORTRAN_LIB) does not exist, MPI suggests the following library: $FORTRANLIB]); 1077 fi 1078 fi 1079 AC_MSG_ERROR([frtran library provided ($FORTRAN_LIB$) does not exist!]); 1080 fi 1050 1081 fi 1051 1082 AC_MSG_RESULT(done) … … 1059 1090 1060 1091 dnl check that --with-graphics-lib may have been provided 1092 1061 1093 if test -n "$GRAPHICS_LIB" ; then 1062 HAVE_GRAPHICS=yes 1063 GRAPHICSLIB="$GRAPHICS_LIB" 1064 1065 AC_DEFINE([_HAVE_GRAPHICS_],[1],[with GRAPHICS in ISSM src]) 1066 AC_SUBST([GRAPHICSLIB]) 1094 dnl check that library provided EXISTS! 1095 GRAPHICS_DIR=$(echo $GRAPHICS_LIB | sed -e "s/-L//g" | awk '{print $[1]}') 1096 if test -d "$GRAPHICS_DIR" || test -f "$GRAPHICS_DIR"; then 1097 HAVE_GRAPHICS=yes 1098 GRAPHICSLIB="$GRAPHICS_LIB" 1099 AC_DEFINE([_HAVE_GRAPHICS_],[1],[with GRAPHICS in ISSM src]) 1100 AC_SUBST([GRAPHICSLIB]) 1101 else 1102 if test -f "$PETSC_ROOT/conf/petscvariables"; then 1103 GRAPHICSLIB=$(cat $PETSC_ROOT/conf/petscvariables | grep X_LIB) 1104 AC_MSG_ERROR([graphics library provided ($GRAPHICS_LIB) does not exist, PETSc suggests the following library: $GRAPHICSLIB]); 1105 fi 1106 AC_MSG_ERROR([graphics library provided ($GRAPHICS_LIB$) does not exist!]); 1107 fi 1067 1108 fi 1068 1109 AC_MSG_RESULT(done) … … 1326 1367 dnl defaults 1327 1368 HAVE_ANDROID=jni 1328 1329 1369 AC_DEFINE([_HAVE_ANDROID_],[1],[with android capability]) 1370 AC_DEFINE([_HAVE_ANDROID_JNI_],[1],[with android jni]) 1330 1371 elif test "x$ANDROID" = "xexe"; then 1331 1372 dnl defaults … … 1342 1383 AM_CONDITIONAL([ANDROIDEXE], [test x$HAVE_ANDROID = xexe]) 1343 1384 AC_MSG_RESULT($HAVE_ANDROID) 1385 dnl }}} 1386 dnl with-android-ndk{{{ 1387 AC_ARG_WITH([android-ndk], 1388 AS_HELP_STRING([--with-android-ndk=DIR], [android-ndk root directory.]), 1389 [ANDROID_NDK_ROOT=$withval],[ANDROID_NDK_ROOT=""]) 1390 AC_MSG_CHECKING(with android ndk) 1391 1392 if test -d "$ANDROID_NDK_ROOT"; then 1393 dnl defaults 1394 HAVE_ANDROID_NDK=yes 1395 ANDROID_NDKINCL="-I$ANDROID_NDK_ROOT/arm-linux-android-install/sysroot/usr/include" 1396 1397 AC_DEFINE([_HAVE_ANDROID_NDK_],[1],[with android ndk in ISSM src]) 1398 AC_SUBST([ANDROID_NDKINCL]) 1399 else 1400 HAVE_ANDROID_NDK=no 1401 fi 1402 AC_MSG_RESULT($HAVE_ANDROID_NDK) 1344 1403 dnl }}} 1345 1404 dnl with-3d{{{ -
issm/trunk/scripts/DownloadExternalPackage.py
r13395 r14310 6 6 # 7 7 8 # imports {{{ 8 9 import os,sys,re 9 10 import urllib 10 11 from HTMLParser import HTMLParser 11 12 from urllib import FancyURLopener 12 13 # Start class myHTMLParser 14 class MyHTMLParser(HTMLParser): 13 # }}} 14 class MyHTMLParser(HTMLParser): #{{{ 15 15 16 16 def __init__(self, pattern): … … 23 23 if "href" == i[0] and str(self.matcher.match(i[1])) != "None": 24 24 self.targets.append(i[1]) 25 # End class myHTMLParser 25 #}}} 26 def main(argv=None): # {{{ 27 # Separates the URL into a directory and the file or pattern based on the 28 # last appearance of '/'. 29 if len(sys.argv) > 1: 30 pivot = sys.argv[1].rfind("/") 31 url = (sys.argv[1])[:pivot] 32 pivot += 1 33 find = (sys.argv[1])[pivot:] 34 else: 35 print "******************************************************************************************************************************" 36 print "* Invalid input! *" 37 print "* *" 38 print "* Try: 'DownloadExternalPackage.py url [localFile]' *" 39 print "* *" 40 print "* Where 'URL' is the URL with an explicit package name or the URL followed by the truncated package name. And 'localFile' is *" 41 print "* the file name (including extension) that you would like to save as. *" 42 print "* *" 43 print "* Examples: *" 44 print "* *" 45 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-2.3.2-p3.tar.gz' 'petsc-2.3.2-p3.tar.gz' *" 46 print "* *" 47 print "* This is the old style and the safest way to download a package. *" 48 print "* *" 49 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' 'libtool.tar.gz' *" 50 print "* *" 51 print "* This is the new style. For packages like 'Libtool', which we never expect to be using multiple versions, this will *" 52 print "* download the most recent version and save it as the generic 'libtool.tar.gz'. *" 53 print "* *" 54 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/gsl-1.' 'gsl-1.15.tar.gz' *" 55 print "* *" 56 print "* This is the new style. This is a demonstration of how this script can be used to disambiguate a package name if there *" 57 print "* are more than once package matching 'gsl-'. *" 58 print "* *" 59 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' *" 60 print "* *" 61 print "* This is the new style. This will download a package with 'libtool' as a prefix and save it as its canonical name. *" 62 print "* *" 63 print "* *" 64 print "******************************************************************************************************************************" 65 66 if len(sys.argv) > 2: 67 localFile=sys.argv[2] 68 print "Downloaded file will be saved as: " + localFile 69 else: 70 localFile = None 71 print "Downloaded file will saved with the same file name." 72 73 74 print "Looking for: " + find 75 76 # As an extra precaution, if no extension is given for a particular package 77 # such as '.../libtool', then ensure that files found are of appropriate 78 # file extensions. 79 # 80 # WARNING: The external packages directory includes executable binaries with 81 # '.exe' extensions. As such, '.exe' is an acceptable suffix, but this is 82 # inherently dangerous since this script can be used to download from any 83 # valid website. Furthermore, if an individual attempts a "man-in-the-middle" 84 # attack, then the user would be capable of downloading executables from 85 # an untrusted source. 86 pattern = find + "[\w.-]*(\.tar\.gz|tar\.gz2|tgz|zip|exe)?" 87 parser = MyHTMLParser(pattern) 88 89 # Creates a 'FancyURL' which allows the script to fail gracefully by catching 90 # HTTP error codes 30X and several 40X(where 'X' is a natural number). 91 urlObject = FancyURLopener() 92 obj = urlObject.open(url) 93 parser.feed(obj.read()) 94 95 # If a file pattern was used to describe the file that should be downloaded, 96 # then there is the potential for multiple file matches. Currently, the script 97 # will detect this ambiguity and print out all the matches, while informing 98 # the user that he must refine his search. 99 # 100 # TODO: Prompt the user to select from a list his/her preferred target. 101 if len(parser.targets) > 1: 102 print "Could not resolve your download due to the number of hits." 103 print "Refine your search." 104 for i in parser.targets: 105 print i 106 107 elif len(parser.targets) == 1: 108 print "Found: " + parser.targets[0] 109 url += "/" + parser.targets[0] 110 111 if localFile is None: 112 if os.path.exists(parser.targets[0]): 113 print "File " + parser.targets[0] + " already exists and will not be downloaded..." 114 else: 115 urllib.urlretrieve(url, parser.targets[0]) 116 print "File saved as: " + parser.targets[0] 117 else: 118 if os.path.exists(localFile): 119 print "File "+ localFile +" already exists and will not be downloaded..." 120 else: 121 if parser.targets[0] == localFile: 122 print "File found and destination match." 123 elif parser.matcher.match(localFile) != "None": 124 print "File found matches destination pattern." 125 else: 126 print "WARNING: the file found \'" + parser.targets[0] + "\' does not match \'" + localFile + "\'" 127 print "Ensure the downloaded version is suitable." 128 129 urllib.urlretrieve(url, localFile) 130 print "File saved as: " + localFile 131 132 else: 133 print "No matches found!" 134 135 obj.close() 136 # End 'main' function. }}} 26 137 27 # Separates the URL into a directory and the file or pattern based on the 28 # last appearance of '/'. 29 if len(sys.argv) > 1: 30 pivot = sys.argv[1].rfind("/") 31 url = (sys.argv[1])[:pivot] 32 pivot += 1 33 find = (sys.argv[1])[pivot:] 34 else: 35 print "******************************************************************************************************************************" 36 print "* Invalid input! *" 37 print "* *" 38 print "* Try: 'DownloadExternalPackage.py url [localFile]' *" 39 print "* *" 40 print "* Where 'URL' is the URL with an explicit package name or the URL followed by the truncated package name. And 'localFile' is *" 41 print "* the file name (including extension) that you would like to save as. *" 42 print "* *" 43 print "* Examples: *" 44 print "* *" 45 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-2.3.2-p3.tar.gz' 'petsc-2.3.2-p3.tar.gz' *" 46 print "* *" 47 print "* This is the old style and the safest way to download a package. *" 48 print "* *" 49 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' 'libtool.tar.gz' *" 50 print "* *" 51 print "* This is the new style. For packages like 'Libtool', which we never expect to be using multiple versions, this will *" 52 print "* download the most recent version and save it as the generic 'libtool.tar.gz'. *" 53 print "* *" 54 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/gsl-1.' 'gsl-1.15.tar.gz' *" 55 print "* *" 56 print "* This is the new style. This is a demonstration of how this script can be used to disambiguate a package name if there *" 57 print "* are more than once package matching 'gsl-'. *" 58 print "* *" 59 print "* DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' *" 60 print "* *" 61 print "* This is the new style. This will download a package with 'libtool' as a prefix and save it as its canonical name. *" 62 print "* *" 63 print "* *" 64 print "******************************************************************************************************************************" 65 66 if len(sys.argv) > 2: 67 localFile=sys.argv[2] 68 print "Downloaded file will saved as: " + localFile 69 else: 70 localFile = None 71 print "Downloaded file will saved with the same file name." 72 73 74 print "Looking for " + find 75 76 # As an extra precaution, if no extension is given for a particular package 77 # such as '.../libtool', then ensure that files found are of appropriate 78 # file extensions. 79 # 80 # WARNING: The external packages directory includes executable binaries with 81 # '.exe' extensions. As such, '.exe' is an acceptable suffix, but this is 82 # inherently dangerous since this script can be used to download from any 83 # valid website. Furthermore, if an individual attempts a "man-in-the-middle" 84 # attack, then the user would be capable of downloading executables from 85 # an untrusted source. 86 pattern = find + "[\w.-]*(\.tar\.gz|tar\.gz2|tgz|zip|exe)?" 87 parser = MyHTMLParser(pattern) 88 89 # Creates a 'FancyURL' which allows the script to fail gracefully by catching 90 # HTTP error codes 30X and several 40X(where 'X' is a natural number). 91 urlObject = FancyURLopener() 92 obj = urlObject.open(url) 93 parser.feed(obj.read()) 94 95 # If a file pattern was used to describe the file that should be downloaded, 96 # then there is the potential for multiple file matches. Currently, the script 97 # will detect this ambiguity and print out all the matches, while informing 98 # the user that he must refine his search. 99 # 100 # TODO: Prompt the user to select from a list his/her preferred target. 101 if len(parser.targets) > 1: 102 print "Could not resolve your download due to the number of hits." 103 print "Refine your search." 104 for i in parser.targets: 105 print i 106 107 elif len(parser.targets) == 1: 108 print "Found: " + parser.targets[0] 109 url += "/" + parser.targets[0] 110 111 if localFile is None: 112 if os.path.exists(parser.targets[0]): 113 print "File " + parser.targets[0] + " already exists and will not be downloaded..." 114 else: 115 urllib.urlretrieve(url, parser.targets[0]) 116 print "File saved as: " + parser.targets[0] 117 else: 118 if os.path.exists(localFile): 119 print "File "+ localFile +" already exists and will not be downloaded..." 120 else: 121 if parser.targets[0] == localFile: 122 print "File found and destination match." 123 elif parser.matcher.match(localFile) != "None": 124 print "File found matches destination pattern." 125 else: 126 print "WARNING: the file found \'" + parser.targets[0] + "\' does not match \'" + localFile + "\'" 127 print "Ensure the downloaded version is suitable." 128 129 urllib.urlretrieve(url, localFile) 130 print "File saved as: " + localFile 131 132 else: 133 print "No matches found!" 134 135 obj.close() 138 if __name__ == "__main__": 139 main() -
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/android/ISSM
- Property svn:ignore
-
issm/trunk/src/android/ISSM/AndroidManifest.xml
r14067 r14310 2 2 package="com.example.issm" 3 3 android:versionCode="1" 4 android:versionName="1.0" >5 4 android:versionName="1.0" 5 android:installLocation="preferExternal" > 6 6 <uses-sdk 7 7 android:minSdkVersion="10" … … 12 12 android:label="@string/app_name" 13 13 android:theme="@style/AppTheme" > 14 <activity android:name=" .MapSelection"14 <activity android:name="com.example.issm.SplashScreen" 15 15 android:label="@string/title_activity_issm" > 16 16 <intent-filter> … … 20 20 </activity> 21 21 <activity 22 android:name=".MenuPage" 23 android:label="@string/title_activity_issm" > 24 </activity> 25 <activity 22 26 android:name=".ISSM" 23 27 android:label="@string/title_activity_issm" > -
issm/trunk/src/android/ISSM/Makefile.am
r13931 r14310 5 5 deps = 6 6 else 7 deps = ../../c/libISSMCore.a7 deps = $(ISSM_DIR)/src/c/libISSMCore.a ./jni/Main.cpp 8 8 endif 9 9 … … 14 14 $(ANDROID_NDK_DIR)/ndk-build -C ./jni clean 15 15 $(ANDROID_NDK_DIR)/ndk-build -C ./jni 16 17 clean: 18 rm -rf libs obj -
issm/trunk/src/android/ISSM/bin
- Property svn:ignore
-
old new 1 com.* 1 2 *ISSM.apk 2 3 resources.ap_
-
- Property svn:ignore
-
issm/trunk/src/android/ISSM/bin/AndroidManifest.xml
r14067 r14310 2 2 package="com.example.issm" 3 3 android:versionCode="1" 4 android:versionName="1.0" >5 4 android:versionName="1.0" 5 android:installLocation="preferExternal" > 6 6 <uses-sdk 7 7 android:minSdkVersion="10" … … 12 12 android:label="@string/app_name" 13 13 android:theme="@style/AppTheme" > 14 <activity android:name=" .MapSelection"14 <activity android:name="com.example.issm.SplashScreen" 15 15 android:label="@string/title_activity_issm" > 16 16 <intent-filter> … … 20 20 </activity> 21 21 <activity 22 android:name=".MenuPage" 23 android:label="@string/title_activity_issm" > 24 </activity> 25 <activity 22 26 android:name=".ISSM" 23 27 android:label="@string/title_activity_issm" > -
issm/trunk/src/android/ISSM/jni/Android.mk
r14067 r14310 2 2 my_LOCAL_PATH:=$(LOCAL_PATH) 3 3 4 #include $(LOCAL_PATH)/issmlib\Android.mk5 4 include $(call all-subdir-makefiles) 6 7 5 8 6 LOCAL_PATH := $(my_LOCAL_PATH) … … 12 10 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true 13 11 LOCAL_CFLAGS := -Wno-psabi -DHAVE_CONFIG_H 14 LOCAL_LDLIBS := - llog -ldl12 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -ldl -lm 15 13 LOCAL_MODULE := IssmJni 16 14 LOCAL_SRC_FILES := Main.cpp 17 LOCAL_STATIC_LIBRARIES := libISSMCore 18 15 LOCAL_STATIC_LIBRARIES := libISSMCore libgsl libgslcblas 19 16 include $(BUILD_SHARED_LIBRARY) -
issm/trunk/src/android/ISSM/jni/Application.mk
r14067 r14310 1 APP_STL:= stlport_static1 APP_STL:= gnustl_static 2 2 APP_CPPFLAGS := -frtti 3 3 APP_CPPFLAGS += -fexceptions 4 APP_ABI := armeabi -
issm/trunk/src/android/ISSM/jni/Main.cpp
r14067 r14310 1 1 #include <jni.h> 2 #include "../../../c/android/fac.h"2 #include <android/log.h> 3 3 #include "../../../c/issm.h" 4 4 #include <cstddef> 5 5 #include <stdio.h> 6 /////////////////////////////////////////////////////////////////////////////////////////// 6 #include <android/log.h> 7 7 8 namespace com_example_issm 8 9 { 9 fac* f;10 /*Global variables{{{*/ 10 11 FemModel *fm; 11 //------------------------------------------------------------------------------------ 12 jint initilize(JNIEnv *env, jclass clazz, jstring file) 12 double* xyz; /*keep vertices information here*/ 13 /*}}}*/ 14 jint Initialize(JNIEnv *env, jclass clazz, jstring jsolution_type, jstring jabsfile, jstring jrelfile) /*{{{*/ 13 15 { 14 char *nativefile = (char*)env->GetStringUTFChars(file,0); 16 17 /*arguments to constructor: */ 18 int argc; //arguments to constructor. 19 char** argv = NULL; 20 COMM communicator = 1; //fake communicator for constructor 21 const char* issmname = "issm.exe"; 22 char *solution_type = NULL; 23 char *absfile = NULL; 24 char *relfile = NULL; 15 25 16 f = new fac(); 26 /*log:*/ 27 __android_log_print(ANDROID_LOG_INFO, "Native","Initializing FemModel"); 17 28 18 //call Model constructor passing in infile as File Descriptor parameter. 19 fm = new FemModel(nativefile); 29 /*retrieve from java machine: */ 30 solution_type = (char*)env->GetStringUTFChars(jsolution_type,0); 31 absfile = (char*)env->GetStringUTFChars(jabsfile,0); 32 relfile = (char*)env->GetStringUTFChars(jrelfile,0); 20 33 21 env->ReleaseStringUTFChars(file, nativefile); //must realease the char* 22 //jint size = (jint) fm->bufferSize(); 23 //return size; 34 /*creat arguments to call constructor for FemModel: */ 35 argc=4; 36 argv=(char**)malloc(argc*sizeof(char*)); 37 argv[0]=(char*)issmname; 38 argv[1]=solution_type; 39 argv[2]=absfile; 40 argv[3]=relfile; 41 42 /*call Model constructor passing in infile as File Descriptor parameter.*/ 43 fm = new FemModel(argc,argv,communicator); 24 44 25 return 0; //return 0 for now. 45 /*release strings: */ 46 env->ReleaseStringUTFChars(jsolution_type, solution_type); //must realease the char* 47 env->ReleaseStringUTFChars(jabsfile, absfile); //must realease the char* 48 env->ReleaseStringUTFChars(jrelfile, relfile); //must realease the char* 49 50 /*figure out size of solution: */ 51 __android_log_print(ANDROID_LOG_INFO, "Native","Number of elements"); 52 jint size = (jint) fm->elements->NumberOfElements(); 53 54 /*retrieve vertices x,y and z coordinates: */ 55 __android_log_print(ANDROID_LOG_INFO, "Native","Retrieving vertices"); 56 xyz=fm->vertices->ToXYZ(); 57 58 /*log: */ 59 __android_log_print(ANDROID_LOG_INFO, "Native","Done Initializing FemModel"); 60 61 return size; 62 26 63 } 27 //------------------------------------------------------------------------------------ 28 //fill out the first two slots, extract the same way in java using get(int position) 29 void solve(JNIEnv *env, jclass clazz , jint alpha, jobject buf) 30 { 64 /*}}}*/ 65 void Solve(JNIEnv *env, jclass clazz , jdouble alpha, jobject buf){ /*{{{*/ 66 67 int i,count; 68 double x1,y1,z1,vel1; 69 double x2,y2,z2,vel2; 70 double x3,y3,z3,vel3; 71 int v1,v2,v3,eid; 72 Patch* patch=NULL; 73 74 /*log:*/ 75 __android_log_print(ANDROID_LOG_INFO, "Native","Solving "); 76 77 /*retrieve buffer: */ 31 78 jdouble *dBuf = (jdouble *)env->GetDirectBufferAddress(buf); 32 79 33 //pass bBuff to fem model to allocate data 34 // fm -> solve(dBuf, alpha); 80 /*reset basal friction to what it was before: */ 81 __android_log_print(ANDROID_LOG_INFO, "Native","alpha %g ",alpha); 82 InputDuplicatex(fm->elements,fm->nodes,fm->vertices,fm->loads,fm->materials,fm->parameters,AndroidFrictionCoefficientEnum,FrictionCoefficientEnum); 35 83 36 } 37 //------------------------------------------------------------------------------------ 38 jlong factorial(JNIEnv *env, jclass clazz, jlong n) 84 /*now scale friction by alpha: */ 85 InputScalex(fm->elements,fm->nodes,fm->vertices,fm->loads,fm->materials,fm->parameters,FrictionCoefficientEnum,alpha/100); 86 87 /*solve: */ 88 fm -> Solve(); 89 90 /*retrieve results: */ 91 __android_log_print(ANDROID_LOG_INFO, "Native","Retrieving results "); 92 patch=fm->elements->ResultsToPatch(); 93 94 /*sort out the velocities: */ 95 for(i=0;i<patch->numrows;i++){ 96 if ((patch->values[i*patch->numcols+0])==VelEnum){ 97 98 /*Each row of the Patch object is made of the following information: 99 - the result enum_type, 100 - the step and time, 101 - the id of the element, 102 - the interpolation type, 103 - the vertices ids, 104 - and the values at the nodes (could be different from the vertices) 105 */ 106 eid=(int)patch->values[i*patch->numcols+3]-1; 107 v1=(int)patch->values[i*patch->numcols+5]; 108 x1=xyz[3*(v1-1)+0]; y1=xyz[3*(v1-1)+1]; z1=xyz[3*(v1-1)+2]; 109 110 v2=(int)patch->values[i*patch->numcols+6]; 111 x2=xyz[3*(v2-1)+0]; y2=xyz[3*(v2-1)+1]; z2=xyz[3*(v2-1)+2]; 112 113 v3=(int)patch->values[i*patch->numcols+7]; 114 x3=xyz[3*(v3-1)+0]; y3=xyz[3*(v3-1)+1]; z3=xyz[3*(v3-1)+2]; 115 116 vel1=patch->values[i*patch->numcols+8]; 117 vel2=patch->values[i*patch->numcols+9]; 118 vel3=patch->values[i*patch->numcols+10]; 119 120 /*plug into dBuf: */ 121 /*vertex 1: */ 122 dBuf[12*eid+0]=x1; 123 dBuf[12*eid+1]=y1; 124 dBuf[12*eid+2]=z1; 125 126 /*vertex 2: */ 127 dBuf[12*eid+3]=x2; 128 dBuf[12*eid+4]=y2; 129 dBuf[12*eid+5]=z2; 130 131 /*vertex 3: */ 132 dBuf[12*eid+6]=x3; 133 dBuf[12*eid+7]=y3; 134 dBuf[12*eid+8]=z3; 135 136 /*values at 3 vertices: */ 137 dBuf[12*eid+9]=vel1; 138 dBuf[12*eid+10]=vel2; 139 dBuf[12*eid+11]=vel3; 140 141 } 142 } 143 144 /*for(i=0;i<148;i++){ 145 __android_log_print(ANDROID_LOG_INFO, "Native","%g %g %g | %g %g %g | %g %g %g | %g %g %g\n", 146 dBuf[12*i+0],dBuf[12*i+1],dBuf[12*i+2], 147 dBuf[12*i+3],dBuf[12*i+4],dBuf[12*i+5], 148 dBuf[12*i+6],dBuf[12*i+7],dBuf[12*i+8], 149 dBuf[12*i+9],dBuf[12*i+10],dBuf[12*i+11]); 150 }*/ 151 152 /*delete temporary data:*/ 153 delete patch; 154 155 }/*}}}*/ 156 static JNINativeMethod method_table[] = /*{{{*/ 39 157 { 40 if( f != NULL) 41 return (jlong) (f->factorial(n)); 42 return 0; 43 } 158 {"createISSMModel" ,"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I" , (void *) Initialize}, 159 {"solveISSMModel", "(DLjava/nio/DoubleBuffer;)V", (void *) Solve} 160 }; 161 /*}}}*/ 162 } 44 163 45 //------------------------------------------------------------------------------------46 static JNINativeMethod method_table[] =47 {48 {"fac" , "(J)J" , (void *) factorial},49 {"createISSMModel" ,"(Ljava/lang/String;)I" , (void *) initilize},50 {"processBuffer", "(ILjava/nio/DoubleBuffer;)V", (void *) solve}51 };52 }53 //------------------------------------------------------------------------------------54 164 using namespace com_example_issm; 55 56 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) 165 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) /*{{{*/ 57 166 { 58 167 JNIEnv* env; … … 72 181 } 73 182 } 74 / //////////////////////////////////////////////////////////////////////////////////////////183 /*}}}*/ -
issm/trunk/src/android/ISSM/jni/issmlib/Android.mk
r14067 r14310 2 2 include $(CLEAR_VARS) 3 3 LOCAL_MODULE := libISSMCore 4 LOCAL_SRC_FILES := libISSMCore.a 4 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog 5 LOCAL_SRC_FILES := ../../../../../lib/libISSMCore.a 5 6 LOCAL_EXPORT_C_INCLUDES := $(ISSM_DIR) 6 7 include $(PREBUILT_STATIC_LIBRARY) 8 -
issm/trunk/src/android/ISSM/project.properties
r13890 r14310 12 12 13 13 # Project target. 14 target=android-1 514 target=android-16 -
issm/trunk/src/android/ISSM/src/com/example/issm/ISSM.java
r14067 r14310 1 1 package com.example.issm; 2 2 3 import java.io.IOException;4 import java.io.InputStream;5 3 import java.nio.ByteBuffer; 6 4 import java.nio.ByteOrder; 7 5 import java.nio.DoubleBuffer; 8 6 import android.opengl.GLSurfaceView; 7 import android.os.AsyncTask; 9 8 import android.os.Bundle; 10 9 import android.app.Activity; 11 import android.content.res.AssetManager; 12 import android.text.TextUtils; 10 import android.app.ProgressDialog; 13 11 import android.view.Menu; 12 import android.view.MenuInflater; 13 import android.view.MenuItem; 14 14 import android.view.View; 15 15 import android.view.View.OnClickListener; 16 import android.view.animation.AccelerateInterpolator; 17 import android.view.animation.Animation; 18 import android.view.animation.TranslateAnimation; 16 19 import android.widget.Button; 17 import android.widget.EditText; 20 import android.widget.FrameLayout; 21 import android.widget.ImageButton; 22 import android.widget.SeekBar; 23 import android.widget.SeekBar.OnSeekBarChangeListener; 18 24 import android.widget.TextView; 19 20 21 public class ISSM extends Activity implements OnClickListener 25 import android.widget.Toast; 26 import android.widget.ViewFlipper; 27 28 29 public class ISSM extends Activity implements OnClickListener 22 30 { 23 private EditText input;24 private TextView output;25 31 private DoubleBuffer buff; 26 32 private IssmJni issmNative; … … 28 34 private String issmFolder; 29 35 private int size; 36 private GLSurfaceView mGLView; 37 private FrameLayout frame; 38 private VerticalSeekBar bar; 39 private TextView value; 40 private ColorMap colorMap; 41 private int alpha; 42 private final int MINIMUM = 90; 43 private final int OFFSET = 10; 44 private ViewFlipper viewflipper; 45 private ProgressDialog dialog; 46 private ColorBar colorBar; 47 //------------------------------------------------------------------------------------------------ 30 48 @Override 31 //------------------------------------------------------------------------------------------------32 public void onCreate(Bundle savedInstanceState){49 public void onCreate(Bundle savedInstanceState) 50 { 33 51 super.onCreate(savedInstanceState); 34 Bundle map = getIntent().getExtras(); 52 setContentView(R.layout.main_issm); 53 this.initialize(); 54 } 55 //---------------------------------------------------------------------------------------------- 56 private void initialize() 57 { 58 Bundle map = getIntent().getExtras(); 35 59 { 36 60 if(map!= null) 37 61 { 38 mapName = map.getString("map");39 62 issmFolder = map.getString("pathToFile"); 40 63 } 41 64 } 42 setContentView(R.layout.activity_issm); 43 this.input = (EditText) super.findViewById(R.id.input); 44 this.output = (TextView) super.findViewById(R.id.output); 45 Button button = (Button) super.findViewById(R.id.button1); 46 button.setOnClickListener(this); 65 alpha = MINIMUM + OFFSET; 66 frame = (FrameLayout)findViewById(R.id.frame); 67 viewflipper = (ViewFlipper) findViewById(R.id.flipper); 68 this.bar = (VerticalSeekBar) findViewById(R.id.seekbar); 69 this.value = (TextView) super.findViewById(R.id.value); 70 Button solve = (Button) super.findViewById(R.id.solve); 71 solve.setOnClickListener(this); 72 Button back = (Button) super.findViewById(R.id.back); 73 back.setOnClickListener(this); 74 ImageButton gl = (ImageButton) findViewById(R.id.greenland); 75 gl.setOnClickListener(this); 76 ImageButton art = (ImageButton) findViewById(R.id.antarctica); 77 art.setOnClickListener(this); 78 bar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() 79 { 80 public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) 81 { 82 83 alpha = progress + OFFSET; 84 value.setText("" + alpha + "%"); 85 } 86 87 @Override 88 public void onStartTrackingTouch(SeekBar seekBar) {} 89 90 @Override 91 public void onStopTrackingTouch(SeekBar seekBar) {} 92 }); 93 94 //load up the ISSM library and create double buffer in java 95 //which later on will be pass for native for allocation. 96 issmNative = new IssmJni(); 47 97 48 // load up the ISSM library and create double buffer in java49 //which later on will be pass for native allocation.50 issmNative = new IssmJni();51 buff = ByteBuffer.allocateDirect(15*8).order(ByteOrder.nativeOrder()).asDoubleBuffer();52 this.createModel();98 //set default color map to be HSV 99 this.colorMap = new ColorMap(); 100 //create colorBar 101 colorBar = new ColorBar(this); 102 colorBar.setColorMap(colorMap); 53 103 } 54 104 //------------------------------------------------------------------------------------------------ 55 105 public void createModel() 56 106 { 107 String solution_type="DiagnosticSolution"; 57 108 String file = ""; 58 109 if( mapName.equals("greenland")) 59 110 { 60 file = "test102.petsc"; 61 } 62 else file = "test102.petsc"; 63 size = issmNative.createISSMModel(issmFolder + file); 64 } 65 //------------------------------------------------------------------------------------------------ 66 public void fillBuffer() 67 { 68 issmNative.processBuffer(5,buff); 69 } 70 //------------------------------------------------------------------------------------------------ 111 file = "greenland"; 112 } 113 else file = "antarctica"; 114 115 size = issmNative.createISSMModel(solution_type,issmFolder,file); 116 buff = ByteBuffer.allocateDirect(size*12*8).order(ByteOrder.nativeOrder()).asDoubleBuffer(); 117 } 118 //------------------------------------------------------------------------------------------------ 119 public boolean onCreateOptionsMenu(Menu menu) 120 { 121 MenuInflater menuInflater = getMenuInflater(); 122 menuInflater.inflate(R.menu.issm_menu,menu); 123 124 return true; 125 } 126 //------------------------------------------------------------------------------------------------ 127 //Option Menu that allow user to choose color. 128 public boolean onOptionsItemSelected(MenuItem item) 129 { 130 switch (item.getItemId()) 131 { 132 case R.id.menu_about: 133 Toast.makeText(ISSM.this, "ISSM Application", Toast.LENGTH_SHORT).show(); 134 return true; 135 136 case R.id.cl_autumn: 137 colorMap.setAutumn(); colorBar.setColorMap(colorMap); 138 drawFigure(); 139 return true; 140 141 case R.id.cl_bone: 142 colorMap.setBone(); colorBar.setColorMap(colorMap); 143 drawFigure(); 144 return true; 145 146 case R.id.cl_cool: 147 colorMap.setCool(); colorBar.setColorMap(colorMap); 148 drawFigure(); 149 return true; 150 151 case R.id.cl_copper: 152 colorMap.setCopper(); colorBar.setColorMap(colorMap); 153 drawFigure(); 154 return true; 155 156 case R.id.cl_gray: 157 colorMap.setGray(); colorBar.setColorMap(colorMap); 158 drawFigure(); 159 return true; 160 161 case R.id.cl_hot: 162 colorMap.setGray(); colorBar.setColorMap(colorMap); 163 drawFigure(); 164 return true; 165 166 case R.id.cl_hsv: 167 colorMap.setDefault(); colorBar.setColorMap(colorMap); 168 drawFigure(); 169 return true; 170 171 case R.id.cl_jet: 172 colorMap.setJet(); colorBar.setColorMap(colorMap); 173 drawFigure(); 174 return true; 175 176 case R.id.cl_pink: 177 colorMap.setPink(); colorBar.setColorMap(colorMap); 178 drawFigure(); 179 return true; 180 181 case R.id.cl_spring: 182 colorMap.setSpring(); colorBar.setColorMap(colorMap); 183 drawFigure(); 184 return true; 185 186 case R.id.cl_summer: 187 colorMap.setSummer(); colorBar.setColorMap(colorMap); 188 drawFigure(); 189 return true; 190 191 case R.id.cl_winter: 192 colorMap.setWinter();colorBar.setColorMap(colorMap); 193 drawFigure(); 194 return true; 195 default: 196 return super.onOptionsItemSelected(item); 197 } 198 199 } 200 // 201 202 //--------------------------------------------------------------------------------- 71 203 public void onClick(View view) 72 204 { 73 //factorial method 74 String input = this.input.getText().toString(); 75 if(TextUtils.isEmpty(input)) 76 { 77 return; 78 } 79 long resultfromFac = issmNative.fac(Long.parseLong(input)); 80 //example of how to fill buffer Native 81 this.fillBuffer(); 205 switch(view.getId()) 206 { 207 case R.id.greenland: 208 { 209 mapName= "greenland"; 210 viewflipper.setInAnimation(inFromRightAnimation()); 211 viewflipper.setOutAnimation(outToLeftAnimation()); 212 viewflipper.showNext(); 213 //create FemModel in native code and return the size of the model 214 this.createModel(); 215 break; 216 } 217 case R.id.antarctica: 218 { 219 mapName= "antarctica"; 220 viewflipper.setInAnimation(inFromRightAnimation()); 221 viewflipper.setOutAnimation(outToLeftAnimation()); 222 viewflipper.showNext(); 223 //create FemModel in native code and return the size of the model 224 this.createModel(); 225 break; 226 } 227 case R.id.back: 228 { 229 frame.removeView(mGLView); 230 viewflipper.setInAnimation(inFromLeftAnimation()); 231 viewflipper.setOutAnimation(outToRightAnimation()); 232 viewflipper.showPrevious(); 233 break; 234 } 235 case R.id.solve: 236 { 237 dialog = new ProgressDialog(view.getContext()); 238 dialog.setCancelable(true); 239 dialog.setMessage("Loading View. Please Wait ..."); 240 dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 241 dialog.setProgress(0); 242 dialog.setMax(100); 243 new CalculationTask().execute(alpha); 244 break; 245 } 246 } 247 } 248 //---------------------------------------------------------------------------------- 249 public void drawFigure() 250 { 251 frame.removeAllViews(); 252 mGLView = new MyGLSurfaceView(this, buff, size, colorMap); 253 frame.addView(mGLView); 254 //frame.addView(colorBar); 255 } 256 //------------------------------------------------------------------------------------ 257 //AsyncTask will allow to display while doing some task in the background 258 private class CalculationTask extends AsyncTask<Integer,Integer,Boolean> 259 { 260 @Override 261 protected Boolean doInBackground(Integer... target) 262 { 263 Thread thread = new Thread() 264 { 265 public void run() 266 { 267 for(int i = 0; i <= 100; i+=5) 268 { 269 try { 270 Thread.sleep(300); 271 } catch (InterruptedException e) { 272 // TODO Auto-generated catch block 273 e.printStackTrace(); 274 } 275 publishProgress(i); 276 } 277 } 278 }; 279 thread.start(); 280 issmNative.solveISSMModel(target[0],buff); 281 return true; 282 } 82 283 83 //print result from fac and the first two slot of filled buffer. 84 this.output.setText("Result = " + resultfromFac + "\n" 85 + "First slot from buffer:\n" 86 + buff.get(0) + " size " + size); 87 88 } 284 protected void onPreExecute() 285 { 286 super.onPostExecute(null); 287 dialog.show(); 288 } 289 protected void onProgressUpdate(Integer ... value) 290 { 291 super.onProgressUpdate(); 292 dialog.setProgress(value[0]); 293 } 294 protected void onPostExecute(Boolean result) 295 { 296 super.onPostExecute(result); 297 dialog.dismiss(); 298 if(result) drawFigure(); 299 } 300 301 } 302 //----------------------------------------------------------------------------------- 303 304 // Below are implementation for the animation between map selection and core computation 305 306 private Animation inFromRightAnimation() { 307 308 Animation inFromRight = new TranslateAnimation( 309 Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, 310 Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f 311 ); 312 inFromRight.setDuration(500); 313 inFromRight.setInterpolator(new AccelerateInterpolator()); 314 return inFromRight; 315 } 316 private Animation outToLeftAnimation() { 317 Animation outtoLeft = new TranslateAnimation( 318 Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, 319 Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f 320 ); 321 outtoLeft.setDuration(500); 322 outtoLeft.setInterpolator(new AccelerateInterpolator()); 323 return outtoLeft; 324 } 325 326 private Animation inFromLeftAnimation() { 327 Animation inFromLeft = new TranslateAnimation( 328 Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, 329 Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f 330 ); 331 inFromLeft.setDuration(500); 332 inFromLeft.setInterpolator(new AccelerateInterpolator()); 333 return inFromLeft; 334 } 335 private Animation outToRightAnimation() { 336 Animation outtoRight = new TranslateAnimation( 337 Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, +1.0f, 338 Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f 339 ); 340 outtoRight.setDuration(500); 341 outtoRight.setInterpolator(new AccelerateInterpolator()); 342 return outtoRight; 343 } 344 //------------------------------------------------------------------------------------------- 89 345 } 346 ///////////////////////////////////////////////////////////////////////////////////////////// -
issm/trunk/src/android/ISSM/src/com/example/issm/IssmJni.java
r14067 r14310 4 4 class IssmJni 5 5 { 6 public native long fac(long n); 7 public native void processBuffer(int alpha, DoubleBuffer buff); 8 public native int createISSMModel(String file); 6 public native void solveISSMModel(double alpha, DoubleBuffer buff); 7 public native int createISSMModel(String solution_type, String absfile, String relfile); 9 8 static 10 9 { -
issm/trunk/src/android/ISSM_Visual/AndroidManifest.xml
r13958 r14310 1 1 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 package=" com.example.issm_visual"2 package="gov.nasa.jpl.issm.visual" 3 3 android:versionCode="1" 4 4 android:versionName="1.0" > -
issm/trunk/src/android/ISSM_Visual/bin
- Property svn:ignore
-
old new 1 classes 1 2 *.apk
-
- Property svn:ignore
-
issm/trunk/src/android/ISSM_Visual/bin/AndroidManifest.xml
r13958 r14310 1 1 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 package=" com.example.issm_visual"2 package="gov.nasa.jpl.issm.visual" 3 3 android:versionCode="1" 4 4 android:versionName="1.0" > -
issm/trunk/src/android/ISSM_Visual/gen
-
Property svn:ignore
set to
gov
-
Property svn:ignore
set to
-
issm/trunk/src/android/ISSM_Visual/res/layout/activity_issmvisual.xml
r13958 r14310 15 15 16 16 <TextView 17 android:id="@+id/ status"17 android:id="@+id/value" 18 18 android:layout_width="wrap_content" 19 19 android:layout_height="wrap_content" 20 20 android:layout_above="@+id/seekBar" 21 21 android:layout_centerHorizontal="true" 22 android:layout_marginBottom="1 6dp"23 android:text=" Status:" />22 android:layout_marginBottom="15dp" 23 android:text="alpha value = 0" /> 24 24 25 25 <FrameLayout … … 31 31 android:layout_above="@+id/value" 32 32 android:layout_centerHorizontal="true" 33 android:layout_marginBottom="1 6dp" >33 android:layout_marginBottom="12dp" > 34 34 </FrameLayout> 35 35 36 < TextView37 android:id="@+id/ value"36 <Button 37 android:id="@+id/button1" 38 38 android:layout_width="wrap_content" 39 39 android:layout_height="wrap_content" 40 android:layout_above="@+id/status" 41 android:layout_alignRight="@+id/status" 42 android:layout_centerHorizontal="true" 43 android:layout_marginBottom="16dp" 44 android:text="Value: " /> 40 android:layout_above="@+id/seekBar" 41 android:layout_alignParentRight="true" 42 android:text="Reset" /> 45 43 46 44 </RelativeLayout> -
issm/trunk/src/c/Container/DataSet.cpp
r13975 r14310 178 178 /*Check index in debugging mode*/ 179 179 _assert_(this!=NULL); 180 _assert_(offset>=0); 180 181 _assert_(offset<this->Size()); 181 182 -
issm/trunk/src/c/Container/Observations.cpp
r14067 r14310 45 45 IssmPDouble offset,minlength,minspacing,mintrimming,maxtrimming; 46 46 Observation *observation = NULL; 47 48 /*Check that observations is not empty*/ 49 if(n==0) _error_("No observation found"); 47 50 48 51 /*Get extrema*/ … … 122 125 /*Output and Intermediaries*/ 123 126 int nobs,i,index; 124 IssmPDouble h 2,hmin2,radius2;127 IssmPDouble hmin,h2,hmin2,radius2; 125 128 int *indices = NULL; 126 129 Observation *observation = NULL; … … 128 131 /*If radius is not provided or is 0, return all observations*/ 129 132 if(radius==0) radius=this->quadtree->root->length; 133 134 /*First, find closest point in Quadtree (fast but might not be the true closest obs)*/ 135 this->quadtree->ClosestObs(&index,x_interp,y_interp); 136 if(index>=0){ 137 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(index)); 138 hmin = sqrt((observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp)); 139 if(hmin<radius) radius=hmin; 140 } 130 141 131 142 /*Compute radius square*/ … … 137 148 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[i])); 138 149 h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp); 139 140 150 if(i==0){ 141 151 hmin2 = h2; 142 index = i ;152 index = indices[i]; 143 153 } 144 154 else{ 145 155 if(h2<hmin2){ 146 156 hmin2 = h2; 147 index = i ;157 index = indices[i]; 148 158 } 149 159 } … … 151 161 152 162 /*Assign output pointer*/ 153 if(!nobs){ 163 if(index>=0){ 164 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(index)); 165 *px=observation->x; 166 *py=observation->y; 167 *pobs=observation->value; 168 } 169 else{ 170 154 171 *px=UNDEF; 155 172 *py=UNDEF; 156 173 *pobs=UNDEF; 157 174 } 158 else{159 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[index]));160 *px=observation->x;161 *py=observation->y;162 *pobs=observation->value;163 }164 175 xDelete<int>(indices); 165 176 177 }/*}}}*/ 178 /*FUNCTION Observations::Distances{{{*/ 179 void Observations::Distances(IssmPDouble* distances,IssmPDouble *x,IssmPDouble *y,int n,IssmPDouble radius){ 180 181 IssmPDouble xi,yi,obs; 182 183 for(int i=0;i<n;i++){ 184 this->ClosestObservation(&xi,&yi,&obs,x[i],y[i],radius); 185 if(xi==UNDEF && yi==UNDEF) 186 distances[i]=UNDEF; 187 else 188 distances[i]=sqrt( (x[i]-xi)*(x[i]-xi) + (y[i]-yi)*(y[i]-yi) ); 189 } 166 190 }/*}}}*/ 167 191 /*FUNCTION Observations::ObservationList(IssmPDouble **px,IssmPDouble **py,IssmPDouble **pobs,int* pnobs,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius,int maxdata){{{*/ -
issm/trunk/src/c/Container/Observations.h
r14067 r14310 27 27 /*Methods*/ 28 28 void ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius); 29 void Distances(IssmPDouble* distances,IssmPDouble *x,IssmPDouble *y,int n,IssmPDouble radius); 29 30 void InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power); 30 31 void InterpolationV4(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata); -
issm/trunk/src/c/Container/Vertices.cpp
r13975 r14310 199 199 } 200 200 /*}}}*/ 201 /*FUNCTION Vertices::ToXYZ{{{*/ 202 IssmDouble* Vertices::ToXYZ(void){ 203 204 /*intermediary: */ 205 int i; 206 int my_rank; 207 int num_vertices; 208 209 /*output: */ 210 Matrix<IssmDouble>* xyz = NULL; 211 IssmDouble* xyz_serial=NULL; 212 213 /*recover my_rank:*/ 214 my_rank=IssmComm::GetRank(); 215 216 /*First, figure out number of vertices: */ 217 num_vertices=this->NumberOfVertices(); 218 219 /*Now, allocate matrix to hold all the vertices x,y and z values: */ 220 xyz= new Matrix<IssmDouble>(num_vertices,3); 221 222 /*Go through vertices, and for each vertex, object, report it cpu: */ 223 for(i=0;i<this->Size();i++){ 224 225 /*let vertex fill matrix: */ 226 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 227 vertex->ToXYZ(xyz); 228 } 229 230 /*Assemble:*/ 231 xyz->Assemble(); 232 233 /*gather on cpu 0: */ 234 xyz_serial=xyz->ToSerial(); 235 236 /*free ressources: */ 237 delete xyz; 238 if(my_rank!=0)delete xyz_serial; 239 240 /*return matrix: */ 241 return xyz_serial; 242 } 243 /*}}}*/ -
issm/trunk/src/c/Container/Vertices.h
r13975 r14310 28 28 int NumberOfVertices(void); 29 29 void Ranks(int* ranks); 30 IssmDouble* ToXYZ(void); 30 31 }; 31 32 -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r13975 r14310 196 196 SurfaceforcingsIssmbgradientsEnum, 197 197 SurfaceforcingsMonthlytemperaturesEnum, 198 SurfaceforcingsHcEnum,199 198 SurfaceforcingsHrefEnum, 200 199 SurfaceforcingsSmbrefEnum, 201 SurfaceforcingsSmbPosMaxEnum,202 SurfaceforcingsSmbPosMinEnum,203 SurfaceforcingsAPosEnum,204 200 SurfaceforcingsBPosEnum, 205 SurfaceforcingsANegEnum,206 201 SurfaceforcingsBNegEnum, 207 202 ThermalMaxiterEnum, … … 235 230 BalancethicknessAnalysisEnum, 236 231 BalancethicknessSolutionEnum, 232 WeakBalancethicknessAnalysisEnum, 233 WeakBalancethicknessSolutionEnum, 237 234 BedSlopeAnalysisEnum, 238 235 BedSlopeSolutionEnum, … … 355 352 AdjointyEnum, 356 353 AdjointzEnum, 354 BalancethicknessMisfitEnum, 357 355 BedSlopeXEnum, 358 356 BedSlopeYEnum, … … 382 380 QmuSurfaceEnum, 383 381 QmuMeltingEnum, 382 AndroidFrictionCoefficientEnum, 384 383 ResetPenaltiesEnum, 385 384 SegmentOnIceShelfEnum, … … 425 424 DragCoefficientAbsGradientEnum, 426 425 TransientInputEnum, 427 OutputfilenameEnum,428 426 WaterfractionEnum, 429 427 WatercolumnEnum, -
issm/trunk/src/c/Makefile.am
r13975 r14310 1 AM_CPPFLAGS = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ 1 AM_CPPFLAGS = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @ANDROID_NDKINCL@ 2 2 3 3 EXEEXT=$(ISSMEXT) … … 475 475 ./modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp\ 476 476 ./modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp\ 477 ./solutions/balancethickness_core.cpp 477 ./solutions/balancethickness_core.cpp \ 478 ./solutions/dummy_core.cpp 478 479 #}}} 479 480 #Slope sources {{{ … … 499 500 #}}} 500 501 #Android sources {{{ 501 android_sources = ./android/fac.h\ 502 ./android/fac.cpp 502 android_sources = 503 503 #}}} 504 504 #3D sources {{{ … … 627 627 ./modules/Kml2Expx/Kml2Expx.h\ 628 628 ./modules/Kml2Expx/Kml2Expx.cpp\ 629 ./modules/Shp2Expx/Shp2Expx.h\ 630 ./modules/Shp2Expx/Shp2Expx.cpp\ 629 631 ./modules/Shp2Kmlx/Shp2Kmlx.h\ 630 632 ./modules/Shp2Kmlx/Shp2Kmlx.cpp\ … … 739 741 ./shared/Exp/IsInPoly.cpp\ 740 742 ./shared/Exp/IsInPolySerial.cpp\ 741 ./shared/Exp/ DomainOutlineWrite.cpp\743 ./shared/Exp/ExpWrite.cpp\ 742 744 ./shared/TriMesh/trimesh.h\ 743 745 ./shared/TriMesh/AssociateSegmentToElement.cpp\ … … 781 783 ./modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp\ 782 784 ./modules/MeshProfileIntersectionx/MeshProfileIntersectionx.h\ 783 ./modules/MeshProfileIntersectionx/MeshSegmentsIntersection.cpp\784 ./modules/MeshProfileIntersectionx/ElementSegmentsIntersection.cpp\785 ./modules/MeshProfileIntersectionx/ElementSegment.cpp\786 ./modules/MeshProfileIntersectionx/SegmentIntersect.cpp\787 ./modules/MeshProfileIntersectionx/NodeInElement.cpp\788 785 ./modules/ContourToMeshx/ContourToMeshx.cpp\ 789 786 ./modules/ContourToMeshx/ContourToMeshxt.cpp\ -
issm/trunk/src/c/classes/FemModel.cpp
r14067 r14310 20 20 21 21 /*Object constructors and destructor*/ 22 /*FUNCTION FemModel::FemModel(char* filename) {{{*/23 FemModel::FemModel(char* filename){24 25 }26 /*}}}*/27 22 /*FUNCTION FemModel::FemModel(int argc,char** argv){{{*/ 28 23 FemModel::FemModel(int argc,char** argv,COMM incomm){ … … 707 702 case ThicknessAlongGradientEnum: ThicknessAlongGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; 708 703 case ThicknessAcrossGradientEnum:ThicknessAcrossGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; 704 case BalancethicknessMisfitEnum:BalancethicknessMisfitx(responses,process_units,weight_index); break; 709 705 case TotalSmbEnum: this->TotalSmbx(responses,process_units); break; 710 706 case RheologyBbarAbsGradientEnum:RheologyBbarAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break; … … 1363 1359 #endif 1364 1360 #ifdef _HAVE_CONTROL_ 1361 void FemModel::BalancethicknessMisfitx(IssmDouble* presponse,bool process_units,int weight_index){/*{{{*/ 1362 1363 IssmDouble J = 0; 1364 IssmDouble J_sum; 1365 1366 for(int i=0;i<this->elements->Size();i++){ 1367 Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i)); 1368 J+=element->BalancethicknessMisfit(process_units,weight_index); 1369 } 1370 #ifdef _HAVE_MPI_ 1371 MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,IssmComm::GetComm() ); 1372 MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,IssmComm::GetComm()); 1373 J=J_sum; 1374 #endif 1375 1376 /*Assign output pointers: */ 1377 *presponse=J; 1378 1379 }/*}}}*/ 1365 1380 void FemModel::ThicknessAbsGradientx( IssmDouble* pJ, bool process_units, int weight_index){/*{{{*/ 1366 1381 -
issm/trunk/src/c/classes/FemModel.h
r14067 r14310 47 47 48 48 /*constructors, destructors: */ 49 FemModel(char* filename);50 49 FemModel(int argc,char** argv,COMM comm_init); 51 50 FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels); … … 81 80 void IceVolumex(IssmDouble* pV,bool process_units); 82 81 void ElementResponsex(IssmDouble* presponse,int response_enum,bool process_units); 82 void BalancethicknessMisfitx(IssmDouble* pV,bool process_units,int weight_index); 83 83 #endif 84 84 #ifdef _HAVE_DAKOTA_ -
issm/trunk/src/c/classes/IssmComm.cpp
r13975 r14310 11 11 #include "./IssmComm.h" 12 12 #include "../include/types.h" 13 #include "../include/macros.h" 14 #include "../shared/Exceptions/exceptions.h" 13 15 14 16 void IssmComm::SetComm(COMM incomm){ /*{{{*/ 15 comm=incomm; 17 18 /*A comm is provided, we are running in parallel (this is not a module)*/ 19 parallel = true; 20 comm = incomm; 21 22 }/*}}}*/ 23 void IssmComm::SetComm(void){ /*{{{*/ 24 25 /*no comm provided, This is a matlab/python module*/ 26 parallel = false; 27 28 /*No need to initialise comm*/ 29 16 30 }/*}}}*/ 17 31 COMM IssmComm::GetComm(){ /*{{{*/ 32 if(!parallel) _error_("Cannot return comm in serial mode"); 18 33 return comm; 19 34 }/*}}}*/ 20 35 int IssmComm::GetRank(){ /*{{{*/ 36 21 37 int my_rank = 0; 22 23 /*for matlab and python modules , comm == -1*/24 if( (int)comm==-1) return my_rank;38 39 /*for matlab and python modules*/ 40 if(!parallel) return my_rank; 25 41 26 42 #ifdef _HAVE_MPI_ … … 35 51 int size = 1; 36 52 37 /*for matlab and python modules , comm == -1*/38 if( (int)comm==-1) return size;53 /*for matlab and python modules*/ 54 if(!parallel) return size; 39 55 40 56 #ifdef _HAVE_MPI_ -
issm/trunk/src/c/classes/IssmComm.h
r13975 r14310 21 21 private: 22 22 static COMM comm; 23 static bool parallel; 23 24 24 25 public: 25 26 static void SetComm(COMM incomm); 26 static COMM GetComm(); 27 static int GetRank(); 28 static int GetSize(); 27 static void SetComm(void); 28 static COMM GetComm(void); 29 static int GetRank(void); 30 static int GetSize(void); 29 31 }; 30 32 -
issm/trunk/src/c/classes/RiftStruct.cpp
r13975 r14310 22 22 23 23 }/*}}}*/ 24 RiftStruct::RiftStruct(int numrifts_in,int *riftsnumsegments_in, double **riftssegments_in,int *riftsnumpairs_in,double **riftspairs_in,int *riftsnumpenaltypairs_in,double **riftspenaltypairs_in,double* riftstips_in){/*{{{*/24 RiftStruct::RiftStruct(int numrifts_in,int *riftsnumsegments_in,int**riftssegments_in,int *riftsnumpairs_in,int**riftspairs_in,int *riftsnumpenaltypairs_in,double **riftspenaltypairs_in,int * riftstips_in){/*{{{*/ 25 25 26 26 int i; … … 37 37 /*riftssegments*/ 38 38 _assert_(riftssegments_in); 39 this->riftssegments=xNew< double*>(numrifts_in);39 this->riftssegments=xNew<int*>(numrifts_in); 40 40 for(i=0;i<numrifts_in;i++){ 41 this->riftssegments[i]=xNew< double>(riftsnumsegments_in[i]*3);42 xMemCpy< double>(this->riftssegments[i],riftssegments_in[i],riftsnumsegments_in[i]*3);41 this->riftssegments[i]=xNew<int>(riftsnumsegments_in[i]*3); 42 xMemCpy<int>(this->riftssegments[i],riftssegments_in[i],riftsnumsegments_in[i]*3); 43 43 } 44 44 … … 50 50 /*riftspairs*/ 51 51 _assert_(riftspairs_in); 52 this->riftspairs=xNew< double*>(numrifts_in);52 this->riftspairs=xNew<int*>(numrifts_in); 53 53 for(i=0;i<numrifts_in;i++){ 54 this->riftspairs[i]=xNew< double>(riftsnumpairs_in[i]*2);55 xMemCpy< double>(this->riftspairs[i],riftspairs_in[i],riftsnumpairs_in[i]*2);54 this->riftspairs[i]=xNew<int>(riftsnumpairs_in[i]*2); 55 xMemCpy<int>(this->riftspairs[i],riftspairs_in[i],riftsnumpairs_in[i]*2); 56 56 } 57 57 … … 71 71 /*riftstips*/ 72 72 _assert_(riftstips_in); 73 this->riftstips=xNew< double>(2*numrifts_in);74 xMemCpy< double>(this->riftstips,riftstips_in,2*numrifts_in);73 this->riftstips=xNew<int>(2*numrifts_in); 74 xMemCpy<int>(this->riftstips,riftstips_in,2*numrifts_in); 75 75 76 76 /*state*/ … … 85 85 86 86 xDelete<int>(this->riftsnumsegments); 87 xDelete< double*>(this->riftssegments);87 xDelete<int*>(this->riftssegments); 88 88 xDelete<int>(this->riftsnumpairs); 89 xDelete< double*>(this->riftspairs);89 xDelete<int*>(this->riftspairs); 90 90 xDelete<int>(this->riftsnumpenaltypairs); 91 91 xDelete<double*>(this->riftspenaltypairs); 92 xDelete< double>(this->riftstips);92 xDelete<int>(this->riftstips); 93 93 xDelete<double*>(this->state); 94 94 -
issm/trunk/src/c/classes/RiftStruct.h
r13975 r14310 10 10 public: 11 11 int numrifts; 12 double**riftssegments;12 int **riftssegments; 13 13 int *riftsnumsegments; 14 double**riftspairs;14 int **riftspairs; 15 15 int *riftsnumpairs; 16 16 double **riftspenaltypairs; 17 17 int *riftsnumpenaltypairs; 18 double*riftstips;18 int *riftstips; 19 19 double **state; 20 20 21 21 RiftStruct(); 22 RiftStruct(int numrifts_in,int *riftsnumsegments_in, double **riftssegments_in,int *riftsnumpairs_in,double **riftspairs_in,int *riftsnumpenaltypairs_in,double **riftspenaltypairs_in,double* riftstips_in);22 RiftStruct(int numrifts_in,int *riftsnumsegments_in,int **riftssegments_in,int *riftsnumpairs_in,int **riftspairs_in,int *riftsnumpenaltypairs_in,double **riftspenaltypairs_in,int* riftstips_in); 23 23 ~RiftStruct(); 24 24 }; -
issm/trunk/src/c/classes/bamg/Mesh.cpp
r13975 r14310 899 899 } 900 900 //Build output 901 connectivitymax_2++;//add last column for size 901 902 bamgmesh->NodalConnectivitySize[0]=nbv; 902 903 bamgmesh->NodalConnectivitySize[1]=connectivitymax_2; 903 904 bamgmesh->NodalConnectivity=xNew<double>(connectivitymax_2*nbv); 904 for (i=0;i<connectivitymax_2*nbv;i++) bamgmesh->NodalConnectivity[i]= NAN;905 for (i=0;i<connectivitymax_2*nbv;i++) bamgmesh->NodalConnectivity[i]=0; 905 906 for (i=0;i<nbv;i++){ 906 907 k=0; … … 917 918 k++; 918 919 } 920 bamgmesh->NodalConnectivity[connectivitymax_2*(i+1)-1]=k; 919 921 } 920 922 -
issm/trunk/src/c/classes/objects/Elements/Element.h
r13975 r14310 110 110 virtual IssmDouble ThicknessAlongGradient(bool process_units,int weight_index)=0; 111 111 virtual IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index)=0; 112 virtual IssmDouble BalancethicknessMisfit(bool process_units,int weight_index)=0; 112 113 virtual IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index)=0; 113 114 virtual IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index)=0; -
issm/trunk/src/c/classes/objects/Elements/Penta.cpp
r14067 r14310 2727 2727 2728 2728 /*Recover SmbGradients*/ 2729 GetInputListOnVertices(&Hc[0],SurfaceforcingsHcEnum);2730 2729 GetInputListOnVertices(&Href[0],SurfaceforcingsHrefEnum); 2731 2730 GetInputListOnVertices(&Smbref[0],SurfaceforcingsSmbrefEnum); 2732 GetInputListOnVertices(&smb_pos_max[0],SurfaceforcingsSmbPosMaxEnum);2733 GetInputListOnVertices(&smb_pos_min[0],SurfaceforcingsSmbPosMinEnum);2734 GetInputListOnVertices(&a_pos[0],SurfaceforcingsAPosEnum);2735 2731 GetInputListOnVertices(&b_pos[0],SurfaceforcingsBPosEnum); 2736 GetInputListOnVertices(&a_neg[0],SurfaceforcingsANegEnum);2737 2732 GetInputListOnVertices(&b_neg[0],SurfaceforcingsBNegEnum); 2738 2733 … … 2747 2742 // loop over all vertices 2748 2743 for(i=0;i<NUMVERTICES;i++){ 2749 if(s[i]>Hc[i]){ 2750 if(Href[i]>Hc[i]){smb[i]=Smbref[i]+b_pos[i]*(s[i]-Href[i]);} 2751 if(Href[i]<=Hc[i]){smb[i]=a_pos[i]+b_pos[i]*s[i];} 2752 if(smb[i]>smb_pos_max[i]){smb[i]=smb_pos_max[i];} 2753 if(smb[i]<smb_pos_min[i]){smb[i]=smb_pos_min[i];} 2744 if(Smbref[i]>0){ 2745 smb[i]=Smbref[i]+b_pos[i]*(s[i]-Href[i]); 2754 2746 } 2755 2747 else{ 2756 if(Href[i]>Hc[i]){smb[i]=a_neg[i]+b_neg[i]*s[i];} 2757 if(Href[i]<=Hc[i]){smb[i]=Smbref[i]+b_neg[i]*(s[i]-Href[i]);} 2748 smb[i]=Smbref[i]+b_neg[i]*(s[i]-Href[i]); 2758 2749 } 2759 2750 smb[i]=smb[i]/rho_ice; // SMB in m/y ice -
issm/trunk/src/c/classes/objects/Elements/Penta.h
r13975 r14310 166 166 IssmDouble ThicknessAlongGradient( bool process_units,int weight_index){_error_("not supported");}; 167 167 IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index){_error_("not supported");}; 168 IssmDouble BalancethicknessMisfit(bool process_units,int weight_index){_error_("not supported");}; 168 169 void InputControlUpdate(IssmDouble scalar,bool save_parameter); 169 170 #endif -
issm/trunk/src/c/classes/objects/Elements/Tria.cpp
r13975 r14310 1550 1550 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts; 1551 1551 this->inputs->AddInput(new ControlInput(VyEnum,TriaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 1552 } 1553 break; 1554 case ThicknessEnum: 1555 if (iomodel->Data(ThicknessEnum)){ 1556 for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(ThicknessEnum)[tria_vertex_ids[j]-1]; 1557 for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]; 1558 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]; 1559 this->inputs->AddInput(new ControlInput(ThicknessEnum,TriaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 1552 1560 } 1553 1561 break; … … 2317 2325 IssmDouble h[NUMVERTICES]; // ice thickness (m) 2318 2326 IssmDouble s[NUMVERTICES]; // surface elevation (m) 2319 IssmDouble a_pos[NUMVERTICES]; // Hs-SMB relation parameter2320 2327 IssmDouble b_pos[NUMVERTICES]; // Hs-SMB relation parameter 2321 IssmDouble a_neg[NUMVERTICES]; // Hs-SMB relation parameter2322 2328 IssmDouble b_neg[NUMVERTICES]; // Hs-SMB relation paremeter 2323 IssmDouble Hc[NUMVERTICES]; // elevation of transition between accumulation regime and ablation regime2324 2329 IssmDouble Href[NUMVERTICES]; // reference elevation from which deviations are used to calculate the SMB adjustment 2325 2330 IssmDouble Smbref[NUMVERTICES]; // reference SMB to which deviations are added 2326 IssmDouble smb_pos_max[NUMVERTICES]; // maximum SMB value in the accumulation regime2327 IssmDouble smb_pos_min[NUMVERTICES]; // minimum SMB value in the accumulation regime2328 2331 IssmDouble rho_water; // density of fresh water 2329 2332 IssmDouble rho_ice; // density of ice … … 2333 2336 2334 2337 /*Recover SmbGradients*/ 2335 GetInputListOnVertices(&Hc[0],SurfaceforcingsHcEnum);2336 2338 GetInputListOnVertices(&Href[0],SurfaceforcingsHrefEnum); 2337 2339 GetInputListOnVertices(&Smbref[0],SurfaceforcingsSmbrefEnum); 2338 GetInputListOnVertices(&smb_pos_max[0],SurfaceforcingsSmbPosMaxEnum);2339 GetInputListOnVertices(&smb_pos_min[0],SurfaceforcingsSmbPosMinEnum);2340 GetInputListOnVertices(&a_pos[0],SurfaceforcingsAPosEnum);2341 2340 GetInputListOnVertices(&b_pos[0],SurfaceforcingsBPosEnum); 2342 GetInputListOnVertices(&a_neg[0],SurfaceforcingsANegEnum);2343 2341 GetInputListOnVertices(&b_neg[0],SurfaceforcingsBNegEnum); 2344 2342 … … 2353 2351 // loop over all vertices 2354 2352 for(i=0;i<NUMVERTICES;i++){ 2355 if(s[i]>Hc[i]){ 2356 if(Href[i]>Hc[i]){smb[i]=Smbref[i]+b_pos[i]*(s[i]-Href[i]);} 2357 if(Href[i]<=Hc[i]){smb[i]=a_pos[i]+b_pos[i]*s[i];} 2358 if(smb[i]>smb_pos_max[i]){smb[i]=smb_pos_max[i];} 2359 if(smb[i]<smb_pos_min[i]){smb[i]=smb_pos_min[i];} 2353 if(Smbref[i]>0){ 2354 smb[i]=Smbref[i]+b_pos[i]*(s[i]-Href[i]); 2360 2355 } 2361 2356 else{ 2362 if(Href[i]>Hc[i]){smb[i]=a_neg[i]+b_neg[i]*s[i];} 2363 if(Href[i]<=Hc[i]){smb[i]=Smbref[i]+b_neg[i]*(s[i]-Href[i]);} 2357 smb[i]=Smbref[i]+b_neg[i]*(s[i]-Href[i]); 2364 2358 } 2365 2359 smb[i]=smb[i]/rho_ice; // SMB in m/y ice 2366 /* printf("s %e \n",s[i]);2367 printf("Hsref %e \n",Href[i]);2368 printf("Hc %e \n",Hc[i]);2369 printf("Smbref %e \n",Smbref[i]);2370 printf("b_neg %e \n",b_neg[i]);2371 printf("smb %e \n",smb[i]);2372 _error_("stop-in-code"); */2373 2360 } //end of the loop over the vertices 2374 2361 /*Update inputs*/ … … 3459 3446 3460 3447 #ifdef _HAVE_CONTROL_ 3448 /*FUNCTION Tria::BalancethicknessMisfit{{{*/ 3449 IssmDouble Tria::BalancethicknessMisfit(bool process_units,int weight_index){ 3450 3451 /* Intermediaries */ 3452 IssmDouble Jelem = 0; 3453 IssmDouble weight; 3454 IssmDouble Jdet,temp; 3455 IssmDouble xyz_list[NUMVERTICES][3]; 3456 IssmDouble dH[2]; 3457 IssmDouble vx,vy,H; 3458 IssmDouble dvx[2],dvy[2]; 3459 IssmDouble dhdt,basal_melting,surface_mass_balance; 3460 GaussTria *gauss = NULL; 3461 3462 /*If on water, return 0: */ 3463 if(IsOnWater()) return 0; 3464 3465 /*Retrieve all inputs we will be needing: */ 3466 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3467 Input* weights_input = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input); 3468 Input* thickness_input = inputs->GetInput(ThicknessEnum); _assert_(thickness_input); 3469 Input* vx_input = inputs->GetInput(VxEnum); _assert_(vx_input); 3470 Input* vy_input = inputs->GetInput(VyEnum); _assert_(vy_input); 3471 Input* surface_mass_balance_input = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(surface_mass_balance_input); 3472 Input* basal_melting_input = inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input); 3473 Input* dhdt_input = inputs->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input); 3474 3475 /* Start looping on the number of gaussian points: */ 3476 gauss=new GaussTria(2); 3477 for(int ig=gauss->begin();ig<gauss->end();ig++){ 3478 3479 gauss->GaussPoint(ig); 3480 3481 /* Get Jacobian determinant: */ 3482 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 3483 3484 /*Get all parameters at gaussian point*/ 3485 weights_input->GetInputValue(&weight,gauss,weight_index); 3486 thickness_input->GetInputValue(&H, gauss); 3487 thickness_input->GetInputDerivativeValue(&dH[0],&xyz_list[0][0],gauss); 3488 surface_mass_balance_input->GetInputValue(&surface_mass_balance,gauss); 3489 basal_melting_input->GetInputValue(&basal_melting,gauss); 3490 dhdt_input->GetInputValue(&dhdt,gauss); 3491 vx_input->GetInputValue(&vx,gauss); 3492 vx_input->GetInputDerivativeValue(&dvx[0],&xyz_list[0][0],gauss); 3493 vy_input->GetInputValue(&vy,gauss); 3494 vy_input->GetInputDerivativeValue(&dvy[0],&xyz_list[0][0],gauss); 3495 3496 /*Weak balance thickness J = 1/2 (div(Hv)-a)^2*/ 3497 temp = vx*dH[0]+vy*dH[1]+H*(dvx[0]+dvy[1]) - (surface_mass_balance-basal_melting-dhdt); 3498 Jelem+=weight*1/2*temp*temp*Jdet*gauss->weight; 3499 } 3500 3501 /*Clean up and return*/ 3502 delete gauss; 3503 return Jelem; 3504 } 3505 /*}}}*/ 3461 3506 /*FUNCTION Tria::InputControlUpdate{{{*/ 3462 3507 void Tria::InputControlUpdate(IssmDouble scalar,bool save_parameter){ … … 3580 3625 GradjVyBalancedthickness(gradient,control_index); 3581 3626 break; 3627 case ThicknessEnum: 3628 GradjThicknessWeakBalancedthickness(gradient,control_index); 3629 break; 3582 3630 default: 3583 3631 _error_("control type not supported yet: " << control_type); … … 3597 3645 case ThicknessAlongGradientEnum: 3598 3646 case ThicknessAcrossGradientEnum: 3647 case BalancethicknessMisfitEnum: 3599 3648 case SurfaceAbsVelMisfitEnum: 3600 3649 case SurfaceRelVelMisfitEnum: … … 4042 4091 /*Clean up and return*/ 4043 4092 delete gauss; 4093 } 4094 /*}}}*/ 4095 /*FUNCTION Tria::GradjThicknessWeakBalancedthickness{{{*/ 4096 void Tria::GradjThicknessWeakBalancedthickness(Vector<IssmDouble>* gradient,int control_index){ 4097 4098 /*Intermediaries */ 4099 int i,resp; 4100 int vertexpidlist[NUMVERTICES]; 4101 IssmDouble Jdet; 4102 IssmDouble thickness,thicknessobs,weight; 4103 int num_responses; 4104 IssmDouble xyz_list[NUMVERTICES][3]; 4105 IssmDouble basis[3]; 4106 IssmDouble dbasis[NDOF2][NUMVERTICES]; 4107 IssmDouble dH[2]; 4108 IssmDouble vx,vy,vel; 4109 IssmDouble dvx[2],dvy[2]; 4110 IssmDouble dhdt,basal_melting,surface_mass_balance; 4111 GaussTria *gauss = NULL; 4112 int *responses = NULL; 4113 IssmDouble grade_g[NUMVERTICES] = {0.0}; 4114 4115 /* Get node coordinates and dof list: */ 4116 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4117 GradientIndexing(&vertexpidlist[0],control_index); 4118 4119 /*Retrieve all inputs and parameters*/ 4120 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4121 this->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum); 4122 this->parameters->FindParam(&responses,NULL,NULL,StepResponsesEnum); 4123 Input* thickness_input = inputs->GetInput(ThicknessEnum); _assert_(thickness_input); 4124 Input* thicknessobs_input = inputs->GetInput(InversionThicknessObsEnum); _assert_(thicknessobs_input); 4125 Input* weights_input = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input); 4126 Input* vx_input = inputs->GetInput(VxEnum); _assert_(vx_input); 4127 Input* vy_input = inputs->GetInput(VyEnum); _assert_(vy_input); 4128 Input* surface_mass_balance_input = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(surface_mass_balance_input); 4129 Input* basal_melting_input = inputs->GetInput(BasalforcingsMeltingRateEnum); _assert_(basal_melting_input); 4130 Input* dhdt_input = inputs->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input); 4131 4132 /* Start looping on the number of gaussian points: */ 4133 gauss=new GaussTria(2); 4134 for(int ig=gauss->begin();ig<gauss->end();ig++){ 4135 4136 gauss->GaussPoint(ig); 4137 4138 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 4139 GetNodalFunctions(basis, gauss); 4140 GetNodalFunctionsDerivatives(&dbasis[0][0],&xyz_list[0][0],gauss); 4141 4142 thickness_input->GetInputValue(&thickness, gauss); 4143 thickness_input->GetInputDerivativeValue(&dH[0],&xyz_list[0][0],gauss); 4144 thicknessobs_input->GetInputValue(&thicknessobs, gauss); 4145 4146 /*Loop over all requested responses*/ 4147 for(resp=0;resp<num_responses;resp++) switch(responses[resp]){ 4148 4149 case ThicknessAbsMisfitEnum: 4150 weights_input->GetInputValue(&weight, gauss,resp); 4151 for(i=0;i<NUMVERTICES;i++) grade_g[i]+= (thicknessobs-thickness)*weight*Jdet*gauss->weight*basis[i]; 4152 break; 4153 case ThicknessAbsGradientEnum: 4154 weights_input->GetInputValue(&weight, gauss,resp); 4155 for(i=0;i<NUMVERTICES;i++) grade_g[i]+= - weight*dH[0]*dbasis[0][i]*Jdet*gauss->weight; 4156 for(i=0;i<NUMVERTICES;i++) grade_g[i]+= - weight*dH[1]*dbasis[1][i]*Jdet*gauss->weight; 4157 break; 4158 case ThicknessAlongGradientEnum: 4159 weights_input->GetInputValue(&weight, gauss,resp); 4160 vx_input->GetInputValue(&vx,gauss); 4161 vy_input->GetInputValue(&vy,gauss); 4162 vel = sqrt(vx*vx+vy*vy); 4163 vx = vx/(vel+1.e-9); 4164 vy = vy/(vel+1.e-9); 4165 for(i=0;i<NUMVERTICES;i++) grade_g[i]+= - weight*(dH[0]*vx+dH[1]*vy)*(dbasis[0][i]*vx+dbasis[1][i]*vy)*Jdet*gauss->weight; 4166 break; 4167 case ThicknessAcrossGradientEnum: 4168 weights_input->GetInputValue(&weight, gauss,resp); 4169 vx_input->GetInputValue(&vx,gauss); 4170 vy_input->GetInputValue(&vy,gauss); 4171 vel = sqrt(vx*vx+vy*vy); 4172 vx = vx/(vel+1.e-9); 4173 vy = vy/(vel+1.e-9); 4174 for(i=0;i<NUMVERTICES;i++) grade_g[i]+= - weight*(dH[0]*(-vy)+dH[1]*vx)*(dbasis[0][i]*(-vy)+dbasis[1][i]*vx)*Jdet*gauss->weight; 4175 break; 4176 case BalancethicknessMisfitEnum: 4177 weights_input->GetInputValue(&weight, gauss,resp); 4178 surface_mass_balance_input->GetInputValue(&surface_mass_balance,gauss); 4179 basal_melting_input->GetInputValue(&basal_melting,gauss); 4180 dhdt_input->GetInputValue(&dhdt,gauss); 4181 vx_input->GetInputValue(&vx,gauss); 4182 vx_input->GetInputDerivativeValue(&dvx[0],&xyz_list[0][0],gauss); 4183 vy_input->GetInputValue(&vy,gauss); 4184 vy_input->GetInputDerivativeValue(&dvy[0],&xyz_list[0][0],gauss); 4185 for(i=0;i<NUMVERTICES;i++){ 4186 grade_g[i]+= - weight*Jdet*gauss->weight*( 4187 (vx*dH[0]+vy*dH[1] + thickness*(dvx[0]+dvy[1]))*(vx*dbasis[0][i]+ vy*dbasis[1][i] + basis[i]*(dvx[0]+dvy[1])) 4188 -(surface_mass_balance-basal_melting-dhdt)*(vx*dbasis[0][i]+ vy*dbasis[1][i] + basis[i]*(dvx[0]+dvy[1])) 4189 ); 4190 } 4191 break; 4192 default: 4193 _error_("response " << EnumToStringx(responses[resp]) << " not supported yet"); 4194 } 4195 } 4196 4197 4198 gradient->SetValues(NUMVERTICES,vertexpidlist,grade_g,ADD_VAL); 4199 4200 /*Clean up and return*/ 4201 delete gauss; 4202 xDelete<int>(responses); 4044 4203 } 4045 4204 /*}}}*/ -
issm/trunk/src/c/classes/objects/Elements/Tria.h
r13975 r14310 153 153 void GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index); 154 154 void GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index); 155 void GradjThicknessWeakBalancedthickness(Vector<IssmDouble>* gradient,int control_index); 155 156 void GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data); 156 157 void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index); … … 164 165 IssmDouble ThicknessAlongGradient( bool process_units,int weight_index); 165 166 IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index); 167 IssmDouble BalancethicknessMisfit( bool process_units,int weight_index); 166 168 IssmDouble SurfaceRelVelMisfit( bool process_units,int weight_index); 167 169 IssmDouble SurfaceLogVelMisfit( bool process_units,int weight_index); -
issm/trunk/src/c/classes/objects/KML/KML_LineString.cpp
r13395 r14310 197 197 x =xNew<IssmDouble>(ncoord); 198 198 y =xNew<IssmDouble>(ncoord); 199 Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 199 if (sgn) { 200 Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 201 } 202 else { 203 memcpy(x,lon,ncoord*sizeof(IssmDouble)); 204 memcpy(y,lat,ncoord*sizeof(IssmDouble)); 205 } 200 206 201 207 /* write header */ -
issm/trunk/src/c/classes/objects/KML/KML_LinearRing.cpp
r13395 r14310 186 186 x =xNew<IssmDouble>(ncoord); 187 187 y =xNew<IssmDouble>(ncoord); 188 Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 188 if (sgn) { 189 Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 190 } 191 else { 192 memcpy(x,lon,ncoord*sizeof(IssmDouble)); 193 memcpy(y,lat,ncoord*sizeof(IssmDouble)); 194 } 189 195 190 196 /* write header */ -
issm/trunk/src/c/classes/objects/KML/KML_Point.cpp
r13395 r14310 166 166 /* convert latitude and longitude to x and y */ 167 167 168 Ll2xyx(&x,&y,&lat,&lon,1,sgn,cm,sp); 168 if (sgn) { 169 Ll2xyx(&x,&y,&lat,&lon,1,sgn,cm,sp); 170 } 171 else { 172 memcpy(&x,&lon,1*sizeof(IssmDouble)); 173 memcpy(&y,&lat,1*sizeof(IssmDouble)); 174 } 169 175 170 176 /* write header */ -
issm/trunk/src/c/classes/objects/Vertex.cpp
r13975 r14310 194 194 } 195 195 /*}}}*/ 196 /*FUNCTION Vertex::ToXYZ {{{*/ 197 void Vertex::ToXYZ(Matrix<IssmDouble>* matrix){ 198 199 IssmDouble xyz[3]; 200 int indices[3]; 201 202 if (this->clone==true) return; 203 204 xyz[0]=x; 205 xyz[1]=y; 206 xyz[2]=z; 207 indices[0]=0; 208 indices[1]=1; 209 indices[2]=2; 210 211 matrix->SetValues(1,&sid,3,&indices[0],&xyz[0],INS_VAL); 212 } 213 /*}}}*/ -
issm/trunk/src/c/classes/objects/Vertex.h
r13975 r14310 13 13 #include "../../include/include.h" 14 14 template <class doubletype> class Vector; 15 template <class doubletype> class Matrix; 15 16 class Parameters; 16 17 class IoModel; … … 53 54 void UpdateClonePids(int* allborderpids); 54 55 void SetClone(int* minranks); 56 void ToXYZ(Matrix<IssmDouble>* matrix); 55 57 }; 56 58 #endif /* _VERTEX_H */ -
issm/trunk/src/c/include/globals.h
r13975 r14310 10 10 11 11 COMM IssmComm::comm; 12 bool IssmComm::parallel; 12 13 13 14 #endif -
issm/trunk/src/c/io/PrintfFunction.cpp
r13975 r14310 8 8 #include "../shared/shared.h" 9 9 #include "../include/include.h" 10 11 #ifdef _HAVE_ANDROID_NDK_ 12 #include <android/log.h> 13 #endif 10 14 11 15 int PrintfFunction(const char* format,...){ … … 58 62 59 63 if(my_rank==0){ 64 #ifdef _HAVE_ANDROID_JNI_ 65 __android_log_print(ANDROID_LOG_INFO, "Native",message.c_str()); 66 #else 60 67 printf("%s\n",message.c_str()); 68 #endif 61 69 } 62 70 return 1; -
issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp
r13975 r14310 201 201 case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients"; 202 202 case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures"; 203 case SurfaceforcingsHcEnum : return "SurfaceforcingsHc";204 203 case SurfaceforcingsHrefEnum : return "SurfaceforcingsHref"; 205 204 case SurfaceforcingsSmbrefEnum : return "SurfaceforcingsSmbref"; 206 case SurfaceforcingsSmbPosMaxEnum : return "SurfaceforcingsSmbPosMax";207 case SurfaceforcingsSmbPosMinEnum : return "SurfaceforcingsSmbPosMin";208 case SurfaceforcingsAPosEnum : return "SurfaceforcingsAPos";209 205 case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos"; 210 case SurfaceforcingsANegEnum : return "SurfaceforcingsANeg";211 206 case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg"; 212 207 case ThermalMaxiterEnum : return "ThermalMaxiter"; … … 238 233 case BalancethicknessAnalysisEnum : return "BalancethicknessAnalysis"; 239 234 case BalancethicknessSolutionEnum : return "BalancethicknessSolution"; 235 case WeakBalancethicknessAnalysisEnum : return "WeakBalancethicknessAnalysis"; 236 case WeakBalancethicknessSolutionEnum : return "WeakBalancethicknessSolution"; 240 237 case BedSlopeAnalysisEnum : return "BedSlopeAnalysis"; 241 238 case BedSlopeSolutionEnum : return "BedSlopeSolution"; … … 346 343 case AdjointyEnum : return "Adjointy"; 347 344 case AdjointzEnum : return "Adjointz"; 345 case BalancethicknessMisfitEnum : return "BalancethicknessMisfit"; 348 346 case BedSlopeXEnum : return "BedSlopeX"; 349 347 case BedSlopeYEnum : return "BedSlopeY"; … … 373 371 case QmuSurfaceEnum : return "QmuSurface"; 374 372 case QmuMeltingEnum : return "QmuMelting"; 373 case AndroidFrictionCoefficientEnum : return "AndroidFrictionCoefficient"; 375 374 case ResetPenaltiesEnum : return "ResetPenalties"; 376 375 case SegmentOnIceShelfEnum : return "SegmentOnIceShelf"; … … 416 415 case DragCoefficientAbsGradientEnum : return "DragCoefficientAbsGradient"; 417 416 case TransientInputEnum : return "TransientInput"; 418 case OutputfilenameEnum : return "Outputfilename";419 417 case WaterfractionEnum : return "Waterfraction"; 420 418 case WatercolumnEnum : return "Watercolumn"; -
issm/trunk/src/c/modules/Krigingx/Krigingx.cpp
r14067 r14310 57 57 else if(strcmp(output,"variomap")==0){ 58 58 observations->Variomap(predictions,x_interp,n_interp); 59 } 60 else if(strcmp(output,"distance")==0){ 61 /*initialize thread parameters: */ 62 gate.n_interp = n_interp; 63 gate.x_interp = x_interp; 64 gate.y_interp = y_interp; 65 gate.radius = radius; 66 gate.mindata = mindata; 67 gate.maxdata = maxdata; 68 gate.variogram = variogram; 69 gate.observations = observations; 70 gate.predictions = predictions; 71 gate.error = error; 72 gate.numdone = xNewZeroInit<int>(num); 73 74 /*launch the thread manager with Krigingxt as a core: */ 75 LaunchThread(Distancest,(void*)&gate,num); 76 xDelete<int>(gate.numdone); 59 77 } 60 78 else if(strcmp(output,"delaunay")==0){ … … 360 378 return NULL; 361 379 }/*}}}*/ 380 /*FUNCTION Distancest{{{*/ 381 void* Distancest(void* vpthread_handle){ 382 383 /*gate variables :*/ 384 KrigingxThreadStruct *gate = NULL; 385 pthread_handle *handle = NULL; 386 int my_thread; 387 int num_threads; 388 int i0,i1; 389 390 /*recover handle and gate: */ 391 handle = (pthread_handle*)vpthread_handle; 392 gate = (KrigingxThreadStruct*)handle->gate; 393 my_thread = handle->id; 394 num_threads = handle->num; 395 396 /*recover parameters :*/ 397 int n_interp = gate->n_interp; 398 double *x_interp = gate->x_interp; 399 double *y_interp = gate->y_interp; 400 double radius = gate->radius; 401 int mindata = gate->mindata; 402 int maxdata = gate->maxdata; 403 Variogram *variogram = gate->variogram; 404 Observations *observations = gate->observations; 405 double *predictions = gate->predictions; 406 double *error = gate->error; 407 int *numdone = gate->numdone; 408 409 /*partition loop across threads: */ 410 PartitionRange(&i0,&i1,n_interp,num_threads,my_thread); 411 observations->Distances(&predictions[i0],&x_interp[i0],&y_interp[i0],i1-i0,radius); 412 return NULL; 413 }/*}}}*/ 362 414 363 415 void ProcessVariogram(Variogram **pvariogram,Options* options){/*{{{*/ -
issm/trunk/src/c/modules/Krigingx/Krigingx.h
r14067 r14310 36 36 void* idwt(void*); 37 37 void* v4t(void*); 38 void* Distancest(void*); 38 39 #endif /* _KRIGINGX_H */ -
issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp
r13975 r14310 4 4 #include "./MeshProfileIntersectionx.h" 5 5 6 void MeshProfileIntersectionx( double** psegments, int* pnumsegs, int* index, double* x, double* y, int nel, int nods, Contour<IssmPDouble>** contours,int numcontours){6 void MeshProfileIntersectionx(double** psegments, int* pnumsegs, int* index, double* x, double* y, int nel, int nods, Contour<IssmPDouble>** contours,int numcontours){/*{{{*/ 7 7 8 8 int i,j,k; … … 20 20 /*intermediary: */ 21 21 double** allsegments=NULL; 22 double* segmentsi=NULL;23 int* allnumsegs=NULL;24 int numsegsi;25 int count;22 double* segmentsi=NULL; 23 int* allnumsegs=NULL; 24 int numsegsi; 25 int count; 26 26 27 27 /*Allocate: */ … … 69 69 *psegments=segments; 70 70 *pnumsegs=numsegs; 71 } 71 }/*}}}*/ 72 void MeshSegmentsIntersection(double** psegments, int* pnumsegs,int* index, double* x, double* y, int nel, int nods, double* xc, double* yc, int numnodes){/*{{{*/ 73 74 int i,j; 75 76 /*output: */ 77 double* segments=NULL; 78 Segment<double>* segment=NULL; 79 int numsegs; 80 81 /*intermediary: */ 82 DataSet* segments_dataset=NULL; 83 double xnodes[3]; 84 double ynodes[3]; 85 86 /*We don't know how many segments we are going to get, so have a dynamic container: */ 87 segments_dataset=new DataSet(); 88 89 /*Go through elements, and call ElementSegmentsIntersection routine: */ 90 for(i=0;i<nel;i++){ 91 for(j=0;j<3;j++){ 92 xnodes[j]=x[*(index+3*i+j)]; 93 ynodes[j]=y[*(index+3*i+j)]; 94 } 95 ElementSegmentsIntersection(segments_dataset,i,xnodes,ynodes,xc,yc,numnodes); 96 } 97 98 /*Using the segments_dataset dataset, create segments: */ 99 numsegs=segments_dataset->Size(); 100 segments=xNew<double>(5*numsegs); 101 for(i=0;i<numsegs;i++){ 102 Segment<double>* segment=(Segment<double>*)segments_dataset->GetObjectByOffset(i); 103 104 /*x1,y1,x2,y2 then element_id: */ 105 segments[5*i+0]=segment->x1; 106 segments[5*i+1]=segment->y1; 107 segments[5*i+2]=segment->x2; 108 segments[5*i+3]=segment->y2; 109 segments[5*i+4]=(double)segment->eid; 110 } 111 112 /*Free ressources:*/ 113 delete segments_dataset; 114 115 /*Assign output pointers:*/ 116 *psegments=segments; 117 *pnumsegs=numsegs; 118 }/*}}}*/ 119 120 /*Utilities*/ 121 void ElementSegmentsIntersection(DataSet* segments_dataset,int el, double* xnodes,double* ynodes,double* xc,double* yc,int numnodes){/*{{{*/ 122 123 double xsegment[2]; 124 double ysegment[2]; 125 126 /*Loop through contour: */ 127 for(int i=0;i<numnodes-1;i++){ 128 xsegment[0]=xc[i]; 129 xsegment[1]=xc[i+1]; 130 ysegment[0]=yc[i]; 131 ysegment[1]=yc[i+1]; 132 ElementSegment(segments_dataset,el, xnodes,ynodes,xsegment,ysegment); 133 } 134 }/*}}}*/ 135 void ElementSegment(DataSet* segments_dataset,int el,double* xnodes,double* ynodes,double* xsegment,double* ysegment){/*{{{*/ 136 137 /*We have a tria element (xnodes,ynodes) and a segment (xsegment,ysegment). Find whether they intersect. 138 * If they do, create a Segment object with the intersection, and add to segments_dataset dataset: */ 139 140 double alpha1,alpha2; 141 double beta1,beta2; 142 double gamma1,gamma2; 143 144 int edge1,edge2,edge3; 145 146 double xel[2],yel[2]; 147 double coord1,coord2; 148 double xfinal[2],yfinal[2]; 149 150 /*edge 1: */ 151 xel[0]=xnodes[0]; yel[0]=ynodes[0]; xel[1]=xnodes[1]; yel[1]=ynodes[1]; 152 edge1=SegmentIntersect(&alpha1,&alpha2, xel,yel,xsegment,ysegment); //alpha1: segment coordinate of intersection. alpha2: same thing for second interesection if it exists (colinear edges) 153 154 /*edge 2: */ 155 xel[0]=xnodes[1]; yel[0]=ynodes[1]; xel[1]=xnodes[2]; yel[1]=ynodes[2]; 156 edge2=SegmentIntersect(&beta1,&beta2, xel,yel,xsegment,ysegment); 157 158 /*edge 3: */ 159 xel[0]=xnodes[2]; yel[0]=ynodes[2]; xel[1]=xnodes[0]; yel[1]=ynodes[0]; 160 edge3=SegmentIntersect(&gamma1,&gamma2, xel,yel,xsegment,ysegment); 161 162 /*edge can be either IntersectEnum (one iand only one intersection between the edge and the segment), ColinearEnum (edge and segment are collinear) and SeparateEnum (no intersection): */ 163 164 if( (edge1==IntersectEnum) && (edge2==IntersectEnum) && (edge3==IntersectEnum) ){ 165 /*This case is impossible: */ 166 _error_("error: a line cannot go through 3 different vertices!"); 167 } 168 else if( ((edge1==IntersectEnum) && (edge2==IntersectEnum)) || ((edge2==IntersectEnum) && (edge3==IntersectEnum)) || ((edge3==IntersectEnum) && (edge1==IntersectEnum)) ){ 169 170 /*segment interscts 2 opposite edges of our triangle, at 2 segment coordinates, pick up the lowest (coord1) and highest (coord2): */ 171 if((edge1==IntersectEnum) && (edge2==IntersectEnum)) {coord1=min(alpha1,beta1); coord2=max(alpha1,beta1);} 172 if((edge2==IntersectEnum) && (edge3==IntersectEnum)) {coord1=min(beta1,gamma1); coord2=max(beta1,gamma1);} 173 if((edge3==IntersectEnum) && (edge1==IntersectEnum)) {coord1=min(gamma1,alpha1); coord2=max(gamma1,alpha1);} 174 175 /*check this segment did not intersect at a vertex of the tria: */ 176 if(coord1!=coord2){ 177 178 xfinal[0]=xsegment[0]+coord1*(xsegment[1]-xsegment[0]); 179 xfinal[1]=xsegment[0]+coord2*(xsegment[1]-xsegment[0]); 180 yfinal[0]=ysegment[0]+coord1*(ysegment[1]-ysegment[0]); 181 yfinal[1]=ysegment[0]+coord2*(ysegment[1]-ysegment[0]); 182 183 segments_dataset->AddObject(new Segment<double>(el+1,xfinal[0],yfinal[0],xfinal[1],yfinal[1])); 184 } 185 else{ 186 /*the segment intersected at the vertex, do not bother with this "0" length segment!:*/ 187 } 188 } 189 else if( (edge1==IntersectEnum) || (edge2==IntersectEnum) || (edge3==IntersectEnum) ){ 190 191 /*segment intersect only 1 edge. Figure out where the first point in the segment is, inside or outside the element, 192 * this will decide the coordinate: */ 193 if (NodeInElement(xnodes,ynodes,xsegment[0],ysegment[0])){ 194 coord1=0; 195 if(edge1==IntersectEnum){coord2=alpha1;} 196 if(edge2==IntersectEnum){coord2=beta1;} 197 if(edge3==IntersectEnum){coord2=gamma1;} 198 } 199 else{ 200 if(edge1==IntersectEnum){coord1=alpha1;} 201 if(edge2==IntersectEnum){coord1=beta1;} 202 if(edge3==IntersectEnum){coord1=gamma1;} 203 coord2=1.0; 204 } 205 206 xfinal[0]=xsegment[0]+coord1*(xsegment[1]-xsegment[0]); 207 xfinal[1]=xsegment[0]+coord2*(xsegment[1]-xsegment[0]); 208 yfinal[0]=ysegment[0]+coord1*(ysegment[1]-ysegment[0]); 209 yfinal[1]=ysegment[0]+coord2*(ysegment[1]-ysegment[0]); 210 211 segments_dataset->AddObject(new Segment<double>(el+1,xfinal[0],yfinal[0],xfinal[1],yfinal[1])); 212 } 213 else{ 214 /*No interesections, but the segment might be entirely inside this triangle!: */ 215 if ( (NodeInElement(xnodes,ynodes,xsegment[0],ysegment[0])) && (NodeInElement(xnodes,ynodes,xsegment[1],ysegment[1])) ){ 216 segments_dataset->AddObject(new Segment<double>(el+1,xsegment[0],ysegment[0],xsegment[1],ysegment[1])); 217 } 218 } 219 }/*}}}*/ 220 bool NodeInElement(double* xnodes, double* ynodes, double x, double y){/*{{{*/ 221 222 double x1,y1; 223 double x2,y2; 224 double x3,y3; 225 double lambda1,lambda2,lambda3; 226 double det; 227 228 x1=xnodes[0]; 229 x2=xnodes[1]; 230 x3=xnodes[2]; 231 y1=ynodes[0]; 232 y2=ynodes[1]; 233 y3=ynodes[2]; 234 235 /*compute determinant: */ 236 det=x1*y2-x1*y3-x3*y2-x2*y1+x2*y3+x3*y1; 237 238 /*area coordinates: */ 239 lambda1=((y2-y3)*(x-x3)+(x3-x2)*(y-y3))/det; 240 lambda2=((y3-y1)*(x-x3)+(x1-x3)*(y-y3))/det; 241 lambda3=1-lambda1-lambda2; 242 243 if( ((lambda1<=1) && (lambda1>=0)) && ((lambda2<=1) && (lambda2>=0)) && ((lambda3<=1) && (lambda3>=0)) )return true; 244 else return false; 245 246 }/*}}}*/ 247 int SegmentIntersect(double* palpha, double* pbeta, double* x1, double* y1, double* x2, double* y2){/*{{{*/ 248 249 /*See ISSM_DIR/src/m/utils/Geometry/SegIntersect.m for matlab routine from which we take this routine: */ 250 251 /*output: */ 252 double alpha=-1; 253 double beta=-1; 254 255 double xA,xB,xC,xD,yA,yB,yC,yD; 256 double O2A[2],O2B[2],O1C[2],O1D[2]; 257 double n1[2],n2[2]; 258 double test1, test2, test3, test4; 259 double det; 260 double O2O1[2]; 261 double pO1A,pO1B,pO1C,pO1D; 262 263 xA=x1[0]; yA=y1[0]; 264 xB=x1[1]; yB=y1[1]; 265 xC=x2[0]; yC=y2[0]; 266 xD=x2[1]; yD=y2[1]; 267 268 O2A[0]=xA -(xD/2+xC/2); O2A[1]=yA -(yD/2+yC/2); 269 O2B[0]=xB -(xD/2+xC/2); O2B[1]=yB -(yD/2+yC/2); 270 O1C[0]=xC -(xA/2+xB/2); O1C[1]=yC -(yA/2+yB/2); 271 O1D[0]=xD -(xA/2+xB/2); O1D[1]=yD -(yA/2+yB/2); 272 273 n1[0]=yA-yB; n1[1]=xB-xA; //normal vector to segA 274 n2[0]=yC-yD; n2[1]=xD-xC; //normal vector to segB 275 276 test1=n2[0]*O2A[0]+n2[1]*O2A[1]; 277 test2=n2[0]*O2B[0]+n2[1]*O2B[1]; 278 279 if (test1*test2>0){ 280 return SeparateEnum; 281 } 282 283 test3=n1[0]*O1C[0]+n1[1]*O1C[1]; 284 test4=n1[0]*O1D[0]+n1[1]*O1D[1]; 285 286 if (test3*test4>0){ 287 return SeparateEnum; 288 } 289 290 /*If colinear: */ 291 det=n1[0]*n2[1]-n2[0]*n1[1]; 292 293 if(test1*test2==0 && test3*test4==0 && det==0){ 294 295 //projection on the axis O1O2 296 O2O1[0]=(xA/2+xB/2)-(xD/2+xC/2); 297 O2O1[1]=(yA/2+yB/2)-(yD/2+yC/2); 298 299 pO1A=O2O1[0]*(O2A[0]-O2O1[0])+O2O1[1]*(O2A[1]-O2O1[1]); 300 pO1B=O2O1[0]*(O2B[0]-O2O1[0])+O2O1[1]*(O2B[1]-O2O1[1]); 301 pO1C=O2O1[0]*O1C[0]+O2O1[1]*O1C[1]; 302 pO1D=O2O1[0]*O1D[0]+O2O1[1]*O1D[1]; 303 304 //test if one point is included in the other segment (->intersects=true) 305 if ((pO1C-pO1A)*(pO1D-pO1A)<0){ 306 alpha=0; beta=0; 307 *palpha=alpha;*pbeta=beta; 308 return ColinearEnum; 309 } 310 if ((pO1C-pO1B)*(pO1D-pO1B)<0){ 311 alpha=0; beta=0; 312 *palpha=alpha;*pbeta=beta; 313 return ColinearEnum; 314 } 315 if ((pO1A-pO1C)*(pO1B-pO1C)<0){ 316 alpha=0; beta=0; 317 *palpha=alpha;*pbeta=beta; 318 return ColinearEnum; 319 } 320 if ((pO1A-pO1D)*(pO1B-pO1D)<0){ 321 alpha=0; beta=0; 322 *palpha=alpha;*pbeta=beta; 323 return ColinearEnum; 324 } 325 326 //test if the 2 segments have the same middle (->intersects=true) 327 if (O2O1==0){ 328 alpha=0; beta=0; 329 *palpha=alpha;*pbeta=beta; 330 return ColinearEnum; 331 } 332 333 //if we are here, both segments are colinear, but do not interset: 334 alpha=-1; beta=-1; 335 *palpha=alpha;*pbeta=beta; 336 return SeparateEnum; 337 } 338 339 /*if we are here, both segments intersect. Determine where in the segment coordinate 340 * system: */ 341 beta=-1; 342 alpha=-(xA*yB-xC*yB+yC*xB-yC*xA+xC*yA-yA*xB)/(-xD*yB+xD*yA+xC*yB-xC*yA-yD*xA+yD*xB+yC*xA-yC*xB); //from intersect.m in formal calculus 343 344 *palpha=alpha;*pbeta=beta; 345 return IntersectEnum; 346 }/*}}}*/ -
issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.h
r13975 r14310 10 10 11 11 /* local prototypes: */ 12 void MeshProfileIntersectionx( 12 void MeshProfileIntersectionx(double** psegments, int* pnumseg, int* index, double* x, double* y, int nel, int nods, Contour<IssmPDouble>** contours,int numcontours); 13 13 void MeshSegmentsIntersection(double** psegments, int* pnumsegs,int* index, double* x, double* y, int nel, int nods, double* xc, double* yc, int numnodes); 14 14 void ElementSegmentsIntersection(DataSet* segments_dataset,int el, double* xnodes,double* ynodes,double* xc,double* yc,int numnodes); -
issm/trunk/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
r13975 r14310 15 15 16 16 Parameters *parameters = NULL; 17 bool control_analysis ;17 bool control_analysis,tao_analysis; 18 18 int nsteps; 19 19 int num_control_type; … … 30 30 /*retrieve some parameters: */ 31 31 iomodel->Constant(&control_analysis,InversionIscontrolEnum); 32 iomodel->Constant(&tao_analysis,InversionTaoEnum); 32 33 33 34 if(control_analysis){ … … 37 38 parameters->AddObject(iomodel->CopyConstantObject(InversionNumCostFunctionsEnum)); 38 39 parameters->AddObject(iomodel->CopyConstantObject(InversionNstepsEnum)); 39 parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum));40 parameters->AddObject(iomodel->CopyConstantObject(InversionGradientOnlyEnum));41 40 parameters->AddObject(iomodel->CopyConstantObject(InversionIncompleteAdjointEnum)); 41 if(!tao_analysis){ 42 parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum)); 43 parameters->AddObject(iomodel->CopyConstantObject(InversionGradientOnlyEnum)); 44 } 42 45 43 46 /*What solution type?*/ … … 52 55 iomodel->FetchData(&control_type,NULL,&num_control_type,InversionControlParametersEnum); 53 56 iomodel->FetchData(&cm_responses,&nsteps,&num_cm_responses,InversionCostFunctionsEnum); 54 iomodel->FetchData(&cm_jump,&nsteps,NULL,InversionStepThresholdEnum); 55 iomodel->FetchData(&optscal,NULL,NULL,InversionGradientScalingEnum); 56 iomodel->FetchData(&maxiter,NULL,NULL,InversionMaxiterPerStepEnum); 57 if(!tao_analysis){ 58 iomodel->FetchData(&cm_jump,&nsteps,NULL,InversionStepThresholdEnum); 59 iomodel->FetchData(&optscal,NULL,NULL,InversionGradientScalingEnum); 60 iomodel->FetchData(&maxiter,NULL,NULL,InversionMaxiterPerStepEnum); 61 } 57 62 58 parameters->AddObject(new IntVecParam(InversionControlParametersEnum,control_type,num_control_type)); 59 parameters->AddObject(new DoubleMatParam(InversionGradientScalingEnum,optscal,nsteps,num_control_type)); 60 parameters->AddObject(new DoubleMatParam(InversionCostFunctionsEnum,cm_responses,nsteps,num_cm_responses)); 61 parameters->AddObject(new DoubleVecParam(InversionStepThresholdEnum,cm_jump,nsteps)); 62 parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps)); 63 if(tao_analysis){ 64 parameters->AddObject(new IntVecParam(InversionControlParametersEnum,control_type,num_control_type)); 65 parameters->AddObject(new DoubleVecParam(InversionCostFunctionsEnum,cm_responses,num_cm_responses)); 66 } 67 else{ 68 parameters->AddObject(new IntVecParam(InversionControlParametersEnum,control_type,num_control_type)); 69 parameters->AddObject(new DoubleMatParam(InversionGradientScalingEnum,optscal,nsteps,num_control_type)); 70 parameters->AddObject(new DoubleMatParam(InversionCostFunctionsEnum,cm_responses,nsteps,num_cm_responses)); 71 parameters->AddObject(new DoubleVecParam(InversionStepThresholdEnum,cm_jump,nsteps)); 72 parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps)); 73 } 63 74 64 75 xDelete<int>(control_type); -
issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
r13975 r14310 45 45 case VxEnum: iomodel->FetchData(1,VxEnum); break; 46 46 case VyEnum: iomodel->FetchData(1,VyEnum); break; 47 case FrictionCoefficientEnum: iomodel->FetchData(1,FrictionCoefficientEnum); break; 48 case MaterialsRheologyBbarEnum: iomodel->FetchData(1,MaterialsRheologyBEnum); break; 49 case MaterialsRheologyZbarEnum: iomodel->FetchData(1,MaterialsRheologyZEnum); break; 47 case ThicknessEnum: iomodel->FetchData(1,ThicknessEnum); break; 48 case FrictionCoefficientEnum: iomodel->FetchData(1,FrictionCoefficientEnum); break; 49 case MaterialsRheologyBbarEnum: iomodel->FetchData(1,MaterialsRheologyBEnum); break; 50 case MaterialsRheologyZbarEnum: iomodel->FetchData(1,MaterialsRheologyZEnum); break; 50 51 default: _error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet"); 51 52 } -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
r13975 r14310 2 2 * UpdateElementsDiagnosticHoriz: 3 3 */ 4 #ifdef HAVE_CONFIG_H 5 #include <config.h> 6 #else 7 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 8 #endif 4 9 5 10 #include "../../../Container/Container.h" … … 85 90 elements->InputDuplicate(VxEnum,InversionVxObsEnum); 86 91 if(dakota_analysis)elements->InputDuplicate(VxEnum,QmuVxEnum); 92 93 #ifdef _HAVE_ANDROID_ 94 elements->InputDuplicate(FrictionCoefficientEnum,AndroidFrictionCoefficientEnum); 95 #endif 87 96 88 97 elements->InputDuplicate(VyEnum,VyPicardEnum); -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
r13975 r14310 72 72 } 73 73 if(issmbgradients){ 74 iomodel->FetchDataToInput(elements,SurfaceforcingsHcEnum);75 74 iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum); 76 75 iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum); 77 iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMaxEnum);78 iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMinEnum);79 iomodel->FetchDataToInput(elements,SurfaceforcingsAPosEnum);80 76 iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum); 81 iomodel->FetchDataToInput(elements,SurfaceforcingsANegEnum);82 77 iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum); 83 78 } -
issm/trunk/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp
r14067 r14310 21 21 22 22 int i,j,n; 23 const int maxels= 25;23 const int maxels=50; 24 24 const int width=maxels+1; 25 25 -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
r13975 r14310 56 56 57 57 /*We don't have a file pointer. Retrieve the output file name and open it for writing:*/ 58 parameters->FindParam(&outputfilename,Output filenameEnum);58 parameters->FindParam(&outputfilename,OutputFileNameEnum); 59 59 60 60 /*What strategy? : */ -
issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp
r13975 r14310 205 205 else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum; 206 206 else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum; 207 else if (strcmp(name,"SurfaceforcingsHc")==0) return SurfaceforcingsHcEnum;208 207 else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum; 209 208 else if (strcmp(name,"SurfaceforcingsSmbref")==0) return SurfaceforcingsSmbrefEnum; 210 else if (strcmp(name,"SurfaceforcingsSmbPosMax")==0) return SurfaceforcingsSmbPosMaxEnum;211 else if (strcmp(name,"SurfaceforcingsSmbPosMin")==0) return SurfaceforcingsSmbPosMinEnum;212 else if (strcmp(name,"SurfaceforcingsAPos")==0) return SurfaceforcingsAPosEnum;213 209 else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum; 214 else if (strcmp(name,"SurfaceforcingsANeg")==0) return SurfaceforcingsANegEnum;215 210 else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum; 216 211 else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum; … … 242 237 else if (strcmp(name,"BalancethicknessAnalysis")==0) return BalancethicknessAnalysisEnum; 243 238 else if (strcmp(name,"BalancethicknessSolution")==0) return BalancethicknessSolutionEnum; 239 else if (strcmp(name,"WeakBalancethicknessAnalysis")==0) return WeakBalancethicknessAnalysisEnum; 240 else if (strcmp(name,"WeakBalancethicknessSolution")==0) return WeakBalancethicknessSolutionEnum; 244 241 else if (strcmp(name,"BedSlopeAnalysis")==0) return BedSlopeAnalysisEnum; 245 242 else if (strcmp(name,"BedSlopeSolution")==0) return BedSlopeSolutionEnum; … … 261 258 else if (strcmp(name,"PrognosticSolution")==0) return PrognosticSolutionEnum; 262 259 else if (strcmp(name,"SteadystateSolution")==0) return SteadystateSolutionEnum; 260 else if (strcmp(name,"SurfaceSlopeAnalysis")==0) return SurfaceSlopeAnalysisEnum; 261 else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum; 262 else if (strcmp(name,"SurfaceSlopeXAnalysis")==0) return SurfaceSlopeXAnalysisEnum; 263 263 else stage=3; 264 264 } 265 265 if(stage==3){ 266 if (strcmp(name,"SurfaceSlopeAnalysis")==0) return SurfaceSlopeAnalysisEnum; 267 else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum; 268 else if (strcmp(name,"SurfaceSlopeXAnalysis")==0) return SurfaceSlopeXAnalysisEnum; 269 else if (strcmp(name,"SurfaceSlopeYAnalysis")==0) return SurfaceSlopeYAnalysisEnum; 266 if (strcmp(name,"SurfaceSlopeYAnalysis")==0) return SurfaceSlopeYAnalysisEnum; 270 267 else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum; 271 268 else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum; … … 353 350 else if (strcmp(name,"Adjointy")==0) return AdjointyEnum; 354 351 else if (strcmp(name,"Adjointz")==0) return AdjointzEnum; 352 else if (strcmp(name,"BalancethicknessMisfit")==0) return BalancethicknessMisfitEnum; 355 353 else if (strcmp(name,"BedSlopeX")==0) return BedSlopeXEnum; 356 354 else if (strcmp(name,"BedSlopeY")==0) return BedSlopeYEnum; … … 380 378 else if (strcmp(name,"QmuSurface")==0) return QmuSurfaceEnum; 381 379 else if (strcmp(name,"QmuMelting")==0) return QmuMeltingEnum; 380 else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum; 382 381 else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum; 383 382 else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum; 384 383 else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum; 385 384 else if (strcmp(name,"SurfaceArea")==0) return SurfaceAreaEnum; 385 else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum; 386 386 else stage=4; 387 387 } 388 388 if(stage==4){ 389 if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum; 390 else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum; 389 if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum; 391 390 else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum; 392 391 else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum; … … 426 425 else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum; 427 426 else if (strcmp(name,"TransientInput")==0) return TransientInputEnum; 428 else if (strcmp(name,"Outputfilename")==0) return OutputfilenameEnum;429 427 else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum; 430 428 else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum; … … 507 505 else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum; 508 506 else if (strcmp(name,"Regular")==0) return RegularEnum; 507 else if (strcmp(name,"Scaled")==0) return ScaledEnum; 508 else if (strcmp(name,"Separate")==0) return SeparateEnum; 509 509 else stage=5; 510 510 } 511 511 if(stage==5){ 512 if (strcmp(name,"Scaled")==0) return ScaledEnum; 513 else if (strcmp(name,"Separate")==0) return SeparateEnum; 514 else if (strcmp(name,"Sset")==0) return SsetEnum; 512 if (strcmp(name,"Sset")==0) return SsetEnum; 515 513 else if (strcmp(name,"Verbose")==0) return VerboseEnum; 516 514 else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum; -
issm/trunk/src/c/modules/TriMeshProcessRiftsx/TriMeshProcessRiftsx.cpp
r13634 r14310 9 9 #include "../../toolkits/toolkits.h" 10 10 11 void TriMeshProcessRiftsx( double** pindex, int* pnel,double** px,double** py,int* pnods,double** psegments,double** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct){11 void TriMeshProcessRiftsx(int** pindex, int* pnel,double** px,double** py,int* pnods,int** psegments,int** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct){ 12 12 13 13 /*Output*/ 14 14 int numrifts,numrifts0; 15 15 int *riftsnumsegments = NULL; 16 double**riftssegments = NULL;16 int **riftssegments = NULL; 17 17 int *riftsnumpairs = NULL; 18 double**riftspairs = NULL;19 double*riftstips = NULL;18 int **riftspairs = NULL; 19 int *riftstips = NULL; 20 20 double **riftspenaltypairs = NULL; 21 21 int *riftsnumpenaltypairs = NULL; … … 23 23 /*Recover initial mesh*/ 24 24 int nel = *pnel; 25 double*index = *pindex;25 int *index = *pindex; 26 26 double *x = *px; 27 27 double *y = *py; 28 28 int nods = *pnods; 29 double*segments = *psegments;30 double*segmentmarkers = *psegmentmarkers;29 int *segments = *psegments; 30 int *segmentmarkers = *psegmentmarkers; 31 31 int num_seg = *pnum_seg; 32 32 -
issm/trunk/src/c/modules/TriMeshProcessRiftsx/TriMeshProcessRiftsx.h
r13634 r14310 8 8 class RiftStruct; 9 9 10 void TriMeshProcessRiftsx( double** pindex, int* pnel,double** px,double** py,int* pnods,double** psegments,double** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct);10 void TriMeshProcessRiftsx(int** pindex,int* pnel,double** px,double** py,int* pnods,int** psegments,int** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct); 11 11 12 12 #endif /* _TRIMESHPROCESSRIFTX_H*/ -
issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp
r13975 r14310 22 22 /*}}}*/ 23 23 24 void TriMeshx(SeqMat< IssmPDouble>** pindex,SeqVec<IssmPDouble>** px,SeqVec<IssmPDouble>** py,SeqMat<IssmPDouble>** psegments,SeqVec<IssmPDouble>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area){24 void TriMeshx(SeqMat<int>** pindex,SeqVec<IssmPDouble>** px,SeqVec<IssmPDouble>** py,SeqMat<int>** psegments,SeqVec<int>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area){ 25 25 26 26 #if !defined(_HAVE_TRIANGLE_) … … 31 31 32 32 /*output: */ 33 IssmPDouble*index = NULL;34 SeqMat< IssmPDouble> *index_matrix = NULL;35 double 36 double 37 double*segments = NULL;38 SeqMat< IssmPDouble> *segments_matrix = NULL;39 double*segmentmarkerlist = NULL;33 int *index = NULL; 34 SeqMat<int> *index_matrix = NULL; 35 double *x = NULL; 36 double *y = NULL; 37 int *segments = NULL; 38 SeqMat<int> *segments_matrix = NULL; 39 int *segmentmarkerlist = NULL; 40 40 41 41 /*intermediary: */ … … 169 169 170 170 /*Allocate index, x and y: */ 171 index=xNew< double>(3*out.numberoftriangles);171 index=xNew<int>(3*out.numberoftriangles); 172 172 x=xNew<double>(out.numberofpoints); 173 173 y=xNew<double>(out.numberofpoints); 174 segments=xNew< double>(3*out.numberofsegments);175 segmentmarkerlist=xNew< double>(out.numberofsegments);174 segments=xNew<int>(3*out.numberofsegments); 175 segmentmarkerlist=xNew<int>(out.numberofsegments); 176 176 177 177 for (i = 0; i< out.numberoftriangles; i++) { 178 178 for (j = 0; j < out.numberofcorners; j++) { 179 index[3*i+j]=( double)out.trianglelist[i*out.numberofcorners+j]+1;179 index[3*i+j]=(int)out.trianglelist[i*out.numberofcorners+j]+1; 180 180 } 181 181 } 182 182 for (i = 0; i< out.numberofpoints; i++){ 183 x[i]= out.pointlist[i*2+0];184 y[i]= out.pointlist[i*2+1];183 x[i]=(double)out.pointlist[i*2+0]; 184 y[i]=(double)out.pointlist[i*2+1]; 185 185 } 186 186 for (i = 0; i<out.numberofsegments;i++){ 187 segments[3*i+0]=( double)out.segmentlist[i*2+0]+1;188 segments[3*i+1]=( double)out.segmentlist[i*2+1]+1;189 segmentmarkerlist[i]=( double)out.segmentmarkerlist[i];187 segments[3*i+0]=(int)out.segmentlist[i*2+0]+1; 188 segments[3*i+1]=(int)out.segmentlist[i*2+1]+1; 189 segmentmarkerlist[i]=(int)out.segmentmarkerlist[i]; 190 190 } 191 191 … … 197 197 198 198 /*Output : */ 199 index_matrix=new SeqMat< IssmPDouble>(index,out.numberoftriangles,3,1.0);199 index_matrix=new SeqMat<int>(index,out.numberoftriangles,3,1); 200 200 *pindex=index_matrix; 201 201 202 segments_matrix=new SeqMat< IssmPDouble>(segments,out.numberofsegments,3,1.0);202 segments_matrix=new SeqMat<int>(segments,out.numberofsegments,3,1); 203 203 *psegments=segments_matrix; 204 204 205 205 *px=new SeqVec<IssmPDouble>(x,out.numberofpoints); 206 206 *py=new SeqVec<IssmPDouble>(y,out.numberofpoints); 207 *psegmentmarkerlist=new SeqVec< IssmPDouble>(segmentmarkerlist,out.numberofsegments);207 *psegmentmarkerlist=new SeqVec<int>(segmentmarkerlist,out.numberofsegments); 208 208 #endif 209 209 } -
issm/trunk/src/c/modules/TriMeshx/TriMeshx.h
r13975 r14310 11 11 12 12 /* local prototypes: */ 13 void TriMeshx(SeqMat< IssmPDouble>** pindex,SeqVec<IssmPDouble>** px,SeqVec<IssmPDouble>** py,SeqMat<IssmPDouble>** psegments,SeqVec<IssmPDouble>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area);13 void TriMeshx(SeqMat<int>** pindex,SeqVec<IssmPDouble>** px,SeqVec<IssmPDouble>** py,SeqMat<int>** psegments,SeqVec<int>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area); 14 14 15 15 #endif /* _TRIMESHX_H */ -
issm/trunk/src/c/modules/modules.h
r13975 r14310 60 60 #include "./Kml2Expx/Kml2Expx.h" 61 61 #include "./Krigingx/Krigingx.h" 62 #include "./Shp2Kmlx/Shp2Kmlx.h"63 62 #include "./Mergesolutionfromftogx/Mergesolutionfromftogx.h" 64 63 #include "./MeshPartitionx/MeshPartitionx.h" … … 87 86 #include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h" 88 87 #include "./Scotchx/Scotchx.h" 88 #include "./Shp2Expx/Shp2Expx.h" 89 #include "./Shp2Kmlx/Shp2Kmlx.h" 89 90 #include "./SmbGradientsx/SmbGradientsx.h" 90 91 #include "./Solverx/Solverx.h" -
issm/trunk/src/c/shared/Elements/PrintArrays.cpp
r13975 r14310 39 39 _printLine_(""); 40 40 } 41 void printarray(bool* array,int lines,int cols){ 42 _printLine_(""); 43 for(int i=0;i<lines;i++){ 44 _printString_(" [ "); 45 for(int j=0;j<cols;j++) _printString_( " " << array[i*cols+j]?1:0); 46 _printLine_(" ]"); 47 } 48 _printLine_(""); 49 } 41 50 void printbinary(int n){ 42 51 unsigned int i=1L<<(sizeof(n)*8-1); -
issm/trunk/src/c/shared/Elements/elements.h
r13975 r14310 40 40 void printarray(IssmPDouble* array,int lines,int cols=1); 41 41 void printarray(int* array,int lines,int cols=1); 42 void printarray(bool* array,int lines,int cols=1); 42 43 void printsparsity(IssmPDouble* array,int lines,int cols=1); 43 44 void printbinary(int n); -
issm/trunk/src/c/shared/Exp/exp.h
r13975 r14310 12 12 13 13 int IsInPolySerial(double* in,double* xc,double* yc,int numvertices,double* x,double* y,int nods, int edgevalue); 14 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname); 14 int ExpWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,char* domainname); 15 int ExpWrite(DataSet* contours,char* domainname); 15 16 int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue); 16 17 -
issm/trunk/src/c/shared/Numerics/UnitConversion.cpp
r13975 r14310 65 65 case SurfaceforcingsPrecipitationEnum: scale=yts;break; //m/yr 66 66 case SurfaceforcingsMassBalanceEnum: scale=yts;break; //m/yr 67 case SurfaceforcingsSmbPosMaxEnum: scale=yts;break; //m/yr68 case SurfaceforcingsSmbPosMinEnum: scale=yts;break; //m/yr69 case SurfaceforcingsAPosEnum: scale=yts;break; //m/yr70 67 case SurfaceforcingsBPosEnum: scale=yts;break; //m/yr 71 case SurfaceforcingsANegEnum: scale=yts;break; //m/yr72 68 case SurfaceforcingsBNegEnum: scale=yts;break; //m/yr 73 69 case SurfaceforcingsSmbrefEnum: scale=yts;break; //m/yr -
issm/trunk/src/c/shared/TriMesh/AssociateSegmentToElement.cpp
r13975 r14310 5 5 #include "./trimesh.h" 6 6 7 int AssociateSegmentToElement(double** psegments,int nseg, double* index,int nel){ 8 9 /*Error management: */ 10 int i; 11 int noerr=1; 12 13 /*Input: */ 14 double* segments=NULL; 7 int AssociateSegmentToElement(int** psegments,int nseg,int* index,int nel){ 15 8 16 9 /*node indices: */ 17 doubleA,B;10 int A,B; 18 11 19 12 /*Recover segments: */ 20 segments=*psegments;13 int* segments=*psegments; 21 14 22 for (i=0;i<nseg;i++){23 A= *(segments+3*i+0);24 B= *(segments+3*i+1);25 *(segments+3*i+2)=FindElement(A,B,index,nel)+1; //matlab indexing.15 for(int i=0;i<nseg;i++){ 16 A=segments[3*i+0]; 17 B=segments[3*i+1]; 18 segments[3*i+2]=FindElement(A,B,index,nel)+1; //matlab indexing. 26 19 } 27 20 28 21 /*Assign output pointers: */ 29 22 *psegments=segments; 30 return noerr;23 return 1; 31 24 } -
issm/trunk/src/c/shared/TriMesh/OrderSegments.cpp
r13975 r14310 5 5 #include "./trimesh.h" 6 6 7 int OrderSegments(double** psegments,int nseg, double* index,int nel){ 8 9 /*Error management: */ 10 int i; 11 int noerr=1; 12 13 /*Input: */ 14 double* segments=NULL; 7 int OrderSegments(int** psegments,int nseg,int* index,int nel){ 15 8 16 9 /*vertex indices: */ 17 double A,B; 18 /*element indices: */ 10 int A,B; 11 12 /*element index*/ 19 13 int el; 20 14 21 15 /*Recover segments: */ 22 segments=*psegments;16 int* segments=*psegments; 23 17 24 for (i=0;i<nseg;i++){18 for(int i=0;i<nseg;i++){ 25 19 A=segments[3*i+0]; 26 20 B=segments[3*i+1]; 27 el= (int)segments[3*i+2]-1; //after AssociateSegmentToElement, el was a matlab index, we need the c index now.21 el=segments[3*i+2]-1; //after AssociateSegmentToElement, el was a matlab index, we need the c index now. 28 22 29 23 if (index[3*el+0]==A){ … … 49 43 /*Assign output pointers: */ 50 44 *psegments=segments; 51 return noerr;45 return 1; 52 46 } -
issm/trunk/src/c/shared/TriMesh/SplitMeshForRifts.cpp
r13975 r14310 6 6 #include "../Alloc/alloc.h" 7 7 8 int SplitMeshForRifts(int* pnel, double** pindex,int* pnods,double** px,double** py,int* pnsegs,double** psegments,double** psegmentmarkerlist){8 int SplitMeshForRifts(int* pnel,int** pindex,int* pnods,double** px,double** py,int* pnsegs,int** psegments,int** psegmentmarkerlist){ 9 9 10 10 /*Some notes on dimensions: … … 13 13 segments of size nsegsx3*/ 14 14 15 /*Error management: */16 int noerr=1;17 18 15 int i,j,k,l; 19 16 int node; 20 17 int el; 21 22 18 int nriftsegs; 23 19 int* riftsegments=NULL; 24 20 int* flags=NULL; 25 26 21 int NumGridElementListOnOneSideOfRift; 27 22 int* GridElementListOnOneSideOfRift=NULL; 28 23 29 /*Input: */30 int nel;31 double* index=NULL;32 int nods;33 double* x=NULL;34 double* y=NULL;35 double* segments=NULL;36 double* segmentmarkerlist=NULL;37 int nsegs;38 39 24 /*Recover input: */ 40 nel=*pnel;41 in dex=*pindex;42 nods=*pnods;43 x=*px;44 y=*py;45 nsegs=*pnsegs;46 segments=*psegments;47 segmentmarkerlist=*psegmentmarkerlist;25 int nel = *pnel; 26 int *index = *pindex; 27 int nods = *pnods; 28 double *x = *px; 29 double *y = *py; 30 int nsegs = *pnsegs; 31 int *segments = *psegments; 32 int *segmentmarkerlist = *psegmentmarkerlist; 48 33 49 34 /*Establish list of segments that belong to a rift: */ … … 90 75 el=GridElementListOnOneSideOfRift[k]; 91 76 for (l=0;l<3;l++){ 92 if ( *(index+3*el+l)==node)*(index+3*el+l)=nods; //again, matlab indexing.77 if (index[3*el+l]==node) index[3*el+l]=nods; //again, matlab indexing. 93 78 } 94 79 } … … 109 94 *psegments=segments; 110 95 *psegmentmarkerlist=segmentmarkerlist; 111 return noerr;96 return 1; 112 97 } -
issm/trunk/src/c/shared/TriMesh/TriMeshUtils.cpp
r13975 r14310 36 36 }/*}}}*/ 37 37 /*FUNCTION GridElementsList{{{*/ 38 int GridElementsList(int** pGridElements, int* pNumGridElements,int node, double* index,int nel){38 int GridElementsList(int** pGridElements, int* pNumGridElements,int node,int* index,int nel){ 39 39 40 40 /*From a node, recover all the elements that are connected to it: */ … … 58 58 for (i=0;i<nel;i++){ 59 59 for (j=0;j<3;j++){ 60 if ( (int)*(index+3*i+j)==node){60 if (index[3*i+j]==node){ 61 61 if (NumGridElements<=(current_size-1)){ 62 62 GridElements[NumGridElements]=i; … … 90 90 }/*}}}*/ 91 91 /*FUNCTION IsNeighbor{{{*/ 92 int IsNeighbor(int el1,int el2, double* index){92 int IsNeighbor(int el1,int el2,int* index){ 93 93 /*From a triangulation held in index, figure out if elements 1 and 2 have two nodes in common: */ 94 94 int i,j; … … 96 96 for (i=0;i<3;i++){ 97 97 for (j=0;j<3;j++){ 98 if ( *(index+3*el1+i)==*(index+3*el2+j))count++;98 if (index[3*el1+i]==index[3*el2+j])count++; 99 99 } 100 100 } … … 118 118 }/*}}}*/ 119 119 /*FUNCTION RiftSegmentsFromSegments{{{*/ 120 void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel, double* index, int nsegs,double* segments){120 void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel,int* index,int nsegs,int* segments){ 121 121 122 122 int i,counter; … … 126 126 int* riftsegments=NULL; 127 127 int* riftsegments_uncompressed=NULL; 128 doubleelement_nodes[3];128 int element_nodes[3]; 129 129 130 130 /*Allocate segmentflags: */ … … 143 143 element_nodes[2]=*(index+3*el+2); 144 144 145 *(index+3*el+0)=-1;146 *(index+3*el+1)=-1;147 *(index+3*el+2)=-1;145 index[3*el+0]=-1; 146 index[3*el+1]=-1; 147 index[3*el+2]=-1; 148 148 149 149 el2=FindElement(*(segments+3*i+0),*(segments+3*i+1),index,nel); 150 150 151 151 /*Restore index: */ 152 *(index+3*el+0)=element_nodes[0];153 *(index+3*el+1)=element_nodes[1];154 *(index+3*el+2)=element_nodes[2];152 index[3*el+0]=element_nodes[0]; 153 index[3*el+1]=element_nodes[1]; 154 index[3*el+2]=element_nodes[2]; 155 155 156 156 if (el2!=-1){ 157 157 /*el and el2 are on a segment rift, facing one another, plug them into riftsegments_uncompressed: */ 158 *(riftsegments_uncompressed+5*i+0)=1;159 *(riftsegments_uncompressed+5*i+1)=el;160 *(riftsegments_uncompressed+5*i+2)=el2;161 *(riftsegments_uncompressed+5*i+3)=(int)*(segments+3*i+0);162 *(riftsegments_uncompressed+5*i+4)=(int)*(segments+3*i+1);163 nriftsegs++;158 riftsegments_uncompressed[5*i+0]=1; 159 riftsegments_uncompressed[5*i+1]=el; 160 riftsegments_uncompressed[5*i+2]=el2; 161 riftsegments_uncompressed[5*i+3]=segments[3*i+0]; 162 riftsegments_uncompressed[5*i+4]=segments[3*i+1]; 163 nriftsegs++; 164 164 } 165 165 } … … 169 169 counter=0; 170 170 for (i=0;i<nsegs;i++){ 171 if ( *(riftsegments_uncompressed+5*i+0)){172 *(riftsegments+counter*4+0)=*(riftsegments_uncompressed+5*i+1);173 *(riftsegments+counter*4+1)=*(riftsegments_uncompressed+5*i+2);174 *(riftsegments+counter*4+2)=*(riftsegments_uncompressed+5*i+3);175 *(riftsegments+counter*4+3)=*(riftsegments_uncompressed+5*i+4);171 if (riftsegments_uncompressed[5*i+0]){ 172 riftsegments[counter*4+0]=riftsegments_uncompressed[5*i+1]; 173 riftsegments[counter*4+1]=riftsegments_uncompressed[5*i+2]; 174 riftsegments[counter*4+2]=riftsegments_uncompressed[5*i+3]; 175 riftsegments[counter*4+3]=riftsegments_uncompressed[5*i+4]; 176 176 counter++; 177 177 } 178 178 } 179 180 179 xDelete<int>(riftsegments_uncompressed); 181 180 … … 185 184 }/*}}}*/ 186 185 /*FUNCTION DetermineGridElementListOnOneSideOfRift{{{*/ 187 int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift, int segmentnumber, int nriftsegs, int* riftsegments, int node, double* index,int nel){186 int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift, int segmentnumber, int nriftsegs, int* riftsegments, int node,int* index,int nel){ 188 187 189 188 int noerr=1; … … 249 248 }/*}}}*/ 250 249 /*FUNCTION UpdateSegments{{{*/ 251 int UpdateSegments( double** psegments,double** psegmentmarkerlist, int* pnsegs, double* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel){250 int UpdateSegments(int** psegments,int** psegmentmarkerlist, int* pnsegs,int* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel){ 252 251 253 252 int noerr=1; … … 255 254 int el1,el2; 256 255 257 double*segments = NULL;258 double*segmentmarkerlist = NULL;259 int 256 int *segments = NULL; 257 int *segmentmarkerlist = NULL; 258 int nsegs; 260 259 261 260 /*Recover input: */ … … 265 264 266 265 /*Reallocate segments: */ 267 segments =xReNew< double>(segments, nsegs*3,(nsegs+nriftsegs)*3);268 segmentmarkerlist=xReNew< double>(segmentmarkerlist,nsegs,(nsegs+nriftsegs));266 segments =xReNew<int>(segments, nsegs*3,(nsegs+nriftsegs)*3); 267 segmentmarkerlist=xReNew<int>(segmentmarkerlist,nsegs,(nsegs+nriftsegs)); 269 268 270 269 /*First, update the existing segments to the new nodes :*/ … … 278 277 *we can only rely on the position (x,y) of the rift nodes to create a segment:*/ 279 278 for (k=0;k<3;k++){ 280 if ((x[ (int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+0)-1])){279 if ((x[*(index+el1*3+k)-1]==x[*(segments+3*j+0)-1]) && (y[*(index+el1*3+k)-1]==y[*(segments+3*j+0)-1])){ 281 280 *(segments+3*j+0)=*(index+el1*3+k); _assert_(segments[3*j+0]<nods+1); 282 281 break; … … 284 283 } 285 284 for (k=0;k<3;k++){ 286 if ((x[ (int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+1)-1]) && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+1)-1])){285 if ((x[*(index+el1*3+k)-1]==x[*(segments+3*j+1)-1]) && (y[*(index+el1*3+k)-1]==y[*(segments+3*j+1)-1])){ 287 286 *(segments+3*j+1)=*(index+el1*3+k); _assert_(segments[3*j+1]<nods+1); 288 287 break; … … 293 292 *(segmentmarkerlist+(nsegs+i))=*(segmentmarkerlist+j); 294 293 for (k=0;k<3;k++){ 295 if ((x[ (int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+0)-1])){294 if ((x[*(index+el2*3+k)-1]==x[*(segments+3*j+0)-1]) && (y[*(index+el2*3+k)-1]==y[*(segments+3*j+0)-1])){ 296 295 *(segments+3*(nsegs+i)+0)=*(index+el2*3+k); _assert_(segments[3*(nsegs+i)+0]<nods+1); 297 296 break; … … 299 298 } 300 299 for (k=0;k<3;k++){ 301 if ((x[ (int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+1)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+1)-1])){300 if ((x[*(index+el2*3+k)-1]==x[*(segments+3*j+1)-1]) && (y[*(index+el2*3+k)-1]==y[*(segments+3*j+1)-1])){ 302 301 *(segments+3*(nsegs+i)+1)=*(index+el2*3+k); _assert_(segments[3*(nsegs+i)+1]<nods+1); 303 302 break; … … 309 308 /*Let's update segments[j][:] using element el2 and the corresponding rift segment: */ 310 309 for (k=0;k<3;k++){ 311 if ((x[ (int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+0)-1])){310 if ((x[*(index+el2*3+k)-1]==x[*(segments+3*j+0)-1]) && (y[*(index+el2*3+k)-1]==y[*(segments+3*j+0)-1])){ 312 311 *(segments+3*j+0)=*(index+el2*3+k); _assert_(segments[3*j+0]<nods+1); 313 312 break; … … 315 314 } 316 315 for (k=0;k<3;k++){ 317 if ((x[ (int)*(index+el2*3+k)-1]==x[(int)*(segments+3*j+1)-1]) && (y[(int)*(index+el2*3+k)-1]==y[(int)*(segments+3*j+1)-1])){316 if ((x[*(index+el2*3+k)-1]==x[*(segments+3*j+1)-1]) && (y[*(index+el2*3+k)-1]==y[*(segments+3*j+1)-1])){ 318 317 *(segments+3*j+1)=*(index+el2*3+k);_assert_(segments[3*j+1]<nods+1); 319 318 break; … … 324 323 *(segmentmarkerlist+(nsegs+i))=*(segmentmarkerlist+j); 325 324 for (k=0;k<3;k++){ 326 if ((x[ (int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+0)-1]) && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+0)-1])){325 if ((x[*(index+el1*3+k)-1]==x[*(segments+3*j+0)-1]) && (y[*(index+el1*3+k)-1]==y[*(segments+3*j+0)-1])){ 327 326 *(segments+3*(nsegs+i)+0)=*(index+el1*3+k);_assert_(segments[3*(nsegs+i)+0]<nods+1); 328 327 break; … … 330 329 } 331 330 for (k=0;k<3;k++){ 332 if ((x[ (int)*(index+el1*3+k)-1]==x[(int)*(segments+3*j+1)-1]) && (y[(int)*(index+el1*3+k)-1]==y[(int)*(segments+3*j+1)-1])){331 if ((x[*(index+el1*3+k)-1]==x[*(segments+3*j+1)-1]) && (y[*(index+el1*3+k)-1]==y[*(segments+3*j+1)-1])){ 333 332 *(segments+3*(nsegs+i)+1)=*(index+el1*3+k);_assert_(segments[3*(nsegs+i)+1]<nods+1); 334 333 break; … … 348 347 }/*}}}*/ 349 348 /*FUNCTION FindElement{{{*/ 350 int FindElement(double A,double B,double* index,int nel){ 351 352 int n; 349 int FindElement(int A,int B,int* index,int nel){ 350 353 351 int el=-1; 354 for ( n=0;n<nel;n++){355 if (((*(index+3*n+0)==A) || (*(index+3*n+1)==A) || (*(index+3*n+2)==A) ) && ((*(index+3*n+0)==B) || (*(index+3*n+1)==B) || (*(index+3*n+2)==B))){352 for (int n=0;n<nel;n++){ 353 if(((index[3*n+0]==A) || (index[3*n+1]==A) || (index[3*n+2]==A)) && ((index[3*n+0]==B) || (index[3*n+1]==B) || (index[3*n+2]==B))){ 356 354 el=n; 357 355 break; … … 361 359 }/*}}}*/ 362 360 /*FUNCTION SplitRiftSegments{{{*/ 363 int SplitRiftSegments( double** psegments,double** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,double*** priftssegments,int numrifts,int nods,int nel){361 int SplitRiftSegments(int** psegments,int** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,int*** priftssegments,int numrifts,int nods,int nel){ 364 362 365 363 /*Using segment markers, wring out the rift segments from the segments. Rift markers are … … 370 368 371 369 /*input: */ 372 double*segments = NULL;373 double*segmentmarkerlist = NULL;370 int *segments = NULL; 371 int *segmentmarkerlist = NULL; 374 372 int numsegs; 375 373 376 374 /*output: */ 377 int 378 int 379 double**riftssegments = NULL;380 double*new_segments = NULL;381 double*new_segmentmarkers = NULL;375 int new_numsegs; 376 int *riftsnumsegs = NULL; 377 int **riftssegments = NULL; 378 int *new_segments = NULL; 379 int *new_segmentmarkers = NULL; 382 380 383 381 /*intermediary: */ 384 double* riftsegment=NULL;382 int* riftsegment=NULL; 385 383 386 384 /*Recover input arguments: */ 387 segments =*psegments;388 numsegs =*pnumsegs;389 segmentmarkerlist =*psegmentmarkerlist;385 segments = *psegments; 386 numsegs = *pnumsegs; 387 segmentmarkerlist = *psegmentmarkerlist; 390 388 391 389 /*First, figure out how many segments will be left in 'segments': */ … … 396 394 /*Allocate new segments: */ 397 395 new_numsegs=counter; 398 new_segments=xNew< double>(new_numsegs*3);399 new_segmentmarkers=xNew< double>(new_numsegs);396 new_segments=xNew<int>(new_numsegs*3); 397 new_segmentmarkers=xNew<int>(new_numsegs); 400 398 401 399 /*Copy new segments info : */ … … 413 411 /*Now deal with rift segments: */ 414 412 riftsnumsegs=xNew<int>(numrifts); 415 riftssegments=xNew< double*>(numrifts);413 riftssegments=xNew<int*>(numrifts); 416 414 for (i=0;i<numrifts;i++){ 417 415 /*Figure out how many segments for rift i: */ … … 421 419 } 422 420 riftsnumsegs[i]=counter; 423 riftsegment=xNew< double>(counter*3);421 riftsegment=xNew<int>(counter*3); 424 422 /*Copy new segments info :*/ 425 423 counter=0; … … 436 434 437 435 /*Free ressources: */ 438 xDelete< double>(segments);436 xDelete<int>(segments); 439 437 440 438 /*Assign output pointers: */ … … 448 446 }/*}}}*/ 449 447 /*FUNCTION PairRiftElements{{{*/ 450 int PairRiftElements(int** priftsnumpairs, double*** priftspairs,int numrifts,int* riftsnumsegments, double** riftssegments,double* x,double* y){448 int PairRiftElements(int** priftsnumpairs,int*** priftspairs,int numrifts,int* riftsnumsegments,int** riftssegments,double* x,double* y){ 451 449 452 450 int noerr=1; … … 454 452 455 453 /*output: */ 456 int 457 double**riftspairs = NULL;454 int *riftsnumpairs = NULL; 455 int **riftspairs = NULL; 458 456 459 457 /*intermediary :*/ 460 int 461 double* segments=NULL;462 double* pairs=NULL;463 int 458 int numsegs; 459 int* segments=NULL; 460 int* pairs=NULL; 461 int node1,node2,node3,node4; 464 462 465 463 riftsnumpairs=xNew<int>(numrifts); 466 riftspairs=xNew< double*>(numrifts);464 riftspairs=xNew<int*>(numrifts); 467 465 for (i=0;i<numrifts;i++){ 468 466 segments=riftssegments[i]; 469 numsegs =riftsnumsegments[i];467 numsegs =riftsnumsegments[i]; 470 468 riftsnumpairs[i]=numsegs; 471 pairs=xNew< double>(2*numsegs);469 pairs=xNew<int>(2*numsegs); 472 470 for (j=0;j<numsegs;j++){ 473 *(pairs+2*j+0)=*(segments+3*j+2); //retrieve element to which this segment belongs.474 node1= (int)*(segments+3*j+0)-1; node2=(int)*(segments+3*j+1)-1;471 pairs[2*j+0]=segments[3*j+2]; //retrieve element to which this segment belongs. 472 node1=segments[3*j+0]-1; node2=segments[3*j+1]-1; 475 473 /*Find element facing on other side of rift: */ 476 474 for (k=0;k<numsegs;k++){ 477 475 if (k==j)continue; 478 node3= (int)*(segments+3*k+0)-1; node4=(int)*(segments+3*k+1)-1;476 node3=segments[3*k+0]-1; node4=segments[3*k+1]-1; 479 477 /*We are trying to find 2 elements, where position of node3 == position of node1, and position of node4 == position of node2*/ 480 478 if ( (x[node3]==x[node1]) && (y[node3]==y[node1]) && (x[node4]==x[node2]) && (y[node4]==y[node2]) 481 479 || (x[node3]==x[node2]) && (y[node3]==y[node2]) && (x[node4]==x[node1]) && (y[node4]==y[node1]) ){ 482 480 /*We found the corresponding element: */ 483 *(pairs+2*j+1)=*(segments+3*k+2);481 pairs[2*j+1]=segments[3*k+2]; 484 482 break; 485 483 } … … 495 493 }/*}}}*/ 496 494 /*FUNCTION RemoveRifts{{{*/ 497 int RemoveRifts( double** pindex,double** px,double** py,int* pnods,double** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,double** rifts1segments,double** rifts1pairs,int nel){495 int RemoveRifts(int** pindex,double** px,double** py,int* pnods,int** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,int** rifts1segments,int** rifts1pairs,int nel){ 498 496 499 497 int noerr=1; 500 498 int i,j,k,counter,counter1,counter2; 501 499 502 /*input: */503 double* index=NULL;504 double* x=NULL;505 double* y=NULL;506 int nods;507 double* segments=NULL;508 int numsegs;509 510 500 /*intermediary: */ 511 double*riftsegments = NULL;512 double*riftpairs = NULL;501 int *riftsegments = NULL; 502 int *riftpairs = NULL; 513 503 int node1,node2,node3,node4,temp_node; 514 doubleel2;504 int el2; 515 505 int newnods; //temporary # node counter. 516 506 double xmin,ymin; … … 523 513 524 514 /*Recover input: */ 525 in dex=*pindex;526 x=*px;527 y=*py;528 nods=*pnods;;529 segments=*psegments;530 numsegs=*pnumsegs;515 int *index = *pindex; 516 double *x = *px; 517 double *y = *py; 518 int nods = *pnods; ; 519 int *segments = *psegments; 520 int numsegs = *pnumsegs; 531 521 532 522 /*initialize newnods : */ … … 558 548 riftpairs=rifts1pairs[i]; 559 549 for (j=0;j<rifts1numsegs[i];j++){ 560 el2= *(riftpairs+2*j+1);550 el2=riftpairs[2*j+1]; 561 551 node1=(int)*(riftsegments+3*j+0); 562 552 node2=(int)*(riftsegments+3*j+1); … … 565 555 for (k=0;k<rifts1numsegs[i];k++){ 566 556 if (*(riftsegments+3*k+2)==el2){ 567 node3= (int)*(riftsegments+3*k+0);568 node4= (int)*(riftsegments+3*k+1);557 node3=*(riftsegments+3*k+0); 558 node4=*(riftsegments+3*k+1); 569 559 break; 570 560 } … … 677 667 }/*}}}*/ 678 668 /*FUNCTION IsRiftPresent{{{*/ 679 int IsRiftPresent(int* priftflag,int* pnumrifts, double* segmentmarkerlist,int nsegs){669 int IsRiftPresent(int* priftflag,int* pnumrifts,int* segmentmarkerlist,int nsegs){ 680 670 681 671 int i; … … 686 676 int numrifts=0; 687 677 688 doublemaxmark=1; //default marker for regular segments678 int maxmark=1; //default marker for regular segments 689 679 690 680 /*Any marker >=2 indicates a certain rift: */ … … 696 686 } 697 687 } 698 if 688 if(numrifts)riftflag=1; 699 689 700 690 /*Assign output pointers:*/ … … 704 694 }/*}}}*/ 705 695 /*FUNCTION OrderRifts{{{*/ 706 int OrderRifts( double** priftstips, double** riftssegments,double** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels){696 int OrderRifts(int** priftstips,int** riftssegments,int** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels){ 707 697 708 698 int noerr=1; … … 710 700 711 701 /*intermediary: */ 712 double*riftsegments = NULL;713 double*riftpairs = NULL;702 int *riftsegments = NULL; 703 int *riftpairs = NULL; 714 704 int numsegs; 715 705 716 706 /*ordering and copy: */ 717 int 718 double*riftsegments_copy = NULL;719 double*riftpairs_copy = NULL;707 int *order = NULL; 708 int *riftsegments_copy = NULL; 709 int *riftpairs_copy = NULL; 720 710 721 711 /*node and element manipulation: */ 722 int 723 doubleel2;724 int 712 int node1,node2,node3,node4,temp_node,tip1,tip2,node; 713 int el2; 714 int already_ordered=0; 725 715 726 716 /*output: */ 727 double* riftstips=NULL;717 int* riftstips=NULL; 728 718 729 719 /*Allocate byproduct of this routine, riftstips: */ 730 riftstips=xNew< double>(numrifts*2);720 riftstips=xNew<int>(numrifts*2); 731 721 732 722 /*Go through all rifts: */ 733 723 for (i=0;i<numrifts;i++){ 734 riftsegments =riftssegments[i];735 riftpairs =riftspairs[i];736 numsegs =riftsnumsegments[i];724 riftsegments = riftssegments[i]; 725 riftpairs = riftspairs[i]; 726 numsegs = riftsnumsegments[i]; 737 727 738 728 /*Allocate copy of riftsegments and riftpairs, 739 729 *as well as ordering vector: */ 740 riftsegments_copy=xNew< double>(numsegs*3);741 riftpairs_copy=xNew< double>(numsegs*2);730 riftsegments_copy=xNew<int>(numsegs*3); 731 riftpairs_copy=xNew<int>(numsegs*2); 742 732 order=xNew<int>(numsegs); 743 733 … … 748 738 for (j=0;j<numsegs;j++){ 749 739 el2=*(riftpairs+2*j+1); 750 node1= (int)*(riftsegments+3*j+0);751 node2= (int)*(riftsegments+3*j+1);740 node1=*(riftsegments+3*j+0); 741 node2=*(riftsegments+3*j+1); 752 742 /*Summary, el1 and el2 are facing one another across the rift. node1 and node2 belong to el1 and 753 743 *are located on the rift. Find node3 and node4, nodes belonging to el2 and located on the rift: */ 754 744 for (k=0;k<numsegs;k++){ 755 745 if (*(riftsegments+3*k+2)==el2){ 756 node3= (int)*(riftsegments+3*k+0);757 node4= (int)*(riftsegments+3*k+1);746 node3=*(riftsegments+3*k+0); 747 node4=*(riftsegments+3*k+1); 758 748 break; 759 749 } … … 796 786 797 787 /*Record tips in riftstips: */ 798 *(riftstips+2*i+0)= (double)tip1;799 *(riftstips+2*i+1)= (double)tip2;788 *(riftstips+2*i+0)=tip1; 789 *(riftstips+2*i+1)=tip2; 800 790 801 791 /*We have the two tips for this rift. Go from tip1 to tip2, and figure out the order in which segments are sequential. … … 804 794 for (counter=0;counter<numsegs;counter++){ 805 795 for (j=0;j<numsegs;j++){ 806 node1= (int)*(riftsegments+3*j+0);807 node2= (int)*(riftsegments+3*j+1);796 node1=*(riftsegments+3*j+0); 797 node2=*(riftsegments+3*j+1); 808 798 809 799 if ((node1==node) || (node2==node)){ … … 849 839 850 840 xDelete<int>(order); 851 xDelete< double>(riftsegments_copy);852 xDelete< double>(riftpairs_copy);841 xDelete<int>(riftsegments_copy); 842 xDelete<int>(riftpairs_copy); 853 843 854 844 } … … 859 849 }/*}}}*/ 860 850 /*FUNCTION PenaltyPairs{{{*/ 861 int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts, double** riftssegments,862 int* riftsnumsegs, double** riftspairs,double* riftstips,double* x,double* y){851 int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts,int** riftssegments, 852 int* riftsnumsegs,int** riftspairs,int* riftstips,double* x,double* y){ 863 853 864 854 int noerr=1; … … 875 865 /*intermediary: */ 876 866 int numsegs; 877 double* riftsegments=NULL;878 double* riftpairs=NULL;867 int* riftsegments=NULL; 868 int* riftpairs=NULL; 879 869 int counter; 880 870 double normal[2]; … … 980 970 /*Renormalize normals: */ 981 971 for(j=0;j<counter;j++){ 982 double magnitude=sqrt(pow( *(riftpenaltypairs+j*7+4),2) + pow( *(riftpenaltypairs+j*7+5),2) );972 double magnitude=sqrt(pow( double(riftpenaltypairs[j*7+4]),2) + pow( double(riftpenaltypairs[j*7+5]),2) ); 983 973 *(riftpenaltypairs+j*7+4)=*(riftpenaltypairs+j*7+4)/magnitude; 984 974 *(riftpenaltypairs+j*7+5)=*(riftpenaltypairs+j*7+5)/magnitude; … … 993 983 *priftsnumpenaltypairs=riftsnumpenaltypairs; 994 984 return noerr; 995 } 996 997 /****************************************************************************************************************************** 998 RemoveCorners 999 ******************************************************************************************************************************/ 1000 1001 int RemoveCornersFromRifts(double** pindex,int* pnel,double** px,double** py,int* pnods, double* segments,double* segmentmarkers,int num_seg){ 985 }/*}}}*/ 986 int RemoveCornersFromRifts(int** pindex,int* pnel,double** px,double** py,int* pnods,int* segments,int* segmentmarkers,int num_seg){/*{{{*/ 1002 987 1003 988 int noerr=1; 1004 989 int i,j,k; 1005 doublenode1,node2,node3;990 int node1,node2,node3; 1006 991 int el; 1007 1008 /*input: */1009 double* index=NULL;1010 int nel;1011 double* x=NULL;1012 double* y=NULL;1013 int nods;1014 992 double pair[2]; 1015 993 int pair_count=0; … … 1017 995 1018 996 /*Recover input: */ 1019 in dex=*pindex;1020 nel=*pnel;1021 x=*px;1022 y=*py;1023 nods=*pnods;997 int *index = *pindex; 998 int nel = *pnel; 999 double *x = *px; 1000 double *y = *py; 1001 int nods = *pnods; 1024 1002 1025 1003 for (i=0;i<num_seg;i++){ … … 1083 1061 x[nods]=(x[(int)node1-1]+x[(int)node2-1]+x[(int)node3-1])/3; 1084 1062 y[nods]=(y[(int)node1-1]+y[(int)node2-1]+y[(int)node3-1])/3; 1085 index=xReNew< double>(index,nel*3,(nel+2*3));1063 index=xReNew<int>(index,nel*3,(nel+2*3)); 1086 1064 /*First, reassign element el: */ 1087 1065 *(index+3*el+0)=node1; … … 1098 1076 /*we need to change the segment elements corresponding to el: */ 1099 1077 for (k=0;k<num_seg;k++){ 1100 if (*(segments+3*k+2)==( double)(el+1)){1101 if ( ((*(segments+3*k+0)==node1) && (*(segments+3*k+1)==node2)) || ((*(segments+3*k+0)==node2) && (*(segments+3*k+1)==node1))) *(segments+3*k+2)= (double)(el+1);1102 if ( ((*(segments+3*k+0)==node2) && (*(segments+3*k+1)==node3)) || ((*(segments+3*k+0)==node3) && (*(segments+3*k+1)==node2))) *(segments+3*k+2)= (double)(nel+1);1103 if ( ((*(segments+3*k+0)==node3) && (*(segments+3*k+1)==node1)) || ((*(segments+3*k+0)==node1) && (*(segments+3*k+1)==node3))) *(segments+3*k+2)= (double)(nel+2);1078 if (*(segments+3*k+2)==(el+1)){ 1079 if ( ((*(segments+3*k+0)==node1) && (*(segments+3*k+1)==node2)) || ((*(segments+3*k+0)==node2) && (*(segments+3*k+1)==node1))) *(segments+3*k+2)=el+1; 1080 if ( ((*(segments+3*k+0)==node2) && (*(segments+3*k+1)==node3)) || ((*(segments+3*k+0)==node3) && (*(segments+3*k+1)==node2))) *(segments+3*k+2)=nel+1; 1081 if ( ((*(segments+3*k+0)==node3) && (*(segments+3*k+1)==node1)) || ((*(segments+3*k+0)==node1) && (*(segments+3*k+1)==node3))) *(segments+3*k+2)=nel+2; 1104 1082 } 1105 1083 } … … 1121 1099 *pnods=nods; 1122 1100 return noerr; 1123 } 1101 }/*}}}*/ -
issm/trunk/src/c/shared/TriMesh/trimesh.h
r13975 r14310 10 10 11 11 //#define REAL double //took it out because it may conflict with stdlib.h defines. put back if necessary 12 int AssociateSegmentToElement( double** psegments,int nseg, double* index,int nel);13 int OrderSegments( double** psegments,int nseg, double* index,int nel);12 int AssociateSegmentToElement(int** psegments,int nseg,int* index,int nel); 13 int OrderSegments(int** psegments,int nseg, int* index,int nel); 14 14 int GridInsideHole(double* px0,double* py0,int n,double* x,double* y); 15 int FindElement( double A,double B,double* index,int nel);16 int SplitMeshForRifts(int* pnel, double** pindex,int* pnods,double** px,double** py,int* pnsegs,double** psegments,double** psegmentmarkerlist);15 int FindElement(int A,int B,int* index,int nel); 16 int SplitMeshForRifts(int* pnel,int** pindex,int* pnods,double** px,double** py,int* pnsegs,int** psegments,int** psegmentmarkerlist); 17 17 int IsGridOnRift(int* riftsegments, int nriftsegs, int node); 18 18 int GridElementsList(int** pGridElements, int* pNumGridElements,int node,double * index,int nel); 19 int IsNeighbor(int el1,int el2, double* index);19 int IsNeighbor(int el1,int el2,int* index); 20 20 int IsOnRift(int el,int nriftsegs,int* riftsegments); 21 void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel, double* index, int nsegs,double* segments);22 int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift, int segmentnumber, int nriftsegs, int* riftsegments, int node,double* index,int nel);23 int UpdateSegments( double** psegments,double** psegmentmarkerlist, int* pnsegs, double* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel);24 int FindElement(double A,double B, double* index,int nel);25 int RemoveRifts( double** pindex,double** px,double** py,int* pnods,double** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,double** rifts1segments,double** rifts1pairs,int nel);26 int IsRiftPresent(int* priftflag,int* pnumrifts, double* segmentmarkerlist,int nsegs);27 int SplitRiftSegments( double** psegments,double** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,double*** priftssegments,int numrifts,int nods,int nels);28 int OrderRifts( double** priftstips, double** riftssegments,double** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels);29 int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts, double** riftssegments,30 int* riftsnumsegments, double** riftspairs,double* riftstips,double* x,double* y);31 int RemoveCornersFromRifts( double** pindex,int* pnel,double** px,double** py,int* pnods, double* segments,double* segmentmarkers,int num_seg);32 int PairRiftElements(int** priftsnumpairs, double*** priftspairs,int numrifts,int* riftsnumsegments, double** riftssegments,double* x,double* y);21 void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel,int* index, int nsegs,int* segments); 22 int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift,int segmentnumber, int nriftsegs,int* riftsegments, int node,int* index,int nel); 23 int UpdateSegments(int** psegments,int** psegmentmarkerlist, int* pnsegs,int* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel); 24 int FindElement(double A,double B,int* index,int nel); 25 int RemoveRifts(int** pindex,double** px,double** py,int* pnods,int** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,int** rifts1segments,double** rifts1pairs,int nel); 26 int IsRiftPresent(int* priftflag,int* pnumrifts,int* segmentmarkerlist,int nsegs); 27 int SplitRiftSegments(int** psegments,int** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,int*** priftssegments,int numrifts,int nods,int nels); 28 int OrderRifts(int** priftstips,int** riftssegments,int** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels); 29 int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts,int** riftssegments, 30 int* riftsnumsegments,int** riftspairs,int* riftstips,double* x,double* y); 31 int RemoveCornersFromRifts(int** pindex,int* pnel,double** px,double** py,int* pnods,int* segments,int* segmentmarkers,int num_seg); 32 int PairRiftElements(int** priftsnumpairs,int*** priftspairs,int numrifts,int* riftsnumsegments,int** riftssegments,double* x,double* y); 33 33 34 34 #endif /* _SHARED_TRIMESH_H */ -
issm/trunk/src/c/solutions/AdjointCorePointerFromSolutionEnum.cpp
r13975 r14310 34 34 adjointcore=&adjointbalancethickness_core; 35 35 break; 36 case WeakBalancethicknessSolutionEnum: 37 adjointcore=&dummy_core; 38 break; 36 39 default: 37 40 _error_("No adjoint has been implemented for solution " << EnumToStringx(solutiontype) << " yet"); -
issm/trunk/src/c/solutions/AnalysisConfiguration.cpp
r13975 r14310 83 83 break; 84 84 85 case WeakBalancethicknessSolutionEnum: 86 numanalyses=1; 87 analyses=xNew<int>(numanalyses); 88 analyses[0]=BalancethicknessAnalysisEnum; 89 break; 90 85 91 case SurfaceSlopeSolutionEnum: 86 92 numanalyses=1; -
issm/trunk/src/c/solutions/CorePointerFromSolutionEnum.cpp
r13975 r14310 60 60 #endif 61 61 break; 62 case WeakBalancethicknessSolutionEnum: 63 #ifdef _HAVE_BALANCED_ 64 solutioncore=&dummy_core; 65 #else 66 _error_("ISSM was not compiled with balanced capabilities. Exiting"); 67 #endif 68 break; 62 69 case HydrologySolutionEnum: 63 70 #ifdef _HAVE_HYDROLOGY_ -
issm/trunk/src/c/solutions/EnvironmentInit.cpp
r13975 r14310 31 31 if(!my_rank) printf("\n"); 32 32 if(!my_rank) printf("Ice Sheet System Model (%s) version %s\n",PACKAGE_NAME,PACKAGE_VERSION); 33 if(!my_rank) printf("(website: %s contact: %s \n",PACKAGE_URL,PACKAGE_BUGREPORT);33 if(!my_rank) printf("(website: %s contact: %s)\n",PACKAGE_URL,PACKAGE_BUGREPORT); 34 34 if(!my_rank) printf("\n"); 35 35 -
issm/trunk/src/c/solutions/controltao_core.cpp
r13975 r14310 49 49 femmodel->parameters->FindParam(&control_list,NULL,InversionControlParametersEnum); 50 50 femmodel->parameters->FindParam(&nsteps,InversionNstepsEnum); 51 femmodel->parameters->FindParam(&dummy,NULL,NULL,InversionMaxiterPerStepEnum);52 51 femmodel->parameters->SetParam(false,SaveResultsEnum); 53 maxiter=nsteps* (int)dummy[0]; xDelete<IssmDouble>(dummy);52 maxiter=nsteps*10; 54 53 55 54 /*Initialize TAO*/ -
issm/trunk/src/c/solutions/convergence.cpp
r13395 r14310 65 65 66 66 //compute K[n]U[n-1]F = K[n]U[n-1] - F 67 _assert_(uf); _assert_(Kff); 67 68 KUold=uf->Duplicate(); Kff->MatMult(old_uf,KUold); 68 69 KUoldF=KUold->Duplicate();KUold->Copy(KUoldF); KUoldF->AYPX(pf,-1.0); -
issm/trunk/src/c/solutions/objectivefunction.cpp
r13975 r14310 46 46 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum); 47 47 } 48 else if (solution_type==WeakBalancethicknessSolutionEnum){ 49 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum); 50 } 48 51 else{ 49 52 _error_("Solution " << EnumToStringx(solution_type) << " not implemented yet"); … … 63 66 solver_linear(femmodel); 64 67 } 68 else if (solution_type==WeakBalancethicknessSolutionEnum){ 69 /*Don't do anything*/ 70 } 65 71 else{ 66 72 _error_("Solution " << EnumToStringx(solution_type) << " not implemented yet"); -
issm/trunk/src/c/solutions/solutions.h
r13975 r14310 33 33 void dakota_core(FemModel* femmodel); 34 34 void ad_core(FemModel* femmodel); 35 void dummy_core(FemModel* femmodel); 35 36 IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs); 36 37 -
issm/trunk/src/c/solvers/solver_newton.cpp
r13975 r14310 56 56 57 57 /*Solver forward model*/ 58 femmodel->SystemMatricesx(&Kff, &Kfs, &pf, &df, NULL); 58 if(count==1){ 59 femmodel->SystemMatricesx(&Kff, &Kfs, &pf, &df, NULL); 60 CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type); 61 Reduceloadx(pf,Kfs,ys);xdelete(&Kfs); 62 Solverx(&uf,Kff,pf,old_uf,df,femmodel->parameters);xdelete(&df); 63 Mergesolutionfromftogx(&ug,uf,ys,femmodel->nodes,femmodel->parameters);xdelete(&ys); 64 InputUpdateFromSolutionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ug);xdelete(&ug); 65 xdelete(&old_ug);old_ug=ug; 66 xdelete(&old_uf);old_uf=uf; 67 } 68 uf=old_uf->Duplicate(); old_uf->Copy(uf); 69 70 /*Prepare next iteration using Newton's method*/ 71 femmodel->SystemMatricesx(&Kff, &Kfs, &pf, &df, NULL);xdelete(&df); 59 72 CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type); 60 Reduceloadx(pf,Kfs,ys);xdelete(&Kfs); 61 Solverx(&uf,Kff,pf,old_uf,df,femmodel->parameters);xdelete(&df); 73 Reduceloadx(pf,Kfs,ys); xdelete(&Kfs); 74 75 pJf=pf->Duplicate(); 76 Kff->MatMult(uf,pJf);// xdelete(&Kff); 77 pJf->Scale(-1.0); pJf->AXPY(pf,+1.0); //xdelete(&pf); 78 79 femmodel->CreateJacobianMatrixx(&Jff,kmax); 80 Solverx(&duf,Jff,pJf,NULL,NULL,femmodel->parameters); xdelete(&Jff); xdelete(&pJf); 81 uf->AXPY(duf, 1.0); xdelete(&duf); 62 82 Mergesolutionfromftogx(&ug,uf,ys,femmodel->nodes,femmodel->parameters);xdelete(&ys); 63 InputUpdateFromSolutionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ug); xdelete(&ug);83 InputUpdateFromSolutionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ug); 64 84 65 85 /*Check convergence*/ … … 82 102 } 83 103 84 /*Prepare next iteration using Newton's method*/85 femmodel->SystemMatricesx(&Kff, &Kfs, &pf, &df, NULL);86 CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);87 Reduceloadx(pf,Kfs,ys); xdelete(&Kfs);88 89 pJf=pf->Duplicate(); Kff->MatMult(uf,pJf); xdelete(&Kff);90 pJf->Scale(-1.0); pJf->AXPY(pf,+1.0); xdelete(&pf);91 92 femmodel->CreateJacobianMatrixx(&Jff,kmax);93 Solverx(&duf,Jff,pJf,NULL,NULL,femmodel->parameters); xdelete(&Jff); xdelete(&pJf);94 uf->AXPY(duf, 1.0); xdelete(&duf);95 Mergesolutionfromftogx(&ug,uf,ys,femmodel->nodes,femmodel->parameters);xdelete(&ys);96 InputUpdateFromSolutionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ug);97 98 104 count++; 99 105 } -
issm/trunk/src/c/solvers/solver_thermal_nonlinear.cpp
r13975 r14310 33 33 /*parameters:*/ 34 34 int kflag,pflag; 35 bool lowmem=0;36 35 int configuration_type; 37 36 38 37 /*Recover parameters: */ 39 38 kflag=1; pflag=1; 40 femmodel->parameters->FindParam(&lowmem,SettingsLowmemEnum);41 39 femmodel->parameters->FindParam(&thermal_penalty_threshold,ThermalPenaltyThresholdEnum); 42 40 femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum); -
issm/trunk/src/m/boundaryconditions/SetIceShelfBC.py
r14067 r14310 25 25 if not os.path.exists(icefrontfile): 26 26 raise IOError("SetIceShelfBC error message: ice front file '%s' not found." % icefrontfile) 27 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements,md.mesh.x .reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2)27 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,icefrontfile,'node',2) 28 28 nodeonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1)) 29 29 else: -
issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py
r14067 r14310 27 27 if not os.path.exists(icefrontfile): 28 28 raise IOError("SetMarineIceSheetBC error message: ice front file '%s' not found." % icefrontfile) 29 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements,md.mesh.x .reshape(-1,1),md.mesh.y.reshape(-1,1),icefrontfile,'node',2)29 [nodeinsideicefront,dum]=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,icefrontfile,'node',2) 30 30 vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1)) 31 31 else: -
issm/trunk/src/m/classes/autodiff.m
r13975 r14310 43 43 end % }}} 44 44 function disp(obj) % {{{ 45 disp(sprintf(' 45 disp(sprintf(' automatic differentiation parameters:')); 46 46 fielddisplay(obj,'isautodiff','indicates if the automatic differentiation is activated'); 47 47 fielddisplay(obj,'dependents','list of dependent variables'); -
issm/trunk/src/m/classes/balancethickness.py
r13395 r14310 29 29 string=' balance thickness solution parameters:' 30 30 31 string="%s\n \n%s"%(string,fielddisplay(self,'spcthickness','thickness constraints (NaN means no constraint)'))31 string="%s\n%s"%(string,fielddisplay(self,'spcthickness','thickness constraints (NaN means no constraint)')) 32 32 string="%s\n%s"%(string,fielddisplay(self,'thickening_rate','ice thickening rate used in the mass conservation (dh/dt)')) 33 33 string="%s\n%s"%(string,fielddisplay(self,'stabilization',"0: None, 1: SU, 2: MacAyeal's artificial diffusivity, 3:DG")) -
issm/trunk/src/m/classes/basalforcings.py
r13395 r14310 28 28 string=" basal forcings parameters:" 29 29 30 string="%s\n \n%s"%(string,fielddisplay(self,"melting_rate","basal melting rate (positive if melting)"))30 string="%s\n%s"%(string,fielddisplay(self,"melting_rate","basal melting rate (positive if melting)")) 31 31 string="%s\n%s"%(string,fielddisplay(self,"melting_rate_correction","additional melting applied when the grounding line retreats")) 32 32 string="%s\n%s"%(string,fielddisplay(self,"geothermalflux","geothermal heat flux [W/m^2]")) -
issm/trunk/src/m/classes/constants.py
r13395 r14310 27 27 # {{{ Display 28 28 string=" constants parameters:" 29 string="%s\n\n%s"%(string,fielddisplay(self,"g","gravitational acceleration")) 29 30 string="%s\n%s"%(string,fielddisplay(self,"g","gravitational acceleration")) 30 31 string="%s\n%s"%(string,fielddisplay(self,"yts","number of seconds in a year")) 31 32 string="%s\n%s"%(string,fielddisplay(self,"referencetemperature","reference temperature used in the enthalpy model")) 32 33 33 34 34 return string 35 35 #}}} 36 37 36 def setdefaultparameters(self): 38 37 # {{{setdefaultparameters -
issm/trunk/src/m/classes/debug.py
r13395 r14310 26 26 string=" debug parameters:" 27 27 28 string="%s\n \n%s"%(string,fielddisplay(self,"valgrind","use Valgrind to debug (0 or 1)"))28 string="%s\n%s"%(string,fielddisplay(self,"valgrind","use Valgrind to debug (0 or 1)")) 29 29 string="%s\n%s"%(string,fielddisplay(self,"gprof","use gnu-profiler to find out where the time is spent")) 30 30 string="%s\n%s"%(string,fielddisplay(self,'profiling','enables profiling (memory, flops, time)')) -
issm/trunk/src/m/classes/diagnostic.py
r13975 r14310 45 45 # {{{ Display 46 46 47 string=' \nDiagnostic solution parameters:'48 string="%s\n \n%s"%(string,' Convergence criteria:')47 string=' Diagnostic solution parameters:' 48 string="%s\n%s"%(string,' Convergence criteria:') 49 49 50 50 string="%s\n%s"%(string,fielddisplay(self,'restol','mechanical equilibrium residual convergence criterion')) … … 55 55 string="%s\n%s"%(string,fielddisplay(self,'viscosity_overshoot','over-shooting constant new=new+C*(new-old)')) 56 56 57 string="%s\n%s"%(string,' boundary conditions:')57 string="%s\n%s"%(string,'\n boundary conditions:') 58 58 59 59 string="%s\n%s"%(string,fielddisplay(self,'spcvx','x-axis velocity constraint (NaN means no constraint)')) … … 62 62 string="%s\n%s"%(string,fielddisplay(self,'icefront','segments on ice front list (last column 0-> Air, 1-> Water, 2->Ice')) 63 63 64 string="%s\n%s"%(string,' Rift options:')64 string="%s\n%s"%(string,'\n Rift options:') 65 65 string="%s\n%s"%(string,fielddisplay(self,'rift_penalty_threshold','threshold for instability of mechanical constraints')) 66 66 string="%s\n%s"%(string,fielddisplay(self,'rift_penalty_lock','number of iterations before rift penalties are locked')) 67 67 68 string="%s\n%s"%(string,' Penalty options:')68 string="%s\n%s"%(string,'\n Penalty options:') 69 69 string="%s\n%s"%(string,fielddisplay(self,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset')) 70 70 string="%s\n%s"%(string,fielddisplay(self,'vertex_pairing','pairs of vertices that are penalized')) 71 71 72 string="%s\n%s"%(string,' Other:')72 string="%s\n%s"%(string,'\n Other:') 73 73 string="%s\n%s"%(string,fielddisplay(self,'shelf_dampening','use dampening for floating ice ? Only for Stokes model')) 74 74 string="%s\n%s"%(string,fielddisplay(self,'stokesreconditioning','multiplier for incompressibility equation. Only for Stokes model')) -
issm/trunk/src/m/classes/flowequation.py
r14067 r14310 37 37 string=' flow equation parameters:' 38 38 39 string="%s\n \n%s"%(string,fielddisplay(self,'ismacayealpattyn',"is the macayeal or pattyn approximation used ?"))39 string="%s\n%s"%(string,fielddisplay(self,'ismacayealpattyn',"is the macayeal or pattyn approximation used ?")) 40 40 string="%s\n%s"%(string,fielddisplay(self,'ishutter',"is the shallow ice approximation used ?")) 41 41 string="%s\n%s"%(string,fielddisplay(self,'isl1l2',"are l1l2 equations used ?")) -
issm/trunk/src/m/classes/friction.py
r13395 r14310 27 27 # {{{ Display 28 28 string="Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p" 29 string="%s\n\n%s"%(string,fielddisplay(self,"coefficient","friction coefficient [SI]")) 29 30 string="%s\n%s"%(string,fielddisplay(self,"coefficient","friction coefficient [SI]")) 30 31 string="%s\n%s"%(string,fielddisplay(self,"p","p exponent")) 31 32 string="%s\n%s"%(string,fielddisplay(self,"q","q exponent")) -
issm/trunk/src/m/classes/geometry.py
r13395 r14310 31 31 string=" geometry parameters:" 32 32 33 string="%s\n \n%s"%(string,fielddisplay(self,'surface','surface elevation'))33 string="%s\n%s"%(string,fielddisplay(self,'surface','surface elevation')) 34 34 string="%s\n%s"%(string,fielddisplay(self,'thickness','ice thickness')) 35 35 string="%s\n%s"%(string,fielddisplay(self,'bed','bed elevation')) -
issm/trunk/src/m/classes/groundingline.py
r13395 r14310 30 30 string=' grounding line solution parameters:' 31 31 32 string="%s\n \n%s"%(string,fielddisplay(self,'migration','type of grounding line migration: ''SoftMigration'',''AgressiveMigration'' or ''None'''))32 string="%s\n%s"%(string,fielddisplay(self,'migration','type of grounding line migration: ''SoftMigration'',''AgressiveMigration'' or ''None''')) 33 33 string="%s\n%s"%(string,fielddisplay(self,'melting_rate','melting rate applied when previously grounded parts start floating')) 34 34 return string -
issm/trunk/src/m/classes/hydrology.py
r13395 r14310 32 32 33 33 string=' hydrology solution parameters:' 34 string="%s\n \n%s"%(string,fielddisplay(self,'spcwatercolumn','water thickness constraints (NaN means no constraint)'))34 string="%s\n%s"%(string,fielddisplay(self,'spcwatercolumn','water thickness constraints (NaN means no constraint)')) 35 35 string="%s\n%s"%(string,fielddisplay(self,'n','Manning roughness coefficient')) 36 36 string="%s\n%s"%(string,fielddisplay(self,'CR','tortuosity parameter')) -
issm/trunk/src/m/classes/initialization.py
r14067 r14310 90 90 WriteData(fid,'data',self.pressure,'format','DoubleMat','mattype',1,'enum',PressureEnum()) 91 91 WriteData(fid,'data',self.temperature,'format','DoubleMat','mattype',1,'enum',TemperatureEnum()) 92 WriteData(fid,'data',self.surfacetemp,'format','DoubleMat','mattype',1,'enum',TemperatureSurfaceEnum())93 WriteData(fid,'data',self.basaltemp,'format','DoubleMat','mattype',1,'enum',TemperatureBasalEnum())94 92 WriteData(fid,'data',self.watercolumn,'format','DoubleMat','mattype',1,'enum',WatercolumnEnum()) 95 93 WriteData(fid,'data',self.waterfraction,'format','DoubleMat','mattype',1,'enum',WaterfractionEnum()) -
issm/trunk/src/m/classes/inversion.m
r13395 r14310 31 31 case 0 32 32 obj=setdefaultparameters(obj); 33 case 1 34 if isa(varargin{1},'taoinversion'), 35 disp('converting taoinversion to inversion'); 36 in=varargin{1}; 37 obj.iscontrol = in.iscontrol; 38 obj.tao = 1; 39 obj.incomplete_adjoint = in.incomplete_adjoint; 40 obj.control_parameters = in.control_parameters; 41 obj.nsteps = in.nsteps; 42 obj.maxiter_per_step = 10*ones(in.nsteps,1); 43 obj.cost_functions = repmat(in.cost_functions,in.nsteps,1); 44 obj.cost_functions_coefficients = in.cost_functions_coefficients; 45 obj.gradient_scaling = 100*ones(in.nsteps,1); 46 obj.cost_function_threshold = NaN; 47 obj.min_parameters = in.min_parameters; 48 obj.max_parameters = in.max_parameters; 49 obj.step_threshold = .99*ones(in.nsteps,1); 50 obj.vx_obs = in.vx_obs; 51 obj.gradient_only = 0; 52 obj.vy_obs = in.vy_obs; 53 obj.vz_obs = in.vz_obs; 54 obj.vel_obs = in.vel_obs; 55 obj.thickness_obs = in.thickness_obs; 56 end 33 57 otherwise 34 58 error('constructor not supported'); … … 86 110 md = checkfield(md,'inversion.tao','values',[0 1]); 87 111 md = checkfield(md,'inversion.incomplete_adjoint','values',[0 1]); 88 md = checkfield(md,'inversion.control_parameters','cell',1,'values',{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'MaterialsRheologyZbar' 'Vx' 'Vy'}); 112 md = checkfield(md,'inversion.control_parameters','cell',1,'values',... 113 {'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'MaterialsRheologyZbar' 'Vx' 'Vy' 'Thickness'}); 89 114 md = checkfield(md,'inversion.nsteps','numel',1,'>=',1); 90 115 md = checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0); 91 116 md = checkfield(md,'inversion.step_threshold','size',[md.inversion.nsteps 1]); 92 md = checkfield(md,'inversion.cost_functions','size',[md.inversion.nsteps num_costfunc],'values',[101:105 201 501:50 5]);117 md = checkfield(md,'inversion.cost_functions','size',[md.inversion.nsteps num_costfunc],'values',[101:105 201 501:506]); 93 118 md = checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0); 94 119 md = checkfield(md,'inversion.gradient_only','values',[0 1]); … … 99 124 if solution==BalancethicknessSolutionEnum() 100 125 md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1); 126 elseif solution==WeakBalancethicknessSolutionEnum() 127 md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1); 101 128 else 102 129 md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1); … … 105 132 end % }}} 106 133 function disp(obj) % {{{ 134 disp(sprintf(' inversion parameters:')); 107 135 fielddisplay(obj,'iscontrol','is inversion activated?'); 108 136 fielddisplay(obj,'incomplete_adjoint','do we assume linear viscosity?'); … … 176 204 pos=find(data==504); data(pos)=ThicknessAlongGradientEnum(); 177 205 pos=find(data==505); data(pos)=ThicknessAcrossGradientEnum(); 206 pos=find(data==506); data(pos)=BalancethicknessMisfitEnum(); 178 207 WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3); 179 208 WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer'); -
issm/trunk/src/m/classes/inversion.py
r13975 r14310 45 45 def __repr__(self): 46 46 # {{{ Display 47 string=' \n Inversion parameters:'47 string=' inversion parameters:' 48 48 string="%s\n%s"%(string,fielddisplay(self,'iscontrol','is inversion activated?')) 49 49 string="%s\n%s"%(string,fielddisplay(self,'incomplete_adjoint','do we assume linear viscosity?')) -
issm/trunk/src/m/classes/mask.m
r12706 r14310 12 12 vertexongroundedice = NaN; 13 13 vertexonwater = NaN; 14 vertexonrock = NaN; 14 15 end 15 16 methods … … 33 34 md = checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]); 34 35 md = checkfield(md,'mask.vertexonwater' ,'size',[md.mesh.numberofvertices 1],'values',[0 1]); 36 md = checkfield(md,'mask.vertexonrock' ,'size',[md.mesh.numberofvertices 1],'values',[0 1]); 35 37 end % }}} 36 38 function disp(obj) % {{{ 39 disp(sprintf(' masks:')); 40 37 41 fielddisplay(obj,'elementonfloatingice','element on floating ice flags list'); 38 42 fielddisplay(obj,'vertexonfloatingice','vertex on floating ice flags list'); 39 43 fielddisplay(obj,'elementongroundedice','element on grounded ice list'); 40 44 fielddisplay(obj,'vertexongroundedice','vertex on grounded ice flags list'); 41 fielddisplay(obj,'elementonwater','element on waterflags list');45 fielddisplay(obj,'elementonwater','element on rock flags list'); 42 46 fielddisplay(obj,'vertexonwater','vertex on water flags list'); 47 fielddisplay(obj,'vertexonrock','vertex on rock flags list'); 43 48 end % }}} 44 49 function marshall(obj,fid) % {{{ -
issm/trunk/src/m/classes/mask.py
r14067 r14310 29 29 def __repr__(self): 30 30 # {{{ Display 31 string=" masks:" 31 32 32 string="";33 33 string="%s\n%s"%(string,fielddisplay(self,"elementonfloatingice","element on floating ice flags list")) 34 34 string="%s\n%s"%(string,fielddisplay(self,"vertexonfloatingice","vertex on floating ice flags list")) -
issm/trunk/src/m/classes/matice.m
r13395 r14310 89 89 end % }}} 90 90 function disp(obj) % {{{ 91 disp(sprintf(' Materials: \n'));91 disp(sprintf(' Materials:')); 92 92 93 93 fielddisplay(obj,'rho_ice','ice density [kg/m^3]'); -
issm/trunk/src/m/classes/matice.py
r13975 r14310 38 38 string=" Materials:" 39 39 40 string="%s\n \n%s"%(string,fielddisplay(self,"rho_ice","ice density [kg/m^3]"))40 string="%s\n%s"%(string,fielddisplay(self,"rho_ice","ice density [kg/m^3]")) 41 41 string="%s\n%s"%(string,fielddisplay(self,"rho_water","water density [kg/m^3]")) 42 42 string="%s\n%s"%(string,fielddisplay(self,"rho_freshwater","fresh water density [kg/m^3]")) -
issm/trunk/src/m/classes/mesh.py
r14067 r14310 63 63 def __repr__(self): 64 64 # {{{ Display 65 string=" Mesh:" 66 65 67 66 68 if self.dimension==3: 67 string=" \n%s"%("Elements and vertices of the original 2d mesh:")69 string="%s\n%s"%(string,"\n Elements and vertices of the original 2d mesh:") 68 70 69 71 string="%s\n%s"%(string,fielddisplay(self,"numberofelements2d","number of elements")) … … 73 75 string="%s\n%s"%(string,fielddisplay(self,"y2d","vertices y coordinate")) 74 76 75 string="%s\n%s" %(string,"Elements and vertices of the extruded 3d mesh:")77 string="%s\n%s"%(string,"\n\n Elements and vertices of the extruded 3d mesh:") 76 78 else: 77 string=" \n%s"%("Elements and vertices:")79 string="%s\n%s"%(string,"\n Elements and vertices:") 78 80 string="%s\n%s"%(string,fielddisplay(self,"numberofelements","number of elements")) 79 81 string="%s\n%s"%(string,fielddisplay(self,"numberofvertices","number of vertices")) … … 85 87 string="%s\n%s"%(string,fielddisplay(self,"numberofedges","number of edges of the 2d mesh")) 86 88 87 string="%s%s"%(string,"\n Properties:")89 string="%s%s"%(string,"\n\n Properties:") 88 90 string="%s\n%s"%(string,fielddisplay(self,"dimension","mesh dimension (2d or 3d)")) 89 91 string="%s\n%s"%(string,fielddisplay(self,"numberoflayers","number of extrusion layers")) … … 103 105 string="%s\n%s"%(string,fielddisplay(self,"average_vertex_connectivity","average number of vertices connected to one vertex")) 104 106 105 string="%s%s"%(string,"\n Extracted model:")107 string="%s%s"%(string,"\n\n Extracted model:") 106 108 string="%s\n%s"%(string,fielddisplay(self,"extractedvertices","vertices extracted from the model")) 107 109 string="%s\n%s"%(string,fielddisplay(self,"extractedelements","elements extracted from the model")) 108 110 109 string="%s%s"%(string,"\n Projection:")111 string="%s%s"%(string,"\n\n Projection:") 110 112 string="%s\n%s"%(string,fielddisplay(self,"lat","vertices latitude")) 111 113 string="%s\n%s"%(string,fielddisplay(self,"long","vertices longitude")) -
issm/trunk/src/m/classes/miscellaneous.py
r13395 r14310 29 29 string=' miscellaneous parameters:' 30 30 31 string="%s\n \n%s"%(string,fielddisplay(self,'notes','notes in a cell of strings'))31 string="%s\n%s"%(string,fielddisplay(self,'notes','notes in a cell of strings')) 32 32 string="%s\n%s"%(string,fielddisplay(self,'name','model name')) 33 33 string="%s\n%s"%(string,fielddisplay(self,'dummy','empty field to store some data')) -
issm/trunk/src/m/classes/model/model.m
r13975 r14310 212 212 md.mask.elementonwater=project2d(md,md.mask.elementonwater,1); 213 213 md.mask.vertexonwater=project2d(md,md.mask.vertexonwater,1); 214 md.mask.vertexonrock=project2d(md,md.mask.vertexonrock,1); 214 215 215 216 %lat long … … 502 503 solutionfields=fields(md1.results); 503 504 for i=1:length(solutionfields), 504 %get subfields 505 solutionsubfields=fields(md1.results.(solutionfields{i})); 506 for j=1:length(solutionsubfields), 507 field=md1.results.(solutionfields{i}).(solutionsubfields{j}); 505 if isstruct(md1.results.(solutionfields{i})) 506 %get subfields 507 solutionsubfields=fields(md1.results.(solutionfields{i})); 508 for j=1:length(solutionsubfields), 509 field=md1.results.(solutionfields{i}).(solutionsubfields{j}); 510 if length(field)==numberofvertices1, 511 md2.results.(solutionfields{i}).(solutionsubfields{j})=field(pos_node); 512 elseif length(field)==numberofelements1, 513 md2.results.(solutionfields{i}).(solutionsubfields{j})=field(pos_elem); 514 else 515 md2.results.(solutionfields{i}).(solutionsubfields{j})=field; 516 end 517 end 518 else 519 field=md1.results.(solutionfields{i}); 508 520 if length(field)==numberofvertices1, 509 md2.results.(solutionfields{i}) .(solutionsubfields{j})=field(pos_node);521 md2.results.(solutionfields{i})=field(pos_node); 510 522 elseif length(field)==numberofelements1, 511 md2.results.(solutionfields{i}) .(solutionsubfields{j})=field(pos_elem);523 md2.results.(solutionfields{i})=field(pos_elem); 512 524 else 513 md2.results.(solutionfields{i}) .(solutionsubfields{j})=field;525 md2.results.(solutionfields{i})=field; 514 526 end 515 527 end … … 744 756 md.mask.elementonwater=project3d(md,'vector',md.mask.elementonwater,'type','element'); 745 757 md.mask.vertexonwater=project3d(md,'vector',md.mask.vertexonwater,'type','node'); 758 md.mask.vertexonrock=project3d(md,'vector',md.mask.vertexonrock,'type','node'); 746 759 if ~isnan(md.inversion.cost_functions_coefficients),md.inversion.cost_functions_coefficients=project3d(md,'vector',md.inversion.cost_functions_coefficients,'type','node');end; 747 760 if ~isnan(md.inversion.min_parameters),md.inversion.min_parameters=project3d(md,'vector',md.inversion.min_parameters,'type','node');end; … … 1120 1133 disp(sprintf('%19s: %-22s -- %s','miscellaneous' ,['[1x1 ' class(obj.miscellaneous) ']'],'miscellaneous fields')); 1121 1134 end % }}} 1135 function memory(obj) % {{{ 1136 1137 disp(sprintf('\nMemory imprint: ')); 1138 1139 objects=fields(obj); 1140 memory=0; 1141 1142 for i=1:length(objects), 1143 field=objects{i}; 1144 realobject=obj.(field); 1145 s=whos('realobject'); 1146 memory=memory+s.bytes/1e6; 1147 disp(sprintf('%19s: %g Mb',field,s.bytes/1e6)); 1148 end 1149 disp(sprintf('Overall: %g Mb',memory)); 1150 end % }}} 1122 1151 end 1123 1152 end -
issm/trunk/src/m/classes/model/model.py
r14067 r14310 45 45 from ElementConnectivity import * 46 46 from contourenvelope import * 47 from PythonFuncs import * 47 48 #}}} 48 49 … … 407 408 md2.diagnostic.icefront[:,2]=Pnode[md1.diagnostic.icefront[:,2].astype(int)-1] 408 409 md2.diagnostic.icefront[:,3]=Pnode[md1.diagnostic.icefront[:,3].astype(int)-1] 409 md2.diagnostic.icefront=md2.diagnostic.icefront[numpy.nonzero( numpy.logical_and(numpy.logical_and(md2.diagnostic.icefront[:,0],md2.diagnostic.icefront[:,1]),md2.diagnostic.icefront[:,-1]))[0],:]410 md2.diagnostic.icefront=md2.diagnostic.icefront[numpy.nonzero(logical_and_n(md2.diagnostic.icefront[:,0],md2.diagnostic.icefront[:,1],md2.diagnostic.icefront[:,-1]))[0],:] 410 411 411 412 #Results fields -
issm/trunk/src/m/classes/organizer.m
r13975 r14310 13 13 % org = organizer('repository','Models/','prefix','AGU2015','steps',0); %build an empty organizer object with a given repository 14 14 15 classdef organizer 15 classdef organizer < handle 16 16 properties (SetAccess=private) 17 17 % {{{ … … 112 112 end 113 113 end%}}} 114 function md=loaddata(org,string),% {{{ 115 116 %Get model path 117 if ~ischar(string), error('argument provided is not a string'); end 118 path=[org.repository '/' org.prefix string]; 119 120 %figure out if the data is there, otherwise, we have to use the default path supplied by user. 121 if exist(path,'file') | exist([path '.mat'],'file'), 122 evalin('caller',['load -mat ' path]); 123 return; 124 end 125 126 %If we are here, the data has not been found. Try trunk prefix if provided 127 if ~isempty(org.trunkprefix), 128 path2=[org.repository '/' org.trunkprefix string]; 129 if ~exist(path2,'file'), 130 error(['Could find neither ' path ', nor ' path2]); 131 else 132 disp(['--> Branching ' org.prefix ' from trunk ' org.trunkprefix]); 133 evalin('caller',['load -mat ' path2]); 134 return; 135 end 136 else 137 error(['Could not find ' path ]); 138 end 139 end%}}} 114 140 function bool=perform(org,string) % {{{ 115 141 … … 142 168 end 143 169 144 %assign org back to calling workspace145 assignin('caller',inputname(1),org);146 147 170 end%}}} 148 171 function savemodel(org,md) % {{{ … … 162 185 save(name,'md','-v7.3'); 163 186 end%}}} 187 function savedata(org,varargin) % {{{ 188 189 %check 190 if (org.currentstep==0), error('Cannot save data because organizer (org) is empty! Make sure you did not skip any perform call'); end 191 if (org.currentstep>length(org.steps)), error('Cannot save data because organizer (org) is not up to date!'); end 192 193 name=[org.repository '/' org.prefix org.steps(org.currentstep).string ]; 194 disp(['saving data in: ' name]); 195 196 %check that md is a model 197 if (org.currentstep>length(org.steps)), error(['organizer error message: element with id ' num2str(org.currentstep) ' not found']); end 198 199 %list of variable names: 200 variables=''; 201 for i=2:nargin, 202 variables=[variables ',' '''' inputname(i) '''']; 203 eval([inputname(i) '= varargin{' num2str(i-1) '};']); 204 end 205 eval(['save(''' name '''' variables ',''-v7.3'');']); 206 end%}}} 164 207 end 165 208 end -
issm/trunk/src/m/classes/pairoptions.m
r13975 r14310 5 5 % pairoptions=pairoptions('module',true,'solver',false); 6 6 7 classdef pairoptions 7 classdef pairoptions < handle 8 8 properties (SetAccess = private,GetAccess = private) 9 9 functionname = ''; 10 list = cell(0, 2);10 list = cell(0,3); 11 11 end 12 12 methods … … 38 38 39 39 %Allocate memory 40 obj.list=cell(numoptions, 2);40 obj.list=cell(numoptions,3); 41 41 42 42 %go through varargin and build list of obj … … 45 45 obj.list{i,1}=varargin{2*i-1}; 46 46 obj.list{i,2}=varargin{2*i}; 47 obj.list{i,3}=false; %used? 47 48 else 48 49 %option is not a string, ignore it … … 57 58 obj.list{end+1,1} = field; 58 59 obj.list{end,2} = value; 60 obj.list{end,3} = false; 59 61 end 60 62 end % }}} … … 65 67 obj.list{end+1,1} = field; 66 68 obj.list{end,2} = value; 69 obj.list{end,3} = true; %It is a default so user will not be notified if not used 67 70 end 68 71 end … … 84 87 %CHANGEOPTIONVALUE - change the value of an option in an option list 85 88 86 %track occur ance of field89 %track occurrence of field 87 90 lines=find(strcmpi(obj.list(:,1),field)); 88 91 … … 91 94 %add new field if not found 92 95 obj=addfield(obj,field,newvalue); 96 obj.list{end,3}=true; % do not notify user if unused 93 97 else 94 98 for i=1:length(lines), … … 100 104 %DELETEDUPLICATES - delete duplicates in an option list 101 105 102 %track the first occur ance of each option106 %track the first occurrence of each option 103 107 [dummy lines]=unique(obj.list(:,1),'first'); 104 108 clear dummy … … 109 113 for i=1:numoptions, 110 114 if ~ismember(i,lines), 111 disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occur ence will be kept'])115 disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurrence will be kept']) 112 116 end 113 117 end … … 116 120 %remove duplicates from the options list 117 121 obj.list=obj.list(lines,:); 122 end % }}} 123 function displayunused(obj) % {{{ 124 %DISPLAYUNUSED - display unused options 125 126 numoptions=size(obj.list,1); 127 for i=1:numoptions, 128 if ~obj.list{i,3}, 129 disp(['WARNING: option ' obj.list{i,1} ' was not used']) 130 end 131 end 118 132 end % }}} 119 133 function disp(obj) % {{{ … … 137 151 end % }}} 138 152 function bool = exist(obj,field) % {{{ 139 %EXIST - check if the option exist 153 %EXIST - check if the option exists 140 154 141 155 %some argument checking: … … 148 162 149 163 %Recover option 150 bool=any(strcmpi(field,obj.list(:,1))); 151 end % }}} 152 function num = fieldoccurences(obj,field), % {{{ 153 %FIELDOCCURENCES - get number of occurence of a field 164 pos=find(strcmpi(field,obj.list(:,1))); 165 if ~isempty(pos), 166 bool=true; 167 obj.list{pos,3} = true; %It is a default so user will not be notified if not used 168 else 169 bool=false; 170 end 171 end % }}} 172 function num = fieldoccurrences(obj,field), % {{{ 173 %FIELDOCCURRENCES - get number of occurrence of a field 154 174 155 175 %check input 156 176 if ~ischar(field), 157 error('fieldoccur ences error message: field should be a string');158 end 159 160 %get number of occur ence177 error('fieldoccurrences error message: field should be a string'); 178 end 179 180 %get number of occurrence 161 181 num=sum(strcmpi(field,obj.list(:,1))); 162 182 end % }}} … … 187 207 pos=find(strcmpi(obj.list(:,1),field)); 188 208 if ~isempty(pos), 189 value=obj.list{pos(1),2}; %ignore extra entry 209 value=obj.list{pos(1),2}; % ignore extra entry 210 obj.list{pos(1),3}=true; % option used 190 211 return; 191 212 end … … 204 225 % obj=removefield(obj,field,warn) 205 226 % 206 % if warn==1 display an info message to wa n user that227 % if warn==1 display an info message to warn user that 207 228 % some of his options have been removed. 208 229 -
issm/trunk/src/m/classes/pairoptions.py
r13975 r14310 78 78 # %DELETEDUPLICATES - delete duplicates in an option list 79 79 # 80 # %track the first occur ance of each option80 # %track the first occurrence of each option 81 81 # [dummy lines]=unique(obj.list(:,1),'first'); 82 82 # clear dummy … … 87 87 # for i=1:numoptions, 88 88 # if ~ismember(i,lines), 89 # disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occur ence will be kept'])89 # disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurrence will be kept']) 90 90 # end 91 91 # end … … 128 128 # }}} 129 129 130 #def fieldoccur ences(self,field): #{{{130 #def fieldoccurrences(self,field): #{{{ 131 131 # ''' 132 # FIELDOCCUR ENCES - get number of occurence of a field132 # FIELDOCCURRENCES - get number of occurrence of a field 133 133 # ''' 134 134 # 135 135 # #check input 136 136 # if not isinstance(field,(str,unicode)): 137 # raise TypeError("fieldoccur ences error message: field should be a string")138 139 # #get number of occur ence137 # raise TypeError("fieldoccurrences error message: field should be a string") 138 139 # #get number of occurrence 140 140 # # ?? 141 141 # #return num -
issm/trunk/src/m/classes/plotoptions.m
r12706 r14310 68 68 69 69 %get number of data to be plotted 70 numberofplots=fieldoccur ences(rawoptions,'data');70 numberofplots=fieldoccurrences(rawoptions,'data'); 71 71 opt.numberofplots=numberofplots; 72 72 … … 112 112 continue; 113 113 114 % #all114 %pound all 115 115 elseif strcmpi(plotnum,'all'); 116 116 for j=1:numberofplots, … … 118 118 end 119 119 120 % #i-j120 %pound i-j 121 121 elseif ismember('-',plotnum) 122 122 nums=strsplit(plotnum,'-'); … … 129 129 end 130 130 131 % #i131 %pound i 132 132 else 133 133 %assign to subplot -
issm/trunk/src/m/classes/prognostic.py
r13975 r14310 32 32 # {{{ Display 33 33 string=' Prognostic solution parameters:' 34 string="%s\n \n%s"%(string,fielddisplay(self,'spcthickness','thickness constraints (NaN means no constraint)'))34 string="%s\n%s"%(string,fielddisplay(self,'spcthickness','thickness constraints (NaN means no constraint)')) 35 35 string="%s\n%s"%(string,fielddisplay(self,'min_thickness','minimum ice thickness allowed')) 36 36 string="%s\n%s"%(string,fielddisplay(self,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ')) -
issm/trunk/src/m/classes/qmu/@dakota_method/dakota_method.m
r13975 r14310 620 620 dm.params.seed=false; 621 621 dm.params.fixed_seed=false; 622 dm.params.rng=false; 622 623 dm.params.samples=false; 623 624 dm.params.sample_type='lhs'; -
issm/trunk/src/m/classes/qmu/@dakota_method/dmeth_params_write.m
r13975 r14310 350 350 param_write(fid,sbeg,'seed',' = ','\n',dm.params); 351 351 param_write(fid,sbeg,'fixed_seed','','\n',dm.params); 352 if (str2num(dakotaversion())>4.2) 353 param_write(fid,sbeg,'rng',' ','\n',dm.params); 354 end 352 355 param_write(fid,sbeg,'samples',' = ','\n',dm.params); 353 356 param_write(fid,sbeg,'sample_type',' ','\n',dm.params); -
issm/trunk/src/m/classes/radaroverlay.py
r13395 r14310 24 24 # {{{ Display 25 25 string=' radaroverlay parameters:' 26 string="%s\n \n%s"%(string,fielddisplay(self,'pwr','radar power image (matrix)'))26 string="%s\n%s"%(string,fielddisplay(self,'pwr','radar power image (matrix)')) 27 27 string="%s\n%s"%(string,fielddisplay(self,'x','corresponding x coordinates')) 28 28 string="%s\n%s"%(string,fielddisplay(self,'y','corresponding y coordinates')) -
issm/trunk/src/m/classes/rifts.py
r13975 r14310 29 29 string=' rifts parameters:' 30 30 31 string="%s\n \n%s"%(string,fielddisplay(self,'riftstruct','structure containing all rift information (vertices coordinates, segments, type of melange, ...)'))31 string="%s\n%s"%(string,fielddisplay(self,'riftstruct','structure containing all rift information (vertices coordinates, segments, type of melange, ...)')) 32 32 string="%s\n%s"%(string,fielddisplay(self,'riftproperties','')) 33 33 return string -
issm/trunk/src/m/classes/settings.m
r13395 r14310 38 38 %onto the model after a parallel run by waiting for the lock file 39 39 %N minutes that is generated once the solution has converged 40 %0 to de sactivate40 %0 to deactivate 41 41 obj.waitonlock=Inf; 42 42 end % }}} … … 65 65 WriteData(fid,'object',obj,'fieldname','results_as_patches','format','Boolean'); 66 66 WriteData(fid,'object',obj,'fieldname','output_frequency','format','Integer'); 67 WriteData(fid,'object',obj,'fieldname','waitonlock','format','Boolean'); 67 if obj.waitonlock>0, 68 WriteData(fid,'enum',SettingsWaitonlockEnum(),'data',true,'format','Boolean'); 69 else 70 WriteData(fid,'enum',SettingsWaitonlockEnum(),'data',false,'format','Boolean'); 71 end 68 72 end % }}} 69 73 end -
issm/trunk/src/m/classes/settings.py
r13395 r14310 56 56 #onto the model after a parallel run by waiting for the lock file 57 57 #N minutes that is generated once the solution has converged 58 #0 to de sactivate59 self.waitonlock= float('Inf')58 #0 to deactivate 59 self.waitonlock=2**31-1 60 60 61 61 return self … … 77 77 WriteData(fid,'object',self,'fieldname','results_as_patches','format','Boolean') 78 78 WriteData(fid,'object',self,'fieldname','output_frequency','format','Integer') 79 WriteData(fid,'object',self,'fieldname','waitonlock','format','Boolean') 79 if self.waitonlock>0: 80 WriteData(fid,'enum',SettingsWaitonlockEnum(),'data',True,'format','Boolean'); 81 else: 82 WriteData(fid,'enum',SettingsWaitonlockEnum(),'data',False,'format','Boolean'); 80 83 # }}} 81 84 -
issm/trunk/src/m/classes/solver.py
r13395 r14310 3 3 from iluasmoptions import * 4 4 from EnumToString import EnumToString 5 from MatlabFuncs import *5 from fielddisplay import fielddisplay 6 6 from EnumDefinitions import * 7 7 from checkfield import * 8 from MatlabFuncs import * 8 9 9 10 class solver(object): … … 48 49 s ="List of solver options per analysis:\n\n" 49 50 for analysis in vars(self).iterkeys(): 50 s+="%s :\n" % analysis 51 s+="%s\n" % getattr(self,analysis) 51 s+="%s\n" % fielddisplay(self,analysis,'') 52 52 53 53 return s -
issm/trunk/src/m/classes/surfaceforcings.m
r13975 r14310 11 11 issmbgradients = 0; 12 12 isdelta18o = 0; 13 hc = NaN;14 13 href = NaN; 15 14 smbref = NaN; 16 smb_pos_max = NaN;17 smb_pos_min = NaN;18 a_pos = NaN;19 15 b_pos = NaN; 20 a_neg = NaN;21 16 b_neg = NaN; 22 17 monthlytemperatures = NaN; … … 61 56 end 62 57 elseif(obj.issmbgradients) 63 md = checkfield(md,'surfaceforcings.hc','forcing',1,'NaN',1);64 58 md = checkfield(md,'surfaceforcings.href','forcing',1,'NaN',1); 65 59 md = checkfield(md,'surfaceforcings.smbref','forcing',1,'NaN',1); 66 md = checkfield(md,'surfaceforcings.smb_pos_max','forcing',1,'NaN',1);67 md = checkfield(md,'surfaceforcings.smb_pos_min','forcing',1,'NaN',1);68 md = checkfield(md,'surfaceforcings.a_pos','forcing',1,'NaN',1);69 60 md = checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1); 70 md = checkfield(md,'surfaceforcings.a_neg','forcing',1,'NaN',1);71 61 md = checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1); 72 62 else … … 92 82 fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'); 93 83 fielddisplay(obj,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)'); 94 fielddisplay(obj,'hc',' elevation of intersection between accumulation and ablation regime required if smb gradients is activated');95 84 fielddisplay(obj,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method'); 96 85 fielddisplay(obj,'smbref',' reference smb from which deviation is calculated in smb gradients method'); 97 fielddisplay(obj,'smb_pos_max',' maximum value of positive smb required if smb gradients is activated');98 fielddisplay(obj,'smb_pos_min',' minimum value of positive smb required if smb gradients is activated');99 fielddisplay(obj,'a_pos',' intercept of hs - smb regression line for accumulation regime required if smb gradients is activated');100 86 fielddisplay(obj,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'); 101 fielddisplay(obj,'a_neg',' intercept of hs - smb regression line for ablation regime required if smb gradients is activated');102 87 fielddisplay(obj,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'); 103 88 … … 122 107 WriteData(fid,'object',obj,'fieldname','issmbgradients','format','Boolean'); 123 108 if obj.issmbgradients, 124 WriteData(fid,'object',obj,'fieldname','hc','format','DoubleMat','mattype',1);125 109 WriteData(fid,'object',obj,'fieldname','href','format','DoubleMat','mattype',1); 126 110 WriteData(fid,'object',obj,'fieldname','smbref','format','DoubleMat','mattype',1); 127 WriteData(fid,'object',obj,'fieldname','smb_pos_max','format','DoubleMat','mattype',1);128 WriteData(fid,'object',obj,'fieldname','smb_pos_min','format','DoubleMat','mattype',1);129 WriteData(fid,'object',obj,'fieldname','a_pos','format','DoubleMat','mattype',1);130 111 WriteData(fid,'object',obj,'fieldname','b_pos','format','DoubleMat','mattype',1); 131 WriteData(fid,'object',obj,'fieldname','a_neg','format','DoubleMat','mattype',1);132 112 WriteData(fid,'object',obj,'fieldname','b_neg','format','DoubleMat','mattype',1); 133 113 end -
issm/trunk/src/m/classes/surfaceforcings.py
r13975 r14310 21 21 self.issmbgradients = 0 22 22 self.isdelta18o = 0 23 self.hc = float('NaN')24 23 self.href = float('NaN') 25 24 self.smbref = float('NaN') 26 self.smb_pos_max = float('NaN')27 self.smb_pos_min = float('NaN')28 self.a_pos = float('NaN')29 25 self.b_pos = float('NaN') 30 self.a_neg = float('NaN')31 26 self.b_neg = float('NaN') 32 27 self.monthlytemperatures = float('NaN') … … 45 40 string=" surface forcings parameters:" 46 41 47 string="%s\n \n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]'))42 string="%s\n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]')) 48 43 string="%s\n%s"%(string,fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]')) 49 44 string="%s\n%s"%(string,fielddisplay(self,'ispdd','is pdd activated (0 or 1, default is 0)')) … … 57 52 string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated')) 58 53 string="%s\n%s"%(string,fielddisplay(self,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)')) 59 string="%s\n%s"%(string,fielddisplay(self,'hc',' elevation of intersection between accumulation and ablation regime required if smb gradients is activated'))60 54 string="%s\n%s"%(string,fielddisplay(self,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method')) 61 55 string="%s\n%s"%(string,fielddisplay(self,'smbref',' reference smb from which deviation is calculated in smb gradients method')) 62 string="%s\n%s"%(string,fielddisplay(self,'smb_pos_max',' maximum value of positive smb required if smb gradients is activated'))63 string="%s\n%s"%(string,fielddisplay(self,'smb_pos_min',' minimum value of positive smb required if smb gradients is activated'))64 string="%s\n%s"%(string,fielddisplay(self,'a_pos',' intercept of hs - smb regression line for accumulation regime required if smb gradients is activated'))65 56 string="%s\n%s"%(string,fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated')) 66 string="%s\n%s"%(string,fielddisplay(self,'a_neg',' intercept of hs - smb regression line for ablation regime required if smb gradients is activated'))67 57 string="%s\n%s"%(string,fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated')) 68 58 69 59 return string 70 60 #}}} 71 72 61 def setdefaultparameters(self): 73 62 # {{{setdefaultparameters … … 97 86 md = checkfield(md,'surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1) 98 87 elif self.issmbgradients: 99 md = checkfield(md,'surfaceforcings.hc','forcing',1,'NaN',1)100 88 md = checkfield(md,'surfaceforcings.href','forcing',1,'NaN',1) 101 89 md = checkfield(md,'surfaceforcings.smbref','forcing',1,'NaN',1) 102 md = checkfield(md,'surfaceforcings.smb_pos_max','forcing',1,'NaN',1)103 md = checkfield(md,'surfaceforcings.smb_pos_min','forcing',1,'NaN',1)104 md = checkfield(md,'surfaceforcings.a_pos','forcing',1,'NaN',1)105 90 md = checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1) 106 md = checkfield(md,'surfaceforcings.a_neg','forcing',1,'NaN',1)107 91 md = checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1) 108 92 else: … … 135 119 136 120 if self.issmbgradients: 137 WriteData(fid,'object',self,'fieldname','hc','format','DoubleMat','mattype',1)138 121 WriteData(fid,'object',self,'fieldname','href','format','DoubleMat','mattype',1) 139 122 WriteData(fid,'object',self,'fieldname','smbref','format','DoubleMat','mattype',1) 140 WriteData(fid,'object',self,'fieldname','smb_pos_max','format','DoubleMat','mattype',1)141 WriteData(fid,'object',self,'fieldname','smb_pos_min','format','DoubleMat','mattype',1)142 WriteData(fid,'object',self,'fieldname','a_pos','format','DoubleMat','mattype',1)143 123 WriteData(fid,'object',self,'fieldname','b_pos','format','DoubleMat','mattype',1) 144 WriteData(fid,'object',self,'fieldname','a_neg','format','DoubleMat','mattype',1)145 124 WriteData(fid,'object',self,'fieldname','b_neg','format','DoubleMat','mattype',1) 146 125 # }}} -
issm/trunk/src/m/classes/thermal.py
r13975 r14310 32 32 # {{{ Display 33 33 string=' Thermal solution parameters:' 34 string="%s\n \n%s"%(string,fielddisplay(self,'spctemperature','temperature constraints (NaN means no constraint)'))34 string="%s\n%s"%(string,fielddisplay(self,'spctemperature','temperature constraints (NaN means no constraint)')) 35 35 string="%s\n%s"%(string,fielddisplay(self,'stabilization','0->no, 1->artificial_diffusivity, 2->SUPG')) 36 36 string="%s\n%s"%(string,fielddisplay(self,'maxiter','maximum number of non linear iterations')) -
issm/trunk/src/m/classes/timestepping.m
r13395 r14310 6 6 classdef timestepping 7 7 properties (SetAccess=public) 8 start_time = 0 ;9 final_time = 0 ;10 time_step = 0 ;8 start_time = 0.; 9 final_time = 0.; 10 time_step = 0.; 11 11 time_adapt = 0; 12 cfl_coefficient = 0 ;12 cfl_coefficient = 0.; 13 13 end 14 14 methods … … 24 24 25 25 %time between 2 time steps 26 obj.time_step=1 /2;26 obj.time_step=1./2.; 27 27 28 28 %final time 29 obj.final_time=10 *obj.time_step;29 obj.final_time=10.*obj.time_step; 30 30 31 31 %time adaptation? 32 32 obj.time_adapt=0; 33 obj.cfl_coefficient= .5;33 obj.cfl_coefficient=0.5; 34 34 end % }}} 35 35 function md = checkconsistency(obj,md,solution,analyses) % {{{ -
issm/trunk/src/m/classes/timestepping.py
r13395 r14310 16 16 def __init__(self): 17 17 # {{{ Properties 18 self.start_time = 0 19 self.final_time = 0 20 self.time_step = 0 18 self.start_time = 0. 19 self.final_time = 0. 20 self.time_step = 0. 21 21 self.time_adapt = 0 22 self.cfl_coefficient = 0 22 self.cfl_coefficient = 0. 23 23 24 24 #set defaults … … 29 29 # {{{ Display 30 30 string=" timestepping parameters:" 31 string="%s\n \n%s"%(string,fielddisplay(self,"start_time","simulation starting time [yrs]"))31 string="%s\n%s"%(string,fielddisplay(self,"start_time","simulation starting time [yrs]")) 32 32 string="%s\n%s"%(string,fielddisplay(self,"final_time","final time to stop the simulation [yrs]")) 33 33 string="%s\n%s"%(string,fielddisplay(self,"time_step","length of time steps [yrs]")) … … 41 41 42 42 #time between 2 time steps 43 self.time_step=1 /243 self.time_step=1./2. 44 44 45 45 #final time 46 self.final_time=10 *self.time_step46 self.final_time=10.*self.time_step 47 47 48 48 #time adaptation? 49 49 self.time_adapt=0 50 self.cfl_coefficient= .550 self.cfl_coefficient=0.5 51 51 52 52 return self -
issm/trunk/src/m/consistency/ismodelselfconsistent.m
r13975 r14310 69 69 analyses=[BalancethicknessAnalysisEnum()]; 70 70 71 case WeakBalancethicknessSolutionEnum(), 72 numanalyses=1; 73 analyses=[BalancethicknessAnalysisEnum()]; 74 71 75 case SurfaceSlopeSolutionEnum(), 72 76 numanalyses=1; -
issm/trunk/src/m/contrib/bamg/YamsCall.m
r13975 r14310 16 16 17 17 %2d geometric parameter (do not change) 18 scale=2 /9;18 scale=2./9.; 19 19 20 20 %Compute Hessian … … 60 60 triangles=[]; 61 61 for i=1:size(md.rifts.riftstruct,1), 62 triangles=[triangles md.rifts(i). segments(:,3)'];62 triangles=[triangles md.rifts(i).riftstruct.segments(:,3)']; 63 63 end 64 64 … … 76 76 %windows 77 77 system(['yams2-win -O 1 -v -0 -ecp -hgrad ' num2str(gradation) ' carre0 carre1']); 78 elseif ismac 78 elseif ismac() 79 79 %Macosx 80 80 system(['yams2-osx -O 1 -v -0 -ecp -hgrad ' num2str(gradation) ' carre0 carre1']); -
issm/trunk/src/m/enum/EnumDefinitions.py
r13975 r14310 1849 1849 return StringToEnum('SurfaceforcingsMonthlytemperatures')[0] 1850 1850 1851 def SurfaceforcingsHcEnum():1852 """1853 SURFACEFORCINGSHCENUM - Enum of SurfaceforcingsHc1854 1855 Usage:1856 macro=SurfaceforcingsHcEnum()1857 """1858 1859 return StringToEnum('SurfaceforcingsHc')[0]1860 1861 1851 def SurfaceforcingsHrefEnum(): 1862 1852 """ … … 1879 1869 return StringToEnum('SurfaceforcingsSmbref')[0] 1880 1870 1881 def SurfaceforcingsSmbPosMaxEnum():1882 """1883 SURFACEFORCINGSSMBPOSMAXENUM - Enum of SurfaceforcingsSmbPosMax1884 1885 Usage:1886 macro=SurfaceforcingsSmbPosMaxEnum()1887 """1888 1889 return StringToEnum('SurfaceforcingsSmbPosMax')[0]1890 1891 def SurfaceforcingsSmbPosMinEnum():1892 """1893 SURFACEFORCINGSSMBPOSMINENUM - Enum of SurfaceforcingsSmbPosMin1894 1895 Usage:1896 macro=SurfaceforcingsSmbPosMinEnum()1897 """1898 1899 return StringToEnum('SurfaceforcingsSmbPosMin')[0]1900 1901 def SurfaceforcingsAPosEnum():1902 """1903 SURFACEFORCINGSAPOSENUM - Enum of SurfaceforcingsAPos1904 1905 Usage:1906 macro=SurfaceforcingsAPosEnum()1907 """1908 1909 return StringToEnum('SurfaceforcingsAPos')[0]1910 1911 1871 def SurfaceforcingsBPosEnum(): 1912 1872 """ … … 1919 1879 return StringToEnum('SurfaceforcingsBPos')[0] 1920 1880 1921 def SurfaceforcingsANegEnum():1922 """1923 SURFACEFORCINGSANEGENUM - Enum of SurfaceforcingsANeg1924 1925 Usage:1926 macro=SurfaceforcingsANegEnum()1927 """1928 1929 return StringToEnum('SurfaceforcingsANeg')[0]1930 1931 1881 def SurfaceforcingsBNegEnum(): 1932 1882 """ … … 2219 2169 return StringToEnum('BalancethicknessSolution')[0] 2220 2170 2171 def WeakBalancethicknessAnalysisEnum(): 2172 """ 2173 WEAKBALANCETHICKNESSANALYSISENUM - Enum of WeakBalancethicknessAnalysis 2174 2175 Usage: 2176 macro=WeakBalancethicknessAnalysisEnum() 2177 """ 2178 2179 return StringToEnum('WeakBalancethicknessAnalysis')[0] 2180 2181 def WeakBalancethicknessSolutionEnum(): 2182 """ 2183 WEAKBALANCETHICKNESSSOLUTIONENUM - Enum of WeakBalancethicknessSolution 2184 2185 Usage: 2186 macro=WeakBalancethicknessSolutionEnum() 2187 """ 2188 2189 return StringToEnum('WeakBalancethicknessSolution')[0] 2190 2221 2191 def BedSlopeAnalysisEnum(): 2222 2192 """ … … 3299 3269 return StringToEnum('Adjointz')[0] 3300 3270 3271 def BalancethicknessMisfitEnum(): 3272 """ 3273 BALANCETHICKNESSMISFITENUM - Enum of BalancethicknessMisfit 3274 3275 Usage: 3276 macro=BalancethicknessMisfitEnum() 3277 """ 3278 3279 return StringToEnum('BalancethicknessMisfit')[0] 3280 3301 3281 def BedSlopeXEnum(): 3302 3282 """ … … 3569 3549 return StringToEnum('QmuMelting')[0] 3570 3550 3551 def AndroidFrictionCoefficientEnum(): 3552 """ 3553 ANDROIDFRICTIONCOEFFICIENTENUM - Enum of AndroidFrictionCoefficient 3554 3555 Usage: 3556 macro=AndroidFrictionCoefficientEnum() 3557 """ 3558 3559 return StringToEnum('AndroidFrictionCoefficient')[0] 3560 3571 3561 def ResetPenaltiesEnum(): 3572 3562 """ … … 3999 3989 return StringToEnum('TransientInput')[0] 4000 3990 4001 def OutputfilenameEnum():4002 """4003 OUTPUTFILENAMEENUM - Enum of Outputfilename4004 4005 Usage:4006 macro=OutputfilenameEnum()4007 """4008 4009 return StringToEnum('Outputfilename')[0]4010 4011 3991 def WaterfractionEnum(): 4012 3992 """ … … 4997 4977 """ 4998 4978 4999 return 49 85000 4979 return 496 4980 -
issm/trunk/src/m/enum/MaximumNumberOfEnums.m
r13975 r14310 9 9 % macro=MaximumNumberOfEnums() 10 10 11 macro=49 8;11 macro=496; -
issm/trunk/src/m/exp/expwrite.m
r13975 r14310 15 15 % See also EXPDOC, EXPREAD, EXPWRITEASVERTICES 16 16 17 %check input variable 18 if ~isstruct(a), 19 error('first argument is not a structure'); 20 end 21 22 %Add density if it's not there 23 if ~isfield(a,'density'), 24 for n=1:length(a), 25 a(n).density=1; 26 end 27 end 28 17 29 fid=fopen(filename,'w'); 18 30 for n=1:length(a), … … 22 34 23 35 if isfield(a,'name'), 24 if ~isempty(a(n).name), 25 fprintf(fid,'%s%s\n','## Name:',a(n).name); 26 else 27 fprintf(fid,'%s\n','## Name:'); 28 end 36 fprintf(fid,'%s%s\n','## Name:',a(n).name); 29 37 else 30 fprintf(fid,'%s \n','## Name:');38 fprintf(fid,'%s%s\n','## Name:',filename); 31 39 end 32 40 … … 35 43 fprintf(fid,'%i %f\n',[length(a(n).x) a(n).density]); 36 44 fprintf(fid,'%s\n','# X pos Y pos'); 37 fprintf(fid,'%10.10f %10.10f\n',[a(n).x a(n).y]');45 fprintf(fid,'%10.10f %10.10f\n',[a(n).x(:) a(n).y(:)]'); 38 46 fprintf(fid,'\n'); 39 47 -
issm/trunk/src/m/exp/expwrite.py
r13395 r14310 25 25 26 26 if 'name' in contour: 27 if contour['name']: 28 fid.write("%s%s\n" % ('## Name:',contour['name'])) 29 else: 30 fid.write("%s\n" % '## Name:') 27 fid.write("%s%s\n" % ('## Name:',contour['name'])) 31 28 else: 32 fid.write("%s \n" % '## Name:')29 fid.write("%s%s\n" % ('## Name:',filename)) 33 30 31 #Add density if it's not there 32 if 'density' not in contour: 33 contour['density']=1 34 34 35 fid.write("%s\n" % '## Icon:0') 35 36 fid.write("%s\n" % '# Points Count Value') -
issm/trunk/src/m/exp/flowlines.m
r13395 r14310 38 38 39 39 %check seed points 40 tria=TriaSearch(index,x,y,x0,y0); 40 %tria=TriaSearch(index,x,y,x0,y0); 41 tria=tsearch(x,y,index,x0,y0); 41 42 pos=find(isnan(tria)); 42 43 x0(pos)=[]; … … 69 70 %find current triangle 70 71 queue=find(~done); 71 tria=TriaSearch(index,x,y,X(queue),Y(queue)); 72 %tria=TriaSearch(index,x,y,X(queue),Y(queue)); 73 tria=tsearch(x,y,index,X(queue),Y(queue)); 72 74 73 75 %check that the point is actually inside a triangle of the mesh … … 118 120 %find current triangle 119 121 queue=find(~done); 120 tria=TriaSearch(index,x,y,X(queue),Y(queue)); 122 %tria=TriaSearch(index,x,y,X(queue),Y(queue)); 123 tria=tsearch(x,y,index,X(queue),Y(queue)); 121 124 122 125 %check that the point is actually inside a triangle of the mesh -
issm/trunk/src/m/geometry/FlagElements.py
r14067 r14310 4 4 from ContourToMesh import * 5 5 from MatlabFuncs import * 6 from PythonFuncs import * 6 7 7 8 def FlagElements(md,region): … … 43 44 raise RuntimeError("FlagElements.py calling basinzoom.py is not complete.") 44 45 xlim,ylim=basinzoom('basin',region) 45 flag_nodes= numpy.logical_and(numpy.logical_and(md.mesh.x<xlim[1],md.mesh.x>xlim[0]),numpy.logical_and(md.mesh.y<ylim[1],md.mesh.y>ylim[0]))46 flag_nodes=logical_and_n(md.mesh.x<xlim[1],md.mesh.x>xlim[0],md.mesh.y<ylim[1],md.mesh.y>ylim[0]) 46 47 flag=numpy.prod(flag_nodes[md.mesh.elements],axis=1).astype(bool) 47 48 else: 48 49 #ok, flag elements 49 [flag,dum]=ContourToMesh(md.mesh.elements[:,0:3].copy(),md.mesh.x .reshape(-1,1),md.mesh.y.reshape(-1,1),region,'element',1)50 [flag,dum]=ContourToMesh(md.mesh.elements[:,0:3].copy(),md.mesh.x,md.mesh.y,region,'element',1) 50 51 flag=flag.astype(bool) 51 52 -
issm/trunk/src/m/mech/mechanicalproperties.m
r13975 r14310 119 119 120 120 strainrate=struct('xx',[],'yy',[],'xy',[],'principalvalue1',[],'principalaxis1',[],'principalvalue2',[],'principalaxis2',[],'effectivevalue',[]); 121 strainrate.xx=ux ;122 strainrate.yy=vy ;123 strainrate.xy=uyvx ;124 strainrate.principalvalue1=valuesstrain(:,1)* (365.25*24*3600); %strain rate in 1/a instead of 1/s121 strainrate.xx=ux*md.constants.yts; %strain rate in 1/a instead of 1/s 122 strainrate.yy=vy*md.constants.yts; 123 strainrate.xy=uyvx*md.constants.yts; 124 strainrate.principalvalue1=valuesstrain(:,1)*md.constants.yts; 125 125 strainrate.principalaxis1=directionsstrain(:,1:2); 126 strainrate.principalvalue2=valuesstrain(:,2)* (365.25*24*3600); %strain rate in 1/a instead of 1/s126 strainrate.principalvalue2=valuesstrain(:,2)*md.constants.yts; 127 127 strainrate.principalaxis2=directionsstrain(:,3:4); 128 128 strainrate.effectivevalue=1/sqrt(2)*sqrt(strainrate.xx.^2+strainrate.yy.^2+2*strainrate.xy.^2); -
issm/trunk/src/m/mesh/ComputeMetric.m
r13975 r14310 13 13 lambda1=0.5*((a+d)+sqrt(4.*b.^2+(a-d).^2)); 14 14 lambda2=0.5*((a+d)-sqrt(4.*b.^2+(a-d).^2)); 15 pos1=find(lambda1==0 );16 pos2=find(lambda2==0 );17 pos3=find(b==0 & lambda1==lambda2);15 pos1=find(lambda1==0.); 16 pos2=find(lambda2==0.); 17 pos3=find(b==0. & lambda1==lambda2); 18 18 19 19 %Modify the eigen values to control the shape of the elements -
issm/trunk/src/m/mesh/ComputeMetric.py
r13975 r14310 19 19 lambda1=0.5*((a+d)+numpy.sqrt(4.*b**2+(a-d)**2)) 20 20 lambda2=0.5*((a+d)-numpy.sqrt(4.*b**2+(a-d)**2)) 21 pos1=numpy.nonzero(lambda1==0 )[0]22 pos2=numpy.nonzero(lambda2==0 )[0]23 pos3=numpy.nonzero(numpy.logical_and(b==0 ,lambda1==lambda2))[0]21 pos1=numpy.nonzero(lambda1==0.)[0] 22 pos2=numpy.nonzero(lambda2==0.)[0] 23 pos3=numpy.nonzero(numpy.logical_and(b==0.,lambda1==lambda2))[0] 24 24 25 25 #Modify the eigen values to control the shape of the elements … … 54 54 #take care of NaNs if any (use Numpy eig in a loop) 55 55 pos=numpy.nonzero(numpy.isnan(metric))[0] 56 if pos:56 if numpy.size(pos): 57 57 print(" %i NaN found in the metric. Use Numpy routine..." % numpy.size(pos)) 58 58 for posi in pos: -
issm/trunk/src/m/mesh/ElementsFromEdge.py
r13975 r14310 1 1 import numpy 2 from PythonFuncs import * 2 3 3 4 def ElementsFromEdge(elements,A,B): … … 12 13 13 14 edgeelements=numpy.nonzero(\ 14 numpy.logical_or( \ 15 numpy.logical_or( \ 16 numpy.logical_or(numpy.logical_and(elements[:,0]==A,elements[:,1]==B), \ 17 numpy.logical_and(elements[:,0]==A,elements[:,2]==B)) \ 18 , \ 19 numpy.logical_or(numpy.logical_and(elements[:,1]==A,elements[:,2]==B), \ 20 numpy.logical_and(elements[:,1]==A,elements[:,0]==B)) \ 21 ), \ 22 numpy.logical_or(numpy.logical_and(elements[:,2]==A,elements[:,0]==B), \ 23 numpy.logical_and(elements[:,2]==A,elements[:,1]==B)) \ 15 logical_or_n(numpy.logical_and(elements[:,0]==A,elements[:,1]==B), \ 16 numpy.logical_and(elements[:,0]==A,elements[:,2]==B), \ 17 numpy.logical_and(elements[:,1]==A,elements[:,2]==B), \ 18 numpy.logical_and(elements[:,1]==A,elements[:,0]==B), \ 19 numpy.logical_and(elements[:,2]==A,elements[:,0]==B), \ 20 numpy.logical_and(elements[:,2]==A,elements[:,1]==B), \ 24 21 ))[0]+1 25 22 -
issm/trunk/src/m/mesh/bamg.py
r14067 r14310 92 92 #Checks that all holes are INSIDE the principle domain outline 93 93 if i: 94 flags=ContourToNodes(domaini['x'] .reshape(-1,1),domaini['y'].reshape(-1,1),domainfile,0)94 flags=ContourToNodes(domaini['x'],domaini['y'],domainfile,0) 95 95 if numpy.any(numpy.logical_not(flags)): 96 96 raise RuntimeError("bamg error message: All holes should be strictly inside the principal domain") … … 118 118 119 119 #detect whether all points of the rift are inside the domain 120 flags=ContourToNodes(rifti['x'] .reshape(-1,1),rifti['y'].reshape(-1,1),domain[0],0)120 flags=ContourToNodes(rifti['x'],rifti['y'],domain[0],0) 121 121 if numpy.all(numpy.logical_not(flags)): 122 122 raise RuntimeError("one rift has all its points outside of the domain outline") -
issm/trunk/src/m/mesh/rifts/meshprocessoutsiderifts.py
r14067 r14310 16 16 17 17 #first, flag nodes that belong to the domain outline 18 flags=ContourToMesh(md.mesh.elements,md.mesh.x .reshape(-1,1),md.mesh.y.reshape(-1,1),domainoutline,'node',0)18 flags=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,domainoutline,'node',0) 19 19 20 20 tips=rift.tips -
issm/trunk/src/m/mesh/rifts/meshprocessrifts.py
r14067 r14310 49 49 50 50 #In case we have rifts that open up the domain outline, we need to open them: 51 [flags,dum]=ContourToMesh(md.mesh.elements,md.mesh.x .reshape(-1,1),md.mesh.y.reshape(-1,1),domainoutline,'node',0)51 [flags,dum]=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,domainoutline,'node',0) 52 52 found=0 53 53 for rift in md.rifts.riftstruct: -
issm/trunk/src/m/mesh/squaremesh.m
r13395 r14310 15 15 16 16 %initialization 17 segments=zeros(0,3);18 17 index=zeros(nel,3); 19 18 x=zeros(nx*ny,1); … … 23 22 for n=1:nx, 24 23 for m=1:ny, 25 x((n-1)*ny+m)=(n-1 );26 y((n-1)*ny+m)=(m-1 );24 x((n-1)*ny+m)=(n-1.); 25 y((n-1)*ny+m)=(m-1.); 27 26 end 28 27 end -
issm/trunk/src/m/miscellaneous/MatlabFuncs.py
r13975 r14310 8 8 9 9 if 'Windows' in platform.system(): 10 return True 11 else: 12 return False 13 14 def ismac(): 15 import platform 16 17 if 'Darwin' in platform.system(): 10 18 return True 11 19 else: … … 89 97 return a 90 98 99 def heaviside(x): 100 import numpy 101 102 y=numpy.zeros_like(x) 103 y[numpy.nonzero(x> 0.)]=1. 104 y[numpy.nonzero(x==0.)]=0.5 105 106 return y 107 -
issm/trunk/src/m/parameterization/contourenvelope.m
r13975 r14310 101 101 els2=mesh.elementconnectivity(el1,find(mesh.elementconnectivity(el1,:))); 102 102 if length(els2)>1, 103 flag=intersect( mesh.elements(els2(1),:),mesh.elements(els2(2),:));103 flag=intersect(intersect(mesh.elements(els2(1),:),mesh.elements(els2(2),:)),mesh.elements(el1,:)); 104 104 nods1=mesh.elements(el1,:); 105 105 nods1(find(nods1==flag))=[]; -
issm/trunk/src/m/parameterization/contourenvelope.py
r14067 r14310 99 99 els2=mesh.elementconnectivity[el1,numpy.nonzero(mesh.elementconnectivity[el1,:])[0]]-1 100 100 if numpy.size(els2)>1: 101 flag=numpy.intersect1d( mesh.elements[els2[0],:],mesh.elements[els2[1],:])101 flag=numpy.intersect1d(numpy.intersect1d(mesh.elements[els2[0],:],mesh.elements[els2[1],:]),mesh.elements[el1,:]) 102 102 nods1=mesh.elements[el1,:] 103 103 nods1=numpy.delete(nods1,numpy.nonzero(nods1==flag)) -
issm/trunk/src/m/parameterization/setflowequation.py
r14067 r14310 3 3 from pairoptions import * 4 4 from MatlabFuncs import * 5 from PythonFuncs import * 5 6 from FlagElements import * 6 7 … … 50 51 #Flag the elements that have not been flagged as filltype 51 52 if strcmpi(filltype,'hutter'): 52 hutterflag[numpy.nonzero(numpy.logical_not( numpy.logical_or(macayealflag,pattynflag)))]=True53 hutterflag[numpy.nonzero(numpy.logical_not(logical_or_n(macayealflag,pattynflag)))]=True 53 54 elif strcmpi(filltype,'macayeal'): 54 macayealflag[numpy.nonzero(numpy.logical_not( numpy.logical_or(hutterflag,numpy.logical_or(pattynflag,stokesflag))))]=True55 macayealflag[numpy.nonzero(numpy.logical_not(logical_or_n(hutterflag,pattynflag,stokesflag)))]=True 55 56 elif strcmpi(filltype,'pattyn'): 56 pattynflag[numpy.nonzero(numpy.logical_not( numpy.logical_or(hutterflag,numpy.logical_or(macayealflag,stokesflag))))]=True57 pattynflag[numpy.nonzero(numpy.logical_not(logical_or_n(hutterflag,macayealflag,stokesflag)))]=True 57 58 58 59 #check that each element has at least one flag … … 69 70 #Check that no pattyn or stokes for 2d mesh 70 71 if md.mesh.dimension==2: 71 if numpy.any( numpy.logical_or(l1l2flag,stokesflag,pattynflag)):72 if numpy.any(logical_or_n(l1l2flag,stokesflag,pattynflag)): 72 73 raise TypeError("stokes and pattyn elements not allowed in 2d mesh, extrude it first") 73 74 -
issm/trunk/src/m/plot/applyoptions.m
r14067 r14310 331 331 end 332 332 333 %position of figure334 if exist(options,'figposition'),335 336 figposition=getfieldvalue(options,'figposition');337 if ischar(figposition),338 if strcmpi(figposition,'larour'),339 set(gcf,'Position',[1604 4 1594 1177]);340 elseif strcmpi(figposition,'larour2'),341 set(gcf,'Position',[756 62 827 504]);342 elseif strcmpi(figposition,'mathieu'),343 set(gcf,'Position',[300 1 1580 1150]);344 elseif strcmpi(figposition,'fullscreen'),345 set(gcf,'Position',get(0,'ScreenSize'));346 elseif strcmpi(figposition,'halfright'),347 screen=get(0,'ScreenSize');348 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;349 set(gcf,'Position',fix([left+widt/2 bott widt/2 heig]));350 elseif strcmpi(figposition,'halfleft'),351 screen=get(0,'ScreenSize');352 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;353 set(gcf,'Position',fix([left bott widt/2 heig]));354 elseif strcmpi(figposition,'square'),355 screen=get(0,'ScreenSize');356 left=screen(1); bott=screen(2); widt=min(screen(3)-25,screen(4)-25);357 set(gcf,'Position',fix([left+(screen(3)-widt) bott widt widt]));358 elseif strcmpi(figposition,'portrait'),359 %reformat with letter paper size (8.5" x 11")360 screen=get(0,'ScreenSize');361 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;362 portrait=fix([left+widt-(heig*8.5/11) bott heig*8.5/11 heig]);363 set(gcf,'Position',portrait)364 elseif strcmpi(figposition,'landscape'),365 %reformat with letter paper size (8.5" x 11")366 screen=get(0,'ScreenSize');367 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25;368 landscape=fix([left+widt-(heig*11/8.5) bott heig*11/8.5 heig]);369 set(gcf,'Position',landscape)370 else371 disp('''figposition'' string not supported yet');372 end373 else374 set(gcf,'Position',figposition);375 end376 377 end378 379 333 %axes position 380 334 if exist(options,'axesPosition') … … 446 400 set(gca,'color',getfieldvalue(options,'backgroundcolor','none')); 447 401 448 %figurebackgrounbcolor449 set(gcf,'color',getfieldvalue(options,'figurebackgroundcolor','w'));450 451 402 %lighting 452 403 if strcmpi(getfieldvalue(options,'light','off'),'on'), -
issm/trunk/src/m/plot/applyoptions.py
r13975 r14310 1 from matplotlib.ticker import MaxNLocator 1 2 2 3 try: … … 107 108 #}}} 108 109 110 #ticklabel notation {{{ 111 p.gca().ticklabel_format(style='sci',scilimits=(0,0)) 112 #}}} 113 109 114 #ticklabelfontsize {{{ 110 115 if options.exist('ticklabelfontsize'): … … 116 121 label.set_fontsize(options.getfieldvalue('ticklabelfontsize')) 117 122 #}}} 123 118 124 #view 119 125 … … 137 143 #ShowBasins 138 144 139 #Caxis 145 #clim {{{ 146 if options.exist('clim'): 147 lims=options.getfieldvalue('clim') 148 if len(lims)!=2: 149 print 'WARNING: clim should be passed as a list of length 2' 150 else: 151 p.clim(lims[0],lims[1]) 152 #}}} 140 153 141 154 #shading … … 152 165 153 166 #colorbar {{{ 154 if 'on' in options.getfieldvalue('colorbar','off'): 155 p.colorbar() 167 if options.getfieldvalue('colorbar','off')==1: 168 cb=p.colorbar() 169 cb.locator=MaxNLocator(nbins=5) # default 5 ticks 170 cb.update_ticks() 171 if options.exist('colorbarnumticks'): 172 cb.locator=MaxNLocator(nbins=options.getfieldvalue('colorbarnumticks',5)) 173 cb.update_ticks() 156 174 #}}} 157 175 -
issm/trunk/src/m/plot/checkplotoptions.m
r13975 r14310 81 81 end 82 82 textweightvalues=repmat(textweightvalues,1,numtext); textweightvalues(numtext+1:end)=[]; 83 83 84 %3: textsize 84 85 if exist(options,'textsize'), … … 107 108 end 108 109 textcolorvalues=repmat(textcolorvalues,1,numtext); textcolorvalues(numtext+1:end)=[]; 109 % 4: textposition110 %5: textposition 110 111 if exist(options,'textposition'), 111 112 textpositionvalues=getfieldvalue(options,'textposition'); … … 191 192 if strcmpi(getfieldvalue(options,'scaleruler'),'on') 192 193 %default values 193 Lx=max(md.mesh. y)-min(md.mesh.y);194 Lx=max(md.mesh.x)-min(md.mesh.x); 194 195 Ly=max(md.mesh.y)-min(md.mesh.y); 195 196 %default values -
issm/trunk/src/m/plot/checkplotoptions.py
r13975 r14310 1 import numpy as npy 2 1 3 def checkplotoptions(md,options): 2 4 ''' … … 11 13 ''' 12 14 13 print "WARNING: checkplotoptions not implemented: options returned as passed" 15 16 #units 17 if options.exist('unit'): 18 if 'km' in options.getfieldvalue('unit','km'): 19 options.changefieldvalue('unit',10**-3) 20 if '100km' in options.getfieldvalue('unit','100km'): 21 options.changefieldvalue('unit',10**-5) 22 23 #density 24 if options.exist('density'): 25 density=options.getfieldvalue('density') 26 options.changefieldvalue('density',abs(ceil(density))) 27 28 #show section 29 if options.exist('showsection'): 30 if 'on' in options.getfieldvalue('showsection','on'): 31 options.changefieldvalue('showsection',4) 32 33 #smooth values 34 if options.exist('smooth'): 35 if 'on' in options.getfieldvalue('smooth','on'): 36 options.changefieldvalue('smooth',0) 37 38 #contouronly values 39 if options.exist('contouronly'): 40 if 'on' in options.getfieldvalue('contouronly','on'): 41 options.changefieldvalue('contouronly',1) 42 43 #colorbar 44 if options.exist('colorbar'): 45 if 'on' in options.getfieldvalue('colorbar','on'): 46 options.changefieldvalue('colorbar',1) 47 elif 'off' in options.getfieldvalue('colorbar','off'): 48 options.changefieldvalue('colorbar',0) 49 50 #text 51 if options.exist('text'): 52 #1: textvalue 53 textvalues=options.getfieldvalue('text') 54 numtext=len(textvalues) 55 56 #2: textweight 57 if options.exist('textweight'): 58 textweightvalues=options.getfieldvalue('textweight') 59 else: 60 textweightvalues='n' 61 textweightvalues=npy.tile(textweightvalues,numtext) 62 63 #3 textsize 64 if options.exist('textsize'): 65 textsizevalues=options.getfieldvalue('textsize') 66 else: 67 textsizevalues=14 68 textsizevalues=npy.tile(textsizevalues,numtext) 69 70 #4 textcolor 71 if options.exist('textcolor'): 72 textcolorvalues=options.getfieldvalue('textcolor') 73 else: 74 textcolorvalues='k' 75 textcolorvalues=npy.tile(textsizevalues,numtext) 76 77 #5 textposition 78 if options.exist('textposition'): 79 options.getfieldvalue('textposition') 80 else: 81 raise Exception("plotmodel error message: 'textposition' option is missing") 82 83 #6 textrotation 84 if options.exist('textrotation'): 85 textrotationvalues=options.getfieldvalue('textrotation') 86 else: 87 textrotationvalues=0 88 textrotationvalues=npy.tile(textrotationvalues,numtext) 89 90 options.changfieldvalue('text',textvalues) 91 options.changfieldvalue('textsize',textsizevalues) 92 options.changfieldvalue('textweight',textweightvalues) 93 options.changfieldvalue('textcolor',textcolorvalues) 94 options.changfieldvalue('textposition',textpositionvalues) 95 options.changfieldvalue('textrotation',textrotationvalues) 96 97 #expdisp 98 expdispvaluesarray=[0,0] 99 expstylevaluesarray=[0,0] 100 expstylevalues=[0,0] 101 if options.exist('expstyle'): 102 expstylevalues=options.getfieldvalue('expstyle') 103 if options.exist('expdisp'): 104 expdispvalues=options.getfieldvalue('expdisp') 105 for i in npy.arange(len(expdispvalues)): 106 expdispvaluesarray.append(expdispvalues[i]) 107 if len(expstylevalues)>i+1: 108 expstylevaluesarray.append(expstylevalues[i]) 109 else: 110 expstylevaluesarray.append('-k') 111 112 options.changefieldvalue('expstyle',expstylevaluesarray) 113 options.changefieldvalue('expdisp',expdispvaluesarray) 114 115 #latlonnumbering 116 if options.exist('latlonclick'): 117 if 'on' in options.getfieldvalue('latlonclick','on'): 118 options.changefieldvalue('latlonclick',1) 119 120 #northarrow 121 if options.exist('northarrow'): 122 if 'on' in options.getfieldvalue('northarrow','on'): 123 #default values 124 Lx=max(md.mesh.x)-min(md.mesh.x) 125 Ly=max(md.mesh.y)-min(md.mesh.y) 126 options.changefieldvalue('northarrow',[min(md.mesh.x)+1./6.*Lx, min(md.mesh.y)+5./6.*Ly, 1./15.*Ly, 0.25, 1./250.*Ly]) 127 128 #scale ruler 129 if options.exist('scaleruler'): 130 if 'on' in options.exist('scaleruler','on'): 131 Lx=max(md.mesh.x)-min(md.mesh.x) 132 Ly=max(md.mesh.y)-min(md.mesh.y) 133 options.changefieldvalue('scaleruler',[min(md.mesh.x)+6./8.*Lx, min(md.mesh.y)+1./10.*Ly, 10**(ceil(log10(Lx)))/5, floor(Lx/100), 5]) 134 135 #log scale 136 if options.exist('log'): 137 if options.exist('caxis'): 138 options.changefieldvalue('caxis',log(options.getfieldvalue('caxis'))/log(options.getfieldvalue('log'))) 139 options.changefieldvalue('cutoff',log(options.getfieldvalue('cutoff',1.5))/log(options.getfieldvalue('log'))) 140 14 141 return options 15 -
issm/trunk/src/m/plot/kmlgroundoverlay.m
r13975 r14310 34 34 35 35 %print image at high resolution 36 printmodel([kmlroot '/' kmlimagename],kmlimagetype,'trim','on','resolution',kmlresolution,'margin','off','frame','off'); 36 export_fig([kmlroot '/' kmlimagename],'-transparent','-zbuffer'); %zbuffer to avoid "Bad data returned by HARDCOPY. Not calling IMWRITE" 37 %printmodel([kmlroot '/' kmlimagename],kmlimagetype,'trim','on','resolution',kmlresolution,'margin','off','frame','off'); 37 38 38 39 %now write kml file -
issm/trunk/src/m/plot/latlonoverlay.m
r13975 r14310 87 87 if (xcorner>xlimits(1) & xcorner<xlimits(2) & ycorner>ylimits(1) & ycorner<ylimits(2)), 88 88 angle=mod((180)/pi*atan2((ycorner2-ycorner),(xcorner2-xcorner))+latangle,360); 89 if lat<0, label=[num2str(abs(lat)) '^{\circ} S'];90 else label=[num2str(abs(lat)) '^{\circ} N']; end89 if lat<0, label=[num2str(abs(lat)) '^{\circ} S']; 90 else label=[num2str(abs(lat)) '^{\circ} N']; end 91 91 th=text(xcorner,ycorner,label); 92 92 set(th,'Color',colornumber,'Rotation',angle,'FontSize',fontsize,'HorizontalAlignment','center','VerticalAlignment','middle','Clipping','on'); … … 130 130 if (xcorner>xlimits(1) & xcorner<xlimits(2) & ycorner>ylimits(1) & ycorner<ylimits(2)), 131 131 angle=mod((180)/pi*atan2((ycorner2-ycorner),(xcorner2-xcorner))+lonangle,360); 132 if lon<0, label=[num2str(abs(lon)) '^{\circ} W'];133 else label=[num2str(abs(lon)) '^{\circ} E']; end132 if lon<0, label=[num2str(abs(lon)) '^{\circ} W']; 133 else label=[num2str(abs(lon)) '^{\circ} E']; end 134 134 th=text(xcorner,ycorner,label); 135 135 set(th,'Color',colornumber,'Rotation',angle,'FontSize',fontsize,'HorizontalAlignment','center','VerticalAlignment','middle','Clipping','on'); -
issm/trunk/src/m/plot/plot_BC.m
r13975 r14310 7 7 8 8 %plot dirichlets 9 h1=plot3(... 10 md.mesh.x(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),... 11 md.mesh.y(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),... 12 md.mesh.z(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),... 13 'ro','MarkerSize',14,'MarkerFaceColor','r'); 14 h2=plot3(... 15 md.mesh.x(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),... 16 md.mesh.y(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),... 17 md.mesh.z(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),... 18 'bo','MarkerSize',10,'MarkerFaceColor','b'); 19 h3=plot3(... 20 md.mesh.x(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),... 21 md.mesh.y(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),... 22 md.mesh.z(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),... 23 'yo','MarkerSize',6 ,'MarkerFaceColor','y'); 9 dirichleton=getfieldvalue(options,'dirichlet','on'); 10 if strcmpi(dirichleton,'on'), 11 h1=plot3(... 12 md.mesh.x(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),... 13 md.mesh.y(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),... 14 md.mesh.z(find(~isnan(md.diagnostic.spcvx(1:md.mesh.numberofvertices,1)))),... 15 'ro','MarkerSize',14,'MarkerFaceColor','r'); 16 h2=plot3(... 17 md.mesh.x(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),... 18 md.mesh.y(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),... 19 md.mesh.z(find(~isnan(md.diagnostic.spcvy(1:md.mesh.numberofvertices,1)))),... 20 'bo','MarkerSize',10,'MarkerFaceColor','b'); 21 h3=plot3(... 22 md.mesh.x(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),... 23 md.mesh.y(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),... 24 md.mesh.z(find(~isnan(md.diagnostic.spcvz(1:md.mesh.numberofvertices,1)))),... 25 'yo','MarkerSize',6 ,'MarkerFaceColor','y'); 26 end 24 27 25 28 %update legend 26 29 [legend_h,object_h,plot_h,text_strings]=legend(); 27 30 legend('off'); 28 text_strings{end+1}='vx Dirichlet'; 29 text_strings{end+1}='vy Dirichlet'; 30 if h3, text_strings{end+1}='vz Dirichlet'; end 31 plot_h(end+1)=h1; 32 plot_h(end+1)=h2; 33 if h3, plot_h(end+1)=h3; end 31 if strcmpi(dirichleton,'on'), 32 text_strings{end+1}='vx Dirichlet'; 33 text_strings{end+1}='vy Dirichlet'; 34 if h3, text_strings{end+1}='vz Dirichlet'; end 35 plot_h(end+1)=h1; 36 plot_h(end+1)=h2; 37 if h3, plot_h(end+1)=h3; end 38 end 34 39 legend(plot_h,text_strings,'location','NorthEast') 35 40 -
issm/trunk/src/m/plot/plot_gridded.m
r13395 r14310 24 24 [x_m y_m data_grid]=InterpFromMeshToGrid(elements,x,y,data,xlim(1),ylim(2),post,post,round(diff(ylim)/post),round(diff(xlim)/post),NaN); 25 25 if size(data_grid,1)<3 | size(data_grid,2)<3, 26 error('data_grid size too small in plot_gridded, check posting and uni ');26 error('data_grid size too small in plot_gridded, check posting and units'); 27 27 end 28 28 -
issm/trunk/src/m/plot/plot_manager.py
r13975 r14310 57 57 58 58 #standard plot 59 p.subplot(nlines,ncols,i )59 p.subplot(nlines,ncols,i,aspect='equal') 60 60 61 61 #plot unit … … 64 64 #apply all options 65 65 applyoptions(md,data2,options) 66 66 67 67 #ground overlay on kml plot_unit -
issm/trunk/src/m/plot/plot_mesh.py
r13975 r14310 21 21 22 22 if is2d: 23 p.subplot(nlines,ncols,i )23 p.subplot(nlines,ncols,i,aspect='equal') 24 24 p.triplot(x,y,elements) 25 25 else: -
issm/trunk/src/m/plot/plotmodel.m
r13975 r14310 34 34 35 35 %Create figure 36 f=figure(figurenumber);clf; 36 37 if strcmpi(getfieldvalue(options.list{1},'visible','on'),'off'), 37 F=figure(figurenumber);clf; 38 set(F,'Visible','Off'); 39 else 40 figure(figurenumber);clf; 38 set(f,'Visible','Off'); 41 39 end 42 40 43 %Use zbuffer renderer (snoother colors) 44 set(gcf,'Renderer','zbuffer'); 41 if exist(options.list{1},'figposition'), % {{{ 42 figposition=getfieldvalue(options.list{1},'figposition'); 43 if ischar(figposition), 44 if strcmpi(figposition,'larour'), 45 set(gcf,'Position',[1604 4 1594 1177]); 46 elseif strcmpi(figposition,'larour2'), 47 set(gcf,'Position',[756 62 827 504]); 48 elseif strcmpi(figposition,'mathieu'), 49 set(gcf,'Position',[300 1 1580 1150]); 50 elseif strcmpi(figposition,'fullscreen'), 51 set(gcf,'Position',get(0,'ScreenSize')); 52 elseif strcmpi(figposition,'halfright'), 53 screen=get(0,'ScreenSize'); 54 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25; 55 set(gcf,'Position',fix([left+widt/2 bott widt/2 heig])); 56 elseif strcmpi(figposition,'halfleft'), 57 screen=get(0,'ScreenSize'); 58 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25; 59 set(gcf,'Position',fix([left bott widt/2 heig])); 60 elseif strcmpi(figposition,'square'), 61 screen=get(0,'ScreenSize'); 62 left=screen(1); bott=screen(2); widt=min(screen(3)-25,screen(4)-25); 63 set(gcf,'Position',fix([left+(screen(3)-widt) bott widt widt])); 64 elseif strcmpi(figposition,'portrait'), 65 %reformat with letter paper size (8.5" x 11") 66 screen=get(0,'ScreenSize'); 67 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25; 68 portrait=fix([left+widt-(heig*8.5/11) bott heig*8.5/11 heig]); 69 set(gcf,'Position',portrait) 70 elseif strcmpi(figposition,'landscape'), 71 %reformat with letter paper size (8.5" x 11") 72 screen=get(0,'ScreenSize'); 73 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25; 74 landscape=fix([left+widt-(heig*11/8.5) bott heig*11/8.5 heig]); 75 set(gcf,'Position',landscape) 76 else 77 disp('''figposition'' string not supported yet'); 78 end 79 else 80 set(gcf,'Position',figposition); 81 end 82 end % }}} 83 84 %Use zbuffer renderer (snoother colors) and white background 85 set(f,'Renderer','zbuffer','color',getfieldvalue(options.list{1},'figurebackgroundcolor','w')); 45 86 46 87 %Go through all data plottable and close window if an error occurs … … 48 89 for i=1:numberofplots, 49 90 plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i); 91 %List all unused options 92 displayunused(options.list{i}) 50 93 end 51 94 catch me, -
issm/trunk/src/m/plot/plotmodel.py
r13975 r14310 1 import numpy as npy 1 2 2 3 try: … … 21 22 subplotwidth=ceil(sqrt(options.numberofplots)) 22 23 24 #Get figure number and number of plots 25 figurenumber=options.figurenumber 26 numberofplots=options.numberofplots 27 23 28 #if nlines and ncols specified, then bypass 24 29 if options.list[0].exist('nlines'): … … 26 31 nl=True 27 32 else: 28 nlines= subplotwidth33 nlines=npy.ceil(numberofplots/subplotwidth) 29 34 nl=False 30 35 … … 40 45 raise StandardError('error: nlines and ncols need to be specified together, or not at all') 41 46 42 #Get figure number and number of plots43 figurenumber=options.figurenumber44 numberofplots=options.numberofplots45 47 46 48 #Go through plots … … 60 62 #try: 61 63 for i in xrange(numberofplots): 62 plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i )64 plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i+1) 63 65 #except StandardError: 64 66 # print 'error in plot_manager' 65 67 else: 66 68 raise StandardError('plotmodel error message: no output data found.') 67 -
issm/trunk/src/m/qmu/dakota_cdfs.m
r13975 r14310 247 247 irow=irow+1; 248 248 cdf(irow,1)=resp(i); 249 cdf(irow,2)=normcdf (resp(i),mu,sigma);249 cdf(irow,2)=normcdf_issm(resp(i),mu,sigma); 250 250 cdf(irow,3)=(mu-resp(i))/sigma; 251 251 cdf(irow,4)=(mu-resp(i))/sigma; … … 256 256 for i=1:length(prob) 257 257 irow=irow+1; 258 cdf(irow,1)=norminv (prob(i),mu,sigma);258 cdf(irow,1)=norminv_issm(prob(i),mu,sigma); 259 259 cdf(irow,2)=prob(i); 260 cdf(irow,3)=-norminv (prob(i),0,1);261 cdf(irow,4)=-norminv (prob(i),0,1);260 cdf(irow,3)=-norminv_issm(prob(i),0,1); 261 cdf(irow,4)=-norminv_issm(prob(i),0,1); 262 262 end 263 263 … … 267 267 irow=irow+1; 268 268 cdf(irow,1)=mu-sigma*rel(i); 269 cdf(irow,2)=normcdf (-rel(i),0,1);269 cdf(irow,2)=normcdf_issm(-rel(i),0,1); 270 270 cdf(irow,3)=rel(i); 271 271 cdf(irow,4)=rel(i); … … 277 277 irow=irow+1; 278 278 cdf(irow,1)=mu-sigma*grel(i); 279 cdf(irow,2)=normcdf (-grel(i),0,1);279 cdf(irow,2)=normcdf_issm(-grel(i),0,1); 280 280 cdf(irow,3)=grel(i); 281 281 cdf(irow,4)=grel(i); -
issm/trunk/src/m/qmu/dakota_moments.m
r13975 r14310 133 133 sigma=std(samp); 134 134 135 muci(1) =mu-tinv(prob,nsamp-1)*sigma/sqrt(nsamp); 136 muci(2) =mu+tinv(prob,nsamp-1)*sigma/sqrt(nsamp); 137 sigmaci(1)=sigma*sqrt((nsamp-1)/chi2inv(prob ,nsamp-1)); 138 sigmaci(2)=sigma*sqrt((nsamp-1)/chi2inv(1-prob,nsamp-1)); 135 try 136 muci(1,1) =mu-tinv(prob,nsamp-1)*sigma/sqrt(nsamp); 137 muci(2,1) =mu+tinv(prob,nsamp-1)*sigma/sqrt(nsamp); 138 sigmaci(1,1)=sigma*sqrt((nsamp-1)/chi2inv(prob ,nsamp-1)); 139 sigmaci(2,1)=sigma*sqrt((nsamp-1)/chi2inv(1-prob,nsamp-1)); 140 catch me 141 muci(1,1) =mu; 142 muci(2,1) =mu; 143 sigmaci(1,1)=sigma; 144 sigmaci(2,1)=sigma; 145 end 139 146 140 147 end -
issm/trunk/src/m/qmu/dakota_out_parse.m
r13975 r14310 112 112 elseif strncmp(fline,'Moments for each response function',34) 113 113 [dresp]=moments_read(fidi,dresp,fline); 114 elseif strncmp(fline,'Moment-based statistics for each response function',50) 115 [dresp]=mbstats_read(fidi,dresp,fline); 114 116 elseif strncmp(fline,'95% confidence intervals for each response function',51) 115 117 [dresp]=cis_read(fidi,dresp,fline); 116 elseif strncmp(fline,'Probabilities for each response function',40) 118 elseif strncmp(fline,'Probabilities for each response function',40) || ... 119 strncmp(fline,'Level mappings for each response function',41) 117 120 [dresp]=cdfs_read(fidi,dresp,fline); 121 elseif strncmp(fline,'Probability Density Function (PDF) histograms for each response function',72) 122 [dresp]=pdfs_read(fidi,dresp,fline); 118 123 elseif strncmp(fline,'Simple Correlation Matrix',25) 119 124 [scm]=corrmat_read(fidi,'Simple Correlation Matrix',fline); … … 137 142 else 138 143 display(['Unexpected line: ' deblank(fline)]); 139 fline=fgetl(fidi);140 144 end 141 145 fline=fgetl(fidi); … … 198 202 %dstddev=std (data,0); 199 203 [dmean,dstddev,dmeanci,dstddevci]=... 200 normfit (data,0.05);204 normfit_issm(data,0.05); 201 205 else 202 206 dmean =zeros(1,size(data,2)); … … 206 210 for i=1:size(data,2) 207 211 [dmean(1,i),dstddev(1,i),dmeanci(:,i),dstddevci(:,i)]=... 208 normfit (data(:,i),0.05);209 end 210 end 211 212 dmin =min (data,[],1);213 dquart1=prctile (data,25,1);214 dmedian=median (data,1);215 dquart3=prctile (data,75,1);216 dmax =max (data,[],1);212 normfit_issm(data(:,i),0.05); 213 end 214 end 215 216 dmin =min (data,[],1); 217 dquart1=prctile_issm(data,25,1); 218 dmedian=median (data,1); 219 dquart3=prctile_issm(data,75,1); 220 dmax =max (data,[],1); 217 221 218 222 % same as Dakota scm, Excel correl … … 316 320 end 317 321 322 %% function to find and read the moment-based statistics 323 324 function [dresp]=mbstats_read(fidi,dresp,fline) 325 326 if ~exist('fline','var') || isempty(fline) || ~ischar(fline) 327 [fline]=findline(fidi,'Moment-based statistics for each response function'); 328 if ~ischar(fline) 329 return 330 end 331 end 332 333 display('Reading moment-based statistics for response functions:'); 334 335 % skip column headings of moment-based statistics 336 337 fline=fgetl(fidi); 338 339 while 1 340 fline=fgetl(fidi); 341 if isempty(fline) 342 break; 343 end 344 [ntokens,tokens]=fltokens(fline); 345 346 % add new response function and moment-based statistics 347 348 dresp(end+1).descriptor=tokens{1}{ 1}; 349 display(sprintf(' %s',dresp(end).descriptor)); 350 dresp(end ).mean =tokens{1}{ 2}; 351 dresp(end ).stddev =tokens{1}{ 3}; 352 dresp(end ).skewness =tokens{1}{ 4}; 353 dresp(end ).kurtosis =tokens{1}{ 5}; 354 end 355 356 display(sprintf(' Number of Dakota response functions=%d.',... 357 length(dresp))); 358 359 end 360 318 361 %% function to find and read the confidence intervals 319 362 … … 336 379 end 337 380 [ntokens,tokens]=fltokens(fline); 381 382 % check for column headings in Dakota 5.2 383 384 if (ntokens == 4) 385 fline=fgetl(fidi); 386 if isempty(fline) 387 break; 388 end 389 [ntokens,tokens]=fltokens(fline); 390 end 338 391 339 392 % find response function associated with confidence intervals … … 354 407 % add confidence intervals to response functions 355 408 356 dresp(i).meanci (1,1)=tokens{1}{ 5}; 357 dresp(i).meanci (2,1)=tokens{1}{ 6}; 358 dresp(i).stddevci(1,1)=tokens{1}{12}; 359 dresp(i).stddevci(2,1)=tokens{1}{13}; 409 if (ntokens == 14) 410 dresp(i).meanci (1,1)=tokens{1}{ 5}; 411 dresp(i).meanci (2,1)=tokens{1}{ 6}; 412 dresp(i).stddevci(1,1)=tokens{1}{12}; 413 dresp(i).stddevci(2,1)=tokens{1}{13}; 414 else 415 dresp(i).meanci (1,1)=tokens{1}{ 2}; 416 dresp(i).meanci (2,1)=tokens{1}{ 3}; 417 dresp(i).stddevci(1,1)=tokens{1}{ 4}; 418 dresp(i).stddevci(2,1)=tokens{1}{ 5}; 419 end 360 420 end 361 421 … … 372 432 [fline]=findline(fidi,'Probabilities for each response function'); 373 433 if ~ischar(fline) 374 return 434 [fline]=findline(fidi,'Level mappings for each response function'); 435 if ~ischar(fline) 436 return 437 end 375 438 end 376 439 end … … 425 488 dresp(idresp).cdf(icdf,i)=tokens{1}{itoken}; 426 489 end 427 end; 490 end 491 fline=fgetl(fidi); 492 end 493 end 494 end 495 496 display(sprintf(' Number of Dakota response functions=%d.',... 497 length(dresp))); 498 499 end 500 501 %% function to find and read the pdf's 502 503 function [dresp]=pdfs_read(fidi,dresp,fline) 504 505 if ~exist('fline','var') || isempty(fline) || ~ischar(fline) 506 [fline]=findline(fidi,'Probability Density Function (PDF) histograms for each response function'); 507 if ~ischar(fline) 508 return 509 end 510 end 511 512 display('Reading PDF''s for response functions:'); 513 514 while ischar(fline) && ~isempty(fline) 515 fline=fgetl(fidi); 516 if ~ischar(fline) 517 break; 518 end 519 520 % process header line of pdf 521 522 while ischar(fline) && ~isempty(fline) 523 [ntokens,tokens]=fltokens(fline); 524 525 % find response function associated with pdf 526 527 idresp=0; 528 for i=1:length(dresp) 529 if strcmpi(tokens{1}{ 3},dresp(i).descriptor) 530 idresp=i; 531 break; 532 end 533 end 534 if ~idresp 535 idresp=length(dresp)+1; 536 dresp(idresp).descriptor=tokens{1}{ 3}; 537 display(sprintf(' %s',dresp(idresp).descriptor)); 538 end 539 540 % skip column headings of pdf 541 542 fline=fgetl(fidi); 543 fline=fgetl(fidi); 544 545 % read and add pdf table to response function 546 547 fline=fgetl(fidi); 548 ipdf=0; 549 while ischar(fline) && ~isempty(fline) && ... 550 ~strncmpi(fline,'PDF for', 7) 551 [ntokens,tokens]=fltokens(fline); 552 ipdf=ipdf+1; 553 dresp(idresp).pdf(ipdf,1:3)=NaN; 554 for i=1:3 555 dresp(idresp).pdf(ipdf,i)=tokens{1}{i}; 556 end 428 557 fline=fgetl(fidi); 429 558 end -
issm/trunk/src/m/qmu/plot/plot_cdf.m
r13975 r14310 139 139 if strncmpi(cplot,'p',1) && ... 140 140 exist('ynorm','var') && strncmpi(ynorm,'y',1) 141 ydata(1:lcdfr(i),i)=norminv (dresp(i).cdf(:,iplot),0,1);141 ydata(1:lcdfr(i),i)=norminv_issm(dresp(i).cdf(:,iplot),0,1); 142 142 else 143 ydata(1:lcdfr(i),i)= dresp(i).cdf(:,iplot);143 ydata(1:lcdfr(i),i)= dresp(i).cdf(:,iplot); 144 144 end 145 145 end … … 237 237 end 238 238 239 tick = norminv (yprob,0,1);239 tick = norminv_issm(yprob,0,1); 240 240 set(ax1,'YTick',tick,'YTickLabel',label); 241 241 ylim([tick(1) tick(end)]) -
issm/trunk/src/m/qmu/plot/plot_hist_norm.m
r13975 r14310 224 224 if exist('mu','var') && exist('sigma','var') 225 225 for i=1:ncol 226 dbelow(end+1)=normcdf (edges( 1),mu(i),sigma(i));226 dbelow(end+1)=normcdf_issm(edges( 1),mu(i),sigma(i)); 227 227 dhistc(1:size(dhistc,1)-1,end+1)=... 228 normcdf (edges(2:end ),mu(i),sigma(i))-...229 normcdf (edges(1:end-1),mu(i),sigma(i));230 dabove(end+1)=norminv (edges(end),mu(i),sigma(i));228 normcdf_issm(edges(2:end ),mu(i),sigma(i))-... 229 normcdf_issm(edges(1:end-1),mu(i),sigma(i)); 230 dabove(end+1)=norminv_issm(edges(end),mu(i),sigma(i)); 231 231 if exist('descr','var') 232 232 descr(end+1)={[descr{i} ' norm']}; -
issm/trunk/src/m/qmu/plot/plot_hist_norm_ci.m
r13975 r14310 129 129 % calculate 95% confidence intervals (same as dakota) 130 130 [mu(i),sigma(i),muci(:,i),sigmaci(:,i)]=... 131 normfit (sampr(:,i),0.05);131 normfit_issm(sampr(:,i),0.05); 132 132 end 133 133 display('Using calculated normal fits.') … … 191 191 if exist('mu','var') && exist('sigma','var') 192 192 for i=1:ncol 193 dbelow(end+1)=normcdf (edges( 1),mu(i),sigma(i));193 dbelow(end+1)=normcdf_issm(edges( 1),mu(i),sigma(i)); 194 194 dhistc(1:size(dhistc,1)-1,end+1)=... 195 normcdf (edges(2:end ),mu(i),sigma(i))-...196 normcdf (edges(1:end-1),mu(i),sigma(i));197 dabove(end+1)=norminv (edges(end),mu(i),sigma(i));195 normcdf_issm(edges(2:end ),mu(i),sigma(i))-... 196 normcdf_issm(edges(1:end-1),mu(i),sigma(i)); 197 dabove(end+1)=norminv_issm(edges(end),mu(i),sigma(i)); 198 198 if exist('descr','var') 199 199 descr(end+1)={[descr{i} ' norm']}; … … 204 204 if exist('muci','var') && exist('sigmaci','var') 205 205 for i=1:ncol 206 dbelow(end+1)=normcdf (edges( 1),muci(1,i),sigmaci(2,i));206 dbelow(end+1)=normcdf_issm(edges( 1),muci(1,i),sigmaci(2,i)); 207 207 dhistc(1:size(dhistc,1)-1,end+1)=... 208 normcdf (edges(2:end ),muci(1,i),sigmaci(2,i))-...209 normcdf (edges(1:end-1),muci(1,i),sigmaci(2,i));210 dabove(end+1)=norminv (edges(end),muci(1,i),sigmaci(2,i));208 normcdf_issm(edges(2:end ),muci(1,i),sigmaci(2,i))-... 209 normcdf_issm(edges(1:end-1),muci(1,i),sigmaci(2,i)); 210 dabove(end+1)=norminv_issm(edges(end),muci(1,i),sigmaci(2,i)); 211 211 if exist('descr','var') 212 212 descr(end+1)={[descr{i} ' norm-+']}; … … 214 214 end 215 215 for i=1:ncol 216 dbelow(end+1)=normcdf (edges( 1),muci(1,i),sigmaci(1,i));216 dbelow(end+1)=normcdf_issm(edges( 1),muci(1,i),sigmaci(1,i)); 217 217 dhistc(1:size(dhistc,1)-1,end+1)=... 218 normcdf (edges(2:end ),muci(1,i),sigmaci(1,i))-...219 normcdf (edges(1:end-1),muci(1,i),sigmaci(1,i));220 dabove(end+1)=norminv (edges(end),muci(1,i),sigmaci(1,i));218 normcdf_issm(edges(2:end ),muci(1,i),sigmaci(1,i))-... 219 normcdf_issm(edges(1:end-1),muci(1,i),sigmaci(1,i)); 220 dabove(end+1)=norminv_issm(edges(end),muci(1,i),sigmaci(1,i)); 221 221 if exist('descr','var') 222 222 descr(end+1)={[descr{i} ' norm--']}; … … 224 224 end 225 225 for i=1:ncol 226 dbelow(end+1)=normcdf (edges( 1),muci(2,i),sigmaci(1,i));226 dbelow(end+1)=normcdf_issm(edges( 1),muci(2,i),sigmaci(1,i)); 227 227 dhistc(1:size(dhistc,1)-1,end+1)=... 228 normcdf (edges(2:end ),muci(2,i),sigmaci(1,i))-...229 normcdf (edges(1:end-1),muci(2,i),sigmaci(1,i));230 dabove(end+1)=norminv (edges(end),muci(2,i),sigmaci(1,i));228 normcdf_issm(edges(2:end ),muci(2,i),sigmaci(1,i))-... 229 normcdf_issm(edges(1:end-1),muci(2,i),sigmaci(1,i)); 230 dabove(end+1)=norminv_issm(edges(end),muci(2,i),sigmaci(1,i)); 231 231 if exist('descr','var') 232 232 descr(end+1)={[descr{i} ' norm+-']}; … … 234 234 end 235 235 for i=1:ncol 236 dbelow(end+1)=normcdf (edges( 1),muci(2,i),sigmaci(2,i));236 dbelow(end+1)=normcdf_issm(edges( 1),muci(2,i),sigmaci(2,i)); 237 237 dhistc(1:size(dhistc,1)-1,end+1)=... 238 normcdf (edges(2:end ),muci(2,i),sigmaci(2,i))-...239 normcdf (edges(1:end-1),muci(2,i),sigmaci(2,i));240 dabove(end+1)=norminv (edges(end),muci(2,i),sigmaci(2,i));238 normcdf_issm(edges(2:end ),muci(2,i),sigmaci(2,i))-... 239 normcdf_issm(edges(1:end-1),muci(2,i),sigmaci(2,i)); 240 dabove(end+1)=norminv_issm(edges(end),muci(2,i),sigmaci(2,i)); 241 241 if exist('descr','var') 242 242 descr(end+1)={[descr{i} ' norm++']}; -
issm/trunk/src/m/qmu/plot/plot_normdist_bars.m
r13975 r14310 126 126 if ~isfield(dresp,'mean') || ~isfield(dresp,'stddev') 127 127 for i=1:length(dresp) 128 [dresp(i).mean,dresp(i).stddev]=normfit (dresp(i).sample);128 [dresp(i).mean,dresp(i).stddev]=normfit_issm(dresp(i).sample); 129 129 end 130 130 end … … 141 141 for i=1:length(dresp) 142 142 descr(i)=cellstr(dresp(i).descriptor); 143 data(i,:)=norminv (prob,dresp(i).mean,dresp(i).stddev);143 data(i,:)=norminv_issm(prob,dresp(i).mean,dresp(i).stddev); 144 144 end 145 145 -
issm/trunk/src/m/qmu/plot/plot_rlev_bars_ci.m
r13975 r14310 133 133 [dresp(i).mean,dresp(i).stddev,... 134 134 dresp(i).meanci,dresp(i).stddevci]=... 135 normfit (sampr(:,i),0.05);135 normfit_issm(sampr(:,i),0.05); 136 136 display('Using calculated normal fits from sample data.') 137 137 end … … 140 140 % use minus/plus integer standard deviations 141 141 sdvect=[-4 -3 -2 -1 0 1 2 3 4]; 142 dresp(i).cdf(:,2)=normcdf (sdvect,0,1);143 dresp(i).cdf(:,1)=norminv (dresp(i).cdf(:,2),...144 dresp(i).mean,dresp(i).stddev);142 dresp(i).cdf(:,2)=normcdf_issm(sdvect,0,1); 143 dresp(i).cdf(:,1)=norminv_issm(dresp(i).cdf(:,2),... 144 dresp(i).mean,dresp(i).stddev); 145 145 display('Using integer standard deviations for percentages.') 146 146 … … 176 176 isfield(dresp(i),'stddev') && ~isempty(dresp(i).stddev) 177 177 descr(end+1)=cellstr([dresp(i).descriptor ' norm']); 178 cdfr(end+1,:)=norminv (dresp(i).cdf(:,2),dresp(i).mean,dresp(i).stddev);178 cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).mean,dresp(i).stddev); 179 179 end 180 180 if isfield(dresp(i),'meanci' ) && ~isempty(dresp(i).meanci ) && ... … … 184 184 descr(end+1)=cellstr([dresp(i).descriptor ' norm+-']); 185 185 descr(end+1)=cellstr([dresp(i).descriptor ' norm++']); 186 cdfr(end+1,:)=norminv (dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(2));187 cdfr(end+1,:)=norminv (dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(1));188 cdfr(end+1,:)=norminv (dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(1));189 cdfr(end+1,:)=norminv (dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(2));186 cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(2)); 187 cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(1)); 188 cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(1)); 189 cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(2)); 190 190 end 191 191 end -
issm/trunk/src/m/qmu/plot/plot_sampdist_bars.m
r13975 r14310 127 127 ~isfield(dresp,'max') 128 128 for i=1:length(dresp) 129 dresp(i).min =min (dresp(i).sample);130 dresp(i).quart1=prctile (dresp(i).sample,25);131 dresp(i).median=median (dresp(i).sample);132 dresp(i).quart3=prctile (dresp(i).sample,75);133 dresp(i).max =max (dresp(i).sample);129 dresp(i).min =min (dresp(i).sample); 130 dresp(i).quart1=prctile_issm(dresp(i).sample,25); 131 dresp(i).median=median (dresp(i).sample); 132 dresp(i).quart3=prctile_issm(dresp(i).sample,75); 133 dresp(i).max =max (dresp(i).sample); 134 134 end 135 135 end -
issm/trunk/src/m/solve/parseresultsfromdisk.py
r13975 r14310 43 43 result=ReadData(fid) 44 44 while result: 45 if result['step'] > len(results):45 if result['step'] > len(results): 46 46 for i in xrange(len(results),result['step']-1): 47 47 results.append(None) 48 48 results.append(resultsclass.results()) 49 elif results[result['step']-1] is None: 50 results[result['step']-1]=resultsclass.results() 49 51 #Get time and step 50 52 setattr(results[result['step']-1],'step',result['step']) -
issm/trunk/src/m/solve/process_solve_options.m
r13395 r14310 11 11 if ~ismember(solution_type,[DiagnosticSolutionEnum(),PrognosticSolutionEnum(),ThermalSolutionEnum(),... 12 12 SteadystateSolutionEnum(),TransientSolutionEnum(),EnthalpySolutionEnum(),... 13 BalancethicknessSolutionEnum(),BedSlopeSolutionEnum(),SurfaceSlopeSolutionEnum(),HydrologySolutionEnum(),FlaimSolutionEnum()]), 13 BalancethicknessSolutionEnum(),WeakBalancethicknessSolutionEnum(),BedSlopeSolutionEnum(),... 14 SurfaceSlopeSolutionEnum(),HydrologySolutionEnum(),FlaimSolutionEnum()]), 14 15 error(['process_solve_options error message: solution_type ' EnumToString(solution_type) ' not supported yet!']); 15 16 end -
issm/trunk/src/wrappers/Exp2Kml/Exp2Kml.h
r13749 r14310 51 51 52 52 #endif 53 -
issm/trunk/src/wrappers/InternalFront/InternalFront.cpp
r13250 r14310 14 14 bool* elementonwater=NULL; 15 15 int* elements=NULL; 16 int* connectivity=NULL;17 16 int* elementconnectivity=NULL; 18 17 int* front=NULL; … … 20 19 bool found; 21 20 int numberofelements,numberofsegments; 22 int N,M;23 21 int i,j,ii,jj,id; 22 int dummy; 24 23 25 24 /*Boot module: */ 26 25 MODULEBOOT(); 27 26 28 /*checks on arguments on the matlab side: */29 C heckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InternalFrontUsage);27 /*checks on arguments: */ 28 CHECKARGUMENTS(NLHS,NRHS,&InternalFrontUsage); 30 29 31 /*Fetch required fields*/ 32 FetchData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements")); 33 if(numberofelements<=0) _error_("No elements found in the model"); 34 FetchData(&elements,&M,&N,mxGetAssignedField(MODEL,0,"elements")); 35 if(M!=numberofelements || N!=3) _error_("Field 'elements' should be of size [md.numberofelements 3]"); 36 FetchData(&elementonwater,&M,&N,mxGetAssignedField(MODEL,0,"elementonwater")); 37 if(M!=numberofelements || N!=1) _error_("Field 'elementonwater' should be of size [md.numberofelements 1]"); 38 FetchData(&elementconnectivity,&M,&N,mxGetAssignedField(MODEL,0,"elementconnectivity")); 39 if(M!=numberofelements || N!=3) _error_("Field 'elementconnectivity' should be of size [md.numberofelements 3]"); 30 /*Fetch inputs: */ 31 FetchData(&elements,&numberofelements,&dummy,ELEMENTS); 32 FetchData(&elementonwater,&dummy,&dummy,ELEMENTONWATER); 33 FetchData(&elementconnectivity,&dummy,&dummy,ELEMENTCONNECTIVITY); 40 34 41 35 /*Allocate and initialize all variables*/ -
issm/trunk/src/wrappers/InternalFront/InternalFront.h
r13749 r14310 27 27 #ifdef _HAVE_MATLAB_MODULES_ 28 28 /* serial input macros: */ 29 #define MODEL prhs[0] 29 #define ELEMENTS prhs[0] 30 #define ELEMENTONWATER prhs[1] 31 #define ELEMENTCONNECTIVITY prhs[2] 30 32 /* serial output macros: */ 31 33 #define FRONT (mxArray**)&plhs[0] … … 34 36 #ifdef _HAVE_PYTHON_MODULES_ 35 37 /* serial input macros: */ 36 #define MODEL PyTuple_GetItem(args,0) 38 #define ELEMENTS PyTuple_GetItem(args,0) 39 #define ELEMENTONWATER PyTuple_GetItem(args,1) 40 #define ELEMENTCONNECTIVITY PyTuple_GetItem(args,2) 37 41 /* serial output macros: */ 38 42 #define FRONT output,0] … … 43 47 #define NLHS 1 44 48 #undef NRHS 45 #define NRHS 149 #define NRHS 3 46 50 47 51 #endif -
issm/trunk/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp
r13864 r14310 45 45 46 46 //contours 47 DataSet *domain= NULL;48 Contour<double> **contours=NULL;49 int numcontours;50 Contour<double> *contouri=NULL;47 DataSet *domain = NULL; 48 Contour<double> **contours=NULL; 49 int numcontours; 50 Contour<double> *contouri=NULL; 51 51 52 52 /* output: */ … … 82 82 *(contours+i)=(Contour<double>*)domain->GetObjectByOffset(i); 83 83 84 /* Debugging of contours :{{{1*/85 /*for(i=0;i<numcontours;i++){86 _printLine_("\nContour echo: contour number " << i+1 << " / " << numcontours);87 contouri=*(contours+i);88 _printLine_(" Number of vertices " << contouri->nods);89 for (j=0;j<contouri->nods;j++){90 _printLine_(" " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f");91 }92 }*/93 /*}}}*/94 95 84 /*Run interpolation routine: */ 96 85 MeshProfileIntersectionx(&segments,&numsegs,index,x,y,nel,nods,contours,numcontours); -
issm/trunk/src/wrappers/TriMesh/TriMesh.cpp
r13355 r14310 22 22 23 23 /* output: */ 24 SeqMat< double>*index = NULL;24 SeqMat<int> *index = NULL; 25 25 SeqVec<double> *x = NULL; 26 26 SeqVec<double> *y = NULL; 27 SeqMat< double>*segments = NULL;28 SeqVec< double>*segmentmarkerlist = NULL;27 SeqMat<int> *segments = NULL; 28 SeqVec<int> *segmentmarkerlist = NULL; 29 29 30 30 /*Boot module: */ -
issm/trunk/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp
r13639 r14310 18 18 /* input: */ 19 19 int nel,nods; 20 double*index = NULL;20 int *index = NULL; 21 21 double *x = NULL; 22 22 double *y = NULL; 23 double*segments = NULL;24 double*segmentmarkers = NULL;23 int *segments = NULL; 24 int *segmentmarkers = NULL; 25 25 int num_seg; 26 26 -
issm/trunk/src/wrappers/matlab/Makefile.am
r13831 r14310 48 48 ElementConnectivity.la\ 49 49 EnumToString.la\ 50 ExpSimplify.la\ 50 51 HoleFiller.la\ 51 52 InternalFront.la\ … … 76 77 KMLMeshWrite.la\ 77 78 KMLOverlay.la\ 78 Shp2Kml.la\79 79 Exp2Kml.la\ 80 Kml2Exp.la 80 Kml2Exp.la\ 81 Shp2Exp.la\ 82 Shp2Kml.la 81 83 endif 82 84 endif … … 210 212 Ll2xy_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) 211 213 214 ExpSimplify_la_SOURCES = ../ExpSimplify/ExpSimplify.cpp\ 215 ../ExpSimplify/ExpSimplify.h 216 ExpSimplify_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) 217 212 218 Exp2Kml_la_SOURCES = ../Exp2Kml/Exp2Kml.cpp\ 213 219 ../Exp2Kml/Exp2Kml.h … … 246 252 Scotch_la_LIBADD = ${deps} $(SCOTCHLIB) $(MPILIB) 247 253 254 Shp2Exp_la_SOURCES = ../Shp2Exp/Shp2Exp.cpp\ 255 ../Shp2Exp/Shp2Exp.h 256 Shp2Exp_la_LIBADD = ${deps} $(SHAPELIBLIB) $(MPILIB) $(PETSCLIB) 257 248 258 Shp2Kml_la_SOURCES = ../Shp2Kml/Shp2Kml.cpp\ 249 259 ../Shp2Kml/Shp2Kml.h -
issm/trunk/src/wrappers/matlab/include/wrapper_macros.h
r13749 r14310 19 19 * will be trapped*/ 20 20 #define MODULEBOOT(); try{ \ 21 IssmComm::SetComm( -1);21 IssmComm::SetComm(); 22 22 23 23 #define MODULEEND(); }\ -
issm/trunk/src/wrappers/matlab/io/WriteMatlabData.cpp
r13749 r14310 290 290 } 291 291 /*}}}*/ 292 /*FUNCTION WriteData(mxArray** pdataref,SeqMat<int>* matrix){{{*/ 293 void WriteData(mxArray** pdataref,SeqMat<int>* matrix){ 294 295 int i,j; 296 int rows,cols; 297 mxArray *dataref = NULL; 298 int *matrix_ptr = NULL; 299 double *tmatrix_ptr = NULL; 300 301 if(matrix){ 302 303 matrix_ptr=matrix->ToSerial(); 304 matrix->GetSize(&rows,&cols); 305 306 /*Now transpose the matrix and allocate with Matlab's memory manager: */ 307 tmatrix_ptr=(double*)mxMalloc(rows*cols*sizeof(double)); 308 for(i=0;i<rows;i++){ 309 for(j=0;j<cols;j++){ 310 tmatrix_ptr[j*rows+i]=(double)matrix_ptr[i*cols+j]; 311 } 312 } 313 314 /*create matlab matrix: */ 315 dataref=mxCreateDoubleMatrix(0,0,mxREAL); 316 mxSetM(dataref,rows); 317 mxSetN(dataref,cols); 318 mxSetPr(dataref,tmatrix_ptr); 319 320 /*Free ressources:*/ 321 xDelete<int>(matrix_ptr); 322 } 323 else{ 324 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 325 } 326 327 *pdataref=dataref; 328 } 329 /*}}}*/ 330 /*FUNCTION WriteData(mxArray** pdataref,SeqVec<int>* vector){{{*/ 331 void WriteData(mxArray** pdataref,SeqVec<int>* vector){ 332 333 mxArray* dataref=NULL; 334 int* vector_ptr=NULL; 335 double* vector_matlab=NULL; 336 int rows; 337 338 if(vector){ 339 /*call toolkit routine: */ 340 vector_ptr=vector->ToMPISerial(); 341 vector->GetSize(&rows); 342 343 /*now create the matlab vector with Matlab's memory manager */ 344 vector_matlab=(double*)mxMalloc(rows*sizeof(double)); 345 for(int i=0;i<rows;i++) vector_matlab[i]=(double)vector_ptr[i]; 346 347 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 348 mxSetM(dataref,rows); 349 mxSetN(dataref,1); 350 mxSetPr(dataref,vector_matlab); 351 } 352 else{ 353 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 354 } 355 356 /*Clean-up and return*/ 357 xDelete<int>(vector_ptr); 358 *pdataref=dataref; 359 } 360 /*}}}*/ 292 361 /*FUNCTION WriteData(mxArray** pdataref,RiftStruct* riftstruct){{{*/ 293 362 void WriteData(mxArray** pdataref,RiftStruct* riftstruct){ … … 363 432 } 364 433 /*}}}*/ 434 /*FUNCTION SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int M,int N,int* fieldpointer){{{*/ 435 void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int M,int N,int* fieldpointer){ 436 437 mxArray* field = NULL; 438 439 /*Convert field*/ 440 WriteData(&field,fieldpointer,M,N); 441 442 /*Assign to structure*/ 443 mxSetField(dataref,i,fieldname,field); 444 } 445 /*}}}*/ 365 446 /*FUNCTION SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int field){{{*/ 366 447 void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int fieldin){ -
issm/trunk/src/wrappers/matlab/io/matlabio.h
r13749 r14310 17 17 #include "../../c/include/include.h" 18 18 19 void WriteData(mxArray** pdataref,SeqMat<int>* matrix); 19 20 void WriteData(mxArray** pdataref,SeqMat<double>* matrix); 20 21 void WriteData(mxArray** pdataref,double* matrix, int M,int N); 21 22 void WriteData(mxArray** pdataref,int* matrix, int M,int N); 23 void WriteData(mxArray** pdataref,SeqVec<int>* vector); 22 24 void WriteData(mxArray** pdataref,SeqVec<double>* vector); 23 25 void WriteData(mxArray** pdataref,double* vector, int M); … … 64 66 void SetStructureField(mxArray* dataref,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer); 65 67 void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer); 68 void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int fieldrows,int fieldcols,int* fieldpointer); 66 69 void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int field); 67 70 void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,double field); -
issm/trunk/src/wrappers/python/include/wrapper_macros.h
r13749 r14310 23 23 if(!output) return NULL;\ 24 24 try{ \ 25 IssmComm::SetComm( -1);25 IssmComm::SetComm(); 26 26 27 27 #define MODULEEND(); }\ -
issm/trunk/src/wrappers/python/io/FetchPythonData.cpp
r14067 r14310 20 20 void FetchData(double* pscalar,PyObject* py_float){ 21 21 22 double scalar;22 double dscalar; 23 23 24 24 /*return internal value: */ 25 scalar=PyFloat_AsDouble(py_float); 26 27 /*output: */ 28 *pscalar=scalar; 29 } 30 /*}}}*/ 31 /*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{*/ 32 void FetchData(int* pinteger, PyObject* py_long){ 33 34 int integer; 25 if (PyFloat_Check(py_float)) 26 dscalar=PyFloat_AsDouble(py_float); 27 else if (PyInt_Check(py_float)) 28 dscalar=(double)PyInt_AsLong(py_float); 29 else if (PyLong_Check(py_float)) 30 dscalar=PyLong_AsDouble(py_float); 31 else if (PyBool_Check(py_float)) 32 dscalar=(double)PyLong_AsLong(py_float); 33 else if (PyTuple_Check(py_float) && (int)PyTuple_Size(py_float)==1) 34 FetchData(&dscalar,PyTuple_GetItem(py_float,(Py_ssize_t)0)); 35 else if (PyList_Check(py_float) && (int)PyList_Size(py_float)==1) 36 FetchData(&dscalar,PyList_GetItem(py_float,(Py_ssize_t)0)); 37 else 38 _error_("unrecognized float type in input!"); 39 40 /*output: */ 41 *pscalar=dscalar; 42 } 43 /*}}}*/ 44 /*FUNCTION FetchData(int* pscalar,PyObject* py_long){{{*/ 45 void FetchData(int* pscalar, PyObject* py_long){ 46 47 int iscalar; 35 48 36 49 /*return internal value: */ 37 integer=(int)PyLong_AsLong(py_long); 38 39 /*output: */ 40 *pinteger=integer; 41 } 42 /*}}}*/ 43 /*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{*/ 44 void FetchData(bool* pboolean,PyObject* py_boolean){ 45 46 bool boolean; 47 48 /*check this is indeed a subtype of long type: */ 49 if(!PyBool_Check(py_boolean))_error_("expecting a boolean in input!"); 50 51 /*extract boolean: */ 52 boolean=(bool)PyLong_AsLong(py_boolean); 53 54 /*simple copy: */ 55 *pboolean=boolean; 56 50 if (PyInt_Check(py_long)) 51 iscalar=(int)PyInt_AsLong(py_long); 52 else if (PyLong_Check(py_long)) 53 iscalar=(int)PyLong_AsLong(py_long); 54 else if (PyFloat_Check(py_long)) 55 iscalar=(int)PyFloat_AsDouble(py_long); 56 else if (PyBool_Check(py_long)) 57 iscalar=(int)PyLong_AsLong(py_long); 58 else if (PyTuple_Check(py_long) && (int)PyTuple_Size(py_long)==1) 59 FetchData(&iscalar,PyTuple_GetItem(py_long,(Py_ssize_t)0)); 60 else if (PyList_Check(py_long) && (int)PyList_Size(py_long)==1) 61 FetchData(&iscalar,PyList_GetItem(py_long,(Py_ssize_t)0)); 62 else 63 _error_("unrecognized long type in input!"); 64 65 /*output: */ 66 *pscalar=iscalar; 67 } 68 /*}}}*/ 69 /*FUNCTION FetchData(bool* pscalar,PyObject* py_boolean){{{*/ 70 void FetchData(bool* pscalar,PyObject* py_boolean){ 71 72 bool bscalar; 73 74 /*return internal value: */ 75 if (PyBool_Check(py_boolean)) 76 bscalar=(bool)PyLong_AsLong(py_boolean); 77 else if (PyInt_Check(py_boolean)) 78 bscalar=(bool)PyInt_AsLong(py_boolean); 79 else if (PyLong_Check(py_boolean)) 80 bscalar=(bool)PyLong_AsLong(py_boolean); 81 else if (PyTuple_Check(py_boolean) && (int)PyTuple_Size(py_boolean)==1) 82 FetchData(&bscalar,PyTuple_GetItem(py_boolean,(Py_ssize_t)0)); 83 else if (PyList_Check(py_boolean) && (int)PyList_Size(py_boolean)==1) 84 FetchData(&bscalar,PyList_GetItem(py_boolean,(Py_ssize_t)0)); 85 else 86 _error_("unrecognized boolean type in input!"); 87 88 /*output: */ 89 *pscalar=bscalar; 57 90 } 58 91 /*}}}*/ … … 72 105 int i; 73 106 74 /*retrieve dimensions: */ 75 ndim=PyArray_NDIM((const PyArrayObject*)py_matrix); 76 if(ndim!=2)_error_("expecting an MxN matrix in input!"); 77 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 78 M=dims[0]; N=dims[1]; 79 80 if (M && N) { 81 if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) { 82 /*retrieve internal value: */ 83 dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 84 85 /*copy matrix: */ 86 matrix=xNew<double>(M*N); 87 memcpy(matrix,dmatrix,(M*N)*sizeof(double)); 88 } 89 90 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_INT64) { 91 /*retrieve internal value: */ 92 lmatrix=(long*)PyArray_DATA((PyArrayObject*)py_matrix); 93 94 /*transform into double matrix: */ 95 matrix=xNew<double>(M*N); 96 for(i=0;i<M*N;i++)matrix[i]=(double)lmatrix[i]; 97 } 98 99 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_BOOL) { 100 /*retrieve internal value: */ 101 bmatrix=(bool*)PyArray_DATA((PyArrayObject*)py_matrix); 102 103 /*transform into double matrix: */ 104 matrix=xNew<double>(M*N); 105 for(i=0;i<M*N;i++)matrix[i]=(double)bmatrix[i]; 106 } 107 108 else 109 _error_("unrecognized matrix type in input!"); 110 } 111 else 112 matrix=NULL; 107 if (PyArray_Check((PyArrayObject*)py_matrix)) { 108 /*retrieve dimensions: */ 109 ndim=PyArray_NDIM((const PyArrayObject*)py_matrix); 110 if (ndim==2) { 111 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 112 M=dims[0]; N=dims[1]; 113 } 114 else if (ndim==1) { 115 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 116 M=dims[0]; N=1; 117 } 118 else 119 _error_("expecting an MxN matrix or M vector in input!"); 120 121 if (M && N) { 122 if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) { 123 /*retrieve internal value: */ 124 dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 125 126 /*copy matrix: */ 127 matrix=xNew<double>(M*N); 128 memcpy(matrix,dmatrix,(M*N)*sizeof(double)); 129 } 130 131 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_INT64) { 132 /*retrieve internal value: */ 133 lmatrix=(long*)PyArray_DATA((PyArrayObject*)py_matrix); 134 135 /*transform into double matrix: */ 136 matrix=xNew<double>(M*N); 137 for(i=0;i<M*N;i++)matrix[i]=(double)lmatrix[i]; 138 } 139 140 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_BOOL) { 141 /*retrieve internal value: */ 142 bmatrix=(bool*)PyArray_DATA((PyArrayObject*)py_matrix); 143 144 /*transform into double matrix: */ 145 matrix=xNew<double>(M*N); 146 for(i=0;i<M*N;i++)matrix[i]=(double)bmatrix[i]; 147 } 148 149 else 150 _error_("unrecognized double pyarray type in input!"); 151 } 152 else 153 matrix=NULL; 154 } 155 156 else { 157 M=1; 158 N=1; 159 matrix=xNew<double>(M*N); 160 FetchData(&(matrix[0]),py_matrix); 161 } 113 162 114 163 /*output: */ … … 133 182 int i; 134 183 135 /*retrieve dimensions: */ 136 ndim=PyArray_NDIM((const PyArrayObject*)py_matrix); 137 if(ndim!=2)_error_("expecting an MxN matrix in input!"); 138 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 139 M=dims[0]; N=dims[1]; 140 141 if (M && N) { 142 if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) { 143 /*retrieve internal value: */ 144 dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 145 146 /*transform into integer matrix: */ 147 matrix=xNew<int>(M*N); 148 for(i=0;i<M*N;i++)matrix[i]=(int)dmatrix[i]; 149 } 150 151 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_INT64) { 152 /*retrieve internal value: */ 153 lmatrix=(long*)PyArray_DATA((PyArrayObject*)py_matrix); 154 155 /*transform into integer matrix: */ 156 matrix=xNew<int>(M*N); 157 for(i=0;i<M*N;i++)matrix[i]=(int)lmatrix[i]; 158 } 159 160 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_BOOL) { 161 /*retrieve internal value: */ 162 bmatrix=(bool*)PyArray_DATA((PyArrayObject*)py_matrix); 163 164 /*transform into integer matrix: */ 165 matrix=xNew<int>(M*N); 166 for(i=0;i<M*N;i++)matrix[i]=(int)bmatrix[i]; 167 } 168 169 else 170 _error_("unrecognized matrix type in input!"); 171 } 172 else 173 matrix=NULL; 184 if (PyArray_Check((PyArrayObject*)py_matrix)) { 185 /*retrieve dimensions: */ 186 ndim=PyArray_NDIM((const PyArrayObject*)py_matrix); 187 if (ndim==2) { 188 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 189 M=dims[0]; N=dims[1]; 190 } 191 else if (ndim==1) { 192 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 193 M=dims[0]; N=1; 194 } 195 else 196 _error_("expecting an MxN matrix or M vector in input!"); 197 198 if (M && N) { 199 if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) { 200 /*retrieve internal value: */ 201 dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 202 203 /*transform into integer matrix: */ 204 matrix=xNew<int>(M*N); 205 for(i=0;i<M*N;i++)matrix[i]=(int)dmatrix[i]; 206 } 207 208 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_INT64) { 209 /*retrieve internal value: */ 210 lmatrix=(long*)PyArray_DATA((PyArrayObject*)py_matrix); 211 212 /*transform into integer matrix: */ 213 matrix=xNew<int>(M*N); 214 for(i=0;i<M*N;i++)matrix[i]=(int)lmatrix[i]; 215 } 216 217 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_BOOL) { 218 /*retrieve internal value: */ 219 bmatrix=(bool*)PyArray_DATA((PyArrayObject*)py_matrix); 220 221 /*transform into integer matrix: */ 222 matrix=xNew<int>(M*N); 223 for(i=0;i<M*N;i++)matrix[i]=(int)bmatrix[i]; 224 } 225 226 else 227 _error_("unrecognized int pyarray type in input!"); 228 } 229 else 230 matrix=NULL; 231 } 232 233 else { 234 M=1; 235 N=1; 236 matrix=xNew<int>(M*N); 237 FetchData(&(matrix[0]),py_matrix); 238 } 239 240 /*output: */ 241 if(pM)*pM=M; 242 if(pN)*pN=N; 243 if(pmatrix)*pmatrix=matrix; 244 } 245 /*}}}*/ 246 /*FUNCTION FetchData(bool** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{*/ 247 void FetchData(bool** pmatrix,int* pM,int *pN,PyObject* py_matrix){ 248 249 /*output: */ 250 bool* bmatrix=NULL; 251 bool* matrix=NULL; 252 int M,N; 253 int ndim; 254 npy_intp* dims=NULL; 255 256 /*intermediary:*/ 257 double* dmatrix=NULL; 258 long* lmatrix=NULL; 259 int i; 260 261 if (PyArray_Check((PyArrayObject*)py_matrix)) { 262 /*retrieve dimensions: */ 263 ndim=PyArray_NDIM((const PyArrayObject*)py_matrix); 264 if (ndim==2) { 265 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 266 M=dims[0]; N=dims[1]; 267 } 268 else if (ndim==1) { 269 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 270 M=dims[0]; N=1; 271 } 272 else 273 _error_("expecting an MxN matrix or M vector in input!"); 274 275 if (M && N) { 276 if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) { 277 /*retrieve internal value: */ 278 dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 279 280 /*transform into bool matrix: */ 281 matrix=xNew<bool>(M*N); 282 for(i=0;i<M*N;i++)matrix[i]=(bool)dmatrix[i]; 283 } 284 285 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_INT64) { 286 /*retrieve internal value: */ 287 lmatrix=(long*)PyArray_DATA((PyArrayObject*)py_matrix); 288 289 /*transform into bool matrix: */ 290 matrix=xNew<bool>(M*N); 291 for(i=0;i<M*N;i++)matrix[i]=(bool)lmatrix[i]; 292 } 293 294 else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_BOOL) { 295 /*retrieve internal value: */ 296 bmatrix=(bool*)PyArray_DATA((PyArrayObject*)py_matrix); 297 298 /*copy matrix: */ 299 matrix=xNew<bool>(M*N); 300 memcpy(matrix,bmatrix,(M*N)*sizeof(bool)); 301 } 302 303 else 304 _error_("unrecognized bool pyarray type in input!"); 305 } 306 else 307 matrix=NULL; 308 } 309 310 else { 311 M=1; 312 N=1; 313 matrix=xNew<bool>(M*N); 314 FetchData(&(matrix[0]),py_matrix); 315 } 174 316 175 317 /*output: */ … … 194 336 int i; 195 337 196 /*retrieve dimensions: */ 197 ndim=PyArray_NDIM((const PyArrayObject*)py_vector); 198 if(ndim!=1)_error_("expecting an Mx1 vector in input!"); 199 dims=PyArray_DIMS((PyArrayObject*)py_vector); 200 M=dims[0]; 201 202 if (M) { 203 if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) { 204 /*retrieve internal value: */ 205 dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector); 206 207 /*copy vector: */ 208 vector=xNew<double>(M); 209 memcpy(vector,dvector,(M)*sizeof(double)); 210 } 211 212 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) { 213 /*retrieve internal value: */ 214 lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector); 215 216 /*transform into double vector: */ 217 vector=xNew<double>(M); 218 for(i=0;i<M;i++)vector[i]=(double)lvector[i]; 219 } 220 221 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) { 222 /*retrieve internal value: */ 223 bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector); 224 225 /*transform into double vector: */ 226 vector=xNew<double>(M); 227 for(i=0;i<M;i++)vector[i]=(double)bvector[i]; 228 } 229 230 else 231 _error_("unrecognized vector type in input!"); 232 } 233 else 234 vector=NULL; 338 if (PyArray_Check((PyArrayObject*)py_vector)) { 339 /*retrieve dimensions: */ 340 ndim=PyArray_NDIM((const PyArrayObject*)py_vector); 341 if (ndim==1) { 342 dims=PyArray_DIMS((PyArrayObject*)py_vector); 343 M=dims[0]; 344 } 345 else if (ndim==2) { 346 dims=PyArray_DIMS((PyArrayObject*)py_vector); 347 if (dims[1]==1) 348 M=dims[0]; 349 else 350 _error_("expecting an Mx1 matrix or M vector in input!"); 351 } 352 else 353 _error_("expecting an Mx1 matrix or M vector in input!"); 354 355 if (M) { 356 if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) { 357 /*retrieve internal value: */ 358 dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector); 359 360 /*copy vector: */ 361 vector=xNew<double>(M); 362 memcpy(vector,dvector,(M)*sizeof(double)); 363 } 364 365 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) { 366 /*retrieve internal value: */ 367 lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector); 368 369 /*transform into double vector: */ 370 vector=xNew<double>(M); 371 for(i=0;i<M;i++)vector[i]=(double)lvector[i]; 372 } 373 374 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) { 375 /*retrieve internal value: */ 376 bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector); 377 378 /*transform into double vector: */ 379 vector=xNew<double>(M); 380 for(i=0;i<M;i++)vector[i]=(double)bvector[i]; 381 } 382 383 else 384 _error_("unrecognized double pyarray type in input!"); 385 } 386 else 387 vector=NULL; 388 } 389 390 else { 391 M=1; 392 vector=xNew<double>(M); 393 FetchData(&(vector[0]),py_vector); 394 } 395 396 /*output: */ 397 if(pM)*pM=M; 398 if(pvector)*pvector=vector; 399 } 400 /*}}}*/ 401 /*FUNCTION FetchData(int** pvector,int* pM, PyObject* py_vector){{{*/ 402 void FetchData(int** pvector,int* pM,PyObject* py_vector){ 403 404 /*output: */ 405 int* vector=NULL; 406 int M; 407 int ndim; 408 npy_intp* dims=NULL; 409 410 /*intermediary:*/ 411 long* lvector=NULL; 412 bool* bvector=NULL; 413 double* dvector=NULL; 414 int i; 415 416 if (PyArray_Check((PyArrayObject*)py_vector)) { 417 /*retrieve dimensions: */ 418 ndim=PyArray_NDIM((const PyArrayObject*)py_vector); 419 if (ndim==1) { 420 dims=PyArray_DIMS((PyArrayObject*)py_vector); 421 M=dims[0]; 422 } 423 else if (ndim==2) { 424 dims=PyArray_DIMS((PyArrayObject*)py_vector); 425 if (dims[1]==1) 426 M=dims[0]; 427 else 428 _error_("expecting an Mx1 matrix or M vector in input!"); 429 } 430 else 431 _error_("expecting an Mx1 matrix or M vector in input!"); 432 433 if (M) { 434 if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) { 435 /*retrieve internal value: */ 436 dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector); 437 438 /*transform into int vector: */ 439 vector=xNew<int>(M); 440 for(i=0;i<M;i++)vector[i]=(int)lvector[i]; 441 } 442 443 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) { 444 /*retrieve internal value: */ 445 lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector); 446 447 /*transform into int vector: */ 448 vector=xNew<int>(M); 449 for(i=0;i<M;i++)vector[i]=(int)lvector[i]; 450 } 451 452 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) { 453 /*retrieve internal value: */ 454 bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector); 455 456 /*transform into int vector: */ 457 vector=xNew<int>(M); 458 for(i=0;i<M;i++)vector[i]=(int)bvector[i]; 459 } 460 461 else 462 _error_("unrecognized int pyarray type in input!"); 463 } 464 else 465 vector=NULL; 466 } 467 468 else { 469 M=1; 470 vector=xNew<int>(M); 471 FetchData(&(vector[0]),py_vector); 472 } 473 474 /*output: */ 475 if(pM)*pM=M; 476 if(pvector)*pvector=vector; 477 } 478 /*}}}*/ 479 /*FUNCTION FetchData(bool** pvector,int* pM, PyObject* py_vector){{{*/ 480 void FetchData(bool** pvector,int* pM,PyObject* py_vector){ 481 482 /*output: */ 483 bool* bvector=NULL; 484 bool* vector=NULL; 485 int M; 486 int ndim; 487 npy_intp* dims=NULL; 488 489 /*intermediary:*/ 490 double* dvector=NULL; 491 long* lvector=NULL; 492 int i; 493 494 if (PyArray_Check((PyArrayObject*)py_vector)) { 495 /*retrieve dimensions: */ 496 ndim=PyArray_NDIM((const PyArrayObject*)py_vector); 497 if (ndim==1) { 498 dims=PyArray_DIMS((PyArrayObject*)py_vector); 499 M=dims[0]; 500 } 501 else if (ndim==2) { 502 dims=PyArray_DIMS((PyArrayObject*)py_vector); 503 if (dims[1]==1) 504 M=dims[0]; 505 else 506 _error_("expecting an Mx1 matrix or M vector in input!"); 507 } 508 else 509 _error_("expecting an Mx1 matrix or M vector in input!"); 510 511 if (M) { 512 if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) { 513 /*retrieve internal value: */ 514 dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector); 515 516 /*transform into bool vector: */ 517 vector=xNew<bool>(M); 518 for(i=0;i<M;i++)vector[i]=(bool)dvector[i]; 519 } 520 521 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) { 522 /*retrieve internal value: */ 523 lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector); 524 525 /*transform into bool vector: */ 526 vector=xNew<bool>(M); 527 for(i=0;i<M;i++)vector[i]=(bool)lvector[i]; 528 } 529 530 else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) { 531 /*retrieve internal value: */ 532 bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector); 533 534 /*copy vector: */ 535 vector=xNew<bool>(M); 536 memcpy(vector,bvector,(M)*sizeof(bool)); 537 } 538 539 else 540 _error_("unrecognized bool pyarray type in input!"); 541 } 542 else 543 vector=NULL; 544 } 545 546 else { 547 M=1; 548 vector=xNew<bool>(M); 549 FetchData(&(vector[0]),py_vector); 550 } 235 551 236 552 /*output: */ -
issm/trunk/src/wrappers/python/io/WritePythonData.cpp
r14067 r14310 137 137 PyObject* array=NULL; 138 138 139 matrix->GetSize(&M,&N); 139 140 buffer=matrix->ToSerial(); 140 matrix->GetSize(&M,&N); 141 141 142 dims[0]=(npy_intp)M; 142 143 dims[1]=(npy_intp)N; … … 154 155 PyObject* array=NULL; 155 156 157 vector->GetSize(&M); 156 158 buffer=vector->ToMPISerial(); 157 vector->GetSize(&M); 159 158 160 dim=(npy_intp)M; 159 161 array=PyArray_SimpleNewFromData(1,&dim,NPY_DOUBLE,buffer); 162 163 PyTuple_SetItem(py_tuple, index, array); 164 } 165 /*}}}*/ 166 /*FUNCTION WriteData(PyObject* py_tuple,int index,SeqMat<int>* matrix){{{*/ 167 void WriteData(PyObject* py_tuple,int index,SeqMat<int>* matrix){ 168 169 int M,N; 170 int* ibuffer=NULL; 171 npy_intp dims[2]={0,0}; 172 PyObject* array=NULL; 173 174 matrix->GetSize(&M,&N); 175 ibuffer=matrix->ToSerial(); 176 177 /*convert to long*/ 178 long* lbuffer=xNew<long>(M*N); 179 for(int i=0;i<M*N;i++) lbuffer[i]=(long)ibuffer[i]; 180 xDelete<int>(ibuffer); 181 182 dims[0]=(npy_intp)M; 183 dims[1]=(npy_intp)N; 184 array=PyArray_SimpleNewFromData(2,dims,NPY_INT64,lbuffer); 185 186 PyTuple_SetItem(py_tuple, index, array); 187 188 }/*}}}*/ 189 /*FUNCTION WriteData(PyObject* py_tuple,int index,SeqVec<int>* vector){{{*/ 190 void WriteData(PyObject* py_tuple,int index,SeqVec<int>* vector){ 191 192 int M; 193 int* ibuffer=NULL; 194 npy_intp dim=10; 195 PyObject* array=NULL; 196 197 vector->GetSize(&M); 198 ibuffer=vector->ToMPISerial(); 199 200 /*convert to long*/ 201 long* lbuffer=xNew<long>(M); 202 for(int i=0;i<M;i++) lbuffer[i]=(long)ibuffer[i]; 203 xDelete<int>(ibuffer); 204 205 dim=(npy_intp)M; 206 array=PyArray_SimpleNewFromData(1,&dim,NPY_INT64,lbuffer); 207 208 PyTuple_SetItem(py_tuple, index, array); 209 } 210 /*}}}*/ 211 /*FUNCTION WriteData(PyObject* py_tuple,int index,SeqMat<bool>* matrix){{{*/ 212 void WriteData(PyObject* py_tuple,int index,SeqMat<bool>* matrix){ 213 214 int M,N; 215 bool* buffer=NULL; 216 npy_intp dims[2]={0,0}; 217 PyObject* array=NULL; 218 219 matrix->GetSize(&M,&N); 220 buffer=matrix->ToSerial(); 221 222 dims[0]=(npy_intp)M; 223 dims[1]=(npy_intp)N; 224 array=PyArray_SimpleNewFromData(2,dims,NPY_BOOL,buffer); 225 226 PyTuple_SetItem(py_tuple, index, array); 227 228 }/*}}}*/ 229 /*FUNCTION WriteData(PyObject* py_tuple,int index,SeqVec<bool>* vector){{{*/ 230 void WriteData(PyObject* py_tuple,int index,SeqVec<bool>* vector){ 231 232 int M; 233 bool* buffer=NULL; 234 npy_intp dim=10; 235 PyObject* array=NULL; 236 237 vector->GetSize(&M); 238 buffer=vector->ToMPISerial(); 239 240 dim=(npy_intp)M; 241 array=PyArray_SimpleNewFromData(1,&dim,NPY_BOOL,buffer); 160 242 161 243 PyTuple_SetItem(py_tuple, index, array); … … 225 307 } 226 308 /*}}}*/ 309 /*FUNCTION PyArrayFromCopiedData(int dimi,int dimj,int* data){{{*/ 310 PyObject* PyArrayFromCopiedData(int dimi,int dimj,int* data){ 311 312 long* pydata; 313 npy_intp pydims[2]={0,0}; 314 315 /* note that PyArray_SimpleNewFromData does not copy the data, so that when the original 316 object (e.g. bamggeom,bamgmesh) is deleted, the data is gone. */ 317 318 pydims[0]=(npy_intp)dimi; 319 pydims[1]=(npy_intp)dimj; 320 pydata=xNew<long>(dimi*dimj); 321 for(int i=0;i<dimi*dimj;i++) pydata[i]=(long)data[i]; 322 return PyArray_SimpleNewFromData(2,pydims,NPY_INT64,pydata); 323 } 324 /*}}}*/ 325 /*FUNCTION PyArrayFromCopiedData(int dimi,int dimj,bool* data){{{*/ 326 PyObject* PyArrayFromCopiedData(int dimi,int dimj,bool* data){ 327 328 bool* pydata; 329 npy_intp pydims[2]={0,0}; 330 331 /* note that PyArray_SimpleNewFromData does not copy the data, so that when the original 332 object (e.g. bamggeom,bamgmesh) is deleted, the data is gone. */ 333 334 pydims[0]=(npy_intp)dimi; 335 pydims[1]=(npy_intp)dimj; 336 pydata=xNew<bool>(dimi*dimj); 337 memcpy(pydata,data,dimi*dimj*sizeof(bool)); 338 return PyArray_SimpleNewFromData(2,pydims,NPY_BOOL,pydata); 339 } 340 /*}}}*/ -
issm/trunk/src/wrappers/python/io/pythonio.h
r14067 r14310 25 25 void WriteData(PyObject* py_tuple,int index, SeqMat<double>* matrix); 26 26 void WriteData(PyObject* py_tuple,int index, SeqVec<double>* vector); 27 void WriteData(PyObject* py_tuple,int index, SeqMat<int>* matrix); 28 void WriteData(PyObject* py_tuple,int index, SeqVec<int>* vector); 29 void WriteData(PyObject* py_tuple,int index, SeqMat<bool>* matrix); 30 void WriteData(PyObject* py_tuple,int index, SeqVec<bool>* vector); 27 31 void WriteData(PyObject* py_tuple,int index, BamgGeom* bamggeom); 28 32 void WriteData(PyObject* py_tuple,int index, BamgMesh* bamgmesh); 29 33 void WriteData(PyObject* py_tuple,int index, RiftStruct* riftstruct); 30 34 31 void FetchData(double** pvector,int* pM,PyObject* py_ref);32 35 void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_array); 33 36 void FetchData(int** pmatrix,int* pM,int *pN,PyObject* py_matrix); 37 void FetchData(bool** pmatrix,int* pM,int *pN,PyObject* py_matrix); 38 void FetchData(double** pvector,int* pM,PyObject* py_ref); 39 void FetchData(int** pvector,int* pM,PyObject* py_ref); 40 void FetchData(bool** pvector,int* pM,PyObject* py_ref); 34 41 void FetchData(char** pstring,PyObject* py_unicode); 35 42 void FetchData(double* pscalar,PyObject* py_float); 36 void FetchData(int* p integer,PyObject* py_long);43 void FetchData(int* pscalar,PyObject* py_long); 37 44 void FetchData(bool* pbool,PyObject* py_boolean); 38 45 void FetchData(BamgGeom** bamggeom,PyObject* py_dict); … … 47 54 PyObject* PyArrayFromCopiedData(int dims[2],double* data); 48 55 PyObject* PyArrayFromCopiedData(int dimi,int dimj,double* data); 56 PyObject* PyArrayFromCopiedData(int dimi,int dimj,int* data); 57 PyObject* PyArrayFromCopiedData(int dimi,int dimj,bool* data); 49 58 50 59 #endif /* _IO_H_ */ -
issm/trunk/startup.m
r13395 r14310 36 36 addpath(recursivepath([ISSM_DIR '/externalpackages/export_fig'])); 37 37 addpath(recursivepath([ISSM_DIR '/externalpackages/googleearthtoolbox'])); 38 addpath(recursivepath([ISSM_DIR '/externalpackages/howatmask'])); 38 39 addpath(recursivepath([ISSM_DIR '/externalpackages/cm_and_cb_utilities'])); 40 addpath(recursivepath([ISSM_DIR '/externalpackages/dem'])); 39 41 40 42 clear ISSM_DIR; -
issm/trunk/test
- Property svn:mergeinfo changed
/issm/trunk-jpl/test merged: 14068,14091,14102,14106-14107,14134-14135,14138-14139,14150,14156-14158,14169,14179-14181,14190,14198,14212,14269-14270
- Property svn:mergeinfo changed
-
issm/trunk/test/NightlyRun/python_skipped_tests.txt
r13975 r14310 11 11 test418 needs Dakota 12 12 test420 needs Dakota 13 14 test1401,test1402 15 Roundoff error in ComputeHessian and ComputeMetric causes different meshes 16 from matlab, specifically in the handling of 0/0=nan, eps/0=inf, etc. Since 17 the mesh is of a different size, NR fails. (Note Matlab test1402 currently 18 fails.) 19 20 test1109,test1110 21 Ugly crashes in solver, but same behavior as Matlab. 22 -
issm/trunk/test/NightlyRun/runme.m
r14067 r14310 79 79 strncmp(fliplr(flist(i).name),fliplr('.m'),2)&... %File name must end by '.m' 80 80 ~strcmp(flist(i).name,'test.m')) %File name must be different than 'test.m' 81 list_ids(end+1)=eval(flist(i).name(5:end-2)); %Keep test id only (skip 'test' and '.m') 81 id=str2num(flist(i).name(5:end-2)); 82 if isempty(id), 83 disp(['WARNING: ignore file ' flist(i).name ]); 84 else 85 list_ids(end+1)=eval(flist(i).name(5:end-2)); %Keep test id only (skip 'test' and '.m') 86 end 82 87 end 83 88 end -
issm/trunk/test/NightlyRun/test1101.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 printingflag=false; 4 4 5 L_list={5000 ,10000,20000,40000,80000,160000};5 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 6 6 results={}; 7 7 minvx=[]; … … 26 26 27 27 pos=find(md.mesh.vertexonbed); 28 md.diagnostic.spcvx(pos)=0 ;29 md.diagnostic.spcvy(pos)=0 ;28 md.diagnostic.spcvx(pos)=0.; 29 md.diagnostic.spcvy(pos)=0.; 30 30 31 31 %Create MPCs to have periodic boundary conditions 32 posx=find(md.mesh.x==0 );32 posx=find(md.mesh.x==0.); 33 33 posx2=find(md.mesh.x==max(md.mesh.x)); 34 34 35 posy=find(md.mesh.y==0 & md.mesh.x~=0& md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times36 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0 & md.mesh.x~=max(md.mesh.x));35 posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times 36 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); 37 37 38 38 md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2]; … … 55 55 set(gcf,'Color','w') 56 56 printmodel(['ismipapattynvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 57 system(['mv ismipapattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 57 system(['mv ismipapattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 58 58 end 59 59 plotmodel(md,'data',vy,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km') … … 61 61 set(gcf,'Color','w') 62 62 printmodel(['ismipapattynvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 63 system(['mv ismipapattynvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 63 system(['mv ismipapattynvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 64 64 end 65 65 plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km') … … 67 67 set(gcf,'Color','w') 68 68 printmodel(['ismipapattynvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 69 system(['mv ismipapattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 69 system(['mv ismipapattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 70 70 end 71 71 72 if(L==5000 ),72 if(L==5000.), 73 73 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,... 74 74 'resolution',[10 10],'ylim',[10 18],'xlim',[0 5000],'title','','xlabel','') 75 elseif(L==10000 ),75 elseif(L==10000.), 76 76 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,... 77 77 'resolution',[10 10],'ylim',[10 30],'xlim',[0 10000],'title','','xlabel','') 78 elseif(L==20000 ),78 elseif(L==20000.), 79 79 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,... 80 80 'resolution',[10 10],'ylim',[0 50],'xlim',[0 20000],'title','','xlabel','') 81 elseif(L==40000 ),81 elseif(L==40000.), 82 82 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,... 83 83 'resolution',[10 10],'ylim',[0 80],'xlim',[0 40000],'title','','xlabel','') 84 elseif(L==80000 ),84 elseif(L==80000.), 85 85 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,... 86 86 'resolution',[10 10],'ylim',[0 100],'xlim',[0 80000],'title','','xlabel','') 87 elseif(L==160000 ),87 elseif(L==160000.), 88 88 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,... 89 89 'resolution',[10 10],'ylim',[0 120],'xlim',[0 160000],'title','','xlabel','') … … 92 92 set(gcf,'Color','w') 93 93 printmodel(['ismipapattynvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 94 system(['mv ismipapattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 94 system(['mv ismipapattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 95 95 end 96 96 end … … 101 101 set(gcf,'Color','w') 102 102 printmodel('ismipapattynminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 103 system(['mv ismipapattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 103 system(['mv ismipapattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 104 104 end 105 105 plot([5 10 20 40 80 160],maxvx);ylim([0 120]);xlim([0 160]) … … 107 107 set(gcf,'Color','w') 108 108 printmodel('ismipapattynmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 109 system(['mv ismipapattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 109 system(['mv ismipapattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 110 110 end 111 111 112 %Fields and tolerances to track changes 112 field_names ={ 113 field_names ={... 113 114 'Vx5km','Vy5km','Vz5km',... 114 115 'Vx10km','Vy10km','Vz10km',... -
issm/trunk/test/NightlyRun/test1102.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 printingflag=false; 4 4 5 L_list={5000 ,10000,20000,40000,80000,160000};5 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 6 6 results={}; 7 7 minvx=[]; … … 17 17 18 18 % %Find elements at the corner and extract model 19 % posnodes=find((md.mesh.x==0 | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0| md.mesh.y==max(md.mesh.y)));19 % posnodes=find((md.mesh.x==0. | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0. | md.mesh.y==max(md.mesh.y))); 20 20 % [a,b]=find(ismember(md.mesh.elements,posnodes)); 21 21 % elements=ones(md.mesh.numberofelements,1); … … 29 29 %Create dirichlet on the bed only 30 30 pos=find(md.mesh.vertexonbed); 31 md.diagnostic.spcvx(pos)=0 ;32 md.diagnostic.spcvy(pos)=0 ;33 md.diagnostic.spcvz(pos)=0 ;31 md.diagnostic.spcvx(pos)=0.; 32 md.diagnostic.spcvy(pos)=0.; 33 md.diagnostic.spcvz(pos)=0.; 34 34 35 %Create MPCs to have periodic boundary conditions36 %posx=find(md.mesh.x==0);37 %posx2=find(md.mesh.x==max(md.mesh.x));38 %posx=find(md.mesh.x==0 & md.mesh.y~=0& md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed);39 %posx2=find(md.mesh.x==max(md.mesh.x) & md.mesh.y~=0& md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed);35 % %Create MPCs to have periodic boundary conditions 36 % posx=find(md.mesh.x==0.); 37 % posx2=find(md.mesh.x==max(md.mesh.x)); 38 % posx=find(md.mesh.x==0. & md.mesh.y~=0. & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed); 39 % posx2=find(md.mesh.x==max(md.mesh.x) & md.mesh.y~=0. & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed); 40 40 41 %posy=find(md.mesh.y==0 & md.mesh.x~=0& md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed); %Don't take the same nodes two times42 %posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0& md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed);41 % posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed); %Don't take the same nodes two times 42 % posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed); 43 43 44 %md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];44 % md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2]; 45 45 46 46 %Compute the diagnostic 47 47 md.diagnostic.abstol=NaN; 48 48 md.diagnostic.reltol=NaN; 49 md.diagnostic.restol=1 ;49 md.diagnostic.restol=1.; 50 50 md.cluster=generic('name',oshostname(),'np',8); 51 51 md=solve(md,DiagnosticSolutionEnum()); … … 62 62 %Now plot vx, vy, vz and vx on a cross section 63 63 plotmodel(md,'data',vx,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',2) 64 if printingflag, 64 if printingflag, 65 65 set(gcf,'Color','w') 66 66 printmodel(['ismipastokesvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 67 system(['mv ismipastokesvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 67 system(['mv ismipastokesvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 68 68 end 69 69 plotmodel(md,'data',vy,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',3) 70 if printingflag, 70 if printingflag, 71 71 set(gcf,'Color','w') 72 72 printmodel(['ismipastokesvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 73 system(['mv ismipastokesvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 73 system(['mv ismipastokesvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 74 74 end 75 75 plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',4) 76 if printingflag, 76 if printingflag, 77 77 set(gcf,'Color','w') 78 78 printmodel(['ismipastokesvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 79 system(['mv ismipastokesvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 79 system(['mv ismipastokesvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 80 80 end 81 81 82 if(L==5000 ),82 if(L==5000.), 83 83 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,... 84 84 'resolution',[10 10],'ylim',[10 18],'xlim',[0 5000],'title','','xlabel','') 85 elseif(L==10000 ),85 elseif(L==10000.), 86 86 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,... 87 87 'resolution',[10 10],'ylim',[10 30],'xlim',[0 10000],'title','','xlabel','') 88 elseif(L==20000 ),88 elseif(L==20000.), 89 89 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,... 90 90 'resolution',[10 10],'ylim',[0 50],'xlim',[0 20000],'title','','xlabel','') 91 elseif(L==40000 ),91 elseif(L==40000.), 92 92 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,... 93 93 'resolution',[10 10],'ylim',[0 80],'xlim',[0 40000],'title','','xlabel','') 94 elseif(L==80000 ),94 elseif(L==80000.), 95 95 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,... 96 96 'resolution',[10 10],'ylim',[0 100],'xlim',[0 80000],'title','','xlabel','') 97 elseif(L==160000 ),97 elseif(L==160000.), 98 98 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,... 99 99 'resolution',[10 10],'ylim',[0 120],'xlim',[0 160000],'title','','xlabel','') 100 100 end 101 if printingflag, 101 if printingflag, 102 102 set(gcf,'Color','w') 103 103 printmodel(['ismipastokesvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 104 system(['mv ismipastokesvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 104 system(['mv ismipastokesvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 105 105 end 106 106 end … … 108 108 %Now plot the min and max values of vx for each size of the square 109 109 plot([5 10 20 40 80 160],minvx);ylim([0 18]) 110 if printingflag, 110 if printingflag, 111 111 set(gcf,'Color','w') 112 112 printmodel('ismipastokesminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 113 system(['mv ismipastokesminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 113 system(['mv ismipastokesminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 114 114 end 115 115 plot([5 10 20 40 80 160],maxvx);ylim([0 120]) 116 if printingflag, 116 if printingflag, 117 117 set(gcf,'Color','w') 118 118 printmodel('ismipastokesmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 119 system(['mv ismipastokesmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA 119 system(['mv ismipastokesmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA']); 120 120 end 121 121 122 %Fields and tolerances to track changes 122 123 field_names ={... … … 127 128 'Vx80km','Vy80km','Vz80km',... 128 129 'Vx160km','Vy160km','Vz160km' 129 } 130 }; 130 131 field_tolerances={... 131 132 1e-12,1e-12,1e-12,... -
issm/trunk/test/NightlyRun/test1103.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 printingflag=false; 4 4 5 L_list={5000 ,10000,20000,40000,80000,160000};5 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 6 6 results={}; 7 minvx=[]; 8 maxvx=[]; 7 9 8 10 for i=1:length(L_list), … … 23 25 md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1); 24 26 pos=find(md.mesh.vertexonbed); 25 md.diagnostic.spcvx(pos)=0 ;26 md.diagnostic.spcvy(pos)=0 ;27 md.diagnostic.spcvx(pos)=0.; 28 md.diagnostic.spcvy(pos)=0.; 27 29 28 30 %Create MPCs to have periodic boundary conditions 29 posx=find(md.mesh.x==0 );31 posx=find(md.mesh.x==0.); 30 32 posx2=find(md.mesh.x==max(md.mesh.x)); 31 33 32 posy=find(md.mesh.y==0 & md.mesh.x~=0& md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times33 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0 & md.mesh.x~=max(md.mesh.x));34 posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times 35 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); 34 36 35 37 md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2]; … … 49 51 %Now plot vx, vy, vz and vx on a cross section 50 52 plotmodel(md,'data',vx,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km') 51 if printingflag, 53 if printingflag, 52 54 set(gcf,'Color','w') 53 55 printmodel(['ismipbpattynvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 54 system(['mv ismipbpattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB 56 system(['mv ismipbpattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB']); 55 57 end 56 58 plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km') 57 if printingflag, 59 if printingflag, 58 60 set(gcf,'Color','w') 59 61 printmodel(['ismipbpattynvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 60 system(['mv ismipbpattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB 62 system(['mv ismipbpattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB']); 61 63 end 62 64 63 if(L==5000 ),65 if(L==5000.), 64 66 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,... 65 67 'resolution',[10 10],'ylim',[6 16],'xlim',[0 5000],'title','','xlabel','') 66 elseif(L==10000 ),68 elseif(L==10000.), 67 69 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,... 68 70 'resolution',[10 10],'ylim',[0 40],'xlim',[0 10000],'title','','xlabel','') 69 elseif(L==20000 ),71 elseif(L==20000.), 70 72 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,... 71 73 'resolution',[10 10],'ylim',[0 60],'xlim',[0 20000],'title','','xlabel','') 72 elseif(L==40000 ),74 elseif(L==40000.), 73 75 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,... 74 76 'resolution',[10 10],'ylim',[0 100],'xlim',[0 40000],'title','','xlabel','') 75 elseif(L==80000 ),77 elseif(L==80000.), 76 78 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,... 77 79 'resolution',[10 10],'ylim',[0 120],'xlim',[0 80000],'title','','xlabel','') 78 elseif(L==160000 ),80 elseif(L==160000.), 79 81 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,... 80 82 'resolution',[10 10],'ylim',[0 120],'xlim',[0 160000],'title','','xlabel','') 81 83 end 82 if printingflag, 84 if printingflag, 83 85 set(gcf,'Color','w') 84 86 printmodel(['ismipbpattynvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 85 system(['mv ismipbpattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB 87 system(['mv ismipbpattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB']); 86 88 end 87 89 end … … 89 91 %Now plot the min and max values of vx for each size of the square 90 92 plot([5 10 20 40 80 160],minvx);ylim([0 14]);xlim([0 160]) 91 if printingflag, 93 if printingflag, 92 94 set(gcf,'Color','w') 93 95 printmodel('ismipbpattynminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 94 system(['mv ismipbpattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB 96 system(['mv ismipbpattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB']); 95 97 end 96 98 plot([5 10 20 40 80 160],maxvx);ylim([0 120]);xlim([0 160]) 97 if printingflag, 99 if printingflag, 98 100 set(gcf,'Color','w') 99 101 printmodel('ismipbpattynmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 100 system(['mv ismipbpattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB 102 system(['mv ismipbpattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestB']); 101 103 end 104 102 105 %Fields and tolerances to track changes 103 106 field_names ={... -
issm/trunk/test/NightlyRun/test1104.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 4 L_list={5000 ,10000,20000,40000,80000,160000};4 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 5 5 results={}; 6 6 … … 22 22 23 23 pos=find(md.mesh.vertexonbed); 24 md.diagnostic.spcvx(pos)=0 ;25 md.diagnostic.spcvy(pos)=0 ;24 md.diagnostic.spcvx(pos)=0.; 25 md.diagnostic.spcvy(pos)=0.; 26 26 27 27 %Create MPCs to have periodic boundary conditions 28 posx=find(md.mesh.x==0 );28 posx=find(md.mesh.x==0.); 29 29 posx2=find(md.mesh.x==max(md.mesh.x)); 30 30 31 posy=find(md.mesh.y==0 & md.mesh.x~=0& md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times32 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0 & md.mesh.x~=max(md.mesh.x));31 posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times 32 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); 33 33 34 34 md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2]; … … 38 38 md.cluster=generic('name',oshostname(),'np',8); 39 39 md=solve(md,DiagnosticSolutionEnum()); 40 pos=find(md.mesh.x==0 | md.mesh.y==0| md.mesh.x==max(md.mesh.x) | md.mesh.y==max(md.mesh.y));40 pos=find(md.mesh.x==0. | md.mesh.y==0. | md.mesh.x==max(md.mesh.x) | md.mesh.y==max(md.mesh.y)); 41 41 md.diagnostic.spcvx(pos)=md.results.DiagnosticSolution.Vx(pos); 42 42 md.diagnostic.spcvy(pos)=md.results.DiagnosticSolution.Vy(pos); -
issm/trunk/test/NightlyRun/test1105.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 printingflag=false; 4 4 5 L_list={5000 ,10000,20000,40000,80000,160000};5 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 6 6 results={}; 7 7 minvx=[]; … … 9 9 10 10 for i=1:length(L_list), 11 L=L_list{i}; %in m (3 times the desired leng htfor BC problems)11 L=L_list{i}; %in m (3 times the desired length for BC problems) 12 12 nx=30; %number of nodes in x direction 13 13 ny=30; … … 18 18 md=extrude(md,10,1.); 19 19 20 md=setflowequation(md,'pattyn','all'); 20 md=setflowequation(md,'pattyn','all'); 21 21 22 22 %Create MPCs to have periodic boundary conditions … … 25 25 md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1); 26 26 27 posx=find(md.mesh.x==0 & md.mesh.y~=0& md.mesh.y~=L);28 posx2=find(md.mesh.x==L & md.mesh.y~=0 & md.mesh.y~=L);27 posx=find(md.mesh.x==0. & md.mesh.y~=0. & md.mesh.y~=L); 28 posx2=find(md.mesh.x==L & md.mesh.y~=0. & md.mesh.y~=L); 29 29 30 posy=find(md.mesh.y==0 & md.mesh.x~=0& md.mesh.x~=L); %Don't take the same nodes two times31 posy2=find(md.mesh.y==L & md.mesh.x~=0 & md.mesh.x~=L);30 posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=L); %Don't take the same nodes two times 31 posy2=find(md.mesh.y==L & md.mesh.x~=0. & md.mesh.x~=L); 32 32 33 33 md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2]; 34 34 35 35 %Add spc on the corners 36 pos=find((md.mesh.x==0 | md.mesh.x==L) & (md.mesh.y==0| md.mesh.y==L) & md.mesh.vertexonbed);37 md.diagnostic.spcvx(pos)=0 ;38 md.diagnostic.spcvy(pos)=0 ;39 if(L==5000 ),36 pos=find((md.mesh.x==0. | md.mesh.x==L) & (md.mesh.y==0. | md.mesh.y==L) & md.mesh.vertexonbed); 37 md.diagnostic.spcvx(pos)=0.; 38 md.diagnostic.spcvy(pos)=0.; 39 if(L==5000.), 40 40 md.diagnostic.spcvx(pos)=15.66; 41 41 md.diagnostic.spcvy(pos)=-0.1967; 42 elseif(L==10000 ),42 elseif(L==10000.), 43 43 md.diagnostic.spcvx(pos)=16.04; 44 44 md.diagnostic.spcvy(pos)=-0.1977; 45 elseif(L==20000 ),45 elseif(L==20000.), 46 46 md.diagnostic.spcvx(pos)=16.53; 47 47 md.diagnostic.spcvy(pos)=-1.27; 48 elseif(L==40000 ),48 elseif(L==40000.), 49 49 md.diagnostic.spcvx(pos)=17.23; 50 50 md.diagnostic.spcvy(pos)=-3.17; 51 elseif(L==80000 ),51 elseif(L==80000.), 52 52 md.diagnostic.spcvx(pos)=16.68; 53 53 md.diagnostic.spcvy(pos)=-2.69; 54 elseif(L==160000 ),54 elseif(L==160000.), 55 55 md.diagnostic.spcvx(pos)=16.03; 56 56 md.diagnostic.spcvy(pos)=-1.27; … … 59 59 %Spc the bed at zero for vz 60 60 pos=find(md.mesh.vertexonbed); 61 md.diagnostic.spcvz(pos)=0 ;61 md.diagnostic.spcvz(pos)=0.; 62 62 63 63 %Compute the diagnostic … … 75 75 %Now plot vx, vy, vz and vx on a cross section 76 76 plotmodel(md,'data',vx,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',2) 77 if printingflag, 77 if printingflag, 78 78 set(gcf,'Color','w') 79 79 printmodel(['ismipcpattynvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 80 system(['mv ismipcpattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC 80 system(['mv ismipcpattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC']); 81 81 end 82 82 plotmodel(md,'data',vy,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',3) 83 if printingflag, 83 if printingflag, 84 84 set(gcf,'Color','w') 85 85 printmodel(['ismipcpattynvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 86 system(['mv ismipcpattynvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC 86 system(['mv ismipcpattynvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC']); 87 87 end 88 88 plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',4) 89 if printingflag, 89 if printingflag, 90 90 set(gcf,'Color','w') 91 91 printmodel(['ismipcpattynvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 92 system(['mv ismipcpattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC 92 system(['mv ismipcpattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC']); 93 93 end 94 94 95 if(L==5000 ),95 if(L==5000.), 96 96 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,... 97 97 'resolution',[10 10],'ylim',[0 20],'xlim',[0 5000],'title','','xlabel','','figure',5) 98 elseif(L==10000 ),98 elseif(L==10000.), 99 99 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,... 100 100 'resolution',[10 10],'ylim',[13 18],'xlim',[0 10000],'title','','xlabel','') 101 elseif(L==20000 ),101 elseif(L==20000.), 102 102 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,... 103 103 'resolution',[10 10],'ylim',[14 22],'xlim',[0 20000],'title','','xlabel','') 104 elseif(L==40000 ),104 elseif(L==40000.), 105 105 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,... 106 106 'resolution',[10 10],'ylim',[10 40],'xlim',[0 40000],'title','','xlabel','') 107 elseif(L==80000 ),107 elseif(L==80000.), 108 108 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,... 109 109 'resolution',[10 10],'ylim',[0 80],'xlim',[0 80000],'title','','xlabel','') 110 elseif(L==160000 ),110 elseif(L==160000.), 111 111 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,... 112 112 'resolution',[10 10],'ylim',[0 200],'xlim',[0 160000],'title','','xlabel','') 113 113 end 114 if printingflag, 114 if printingflag, 115 115 set(gcf,'Color','w') 116 116 printmodel(['ismipcpattynvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 117 system(['mv ismipcpattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC 117 system(['mv ismipcpattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC']); 118 118 end 119 119 end … … 121 121 %Now plot the min and max values of vx for each size of the square 122 122 plot([5 10 20 40 80 160],minvx);ylim([4 18]);xlim([0 160]) 123 if printingflag, 123 if printingflag, 124 124 set(gcf,'Color','w') 125 125 printmodel('ismipcpattynminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 126 system(['mv ismipcpattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC 126 system(['mv ismipcpattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC']); 127 127 end 128 128 plot([5 10 20 40 80 160],maxvx);ylim([0 200]); xlim([0 160]) 129 if printingflag, 129 if printingflag, 130 130 set(gcf,'Color','w') 131 131 printmodel('ismipcpattynmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 132 system(['mv ismipcpattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC 132 system(['mv ismipcpattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC']); 133 133 end 134 134 135 %Fields and tolerances to track changes 135 136 field_names ={... -
issm/trunk/test/NightlyRun/test1106.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 4 L_list={5000 ,10000,20000,40000,80000,160000};4 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 5 5 results={}; 6 6 … … 10 10 md=setmask(md,'',''); %ice sheet test 11 11 md=parameterize(md,'../Par/ISMIPC.par'); 12 md.friction.coefficient=sqrt(md.constants.yts.*(1000 +1000*sin(md.mesh.x*2*pi/L).*sin(md.mesh.y*2*pi/L)));12 md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/L).*sin(md.mesh.y*2.*pi/L))); 13 13 md=extrude(md,10,1.); 14 14 15 15 %Add spc on the borders 16 pos=find( (md.mesh.x==0 | md.mesh.x==max(md.mesh.x) | md.mesh.y==0 | md.mesh.y==max(md.mesh.y)));17 md.diagnostic.spcvx(pos)=0 ;18 md.diagnostic.spcvy(pos)=0 ;19 if(L==5000 ),16 pos=find(md.mesh.x==0. | md.mesh.x==max(md.mesh.x) | md.mesh.y==0. | md.mesh.y==max(md.mesh.y)); 17 md.diagnostic.spcvx(pos)=0.; 18 md.diagnostic.spcvy(pos)=0.; 19 if(L==5000.), 20 20 md.diagnostic.spcvx(pos)=15.66; 21 21 md.diagnostic.spcvy(pos)=-0.1967; 22 elseif(L==10000 ),22 elseif(L==10000.), 23 23 md.diagnostic.spcvx(pos)=16.04; 24 24 md.diagnostic.spcvy(pos)=-0.1977; 25 elseif(L==20000 ),25 elseif(L==20000.), 26 26 md.diagnostic.spcvx(pos)=16.53; 27 27 md.diagnostic.spcvy(pos)=-1.27; 28 elseif(L==40000 ),28 elseif(L==40000.), 29 29 md.diagnostic.spcvx(pos)=17.23; 30 30 md.diagnostic.spcvy(pos)=-3.17; 31 elseif(L==80000 ),31 elseif(L==80000.), 32 32 md.diagnostic.spcvx(pos)=16.68; 33 33 md.diagnostic.spcvy(pos)=-2.69; 34 elseif(L==160000 ),34 elseif(L==160000.), 35 35 md.diagnostic.spcvx(pos)=16.03; 36 36 md.diagnostic.spcvy(pos)=-1.27; 37 37 end 38 38 39 md=setflowequation(md,'stokes','all'); 39 md=setflowequation(md,'stokes','all'); 40 40 41 41 %Compute the diagnostic -
issm/trunk/test/NightlyRun/test1107.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 printingflag=false; 4 4 5 L_list={5000 ,10000,20000,40000,80000,160000};5 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 6 6 results={}; 7 7 minvx=[]; … … 26 26 27 27 %Create MPCs to have periodic boundary conditions 28 posx=find(md.mesh.x==0 & ~(md.mesh.y==0& md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed));29 posx2=find(md.mesh.x==max(md.mesh.x) & ~(md.mesh.y==0 & md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed));28 posx=find(md.mesh.x==0. & ~(md.mesh.y==0. & md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed)); 29 posx2=find(md.mesh.x==max(md.mesh.x) & ~(md.mesh.y==0. & md.mesh.vertexonbed) & ~(md.mesh.y==L & md.mesh.vertexonbed)); 30 30 31 posy=find(md.mesh.y==0 & md.mesh.x~=0& md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times32 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0 & md.mesh.x~=max(md.mesh.x));31 posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times 32 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); 33 33 34 34 md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2]; 35 35 36 36 %Add spc on the corners 37 pos=find((md.mesh.x==0 | md.mesh.x==L) & (md.mesh.y==0| md.mesh.y==L) & md.mesh.vertexonbed);38 md.diagnostic.spcvy(:)=0 ;39 md.diagnostic.spcvx(pos)=0 ;40 if(L==5000 ),37 pos=find((md.mesh.x==0. | md.mesh.x==L) & (md.mesh.y==0. | md.mesh.y==L) & md.mesh.vertexonbed); 38 md.diagnostic.spcvy(:)=0.; 39 md.diagnostic.spcvx(pos)=0.; 40 if(L==5000.), 41 41 md.diagnostic.spcvx(pos)=16.0912; 42 elseif(L==10000 ),42 elseif(L==10000.), 43 43 md.diagnostic.spcvx(pos)=16.52; 44 elseif(L==20000 ),44 elseif(L==20000.), 45 45 md.diagnostic.spcvx(pos)=17.77; 46 elseif(L==40000 ),46 elseif(L==40000.), 47 47 md.diagnostic.spcvx(pos)=19.88; 48 elseif(L==80000 ),48 elseif(L==80000.), 49 49 md.diagnostic.spcvx(pos)=18.65; 50 elseif(L==160000 ),50 elseif(L==160000.), 51 51 md.diagnostic.spcvx(pos)=16.91; 52 52 end … … 54 54 %Spc the bed at zero for vz 55 55 pos=find(md.mesh.vertexonbed); 56 md.diagnostic.spcvz(pos)=0 ;56 md.diagnostic.spcvz(pos)=0.; 57 57 58 58 %Compute the diagnostic … … 70 70 %Now plot vx, vy, vz and vx on a cross section 71 71 plotmodel(md,'data',vx,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',2) 72 if printingflag, 72 if printingflag, 73 73 set(gcf,'Color','w') 74 74 printmodel(['ismipdpattynvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 75 system(['mv ismipdpattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD 75 system(['mv ismipdpattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD']); 76 76 end 77 77 plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',3) 78 if printingflag, 78 if printingflag, 79 79 set(gcf,'Color','w') 80 80 printmodel(['ismipdpattynvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 81 system(['mv ismipdpattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD 81 system(['mv ismipdpattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD']); 82 82 end 83 83 84 if(L==5000 ),84 if(L==5000.), 85 85 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,... 86 86 'resolution',[10 10],'ylim',[0 20],'xlim',[0 5000],'title','','xlabel','','figure',4) 87 elseif(L==10000 ),87 elseif(L==10000.), 88 88 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,... 89 89 'resolution',[10 10],'ylim',[0 20],'xlim',[0 10000],'title','','xlabel','','figure',4) 90 elseif(L==20000 ),90 elseif(L==20000.), 91 91 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,... 92 92 'resolution',[10 10],'ylim',[0 30],'xlim',[0 20000],'title','','xlabel','','figure',4) 93 elseif(L==40000 ),93 elseif(L==40000.), 94 94 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,... 95 95 'resolution',[10 10],'ylim',[10 60],'xlim',[0 40000],'title','','xlabel','','figure',4) 96 elseif(L==80000 ),96 elseif(L==80000.), 97 97 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,... 98 98 'resolution',[10 10],'ylim',[0 200],'xlim',[0 80000],'title','','xlabel','','figure',4) 99 elseif(L==160000 ),99 elseif(L==160000.), 100 100 plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,... 101 101 'resolution',[10 10],'ylim',[0 400],'xlim',[0 160000],'title','','xlabel','','figure',4) 102 102 end 103 if printingflag, 103 if printingflag, 104 104 set(gcf,'Color','w') 105 105 printmodel(['ismipdpattynvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 106 system(['mv ismipdpattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD 106 system(['mv ismipdpattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD']); 107 107 end 108 108 end … … 110 110 %Now plot the min and max values of vx for each size of the square 111 111 plot([5 10 20 40 80 160],minvx);ylim([2 18]);xlim([0 160]) 112 if printingflag, 112 if printingflag, 113 113 set(gcf,'Color','w') 114 114 printmodel('ismipdpattynminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 115 system(['mv ismipdpattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD 115 system(['mv ismipdpattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD']); 116 116 end 117 117 plot([5 10 20 40 80 160],maxvx);ylim([0 300]);xlim([0 160]) 118 if printingflag, 118 if printingflag, 119 119 set(gcf,'Color','w') 120 120 printmodel('ismipdpattynmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 121 system(['mv ismipdpattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD 121 system(['mv ismipdpattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestD']); 122 122 end 123 123 124 %Fields and tolerances to track changes 124 125 field_names ={... -
issm/trunk/test/NightlyRun/test1108.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %Pattyn and Payne 2006 3 3 4 L_list={5000 ,10000,20000,40000,80000,160000};4 L_list={5000.,10000.,20000.,40000.,80000.,160000.}; 5 5 results={}; 6 6 … … 17 17 md=setflowequation(md,'pattyn','all'); 18 18 19 %We need one gr d on dirichlet: the 4 corners are set to zero19 %We need one grid on dirichlet: the 4 corners are set to zero 20 20 md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1); 21 21 md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1); 22 22 md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1); 23 23 24 pos=find(md.mesh.vertexonbed & (md.mesh.x==0 | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0| md.mesh.y==max(md.mesh.y)));25 md.diagnostic.spcvx(pos)=0 ;26 md.diagnostic.spcvy(pos)=0 ;27 md.diagnostic.spcvz(pos)=0 ;24 pos=find(md.mesh.vertexonbed & (md.mesh.x==0. | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0. | md.mesh.y==max(md.mesh.y))); 25 md.diagnostic.spcvx(pos)=0.; 26 md.diagnostic.spcvy(pos)=0.; 27 md.diagnostic.spcvz(pos)=0.; 28 28 29 29 %Create MPCs to have periodic boundary conditions 30 posx=find(md.mesh.x==0 );30 posx=find(md.mesh.x==0.); 31 31 posx2=find(md.mesh.x==max(md.mesh.x)); 32 32 33 posy=find(md.mesh.y==0 & md.mesh.x~=0& md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times34 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0 & md.mesh.x~=max(md.mesh.x));33 posy=find(md.mesh.y==0. & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); %Don't take the same nodes two times 34 posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0. & md.mesh.x~=max(md.mesh.x)); 35 35 36 36 md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2]; … … 47 47 md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1); 48 48 md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1); 49 pos=find(md.mesh.y==0 | md.mesh.x==0| md.mesh.x==max(md.mesh.x) | md.mesh.y==max(md.mesh.y)); %Don't take the same nodes two times49 pos=find(md.mesh.y==0. | md.mesh.x==0. | md.mesh.x==max(md.mesh.x) | md.mesh.y==max(md.mesh.y)); %Don't take the same nodes two times 50 50 md.diagnostic.spcvx(pos)=md.results.DiagnosticSolution.Vx(pos); 51 51 md.diagnostic.spcvy(pos)=md.results.DiagnosticSolution.Vy(pos); -
issm/trunk/test/NightlyRun/test1109.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %TestE 3 3 %Four tests to run: - Pattyn frozen … … 9 9 10 10 for i=1:4, 11 Lx=10 ; %in m12 Ly=5000 ; %in m11 Lx=10.; %in m 12 Ly=5000.; %in m 13 13 nx=3; %number of nodes in x direction 14 14 ny=51; … … 26 26 27 27 %Create MPCs to have periodic boundary conditions 28 posx=find(md.mesh.x==0 );28 posx=find(md.mesh.x==0.); 29 29 posx2=find(md.mesh.x==max(md.mesh.x)); 30 30 md.diagnostic.vertex_pairing=[posx,posx2]; … … 35 35 md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1); 36 36 md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1); 37 md.diagnostic.spcvx(pos)=0 ;38 md.diagnostic.spcvy(pos)=0 ;39 md.diagnostic.spcvz(pos)=0 ;37 md.diagnostic.spcvx(pos)=0.; 38 md.diagnostic.spcvy(pos)=0.; 39 md.diagnostic.spcvz(pos)=0.; 40 40 41 41 %Remove the spc where there is some sliding (case 3 and 4): … … 58 58 if i==1, 59 59 plotmodel(md,'data',vy,'ylim',[-10 80],'layer',md.mesh.numberoflayers,'sectionvalue','../Exp/ISMIPE.exp','resolution',[10 10],'title','','xlabel','') 60 if printingflag, 60 if printingflag, 61 61 set(gcf,'Color','w') 62 62 printmodel('ismipepattynvxfrozen','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 63 system(['mv ismipepattynvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE 63 system(['mv ismipepattynvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE']); 64 64 end 65 65 elseif i==2, 66 66 plotmodel(md,'data',vy,'ylim',[-10 80],'layer',md.mesh.numberoflayers,'sectionvalue','../Exp/ISMIPE.exp','resolution',[10 10],'title','','xlabel','') 67 if printingflag, 67 if printingflag, 68 68 set(gcf,'Color','w') 69 69 printmodel('ismipestokesvxfrozen','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 70 system(['mv ismipestokesvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE 70 system(['mv ismipestokesvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE']); 71 71 end 72 72 elseif i==3, 73 73 plotmodel(md,'data',vy,'ylim',[-50 200],'layer',md.mesh.numberoflayers,'sectionvalue','../Exp/ISMIPE.exp','resolution',[10 10],'title','','xlabel','') 74 if printingflag, 74 if printingflag, 75 75 set(gcf,'Color','w') 76 76 printmodel('ismipepattynvxsliding','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 77 system(['mv ismipepattynvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE 77 system(['mv ismipepattynvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE']); 78 78 end 79 79 elseif i==4, 80 80 plotmodel(md,'data',vy,'ylim',[-50 200],'layer',md.mesh.numberoflayers,'sectionvalue','../Exp/ISMIPE.exp','resolution',[10 10],'title','','xlabel','') 81 if printingflag, 81 if printingflag, 82 82 set(gcf,'Color','w') 83 83 printmodel('ismipestokesvxsliding','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 84 system(['mv ismipestokesvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE 84 system(['mv ismipestokesvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestE']); 85 85 end 86 86 end 87 87 end 88 88 89 %Fields and tolerances to track changes 89 field_names ={ 90 field_names ={... 90 91 'VyPattynSliding','VzPattynSliding',... 91 92 'VxStokesSliding','VyStokesSliding','VzStokesSliding',... -
issm/trunk/test/NightlyRun/test1110.m
r13975 r14310 1 %This test is a test from the ISMP-HOM Intercomparison project 1 %This test is a test from the ISMP-HOM Intercomparison project. 2 2 %TestF 3 3 printingflag=false; 4 results={}; 4 5 5 6 for i=1:4, 6 L=100000 ; %in m7 L=100000.; %in m 7 8 nx=30; %numberof nodes in x direction 8 9 ny=30; 9 10 md=model(); 10 11 md=squaremesh(md,L,L,nx,ny); 11 %md=triangle(md,'../Exp/SquareISMIP.exp',5500.);12 % md=triangle(md,'../Exp/SquareISMIP.exp',5500.); 12 13 md=setmask(md,'',''); %ice sheet test 13 14 md=parameterize(md,'../Par/ISMIPF.par'); … … 26 27 %Create dirichlet on the bed if no slip 27 28 pos=find(md.mesh.vertexonbed); 28 md.diagnostic.spcvx(pos)=0 ;29 md.diagnostic.spcvy(pos)=0 ;30 md.diagnostic.spcvz(pos)=0 ;29 md.diagnostic.spcvx(pos)=0.; 30 md.diagnostic.spcvy(pos)=0.; 31 md.diagnostic.spcvz(pos)=0.; 31 32 else 32 pos=find(md.mesh.vertexonbed & (md.mesh.x==0 | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0| md.mesh.y==max(md.mesh.y)));33 md.diagnostic.spcvx(pos)=100 ; %because we need a dirichlet somewhere34 md.diagnostic.spcvy(pos)=0 ;35 md.diagnostic.spcvz(pos)=0 ;33 pos=find(md.mesh.vertexonbed & (md.mesh.x==0. | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0. | md.mesh.y==max(md.mesh.y))); 34 md.diagnostic.spcvx(pos)=100.; %because we need a dirichlet somewhere 35 md.diagnostic.spcvy(pos)=0.; 36 md.diagnostic.spcvz(pos)=0.; 36 37 end 37 38 pos=find(~md.mesh.vertexonbed); 38 md.thermal.spctemperature(pos)=255 ;39 md.thermal.spctemperature(pos)=255.; 39 40 40 41 %Create MPCs to have periodic boundary conditions 41 posx=find(md.mesh.x==0 );42 posx=find(md.mesh.x==0.); 42 43 posx2=find(md.mesh.x==max(md.mesh.x)); 43 44 44 posy=find(md.mesh.y==0 );45 posy=find(md.mesh.y==0.); 45 46 posy2=find(md.mesh.y==max(md.mesh.y)); 46 47 … … 48 49 md.prognostic.vertex_pairing=[posx,posx2;posy,posy2]; 49 50 50 md.timestepping.time_step=3 ;51 md.timestepping.final_time=300 ;51 md.timestepping.time_step=3.; 52 md.timestepping.final_time=300.; 52 53 md.settings.output_frequency=50; 53 54 md.prognostic.stabilization=1; … … 68 69 plotmodel(md,'data',(md.results.TransientSolution(end).Vx),'layer',md.mesh.numberoflayers,'sectionvalue','../Exp/ISMIP100000.exp','title','','xlabel','','ylabel','Velocity (m/yr)','linewidth',3,'grid','on','unit','km','ylim',[185 200]) 69 70 end 70 if printingflag, 71 if printingflag, 71 72 set(gcf,'Color','w') 72 73 if i==1, 73 74 printmodel('ismipfpattynvxfrozen','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 74 system(['mv ismipfpattynvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 75 system(['mv ismipfpattynvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 75 76 elseif i==2, 76 77 printmodel('ismipfpattynvxsliding','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 77 system(['mv ismipfpattynvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 78 system(['mv ismipfpattynvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 78 79 elseif i==3, 79 80 printmodel('ismipfstokesvxfrozen','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 80 system(['mv ismipfstokesvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 81 system(['mv ismipfstokesvxfrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 81 82 elseif i==4, 82 83 printmodel('ismipfstokesvxsliding','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 83 system(['mv ismipfstokesvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 84 system(['mv ismipfstokesvxsliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 84 85 end 85 86 end 86 87 87 88 plotmodel(md,'data',(md.results.TransientSolution(end).Surface)-md.geometry.surface,'layer',md.mesh.numberoflayers,'sectionvalue','../Exp/ISMIP100000.exp','title','','xlabel','','ylabel','Surface (m)','linewidth',3,'grid','on','unit','km','ylim',[-30 50]) 88 if printingflag, 89 if printingflag, 89 90 set(gcf,'Color','w') 90 91 if i==1, 91 92 printmodel('ismipfpattyndeltasurfacefrozen','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 92 system(['mv ismipfpattyndeltasurfacefrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 93 system(['mv ismipfpattyndeltasurfacefrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 93 94 elseif i==2, 94 95 printmodel('ismipfpattyndeltasurfacesliding','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 95 system(['mv ismipfpattyndeltasurfacesliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 96 system(['mv ismipfpattyndeltasurfacesliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 96 97 elseif i==3, 97 98 printmodel('ismipfstokesdeltasurfacefrozen','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 98 system(['mv ismipfstokesdeltasurfacefrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 99 system(['mv ismipfstokesdeltasurfacefrozen.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 99 100 elseif i==4, 100 101 printmodel('ismipfstokesdeltasurfacesliding','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off'); 101 system(['mv ismipfstokesdeltasurfacesliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF 102 system(['mv ismipfstokesdeltasurfacesliding.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestF']); 102 103 end 103 104 end … … 105 106 106 107 %Fields and tolerances to track changes 107 field_names ={ 108 field_names ={... 108 109 'VxPattynFrozen','VyPattynFrozen','VzPattynFrozen','SurfacePattynFrozen',... 109 110 'VxPattynSliding','VyPattynSliding','VzPattynSliding','SurfacePattynSliding',... -
issm/trunk/test/NightlyRun/test1201.m
r13975 r14310 1 %This test is a test from the EISMINT for Ice shelves Vincent Rommelaere 1996 1 %This test is a test from the EISMINT for Ice shelves Vincent Rommelaere 1996. 2 2 printingflag=false; 3 3 … … 6 6 for stabilization=1:3; 7 7 %The goal is to test the prognostic model 8 md=bamg(model(),'domain','../Exp/SquareEISMINT.exp','hmax',3000 );8 md=bamg(model(),'domain','../Exp/SquareEISMINT.exp','hmax',3000.); 9 9 md=setmask(md,'all',''); 10 10 md=parameterize(md,'../Par/SquareEISMINT.par'); 11 md.surfaceforcings.mass_balance(:)=0 ;11 md.surfaceforcings.mass_balance(:)=0.; 12 12 md=setflowequation(md,'macayeal','all'); 13 13 md.cluster=generic('name',oshostname(),'np',8); … … 15 15 disp(' initial velocity'); 16 16 md.initialization.vx=zeros(md.mesh.numberofvertices,1); 17 md.initialization.vy=-400 *ones(md.mesh.numberofvertices,1);17 md.initialization.vy=-400.*ones(md.mesh.numberofvertices,1); 18 18 19 19 %Stabilization … … 29 29 md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices+1,length(times)); 30 30 md.prognostic.spcthickness(end,:)=times; 31 md.prognostic.spcthickness(pos,:)=repmat(500 +100*sin(2*pi*times/200),length(pos),1);31 md.prognostic.spcthickness(pos,:)=repmat(500.+100.*sin(2.*pi*times/200.),length(pos),1); 32 32 if stabilization==3, 33 pos=find(isnan(md.prognostic.spcthickness)); md.prognostic.spcthickness(pos)=500 ; %No NaN for DG33 pos=find(isnan(md.prognostic.spcthickness)); md.prognostic.spcthickness(pos)=500.; %No NaN for DG 34 34 end 35 35 … … 43 43 44 44 %plot results 45 [elements,x,y,z,s,h1]=SectionValues(md,results{1},'../Exp/CrossLineEISMINT.exp',100 );46 [elements,x,y,z,s,h2]=SectionValues(md,results{2},'../Exp/CrossLineEISMINT.exp',100 );47 [elements,x,y,z,s,h3]=SectionValues(md,results{3},'../Exp/CrossLineEISMINT.exp',100 );48 [elements,x,y,z,s,hth]=SectionValues(md, 500+100*sin(2*pi/200*(500-md.mesh.y/400)),'../Exp/CrossLineEISMINT.exp',100 );45 [elements,x,y,z,s,h1]=SectionValues(md,results{1},'../Exp/CrossLineEISMINT.exp',100.); 46 [elements,x,y,z,s,h2]=SectionValues(md,results{2},'../Exp/CrossLineEISMINT.exp',100.); 47 [elements,x,y,z,s,h3]=SectionValues(md,results{3},'../Exp/CrossLineEISMINT.exp',100.); 48 [elements,x,y,z,s,hth]=SectionValues(md, 500+100*sin(2*pi/200*(500-md.mesh.y/400)),'../Exp/CrossLineEISMINT.exp',100.); 49 49 plot(s,h1,'r',s,h2,'b',s,h3,'g',s,hth,'k') 50 50 legend('Art. diff.','No Art. diff.','D.G.','Theoretical') 51 if printingflag, 51 if printingflag, 52 52 set(gcf,'Color','w') 53 53 export_fig([issmdir() '/website/doc_pdf/validation/Images/EISMINT/IceShelf/eismintmasscthickness.pdf']); … … 56 56 %Fields and tolerances to track changes 57 57 field_names ={ ... 58 'ThicknessArtDi gg','ThicknessNoArtDiff','ThicknessDG' ...58 'ThicknessArtDiff','ThicknessNoArtDiff','ThicknessDG' ... 59 59 }; 60 60 field_tolerances={... -
issm/trunk/test/NightlyRun/test1202.m
r13975 r14310 1 %Test on the diagnostic model and the prognostic in 2d 1 %Test on the diagnostic model and the prognostic in 2d. 2 2 printingflag=false; 3 3 … … 19 19 plotmodel(md,'data',vx,'contourlevels',{0,20,40,60,60,100,120,140,160,180,-20,-40,-60,-80,-100,-120,-140,-160,-180}, ... 20 20 'contourcolor','k') 21 if printingflag, 21 if printingflag, 22 22 set(gcf,'Color','w') 23 23 printmodel('eismintdiag1vx','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off'); … … 27 27 plotmodel(md,'data',vy,'contourlevels',{-100,-200,-300,-400,-500,-600,-700,-800,-900,-1000},... 28 28 'contourcolor','k') 29 if printingflag, 29 if printingflag, 30 30 set(gcf,'Color','w') 31 31 printmodel('eismintdiag1vy','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test1203.m
r13975 r14310 2 2 printingflag=false; 3 3 4 %test 5 and 6 4 %test 5 and 6: 5 5 md=model(); 6 6 md=triangle(md,'../Exp/SquareEISMINT.exp',5100.); %test3 … … 11 11 %Impose a non zero velocity on the upper boundary condition (y=max(y)) 12 12 pos=find(md.mesh.y==max(md.mesh.y)); 13 md.diagnostic.spcvy(pos)=400 *(((md.mesh.x(pos)-100000)/25000).^2-ones(size(pos,1),1)).*heaviside((1+eps)*ones(size(pos,1),1)-((md.mesh.x(pos)-100000)/25000).^2);13 md.diagnostic.spcvy(pos)=400.*(((md.mesh.x(pos)-100000.)/25000.).^2-ones(size(pos,1),1)).*heaviside((1.+eps)*ones(size(pos,1),1)-((md.mesh.x(pos)-100000.)/25000.).^2); 14 14 15 15 %Compute solution for MacAyeal's model … … 23 23 plotmodel(md,'data',vx,'contourlevels',{0,20,40,60,80,100,-20,-40,-60,-80,-100},... 24 24 'contourcolor','k') 25 if printingflag, 25 if printingflag, 26 26 set(gcf,'Color','w') 27 27 printmodel('eismintdiag2vx','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off'); … … 30 30 plotmodel(md,'data',vy,'contourlevels',{-100,-200,-300,-400,-500,-600,-700,-800,-900,-1000},... 31 31 'contourcolor','k') 32 if printingflag, 32 if printingflag, 33 33 set(gcf,'Color','w') 34 34 printmodel('eismintdiag2vy','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test1204.m
r13975 r14310 11 11 %Impose a non zero velocity on the upper boundary condition (y=max(y)) 12 12 pos=find(md.mesh.y==max(md.mesh.y)); 13 md.diagnostic.spcvy(pos)=400 *(((md.mesh.x(pos)-100000)/25000).^2-ones(size(pos,1),1)).*heaviside((1+eps)*ones(size(pos,1),1)-((md.mesh.x(pos)-100000)/25000).^2);13 md.diagnostic.spcvy(pos)=400.*(((md.mesh.x(pos)-100000.)/25000.).^2-ones(size(pos,1),1)).*heaviside((1.+eps)*ones(size(pos,1),1)-((md.mesh.x(pos)-100000.)/25000.).^2); 14 14 15 15 %Compute solution for MacAyeal's model … … 21 21 md.initialization.vy=(md.results.DiagnosticSolution.Vy); 22 22 23 md.timestepping.time_step=1 ;24 md.timestepping.final_time=5000 ;23 md.timestepping.time_step=1.; 24 md.timestepping.final_time=5000.; 25 25 md.prognostic.stabilization=1; 26 26 md=solve(md,TransientSolutionEnum()); 27 27 28 28 plotmodel(md,'data',(md.results.TransientSolution(end).Vx)) 29 if printingflag, 29 if printingflag, 30 30 set(gcf,'Color','w') 31 31 printmodel('eisminttrans2vx','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off'); … … 34 34 35 35 plotmodel(md,'data',(md.results.TransientSolution(end).Vy)) 36 if printingflag, 36 if printingflag, 37 37 set(gcf,'Color','w') 38 38 printmodel('eisminttrans2vy','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off'); … … 41 41 42 42 plotmodel(md,'data',(md.results.TransientSolution(end).Thickness)) 43 if printingflag, 43 if printingflag, 44 44 set(gcf,'Color','w') 45 45 printmodel('eisminttrans2thickness','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test1205.m
r13975 r14310 1 %The aim of this program is to compare a model with an analytical solution given in MacAyeal EISMINT : Lessons in Ice-Sheet Modeling 1 %The aim of this program is to compare a model with an analytical solution given in MacAyeal EISMINT : Lessons in Ice-Sheet Modeling. 2 2 printingflag=false; 3 3 4 4 numlayers=10; 5 resolution=30000 ;5 resolution=30000.; 6 6 7 7 %To begin with the numerical model 8 8 md=model(); 9 md=roundmesh(md,750000 ,resolution);9 md=roundmesh(md,750000.,resolution); 10 10 md=setmask(md,'',''); %We can not test iceshelves nor ice rises with this analytical solution 11 11 md=parameterize(md,'../Par/RoundSheetStaticEISMINT.par'); … … 13 13 %Calculation of the analytical 2d velocity field 14 14 constant=0.3; 15 vx_obs=constant/2 *md.mesh.x.*(md.geometry.thickness).^-1;16 vy_obs=constant/2 *md.mesh.y.*(md.geometry.thickness).^-1;17 vel_obs= (sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2));15 vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1; 16 vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1; 17 vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2); 18 18 19 19 %We extrude the model to have a 3d model … … 23 23 %Spc the nodes on the bed 24 24 pos=find(md.mesh.vertexonbed); 25 md.diagnostic.spcvx(pos)=0 ;26 md.diagnostic.spcvy(pos)=0 ;27 md.diagnostic.spcvz(pos)=0 ;25 md.diagnostic.spcvx(pos)=0.; 26 md.diagnostic.spcvy(pos)=0.; 27 md.diagnostic.spcvz(pos)=0.; 28 28 29 29 %Now we can solve the problem … … 36 36 vel=zeros(md.mesh.numberofvertices2d,1); 37 37 38 node_vel=0;39 38 for i=1:md.mesh.numberofvertices2d 40 for j=1:(md.mesh.numberoflayers-1) 41 node_vel=node_vel+1/(2*(md.mesh.numberoflayers-1))*(sqrt(vx(i+j*md.mesh.numberofvertices2d,1).^2+... 42 vy(i+j*md.mesh.numberofvertices2d,1).^2)+... 39 node_vel=0.; 40 for j=1:md.mesh.numberoflayers-1 41 node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*... 42 (sqrt(vx(i+j*md.mesh.numberofvertices2d,1).^2+vy(i+j*md.mesh.numberofvertices2d,1).^2)+... 43 43 sqrt(vx(i+(j-1)*md.mesh.numberofvertices2d,1).^2+vy(i+(j-1)*md.mesh.numberofvertices2d,1).^2)); 44 44 end 45 45 vel(i,1)=node_vel; 46 node_vel=0;47 46 end 48 47 … … 82 81 caxis([0 100]); 83 82 84 if printingflag, 83 if printingflag, 85 84 set(gcf,'Color','w') 86 85 printmodel('hutterstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off'); … … 92 91 'Vx','Vy','Vel', ... 93 92 }; 94 field_tolerances={ ...93 field_tolerances={ ... 95 94 1e-13,1e-13,1e-13, ... 96 95 }; 97 field_values={ 96 field_values={ ... 98 97 vx,vy,vel, ... 99 98 }; -
issm/trunk/test/NightlyRun/test1206.m
r13975 r14310 1 %The aim of this program is to compare a model with an analytical solution given in MacAyeal EISMINT : Lessons in Ice-Sheet Modeling 1 %The aim of this program is to compare a model with an analytical solution given in MacAyeal EISMINT : Lessons in Ice-Sheet Modeling. 2 2 printingflag=false; 3 3 4 4 numlayers=10; 5 resolution=30000 ;5 resolution=30000.; 6 6 7 7 %To begin with the numerical model 8 8 md=model(); 9 md=roundmesh(md,750000 ,resolution);9 md=roundmesh(md,750000.,resolution); 10 10 md=setmask(md,'',''); %We can not test iceshelves nor ice rises with this analytical solution 11 11 md=parameterize(md,'../Par/RoundSheetStaticEISMINT.par'); … … 13 13 %Calculation of the analytical 2d velocity field 14 14 constant=0.3; 15 vx_obs=constant/2 *md.mesh.x.*(md.geometry.thickness).^-1;16 vy_obs=constant/2 *md.mesh.y.*(md.geometry.thickness).^-1;17 vel_obs= (sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2));15 vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1; 16 vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1; 17 vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2); 18 18 19 19 %We extrude the model to have a 3d model … … 23 23 %Spc the nodes on the bed 24 24 pos=find(md.mesh.vertexonbed); 25 md.diagnostic.spcvx(pos)=0 ;26 md.diagnostic.spcvy(pos)=0 ;27 md.diagnostic.spcvz(pos)=0 ;25 md.diagnostic.spcvx(pos)=0.; 26 md.diagnostic.spcvy(pos)=0.; 27 md.diagnostic.spcvz(pos)=0.; 28 28 29 29 %Now we can solve the problem … … 36 36 vel=zeros(md.mesh.numberofvertices2d,1); 37 37 38 node_vel=0;39 38 for i=1:md.mesh.numberofvertices2d 40 for j=1:(md.mesh.numberoflayers-1) 41 node_vel=node_vel+1/(2*(md.mesh.numberoflayers-1))*(sqrt(vx(i+j*md.mesh.numberofvertices2d,1).^2+... 42 vy(i+j*md.mesh.numberofvertices2d,1).^2)+... 39 node_vel=0.; 40 for j=1:md.mesh.numberoflayers-1 41 node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*... 42 (sqrt(vx(i+j*md.mesh.numberofvertices2d,1).^2+vy(i+j*md.mesh.numberofvertices2d,1).^2)+... 43 43 sqrt(vx(i+(j-1)*md.mesh.numberofvertices2d,1).^2+vy(i+(j-1)*md.mesh.numberofvertices2d,1).^2)); 44 44 end 45 45 vel(i,1)=node_vel; 46 node_vel=0;47 46 end 48 47 … … 81 80 caxis([0 100]); 82 81 83 if printingflag, 82 if printingflag, 84 83 set(gcf,'Color','w') 85 84 printmodel('pattynstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off'); … … 91 90 'Vx','Vy','Vel', ... 92 91 }; 93 field_tolerances={ ...92 field_tolerances={ ... 94 93 1e-12,1e-12,1e-12, ... 95 94 }; 96 field_values={ 95 field_values={ ... 97 96 vx,vy,vel, ... 98 97 }; -
issm/trunk/test/NightlyRun/test1207.m
r13975 r14310 1 %The aim of this program is to compare a model with an analytical solution given in MacAyeal EISMINT : Lessons in Ice-Sheet Modeling 1 %The aim of this program is to compare a model with an analytical solution given in MacAyeal EISMINT : Lessons in Ice-Sheet Modeling. 2 2 printingflag=false; 3 3 4 4 numlayers=10; 5 resolution=30000 ;5 resolution=30000.; 6 6 7 7 %To begin with the numerical model 8 8 md=model(); 9 md=roundmesh(md,750000 ,resolution);9 md=roundmesh(md,750000.,resolution); 10 10 md=setmask(md,'',''); %We can not test iceshelves nor ice rises with this analytical solution 11 11 md=parameterize(md,'../Par/RoundSheetStaticEISMINT.par'); … … 13 13 %Calculation of the analytical 2d velocity field 14 14 constant=0.3; 15 vx_obs=constant/2 *md.mesh.x.*(md.geometry.thickness).^-1;16 vy_obs=constant/2 *md.mesh.y.*(md.geometry.thickness).^-1;17 vel_obs= (sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2));15 vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1; 16 vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1; 17 vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2); 18 18 19 19 %We extrude the model to have a 3d model … … 23 23 %Spc the nodes on the bed 24 24 pos=find(md.mesh.vertexonbed); 25 md.diagnostic.spcvx(pos)=0 ;26 md.diagnostic.spcvy(pos)=0 ;27 md.diagnostic.spcvz(pos)=0 ;25 md.diagnostic.spcvx(pos)=0.; 26 md.diagnostic.spcvy(pos)=0.; 27 md.diagnostic.spcvz(pos)=0.; 28 28 29 29 %Now we can solve the problem … … 36 36 vel=zeros(md.mesh.numberofvertices2d,1); 37 37 38 node_vel=0;39 38 for i=1:md.mesh.numberofvertices2d 40 for j=1:(md.mesh.numberoflayers-1) 41 node_vel=node_vel+1/(2*(md.mesh.numberoflayers-1))*(sqrt(vx(i+j*md.mesh.numberofvertices2d,1).^2+... 42 vy(i+j*md.mesh.numberofvertices2d,1).^2)+... 39 node_vel=0.; 40 for j=1:md.mesh.numberoflayers-1 41 node_vel=node_vel+1./(2.*(md.mesh.numberoflayers-1))*... 42 (sqrt(vx(i+j*md.mesh.numberofvertices2d,1).^2+vy(i+j*md.mesh.numberofvertices2d,1).^2)+... 43 43 sqrt(vx(i+(j-1)*md.mesh.numberofvertices2d,1).^2+vy(i+(j-1)*md.mesh.numberofvertices2d,1).^2)); 44 44 end 45 45 vel(i,1)=node_vel; 46 node_vel=0;47 46 end 48 47 … … 81 80 caxis([0 100]); 82 81 83 if printingflag, 82 if printingflag, 84 83 set(gcf,'Color','w') 85 84 printmodel('stokesstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off'); … … 91 90 'Vx','Vy','Vel', ... 92 91 }; 93 field_tolerances={ ...92 field_tolerances={ ... 94 93 1e-12,1e-12,1e-12, ... 95 94 }; 96 field_values={ 95 field_values={ ... 97 96 vx,vy,vel, ... 98 97 }; -
issm/trunk/test/NightlyRun/test1208.m
r13975 r14310 1 1 %EISMINT benchmark experiment A 2 2 numlayers=8; 3 resolution=50000 ;3 resolution=50000.; 4 4 5 5 %To begin with the numerical model … … 14 14 %Spc the nodes on the bed 15 15 pos=find(md.mesh.vertexonbed); 16 md.diagnostic.spcvx(pos)=0 ;17 md.diagnostic.spcvy(pos)=0 ;18 md.diagnostic.spcvz(pos)=0 ;16 md.diagnostic.spcvx(pos)=0.; 17 md.diagnostic.spcvy(pos)=0.; 18 md.diagnostic.spcvz(pos)=0.; 19 19 20 20 %Adapt the time steps to the resolution 21 md.timestepping.time_step=15 ;21 md.timestepping.time_step=15.; 22 22 md.settings.output_frequency=500; 23 md.timestepping.final_time=30000 ;23 md.timestepping.final_time=30000.; 24 24 md.prognostic.stabilization=1; 25 25 md.thermal.stabilization=1; -
issm/trunk/test/NightlyRun/test1301.m
r13975 r14310 10 10 md=parameterize(md,'../Par/SquareThermal.par'); 11 11 md=extrude(md,3,2.); 12 md=setflowequation(md,' Pattyn','all');12 md=setflowequation(md,'pattyn','all'); 13 13 14 14 %Some conditions specific to melting test … … 24 24 melting=md.basalforcings.geothermalflux/(md.materials.rho_ice*md.materials.latentheat)*md.constants.yts; 25 25 26 %modeled 26 %modeled results 27 27 md.cluster=generic('name',oshostname(),'np',2); 28 28 md=solve(md,ThermalSolutionEnum()); … … 30 30 %plot results 31 31 comp_melting=md.results.ThermalSolution.BasalforcingsMeltingRate; 32 relative=abs((comp_melting-melting)./melting)*100 ;33 relative(find(comp_melting==melting))=0 ;32 relative=abs((comp_melting-melting)./melting)*100.; 33 relative(find(comp_melting==melting))=0.; 34 34 plotmodel(md,'data',comp_melting,'title','Modeled melting','data',melting,'title','Analytical melting',... 35 35 'data',comp_melting-melting,'title','Absolute error','data',relative,'title','Relative error [%]',... 36 36 'layer#all',1,'caxis#2',[1.02964 1.02966]*10^-4,'FontSize#all',20,'figposition','mathieu') 37 if printingflag, 37 if printingflag, 38 38 set(gcf,'Color','w') 39 39 printmodel('thermalmelting','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off'); … … 41 41 end 42 42 43 44 43 %Fields and tolerances to track changes 45 44 field_names ={'BasalMelting'}; -
issm/trunk/test/NightlyRun/test1302.m
r13975 r14310 9 9 md=parameterize(md,'../Par/SquareThermal.par'); 10 10 md=extrude(md,30,1.); %NB: the more one extrudes, the better (10-> relative~0.35%, 20->0.1%, 30->0.05%) 11 md=setflowequation(md,' Pattyn','all');11 md=setflowequation(md,'pattyn','all'); 12 12 13 13 %Thermal boundary conditions 14 pos1=find(md.mesh.elementonbed); md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10 ;15 pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0 ;14 pos1=find(md.mesh.elementonbed); md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.; 15 pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.; 16 16 md.initialization.vz=0.1*ones(md.mesh.numberofvertices,1); 17 17 md.initialization.vel=sqrt( md.initialization.vx.^2+ md.initialization.vy.^2+ md.initialization.vz.^2); … … 22 22 %d2T/dz2-w*rho_ice*c/k*dT/dz=0 T(surface)=0 T(bed)=10 => T=A exp(alpha z)+B 23 23 alpha=0.1/md.constants.yts*md.materials.rho_ice*md.materials.heatcapacity/md.materials.thermalconductivity; %alpha=w rho_ice c /k and w=0.1m/an 24 A=10 /(exp(alpha*(-1000))-1); %A=T(bed)/(exp(alpha*bed)-1) with bed=-1000 T(bed)=1024 A=10./(exp(alpha*(-1000.))-1.); %A=T(bed)/(exp(alpha*bed)-1) with bed=-1000 T(bed)=10 25 25 B=-A; 26 26 md.initialization.temperature=A*exp(alpha*md.mesh.z)+B; 27 27 28 %modeled 28 %modeled results 29 29 md.cluster=generic('name',oshostname(),'np',2); 30 30 md=solve(md,ThermalSolutionEnum()); … … 32 32 %plot results 33 33 comp_temp=md.results.ThermalSolution.Temperature; 34 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100 ;35 relative(find(comp_temp==md.initialization.temperature))=0 ;34 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100.; 35 relative(find(comp_temp==md.initialization.temperature))=0.; 36 36 plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,... 37 37 'title','Analytical temperature [K]','view',3,'data',comp_temp-md.initialization.temperature,... 38 38 'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,... 39 39 'figposition','mathieu','FontSize#all',20) 40 if printingflag, 40 if printingflag, 41 41 set(gcf,'Color','w') 42 42 printmodel('thermaladvection','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test1303.m
r13975 r14310 10 10 md=parameterize(md,'../Par/SquareThermal.par'); 11 11 md=extrude(md,11,2.); 12 md=setflowequation(md,'Pattyn','all'); 13 pos1=find(md.mesh.elementonbed); md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10; 14 pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0; 12 md=setflowequation(md,'pattyn','all'); 13 14 pos1=find(md.mesh.elementonbed); md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.; 15 pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.; 15 16 md.initialization.pressure=zeros(md.mesh.numberofvertices,1); 16 17 … … 18 19 %d2T/dz2=0 T(bed)=10 T(surface)=0 => T=0*(z-bed)/thickness+10*(surface-z)/thickness 19 20 %each layer of the 3d mesh must have a constant value 20 md.initialization.temperature=10 *(md.geometry.surface-md.mesh.z)./md.geometry.thickness;21 md.initialization.temperature=10.*(md.geometry.surface-md.mesh.z)./md.geometry.thickness; 21 22 22 %modeled 23 %modeled results 23 24 md.cluster=generic('name',oshostname(),'np',2); 24 25 md=solve(md,ThermalSolutionEnum()); … … 26 27 %plot results 27 28 comp_temp=md.results.ThermalSolution.Temperature; 28 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100 ;29 relative(find(comp_temp==md.initialization.temperature))=0 ;29 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100.; 30 relative(find(comp_temp==md.initialization.temperature))=0.; 30 31 plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,... 31 32 'title','Analytical temperature [K]','view',3,'data',comp_temp-md.initialization.temperature,... 32 33 'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,... 33 34 'figposition','mathieu','FontSize#all',20) 34 if printingflag, 35 if printingflag, 35 36 set(gcf,'Color','w') 36 37 printmodel('thermalconduction','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test1304.m
r13975 r14310 10 10 md=parameterize(md,'../Par/SquareThermal.par'); 11 11 md=extrude(md,11,1.); 12 md=setflowequation(md,' Pattyn','all');12 md=setflowequation(md,'pattyn','all'); 13 13 14 pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0 ;14 pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.; 15 15 md.initialization.pressure=zeros(md.mesh.numberofvertices,1); 16 16 md.basalforcings.geothermalflux(:)=0.1; %100mW/m^2 … … 21 21 md.initialization.temperature=-0.1/md.materials.thermalconductivity*(md.mesh.z-md.geometry.surface); %G=0.1 W/m2 22 22 23 %modeled 23 %modeled results 24 24 md.cluster=generic('name',oshostname(),'np',2); 25 25 md=solve(md,ThermalSolutionEnum()); … … 27 27 %plot results 28 28 comp_temp=md.results.ThermalSolution.Temperature; 29 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100 ;30 relative(find(comp_temp==md.initialization.temperature))=0 ;29 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100.; 30 relative(find(comp_temp==md.initialization.temperature))=0.; 31 31 plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,... 32 32 'title','Analytical temperature','view',3,'data',comp_temp-md.initialization.temperature,... 33 33 'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,... 34 34 'figposition','mathieu','FontSize#all',20) 35 if printingflag, 35 if printingflag, 36 36 set(gcf,'Color','w') 37 37 printmodel('thermalgeothermalflux','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test1401.m
r13975 r14310 1 1 %test the anisotropic mesh adaptation 2 %function to capture = exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10 ^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2;2 %function to capture = exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10.^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2.; 3 3 printingflag=false; 4 4 5 5 %create square mesh 6 L=1 ; %in m6 L=1.; %in m 7 7 nx=70; %numberof nodes in x direction 8 8 ny=70; … … 11 11 %mesh adaptation loop YAMS 12 12 md=squaremesh(md,L,L,nx,ny); 13 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10 ^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2;13 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10.^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2.; 14 14 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 15 if printingflag, 15 if printingflag, 16 16 set(gcf,'Color','w') 17 17 printmodel('mesh1_yams1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 19 19 end 20 20 21 md=YamsCall(md,md.inversion.vel_obs,0.001,0.3,1.3,10 ^-4);22 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10 ^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2;21 md=YamsCall(md,md.inversion.vel_obs,0.001,0.3,1.3,10.^-4); 22 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10.^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2.; 23 23 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 24 if printingflag, 24 if printingflag, 25 25 set(gcf,'Color','w') 26 26 printmodel('mesh1_yams2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 29 29 30 30 md=YamsCall(md,md.inversion.vel_obs,0.001,0.3,2.5,0.008); 31 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10 ^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2;31 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10.^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2.; 32 32 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 33 if printingflag, 33 if printingflag, 34 34 set(gcf,'Color','w') 35 35 printmodel('mesh1_yams3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 41 41 %mesh adaptation loop BAMG 42 42 md=squaremesh(md,L,L,nx,ny); 43 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10 ^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2;43 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10.^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2.; 44 44 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 45 if printingflag, 45 if printingflag, 46 46 set(gcf,'Color','w') 47 47 printmodel('mesh1_bamg1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 50 50 51 51 md.private.bamg=NaN; 52 md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.001,'hmax',0.3,'gradation',1.3,'err',10 ^-4);53 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10 ^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2;52 md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.001,'hmax',0.3,'gradation',1.3,'err',10.^-4); 53 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10.^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2.; 54 54 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 55 if printingflag, 55 if printingflag, 56 56 set(gcf,'Color','w') 57 57 printmodel('mesh1_bamg2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 61 61 md.private.bamg=NaN; 62 62 md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.001,'hmax',0.3,'gradation',2.5,'err',0.008); 63 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10 ^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2;63 md.inversion.vel_obs=exp(-(sqrt((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)-0.75).^2*10.^6)+((md.mesh.x+0.1).^2+(md.mesh.y+0.1).^2)/2.; 64 64 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 65 if printingflag, 65 if printingflag, 66 66 set(gcf,'Color','w') 67 67 printmodel('mesh1_bamg3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test1402.m
r13975 r14310 3 3 4 4 %create square mesh 5 L=1 ; %in m5 L=1.; %in m 6 6 nx=30; %numberof nodes in x direction 7 7 ny=30; … … 10 10 %mesh adaptation loop YAMS 11 11 md=squaremesh(md,L,L,nx,ny); 12 u=4 *md.mesh.x-2; v=4*md.mesh.y-2;13 md.inversion.vel_obs=tanh(30 *(u.^2+v.^2-0.25)) ...14 +tanh(30 *((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u-0.75).^2+(v+0.75).^2-0.25)) ...15 +tanh(30 *((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u+0.75).^2+(v+0.75).^2-0.25));12 u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.; 13 md.inversion.vel_obs=tanh(30.*(u.^2+v.^2-0.25)) ... 14 +tanh(30.*((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u-0.75).^2+(v+0.75).^2-0.25)) ... 15 +tanh(30.*((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u+0.75).^2+(v+0.75).^2-0.25)); 16 16 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 17 if printingflag, 17 if printingflag, 18 18 set(gcf,'Color','w') 19 19 printmodel('mesh2_yams1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 21 21 end 22 22 23 md=YamsCall(md,md.inversion.vel_obs,0.005,0.3,2.3,10 ^-2);24 u=4 *md.mesh.x-2; v=4*md.mesh.y-2;25 md.inversion.vel_obs=tanh(30 *(u.^2+v.^2-0.25)) ...26 +tanh(30 *((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u-0.75).^2+(v+0.75).^2-0.25)) ...27 +tanh(30 *((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u+0.75).^2+(v+0.75).^2-0.25));23 md=YamsCall(md,md.inversion.vel_obs,0.005,0.3,2.3,10.^-2); 24 u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.; 25 md.inversion.vel_obs=tanh(30.*(u.^2+v.^2-0.25)) ... 26 +tanh(30.*((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u-0.75).^2+(v+0.75).^2-0.25)) ... 27 +tanh(30.*((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u+0.75).^2+(v+0.75).^2-0.25)); 28 28 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 29 if printingflag, 29 if printingflag, 30 30 set(gcf,'Color','w') 31 31 printmodel('mesh2_yams2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 34 34 35 35 md=YamsCall(md,md.inversion.vel_obs,0.005,0.3,3,0.005); 36 u=4 *md.mesh.x-2; v=4*md.mesh.y-2;37 md.inversion.vel_obs=tanh(30 *(u.^2+v.^2-0.25)) ...38 +tanh(30 *((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u-0.75).^2+(v+0.75).^2-0.25)) ...39 +tanh(30 *((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u+0.75).^2+(v+0.75).^2-0.25));36 u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.; 37 md.inversion.vel_obs=tanh(30.*(u.^2+v.^2-0.25)) ... 38 +tanh(30.*((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u-0.75).^2+(v+0.75).^2-0.25)) ... 39 +tanh(30.*((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u+0.75).^2+(v+0.75).^2-0.25)); 40 40 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 41 if printingflag, 41 if printingflag, 42 42 set(gcf,'Color','w') 43 43 printmodel('mesh2_yams3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 49 49 %mesh adaptation loop BAMG 50 50 md=squaremesh(md,L,L,nx,ny); 51 u=4 *md.mesh.x-2; v=4*md.mesh.y-2;52 md.inversion.vel_obs=tanh(30 *(u.^2+v.^2-0.25)) ...53 +tanh(30 *((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u-0.75).^2+(v+0.75).^2-0.25)) ...54 +tanh(30 *((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u+0.75).^2+(v+0.75).^2-0.25));51 u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.; 52 md.inversion.vel_obs=tanh(30.*(u.^2+v.^2-0.25)) ... 53 +tanh(30.*((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u-0.75).^2+(v+0.75).^2-0.25)) ... 54 +tanh(30.*((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u+0.75).^2+(v+0.75).^2-0.25)); 55 55 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 56 if printingflag, 56 if printingflag, 57 57 set(gcf,'Color','w') 58 58 printmodel('mesh2_bamg1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 61 61 62 62 md.private.bamg=NaN; 63 md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.005,'hmax',0.3,'gradation',2.3,'err',10 ^-2);64 u=4 *md.mesh.x-2; v=4*md.mesh.y-2;65 md.inversion.vel_obs=tanh(30 *(u.^2+v.^2-0.25)) ...66 +tanh(30 *((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u-0.75).^2+(v+0.75).^2-0.25)) ...67 +tanh(30 *((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u+0.75).^2+(v+0.75).^2-0.25));63 md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.005,'hmax',0.3,'gradation',2.3,'err',10.^-2); 64 u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.; 65 md.inversion.vel_obs=tanh(30.*(u.^2+v.^2-0.25)) ... 66 +tanh(30.*((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u-0.75).^2+(v+0.75).^2-0.25)) ... 67 +tanh(30.*((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u+0.75).^2+(v+0.75).^2-0.25)); 68 68 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 69 if printingflag, 69 if printingflag, 70 70 set(gcf,'Color','w') 71 71 printmodel('mesh2_bamg2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 75 75 md.private.bamg=NaN; 76 76 md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.005,'hmax',0.3,'gradation',3,'err',0.005); 77 u=4 *md.mesh.x-2; v=4*md.mesh.y-2;78 md.inversion.vel_obs=tanh(30 *(u.^2+v.^2-0.25)) ...79 +tanh(30 *((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u-0.75).^2+(v+0.75).^2-0.25)) ...80 +tanh(30 *((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u+0.75).^2+(v+0.75).^2-0.25));77 u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.; 78 md.inversion.vel_obs=tanh(30.*(u.^2+v.^2-0.25)) ... 79 +tanh(30.*((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u-0.75).^2+(v+0.75).^2-0.25)) ... 80 +tanh(30.*((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u+0.75).^2+(v+0.75).^2-0.25)); 81 81 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 82 if printingflag, 82 if printingflag, 83 83 set(gcf,'Color','w') 84 84 printmodel('mesh2_bamg3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); … … 88 88 md.private.bamg=NaN; 89 89 md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.005,'hmax',0.3,'gradation',1.5,'err',0.003,'anisomax',1); 90 u=4 *md.mesh.x-2; v=4*md.mesh.y-2;91 md.inversion.vel_obs=tanh(30 *(u.^2+v.^2-0.25)) ...92 +tanh(30 *((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u-0.75).^2+(v+0.75).^2-0.25)) ...93 +tanh(30 *((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30*((u+0.75).^2+(v+0.75).^2-0.25));90 u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.; 91 md.inversion.vel_obs=tanh(30.*(u.^2+v.^2-0.25)) ... 92 +tanh(30.*((u-0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u-0.75).^2+(v+0.75).^2-0.25)) ... 93 +tanh(30.*((u+0.75).^2+(v-0.75).^2-0.25)) +tanh(30.*((u+0.75).^2+(v+0.75).^2-0.25)); 94 94 plotmodel(md,'data',md.inversion.vel_obs,'data',md.inversion.vel_obs,'nlines',1,'ncols',2,'title','','figposition',[500 500 1000 500],'axis#all','equal','xlim#all',[0 1],'ylim#all',[0 1],'edgecolor#1','w'); pause(0.5); 95 if printingflag, 95 if printingflag, 96 96 set(gcf,'Color','w') 97 97 printmodel('mesh2_bamgiso','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off'); -
issm/trunk/test/NightlyRun/test234.m
r13975 r14310 42 42 md.qmu.method=dakota_method('nond_samp'); 43 43 md.qmu.method(end)=dmeth_params_set(md.qmu.method(end),'seed',1234,'samples',20,'sample_type','lhs'); 44 if (str2num(dakotaversion())>4.2) 45 md.qmu.method(end)=dmeth_params_set(md.qmu.method(end),'rng','rnum2') 46 end 44 47 45 48 %parameters … … 59 62 60 63 %Fields and tolerances to track changes 61 md.results.dakota. importancefactors=[];64 md.results.dakota.moments=[]; 62 65 for i=1:8, 63 md.results.dakota. importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).mean];66 md.results.dakota.moments=[md.results.dakota.moments md.results.dakota.dresp_out(i).mean]; 64 67 end 65 68 for i=1:8, 66 md.results.dakota. importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).stddev];69 md.results.dakota.moments=[md.results.dakota.moments md.results.dakota.dresp_out(i).stddev]; 67 70 end 68 field_names ={' importancefactors'};71 field_names ={'moments'}; 69 72 field_tolerances={1e-11}; 70 73 field_values={... 71 md.results.dakota. importancefactors,...74 md.results.dakota.moments,... 72 75 }; -
issm/trunk/test/NightlyRun/test235.m
r13975 r14310 59 59 60 60 %Fields and tolerances to track changes 61 md.results.dakota. importancefactors=[];61 md.results.dakota.moments=[]; 62 62 for i=1:8, 63 md.results.dakota. importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).mean];63 md.results.dakota.moments=[md.results.dakota.moments md.results.dakota.dresp_out(i).mean]; 64 64 end 65 65 for i=1:8, 66 md.results.dakota. importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).stddev];66 md.results.dakota.moments=[md.results.dakota.moments md.results.dakota.dresp_out(i).stddev]; 67 67 end 68 field_names ={' importancefactors'};68 field_names ={'moments'}; 69 69 field_tolerances={1e-11}; 70 70 field_values={... 71 md.results.dakota. importancefactors,...71 md.results.dakota.moments,... 72 72 }; -
issm/trunk/test/NightlyRun/test328.m
r13975 r14310 4 4 md=setflowequation(md,'macayeal','all'); 5 5 md.surfaceforcings.issmbgradients=1; 6 md.surfaceforcings.smb_pos_max=5000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y;7 md.surfaceforcings.smb_pos_min=1250. + 0.00005*md.mesh.x -0.0001*md.mesh.y;8 md.surfaceforcings.a_pos=15000. - 0.000051*md.mesh.x + 0.00011*md.mesh.y;9 6 md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y; 10 md.surfaceforcings.a_neg=-20000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y;11 7 md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y; 12 md.surfaceforcings.hc=(md.surfaceforcings.a_pos-md.surfaceforcings.a_neg)./(md.surfaceforcings.b_neg-md.surfaceforcings.b_pos); 8 md.surfaceforcings.href=md.geometry.surface; 9 md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y; 13 10 md.transient.requested_outputs=TotalSmbEnum(); 14 md.surfaceforcings.href=md.geometry.surface;15 for i=1:size(md.surfaceforcings.hc),16 if md.geometry.surface(i)<md.surfaceforcings.hc(i)17 smbref(i)=md.surfaceforcings.a_neg(i)+md.surfaceforcings.b_neg(i)*md.geometry.surface(i);18 else19 smbref(i)=md.surfaceforcings.a_pos(i)+md.surfaceforcings.b_pos(i)*md.geometry.surface(i);20 end21 end22 md.surfaceforcings.smbref=smbref';23 11 md.cluster=generic('name',oshostname(),'np',3); 24 12 md=solve(md,TransientSolutionEnum()); -
issm/trunk/test/NightlyRun/test328.py
r13975 r14310 15 15 md=setflowequation(md,'macayeal','all') 16 16 md.surfaceforcings.issmbgradients=1 17 md.surfaceforcings.smb_pos_max=5000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y18 md.surfaceforcings.smb_pos_min=1250. + 0.00005*md.mesh.x -0.0001*md.mesh.y19 md.surfaceforcings.a_pos=15000. - 0.000051*md.mesh.x + 0.00011*md.mesh.y20 17 md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y 21 md.surfaceforcings.a_neg=-20000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y22 18 md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y 23 md.surfaceforcings.hc=(md.surfaceforcings.a_pos-md.surfaceforcings.a_neg)/(md.surfaceforcings.b_neg-md.surfaceforcings.b_pos)24 19 md.transient.requested_outputs=TotalSmbEnum() 25 20 md.surfaceforcings.href=copy.deepcopy(md.geometry.surface).reshape(-1) 26 smbref=numpy.empty_like(md.surfaceforcings.hc) 27 for i in xrange(numpy.size(md.surfaceforcings.hc,axis=0)): 28 if md.geometry.surface[i]<md.surfaceforcings.hc[i]: 29 smbref[i]=md.surfaceforcings.a_neg[i]+md.surfaceforcings.b_neg[i]*md.geometry.surface[i] 30 else: 31 smbref[i]=md.surfaceforcings.a_pos[i]+md.surfaceforcings.b_pos[i]*md.geometry.surface[i] 32 md.surfaceforcings.smbref=smbref 21 md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y; 33 22 md.cluster=generic('name',oshostname(),'np',3) 34 23 md=solve(md,TransientSolutionEnum()) -
issm/trunk/test/NightlyRun/test329.m
r13975 r14310 5 5 md=setflowequation(md,'pattyn','all'); 6 6 md.surfaceforcings.issmbgradients=1; 7 md.surfaceforcings.smb_pos_max=5000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y;8 md.surfaceforcings.smb_pos_min=1250. + 0.00005*md.mesh.x -0.0001*md.mesh.y;9 md.surfaceforcings.a_pos=15000. - 0.000051*md.mesh.x + 0.00011*md.mesh.y;10 7 md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y; 11 md.surfaceforcings.a_neg=-20000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y;12 8 md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y; 13 md.surfaceforcings.hc=(md.surfaceforcings.a_pos-md.surfaceforcings.a_neg)./(md.surfaceforcings.b_neg-md.surfaceforcings.b_pos);14 9 md.surfaceforcings.href=md.geometry.surface; 15 for i=1:size(md.surfaceforcings.hc), 16 if md.geometry.surface(i)<md.surfaceforcings.hc(i) 17 smbref(i)=md.surfaceforcings.a_neg(i)+md.surfaceforcings.b_neg(i)*md.geometry.surface(i); 18 else 19 smbref(i)=md.surfaceforcings.a_pos(i)+md.surfaceforcings.b_pos(i)*md.geometry.surface(i); 20 end 21 end 22 md.surfaceforcings.smbref=smbref'; 10 md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y; 23 11 md.transient.requested_outputs=TotalSmbEnum(); 24 12 md.cluster=generic('name',oshostname(),'np',3); … … 26 14 27 15 %Fields and tolerances to track changes 28 field_names ={'Vx1','Vy1','Vz1','Vel1','Bed1','Surface1','Thickness1','Temperature1','SMB1','TotalSmb1','Vx2','Vy2','Vz2','Vel2','Bed2','Surface2','Thickness2','Temperature2','SMB2','TotalSmb 1','Vx3','Vy3','Vz3','Vel3','Bed3','Surface3','Thickness3','Temperature3','SMB3','TotalSmb1'};16 field_names ={'Vx1','Vy1','Vz1','Vel1','Bed1','Surface1','Thickness1','Temperature1','SMB1','TotalSmb1','Vx2','Vy2','Vz2','Vel2','Bed2','Surface2','Thickness2','Temperature2','SMB2','TotalSmb2','Vx3','Vy3','Vz3','Vel3','Bed3','Surface3','Thickness3','Temperature3','SMB3','TotalSmb3'}; 29 17 field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,... 30 18 1e-09,1e-09,1e-10,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,... -
issm/trunk/test/NightlyRun/test329.py
r13975 r14310 16 16 md=setflowequation(md,'pattyn','all') 17 17 md.surfaceforcings.issmbgradients=1 18 md.surfaceforcings.smb_pos_max=5000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y19 md.surfaceforcings.smb_pos_min=1250. + 0.00005*md.mesh.x -0.0001*md.mesh.y20 md.surfaceforcings.a_pos=15000. - 0.000051*md.mesh.x + 0.00011*md.mesh.y21 18 md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y 22 md.surfaceforcings.a_neg=-20000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y23 19 md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y 24 md.surfaceforcings.hc=(md.surfaceforcings.a_pos-md.surfaceforcings.a_neg)/(md.surfaceforcings.b_neg-md.surfaceforcings.b_pos)25 20 md.surfaceforcings.href=copy.deepcopy(md.geometry.surface).reshape(-1) 26 smbref=numpy.empty_like(md.surfaceforcings.hc) 27 for i in xrange(numpy.size(md.surfaceforcings.hc,axis=0)): 28 if md.geometry.surface[i]<md.surfaceforcings.hc[i]: 29 smbref[i]=md.surfaceforcings.a_neg[i]+md.surfaceforcings.b_neg[i]*md.geometry.surface[i] 30 else: 31 smbref[i]=md.surfaceforcings.a_pos[i]+md.surfaceforcings.b_pos[i]*md.geometry.surface[i] 32 md.surfaceforcings.smbref=smbref 21 md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y; 33 22 md.transient.requested_outputs=TotalSmbEnum() 34 23 md.cluster=generic('name',oshostname(),'np',3) … … 36 25 37 26 #Fields and tolerances to track changes 38 field_names =['Vx1','Vy1','Vz1','Vel1','Bed1','Surface1','Thickness1','Temperature1','SMB1','TotalSmb1','Vx2','Vy2','Vz2','Vel2','Bed2','Surface2','Thickness2','Temperature2','SMB2','TotalSmb 1','Vx3','Vy3','Vz3','Vel3','Bed3','Surface3','Thickness3','Temperature3','SMB3','TotalSmb1']27 field_names =['Vx1','Vy1','Vz1','Vel1','Bed1','Surface1','Thickness1','Temperature1','SMB1','TotalSmb1','Vx2','Vy2','Vz2','Vel2','Bed2','Surface2','Thickness2','Temperature2','SMB2','TotalSmb2','Vx3','Vy3','Vz3','Vel3','Bed3','Surface3','Thickness3','Temperature3','SMB3','TotalSmb3'] 39 28 field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\ 40 29 1e-09,1e-09,1e-10,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\ -
issm/trunk/test/NightlyRun/test414.m
r13975 r14310 55 55 %we recover those mass fluxes through the mean of the response. 56 56 %also, we recover the max velo, which should be 1m/yr. 57 %we put all that data in the importancefactors, which we will use to test for success.57 %we put all that data in the moments, which we will use to test for success. 58 58 %also, check that the stddev are 0. 59 md.results.dakota. importancefactors=[];59 md.results.dakota.moments=[]; 60 60 for i=1:8, 61 md.results.dakota. importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).mean];61 md.results.dakota.moments=[md.results.dakota.moments md.results.dakota.dresp_out(i).mean]; 62 62 end 63 63 for i=1:8, 64 md.results.dakota. importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).stddev];64 md.results.dakota.moments=[md.results.dakota.moments md.results.dakota.dresp_out(i).stddev]; 65 65 end 66 field_names ={' importancefactors'};66 field_names ={'moments'}; 67 67 field_tolerances={1e-11}; 68 68 field_values={... 69 md.results.dakota. importancefactors,...69 md.results.dakota.moments,... 70 70 }; -
issm/trunk/test/Par/ISMIPA.par
r9734 r14310 2 2 3 3 disp(' creating thickness'); 4 md.geometry.surface=-md.mesh.x*tan(0.5*pi/180 );5 md.geometry.bed=md.geometry.surface-1000 +500*sin(md.mesh.x*2*pi/max(md.mesh.x)).*sin(md.mesh.y*2*pi/max(md.mesh.x));4 md.geometry.surface=-md.mesh.x*tan(0.5*pi/180.); 5 md.geometry.bed=md.geometry.surface-1000.+500.*sin(md.mesh.x*2.*pi/max(md.mesh.x)).*sin(md.mesh.y*2.*pi/max(md.mesh.x)); 6 6 md.geometry.thickness=md.geometry.surface-md.geometry.bed; 7 7 8 8 disp(' creating drag'); 9 md.friction.coefficient=200 *ones(md.mesh.numberofvertices,1); %q=1.9 md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1. 10 10 %Take care of iceshelves: no basal drag 11 11 pos=find(md.mask.elementonfloatingice); 12 md.friction.coefficient(md.mesh.elements(pos,:))=0 ;12 md.friction.coefficient(md.mesh.elements(pos,:))=0.; 13 13 md.friction.p=ones(md.mesh.numberofelements,1); 14 14 md.friction.q=ones(md.mesh.numberofelements,1); 15 15 16 disp(' creating flow law param ter');16 disp(' creating flow law parameter'); 17 17 md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1); 18 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);18 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 19 19 20 20 disp(' boundary conditions for diagnostic model'); 21 %Create node on boundary fi st (because we cannot use mesh)21 %Create node on boundary first (because we cannot use mesh) 22 22 md=SetIceSheetBC(md); -
issm/trunk/test/Par/ISMIPB.par
r9734 r14310 2 2 3 3 disp(' creating thickness'); 4 md.geometry.surface=-md.mesh.x*tan(0.5*pi/180 );5 md.geometry.bed=md.geometry.surface-1000 +500*sin(md.mesh.x*2*pi/max(md.mesh.x));4 md.geometry.surface=-md.mesh.x*tan(0.5*pi/180.); 5 md.geometry.bed=md.geometry.surface-1000.+500.*sin(md.mesh.x*2.*pi/max(md.mesh.x)); 6 6 md.geometry.thickness=md.geometry.surface-md.geometry.bed; 7 7 8 8 disp(' creating drag'); 9 md.friction.coefficient=200 *ones(md.mesh.numberofvertices,1); %q=1.9 md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1. 10 10 %Take care of iceshelves: no basal drag 11 11 pos=find(md.mask.elementonfloatingice); 12 md.friction.coefficient(md.mesh.elements(pos,:))=0 ;12 md.friction.coefficient(md.mesh.elements(pos,:))=0.; 13 13 md.friction.p=ones(md.mesh.numberofelements,1); 14 14 md.friction.q=ones(md.mesh.numberofelements,1); 15 15 16 disp(' creating flow law param ter');16 disp(' creating flow law parameter'); 17 17 md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1); 18 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);18 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 19 19 20 20 disp(' boundary conditions for diagnostic model'); 21 %Create node on boundary fi st (because we cannot use mesh)21 %Create node on boundary first (because we cannot use mesh) 22 22 md=SetIceSheetBC(md); -
issm/trunk/test/Par/ISMIPC.par
r9734 r14310 2 2 3 3 disp(' creating thickness'); 4 md.geometry.surface=2000 -md.mesh.x*tan(0.1*pi/180); %to have z>05 md.geometry.bed=md.geometry.surface-1000 ;4 md.geometry.surface=2000.-md.mesh.x*tan(0.1*pi/180.); %to have z>0 5 md.geometry.bed=md.geometry.surface-1000.; 6 6 md.geometry.thickness=md.geometry.surface-md.geometry.bed; 7 7 8 8 disp(' creating drag'); 9 %md.friction.coefficient=sqrt(md.constants.yts.*(1000 +1000*sin(md.mesh.x*2*pi/max(md.mesh.x/2)).*sin(md.mesh.y*2*pi/max(md.mesh.x/2)))./(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed)));10 md.friction.coefficient=sqrt(md.constants.yts.*(1000 +1000*sin(md.mesh.x*2*pi/max(md.mesh.x)).*sin(md.mesh.y*2*pi/max(md.mesh.x))));9 %md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x/2.)).*sin(md.mesh.y*2.*pi/max(md.mesh.x/2.)))./(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.bed))); 10 md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x)).*sin(md.mesh.y*2.*pi/max(md.mesh.x)))); 11 11 %Take care of iceshelves: no basal drag 12 12 pos=find(md.mask.elementonfloatingice); 13 md.friction.coefficient(md.mesh.elements(pos,:))=0 ;13 md.friction.coefficient(md.mesh.elements(pos,:))=0.; 14 14 md.friction.p=ones(md.mesh.numberofelements,1); 15 15 md.friction.q=zeros(md.mesh.numberofelements,1); 16 16 17 disp(' creating flow law param ter');17 disp(' creating flow law parameter'); 18 18 md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1); 19 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);19 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 20 20 21 disp(' boundary conditions for diagnostic model: 22 %Create node on boundary fi st (because wican not use mesh)21 disp(' boundary conditions for diagnostic model:'); 22 %Create node on boundary first (because we can not use mesh) 23 23 md=SetIceSheetBC(md); -
issm/trunk/test/Par/ISMIPD.par
r9734 r14310 2 2 3 3 disp(' creating thickness'); 4 md.geometry.surface=2000 -md.mesh.x*tan(0.1*pi/180); %to have z>05 md.geometry.bed=md.geometry.surface-1000 ;4 md.geometry.surface=2000.-md.mesh.x*tan(0.1*pi/180.); %to have z>0 5 md.geometry.bed=md.geometry.surface-1000.; 6 6 md.geometry.thickness=md.geometry.surface-md.geometry.bed; 7 7 8 8 disp(' creating drag'); 9 md.friction.coefficient=sqrt(md.constants.yts.*(1000 +1000*sin(md.mesh.x*2*pi/max(md.mesh.x))));9 md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x)))); 10 10 %Take care of iceshelves: no basal drag 11 11 pos=find(md.mask.elementonfloatingice); 12 md.friction.coefficient(md.mesh.elements(pos,:))=0 ;12 md.friction.coefficient(md.mesh.elements(pos,:))=0.; 13 13 md.friction.p=ones(md.mesh.numberofelements,1); 14 14 md.friction.q=zeros(md.mesh.numberofelements,1); 15 15 16 disp(' creating flow law param ter');16 disp(' creating flow law parameter'); 17 17 md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1); 18 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);18 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 19 19 20 disp(' boundary conditions for diagnostic model: 21 %Create node on boundary fi st (because wican not use mesh)20 disp(' boundary conditions for diagnostic model:'); 21 %Create node on boundary first (because we can not use mesh) 22 22 md=SetIceSheetBC(md); -
issm/trunk/test/Par/ISMIPE.par
r13395 r14310 7 7 for i=1:md.mesh.numberofvertices 8 8 y=md.mesh.y(i); 9 point1=floor(y/100 )+1;9 point1=floor(y/100.)+1; 10 10 point2=min(point1+1,51); 11 coeff=(y-(point1-1 )*100)/100;12 md.geometry.bed(i)=(1 -coeff)*data(point1,2)+coeff*data(point2,2);13 md.geometry.surface(i)=(1 -coeff)*data(point1,3)+coeff*data(point2,3);11 coeff=(y-(point1-1.)*100.)/100.; 12 md.geometry.bed(i)=(1.-coeff)*data(point1,2)+coeff*data(point2,2); 13 md.geometry.surface(i)=(1.-coeff)*data(point1,3)+coeff*data(point2,3); 14 14 end 15 15 md.geometry.thickness=md.geometry.surface-md.geometry.bed; … … 22 22 md.friction.q=ones(md.mesh.numberofelements,1); 23 23 24 disp(' creating flow law param ter');24 disp(' creating flow law parameter'); 25 25 md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1); 26 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);26 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 27 27 28 disp(' boundary conditions for diagnostic model: 29 %Create node on boundary fi st (because wican not use mesh)28 disp(' boundary conditions for diagnostic model:'); 29 %Create node on boundary first (because we can not use mesh) 30 30 md=SetIceSheetBC(md); -
issm/trunk/test/Par/ISMIPF.par
r9764 r14310 3 3 4 4 disp(' creating thickness'); 5 md.geometry.surface=-md.mesh.x*tan(3 *pi/180);6 %md.geometry.bed=md.geometry.surface-1000 ;7 md.geometry.bed=md.geometry.surface-1000 +100*exp(-((md.mesh.x-max(md.mesh.x)/2).^2+(md.mesh.y-max(md.mesh.y)/2).^2)/(10000^2));5 md.geometry.surface=-md.mesh.x*tan(3.*pi/180.); 6 %md.geometry.bed=md.geometry.surface-1000.; 7 md.geometry.bed=md.geometry.surface-1000.+100.*exp(-((md.mesh.x-max(md.mesh.x)/2.).^2+(md.mesh.y-max(md.mesh.y)/2.).^2)/(10000.^2)); 8 8 md.geometry.thickness=md.geometry.surface-md.geometry.bed; 9 9 10 10 disp(' creating drag'); 11 md.friction.coefficient=sqrt(md.constants.yts/(2.140373*10^-7*1000 ))*ones(md.mesh.numberofvertices,1);11 md.friction.coefficient=sqrt(md.constants.yts/(2.140373*10^-7*1000.))*ones(md.mesh.numberofvertices,1); 12 12 md.friction.p=ones(md.mesh.numberofelements,1); 13 13 md.friction.q=zeros(md.mesh.numberofelements,1); 14 14 15 disp(' creating flow law param ter');15 disp(' creating flow law parameter'); 16 16 md.materials.rheology_B=1.4734*10^14*ones(md.mesh.numberofvertices,1); 17 md.materials.rheology_n=1 *ones(md.mesh.numberofelements,1);17 md.materials.rheology_n=1.*ones(md.mesh.numberofelements,1); 18 18 md.materials.rheology_law='None'; 19 19 20 20 disp(' boundary conditions for diagnostic model'); 21 %Create node on boundary fi st (because we cannot use mesh)21 %Create node on boundary first (because we cannot use mesh) 22 22 md=SetIceSheetBC(md); 23 md.diagnostic.spcvx=100 *ones(md.mesh.numberofvertices,1);23 md.diagnostic.spcvx=100.*ones(md.mesh.numberofvertices,1); 24 24 md.initialization.vx=zeros(md.mesh.numberofvertices,1); 25 25 md.initialization.vy=zeros(md.mesh.numberofvertices,1); … … 27 27 md.initialization.vel=zeros(md.mesh.numberofvertices,1); 28 28 md.initialization.pressure=zeros(md.mesh.numberofvertices,1); 29 md.initialization.temperature=255 *ones(md.mesh.numberofvertices,1);29 md.initialization.temperature=255.*ones(md.mesh.numberofvertices,1); 30 30 pos=find(md.mesh.x==min(md.mesh.x) | md.mesh.x==max(md.mesh.x) | md.mesh.y==min(md.mesh.y) | md.mesh.y==max(md.mesh.y)); 31 31 md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1); … … 33 33 md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices,1); 34 34 md.prognostic.spcthickness(pos)=md.geometry.thickness(pos); 35 md.thermal.spctemperature=255 *ones(md.mesh.numberofvertices,1);35 md.thermal.spctemperature=255.*ones(md.mesh.numberofvertices,1); 36 36 md.basalforcings.geothermalflux=0.4*ones(md.mesh.numberofvertices,1); 37 37 … … 40 40 41 41 %Transient options 42 md.timestepping.time_step=1 ;43 md.timestepping.final_time=10 ;42 md.timestepping.time_step=1.; 43 md.timestepping.final_time=10.; 44 44 md.prognostic.stabilization=1; 45 45 md.thermal.stabilization=1; -
issm/trunk/test/Par/Pig.py
r13975 r14310 48 48 md.prognostic.stabilization=1. 49 49 md.verbose=verbose(0) 50 md.settings.waitonlock=30 .50 md.settings.waitonlock=30 51 51 md.timestepping.time_step=1. 52 52 md.timestepping.final_time=2. -
issm/trunk/test/Par/RoundSheetEISMINT.par
r9734 r14310 1 1 %Ok, start defining model parameters here 2 2 disp(' creating thickness'); 3 md.geometry.thickness=10 *ones(md.mesh.numberofvertices,1);3 md.geometry.thickness=10.*ones(md.mesh.numberofvertices,1); 4 4 md.geometry.bed=zeros(md.mesh.numberofvertices,1); 5 5 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 6 6 7 7 disp(' creating drag'); 8 md.friction.coefficient=20 *ones(md.mesh.numberofvertices,1); %q=1. %no drag is specified in the analytical solution8 md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1); %q=1. no drag is specified in the analytical solution 9 9 md.friction.p=ones(md.mesh.numberofelements,1); 10 10 md.friction.q=ones(md.mesh.numberofelements,1); … … 12 12 disp(' creating temperatures'); 13 13 tmin=238.15; %K 14 st=1.67*10^-2/1000 ; %k/m;14 st=1.67*10^-2/1000.; %k/m 15 15 radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2); 16 16 md.initialization.temperature=(tmin+st*radius); 17 17 md.basalforcings.geothermalflux=4.2*10^-2*ones(md.mesh.numberofvertices,1); 18 18 19 disp(' creating flow law param ter');20 md.materials.rheology_B=6.81*10^ (7)*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution21 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);19 disp(' creating flow law parameter'); 20 md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 21 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 22 22 23 23 disp(' creating surface mass balance'); 24 24 smb_max=0.5; %m/yr 25 sb=10^-2/1000 ; %m/yr/m26 rel=450 *1000; %m25 sb=10^-2/1000.; %m/yr/m 26 rel=450.*1000.; %m 27 27 md.surfaceforcings.mass_balance=min(smb_max,sb*(rel-radius)); 28 28 29 29 disp(' creating velocities'); 30 30 constant=0.3; 31 md.inversion.vx_obs=constant/2 *md.mesh.x.*(md.geometry.thickness).^-1;32 md.inversion.vy_obs=constant/2 *md.mesh.y.*(md.geometry.thickness).^-1;31 md.inversion.vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1; 32 md.inversion.vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1; 33 33 md.inversion.vel_obs=(sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2)); 34 34 md.initialization.vx=zeros(md.mesh.numberofvertices,1); … … 38 38 39 39 %Deal with boundary conditions: 40 disp(' boundary conditions for diagnostic model: 40 disp(' boundary conditions for diagnostic model:'); 41 41 md=SetMarineIceSheetBC(md,'../Exp/RoundFrontEISMINT.exp'); 42 42 43 radius=sqrt((md.mesh.x). *md.mesh.x+(md.mesh.y).*md.mesh.y);43 radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2); 44 44 pos=find(radius==min(radius)); 45 md.mesh.x(pos)=0 ; md.mesh.y(pos)=0; %the closest node to the center is changed to be exactly at the center45 md.mesh.x(pos)=0.; md.mesh.y(pos)=0.; %the closest node to the center is changed to be exactly at the center 46 46 47 md.diagnostic.spcvx(pos)=0 ;48 md.diagnostic.spcvy(pos)=0 ;49 md.diagnostic.spcvz(pos)=0 ;47 md.diagnostic.spcvx(pos)=0.; 48 md.diagnostic.spcvy(pos)=0.; 49 md.diagnostic.spcvz(pos)=0.; 50 50 51 51 %parallel options 52 md.timestepping.final_time=50000 ;52 md.timestepping.final_time=50000.; 53 53 54 54 %Constants 55 md.materials.rho_ice=910 ;55 md.materials.rho_ice=910.; 56 56 md.materials.thermalconductivity=2.1; 57 57 md.materials.latentheat=3.35*10^5; 58 58 md.materials.beta=8.66*10^-4/(md.materials.rho_ice*md.constants.g); %conversion from K/m to K/Pa 59 md.constants.yts=31556926 ;59 md.constants.yts=31556926.; -
issm/trunk/test/Par/RoundSheetStaticEISMINT.par
r9734 r14310 2 2 hmin=0.01; 3 3 hmax=2756.7; 4 radius= (sqrt((md.mesh.x).^2+(md.mesh.y).^2));4 radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2); 5 5 radiusmax=max(radius); 6 md.geometry.thickness=hmin*ones(size(md.mesh.x,1),1)+hmax*(4*((1/2)^(4/3)*ones(size(md.mesh.x,1),1)-((radius)./(2*radiusmax)).^(4/3))).^(3/8); 7 md.geometry.bed=0*md.geometry.thickness; 6 radius(find(radius>(1.-10^-9)*radiusmax))=radiusmax; %eliminate roundoff issues in next statement 7 md.geometry.thickness=hmin*ones(size(md.mesh.x,1),1)+hmax*(4.*((1./2.)^(4./3.)*ones(size(md.mesh.x,1),1)-((radius)./(2.*radiusmax)).^(4./3.))).^(3./8.); 8 md.geometry.bed=0.*md.geometry.thickness; 8 9 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 9 10 10 11 disp(' creating drag'); 11 md.friction.coefficient=20 *ones(md.mesh.numberofvertices,1); %q=1. %no drag is specified in the analytical solution12 md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1); %q=1. no drag is specified in the analytical solution 12 13 %Take care of iceshelves: no basal drag 13 14 pos=find(md.mask.elementonfloatingice); 14 md.friction.coefficient(md.mesh.elements(pos,:))=0 ;15 md.friction.coefficient(md.mesh.elements(pos,:))=0.; 15 16 md.friction.p=ones(md.mesh.numberofelements,1); 16 17 md.friction.q=ones(md.mesh.numberofelements,1); … … 18 19 disp(' creating temperatures'); 19 20 tmin=238.15; %K 20 st=1.67*10^-2/1000 ; %k/m;21 md.initialization.temperature= (tmin+st*radius);21 st=1.67*10^-2/1000.; %k/m 22 md.initialization.temperature=tmin+st*radius; 22 23 md.basalforcings.geothermalflux=4.2*10^-2*ones(md.mesh.numberofvertices,1); 23 24 24 disp(' creating flow law param ter');25 md.materials.rheology_B=6.81*10^ (7)*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution26 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);25 disp(' creating flow law parameter'); 26 md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution 27 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 27 28 28 29 disp(' creating surface mass balance'); 29 30 smb_max=0.5; %m/yr 30 sb=10^-2/1000 ; %m/yr/m31 rel=450 *1000; %m31 sb=10^-2/1000.; %m/yr/m 32 rel=450.*1000.; %m 32 33 md.surfaceforcings.mass_balance=min(smb_max,sb*(rel-radius)); 33 34 34 35 disp(' creating velocities'); 35 36 constant=0.3; 36 md.inversion.vx_obs=constant/2 *md.mesh.x.*(md.geometry.thickness).^-1;37 md.inversion.vy_obs=constant/2 *md.mesh.y.*(md.geometry.thickness).^-1;38 md.inversion.vel_obs= (sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2));37 md.inversion.vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1; 38 md.inversion.vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1; 39 md.inversion.vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2); 39 40 md.initialization.vx=zeros(md.mesh.numberofvertices,1); 40 41 md.initialization.vy=zeros(md.mesh.numberofvertices,1); … … 43 44 44 45 %Deal with boundary conditions: 45 disp(' boundary conditions for diagnostic model: 46 disp(' boundary conditions for diagnostic model:'); 46 47 md=SetMarineIceSheetBC(md,'../Exp/RoundFrontEISMINT.exp'); 47 48 48 radius=sqrt((md.mesh.x). *md.mesh.x+(md.mesh.y).*md.mesh.y);49 radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2); 49 50 pos=find(radius==min(radius)); 50 md.mesh.x(pos)=0 ; md.mesh.y(pos)=0; %the closest node to the center is changed to be exactly at the center51 md.mesh.x(pos)=0.; md.mesh.y(pos)=0.; %the closest node to the center is changed to be exactly at the center 51 52 52 md.diagnostic.spcvx(pos)=0 ;53 md.diagnostic.spcvy(pos)=0 ;54 md.diagnostic.spcvz(pos)=0 ;53 md.diagnostic.spcvx(pos)=0.; 54 md.diagnostic.spcvy(pos)=0.; 55 md.diagnostic.spcvz(pos)=0.; -
issm/trunk/test/Par/SquareEISMINT.par
r9864 r14310 4 4 ymin=min(md.mesh.y); 5 5 ymax=max(md.mesh.y); 6 md.geometry.thickness=500 *ones(md.mesh.numberofvertices,1);6 md.geometry.thickness=500.*ones(md.mesh.numberofvertices,1); 7 7 md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness; 8 8 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 9 9 10 10 disp(' creating drag'); 11 md.friction.coefficient=200 *ones(md.mesh.numberofvertices,1); %q=1.11 md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1. 12 12 %Take care of iceshelves: no basal drag 13 13 pos=find(md.mask.elementonfloatingice); 14 md.friction.coefficient(md.mesh.elements(pos,:))=0 ;14 md.friction.coefficient(md.mesh.elements(pos,:))=0.; 15 15 md.friction.p=ones(md.mesh.numberofelements,1); 16 16 md.friction.q=ones(md.mesh.numberofelements,1); 17 17 18 18 disp(' creating initial values'); 19 md.initialization.temperature=(273 -20)*ones(md.mesh.numberofvertices,1);19 md.initialization.temperature=(273.-20.)*ones(md.mesh.numberofvertices,1); 20 20 md.initialization.vx=zeros(md.mesh.numberofvertices,1); 21 21 md.initialization.vy=zeros(md.mesh.numberofvertices,1); … … 24 24 md.initialization.pressure=zeros(md.mesh.numberofvertices,1); 25 25 26 disp(' creating flow law param ter');26 disp(' creating flow law parameter'); 27 27 md.materials.rheology_B=1.7687*10^8*ones(md.mesh.numberofvertices,1); 28 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);28 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 29 29 30 30 disp(' creating surface mass balance'); 31 31 md.surfaceforcings.mass_balance=0.2*ones(md.mesh.numberofvertices,1); %0m/a 32 md.basalforcings.melting_rate=0 *ones(md.mesh.numberofvertices,1); %0m/a32 md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1); %0m/a 33 33 34 disp(' boundary conditions 34 disp(' boundary conditions'); 35 35 md=SetMarineIceSheetBC(md,'../Exp/SquareFrontEISMINT.exp'); 36 36 37 37 %Evolution of the ice shelf 38 pos=find(md.mesh.y==200000 ); %nodes on the upper boundary condition38 pos=find(md.mesh.y==200000.); %nodes on the upper boundary condition 39 39 md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1); 40 md.balancethickness.spcthickness(pos)=500 ;40 md.balancethickness.spcthickness(pos)=500.; 41 41 md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices,1); 42 md.prognostic.spcthickness(pos)=500 ;42 md.prognostic.spcthickness(pos)=500.; 43 43 md.prognostic.stabilization=0; %Better result with no artificial diffusivity 44 md.thermal.stabilization=0; 45 md.timestepping.final_time=500 ;44 md.thermal.stabilization=0; 45 md.timestepping.final_time=500.; 46 46 md.timestepping.time_step=1; -
issm/trunk/test/Par/SquareSheetConstrained.py
r13975 r14310 51 51 md.thermal.stabilization=1. 52 52 md.verbose=verbose(0) 53 md.settings.waitonlock=30 .53 md.settings.waitonlock=30 54 54 md.diagnostic.restol=0.05 55 55 md.steadystate.reltol=0.05 -
issm/trunk/test/Par/SquareSheetShelf.py
r13975 r14310 57 57 md.thermal.stabilization=1 58 58 md.verbose=verbose(0) 59 md.settings.waitonlock=30 .59 md.settings.waitonlock=30 60 60 md.diagnostic.restol=0.05 61 61 md.steadystate.reltol=0.05 -
issm/trunk/test/Par/SquareShelf.py
r13975 r14310 70 70 md.prognostic.stabilization = 1. 71 71 md.thermal.stabilization = 1. 72 md.settings.waitonlock = 30 .72 md.settings.waitonlock = 30 73 73 md.verbose=verbose() 74 74 md.diagnostic.restol = 0.10 -
issm/trunk/test/Par/SquareShelfConstrained.py
r13975 r14310 55 55 md.thermal.stabilization=1. 56 56 md.verbose = verbose(0) 57 md.settings.waitonlock=30 .57 md.settings.waitonlock=30 58 58 md.diagnostic.restol=0.05 59 59 md.diagnostic.reltol=0.05 -
issm/trunk/test/Par/SquareThermal.par
r9733 r14310 4 4 5 5 disp(' creating thickness'); 6 h=1000 ;6 h=1000.; 7 7 md.geometry.thickness=h*ones(md.mesh.numberofvertices,1); 8 md.geometry.bed=-1000 *ones(md.mesh.numberofvertices,1);8 md.geometry.bed=-1000.*ones(md.mesh.numberofvertices,1); 9 9 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 10 10 … … 15 15 16 16 disp(' creating drag'); 17 md.friction.coefficient=200 *ones(md.mesh.numberofvertices,1); %q=1.17 md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1. 18 18 %Take care of iceshelves: no basal drag 19 19 pos=find(md.mask.elementonfloatingice); 20 md.friction.coefficient(md.mesh.elements(pos,:))=0 ;20 md.friction.coefficient(md.mesh.elements(pos,:))=0.; 21 21 md.friction.p=ones(md.mesh.numberofelements,1); 22 22 md.friction.q=ones(md.mesh.numberofelements,1); 23 23 24 24 disp(' creating temperatures'); 25 md.initialization.temperature=(273 -20)*ones(md.mesh.numberofvertices,1);25 md.initialization.temperature=(273.-20.)*ones(md.mesh.numberofvertices,1); 26 26 27 disp(' creating flow law param ter');27 disp(' creating flow law parameter'); 28 28 md.materials.rheology_B=paterson(md.initialization.temperature); 29 md.materials.rheology_n=3 *ones(md.mesh.numberofelements,1);29 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1); 30 30 31 31 disp(' creating surface mass balance'); 32 32 md.surfaceforcings.mass_balance=ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a 33 md.basalforcings.melting_rate=0 *ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a33 md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a 34 34 35 35 %Deal with boundary conditions: … … 41 41 md.thermal.spctemperature(:)=md.initialization.temperature; 42 42 md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1); 43 pos=find(md.mask.elementongroundedice);md.basalforcings.geothermalflux(md.mesh.elements(pos,:))=1 *10^-3; %1 mW/m^243 pos=find(md.mask.elementongroundedice);md.basalforcings.geothermalflux(md.mesh.elements(pos,:))=1.*10^-3; %1 mW/m^2
Note:
See TracChangeset
for help on using the changeset viewer.