Changeset 14310


Ignore:
Timestamp:
02/04/13 08:01:04 (12 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 14308

Location:
issm/trunk
Files:
42 deleted
252 edited
279 copied

Legend:

Unmodified
Added
Removed
  • issm/trunk

  • issm/trunk/configs/config-arm-linux.sh

    r13975 r14310  
    66    --host="arm-linux-androideabi" \
    77    --enable-shared \
    8     --with-android=jni\
     8    --with-android=jni \
     9        --with-android-ndk=$ISSM_DIR/externalpackages/android/android-ndk/install \
    910    --without-fortran \
    1011        --without-wrappers \
  • issm/trunk/configure.ac

    r14067 r14310  
    22
    33#AUTOCONF
    4 AC_INIT([ISSM],[4.2.4],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
     4AC_INIT([ISSM],[4.2.5],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
    55AC_CONFIG_AUX_DIR([./aux-config])         #Put config files in aux-config
    66AC_CONFIG_MACRO_DIR([m4])                 #m4 macros are located in m4
  • issm/trunk/externalpackages/adolc/install-dev.sh

    r13975 r14310  
    66
    77git clone -b 2.3.x_ISSM  git://git.mcs.anl.gov/adol-c.git adolc_issm
     8#git reset --hard b254b2a001a1b7a024a9184cd087ae06eb975cad
    89
    910#Compile ADOL-C
  • issm/trunk/externalpackages/adolc/install-update-dev.sh

    r13975 r14310  
    1515cd adolc_issm
    1616git pull
     17#git reset --hard b254b2a001a1b7a024a9184cd087ae06eb975cad
    1718
    1819autoreconf -f -i
  • issm/trunk/externalpackages/export_fig/export_fig.m

    r12707 r14310  
    123123%   -bookmark - option to indicate that a bookmark with the name of the
    124124%               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 handles
    126 %            of several axes, but these must be in the same figure) to be
     125%   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
    127127%            saved. Default: gcf.
    128128%
     
    166166% 09/05/12: Incorporate patch of Arcelia Arrieta (many thanks), to keep
    167167%           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
     171function [im, alpha] = export_fig(varargin)
    170172% Make sure the figure is rendered correctly _now_ so that properties like
    171173% axes limits are up-to-date.
    172174drawnow;
    173175% Parse the input arguments
    174 [fig options] = parse_args(nargout, varargin{:});
     176[fig, options] = parse_args(nargout, varargin{:});
    175177% Isolate the subplot, if it is one
    176 cls = strcmp(get(fig(1), 'Type'), 'axes');
     178cls = all(ismember(get(fig, 'Type'), {'axes', 'uipanel'}));
    177179if cls
    178180    % Given handles of one or more axes, so isolate them from the rest
    179181    fig = isolate_axes(fig);
    180182else
     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
    181188    old_mode = get(fig, 'InvertHardcopy');
    182189end
     
    198205    end
    199206end
    200 % MATLAB "feature": axes limits can change when printing
     207% MATLAB "feature": axes limits and tick marks can change when printing
    201208Hlims = findall(fig, 'Type', 'axes');
    202209if ~cls
     
    282289        % Crop the background
    283290        if options.crop
    284             [alpha v] = crop_background(alpha, 0);
     291            [alpha, v] = crop_background(alpha, 0);
    285292            A = A(v(1):v(2),v(3):v(4),:);
    286293        end
     
    289296            res = options.magnify * get(0, 'ScreenPixelsPerInch') / 25.4e-3;
    290297            % 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);
    292299            % Clear the png bit
    293300            options.png = false;
     
    325332            tcol = 255;
    326333        else
    327             [A tcol] = print2array(fig, magnify, renderer);
     334            [A, tcol] = print2array(fig, magnify, renderer);
    328335        end
    329336        % Crop the background
     
    460467return
    461468
    462 function [fig options] = parse_args(nout, varargin)
     469function [fig, options] = parse_args(nout, varargin)
    463470% Parse the input arguments
    464471% Set the defaults
     
    542549            end
    543550        else
    544             [p options.name ext] = fileparts(varargin{a});
     551            [p, options.name, ext] = fileparts(varargin{a});
    545552            if ~isempty(p)
    546553                options.name = [p filesep options.name];
     
    577584
    578585% Check whether transparent background is wanted (old way)
    579 if isequal(get(fig, 'Color'), 'none')
     586if isequal(get(ancestor(fig, 'figure'), 'Color'), 'none')
    580587    options.transparent = true;
    581588end
     
    667674return
    668675
    669 function [A v] = crop_background(A, bcol)
     676function [A, v] = crop_background(A, bcol)
    670677% Map the foreground pixels
    671 [h w c] = size(A);
     678[h, w, c] = size(A);
    672679if isscalar(bcol) && c > 1
    673680    bcol = bcol(ones(1, c));
  • issm/trunk/externalpackages/export_fig/ghostscript.m

    r10635 r14310  
    1 function varargout = ghostscript(cmd)
    21%GHOSTSCRIPT  Calls a local GhostScript executable with the input command
    32%
     
    2524% Thanks to Jonas Dorn for the fix for the title of the uigetdir window on
    2625% Mac OS.
    27 
    2826% Thanks to Nathan Childress for the fix to the default location on 64-bit
    2927% Windows systems.
    30 
    3128% 27/4/11 - Find 64-bit Ghostscript on Windows. Thanks to Paul Durack and
    3229% Shaun Kline for pointing out the issue
    33 
    3430% 4/5/11 - Thanks to David Chorlian for pointing out an alternative
    3531% location for gs on linux.
     32% 12/12/12 - Add extra executable name on Windows. Thanks to Ratish
     33% Punnoose for highlighting the issue.
    3634
     35function varargout = ghostscript(cmd)
    3736% Call ghostscript
    3837[varargout{1:nargout}] = system(sprintf('"%s" %s', gs_path, cmd));
    3938return
    4039
    41 function path = gs_path
     40function path_ = gs_path
    4241% Return a valid path
    4342% Start with the currently set path
    44 path = user_string('ghostscript');
     43path_ = user_string('ghostscript');
    4544% Check the path works
    46 if check_gs_path(path)
     45if check_gs_path(path_)
    4746    return
    4847end
    4948% Check whether the binary is on the path
    5049if ispc
    51     bin = {'gswin32c.exe', 'gswin64c.exe'};
     50    bin = {'gswin32c.exe', 'gswin64c.exe', 'gs'};
    5251else
    5352    bin = {'gs'};
    5453end
    5554for 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_)
    5857        return
    5958    end
     
    7675                path2 = [default_location dir_list(a).name executable{b}];
    7776                if exist(path2, 'file') == 2
    78                     path = path2;
     77                    path_ = path2;
    7978                    ver_num = ver_num2;
    8079                end
     
    8281        end
    8382    end
    84     if check_store_gs_path(path)
     83    if check_store_gs_path(path_)
    8584        return
    8685    end
     
    8887    bin = {'/usr/bin/gs', '/usr/local/bin/gs'};
    8988    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_)
    9291            return
    9392        end
     
    110109    for a = 1:numel(bin_dir)
    111110        for b = 1:numel(bin)
    112             path = [base bin_dir{a} bin{b}];
    113             if exist(path, 'file') == 2
    114                 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_)
    115114                    return
    116115                end
     
    121120error('Ghostscript not found. Have you installed it from www.ghostscript.com?');
    122121
    123 function good = check_store_gs_path(path)
     122function good = check_store_gs_path(path_)
    124123% Check the path is valid
    125 good = check_gs_path(path);
     124good = check_gs_path(path_);
    126125if ~good
    127126    return
    128127end
    129128% Update the current default path to the path found
    130 if ~user_string('ghostscript', path)
     129if ~user_string('ghostscript', path_)
    131130    warning('Path to ghostscript installation could not be saved. Enter it manually in ghostscript.txt.');
    132131    return
     
    134133return
    135134
    136 function good = check_gs_path(path)
     135function good = check_gs_path(path_)
    137136% Check the path is valid
    138 [good message] = system(sprintf('"%s" -h', path));
     137[good, message] = system(sprintf('"%s" -h', path_));
    139138good = good == 0;
    140139return
  • issm/trunk/externalpackages/export_fig/isolate_axes.m

    r11995 r14310  
    55%   fh = isolate_axes(ah, vis)
    66%
    7 % This function will create a new figure containing the axes specified, and
    8 % also their associated legends and colorbars. The axes specified must all
    9 % be in the same figure, but they will generally only be a subset of the
    10 % axes 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.
    1111%
    1212% 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.
    1415%    vis - A boolean indicating whether the new figure should be visible.
    1516%          Default: false.
     
    2324% 16/3/2012 Moved copyfig to its own function. Thanks to Bob Fratantonio
    2425% 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.
    2528
    2629function fh = isolate_axes(ah, vis)
     
    2932    error('ah must be an array of handles');
    3033end
    31 % Check that the handles are all for axes, and are all in the same figure
     34% Check that the handles are all for axes or uipanels, and are all in the same figure
    3235fh = ancestor(ah(1), 'figure');
    3336nAx = numel(ah);
    3437for 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.');
    3740    end
    3841    if ~isequal(ancestor(ah(a), 'figure'), fh)
     
    4043    end
    4144end
    42 % Tag the axes so we can find them in the copy
     45% Tag the objects so we can find them in the copy
    4346old_tag = get(ah, 'Tag');
    4447if nAx == 1
     
    5154    set(fh, 'Visible', 'off');
    5255end
    53 % Reset the axes tags
     56% Reset the object tags
    5457for a = 1:nAx
    5558    set(ah(a), 'Tag', old_tag{a});
     
    5962if numel(ah) ~= nAx
    6063    close(fh);
    61     error('Incorrect number of axes found.');
     64    error('Incorrect number of objects found.');
    6265end
    6366% Set the axes tags to what they should be
     
    8790% Get all the objects in the figure
    8891axs = findall(fh);
    89 % Delete everything except for the input axes and associated items
     92% Delete everything except for the input objects and associated items
    9093delete(axs(~ismember(axs, [ah; allchildren(ah); allancestors(ah)])));
    9194return
  • issm/trunk/externalpackages/export_fig/pdftops.m

    r10635 r14310  
    3333return
    3434
    35 function path = xpdf_path
     35function path_ = xpdf_path
    3636% Return a valid path
    3737% Start with the currently set path
    38 path = user_string('pdftops');
     38path_ = user_string('pdftops');
    3939% Check the path works
    40 if check_xpdf_path(path)
     40if check_xpdf_path(path_)
    4141    return
    4242end
     
    4848end
    4949if check_store_xpdf_path(bin)
    50     path = bin;
     50    path_ = bin;
    5151    return
    5252end
    5353% Search the obvious places
    5454if ispc
    55     path = 'C:\Program Files\xpdf\pdftops.exe';
     55    path_ = 'C:\Program Files\xpdf\pdftops.exe';
    5656else
    57     path = '/usr/local/bin/pdftops';
     57    path_ = '/usr/local/bin/pdftops';
    5858end
    59 if check_store_xpdf_path(path)
     59if check_store_xpdf_path(path_)
    6060    return
    6161end
     
    7575    bin_dir = {'', ['bin' filesep], ['lib' filesep]};
    7676    for a = 1:numel(bin_dir)
    77         path = [base bin_dir{a} bin];
    78         if exist(path, 'file') == 2
     77        path_ = [base bin_dir{a} bin];
     78        if exist(path_, 'file') == 2
    7979            break;
    8080        end
    8181    end
    82     if check_store_xpdf_path(path)
     82    if check_store_xpdf_path(path_)
    8383        return
    8484    end
     
    8686error('pdftops executable not found.');
    8787
    88 function good = check_store_xpdf_path(path)
     88function good = check_store_xpdf_path(path_)
    8989% Check the path is valid
    90 good = check_xpdf_path(path);
     90good = check_xpdf_path(path_);
    9191if ~good
    9292    return
    9393end
    9494% Update the current default path to the path found
    95 if ~user_string('pdftops', path)
     95if ~user_string('pdftops', path_)
    9696    warning('Path to pdftops executable could not be saved. Enter it manually in pdftops.txt.');
    9797    return
     
    9999return
    100100
    101 function good = check_xpdf_path(path)
     101function good = check_xpdf_path(path_)
    102102% Check the path is valid
    103 [good message] = system(sprintf('"%s" -h', path));
     103[good message] = system(sprintf('"%s" -h', path_));
    104104% system returns good = 1 even when the command runs
    105105% Look for something distinct in the help text
  • issm/trunk/externalpackages/export_fig/print2array.m

    r12707 r14310  
    2525%   bcol - 1x3 uint8 vector of the background color
    2626
    27 % Copyright (C) Oliver Woodford 2008-2011
     27% Copyright (C) Oliver Woodford 2008-2012
    2828
    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.
    3145
    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)
     46function [A, bcol] = print2array(fig, res, renderer)
    4847% Generate default input arguments, if needed
    4948if nargin < 2
     
    8584        % Execute the ghostscript command
    8685        ghostscript(cmd_str);
    87     catch
     86    catch me
    8887        % Delete the intermediate file
    8988        delete(tmp_eps);
    90         rethrow(lasterror);
     89        rethrow(me);
    9190    end
    9291    % Delete the intermediate file
     
    134133    err = false;
    135134    % 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');
    138138    try
    139139        % Print to tiff file
     
    147147    end
    148148    % Reset paper size
    149     set(fig, 'PaperPositionMode', old_mode);
     149    set(fig, 'PaperPositionMode', old_pos_mode, 'PaperOrientation', old_orientation);
    150150    % Throw any error that occurred
    151151    if err
  • issm/trunk/externalpackages/export_fig/print2eps.m

    r12707 r14310  
    2828% fex id: 5743, but the implementation is mine :)
    2929
    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.
    4850
    4951function print2eps(name, fig, varargin)
     
    5961end
    6062% Find all the used fonts in the figure
    61 font_handles = findall(fig, '-property', 'FontName');
     63font_handles = findobj(fig, '-property', 'FontName');
    6264fonts = get(font_handles, 'FontName');
    6365if ~iscell(fonts)
     
    8688require_swap = find(~ismember(fontslu, matlab_fontsl));
    8789unused_fonts = find(~ismember(matlab_fontsl, fontslu));
    88 font_swap = cell(3, 0);
    89 for a = 1:min(numel(require_swap), numel(unused_fonts))
    90     ind = find(strcmp(fontslu{require_swap(a)}, fontsl));
    91     n = numel(ind);
    92     font_swap(1,end+1:end+n) = reshape(mat2cell(font_handles(ind), ones(n, 1)), 1, []);
    93     font_swap(2,end-n+1:end) = matlab_fonts(unused_fonts(a));
    94     font_swap(3,end-n+1:end) = reshape(fonts(ind), 1, []);
     90font_swap = cell(3, min(numel(require_swap), numel(unused_fonts)));
     91fonts_new = fonts;
     92for 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}};
    9597end
    9698% Swap the fonts
    97 for a = 1:size(font_swap, 2)
    98     set(font_swap{1,a}, 'FontName', font_swap{2,a});
     99if ~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, []);
    99125end
    100126% Set paper size
    101 old_mode = get(fig, 'PaperPositionMode');
    102 set(fig, 'PaperPositionMode', 'auto');
     127old_pos_mode = get(fig, 'PaperPositionMode');
     128old_orientation = get(fig, 'PaperOrientation');
     129set(fig, 'PaperPositionMode', 'auto', 'PaperOrientation', 'portrait');
    103130% MATLAB bug fix - black and white text can come out inverted sometimes
    104131% Find the white and black text
     
    120147set(white_text_handles, 'Color', [1 1 1]);
    121148% Reset paper size
    122 set(fig, 'PaperPositionMode', old_mode);
     149set(fig, 'PaperPositionMode', old_pos_mode, 'PaperOrientation', old_orientation);
    123150% Correct the fonts
    124151if ~isempty(font_swap)
    125152    % 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));
    128155    end
    129156    % Replace the font names in the eps file
  • issm/trunk/externalpackages/gsl/install-android.sh

    r14067 r14310  
    2828    patch Makefile.am < Makefile.am.patch
    2929
    30     autoreconf -iv --force -I $ISSM_DIR/externalpackages/autotools/install/share/aclocal
     30    autoreconf -i
    3131
    3232    ./configure \
    3333        --build="i386-apple-darwin10.8.0" \
    3434        --host=$host_triplet \
    35             --prefix="$ISSM_DIR/externalpackages/gsl/install/" \
    36         --disable-static
     35            --prefix="$ISSM_DIR/externalpackages/gsl/install"
    3736fi
    3837
  • issm/trunk/m4/issm_options.m4

    r13975 r14310  
    163163        fi
    164164        AC_MSG_RESULT($HAVE_TRIANGLE)
    165 
    166         AC_MSG_CHECKING(for triangle and parallel status)
    167         if test $HAVE_TRIANGLE = no; then
    168                 if test "$SERIAL_VALUE" = "yes" ; then
    169                         AC_MSG_ERROR([--with-triangle-dir  missing. Triangle is needed to run ISSM serially!])
    170                 fi
    171         fi
    172         AC_MSG_RESULT(ok)
    173165        dnl }}}
    174166        dnl dakota{{{
     
    182174                dnl defaults
    183175                HAVE_DAKOTA=yes
     176                AC_MSG_RESULT($HAVE_DAKOTA)
    184177                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])
    185182                case "${host_os}" in
    186183                        *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
    188192                        ;;
    189193                        *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
    191202                        ;;
    192203                        *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
    195214                        ;;
    196215                esac
     
    201220        else
    202221                HAVE_DAKOTA=no
     222                AC_MSG_RESULT($HAVE_DAKOTA)
    203223        fi
    204224        AM_CONDITIONAL([DAKOTA], [test x$HAVE_DAKOTA = xyes])
    205         AC_MSG_RESULT($HAVE_DAKOTA)
    206225        dnl }}}
    207226        dnl boost{{{
     
    10451064                dnl check that --with-fortran-lib may have been provided
    10461065                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
    10501081                fi
    10511082                AC_MSG_RESULT(done)
     
    10591090
    10601091        dnl check that --with-graphics-lib may have been provided
     1092       
    10611093        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
    10671108        fi
    10681109        AC_MSG_RESULT(done)
     
    13261367                dnl defaults
    13271368                HAVE_ANDROID=jni
    1328 
    13291369                AC_DEFINE([_HAVE_ANDROID_],[1],[with android capability])
     1370                AC_DEFINE([_HAVE_ANDROID_JNI_],[1],[with android jni])
    13301371        elif test "x$ANDROID" = "xexe"; then
    13311372                dnl defaults
     
    13421383        AM_CONDITIONAL([ANDROIDEXE], [test x$HAVE_ANDROID = xexe])
    13431384        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)
    13441403        dnl }}}
    13451404        dnl with-3d{{{
  • issm/trunk/scripts/DownloadExternalPackage.py

    r13395 r14310  
    66#
    77
     8# imports {{{
    89import os,sys,re
    910import urllib
    1011from HTMLParser import HTMLParser
    1112from urllib import FancyURLopener
    12 
    13 # Start class myHTMLParser
    14 class MyHTMLParser(HTMLParser):
     13# }}}
     14class MyHTMLParser(HTMLParser): #{{{
    1515
    1616    def __init__(self, pattern):
     
    2323            if "href" == i[0] and str(self.matcher.match(i[1])) != "None":
    2424                self.targets.append(i[1])
    25 # End class myHTMLParser
     25#}}}
     26def 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. }}}
    26137
    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()
     138if __name__ == "__main__":
     139    main()
  • issm/trunk/src

  • issm/trunk/src/android/ISSM

    • Property svn:ignore
      •  

        old new  
        1 gen
         1gen*
        22.settings
        33libs
         
        55Makefile
        66Makefile.in
         7bin
  • issm/trunk/src/android/ISSM/AndroidManifest.xml

    r14067 r14310  
    22    package="com.example.issm"
    33    android:versionCode="1"
    4     android:versionName="1.0" >
    5 
     4    android:versionName="1.0"
     5    android:installLocation="preferExternal" >
    66    <uses-sdk
    77        android:minSdkVersion="10"
     
    1212        android:label="@string/app_name"
    1313        android:theme="@style/AppTheme" >
    14         <activity android:name=".MapSelection"
     14        <activity android:name="com.example.issm.SplashScreen"
    1515                  android:label="@string/title_activity_issm" >
    1616            <intent-filter>
     
    2020            </activity>
    2121            <activity
     22            android:name=".MenuPage"
     23            android:label="@string/title_activity_issm" >
     24        </activity>
     25            <activity
    2226            android:name=".ISSM"
    2327            android:label="@string/title_activity_issm" >
  • issm/trunk/src/android/ISSM/Makefile.am

    r13931 r14310  
    55deps =           
    66else             
    7 deps = ../../c/libISSMCore.a             
     7deps = $(ISSM_DIR)/src/c/libISSMCore.a ./jni/Main.cpp
    88endif
    99
     
    1414        $(ANDROID_NDK_DIR)/ndk-build -C ./jni clean
    1515        $(ANDROID_NDK_DIR)/ndk-build -C ./jni
     16
     17clean:
     18        rm -rf libs obj
  • issm/trunk/src/android/ISSM/bin

    • Property svn:ignore
      •  

        old new  
         1com.*
        12*ISSM.apk
        23resources.ap_
  • issm/trunk/src/android/ISSM/bin/AndroidManifest.xml

    r14067 r14310  
    22    package="com.example.issm"
    33    android:versionCode="1"
    4     android:versionName="1.0" >
    5 
     4    android:versionName="1.0"
     5    android:installLocation="preferExternal" >
    66    <uses-sdk
    77        android:minSdkVersion="10"
     
    1212        android:label="@string/app_name"
    1313        android:theme="@style/AppTheme" >
    14         <activity android:name=".MapSelection"
     14        <activity android:name="com.example.issm.SplashScreen"
    1515                  android:label="@string/title_activity_issm" >
    1616            <intent-filter>
     
    2020            </activity>
    2121            <activity
     22            android:name=".MenuPage"
     23            android:label="@string/title_activity_issm" >
     24        </activity>
     25            <activity
    2226            android:name=".ISSM"
    2327            android:label="@string/title_activity_issm" >
  • issm/trunk/src/android/ISSM/jni/Android.mk

    r14067 r14310  
    22my_LOCAL_PATH:=$(LOCAL_PATH)
    33
    4 #include $(LOCAL_PATH)/issmlib\Android.mk
    54include $(call all-subdir-makefiles)
    6 
    75
    86LOCAL_PATH := $(my_LOCAL_PATH)
     
    1210LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
    1311LOCAL_CFLAGS := -Wno-psabi -DHAVE_CONFIG_H
    14 LOCAL_LDLIBS := -llog -ldl
     12LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -ldl -lm
    1513LOCAL_MODULE := IssmJni
    1614LOCAL_SRC_FILES := Main.cpp
    17 LOCAL_STATIC_LIBRARIES := libISSMCore
    18 
     15LOCAL_STATIC_LIBRARIES := libISSMCore libgsl libgslcblas
    1916include $(BUILD_SHARED_LIBRARY)
  • issm/trunk/src/android/ISSM/jni/Application.mk

    r14067 r14310  
    1 APP_STL:=stlport_static
     1APP_STL:= gnustl_static
    22APP_CPPFLAGS := -frtti
    33APP_CPPFLAGS += -fexceptions
     4APP_ABI := armeabi
  • issm/trunk/src/android/ISSM/jni/Main.cpp

    r14067 r14310  
    11#include <jni.h>
    2 #include "../../../c/android/fac.h"
     2#include <android/log.h>
    33#include "../../../c/issm.h"
    44#include <cstddef>
    55#include <stdio.h>
    6 ///////////////////////////////////////////////////////////////////////////////////////////
     6#include <android/log.h>
     7
    78namespace com_example_issm
    89{
    9         fac* f;
     10        /*Global variables{{{*/
    1011        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) /*{{{*/
    1315        {
    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;
    1525
    16                 f = new fac();
     26                /*log:*/
     27                __android_log_print(ANDROID_LOG_INFO, "Native","Initializing FemModel");
    1728
    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);
    2033
    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);
    2444
    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
    2663        }
    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: */
    3178                jdouble *dBuf = (jdouble *)env->GetDirectBufferAddress(buf);
    3279
    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);
    3583
    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[] = /*{{{*/
    39157        {
    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}
    44163
    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 //------------------------------------------------------------------------------------
    54164using namespace com_example_issm;
    55 
    56 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
     165extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) /*{{{*/
    57166{
    58167    JNIEnv* env;
     
    72181    }
    73182}
    74 ///////////////////////////////////////////////////////////////////////////////////////////
     183/*}}}*/
  • issm/trunk/src/android/ISSM/jni/issmlib/Android.mk

    r14067 r14310  
    22include $(CLEAR_VARS)
    33LOCAL_MODULE    := libISSMCore
    4 LOCAL_SRC_FILES := libISSMCore.a
     4LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
     5LOCAL_SRC_FILES := ../../../../../lib/libISSMCore.a
    56LOCAL_EXPORT_C_INCLUDES := $(ISSM_DIR)
    67include $(PREBUILT_STATIC_LIBRARY)
     8
  • issm/trunk/src/android/ISSM/project.properties

    r13890 r14310  
    1212
    1313# Project target.
    14 target=android-15
     14target=android-16
  • issm/trunk/src/android/ISSM/src/com/example/issm/ISSM.java

    r14067 r14310  
    11package com.example.issm;
    22
    3 import java.io.IOException;
    4 import java.io.InputStream;
    53import java.nio.ByteBuffer;
    64import java.nio.ByteOrder;
    75import java.nio.DoubleBuffer;
    8 
     6import android.opengl.GLSurfaceView;
     7import android.os.AsyncTask;
    98import android.os.Bundle;
    109import android.app.Activity;
    11 import android.content.res.AssetManager;
    12 import android.text.TextUtils;
     10import android.app.ProgressDialog;
    1311import android.view.Menu;
     12import android.view.MenuInflater;
     13import android.view.MenuItem;
    1414import android.view.View;
    1515import android.view.View.OnClickListener;
     16import android.view.animation.AccelerateInterpolator;
     17import android.view.animation.Animation;
     18import android.view.animation.TranslateAnimation;
    1619import android.widget.Button;
    17 import android.widget.EditText;
     20import android.widget.FrameLayout;
     21import android.widget.ImageButton;
     22import android.widget.SeekBar;
     23import android.widget.SeekBar.OnSeekBarChangeListener;
    1824import android.widget.TextView;
    19 
    20 
    21 public class ISSM extends Activity implements OnClickListener
     25import android.widget.Toast;
     26import android.widget.ViewFlipper;
     27
     28
     29public class ISSM extends Activity implements OnClickListener
    2230{
    23         private EditText input;
    24         private TextView output;
    2531        private DoubleBuffer buff;
    2632        private IssmJni issmNative;
     
    2834        private String issmFolder;
    2935        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        //------------------------------------------------------------------------------------------------   
    3048    @Override
    31   //------------------------------------------------------------------------------------------------   
    32     public void onCreate(Bundle savedInstanceState) {
     49    public void onCreate(Bundle savedInstanceState)
     50    {
    3351        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();
    3559        {
    3660                if(map!= null)
    3761                {
    38                         mapName = map.getString("map");
    3962                        issmFolder = map.getString("pathToFile");
    4063                }
    4164        }
    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();
    4797       
    48         //load up the ISSM library and create double buffer in java
    49         //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);
    53103    }
    54104//------------------------------------------------------------------------------------------------   
    55105    public void createModel()
    56106    {
     107                String solution_type="DiagnosticSolution";
    57108        String file = "";
    58109        if( mapName.equals("greenland"))
    59110                {
    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//---------------------------------------------------------------------------------   
    71203    public void onClick(View view)
    72204        {
    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                }
    82283               
    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//-------------------------------------------------------------------------------------------   
    89345}
     346/////////////////////////////////////////////////////////////////////////////////////////////
  • issm/trunk/src/android/ISSM/src/com/example/issm/IssmJni.java

    r14067 r14310  
    44class IssmJni
    55{
    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);
    98        static
    109        {
  • issm/trunk/src/android/ISSM_Visual/AndroidManifest.xml

    r13958 r14310  
    11<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    2     package="com.example.issm_visual"
     2    package="gov.nasa.jpl.issm.visual"
    33    android:versionCode="1"
    44    android:versionName="1.0" >
  • issm/trunk/src/android/ISSM_Visual/bin

    • Property svn:ignore
      •  

        old new  
         1classes
        12*.apk
  • issm/trunk/src/android/ISSM_Visual/bin/AndroidManifest.xml

    r13958 r14310  
    11<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    2     package="com.example.issm_visual"
     2    package="gov.nasa.jpl.issm.visual"
    33    android:versionCode="1"
    44    android:versionName="1.0" >
  • issm/trunk/src/android/ISSM_Visual/gen

    • Property svn:ignore set to
      gov
  • issm/trunk/src/android/ISSM_Visual/res/layout/activity_issmvisual.xml

    r13958 r14310  
    1515
    1616    <TextView
    17         android:id="@+id/status"
     17        android:id="@+id/value"
    1818        android:layout_width="wrap_content"
    1919        android:layout_height="wrap_content"
    2020        android:layout_above="@+id/seekBar"
    2121        android:layout_centerHorizontal="true"
    22         android:layout_marginBottom="16dp"
    23         android:text="Status: " />
     22        android:layout_marginBottom="15dp"
     23        android:text="alpha value = 0" />
    2424
    2525    <FrameLayout
     
    3131        android:layout_above="@+id/value"
    3232        android:layout_centerHorizontal="true"
    33         android:layout_marginBottom="16dp" >
     33        android:layout_marginBottom="12dp" >
    3434    </FrameLayout>
    3535
    36     <TextView
    37         android:id="@+id/value"
     36    <Button
     37        android:id="@+id/button1"
    3838        android:layout_width="wrap_content"
    3939        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" />
    4543
    4644</RelativeLayout>
  • issm/trunk/src/c/Container/DataSet.cpp

    r13975 r14310  
    178178        /*Check index in debugging mode*/
    179179        _assert_(this!=NULL);
     180        _assert_(offset>=0);
    180181        _assert_(offset<this->Size());
    181182
  • issm/trunk/src/c/Container/Observations.cpp

    r14067 r14310  
    4545        IssmPDouble  offset,minlength,minspacing,mintrimming,maxtrimming;
    4646        Observation *observation = NULL;
     47
     48        /*Check that observations is not empty*/
     49        if(n==0) _error_("No observation found");
    4750
    4851        /*Get extrema*/
     
    122125        /*Output and Intermediaries*/
    123126        int          nobs,i,index;
    124         IssmPDouble  h2,hmin2,radius2;
     127        IssmPDouble  hmin,h2,hmin2,radius2;
    125128        int         *indices      = NULL;
    126129        Observation *observation  = NULL;
     
    128131        /*If radius is not provided or is 0, return all observations*/
    129132        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        }
    130141
    131142        /*Compute radius square*/
     
    137148                observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[i]));
    138149                h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp);
    139 
    140150                if(i==0){
    141151                        hmin2 = h2;
    142                         index = i;
     152                        index = indices[i];
    143153                }
    144154                else{
    145155                        if(h2<hmin2){
    146156                                hmin2 = h2;
    147                                 index = i;
     157                                index = indices[i];
    148158                        }
    149159                }
     
    151161
    152162        /*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
    154171                *px=UNDEF;
    155172                *py=UNDEF;
    156173                *pobs=UNDEF;
    157174        }
    158         else{
    159                 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[index]));
    160                 *px=observation->x;
    161                 *py=observation->y;
    162                 *pobs=observation->value;
    163         }
    164175        xDelete<int>(indices);
    165176
     177}/*}}}*/
     178/*FUNCTION Observations::Distances{{{*/
     179void 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        }
    166190}/*}}}*/
    167191/*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  
    2727                /*Methods*/
    2828                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);
    2930                void InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power);
    3031                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  
    199199}
    200200/*}}}*/
     201/*FUNCTION Vertices::ToXYZ{{{*/
     202IssmDouble* 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  
    2828                int   NumberOfVertices(void);
    2929                void  Ranks(int* ranks);
     30                IssmDouble* ToXYZ(void);
    3031};
    3132
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r13975 r14310  
    196196        SurfaceforcingsIssmbgradientsEnum,
    197197        SurfaceforcingsMonthlytemperaturesEnum,
    198         SurfaceforcingsHcEnum,
    199198        SurfaceforcingsHrefEnum,
    200199        SurfaceforcingsSmbrefEnum,
    201         SurfaceforcingsSmbPosMaxEnum,
    202         SurfaceforcingsSmbPosMinEnum,
    203         SurfaceforcingsAPosEnum,
    204200        SurfaceforcingsBPosEnum,
    205         SurfaceforcingsANegEnum,
    206201        SurfaceforcingsBNegEnum,
    207202        ThermalMaxiterEnum,
     
    235230        BalancethicknessAnalysisEnum,
    236231        BalancethicknessSolutionEnum,
     232        WeakBalancethicknessAnalysisEnum,
     233        WeakBalancethicknessSolutionEnum,
    237234        BedSlopeAnalysisEnum,
    238235        BedSlopeSolutionEnum,
     
    355352        AdjointyEnum,
    356353        AdjointzEnum,
     354        BalancethicknessMisfitEnum,
    357355        BedSlopeXEnum,
    358356        BedSlopeYEnum,
     
    382380        QmuSurfaceEnum,
    383381        QmuMeltingEnum,
     382        AndroidFrictionCoefficientEnum,
    384383        ResetPenaltiesEnum,
    385384        SegmentOnIceShelfEnum,
     
    425424        DragCoefficientAbsGradientEnum,
    426425        TransientInputEnum,
    427         OutputfilenameEnum,
    428426        WaterfractionEnum,
    429427        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@
     1AM_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@
    22
    33EXEEXT=$(ISSMEXT)
     
    475475                                            ./modules/ModelProcessorx/Balancethickness/CreateConstraintsBalancethickness.cpp\
    476476                                                ./modules/ModelProcessorx/Balancethickness/CreateLoadsBalancethickness.cpp\
    477                                                 ./solutions/balancethickness_core.cpp
     477                                                ./solutions/balancethickness_core.cpp \
     478                                                ./solutions/dummy_core.cpp
    478479#}}}
    479480#Slope sources  {{{
     
    499500#}}}
    500501#Android sources  {{{
    501 android_sources = ./android/fac.h\
    502                                   ./android/fac.cpp
     502android_sources =
    503503#}}}
    504504#3D sources  {{{
     
    627627                             ./modules/Kml2Expx/Kml2Expx.h\
    628628                             ./modules/Kml2Expx/Kml2Expx.cpp\
     629                             ./modules/Shp2Expx/Shp2Expx.h\
     630                             ./modules/Shp2Expx/Shp2Expx.cpp\
    629631                             ./modules/Shp2Kmlx/Shp2Kmlx.h\
    630632                             ./modules/Shp2Kmlx/Shp2Kmlx.cpp\
     
    739741                        ./shared/Exp/IsInPoly.cpp\
    740742                        ./shared/Exp/IsInPolySerial.cpp\
    741                         ./shared/Exp/DomainOutlineWrite.cpp\
     743                        ./shared/Exp/ExpWrite.cpp\
    742744                        ./shared/TriMesh/trimesh.h\
    743745                        ./shared/TriMesh/AssociateSegmentToElement.cpp\
     
    781783                        ./modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp\
    782784                        ./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\
    788785                        ./modules/ContourToMeshx/ContourToMeshx.cpp\
    789786                        ./modules/ContourToMeshx/ContourToMeshxt.cpp\
  • issm/trunk/src/c/classes/FemModel.cpp

    r14067 r14310  
    2020
    2121/*Object constructors and destructor*/
    22 /*FUNCTION FemModel::FemModel(char* filename) {{{*/
    23 FemModel::FemModel(char* filename){
    24 
    25 }
    26 /*}}}*/
    2722/*FUNCTION FemModel::FemModel(int argc,char** argv){{{*/
    2823FemModel::FemModel(int argc,char** argv,COMM incomm){
     
    707702                case ThicknessAlongGradientEnum: ThicknessAlongGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
    708703                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;
    709705                case TotalSmbEnum:                                      this->TotalSmbx(responses,process_units); break;
    710706                case RheologyBbarAbsGradientEnum:RheologyBbarAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
     
    13631359#endif
    13641360#ifdef _HAVE_CONTROL_
     1361void 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}/*}}}*/
    13651380void FemModel::ThicknessAbsGradientx( IssmDouble* pJ, bool process_units, int weight_index){/*{{{*/
    13661381
  • issm/trunk/src/c/classes/FemModel.h

    r14067 r14310  
    4747
    4848                /*constructors, destructors: */
    49                 FemModel(char* filename);
    5049                FemModel(int argc,char** argv,COMM comm_init);
    5150                FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels);
     
    8180                void IceVolumex(IssmDouble* pV,bool process_units);
    8281                void ElementResponsex(IssmDouble* presponse,int response_enum,bool process_units);
     82                void BalancethicknessMisfitx(IssmDouble* pV,bool process_units,int weight_index);
    8383                #endif
    8484                #ifdef  _HAVE_DAKOTA_
  • issm/trunk/src/c/classes/IssmComm.cpp

    r13975 r14310  
    1111#include "./IssmComm.h"
    1212#include "../include/types.h"
     13#include "../include/macros.h"
     14#include "../shared/Exceptions/exceptions.h"
    1315
    1416void 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}/*}}}*/
     23void 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
    1630}/*}}}*/
    1731COMM IssmComm::GetComm(){  /*{{{*/
     32        if(!parallel) _error_("Cannot return comm in serial mode");
    1833        return comm;
    1934}/*}}}*/
    2035int IssmComm::GetRank(){  /*{{{*/
     36
    2137        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;
    2541
    2642        #ifdef _HAVE_MPI_
     
    3551        int size = 1;
    3652
    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;
    3955
    4056        #ifdef _HAVE_MPI_
  • issm/trunk/src/c/classes/IssmComm.h

    r13975 r14310  
    2121        private:
    2222                static COMM comm;
     23                static bool parallel;
    2324
    2425        public:
    2526                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);
    2931};
    3032
  • issm/trunk/src/c/classes/RiftStruct.cpp

    r13975 r14310  
    2222
    2323}/*}}}*/
    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){/*{{{*/
     24RiftStruct::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){/*{{{*/
    2525
    2626        int i;
     
    3737        /*riftssegments*/
    3838        _assert_(riftssegments_in);
    39         this->riftssegments=xNew<double*>(numrifts_in);
     39        this->riftssegments=xNew<int*>(numrifts_in);
    4040        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);
    4343        }
    4444
     
    5050        /*riftspairs*/
    5151        _assert_(riftspairs_in);
    52         this->riftspairs=xNew<double*>(numrifts_in);
     52        this->riftspairs=xNew<int*>(numrifts_in);
    5353        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);
    5656        }
    5757
     
    7171        /*riftstips*/
    7272        _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);
    7575
    7676        /*state*/
     
    8585
    8686        xDelete<int>(this->riftsnumsegments);
    87         xDelete<double*>(this->riftssegments);
     87        xDelete<int*>(this->riftssegments);
    8888        xDelete<int>(this->riftsnumpairs);
    89         xDelete<double*>(this->riftspairs);
     89        xDelete<int*>(this->riftspairs);
    9090        xDelete<int>(this->riftsnumpenaltypairs);
    9191        xDelete<double*>(this->riftspenaltypairs);
    92         xDelete<double>(this->riftstips);
     92        xDelete<int>(this->riftstips);
    9393        xDelete<double*>(this->state);
    9494
  • issm/trunk/src/c/classes/RiftStruct.h

    r13975 r14310  
    1010        public:
    1111                int      numrifts;
    12                 double **riftssegments;
     12                int    **riftssegments;
    1313                int     *riftsnumsegments;
    14                 double **riftspairs;
     14                int    **riftspairs;
    1515                int     *riftsnumpairs;
    1616                double **riftspenaltypairs;
    1717                int     *riftsnumpenaltypairs;
    18                 double  *riftstips;
     18                int     *riftstips;
    1919                double **state;
    2020
    2121                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);
    2323                ~RiftStruct();
    2424};
  • issm/trunk/src/c/classes/bamg/Mesh.cpp

    r13975 r14310  
    899899                }
    900900                //Build output
     901                connectivitymax_2++;//add last column for size
    901902                bamgmesh->NodalConnectivitySize[0]=nbv;
    902903                bamgmesh->NodalConnectivitySize[1]=connectivitymax_2;
    903904                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;
    905906                for (i=0;i<nbv;i++){
    906907                        k=0;
     
    917918                                k++;
    918919                        }
     920                        bamgmesh->NodalConnectivity[connectivitymax_2*(i+1)-1]=k;
    919921                }
    920922
  • issm/trunk/src/c/classes/objects/Elements/Element.h

    r13975 r14310  
    110110                virtual IssmDouble ThicknessAlongGradient(bool process_units,int weight_index)=0;
    111111                virtual IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index)=0;
     112                virtual IssmDouble BalancethicknessMisfit(bool process_units,int weight_index)=0;
    112113                virtual IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index)=0;
    113114                virtual IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index)=0;
  • issm/trunk/src/c/classes/objects/Elements/Penta.cpp

    r14067 r14310  
    27272727
    27282728        /*Recover SmbGradients*/
    2729         GetInputListOnVertices(&Hc[0],SurfaceforcingsHcEnum);
    27302729        GetInputListOnVertices(&Href[0],SurfaceforcingsHrefEnum);
    27312730        GetInputListOnVertices(&Smbref[0],SurfaceforcingsSmbrefEnum);
    2732         GetInputListOnVertices(&smb_pos_max[0],SurfaceforcingsSmbPosMaxEnum);
    2733         GetInputListOnVertices(&smb_pos_min[0],SurfaceforcingsSmbPosMinEnum);
    2734         GetInputListOnVertices(&a_pos[0],SurfaceforcingsAPosEnum);
    27352731        GetInputListOnVertices(&b_pos[0],SurfaceforcingsBPosEnum);
    2736         GetInputListOnVertices(&a_neg[0],SurfaceforcingsANegEnum);
    27372732        GetInputListOnVertices(&b_neg[0],SurfaceforcingsBNegEnum);
    27382733
     
    27472742   // loop over all vertices
    27482743 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]);
    27542746          }
    27552747          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]);
    27582749          }
    27592750          smb[i]=smb[i]/rho_ice;      // SMB in m/y ice         
  • issm/trunk/src/c/classes/objects/Elements/Penta.h

    r13975 r14310  
    166166                IssmDouble ThicknessAlongGradient( bool process_units,int weight_index){_error_("not supported");};
    167167                IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index){_error_("not supported");};
     168                IssmDouble BalancethicknessMisfit(bool process_units,int weight_index){_error_("not supported");};
    168169                void   InputControlUpdate(IssmDouble scalar,bool save_parameter);
    169170                #endif
  • issm/trunk/src/c/classes/objects/Elements/Tria.cpp

    r13975 r14310  
    15501550                                                for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
    15511551                                                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));
    15521560                                        }
    15531561                                        break;
     
    23172325   IssmDouble h[NUMVERTICES];                                   // ice thickness (m)           
    23182326        IssmDouble s[NUMVERTICES];                                      // surface elevation (m)
    2319         IssmDouble a_pos[NUMVERTICES];                          // Hs-SMB relation parameter
    23202327        IssmDouble b_pos[NUMVERTICES];                          // Hs-SMB relation parameter
    2321         IssmDouble a_neg[NUMVERTICES];                          // Hs-SMB relation parameter
    23222328        IssmDouble b_neg[NUMVERTICES];                          // Hs-SMB relation paremeter
    2323         IssmDouble Hc[NUMVERTICES];                                     // elevation of transition between accumulation regime and ablation regime
    23242329        IssmDouble Href[NUMVERTICES];                                   // reference elevation from which deviations are used to calculate the SMB adjustment
    23252330        IssmDouble Smbref[NUMVERTICES];                         // reference SMB to which deviations are added
    2326         IssmDouble smb_pos_max[NUMVERTICES];            // maximum SMB value in the accumulation regime
    2327         IssmDouble smb_pos_min[NUMVERTICES];            // minimum SMB value in the accumulation regime
    23282331   IssmDouble rho_water;                   // density of fresh water
    23292332        IssmDouble rho_ice;                     // density of ice
     
    23332336
    23342337        /*Recover SmbGradients*/
    2335         GetInputListOnVertices(&Hc[0],SurfaceforcingsHcEnum);
    23362338        GetInputListOnVertices(&Href[0],SurfaceforcingsHrefEnum);
    23372339        GetInputListOnVertices(&Smbref[0],SurfaceforcingsSmbrefEnum);
    2338         GetInputListOnVertices(&smb_pos_max[0],SurfaceforcingsSmbPosMaxEnum);
    2339         GetInputListOnVertices(&smb_pos_min[0],SurfaceforcingsSmbPosMinEnum);
    2340         GetInputListOnVertices(&a_pos[0],SurfaceforcingsAPosEnum);
    23412340        GetInputListOnVertices(&b_pos[0],SurfaceforcingsBPosEnum);
    2342         GetInputListOnVertices(&a_neg[0],SurfaceforcingsANegEnum);
    23432341        GetInputListOnVertices(&b_neg[0],SurfaceforcingsBNegEnum);
    23442342
     
    23532351   // loop over all vertices
    23542352   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]);
    23602355          }
    23612356          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]);
    23642358          }
    23652359          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"); */
    23732360                }  //end of the loop over the vertices
    23742361          /*Update inputs*/
     
    34593446
    34603447#ifdef _HAVE_CONTROL_
     3448/*FUNCTION Tria::BalancethicknessMisfit{{{*/
     3449IssmDouble 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/*}}}*/
    34613506/*FUNCTION Tria::InputControlUpdate{{{*/
    34623507void  Tria::InputControlUpdate(IssmDouble scalar,bool save_parameter){
     
    35803625                        GradjVyBalancedthickness(gradient,control_index);
    35813626                        break;
     3627                case ThicknessEnum:
     3628                        GradjThicknessWeakBalancedthickness(gradient,control_index);
     3629                        break;
    35823630                default:
    35833631                        _error_("control type not supported yet: " << control_type);
     
    35973645                case ThicknessAlongGradientEnum:
    35983646                case ThicknessAcrossGradientEnum:
     3647                case BalancethicknessMisfitEnum:
    35993648                case SurfaceAbsVelMisfitEnum:
    36003649                case SurfaceRelVelMisfitEnum:
     
    40424091        /*Clean up and return*/
    40434092        delete gauss;
     4093}
     4094/*}}}*/
     4095/*FUNCTION Tria::GradjThicknessWeakBalancedthickness{{{*/
     4096void  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);
    40444203}
    40454204/*}}}*/
  • issm/trunk/src/c/classes/objects/Elements/Tria.h

    r13975 r14310  
    153153                void   GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
    154154                void   GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
     155                void   GradjThicknessWeakBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
    155156                void   GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data);
    156157                void   SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index);
     
    164165                IssmDouble ThicknessAlongGradient( bool process_units,int weight_index);
    165166                IssmDouble ThicknessAcrossGradient(bool process_units,int weight_index);
     167                IssmDouble BalancethicknessMisfit(     bool process_units,int weight_index);
    166168                IssmDouble SurfaceRelVelMisfit(    bool process_units,int weight_index);
    167169                IssmDouble SurfaceLogVelMisfit(    bool process_units,int weight_index);
  • issm/trunk/src/c/classes/objects/KML/KML_LineString.cpp

    r13395 r14310  
    197197        x  =xNew<IssmDouble>(ncoord);
    198198        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        }
    200206
    201207/*  write header  */
  • issm/trunk/src/c/classes/objects/KML/KML_LinearRing.cpp

    r13395 r14310  
    186186        x  =xNew<IssmDouble>(ncoord);
    187187        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        }
    189195
    190196/*  write header  */
  • issm/trunk/src/c/classes/objects/KML/KML_Point.cpp

    r13395 r14310  
    166166/*  convert latitude and longitude to x and y  */
    167167
    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        }
    169175
    170176/*  write header  */
  • issm/trunk/src/c/classes/objects/Vertex.cpp

    r13975 r14310  
    194194}
    195195/*}}}*/
     196/*FUNCTION Vertex::ToXYZ {{{*/
     197void  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  
    1313#include "../../include/include.h"
    1414template <class doubletype> class Vector;
     15template <class doubletype> class Matrix;
    1516class Parameters;
    1617class IoModel;
     
    5354                void  UpdateClonePids(int* allborderpids);
    5455                void  SetClone(int* minranks);
     56                void  ToXYZ(Matrix<IssmDouble>* matrix);
    5557};
    5658#endif  /* _VERTEX_H */
  • issm/trunk/src/c/include/globals.h

    r13975 r14310  
    1010
    1111COMM IssmComm::comm;
     12bool IssmComm::parallel;
    1213
    1314#endif
  • issm/trunk/src/c/io/PrintfFunction.cpp

    r13975 r14310  
    88#include "../shared/shared.h"
    99#include "../include/include.h"
     10
     11#ifdef _HAVE_ANDROID_NDK_
     12#include <android/log.h>
     13#endif
    1014
    1115int PrintfFunction(const char* format,...){
     
    5862
    5963        if(my_rank==0){
     64                #ifdef _HAVE_ANDROID_JNI_
     65                __android_log_print(ANDROID_LOG_INFO, "Native",message.c_str());
     66                #else
    6067                printf("%s\n",message.c_str());
     68                #endif
    6169        }
    6270        return 1;
  • issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp

    r13975 r14310  
    201201                case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
    202202                case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures";
    203                 case SurfaceforcingsHcEnum : return "SurfaceforcingsHc";
    204203                case SurfaceforcingsHrefEnum : return "SurfaceforcingsHref";
    205204                case SurfaceforcingsSmbrefEnum : return "SurfaceforcingsSmbref";
    206                 case SurfaceforcingsSmbPosMaxEnum : return "SurfaceforcingsSmbPosMax";
    207                 case SurfaceforcingsSmbPosMinEnum : return "SurfaceforcingsSmbPosMin";
    208                 case SurfaceforcingsAPosEnum : return "SurfaceforcingsAPos";
    209205                case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos";
    210                 case SurfaceforcingsANegEnum : return "SurfaceforcingsANeg";
    211206                case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg";
    212207                case ThermalMaxiterEnum : return "ThermalMaxiter";
     
    238233                case BalancethicknessAnalysisEnum : return "BalancethicknessAnalysis";
    239234                case BalancethicknessSolutionEnum : return "BalancethicknessSolution";
     235                case WeakBalancethicknessAnalysisEnum : return "WeakBalancethicknessAnalysis";
     236                case WeakBalancethicknessSolutionEnum : return "WeakBalancethicknessSolution";
    240237                case BedSlopeAnalysisEnum : return "BedSlopeAnalysis";
    241238                case BedSlopeSolutionEnum : return "BedSlopeSolution";
     
    346343                case AdjointyEnum : return "Adjointy";
    347344                case AdjointzEnum : return "Adjointz";
     345                case BalancethicknessMisfitEnum : return "BalancethicknessMisfit";
    348346                case BedSlopeXEnum : return "BedSlopeX";
    349347                case BedSlopeYEnum : return "BedSlopeY";
     
    373371                case QmuSurfaceEnum : return "QmuSurface";
    374372                case QmuMeltingEnum : return "QmuMelting";
     373                case AndroidFrictionCoefficientEnum : return "AndroidFrictionCoefficient";
    375374                case ResetPenaltiesEnum : return "ResetPenalties";
    376375                case SegmentOnIceShelfEnum : return "SegmentOnIceShelf";
     
    416415                case DragCoefficientAbsGradientEnum : return "DragCoefficientAbsGradient";
    417416                case TransientInputEnum : return "TransientInput";
    418                 case OutputfilenameEnum : return "Outputfilename";
    419417                case WaterfractionEnum : return "Waterfraction";
    420418                case WatercolumnEnum : return "Watercolumn";
  • issm/trunk/src/c/modules/Krigingx/Krigingx.cpp

    r14067 r14310  
    5757        else if(strcmp(output,"variomap")==0){
    5858                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);
    5977        }
    6078        else if(strcmp(output,"delaunay")==0){
     
    360378        return NULL;
    361379}/*}}}*/
     380/*FUNCTION Distancest{{{*/
     381void* 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}/*}}}*/
    362414
    363415void ProcessVariogram(Variogram **pvariogram,Options* options){/*{{{*/
  • issm/trunk/src/c/modules/Krigingx/Krigingx.h

    r14067 r14310  
    3636void* idwt(void*);
    3737void* v4t(void*);
     38void* Distancest(void*);
    3839#endif /* _KRIGINGX_H */
  • issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp

    r13975 r14310  
    44#include "./MeshProfileIntersectionx.h"
    55
    6 void MeshProfileIntersectionx( double** psegments, int* pnumsegs, int* index, double* x, double* y, int nel, int nods,  Contour<IssmPDouble>** contours,int numcontours){
     6void MeshProfileIntersectionx(double** psegments, int* pnumsegs, int* index, double* x, double* y, int nel, int nods,  Contour<IssmPDouble>** contours,int numcontours){/*{{{*/
    77
    88        int i,j,k;
     
    2020        /*intermediary: */
    2121        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;
    2626
    2727        /*Allocate: */
     
    6969        *psegments=segments;
    7070        *pnumsegs=numsegs;
    71 }
     71}/*}}}*/
     72void 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*/
     121void 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}/*}}}*/
     135void 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}/*}}}*/
     220bool 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}/*}}}*/
     247int 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  
    1010
    1111/* local prototypes: */
    12 void MeshProfileIntersectionx( double** psegments, int* pnumseg, int* index, double* x, double* y, int nel, int nods,  Contour<IssmPDouble>** contours,int numcontours);
     12void MeshProfileIntersectionx(double** psegments, int* pnumseg, int* index, double* x, double* y, int nel, int nods,  Contour<IssmPDouble>** contours,int numcontours);
    1313void MeshSegmentsIntersection(double** psegments, int* pnumsegs,int* index, double* x, double* y, int nel, int nods, double* xc, double* yc, int numnodes);
    1414void 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  
    1515
    1616        Parameters *parameters       = NULL;
    17         bool        control_analysis;
     17        bool        control_analysis,tao_analysis;
    1818        int         nsteps;
    1919        int         num_control_type;
     
    3030        /*retrieve some parameters: */
    3131        iomodel->Constant(&control_analysis,InversionIscontrolEnum);
     32        iomodel->Constant(&tao_analysis,InversionTaoEnum);
    3233
    3334        if(control_analysis){
     
    3738                parameters->AddObject(iomodel->CopyConstantObject(InversionNumCostFunctionsEnum));
    3839                parameters->AddObject(iomodel->CopyConstantObject(InversionNstepsEnum));
    39                 parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum));
    40                 parameters->AddObject(iomodel->CopyConstantObject(InversionGradientOnlyEnum));
    4140                parameters->AddObject(iomodel->CopyConstantObject(InversionIncompleteAdjointEnum));
     41                if(!tao_analysis){
     42                        parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum));
     43                        parameters->AddObject(iomodel->CopyConstantObject(InversionGradientOnlyEnum));
     44                }
    4245
    4346                /*What solution type?*/
     
    5255                iomodel->FetchData(&control_type,NULL,&num_control_type,InversionControlParametersEnum);
    5356                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                }
    5762
    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                }
    6374
    6475                xDelete<int>(control_type);
  • issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp

    r13975 r14310  
    4545                        case VxEnum:   iomodel->FetchData(1,VxEnum); break;
    4646                        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;
    5051                        default: _error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
    5152                }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp

    r13975 r14310  
    22 * UpdateElementsDiagnosticHoriz:
    33 */
     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
    49
    510#include "../../../Container/Container.h"
     
    8590        elements->InputDuplicate(VxEnum,InversionVxObsEnum);
    8691        if(dakota_analysis)elements->InputDuplicate(VxEnum,QmuVxEnum);
     92       
     93        #ifdef _HAVE_ANDROID_
     94        elements->InputDuplicate(FrictionCoefficientEnum,AndroidFrictionCoefficientEnum);
     95        #endif
    8796
    8897        elements->InputDuplicate(VyEnum,VyPicardEnum);
  • issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp

    r13975 r14310  
    7272        }
    7373        if(issmbgradients){
    74                 iomodel->FetchDataToInput(elements,SurfaceforcingsHcEnum);
    7574                iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum);
    7675                iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum);
    77                 iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMaxEnum);
    78                 iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMinEnum);
    79                 iomodel->FetchDataToInput(elements,SurfaceforcingsAPosEnum);
    8076                iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
    81                 iomodel->FetchDataToInput(elements,SurfaceforcingsANegEnum);
    8277                iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
    8378        }
  • issm/trunk/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp

    r14067 r14310  
    2121
    2222        int i,j,n;
    23         const int maxels=25;
     23        const int maxels=50;
    2424        const int width=maxels+1;
    2525
  • issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp

    r13975 r14310  
    5656
    5757                /*We don't have a file pointer. Retrieve the output file name and open it for writing:*/
    58                 parameters->FindParam(&outputfilename,OutputfilenameEnum);
     58                parameters->FindParam(&outputfilename,OutputFileNameEnum);
    5959
    6060                /*What strategy? : */
  • issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp

    r13975 r14310  
    205205              else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
    206206              else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
    207               else if (strcmp(name,"SurfaceforcingsHc")==0) return SurfaceforcingsHcEnum;
    208207              else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
    209208              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;
    213209              else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
    214               else if (strcmp(name,"SurfaceforcingsANeg")==0) return SurfaceforcingsANegEnum;
    215210              else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
    216211              else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum;
     
    242237              else if (strcmp(name,"BalancethicknessAnalysis")==0) return BalancethicknessAnalysisEnum;
    243238              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;
    244241              else if (strcmp(name,"BedSlopeAnalysis")==0) return BedSlopeAnalysisEnum;
    245242              else if (strcmp(name,"BedSlopeSolution")==0) return BedSlopeSolutionEnum;
     
    261258              else if (strcmp(name,"PrognosticSolution")==0) return PrognosticSolutionEnum;
    262259              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;
    263263         else stage=3;
    264264   }
    265265   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;
    270267              else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum;
    271268              else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
     
    353350              else if (strcmp(name,"Adjointy")==0) return AdjointyEnum;
    354351              else if (strcmp(name,"Adjointz")==0) return AdjointzEnum;
     352              else if (strcmp(name,"BalancethicknessMisfit")==0) return BalancethicknessMisfitEnum;
    355353              else if (strcmp(name,"BedSlopeX")==0) return BedSlopeXEnum;
    356354              else if (strcmp(name,"BedSlopeY")==0) return BedSlopeYEnum;
     
    380378              else if (strcmp(name,"QmuSurface")==0) return QmuSurfaceEnum;
    381379              else if (strcmp(name,"QmuMelting")==0) return QmuMeltingEnum;
     380              else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
    382381              else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
    383382              else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
    384383              else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
    385384              else if (strcmp(name,"SurfaceArea")==0) return SurfaceAreaEnum;
     385              else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
    386386         else stage=4;
    387387   }
    388388   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;
    391390              else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
    392391              else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
     
    426425              else if (strcmp(name,"DragCoefficientAbsGradient")==0) return DragCoefficientAbsGradientEnum;
    427426              else if (strcmp(name,"TransientInput")==0) return TransientInputEnum;
    428               else if (strcmp(name,"Outputfilename")==0) return OutputfilenameEnum;
    429427              else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
    430428              else if (strcmp(name,"Watercolumn")==0) return WatercolumnEnum;
     
    507505              else if (strcmp(name,"QmuOutName")==0) return QmuOutNameEnum;
    508506              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;
    509509         else stage=5;
    510510   }
    511511   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;
    515513              else if (strcmp(name,"Verbose")==0) return VerboseEnum;
    516514              else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
  • issm/trunk/src/c/modules/TriMeshProcessRiftsx/TriMeshProcessRiftsx.cpp

    r13634 r14310  
    99#include "../../toolkits/toolkits.h"
    1010
    11 void TriMeshProcessRiftsx(double** pindex, int* pnel,double** px,double** py,int* pnods,double** psegments,double** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct){
     11void TriMeshProcessRiftsx(int** pindex, int* pnel,double** px,double** py,int* pnods,int** psegments,int** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct){
    1212
    1313        /*Output*/
    1414        int      numrifts,numrifts0;
    1515        int     *riftsnumsegments     = NULL;
    16         double **riftssegments        = NULL;
     16        int    **riftssegments        = NULL;
    1717        int     *riftsnumpairs        = NULL;
    18         double **riftspairs           = NULL;
    19         double  *riftstips            = NULL;
     18        int    **riftspairs           = NULL;
     19        int     *riftstips            = NULL;
    2020        double **riftspenaltypairs    = NULL;
    2121        int     *riftsnumpenaltypairs = NULL;
     
    2323        /*Recover initial mesh*/
    2424        int     nel            = *pnel;
    25         double *index          = *pindex;
     25        int    *index          = *pindex;
    2626        double *x              = *px;
    2727        double *y              = *py;
    2828        int     nods           = *pnods;
    29         double *segments       = *psegments;
    30         double *segmentmarkers = *psegmentmarkers;
     29        int    *segments       = *psegments;
     30        int    *segmentmarkers = *psegmentmarkers;
    3131        int     num_seg        = *pnum_seg;
    3232
  • issm/trunk/src/c/modules/TriMeshProcessRiftsx/TriMeshProcessRiftsx.h

    r13634 r14310  
    88class RiftStruct;
    99
    10 void TriMeshProcessRiftsx(double** pindex, int* pnel,double** px,double** py,int* pnods,double** psegments,double** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct);
     10void TriMeshProcessRiftsx(int** pindex,int* pnel,double** px,double** py,int* pnods,int** psegments,int** psegmentmarkers,int *pnum_seg,RiftStruct **priftstruct);
    1111
    1212#endif  /* _TRIMESHPROCESSRIFTX_H*/
  • issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp

    r13975 r14310  
    2222/*}}}*/
    2323
    24 void TriMeshx(SeqMat<IssmPDouble>** pindex,SeqVec<IssmPDouble>** px,SeqVec<IssmPDouble>** py,SeqMat<IssmPDouble>** psegments,SeqVec<IssmPDouble>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area){
     24void TriMeshx(SeqMat<int>** pindex,SeqVec<IssmPDouble>** px,SeqVec<IssmPDouble>** py,SeqMat<int>** psegments,SeqVec<int>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area){
    2525
    2626#if !defined(_HAVE_TRIANGLE_)
     
    3131
    3232        /*output: */
    33         IssmPDouble         *index             = NULL;
    34         SeqMat<IssmPDouble> *index_matrix      = NULL;
    35         double              *x                 = NULL;
    36         double              *y                 = NULL;
    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;
    4040
    4141        /*intermediary: */
     
    169169
    170170        /*Allocate index, x and y: */
    171         index=xNew<double>(3*out.numberoftriangles);
     171        index=xNew<int>(3*out.numberoftriangles);
    172172        x=xNew<double>(out.numberofpoints);
    173173        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);
    176176
    177177        for (i = 0; i< out.numberoftriangles; i++) {
    178178                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;
    180180                }
    181181        }
    182182        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];
    185185        }
    186186        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];
    190190        }
    191191
     
    197197
    198198        /*Output : */
    199         index_matrix=new SeqMat<IssmPDouble>(index,out.numberoftriangles,3,1.0);
     199        index_matrix=new SeqMat<int>(index,out.numberoftriangles,3,1);
    200200        *pindex=index_matrix;
    201201
    202         segments_matrix=new SeqMat<IssmPDouble>(segments,out.numberofsegments,3,1.0);
     202        segments_matrix=new SeqMat<int>(segments,out.numberofsegments,3,1);
    203203        *psegments=segments_matrix;
    204204
    205205        *px=new SeqVec<IssmPDouble>(x,out.numberofpoints);
    206206        *py=new SeqVec<IssmPDouble>(y,out.numberofpoints);
    207         *psegmentmarkerlist=new SeqVec<IssmPDouble>(segmentmarkerlist,out.numberofsegments);
     207        *psegmentmarkerlist=new SeqVec<int>(segmentmarkerlist,out.numberofsegments);
    208208#endif
    209209}
  • issm/trunk/src/c/modules/TriMeshx/TriMeshx.h

    r13975 r14310  
    1111
    1212/* 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);
     13void TriMeshx(SeqMat<int>** pindex,SeqVec<IssmPDouble>** px,SeqVec<IssmPDouble>** py,SeqMat<int>** psegments,SeqVec<int>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area);
    1414
    1515#endif  /* _TRIMESHX_H */
  • issm/trunk/src/c/modules/modules.h

    r13975 r14310  
    6060#include "./Kml2Expx/Kml2Expx.h"
    6161#include "./Krigingx/Krigingx.h"
    62 #include "./Shp2Kmlx/Shp2Kmlx.h"
    6362#include "./Mergesolutionfromftogx/Mergesolutionfromftogx.h"
    6463#include "./MeshPartitionx/MeshPartitionx.h"
     
    8786#include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h"
    8887#include "./Scotchx/Scotchx.h"
     88#include "./Shp2Expx/Shp2Expx.h"
     89#include "./Shp2Kmlx/Shp2Kmlx.h"
    8990#include "./SmbGradientsx/SmbGradientsx.h"
    9091#include "./Solverx/Solverx.h"
  • issm/trunk/src/c/shared/Elements/PrintArrays.cpp

    r13975 r14310  
    3939        _printLine_("");
    4040}
     41void 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}
    4150void printbinary(int n){
    4251        unsigned int i=1L<<(sizeof(n)*8-1);
  • issm/trunk/src/c/shared/Elements/elements.h

    r13975 r14310  
    4040void printarray(IssmPDouble* array,int lines,int cols=1);
    4141void printarray(int* array,int lines,int cols=1);
     42void printarray(bool* array,int lines,int cols=1);
    4243void printsparsity(IssmPDouble* array,int lines,int cols=1);
    4344void printbinary(int n);
  • issm/trunk/src/c/shared/Exp/exp.h

    r13975 r14310  
    1212
    1313int 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);
     14int ExpWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,char* domainname);
     15int ExpWrite(DataSet* contours,char* domainname);
    1516int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue);
    1617
  • issm/trunk/src/c/shared/Numerics/UnitConversion.cpp

    r13975 r14310  
    6565                case SurfaceforcingsPrecipitationEnum:       scale=yts;break;     //m/yr
    6666                case SurfaceforcingsMassBalanceEnum:         scale=yts;break;     //m/yr
    67                 case SurfaceforcingsSmbPosMaxEnum:                              scale=yts;break;     //m/yr
    68                 case SurfaceforcingsSmbPosMinEnum:                              scale=yts;break;     //m/yr
    69                 case SurfaceforcingsAPosEnum:                                           scale=yts;break;     //m/yr
    7067                case SurfaceforcingsBPosEnum:                                           scale=yts;break;     //m/yr
    71                 case SurfaceforcingsANegEnum:                                           scale=yts;break;     //m/yr
    7268                case SurfaceforcingsBNegEnum:                                           scale=yts;break;     //m/yr
    7369                case SurfaceforcingsSmbrefEnum:                                 scale=yts;break;     //m/yr
  • issm/trunk/src/c/shared/TriMesh/AssociateSegmentToElement.cpp

    r13975 r14310  
    55#include "./trimesh.h"
    66
    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;
     7int AssociateSegmentToElement(int** psegments,int nseg,int* index,int nel){
    158
    169        /*node indices: */
    17         double A,B;
     10        int A,B;
    1811
    1912        /*Recover segments: */
    20         segments=*psegments;
     13        int* segments=*psegments;
    2114
    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.
    2619        }
    2720
    2821        /*Assign output pointers: */
    2922        *psegments=segments;
    30         return noerr;
     23        return 1;
    3124}
  • issm/trunk/src/c/shared/TriMesh/OrderSegments.cpp

    r13975 r14310  
    55#include "./trimesh.h"
    66
    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;
     7int OrderSegments(int** psegments,int nseg,int* index,int nel){
    158
    169        /*vertex indices: */
    17         double A,B;
    18         /*element indices: */
     10        int A,B;
     11
     12        /*element index*/
    1913        int el;
    2014
    2115        /*Recover segments: */
    22         segments=*psegments;
     16        int* segments=*psegments;
    2317
    24         for (i=0;i<nseg;i++){
     18        for(int i=0;i<nseg;i++){
    2519                A=segments[3*i+0];
    2620                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.
    2822
    2923                if (index[3*el+0]==A){
     
    4943        /*Assign output pointers: */
    5044        *psegments=segments;
    51         return noerr;
     45        return 1;
    5246}
  • issm/trunk/src/c/shared/TriMesh/SplitMeshForRifts.cpp

    r13975 r14310  
    66#include "../Alloc/alloc.h"
    77
    8 int SplitMeshForRifts(int* pnel,double** pindex,int* pnods,double** px,double** py,int* pnsegs,double** psegments,double** psegmentmarkerlist){
     8int SplitMeshForRifts(int* pnel,int** pindex,int* pnods,double** px,double** py,int* pnsegs,int** psegments,int** psegmentmarkerlist){
    99
    1010        /*Some notes on dimensions:
     
    1313        segments of size nsegsx3*/
    1414
    15         /*Error management: */
    16         int noerr=1;
    17 
    1815        int i,j,k,l;
    1916        int node;
    2017        int el;
    21 
    2218        int  nriftsegs;
    2319        int* riftsegments=NULL;
    2420        int* flags=NULL;
    25 
    2621        int  NumGridElementListOnOneSideOfRift;
    2722        int* GridElementListOnOneSideOfRift=NULL;
    2823
    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 
    3924        /*Recover input: */
    40         nel=*pnel;
    41         index=*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;
    4833
    4934        /*Establish list of segments that belong to a rift: */
     
    9075                                        el=GridElementListOnOneSideOfRift[k];
    9176                                        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.
    9378                                        }
    9479                                }
     
    10994        *psegments=segments;
    11095        *psegmentmarkerlist=segmentmarkerlist;
    111         return noerr;
     96        return 1;
    11297}
  • issm/trunk/src/c/shared/TriMesh/TriMeshUtils.cpp

    r13975 r14310  
    3636}/*}}}*/
    3737/*FUNCTION GridElementsList{{{*/
    38 int GridElementsList(int** pGridElements, int* pNumGridElements,int node,double * index,int nel){
     38int GridElementsList(int** pGridElements, int* pNumGridElements,int node,int* index,int nel){
    3939
    4040        /*From a node, recover all the elements that are connected to it: */
     
    5858        for (i=0;i<nel;i++){
    5959                for (j=0;j<3;j++){
    60                         if ((int)*(index+3*i+j)==node){
     60                        if (index[3*i+j]==node){
    6161                                if (NumGridElements<=(current_size-1)){
    6262                                        GridElements[NumGridElements]=i;
     
    9090}/*}}}*/
    9191/*FUNCTION IsNeighbor{{{*/
    92 int IsNeighbor(int el1,int el2,double* index){
     92int IsNeighbor(int el1,int el2,int* index){
    9393        /*From a triangulation held in index, figure out if elements 1 and 2 have two nodes in common: */
    9494        int i,j;
     
    9696        for (i=0;i<3;i++){
    9797                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++;
    9999                }
    100100        }
     
    118118}/*}}}*/
    119119/*FUNCTION RiftSegmentsFromSegments{{{*/
    120 void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel, double* index, int nsegs,double* segments){
     120void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel,int* index,int nsegs,int* segments){
    121121
    122122        int i,counter;
     
    126126        int* riftsegments=NULL;
    127127        int* riftsegments_uncompressed=NULL;
    128         double element_nodes[3];
     128        int element_nodes[3];
    129129
    130130        /*Allocate segmentflags: */
     
    143143                element_nodes[2]=*(index+3*el+2);
    144144
    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;
    148148
    149149                el2=FindElement(*(segments+3*i+0),*(segments+3*i+1),index,nel);
    150150
    151151                /*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];
    155155
    156156                if (el2!=-1){
    157157                        /*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++;
    164164                }
    165165        }
     
    169169        counter=0;
    170170        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];
    176176                        counter++;
    177177                }
    178178        }
    179 
    180179        xDelete<int>(riftsegments_uncompressed);
    181180
     
    185184}/*}}}*/
    186185/*FUNCTION DetermineGridElementListOnOneSideOfRift{{{*/
    187 int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift, int segmentnumber, int nriftsegs, int* riftsegments, int node,double* index,int nel){
     186int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift, int segmentnumber, int nriftsegs, int* riftsegments, int node,int* index,int nel){
    188187
    189188        int noerr=1;
     
    249248}/*}}}*/
    250249/*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){
     250int UpdateSegments(int** psegments,int** psegmentmarkerlist, int* pnsegs,int* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel){
    252251
    253252        int noerr=1;
     
    255254        int el1,el2;
    256255
    257         double *segments          = NULL;
    258         double *segmentmarkerlist = NULL;
    259         int     nsegs;
     256        int *segments          = NULL;
     257        int *segmentmarkerlist = NULL;
     258        int  nsegs;
    260259
    261260        /*Recover input: */
     
    265264
    266265        /*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));
    269268
    270269        /*First, update the existing segments to the new nodes :*/
     
    278277                                 *we can only rely on the position (x,y) of the rift nodes to create a segment:*/
    279278                                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])){
    281280                                                *(segments+3*j+0)=*(index+el1*3+k); _assert_(segments[3*j+0]<nods+1);
    282281                                                break;
     
    284283                                }
    285284                                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])){
    287286                                                *(segments+3*j+1)=*(index+el1*3+k); _assert_(segments[3*j+1]<nods+1);
    288287                                                break;
     
    293292                                *(segmentmarkerlist+(nsegs+i))=*(segmentmarkerlist+j);
    294293                                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])){
    296295                                                *(segments+3*(nsegs+i)+0)=*(index+el2*3+k); _assert_(segments[3*(nsegs+i)+0]<nods+1);
    297296                                                break;
     
    299298                                }
    300299                                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])){
    302301                                                *(segments+3*(nsegs+i)+1)=*(index+el2*3+k); _assert_(segments[3*(nsegs+i)+1]<nods+1);
    303302                                                break;
     
    309308                                /*Let's update segments[j][:] using  element el2 and the corresponding rift segment: */
    310309                                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])){
    312311                                                *(segments+3*j+0)=*(index+el2*3+k); _assert_(segments[3*j+0]<nods+1);
    313312                                                break;
     
    315314                                }
    316315                                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])){
    318317                                                *(segments+3*j+1)=*(index+el2*3+k);_assert_(segments[3*j+1]<nods+1);
    319318                                                break;
     
    324323                                *(segmentmarkerlist+(nsegs+i))=*(segmentmarkerlist+j);
    325324                                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])){
    327326                                                *(segments+3*(nsegs+i)+0)=*(index+el1*3+k);_assert_(segments[3*(nsegs+i)+0]<nods+1);
    328327                                                break;
     
    330329                                }
    331330                                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])){
    333332                                                *(segments+3*(nsegs+i)+1)=*(index+el1*3+k);_assert_(segments[3*(nsegs+i)+1]<nods+1);
    334333                                                break;
     
    348347}/*}}}*/
    349348/*FUNCTION FindElement{{{*/
    350 int FindElement(double A,double B,double* index,int nel){
    351 
    352         int n;
     349int FindElement(int A,int B,int* index,int nel){
     350
    353351        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))){
    356354                        el=n;
    357355                        break;
     
    361359}/*}}}*/
    362360/*FUNCTION SplitRiftSegments{{{*/
    363 int SplitRiftSegments(double** psegments,double** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,double*** priftssegments,int numrifts,int nods,int nel){
     361int SplitRiftSegments(int** psegments,int** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,int*** priftssegments,int numrifts,int nods,int nel){
    364362
    365363        /*Using segment markers, wring out the rift segments from the segments. Rift markers are
     
    370368
    371369        /*input: */
    372         double *segments          = NULL;
    373         double *segmentmarkerlist = NULL;
     370        int *segments          = NULL;
     371        int *segmentmarkerlist = NULL;
    374372        int numsegs;
    375373
    376374        /*output: */
    377         int      new_numsegs;
    378         int     *riftsnumsegs       = NULL;
    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;
    382380
    383381        /*intermediary: */
    384         double* riftsegment=NULL;
     382        int* riftsegment=NULL;
    385383
    386384        /*Recover input arguments: */
    387         segments=*psegments;
    388         numsegs=*pnumsegs;
    389         segmentmarkerlist=*psegmentmarkerlist;
     385        segments          = *psegments;
     386        numsegs           = *pnumsegs;
     387        segmentmarkerlist = *psegmentmarkerlist;
    390388
    391389        /*First, figure out  how many segments will be left in 'segments': */
     
    396394        /*Allocate new segments: */
    397395        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);
    400398
    401399        /*Copy new segments info : */
     
    413411        /*Now deal with rift segments: */
    414412        riftsnumsegs=xNew<int>(numrifts);
    415         riftssegments=xNew<double*>(numrifts);
     413        riftssegments=xNew<int*>(numrifts);
    416414        for (i=0;i<numrifts;i++){
    417415                /*Figure out how many segments for rift i: */
     
    421419                }
    422420                riftsnumsegs[i]=counter;
    423                 riftsegment=xNew<double>(counter*3);
     421                riftsegment=xNew<int>(counter*3);
    424422                /*Copy new segments info :*/
    425423                counter=0;
     
    436434
    437435        /*Free ressources: */
    438         xDelete<double>(segments);
     436        xDelete<int>(segments);
    439437
    440438        /*Assign output pointers: */
     
    448446}/*}}}*/
    449447/*FUNCTION PairRiftElements{{{*/
    450 int PairRiftElements(int** priftsnumpairs, double*** priftspairs,int numrifts,int* riftsnumsegments, double** riftssegments,double* x,double* y){
     448int PairRiftElements(int** priftsnumpairs,int*** priftspairs,int numrifts,int* riftsnumsegments,int** riftssegments,double* x,double* y){
    451449
    452450        int noerr=1;
     
    454452
    455453        /*output: */
    456         int     *riftsnumpairs = NULL;
    457         double **riftspairs    = NULL;
     454        int  *riftsnumpairs = NULL;
     455        int **riftspairs    = NULL;
    458456
    459457        /*intermediary :*/
    460         int     numsegs;
    461         double* segments=NULL;
    462         double* pairs=NULL;
    463         int     node1,node2,node3,node4;
     458        int  numsegs;
     459        int* segments=NULL;
     460        int* pairs=NULL;
     461        int  node1,node2,node3,node4;
    464462
    465463        riftsnumpairs=xNew<int>(numrifts);
    466         riftspairs=xNew<double*>(numrifts);
     464        riftspairs=xNew<int*>(numrifts);
    467465        for (i=0;i<numrifts;i++){
    468466                segments=riftssegments[i];
    469                 numsegs=riftsnumsegments[i];
     467                numsegs =riftsnumsegments[i];
    470468                riftsnumpairs[i]=numsegs;
    471                 pairs=xNew<double>(2*numsegs);
     469                pairs=xNew<int>(2*numsegs);
    472470                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;
    475473                        /*Find element facing on other side of rift: */
    476474                        for (k=0;k<numsegs;k++){
    477475                                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;
    479477                                /*We are trying to find 2 elements, where position of node3 == position of node1, and position of node4 == position of node2*/
    480478                                if (   (x[node3]==x[node1]) && (y[node3]==y[node1]) && (x[node4]==x[node2]) && (y[node4]==y[node2])
    481479                                    || (x[node3]==x[node2]) && (y[node3]==y[node2]) && (x[node4]==x[node1]) && (y[node4]==y[node1])  ){
    482480                                        /*We found the corresponding element: */
    483                                         *(pairs+2*j+1)=*(segments+3*k+2);
     481                                        pairs[2*j+1]=segments[3*k+2];
    484482                                        break;
    485483                                }
     
    495493}/*}}}*/
    496494/*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){
     495int RemoveRifts(int** pindex,double** px,double** py,int* pnods,int** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,int** rifts1segments,int** rifts1pairs,int nel){
    498496
    499497        int noerr=1;
    500498        int i,j,k,counter,counter1,counter2;
    501499
    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 
    510500        /*intermediary: */
    511         double *riftsegments = NULL;
    512         double *riftpairs    = NULL;
     501        int    *riftsegments = NULL;
     502        int    *riftpairs    = NULL;
    513503        int     node1,node2,node3,node4,temp_node;
    514         double  el2;
     504        int     el2;
    515505        int     newnods; //temporary # node counter.
    516506        double  xmin,ymin;
     
    523513
    524514        /*Recover input: */
    525         index=*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;
    531521
    532522        /*initialize newnods : */
     
    558548                riftpairs=rifts1pairs[i];
    559549                for (j=0;j<rifts1numsegs[i];j++){
    560                         el2=*(riftpairs+2*j+1);
     550                        el2=riftpairs[2*j+1];
    561551                        node1=(int)*(riftsegments+3*j+0);
    562552                        node2=(int)*(riftsegments+3*j+1);
     
    565555                        for (k=0;k<rifts1numsegs[i];k++){
    566556                                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);
    569559                                        break;
    570560                                }
     
    677667}/*}}}*/
    678668/*FUNCTION IsRiftPresent{{{*/
    679 int IsRiftPresent(int* priftflag,int* pnumrifts, double* segmentmarkerlist,int nsegs){
     669int IsRiftPresent(int* priftflag,int* pnumrifts,int* segmentmarkerlist,int nsegs){
    680670
    681671        int i;
     
    686676        int numrifts=0;
    687677
    688         double maxmark=1; //default marker for regular segments
     678        int maxmark=1; //default marker for regular segments
    689679
    690680        /*Any marker >=2 indicates a certain rift: */
     
    696686                }
    697687        }
    698         if (numrifts)riftflag=1;
     688        if(numrifts)riftflag=1;
    699689
    700690        /*Assign output pointers:*/
     
    704694}/*}}}*/
    705695/*FUNCTION OrderRifts{{{*/
    706 int OrderRifts(double** priftstips, double** riftssegments,double** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels){
     696int OrderRifts(int** priftstips,int** riftssegments,int** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels){
    707697
    708698        int noerr=1;
     
    710700
    711701        /*intermediary: */
    712         double *riftsegments = NULL;
    713         double *riftpairs    = NULL;
     702        int *riftsegments = NULL;
     703        int *riftpairs    = NULL;
    714704        int numsegs;
    715705
    716706        /*ordering and copy: */
    717         int    *order             = NULL;
    718         double *riftsegments_copy = NULL;
    719         double *riftpairs_copy    = NULL;
     707        int *order             = NULL;
     708        int *riftsegments_copy = NULL;
     709        int *riftpairs_copy    = NULL;
    720710
    721711        /*node and element manipulation: */
    722         int     node1,node2,node3,node4,temp_node,tip1,tip2,node;
    723         double el2;
    724         int     already_ordered=0;
     712        int node1,node2,node3,node4,temp_node,tip1,tip2,node;
     713        int el2;
     714        int already_ordered=0;
    725715
    726716        /*output: */
    727         double* riftstips=NULL;
     717        int* riftstips=NULL;
    728718
    729719        /*Allocate byproduct of this routine, riftstips: */
    730         riftstips=xNew<double>(numrifts*2);
     720        riftstips=xNew<int>(numrifts*2);
    731721
    732722        /*Go through all rifts: */
    733723        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];
    737727
    738728                /*Allocate copy of riftsegments and riftpairs,
    739729                 *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);
    742732                order=xNew<int>(numsegs);
    743733
     
    748738                for (j=0;j<numsegs;j++){
    749739                        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);
    752742                        /*Summary, el1 and el2 are facing one another across the rift. node1 and node2 belong to el1 and
    753743                         *are located on the rift. Find node3 and node4, nodes belonging to el2 and located on the rift: */
    754744                        for (k=0;k<numsegs;k++){
    755745                                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);
    758748                                        break;
    759749                                }
     
    796786
    797787                /*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;
    800790
    801791                /*We have the two tips for this rift.  Go from tip1 to tip2, and figure out the order in which segments are sequential.
     
    804794                for (counter=0;counter<numsegs;counter++){
    805795                        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);
    808798
    809799                                if ((node1==node) || (node2==node)){
     
    849839
    850840                xDelete<int>(order);
    851                 xDelete<double>(riftsegments_copy);
    852                 xDelete<double>(riftpairs_copy);
     841                xDelete<int>(riftsegments_copy);
     842                xDelete<int>(riftpairs_copy);
    853843
    854844        }
     
    859849}/*}}}*/
    860850/*FUNCTION PenaltyPairs{{{*/
    861 int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts,double** riftssegments,
    862                 int* riftsnumsegs,double** riftspairs,double* riftstips,double* x,double* y){
     851int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts,int** riftssegments,
     852                int* riftsnumsegs,int** riftspairs,int* riftstips,double* x,double* y){
    863853
    864854        int noerr=1;
     
    875865        /*intermediary: */
    876866        int numsegs;
    877         double* riftsegments=NULL;
    878         double* riftpairs=NULL;
     867        int* riftsegments=NULL;
     868        int* riftpairs=NULL;
    879869        int counter;
    880870        double normal[2];
     
    980970                /*Renormalize normals: */
    981971                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) );
    983973                        *(riftpenaltypairs+j*7+4)=*(riftpenaltypairs+j*7+4)/magnitude;
    984974                        *(riftpenaltypairs+j*7+5)=*(riftpenaltypairs+j*7+5)/magnitude;
     
    993983        *priftsnumpenaltypairs=riftsnumpenaltypairs;
    994984        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}/*}}}*/
     986int RemoveCornersFromRifts(int** pindex,int* pnel,double** px,double** py,int* pnods,int* segments,int* segmentmarkers,int num_seg){/*{{{*/
    1002987
    1003988        int noerr=1;
    1004989        int i,j,k;
    1005         double node1,node2,node3;
     990        int node1,node2,node3;
    1006991        int el;
    1007 
    1008         /*input: */
    1009         double* index=NULL;
    1010         int     nel;
    1011         double* x=NULL;
    1012         double* y=NULL;
    1013         int     nods;
    1014992        double  pair[2];
    1015993        int     pair_count=0;
     
    1017995
    1018996        /*Recover input: */
    1019         index=*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;
    10241002
    10251003        for (i=0;i<num_seg;i++){
     
    10831061                                        x[nods]=(x[(int)node1-1]+x[(int)node2-1]+x[(int)node3-1])/3;
    10841062                                        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));
    10861064                                        /*First, reassign element el: */
    10871065                                        *(index+3*el+0)=node1;
     
    10981076                                        /*we need  to change the segment elements corresponding to el: */
    10991077                                        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;
    11041082                                                }
    11051083                                        }
     
    11211099        *pnods=nods;
    11221100        return noerr;
    1123 }
     1101}/*}}}*/
  • issm/trunk/src/c/shared/TriMesh/trimesh.h

    r13975 r14310  
    1010
    1111//#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);
     12int AssociateSegmentToElement(int** psegments,int nseg,int* index,int nel);
     13int OrderSegments(int** psegments,int nseg, int* index,int nel);
    1414int 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);
     15int FindElement(int A,int B,int* index,int nel);
     16int SplitMeshForRifts(int* pnel,int** pindex,int* pnods,double** px,double** py,int* pnsegs,int** psegments,int** psegmentmarkerlist);
    1717int IsGridOnRift(int* riftsegments, int nriftsegs, int node);
    1818int GridElementsList(int** pGridElements, int* pNumGridElements,int node,double * index,int nel);
    19 int IsNeighbor(int el1,int el2,double* index);
     19int IsNeighbor(int el1,int el2,int* index);
    2020int 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);
     21void RiftSegmentsFromSegments(int* pnriftsegs, int** priftsegments, int nel,int* index, int nsegs,int* segments);
     22int DetermineGridElementListOnOneSideOfRift(int* pNumGridElementListOnOneSideOfRift, int** pGridElementListOnOneSideOfRift,int segmentnumber, int nriftsegs,int* riftsegments, int node,int* index,int nel);
     23int UpdateSegments(int** psegments,int** psegmentmarkerlist, int* pnsegs,int* index, double* x,double* y,int* riftsegments,int nriftsegs,int nods,int nel);
     24int FindElement(double A,double B,int* index,int nel);
     25int RemoveRifts(int** pindex,double** px,double** py,int* pnods,int** psegments,int* pnumsegs,int numrifts1,int* rifts1numsegs,int** rifts1segments,double** rifts1pairs,int nel);
     26int IsRiftPresent(int* priftflag,int* pnumrifts,int* segmentmarkerlist,int nsegs);
     27int SplitRiftSegments(int** psegments,int** psegmentmarkerlist, int* pnumsegs, int* pnumrifts,int** priftsnumsegs,int*** priftssegments,int numrifts,int nods,int nels);
     28int OrderRifts(int** priftstips,int** riftssegments,int** riftspairs,int numrifts,int* riftsnumsegments,double* x,double* y,int nods,int nels);
     29int PenaltyPairs(double*** priftspenaltypairs,int** priftsnumpenaltypairs,int numrifts,int**  riftssegments,
     30                int* riftsnumsegments,int** riftspairs,int* riftstips,double* x,double* y);
     31int RemoveCornersFromRifts(int** pindex,int* pnel,double** px,double** py,int* pnods,int* segments,int* segmentmarkers,int num_seg);
     32int PairRiftElements(int** priftsnumpairs,int*** priftspairs,int numrifts,int* riftsnumsegments,int** riftssegments,double* x,double* y);
    3333
    3434#endif  /* _SHARED_TRIMESH_H */
  • issm/trunk/src/c/solutions/AdjointCorePointerFromSolutionEnum.cpp

    r13975 r14310  
    3434                        adjointcore=&adjointbalancethickness_core;
    3535                        break;
     36                case WeakBalancethicknessSolutionEnum:
     37                        adjointcore=&dummy_core;
     38                        break;
    3639                default:
    3740                        _error_("No adjoint has been implemented for solution " << EnumToStringx(solutiontype) << " yet");
  • issm/trunk/src/c/solutions/AnalysisConfiguration.cpp

    r13975 r14310  
    8383                        break;
    8484
     85                case WeakBalancethicknessSolutionEnum:
     86                        numanalyses=1;
     87                        analyses=xNew<int>(numanalyses);
     88                        analyses[0]=BalancethicknessAnalysisEnum;
     89                        break;
     90
    8591                case SurfaceSlopeSolutionEnum:
    8692                        numanalyses=1;
  • issm/trunk/src/c/solutions/CorePointerFromSolutionEnum.cpp

    r13975 r14310  
    6060                        #endif
    6161                        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;
    6269                case HydrologySolutionEnum:
    6370                        #ifdef _HAVE_HYDROLOGY_
  • issm/trunk/src/c/solutions/EnvironmentInit.cpp

    r13975 r14310  
    3131        if(!my_rank) printf("\n");
    3232        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);
    3434        if(!my_rank) printf("\n");
    3535
  • issm/trunk/src/c/solutions/controltao_core.cpp

    r13975 r14310  
    4949        femmodel->parameters->FindParam(&control_list,NULL,InversionControlParametersEnum);
    5050        femmodel->parameters->FindParam(&nsteps,InversionNstepsEnum);
    51         femmodel->parameters->FindParam(&dummy,NULL,NULL,InversionMaxiterPerStepEnum);
    5251        femmodel->parameters->SetParam(false,SaveResultsEnum);
    53         maxiter=nsteps*(int)dummy[0]; xDelete<IssmDouble>(dummy);
     52        maxiter=nsteps*10;
    5453
    5554        /*Initialize TAO*/
  • issm/trunk/src/c/solutions/convergence.cpp

    r13395 r14310  
    6565
    6666        //compute K[n]U[n-1]F = K[n]U[n-1] - F
     67        _assert_(uf); _assert_(Kff);
    6768        KUold=uf->Duplicate(); Kff->MatMult(old_uf,KUold);
    6869        KUoldF=KUold->Duplicate();KUold->Copy(KUoldF); KUoldF->AYPX(pf,-1.0);
  • issm/trunk/src/c/solutions/objectivefunction.cpp

    r13975 r14310  
    4646                femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
    4747        }
     48        else if (solution_type==WeakBalancethicknessSolutionEnum){
     49                femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
     50        }
    4851        else{
    4952                _error_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
     
    6366                solver_linear(femmodel);
    6467        }
     68        else if (solution_type==WeakBalancethicknessSolutionEnum){
     69                /*Don't do anything*/
     70        }
    6571        else{
    6672                _error_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
  • issm/trunk/src/c/solutions/solutions.h

    r13975 r14310  
    3333void dakota_core(FemModel* femmodel);
    3434void ad_core(FemModel* femmodel);
     35void dummy_core(FemModel* femmodel);
    3536IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs);
    3637
  • issm/trunk/src/c/solvers/solver_newton.cpp

    r13975 r14310  
    5656
    5757                /*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);
    5972                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);
    6282                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);
    6484
    6585                /*Check convergence*/
     
    82102                }
    83103
    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 
    98104                count++;
    99105        }
  • issm/trunk/src/c/solvers/solver_thermal_nonlinear.cpp

    r13975 r14310  
    3333        /*parameters:*/
    3434        int kflag,pflag;
    35         bool lowmem=0;
    3635        int  configuration_type;
    3736
    3837        /*Recover parameters: */
    3938        kflag=1; pflag=1;
    40         femmodel->parameters->FindParam(&lowmem,SettingsLowmemEnum);
    4139        femmodel->parameters->FindParam(&thermal_penalty_threshold,ThermalPenaltyThresholdEnum);
    4240        femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
  • issm/trunk/src/m/boundaryconditions/SetIceShelfBC.py

    r14067 r14310  
    2525                if not os.path.exists(icefrontfile):
    2626                        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)
    2828                nodeonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1))
    2929        else:
  • issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py

    r14067 r14310  
    2727                if not os.path.exists(icefrontfile):
    2828                        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)
    3030                vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,nodeinsideicefront.reshape(-1))
    3131        else:
  • issm/trunk/src/m/classes/autodiff.m

    r13975 r14310  
    4343                end % }}}
    4444                function disp(obj) % {{{
    45                         disp(sprintf('      automatic differentiation parameters:'));
     45                        disp(sprintf('   automatic differentiation parameters:'));
    4646                        fielddisplay(obj,'isautodiff','indicates if the automatic differentiation is activated');
    4747                        fielddisplay(obj,'dependents','list of dependent variables');
  • issm/trunk/src/m/classes/balancethickness.py

    r13395 r14310  
    2929                string='   balance thickness solution parameters:'
    3030               
    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)'))
    3232                string="%s\n%s"%(string,fielddisplay(self,'thickening_rate','ice thickening rate used in the mass conservation (dh/dt)'))
    3333                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  
    2828                string="   basal forcings parameters:"
    2929
    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)"))
    3131                string="%s\n%s"%(string,fielddisplay(self,"melting_rate_correction","additional melting applied when the grounding line retreats"))
    3232                string="%s\n%s"%(string,fielddisplay(self,"geothermalflux","geothermal heat flux [W/m^2]"))
  • issm/trunk/src/m/classes/constants.py

    r13395 r14310  
    2727                # {{{ Display
    2828                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"))
    3031                string="%s\n%s"%(string,fielddisplay(self,"yts","number of seconds in a year"))
    3132                string="%s\n%s"%(string,fielddisplay(self,"referencetemperature","reference temperature used in the enthalpy model"))
    3233
    33 
    3434                return string
    3535                #}}}
    36                
    3736        def setdefaultparameters(self):
    3837                # {{{setdefaultparameters
  • issm/trunk/src/m/classes/debug.py

    r13395 r14310  
    2626                string="   debug parameters:"
    2727
    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)"))
    2929                string="%s\n%s"%(string,fielddisplay(self,"gprof","use gnu-profiler to find out where the time is spent"))
    3030                string="%s\n%s"%(string,fielddisplay(self,'profiling','enables profiling (memory, flops, time)'))
  • issm/trunk/src/m/classes/diagnostic.py

    r13975 r14310  
    4545                # {{{ Display
    4646               
    47                 string='\n   Diagnostic solution parameters:'
    48                 string="%s\n\n%s"%(string,'      Convergence criteria:')
     47                string='   Diagnostic solution parameters:'
     48                string="%s\n%s"%(string,'      Convergence criteria:')
    4949                       
    5050                string="%s\n%s"%(string,fielddisplay(self,'restol','mechanical equilibrium residual convergence criterion'))
     
    5555                string="%s\n%s"%(string,fielddisplay(self,'viscosity_overshoot','over-shooting constant new=new+C*(new-old)'))
    5656
    57                 string="%s\n%s"%(string,'      boundary conditions:')
     57                string="%s\n%s"%(string,'\n      boundary conditions:')
    5858
    5959                string="%s\n%s"%(string,fielddisplay(self,'spcvx','x-axis velocity constraint (NaN means no constraint)'))
     
    6262                string="%s\n%s"%(string,fielddisplay(self,'icefront','segments on ice front list (last column 0-> Air, 1-> Water, 2->Ice'))
    6363
    64                 string="%s\n%s"%(string,'      Rift options:')
     64                string="%s\n%s"%(string,'\n      Rift options:')
    6565                string="%s\n%s"%(string,fielddisplay(self,'rift_penalty_threshold','threshold for instability of mechanical constraints'))
    6666                string="%s\n%s"%(string,fielddisplay(self,'rift_penalty_lock','number of iterations before rift penalties are locked'))
    6767
    68                 string="%s\n%s"%(string,'      Penalty options:')
     68                string="%s\n%s"%(string,'\n      Penalty options:')
    6969                string="%s\n%s"%(string,fielddisplay(self,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset'))
    7070                string="%s\n%s"%(string,fielddisplay(self,'vertex_pairing','pairs of vertices that are penalized'))
    7171
    72                 string="%s\n%s"%(string,'      Other:')
     72                string="%s\n%s"%(string,'\n      Other:')
    7373                string="%s\n%s"%(string,fielddisplay(self,'shelf_dampening','use dampening for floating ice ? Only for Stokes model'))
    7474                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  
    3737                string='   flow equation parameters:'
    3838
    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 ?"))
    4040                string="%s\n%s"%(string,fielddisplay(self,'ishutter',"is the shallow ice approximation used ?"))
    4141                string="%s\n%s"%(string,fielddisplay(self,'isl1l2',"are l1l2 equations used ?"))
  • issm/trunk/src/m/classes/friction.py

    r13395 r14310  
    2727                # {{{ Display
    2828                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]"))
    3031                string="%s\n%s"%(string,fielddisplay(self,"p","p exponent"))
    3132                string="%s\n%s"%(string,fielddisplay(self,"q","q exponent"))
  • issm/trunk/src/m/classes/geometry.py

    r13395 r14310  
    3131                string="   geometry parameters:"
    3232
    33                 string="%s\n\n%s"%(string,fielddisplay(self,'surface','surface elevation'))
     33                string="%s\n%s"%(string,fielddisplay(self,'surface','surface elevation'))
    3434                string="%s\n%s"%(string,fielddisplay(self,'thickness','ice thickness'))
    3535                string="%s\n%s"%(string,fielddisplay(self,'bed','bed elevation'))
  • issm/trunk/src/m/classes/groundingline.py

    r13395 r14310  
    3030                string='   grounding line solution parameters:'
    3131
    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'''))
    3333                string="%s\n%s"%(string,fielddisplay(self,'melting_rate','melting rate applied when previously grounded parts start floating'))
    3434                return string
  • issm/trunk/src/m/classes/hydrology.py

    r13395 r14310  
    3232               
    3333                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)'))
    3535                string="%s\n%s"%(string,fielddisplay(self,'n','Manning roughness coefficient'))
    3636                string="%s\n%s"%(string,fielddisplay(self,'CR','tortuosity parameter'))
  • issm/trunk/src/m/classes/initialization.py

    r14067 r14310  
    9090                WriteData(fid,'data',self.pressure,'format','DoubleMat','mattype',1,'enum',PressureEnum())
    9191                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())
    9492                WriteData(fid,'data',self.watercolumn,'format','DoubleMat','mattype',1,'enum',WatercolumnEnum())
    9593                WriteData(fid,'data',self.waterfraction,'format','DoubleMat','mattype',1,'enum',WaterfractionEnum())
  • issm/trunk/src/m/classes/inversion.m

    r13395 r14310  
    3131                                case 0
    3232                                        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
    3357                                otherwise
    3458                                        error('constructor not supported');
     
    86110                        md = checkfield(md,'inversion.tao','values',[0 1]);
    87111                        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'});
    89114                        md = checkfield(md,'inversion.nsteps','numel',1,'>=',1);
    90115                        md = checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0);
    91116                        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:505]);
     117                        md = checkfield(md,'inversion.cost_functions','size',[md.inversion.nsteps num_costfunc],'values',[101:105 201 501:506]);
    93118                        md = checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
    94119                        md = checkfield(md,'inversion.gradient_only','values',[0 1]);
     
    99124                        if solution==BalancethicknessSolutionEnum()
    100125                                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);
    101128                        else
    102129                                md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
     
    105132                end % }}}
    106133                function disp(obj) % {{{
     134                        disp(sprintf('   inversion parameters:'));
    107135                        fielddisplay(obj,'iscontrol','is inversion activated?');
    108136                        fielddisplay(obj,'incomplete_adjoint','do we assume linear viscosity?');
     
    176204                        pos=find(data==504); data(pos)=ThicknessAlongGradientEnum();
    177205                        pos=find(data==505); data(pos)=ThicknessAcrossGradientEnum();
     206                        pos=find(data==506); data(pos)=BalancethicknessMisfitEnum();
    178207                        WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
    179208                        WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
  • issm/trunk/src/m/classes/inversion.py

    r13975 r14310  
    4545        def __repr__(self):
    4646                # {{{ Display
    47                 string='\n   Inversion parameters:'
     47                string='   inversion parameters:'
    4848                string="%s\n%s"%(string,fielddisplay(self,'iscontrol','is inversion activated?'))
    4949                string="%s\n%s"%(string,fielddisplay(self,'incomplete_adjoint','do we assume linear viscosity?'))
  • issm/trunk/src/m/classes/mask.m

    r12706 r14310  
    1212                vertexongroundedice  = NaN;
    1313                vertexonwater        = NaN;
     14                vertexonrock        = NaN;
    1415        end
    1516        methods
     
    3334                        md = checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
    3435                        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]);
    3537                end % }}}
    3638                function disp(obj) % {{{
     39                        disp(sprintf('   masks:'));
     40
    3741                        fielddisplay(obj,'elementonfloatingice','element on floating ice flags list');
    3842                        fielddisplay(obj,'vertexonfloatingice','vertex on floating ice flags list');
    3943                        fielddisplay(obj,'elementongroundedice','element on grounded ice  list');
    4044                        fielddisplay(obj,'vertexongroundedice','vertex on grounded ice flags list');
    41                         fielddisplay(obj,'elementonwater','element on water flags list');
     45                        fielddisplay(obj,'elementonwater','element on rock flags list');
    4246                        fielddisplay(obj,'vertexonwater','vertex on water flags list');
     47                        fielddisplay(obj,'vertexonrock','vertex on rock flags list');
    4348                end % }}}
    4449                function marshall(obj,fid) % {{{
  • issm/trunk/src/m/classes/mask.py

    r14067 r14310  
    2929        def __repr__(self):
    3030                # {{{ Display
     31                string="   masks:"
    3132
    32                 string="";
    3333                string="%s\n%s"%(string,fielddisplay(self,"elementonfloatingice","element on floating ice flags list"))
    3434                string="%s\n%s"%(string,fielddisplay(self,"vertexonfloatingice","vertex on floating ice flags list"))
  • issm/trunk/src/m/classes/matice.m

    r13395 r14310  
    8989                end % }}}
    9090                function disp(obj) % {{{
    91                         disp(sprintf('   Materials:\n'));
     91                        disp(sprintf('   Materials:'));
    9292
    9393                        fielddisplay(obj,'rho_ice','ice density [kg/m^3]');
  • issm/trunk/src/m/classes/matice.py

    r13975 r14310  
    3838                string="   Materials:"
    3939
    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]"))
    4141                string="%s\n%s"%(string,fielddisplay(self,"rho_water","water density [kg/m^3]"))
    4242                string="%s\n%s"%(string,fielddisplay(self,"rho_freshwater","fresh water density [kg/m^3]"))
  • issm/trunk/src/m/classes/mesh.py

    r14067 r14310  
    6363        def __repr__(self):
    6464                # {{{ Display
     65                string="   Mesh:"
     66
    6567
    6668                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:")
    6870                       
    6971                        string="%s\n%s"%(string,fielddisplay(self,"numberofelements2d","number of elements"))
     
    7375                        string="%s\n%s"%(string,fielddisplay(self,"y2d","vertices y coordinate"))
    7476
    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:")
    7678                else:
    77                         string="\n%s"%("      Elements and vertices:")
     79                        string="%s\n%s"%(string,"\n      Elements and vertices:")
    7880                string="%s\n%s"%(string,fielddisplay(self,"numberofelements","number of elements"))
    7981                string="%s\n%s"%(string,fielddisplay(self,"numberofvertices","number of vertices"))
     
    8587                string="%s\n%s"%(string,fielddisplay(self,"numberofedges","number of edges of the 2d mesh"))
    8688
    87                 string="%s%s"%(string,"\n      Properties:")
     89                string="%s%s"%(string,"\n\n      Properties:")
    8890                string="%s\n%s"%(string,fielddisplay(self,"dimension","mesh dimension (2d or 3d)"))
    8991                string="%s\n%s"%(string,fielddisplay(self,"numberoflayers","number of extrusion layers"))
     
    103105                string="%s\n%s"%(string,fielddisplay(self,"average_vertex_connectivity","average number of vertices connected to one vertex"))
    104106
    105                 string="%s%s"%(string,"\n      Extracted model:")
     107                string="%s%s"%(string,"\n\n      Extracted model:")
    106108                string="%s\n%s"%(string,fielddisplay(self,"extractedvertices","vertices extracted from the model"))
    107109                string="%s\n%s"%(string,fielddisplay(self,"extractedelements","elements extracted from the model"))
    108110
    109                 string="%s%s"%(string,"\n      Projection:")
     111                string="%s%s"%(string,"\n\n      Projection:")
    110112                string="%s\n%s"%(string,fielddisplay(self,"lat","vertices latitude"))
    111113                string="%s\n%s"%(string,fielddisplay(self,"long","vertices longitude"))
  • issm/trunk/src/m/classes/miscellaneous.py

    r13395 r14310  
    2929                string='   miscellaneous parameters:'
    3030
    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'))
    3232                string="%s\n%s"%(string,fielddisplay(self,'name','model name'))
    3333                string="%s\n%s"%(string,fielddisplay(self,'dummy','empty field to store some data'))
  • issm/trunk/src/m/classes/model/model.m

    r13975 r14310  
    212212                        md.mask.elementonwater=project2d(md,md.mask.elementonwater,1);
    213213                        md.mask.vertexonwater=project2d(md,md.mask.vertexonwater,1);
     214                        md.mask.vertexonrock=project2d(md,md.mask.vertexonrock,1);
    214215
    215216                        %lat long
     
    502503                                solutionfields=fields(md1.results);
    503504                                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});
    508520                                                if length(field)==numberofvertices1,
    509                                                         md2.results.(solutionfields{i}).(solutionsubfields{j})=field(pos_node);
     521                                                        md2.results.(solutionfields{i})=field(pos_node);
    510522                                                elseif length(field)==numberofelements1,
    511                                                         md2.results.(solutionfields{i}).(solutionsubfields{j})=field(pos_elem);
     523                                                        md2.results.(solutionfields{i})=field(pos_elem);
    512524                                                else
    513                                                         md2.results.(solutionfields{i}).(solutionsubfields{j})=field;
     525                                                        md2.results.(solutionfields{i})=field;
    514526                                                end
    515527                                        end
     
    744756                        md.mask.elementonwater=project3d(md,'vector',md.mask.elementonwater,'type','element');
    745757                        md.mask.vertexonwater=project3d(md,'vector',md.mask.vertexonwater,'type','node');
     758                        md.mask.vertexonrock=project3d(md,'vector',md.mask.vertexonrock,'type','node');
    746759                        if ~isnan(md.inversion.cost_functions_coefficients),md.inversion.cost_functions_coefficients=project3d(md,'vector',md.inversion.cost_functions_coefficients,'type','node');end;
    747760                        if ~isnan(md.inversion.min_parameters),md.inversion.min_parameters=project3d(md,'vector',md.inversion.min_parameters,'type','node');end;
     
    11201133                        disp(sprintf('%19s: %-22s -- %s','miscellaneous'   ,['[1x1 ' class(obj.miscellaneous) ']'],'miscellaneous fields'));
    11211134                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 % }}}
    11221151        end
    11231152 end
  • issm/trunk/src/m/classes/model/model.py

    r14067 r14310  
    4545from ElementConnectivity import *
    4646from contourenvelope import *
     47from PythonFuncs import *
    4748#}}}
    4849
     
    407408                                md2.diagnostic.icefront[:,2]=Pnode[md1.diagnostic.icefront[:,2].astype(int)-1]
    408409                                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],:]
    410411
    411412                #Results fields
  • issm/trunk/src/m/classes/organizer.m

    r13975 r14310  
    1313%      org = organizer('repository','Models/','prefix','AGU2015','steps',0);  %build an empty organizer object with a given repository
    1414
    15 classdef organizer
     15classdef organizer < handle
    1616    properties (SetAccess=private)
    1717                % {{{
     
    112112                        end
    113113                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%}}}
    114140                function bool=perform(org,string) % {{{
    115141
     
    142168                        end
    143169
    144                         %assign org back to calling workspace
    145                         assignin('caller',inputname(1),org);
    146 
    147170                end%}}}
    148171                function savemodel(org,md) % {{{
     
    162185                        save(name,'md','-v7.3');
    163186                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%}}}
    164207        end
    165208end
  • issm/trunk/src/m/classes/pairoptions.m

    r13975 r14310  
    55%      pairoptions=pairoptions('module',true,'solver',false);
    66
    7 classdef pairoptions
     7classdef pairoptions < handle
    88        properties (SetAccess = private,GetAccess = private)
    99                functionname = '';
    10                 list         = cell(0,2);
     10                list         = cell(0,3);
    1111        end
    1212        methods
     
    3838
    3939                        %Allocate memory
    40                         obj.list=cell(numoptions,2);
     40                        obj.list=cell(numoptions,3);
    4141
    4242                        %go through varargin and build list of obj
     
    4545                                        obj.list{i,1}=varargin{2*i-1};
    4646                                        obj.list{i,2}=varargin{2*i};
     47                                        obj.list{i,3}=false; %used?
    4748                                else
    4849                                        %option is not a string, ignore it
     
    5758                                obj.list{end+1,1} = field;
    5859                                obj.list{end,2}   = value;
     60                                obj.list{end,3}   = false;
    5961                        end
    6062                end % }}}
     
    6567                                        obj.list{end+1,1} = field;
    6668                                        obj.list{end,2}   = value;
     69                                        obj.list{end,3}   = true;  %It is a default so user will not be notified if not used
    6770                                end
    6871                        end
     
    8487                %CHANGEOPTIONVALUE - change the value of an option in an option list
    8588
    86                         %track occurance of field
     89                        %track occurrence of field
    8790                        lines=find(strcmpi(obj.list(:,1),field));
    8891
     
    9194                                %add new field if not found
    9295                                obj=addfield(obj,field,newvalue);
     96                                obj.list{end,3}=true; % do not notify user if unused
    9397                        else
    9498                                for i=1:length(lines),
     
    100104                %DELETEDUPLICATES - delete duplicates in an option list
    101105
    102                         %track the first occurance of each option
     106                        %track the first occurrence of each option
    103107                        [dummy lines]=unique(obj.list(:,1),'first');
    104108                        clear dummy
     
    109113                                for i=1:numoptions,
    110114                                        if ~ismember(i,lines),
    111                                                 disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurence will be kept'])
     115                                                disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurrence will be kept'])
    112116                                        end
    113117                                end
     
    116120                        %remove duplicates from the options list
    117121                        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
    118132                end % }}}
    119133                function disp(obj) % {{{
     
    137151                end % }}}
    138152                function bool = exist(obj,field) % {{{
    139                 %EXIST - check if the option exist
     153                %EXIST - check if the option exists
    140154
    141155                        %some argument checking:
     
    148162
    149163                        %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
    154174
    155175                        %check input
    156176                        if ~ischar(field),
    157                                 error('fieldoccurences error message: field should be a string');
    158                         end
    159 
    160                         %get number of occurence
     177                                error('fieldoccurrences error message: field should be a string');
     178                        end
     179
     180                        %get number of occurrence
    161181                        num=sum(strcmpi(field,obj.list(:,1)));
    162182                end % }}}
     
    187207                        pos=find(strcmpi(obj.list(:,1),field));
    188208                        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
    190211                                return;
    191212                        end
     
    204225                %      obj=removefield(obj,field,warn)
    205226                %
    206                 %   if warn==1 display an info message to wan user that
     227                %   if warn==1 display an info message to warn user that
    207228                %   some of his options have been removed.
    208229
  • issm/trunk/src/m/classes/pairoptions.py

    r13975 r14310  
    7878#       %DELETEDUPLICATES - delete duplicates in an option list
    7979#
    80 #               %track the first occurance of each option
     80#               %track the first occurrence of each option
    8181#               [dummy lines]=unique(obj.list(:,1),'first');
    8282#               clear dummy
     
    8787#                       for i=1:numoptions,
    8888#                               if ~ismember(i,lines),
    89 #                                       disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurence will be kept'])
     89#                                       disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurrence will be kept'])
    9090#                               end
    9191#                       end
     
    128128        # }}}
    129129
    130         #def fieldoccurences(self,field): #{{{
     130        #def fieldoccurrences(self,field): #{{{
    131131        #       '''
    132         #       FIELDOCCURENCES - get number of occurence of a field
     132        #       FIELDOCCURRENCES - get number of occurrence of a field
    133133        #       '''
    134134        #
    135135        #       #check input
    136136        #       if not isinstance(field,(str,unicode)):
    137         #               raise TypeError("fieldoccurences error message: field should be a string")
    138 
    139         #       #get number of occurence
     137        #               raise TypeError("fieldoccurrences error message: field should be a string")
     138
     139        #       #get number of occurrence
    140140        #       # ??
    141141        #       #return num
  • issm/trunk/src/m/classes/plotoptions.m

    r12706 r14310  
    6868
    6969                         %get number of data to be plotted
    70                          numberofplots=fieldoccurences(rawoptions,'data');
     70                         numberofplots=fieldoccurrences(rawoptions,'data');
    7171                         opt.numberofplots=numberofplots;
    7272
     
    112112                                                         continue;
    113113
    114                                                          %#all
     114                                                         %pound all
    115115                                                 elseif strcmpi(plotnum,'all');
    116116                                                         for j=1:numberofplots,
     
    118118                                                         end
    119119
    120                                                          %#i-j
     120                                                         %pound i-j
    121121                                                 elseif ismember('-',plotnum)
    122122                                                         nums=strsplit(plotnum,'-');
     
    129129                                                         end
    130130
    131                                                          %#i
     131                                                         %pound i
    132132                                                 else
    133133                                                         %assign to subplot
  • issm/trunk/src/m/classes/prognostic.py

    r13975 r14310  
    3232                # {{{ Display
    3333                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)'))
    3535                string="%s\n%s"%(string,fielddisplay(self,'min_thickness','minimum ice thickness allowed'))
    3636                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  
    620620                                dm.params.seed=false;
    621621                                dm.params.fixed_seed=false;
     622                                dm.params.rng=false;
    622623                                dm.params.samples=false;
    623624                                dm.params.sample_type='lhs';
  • issm/trunk/src/m/classes/qmu/@dakota_method/dmeth_params_write.m

    r13975 r14310  
    350350                param_write(fid,sbeg,'seed','             = ','\n',dm.params);
    351351                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
    352355                param_write(fid,sbeg,'samples','          = ','\n',dm.params);
    353356                param_write(fid,sbeg,'sample_type','        ','\n',dm.params);
  • issm/trunk/src/m/classes/radaroverlay.py

    r13395 r14310  
    2424                # {{{ Display
    2525                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)'))
    2727                string="%s\n%s"%(string,fielddisplay(self,'x','corresponding x coordinates'))
    2828                string="%s\n%s"%(string,fielddisplay(self,'y','corresponding y coordinates'))
  • issm/trunk/src/m/classes/rifts.py

    r13975 r14310  
    2929                string='   rifts parameters:'
    3030
    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, ...)'))
    3232                string="%s\n%s"%(string,fielddisplay(self,'riftproperties',''))
    3333                return string
  • issm/trunk/src/m/classes/settings.m

    r13395 r14310  
    3838                        %onto the model after a parallel run by waiting for the lock file
    3939                        %N minutes that is generated once the solution has converged
    40                         %0 to desactivate
     40                        %0 to deactivate
    4141                        obj.waitonlock=Inf;
    4242                end % }}}
     
    6565                        WriteData(fid,'object',obj,'fieldname','results_as_patches','format','Boolean');
    6666                        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
    6872                end % }}}
    6973        end
  • issm/trunk/src/m/classes/settings.py

    r13395 r14310  
    5656                #onto the model after a parallel run by waiting for the lock file
    5757                #N minutes that is generated once the solution has converged
    58                 #0 to desactivate
    59                 self.waitonlock=float('Inf')
     58                #0 to deactivate
     59                self.waitonlock=2**31-1
    6060
    6161                return self
     
    7777                WriteData(fid,'object',self,'fieldname','results_as_patches','format','Boolean')
    7878                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');
    8083        # }}}
    8184
  • issm/trunk/src/m/classes/solver.py

    r13395 r14310  
    33from iluasmoptions import *
    44from EnumToString import EnumToString
    5 from MatlabFuncs import *
     5from fielddisplay import fielddisplay
    66from EnumDefinitions import *
    77from checkfield import *
     8from MatlabFuncs import *
    89
    910class solver(object):
     
    4849                s ="List of solver options per analysis:\n\n"
    4950                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,'')
    5252
    5353                return s
  • issm/trunk/src/m/classes/surfaceforcings.m

    r13975 r14310  
    1111                issmbgradients = 0;
    1212                isdelta18o = 0;
    13                 hc = NaN;
    1413                href = NaN;
    1514                smbref = NaN;
    16                 smb_pos_max = NaN;
    17                 smb_pos_min = NaN;
    18                 a_pos = NaN;
    1915                b_pos = NaN;
    20                 a_neg = NaN;
    2116                b_neg = NaN;
    2217                monthlytemperatures = NaN;
     
    6156                                        end
    6257                                elseif(obj.issmbgradients)
    63                                         md = checkfield(md,'surfaceforcings.hc','forcing',1,'NaN',1);
    6458                                        md = checkfield(md,'surfaceforcings.href','forcing',1,'NaN',1);
    6559                                        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);
    6960                                        md = checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1);
    70                                         md = checkfield(md,'surfaceforcings.a_neg','forcing',1,'NaN',1);
    7161                                        md = checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1);
    7262                                else
     
    9282                        fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
    9383                        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');
    9584                        fielddisplay(obj,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method');
    9685                        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');
    10086                        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');
    10287                        fielddisplay(obj,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated');
    10388
     
    122107                        WriteData(fid,'object',obj,'fieldname','issmbgradients','format','Boolean');
    123108                        if obj.issmbgradients,
    124                                 WriteData(fid,'object',obj,'fieldname','hc','format','DoubleMat','mattype',1);
    125109                                WriteData(fid,'object',obj,'fieldname','href','format','DoubleMat','mattype',1);
    126110                                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);
    130111                                WriteData(fid,'object',obj,'fieldname','b_pos','format','DoubleMat','mattype',1);
    131                                 WriteData(fid,'object',obj,'fieldname','a_neg','format','DoubleMat','mattype',1);
    132112                                WriteData(fid,'object',obj,'fieldname','b_neg','format','DoubleMat','mattype',1);
    133113                        end
  • issm/trunk/src/m/classes/surfaceforcings.py

    r13975 r14310  
    2121                self.issmbgradients = 0
    2222                self.isdelta18o = 0
    23                 self.hc = float('NaN')
    2423                self.href = float('NaN')
    2524                self.smbref = float('NaN')
    26                 self.smb_pos_max = float('NaN')
    27                 self.smb_pos_min = float('NaN')
    28                 self.a_pos = float('NaN')
    2925                self.b_pos = float('NaN')
    30                 self.a_neg = float('NaN')
    3126                self.b_neg = float('NaN')
    3227                self.monthlytemperatures = float('NaN')
     
    4540                string="   surface forcings parameters:"
    4641
    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]'))
    4843                string="%s\n%s"%(string,fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]'))
    4944                string="%s\n%s"%(string,fielddisplay(self,'ispdd','is pdd activated (0 or 1, default is 0)'))
     
    5752                string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
    5853                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'))
    6054                string="%s\n%s"%(string,fielddisplay(self,'href',' reference elevation from which deviation is used to calculate SMB adjustment in smb gradients method'))
    6155                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'))
    6556                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'))
    6757                string="%s\n%s"%(string,fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'))
    6858
    6959                return string
    7060                #}}}
    71                
    7261        def setdefaultparameters(self):
    7362                # {{{setdefaultparameters
     
    9786                                        md = checkfield(md,'surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
    9887                        elif self.issmbgradients:
    99                                 md = checkfield(md,'surfaceforcings.hc','forcing',1,'NaN',1)
    10088                                md = checkfield(md,'surfaceforcings.href','forcing',1,'NaN',1)
    10189                                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)
    10590                                md = checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1)
    106                                 md = checkfield(md,'surfaceforcings.a_neg','forcing',1,'NaN',1)
    10791                                md = checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1)
    10892                        else:
     
    135119
    136120                if self.issmbgradients:
    137                         WriteData(fid,'object',self,'fieldname','hc','format','DoubleMat','mattype',1)
    138121                        WriteData(fid,'object',self,'fieldname','href','format','DoubleMat','mattype',1)
    139122                        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)
    143123                        WriteData(fid,'object',self,'fieldname','b_pos','format','DoubleMat','mattype',1)
    144                         WriteData(fid,'object',self,'fieldname','a_neg','format','DoubleMat','mattype',1)
    145124                        WriteData(fid,'object',self,'fieldname','b_neg','format','DoubleMat','mattype',1)
    146125        # }}}
  • issm/trunk/src/m/classes/thermal.py

    r13975 r14310  
    3232                # {{{ Display
    3333                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)'))
    3535                string="%s\n%s"%(string,fielddisplay(self,'stabilization','0->no, 1->artificial_diffusivity, 2->SUPG'))
    3636                string="%s\n%s"%(string,fielddisplay(self,'maxiter','maximum number of non linear iterations'))
  • issm/trunk/src/m/classes/timestepping.m

    r13395 r14310  
    66classdef timestepping
    77        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.;
    1111                time_adapt      = 0;
    12                 cfl_coefficient = 0;
     12                cfl_coefficient = 0.;
    1313        end
    1414        methods
     
    2424
    2525                        %time between 2 time steps
    26                         obj.time_step=1/2;
     26                        obj.time_step=1./2.;
    2727
    2828                        %final time
    29                         obj.final_time=10*obj.time_step;
     29                        obj.final_time=10.*obj.time_step;
    3030
    3131                        %time adaptation?
    3232                        obj.time_adapt=0;
    33                         obj.cfl_coefficient=.5;
     33                        obj.cfl_coefficient=0.5;
    3434                end % }}}
    3535                function md = checkconsistency(obj,md,solution,analyses) % {{{
  • issm/trunk/src/m/classes/timestepping.py

    r13395 r14310  
    1616        def __init__(self):
    1717                # {{{ 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.
    2121                self.time_adapt      = 0
    22                 self.cfl_coefficient = 0
     22                self.cfl_coefficient = 0.
    2323               
    2424                #set defaults
     
    2929                # {{{ Display
    3030                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]"))
    3232                string="%s\n%s"%(string,fielddisplay(self,"final_time","final time to stop the simulation [yrs]"))
    3333                string="%s\n%s"%(string,fielddisplay(self,"time_step","length of time steps [yrs]"))
     
    4141               
    4242                #time between 2 time steps
    43                 self.time_step=1/2
     43                self.time_step=1./2.
    4444
    4545                #final time
    46                 self.final_time=10*self.time_step
     46                self.final_time=10.*self.time_step
    4747
    4848                #time adaptation?
    4949                self.time_adapt=0
    50                 self.cfl_coefficient=.5
     50                self.cfl_coefficient=0.5
    5151
    5252                return self
  • issm/trunk/src/m/consistency/ismodelselfconsistent.m

    r13975 r14310  
    6969                analyses=[BalancethicknessAnalysisEnum()];
    7070
     71        case WeakBalancethicknessSolutionEnum(),
     72                numanalyses=1;
     73                analyses=[BalancethicknessAnalysisEnum()];
     74
    7175        case SurfaceSlopeSolutionEnum(),
    7276                numanalyses=1;
  • issm/trunk/src/m/contrib/bamg/YamsCall.m

    r13975 r14310  
    1616
    1717%2d geometric parameter (do not change)
    18 scale=2/9;
     18scale=2./9.;
    1919
    2020%Compute Hessian
     
    6060        triangles=[];
    6161        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)'];
    6363        end
    6464
     
    7676        %windows
    7777        system(['yams2-win -O 1 -v -0 -ecp -hgrad ' num2str(gradation)  ' carre0 carre1']);
    78 elseif ismac
     78elseif ismac()
    7979        %Macosx
    8080        system(['yams2-osx -O 1 -v -0 -ecp -hgrad ' num2str(gradation)  ' carre0 carre1']);
  • issm/trunk/src/m/enum/EnumDefinitions.py

    r13975 r14310  
    18491849        return StringToEnum('SurfaceforcingsMonthlytemperatures')[0]
    18501850
    1851 def SurfaceforcingsHcEnum():
    1852         """
    1853         SURFACEFORCINGSHCENUM - Enum of SurfaceforcingsHc
    1854 
    1855            Usage:
    1856               macro=SurfaceforcingsHcEnum()
    1857         """
    1858 
    1859         return StringToEnum('SurfaceforcingsHc')[0]
    1860 
    18611851def SurfaceforcingsHrefEnum():
    18621852        """
     
    18791869        return StringToEnum('SurfaceforcingsSmbref')[0]
    18801870
    1881 def SurfaceforcingsSmbPosMaxEnum():
    1882         """
    1883         SURFACEFORCINGSSMBPOSMAXENUM - Enum of SurfaceforcingsSmbPosMax
    1884 
    1885            Usage:
    1886               macro=SurfaceforcingsSmbPosMaxEnum()
    1887         """
    1888 
    1889         return StringToEnum('SurfaceforcingsSmbPosMax')[0]
    1890 
    1891 def SurfaceforcingsSmbPosMinEnum():
    1892         """
    1893         SURFACEFORCINGSSMBPOSMINENUM - Enum of SurfaceforcingsSmbPosMin
    1894 
    1895            Usage:
    1896               macro=SurfaceforcingsSmbPosMinEnum()
    1897         """
    1898 
    1899         return StringToEnum('SurfaceforcingsSmbPosMin')[0]
    1900 
    1901 def SurfaceforcingsAPosEnum():
    1902         """
    1903         SURFACEFORCINGSAPOSENUM - Enum of SurfaceforcingsAPos
    1904 
    1905            Usage:
    1906               macro=SurfaceforcingsAPosEnum()
    1907         """
    1908 
    1909         return StringToEnum('SurfaceforcingsAPos')[0]
    1910 
    19111871def SurfaceforcingsBPosEnum():
    19121872        """
     
    19191879        return StringToEnum('SurfaceforcingsBPos')[0]
    19201880
    1921 def SurfaceforcingsANegEnum():
    1922         """
    1923         SURFACEFORCINGSANEGENUM - Enum of SurfaceforcingsANeg
    1924 
    1925            Usage:
    1926               macro=SurfaceforcingsANegEnum()
    1927         """
    1928 
    1929         return StringToEnum('SurfaceforcingsANeg')[0]
    1930 
    19311881def SurfaceforcingsBNegEnum():
    19321882        """
     
    22192169        return StringToEnum('BalancethicknessSolution')[0]
    22202170
     2171def WeakBalancethicknessAnalysisEnum():
     2172        """
     2173        WEAKBALANCETHICKNESSANALYSISENUM - Enum of WeakBalancethicknessAnalysis
     2174
     2175           Usage:
     2176              macro=WeakBalancethicknessAnalysisEnum()
     2177        """
     2178
     2179        return StringToEnum('WeakBalancethicknessAnalysis')[0]
     2180
     2181def WeakBalancethicknessSolutionEnum():
     2182        """
     2183        WEAKBALANCETHICKNESSSOLUTIONENUM - Enum of WeakBalancethicknessSolution
     2184
     2185           Usage:
     2186              macro=WeakBalancethicknessSolutionEnum()
     2187        """
     2188
     2189        return StringToEnum('WeakBalancethicknessSolution')[0]
     2190
    22212191def BedSlopeAnalysisEnum():
    22222192        """
     
    32993269        return StringToEnum('Adjointz')[0]
    33003270
     3271def BalancethicknessMisfitEnum():
     3272        """
     3273        BALANCETHICKNESSMISFITENUM - Enum of BalancethicknessMisfit
     3274
     3275           Usage:
     3276              macro=BalancethicknessMisfitEnum()
     3277        """
     3278
     3279        return StringToEnum('BalancethicknessMisfit')[0]
     3280
    33013281def BedSlopeXEnum():
    33023282        """
     
    35693549        return StringToEnum('QmuMelting')[0]
    35703550
     3551def AndroidFrictionCoefficientEnum():
     3552        """
     3553        ANDROIDFRICTIONCOEFFICIENTENUM - Enum of AndroidFrictionCoefficient
     3554
     3555           Usage:
     3556              macro=AndroidFrictionCoefficientEnum()
     3557        """
     3558
     3559        return StringToEnum('AndroidFrictionCoefficient')[0]
     3560
    35713561def ResetPenaltiesEnum():
    35723562        """
     
    39993989        return StringToEnum('TransientInput')[0]
    40003990
    4001 def OutputfilenameEnum():
    4002         """
    4003         OUTPUTFILENAMEENUM - Enum of Outputfilename
    4004 
    4005            Usage:
    4006               macro=OutputfilenameEnum()
    4007         """
    4008 
    4009         return StringToEnum('Outputfilename')[0]
    4010 
    40113991def WaterfractionEnum():
    40123992        """
     
    49974977        """
    49984978
    4999         return 498
    5000 
     4979        return 496
     4980
  • issm/trunk/src/m/enum/MaximumNumberOfEnums.m

    r13975 r14310  
    99%      macro=MaximumNumberOfEnums()
    1010
    11 macro=498;
     11macro=496;
  • issm/trunk/src/m/exp/expwrite.m

    r13975 r14310  
    1515%   See also EXPDOC, EXPREAD, EXPWRITEASVERTICES
    1616
     17%check input variable
     18if ~isstruct(a),
     19        error('first argument is not a structure');
     20end
     21
     22%Add density if it's not there
     23if ~isfield(a,'density'),
     24        for n=1:length(a),
     25                a(n).density=1;
     26        end
     27end
     28
    1729fid=fopen(filename,'w');
    1830for n=1:length(a),
     
    2234
    2335        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);
    2937        else
    30                 fprintf(fid,'%s\n','## Name:');
     38                fprintf(fid,'%s%s\n','## Name:',filename);
    3139        end
    3240
     
    3543        fprintf(fid,'%i %f\n',[length(a(n).x) a(n).density]);
    3644        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(:)]');
    3846        fprintf(fid,'\n');
    3947
  • issm/trunk/src/m/exp/expwrite.py

    r13395 r14310  
    2525   
    2626                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']))
    3128                else:
    32                         fid.write("%s\n" % '## Name:')
     29                        fid.write("%s%s\n" % ('## Name:',filename))
    3330   
     31                #Add density if it's not there
     32                if 'density' not in contour:
     33                        contour['density']=1
     34
    3435                fid.write("%s\n" % '## Icon:0')
    3536                fid.write("%s\n" % '# Points Count Value')
  • issm/trunk/src/m/exp/flowlines.m

    r13395 r14310  
    3838
    3939%check seed points
    40 tria=TriaSearch(index,x,y,x0,y0);
     40%tria=TriaSearch(index,x,y,x0,y0);
     41tria=tsearch(x,y,index,x0,y0);
    4142pos=find(isnan(tria));
    4243x0(pos)=[];
     
    6970        %find current triangle
    7071        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));
    7274
    7375        %check that the point is actually inside a triangle of the mesh
     
    118120        %find current triangle
    119121        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));
    121124
    122125        %check that the point is actually inside a triangle of the mesh
  • issm/trunk/src/m/geometry/FlagElements.py

    r14067 r14310  
    44from ContourToMesh import *
    55from MatlabFuncs import *
     6from PythonFuncs import *
    67
    78def FlagElements(md,region):
     
    4344                                raise RuntimeError("FlagElements.py calling basinzoom.py is not complete.")
    4445                                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])
    4647                                flag=numpy.prod(flag_nodes[md.mesh.elements],axis=1).astype(bool)
    4748                        else:
    4849                                #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)
    5051                                flag=flag.astype(bool)
    5152
  • issm/trunk/src/m/mech/mechanicalproperties.m

    r13975 r14310  
    119119
    120120strainrate=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/s
     121strainrate.xx=ux*md.constants.yts; %strain rate in 1/a instead of 1/s
     122strainrate.yy=vy*md.constants.yts;
     123strainrate.xy=uyvx*md.constants.yts;
     124strainrate.principalvalue1=valuesstrain(:,1)*md.constants.yts;
    125125strainrate.principalaxis1=directionsstrain(:,1:2);
    126 strainrate.principalvalue2=valuesstrain(:,2)*(365.25*24*3600); %strain rate in 1/a instead of 1/s
     126strainrate.principalvalue2=valuesstrain(:,2)*md.constants.yts;
    127127strainrate.principalaxis2=directionsstrain(:,3:4);
    128128strainrate.effectivevalue=1/sqrt(2)*sqrt(strainrate.xx.^2+strainrate.yy.^2+2*strainrate.xy.^2);
  • issm/trunk/src/m/mesh/ComputeMetric.m

    r13975 r14310  
    1313lambda1=0.5*((a+d)+sqrt(4.*b.^2+(a-d).^2));
    1414lambda2=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);
     15pos1=find(lambda1==0.);
     16pos2=find(lambda2==0.);
     17pos3=find(b==0. & lambda1==lambda2);
    1818
    1919%Modify the eigen values to control the shape of the elements
  • issm/trunk/src/m/mesh/ComputeMetric.py

    r13975 r14310  
    1919        lambda1=0.5*((a+d)+numpy.sqrt(4.*b**2+(a-d)**2))
    2020        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]
    2424
    2525        #Modify the eigen values to control the shape of the elements
     
    5454        #take care of NaNs if any (use Numpy eig in a loop)
    5555        pos=numpy.nonzero(numpy.isnan(metric))[0]
    56         if pos:
     56        if numpy.size(pos):
    5757                print(" %i NaN found in the metric. Use Numpy routine..." % numpy.size(pos))
    5858                for posi in pos:
  • issm/trunk/src/m/mesh/ElementsFromEdge.py

    r13975 r14310  
    11import numpy
     2from PythonFuncs import *
    23
    34def ElementsFromEdge(elements,A,B):
     
    1213
    1314        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), \
    2421                ))[0]+1
    2522
  • issm/trunk/src/m/mesh/bamg.py

    r14067 r14310  
    9292                        #Checks that all holes are INSIDE the principle domain outline
    9393                        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)
    9595                                if numpy.any(numpy.logical_not(flags)):
    9696                                        raise RuntimeError("bamg error message: All holes should be strictly inside the principal domain")
     
    118118
    119119                                #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)
    121121                                if numpy.all(numpy.logical_not(flags)):
    122122                                        raise RuntimeError("one rift has all its points outside of the domain outline")
  • issm/trunk/src/m/mesh/rifts/meshprocessoutsiderifts.py

    r14067 r14310  
    1616       
    1717                #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)
    1919
    2020                tips=rift.tips
  • issm/trunk/src/m/mesh/rifts/meshprocessrifts.py

    r14067 r14310  
    4949
    5050        #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)
    5252        found=0
    5353        for rift in md.rifts.riftstruct:
  • issm/trunk/src/m/mesh/squaremesh.m

    r13395 r14310  
    1515
    1616%initialization
    17 segments=zeros(0,3);
    1817index=zeros(nel,3);
    1918x=zeros(nx*ny,1);
     
    2322for n=1:nx,
    2423        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.);
    2726        end
    2827end
  • issm/trunk/src/m/miscellaneous/MatlabFuncs.py

    r13975 r14310  
    88
    99        if 'Windows' in platform.system():
     10                return True
     11        else:
     12                return False
     13
     14def ismac():
     15        import platform
     16
     17        if 'Darwin' in platform.system():
    1018                return True
    1119        else:
     
    8997        return a
    9098
     99def 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  
    101101        els2=mesh.elementconnectivity(el1,find(mesh.elementconnectivity(el1,:)));
    102102        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,:));
    104104                nods1=mesh.elements(el1,:);
    105105                nods1(find(nods1==flag))=[];
  • issm/trunk/src/m/parameterization/contourenvelope.py

    r14067 r14310  
    9999                els2=mesh.elementconnectivity[el1,numpy.nonzero(mesh.elementconnectivity[el1,:])[0]]-1
    100100                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,:])
    102102                        nods1=mesh.elements[el1,:]
    103103                        nods1=numpy.delete(nods1,numpy.nonzero(nods1==flag))
  • issm/trunk/src/m/parameterization/setflowequation.py

    r14067 r14310  
    33from pairoptions import *
    44from MatlabFuncs import *
     5from PythonFuncs import *
    56from FlagElements import *
    67
     
    5051        #Flag the elements that have not been flagged as filltype
    5152        if   strcmpi(filltype,'hutter'):
    52                 hutterflag[numpy.nonzero(numpy.logical_not(numpy.logical_or(macayealflag,pattynflag)))]=True
     53                hutterflag[numpy.nonzero(numpy.logical_not(logical_or_n(macayealflag,pattynflag)))]=True
    5354        elif strcmpi(filltype,'macayeal'):
    54                 macayealflag[numpy.nonzero(numpy.logical_not(numpy.logical_or(hutterflag,numpy.logical_or(pattynflag,stokesflag))))]=True
     55                macayealflag[numpy.nonzero(numpy.logical_not(logical_or_n(hutterflag,pattynflag,stokesflag)))]=True
    5556        elif strcmpi(filltype,'pattyn'):
    56                 pattynflag[numpy.nonzero(numpy.logical_not(numpy.logical_or(hutterflag,numpy.logical_or(macayealflag,stokesflag))))]=True
     57                pattynflag[numpy.nonzero(numpy.logical_not(logical_or_n(hutterflag,macayealflag,stokesflag)))]=True
    5758
    5859        #check that each element has at least one flag
     
    6970        #Check that no pattyn or stokes for 2d mesh
    7071        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)):
    7273                        raise TypeError("stokes and pattyn elements not allowed in 2d mesh, extrude it first")
    7374
  • issm/trunk/src/m/plot/applyoptions.m

    r14067 r14310  
    331331end
    332332
    333 %position of figure
    334 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                 else
    371                         disp('''figposition'' string not supported yet');
    372                 end
    373         else
    374                 set(gcf,'Position',figposition);
    375         end
    376 
    377 end
    378 
    379333%axes position
    380334if exist(options,'axesPosition')
     
    446400set(gca,'color',getfieldvalue(options,'backgroundcolor','none'));
    447401
    448 %figurebackgrounbcolor
    449 set(gcf,'color',getfieldvalue(options,'figurebackgroundcolor','w'));
    450 
    451402%lighting
    452403if strcmpi(getfieldvalue(options,'light','off'),'on'),
  • issm/trunk/src/m/plot/applyoptions.py

    r13975 r14310  
     1from matplotlib.ticker import MaxNLocator
    12
    23try:
     
    107108        #}}}
    108109
     110        #ticklabel notation {{{
     111        p.gca().ticklabel_format(style='sci',scilimits=(0,0))
     112        #}}}
     113
    109114        #ticklabelfontsize {{{
    110115        if options.exist('ticklabelfontsize'):
     
    116121                                label.set_fontsize(options.getfieldvalue('ticklabelfontsize'))
    117122        #}}}
     123
    118124        #view
    119125
     
    137143        #ShowBasins
    138144
    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        #}}}
    140153
    141154        #shading
     
    152165
    153166        #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()
    156174        #}}}
    157175
  • issm/trunk/src/m/plot/checkplotoptions.m

    r13975 r14310  
    8181        end
    8282        textweightvalues=repmat(textweightvalues,1,numtext); textweightvalues(numtext+1:end)=[];
     83
    8384        %3: textsize
    8485        if exist(options,'textsize'),
     
    107108        end
    108109        textcolorvalues=repmat(textcolorvalues,1,numtext); textcolorvalues(numtext+1:end)=[];
    109         %4: textposition
     110        %5: textposition
    110111        if exist(options,'textposition'),
    111112                textpositionvalues=getfieldvalue(options,'textposition');
     
    191192        if strcmpi(getfieldvalue(options,'scaleruler'),'on')
    192193                %default values
    193                 Lx=max(md.mesh.y)-min(md.mesh.y);
     194                Lx=max(md.mesh.x)-min(md.mesh.x);
    194195                Ly=max(md.mesh.y)-min(md.mesh.y);
    195196                %default values
  • issm/trunk/src/m/plot/checkplotoptions.py

    r13975 r14310  
     1import numpy as npy
     2
    13def checkplotoptions(md,options):
    24        '''
     
    1113        '''
    1214
    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
    14141        return options
    15 
  • issm/trunk/src/m/plot/kmlgroundoverlay.m

    r13975 r14310  
    3434
    3535%print image at high resolution
    36 printmodel([kmlroot '/' kmlimagename],kmlimagetype,'trim','on','resolution',kmlresolution,'margin','off','frame','off');
     36export_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');
    3738
    3839%now write kml file
  • issm/trunk/src/m/plot/latlonoverlay.m

    r13975 r14310  
    8787                if (xcorner>xlimits(1) & xcorner<xlimits(2) & ycorner>ylimits(1) & ycorner<ylimits(2)),
    8888                        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']; end
     89                        if lat<0, label=[num2str(abs(lat)) '^{\circ} S'];
     90                        else      label=[num2str(abs(lat)) '^{\circ} N']; end
    9191                        th=text(xcorner,ycorner,label);
    9292                        set(th,'Color',colornumber,'Rotation',angle,'FontSize',fontsize,'HorizontalAlignment','center','VerticalAlignment','middle','Clipping','on');
     
    130130                if (xcorner>xlimits(1) & xcorner<xlimits(2) & ycorner>ylimits(1) & ycorner<ylimits(2)),
    131131                        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']; end
     132                        if lon<0, label=[num2str(abs(lon)) '^{\circ} W'];
     133                        else      label=[num2str(abs(lon)) '^{\circ} E']; end
    134134                        th=text(xcorner,ycorner,label);
    135135                        set(th,'Color',colornumber,'Rotation',angle,'FontSize',fontsize,'HorizontalAlignment','center','VerticalAlignment','middle','Clipping','on');
  • issm/trunk/src/m/plot/plot_BC.m

    r13975 r14310  
    77
    88%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');
     9dirichleton=getfieldvalue(options,'dirichlet','on');
     10if 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');
     26end
    2427
    2528%update legend
    2629[legend_h,object_h,plot_h,text_strings]=legend();
    2730legend('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
     31if 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
     38end
    3439legend(plot_h,text_strings,'location','NorthEast')
    3540
  • issm/trunk/src/m/plot/plot_gridded.m

    r13395 r14310  
    2424[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);
    2525if 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');
    2727end
    2828
  • issm/trunk/src/m/plot/plot_manager.py

    r13975 r14310  
    5757
    5858        #standard plot
    59         p.subplot(nlines,ncols,i)
     59        p.subplot(nlines,ncols,i,aspect='equal')
    6060
    6161        #plot unit
     
    6464        #apply all options
    6565        applyoptions(md,data2,options)
    66 
     66       
    6767        #ground overlay on kml plot_unit
  • issm/trunk/src/m/plot/plot_mesh.py

    r13975 r14310  
    2121
    2222        if is2d:
    23                 p.subplot(nlines,ncols,i)
     23                p.subplot(nlines,ncols,i,aspect='equal')
    2424                p.triplot(x,y,elements)
    2525        else:
  • issm/trunk/src/m/plot/plotmodel.m

    r13975 r14310  
    3434
    3535        %Create figure
     36        f=figure(figurenumber);clf;
    3637        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');
    4139        end
    4240
    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'));
    4586
    4687        %Go through all data plottable and close window if an error occurs
     
    4889                for i=1:numberofplots,
    4990                        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})
    5093                end
    5194        catch me,
  • issm/trunk/src/m/plot/plotmodel.py

    r13975 r14310  
     1import numpy as npy
    12
    23try:
     
    2122        subplotwidth=ceil(sqrt(options.numberofplots))
    2223       
     24        #Get figure number and number of plots
     25        figurenumber=options.figurenumber
     26        numberofplots=options.numberofplots
     27
    2328        #if nlines and ncols specified, then bypass
    2429        if options.list[0].exist('nlines'):
     
    2631                nl=True
    2732        else:
    28                 nlines=subplotwidth
     33                nlines=npy.ceil(numberofplots/subplotwidth)
    2934                nl=False
    3035       
     
    4045                raise StandardError('error: nlines and ncols need to be specified together, or not at all')
    4146       
    42         #Get figure number and number of plots
    43         figurenumber=options.figurenumber
    44         numberofplots=options.numberofplots
    4547       
    4648        #Go through plots
     
    6062                #try:
    6163                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)
    6365                #except StandardError:
    6466                #       print 'error in plot_manager'
    6567        else:
    6668                raise StandardError('plotmodel error message: no output data found.')
    67                        
  • issm/trunk/src/m/qmu/dakota_cdfs.m

    r13975 r14310  
    247247        irow=irow+1;
    248248        cdf(irow,1)=resp(i);
    249         cdf(irow,2)=normcdf(resp(i),mu,sigma);
     249        cdf(irow,2)=normcdf_issm(resp(i),mu,sigma);
    250250        cdf(irow,3)=(mu-resp(i))/sigma;
    251251        cdf(irow,4)=(mu-resp(i))/sigma;
     
    256256    for i=1:length(prob)
    257257        irow=irow+1;
    258         cdf(irow,1)=norminv(prob(i),mu,sigma);
     258        cdf(irow,1)=norminv_issm(prob(i),mu,sigma);
    259259        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);
    262262    end
    263263
     
    267267        irow=irow+1;
    268268        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);
    270270        cdf(irow,3)=rel(i);
    271271        cdf(irow,4)=rel(i);
     
    277277        irow=irow+1;
    278278        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);
    280280        cdf(irow,3)=grel(i);
    281281        cdf(irow,4)=grel(i);
  • issm/trunk/src/m/qmu/dakota_moments.m

    r13975 r14310  
    133133    sigma=std(samp);
    134134
    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
    139146
    140147end
  • issm/trunk/src/m/qmu/dakota_out_parse.m

    r13975 r14310  
    112112    elseif strncmp(fline,'Moments for each response function',34)
    113113        [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);
    114116    elseif strncmp(fline,'95% confidence intervals for each response function',51)
    115117        [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)
    117120        [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);
    118123    elseif strncmp(fline,'Simple Correlation Matrix',25)
    119124        [scm]=corrmat_read(fidi,'Simple Correlation Matrix',fline);
     
    137142    else
    138143        display(['Unexpected line: ' deblank(fline)]);
    139         fline=fgetl(fidi);
    140144    end
    141145    fline=fgetl(fidi);
     
    198202    %dstddev=std    (data,0);
    199203    [dmean,dstddev,dmeanci,dstddevci]=...
    200         normfit(data,0.05);
     204        normfit_issm(data,0.05);
    201205else
    202206    dmean    =zeros(1,size(data,2));
     
    206210    for i=1:size(data,2)
    207211        [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
     214end
     215
     216dmin   =min         (data,[],1);
     217dquart1=prctile_issm(data,25,1);
     218dmedian=median      (data,1);
     219dquart3=prctile_issm(data,75,1);
     220dmax   =max         (data,[],1);
    217221
    218222%  same as Dakota scm, Excel correl
     
    316320end
    317321
     322%%  function to find and read the moment-based statistics
     323
     324function [dresp]=mbstats_read(fidi,dresp,fline)
     325
     326if ~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
     331end
     332
     333display('Reading moment-based statistics for response functions:');
     334
     335%  skip column headings of moment-based statistics
     336
     337    fline=fgetl(fidi);
     338
     339while 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};
     354end
     355
     356display(sprintf('  Number of Dakota response functions=%d.',...
     357    length(dresp)));
     358
     359end
     360
    318361%%  function to find and read the confidence intervals
    319362
     
    336379    end
    337380    [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
    338391
    339392%  find response function associated with confidence intervals
     
    354407%  add confidence intervals to response functions
    355408
    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
    360420end
    361421
     
    372432    [fline]=findline(fidi,'Probabilities for each response function');
    373433    if ~ischar(fline)
    374         return
     434        [fline]=findline(fidi,'Level mappings for each response function');
     435        if ~ischar(fline)
     436            return
     437        end
    375438    end
    376439end
     
    425488                    dresp(idresp).cdf(icdf,i)=tokens{1}{itoken};
    426489                end
    427             end;
     490            end
     491            fline=fgetl(fidi);
     492        end
     493    end
     494end
     495
     496display(sprintf('  Number of Dakota response functions=%d.',...
     497    length(dresp)));
     498
     499end
     500
     501%%  function to find and read the pdf's
     502
     503function [dresp]=pdfs_read(fidi,dresp,fline)
     504
     505if ~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
     510end
     511
     512display('Reading PDF''s for response functions:');
     513
     514while 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
    428557            fline=fgetl(fidi);
    429558        end
  • issm/trunk/src/m/qmu/plot/plot_cdf.m

    r13975 r14310  
    139139        if strncmpi(cplot,'p',1) && ...
    140140           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);
    142142        else
    143              ydata(1:lcdfr(i),i)=        dresp(i).cdf(:,iplot);
     143             ydata(1:lcdfr(i),i)=             dresp(i).cdf(:,iplot);
    144144        end
    145145    end
     
    237237    end
    238238
    239     tick  = norminv(yprob,0,1);
     239    tick  = norminv_issm(yprob,0,1);
    240240    set(ax1,'YTick',tick,'YTickLabel',label);
    241241    ylim([tick(1) tick(end)])
  • issm/trunk/src/m/qmu/plot/plot_hist_norm.m

    r13975 r14310  
    224224if exist('mu','var') && exist('sigma','var')
    225225    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));
    227227        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));
    231231        if exist('descr','var')
    232232            descr(end+1)={[descr{i} ' norm']};
  • issm/trunk/src/m/qmu/plot/plot_hist_norm_ci.m

    r13975 r14310  
    129129%  calculate 95% confidence intervals (same as dakota)
    130130        [mu(i),sigma(i),muci(:,i),sigmaci(:,i)]=...
    131             normfit(sampr(:,i),0.05);
     131            normfit_issm(sampr(:,i),0.05);
    132132    end
    133133    display('Using calculated normal fits.')
     
    191191if exist('mu','var') && exist('sigma','var')
    192192    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));
    194194        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));
    198198        if exist('descr','var')
    199199            descr(end+1)={[descr{i} ' norm']};
     
    204204if exist('muci','var') && exist('sigmaci','var')
    205205    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));
    207207        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));
    211211        if exist('descr','var')
    212212            descr(end+1)={[descr{i} ' norm-+']};
     
    214214    end
    215215    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));
    217217        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));
    221221        if exist('descr','var')
    222222            descr(end+1)={[descr{i} ' norm--']};
     
    224224    end
    225225    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));
    227227        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));
    231231        if exist('descr','var')
    232232            descr(end+1)={[descr{i} ' norm+-']};
     
    234234    end
    235235    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));
    237237        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));
    241241        if exist('descr','var')
    242242            descr(end+1)={[descr{i} ' norm++']};
  • issm/trunk/src/m/qmu/plot/plot_normdist_bars.m

    r13975 r14310  
    126126if ~isfield(dresp,'mean') || ~isfield(dresp,'stddev')
    127127    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);
    129129    end
    130130end
     
    141141for i=1:length(dresp)
    142142    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);
    144144end
    145145
  • issm/trunk/src/m/qmu/plot/plot_rlev_bars_ci.m

    r13975 r14310  
    133133        [dresp(i).mean,dresp(i).stddev,...
    134134         dresp(i).meanci,dresp(i).stddevci]=...
    135             normfit(sampr(:,i),0.05);
     135            normfit_issm(sampr(:,i),0.05);
    136136        display('Using calculated normal fits from sample data.')
    137137    end
     
    140140%  use minus/plus integer standard deviations
    141141        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);
    145145        display('Using integer standard deviations for percentages.')
    146146
     
    176176           isfield(dresp(i),'stddev') && ~isempty(dresp(i).stddev)
    177177            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);
    179179        end
    180180        if isfield(dresp(i),'meanci'  ) && ~isempty(dresp(i).meanci  ) && ...
     
    184184            descr(end+1)=cellstr([dresp(i).descriptor ' norm+-']);
    185185            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));
    190190        end
    191191    end
  • issm/trunk/src/m/qmu/plot/plot_sampdist_bars.m

    r13975 r14310  
    127127   ~isfield(dresp,'max')
    128128    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);
    134134    end
    135135end
  • issm/trunk/src/m/solve/parseresultsfromdisk.py

    r13975 r14310  
    4343        result=ReadData(fid)
    4444        while result:
    45                 if result['step'] > len(results):
     45                if   result['step'] > len(results):
    4646                        for i in xrange(len(results),result['step']-1):
    4747                                results.append(None)
    4848                        results.append(resultsclass.results())
     49                elif results[result['step']-1] is None:
     50                        results[result['step']-1]=resultsclass.results()
    4951                #Get time and step
    5052                setattr(results[result['step']-1],'step',result['step'])
  • issm/trunk/src/m/solve/process_solve_options.m

    r13395 r14310  
    1111if ~ismember(solution_type,[DiagnosticSolutionEnum(),PrognosticSolutionEnum(),ThermalSolutionEnum(),...
    1212                SteadystateSolutionEnum(),TransientSolutionEnum(),EnthalpySolutionEnum(),...
    13                 BalancethicknessSolutionEnum(),BedSlopeSolutionEnum(),SurfaceSlopeSolutionEnum(),HydrologySolutionEnum(),FlaimSolutionEnum()]),
     13                BalancethicknessSolutionEnum(),WeakBalancethicknessSolutionEnum(),BedSlopeSolutionEnum(),...
     14                SurfaceSlopeSolutionEnum(),HydrologySolutionEnum(),FlaimSolutionEnum()]),
    1415        error(['process_solve_options error message: solution_type ' EnumToString(solution_type) ' not supported yet!']);
    1516end
  • issm/trunk/src/wrappers/Exp2Kml/Exp2Kml.h

    r13749 r14310  
    5151
    5252#endif
    53 
  • issm/trunk/src/wrappers/InternalFront/InternalFront.cpp

    r13250 r14310  
    1414        bool*   elementonwater=NULL;
    1515        int*    elements=NULL;
    16         int*    connectivity=NULL;
    1716        int*    elementconnectivity=NULL;
    1817        int*    front=NULL;
     
    2019        bool    found;
    2120        int     numberofelements,numberofsegments;
    22         int     N,M;
    2321        int     i,j,ii,jj,id;
     22        int     dummy;
    2423
    2524        /*Boot module: */
    2625        MODULEBOOT();
    2726
    28         /*checks on arguments on the matlab side: */
    29         CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InternalFrontUsage);
     27        /*checks on arguments: */
     28        CHECKARGUMENTS(NLHS,NRHS,&InternalFrontUsage);
    3029
    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);
    4034
    4135        /*Allocate and initialize all variables*/
  • issm/trunk/src/wrappers/InternalFront/InternalFront.h

    r13749 r14310  
    2727#ifdef _HAVE_MATLAB_MODULES_
    2828/* serial input macros: */
    29 #define MODEL prhs[0]
     29#define ELEMENTS prhs[0]
     30#define ELEMENTONWATER prhs[1]
     31#define ELEMENTCONNECTIVITY prhs[2]
    3032/* serial output macros: */
    3133#define FRONT (mxArray**)&plhs[0]
     
    3436#ifdef _HAVE_PYTHON_MODULES_
    3537/* 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)
    3741/* serial output macros: */
    3842#define FRONT output,0]
     
    4347#define NLHS  1
    4448#undef NRHS
    45 #define NRHS  1
     49#define NRHS  3
    4650
    4751#endif
  • issm/trunk/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp

    r13864 r14310  
    4545       
    4646        //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;
    5151
    5252        /* output: */
     
    8282                *(contours+i)=(Contour<double>*)domain->GetObjectByOffset(i);
    8383
    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 
    9584        /*Run interpolation routine: */
    9685        MeshProfileIntersectionx(&segments,&numsegs,index,x,y,nel,nods,contours,numcontours);
  • issm/trunk/src/wrappers/TriMesh/TriMesh.cpp

    r13355 r14310  
    2222
    2323        /* output: */
    24         SeqMat<double> *index             = NULL;
     24        SeqMat<int>    *index             = NULL;
    2525        SeqVec<double> *x                 = NULL;
    2626        SeqVec<double> *y                 = NULL;
    27         SeqMat<double> *segments          = NULL;
    28         SeqVec<double> *segmentmarkerlist = NULL;
     27        SeqMat<int>    *segments          = NULL;
     28        SeqVec<int>    *segmentmarkerlist = NULL;
    2929
    3030        /*Boot module: */
  • issm/trunk/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp

    r13639 r14310  
    1818        /* input: */
    1919        int     nel,nods;
    20         double *index          = NULL;
     20        int    *index          = NULL;
    2121        double *x              = NULL;
    2222        double *y              = NULL;
    23         double *segments       = NULL;
    24         double *segmentmarkers = NULL;
     23        int    *segments       = NULL;
     24        int    *segmentmarkers = NULL;
    2525        int     num_seg;
    2626
  • issm/trunk/src/wrappers/matlab/Makefile.am

    r13831 r14310  
    4848                                                 ElementConnectivity.la\
    4949                                                 EnumToString.la\
     50                                                 ExpSimplify.la\
    5051                                                 HoleFiller.la\
    5152                                                 InternalFront.la\
     
    7677                                   KMLMeshWrite.la\
    7778                                   KMLOverlay.la\
    78                                    Shp2Kml.la\
    7979                                   Exp2Kml.la\
    80                                    Kml2Exp.la
     80                                   Kml2Exp.la\
     81                                   Shp2Exp.la\
     82                                   Shp2Kml.la
    8183endif
    8284endif
     
    210212Ll2xy_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
    211213
     214ExpSimplify_la_SOURCES = ../ExpSimplify/ExpSimplify.cpp\
     215                                                        ../ExpSimplify/ExpSimplify.h
     216ExpSimplify_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
     217
    212218Exp2Kml_la_SOURCES = ../Exp2Kml/Exp2Kml.cpp\
    213219                                                        ../Exp2Kml/Exp2Kml.h
     
    246252Scotch_la_LIBADD = ${deps} $(SCOTCHLIB) $(MPILIB)
    247253
     254Shp2Exp_la_SOURCES = ../Shp2Exp/Shp2Exp.cpp\
     255                                                        ../Shp2Exp/Shp2Exp.h
     256Shp2Exp_la_LIBADD = ${deps} $(SHAPELIBLIB) $(MPILIB) $(PETSCLIB)
     257
    248258Shp2Kml_la_SOURCES = ../Shp2Kml/Shp2Kml.cpp\
    249259                                                        ../Shp2Kml/Shp2Kml.h
  • issm/trunk/src/wrappers/matlab/include/wrapper_macros.h

    r13749 r14310  
    1919 * will be trapped*/
    2020#define MODULEBOOT(); try{ \
    21         IssmComm::SetComm(-1);
     21        IssmComm::SetComm();
    2222
    2323#define MODULEEND(); }\
  • issm/trunk/src/wrappers/matlab/io/WriteMatlabData.cpp

    r13749 r14310  
    290290}
    291291/*}}}*/
     292/*FUNCTION WriteData(mxArray** pdataref,SeqMat<int>* matrix){{{*/
     293void 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){{{*/
     331void 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/*}}}*/
    292361/*FUNCTION WriteData(mxArray** pdataref,RiftStruct* riftstruct){{{*/
    293362void WriteData(mxArray** pdataref,RiftStruct* riftstruct){
     
    363432}
    364433/*}}}*/
     434/*FUNCTION SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int M,int N,int* fieldpointer){{{*/
     435void 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/*}}}*/
    365446/*FUNCTION SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int field){{{*/
    366447void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int fieldin){
  • issm/trunk/src/wrappers/matlab/io/matlabio.h

    r13749 r14310  
    1717#include "../../c/include/include.h"
    1818
     19void WriteData(mxArray** pdataref,SeqMat<int>* matrix);
    1920void WriteData(mxArray** pdataref,SeqMat<double>* matrix);
    2021void WriteData(mxArray** pdataref,double* matrix, int M,int N);
    2122void WriteData(mxArray** pdataref,int*    matrix, int M,int N);
     23void WriteData(mxArray** pdataref,SeqVec<int>* vector);
    2224void WriteData(mxArray** pdataref,SeqVec<double>* vector);
    2325void WriteData(mxArray** pdataref,double* vector, int M);
     
    6466void SetStructureField(mxArray* dataref,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
    6567void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
     68void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int fieldrows,int fieldcols,int*    fieldpointer);
    6669void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int field);
    6770void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,double field);
  • issm/trunk/src/wrappers/python/include/wrapper_macros.h

    r13749 r14310  
    2323        if(!output) return NULL;\
    2424        try{ \
    25         IssmComm::SetComm(-1);
     25        IssmComm::SetComm();
    2626
    2727#define MODULEEND(); }\
  • issm/trunk/src/wrappers/python/io/FetchPythonData.cpp

    r14067 r14310  
    2020void FetchData(double* pscalar,PyObject* py_float){
    2121
    22         double scalar;
     22        double dscalar;
    2323
    2424        /*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){{{*/
     45void FetchData(int* pscalar, PyObject* py_long){
     46
     47        int iscalar;
    3548
    3649        /*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){{{*/
     70void 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;
    5790}
    5891/*}}}*/
     
    72105        int i;
    73106
    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        }
    113162
    114163        /*output: */
     
    133182        int i;
    134183
    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){{{*/
     247void 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        }
    174316
    175317        /*output: */
     
    194336        int i;
    195337
    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){{{*/
     402void 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){{{*/
     480void 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        }
    235551
    236552        /*output: */
  • issm/trunk/src/wrappers/python/io/WritePythonData.cpp

    r14067 r14310  
    137137        PyObject* array=NULL;
    138138
     139        matrix->GetSize(&M,&N);
    139140        buffer=matrix->ToSerial();
    140         matrix->GetSize(&M,&N);
     141
    141142        dims[0]=(npy_intp)M;
    142143        dims[1]=(npy_intp)N;
     
    154155        PyObject* array=NULL;
    155156
     157        vector->GetSize(&M);
    156158        buffer=vector->ToMPISerial();
    157         vector->GetSize(&M);
     159
    158160        dim=(npy_intp)M;
    159161        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){{{*/
     167void 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){{{*/
     190void 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){{{*/
     212void 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){{{*/
     230void 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);
    160242
    161243        PyTuple_SetItem(py_tuple, index, array);
     
    225307}
    226308/*}}}*/
     309/*FUNCTION PyArrayFromCopiedData(int dimi,int dimj,int* data){{{*/
     310PyObject* 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){{{*/
     326PyObject* 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  
    2525void WriteData(PyObject* py_tuple,int index, SeqMat<double>* matrix);
    2626void WriteData(PyObject* py_tuple,int index, SeqVec<double>* vector);
     27void WriteData(PyObject* py_tuple,int index, SeqMat<int>* matrix);
     28void WriteData(PyObject* py_tuple,int index, SeqVec<int>* vector);
     29void WriteData(PyObject* py_tuple,int index, SeqMat<bool>* matrix);
     30void WriteData(PyObject* py_tuple,int index, SeqVec<bool>* vector);
    2731void WriteData(PyObject* py_tuple,int index, BamgGeom* bamggeom);
    2832void WriteData(PyObject* py_tuple,int index, BamgMesh* bamgmesh);
    2933void WriteData(PyObject* py_tuple,int index, RiftStruct* riftstruct);
    3034
    31 void FetchData(double** pvector,int* pM,PyObject* py_ref);
    3235void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_array);
    3336void FetchData(int** pmatrix,int* pM,int *pN,PyObject* py_matrix);
     37void FetchData(bool** pmatrix,int* pM,int *pN,PyObject* py_matrix);
     38void FetchData(double** pvector,int* pM,PyObject* py_ref);
     39void FetchData(int** pvector,int* pM,PyObject* py_ref);
     40void FetchData(bool** pvector,int* pM,PyObject* py_ref);
    3441void FetchData(char** pstring,PyObject* py_unicode);
    3542void FetchData(double* pscalar,PyObject* py_float);
    36 void FetchData(int* pinteger,PyObject* py_long);
     43void FetchData(int* pscalar,PyObject* py_long);
    3744void FetchData(bool* pbool,PyObject* py_boolean);
    3845void FetchData(BamgGeom** bamggeom,PyObject* py_dict);
     
    4754PyObject* PyArrayFromCopiedData(int dims[2],double* data);
    4855PyObject* PyArrayFromCopiedData(int dimi,int dimj,double* data);
     56PyObject* PyArrayFromCopiedData(int dimi,int dimj,int* data);
     57PyObject* PyArrayFromCopiedData(int dimi,int dimj,bool* data);
    4958
    5059#endif  /* _IO_H_ */
  • issm/trunk/startup.m

    r13395 r14310  
    3636addpath(recursivepath([ISSM_DIR '/externalpackages/export_fig']));
    3737addpath(recursivepath([ISSM_DIR '/externalpackages/googleearthtoolbox']));
     38addpath(recursivepath([ISSM_DIR '/externalpackages/howatmask']));
    3839addpath(recursivepath([ISSM_DIR '/externalpackages/cm_and_cb_utilities']));
     40addpath(recursivepath([ISSM_DIR '/externalpackages/dem']));
    3941
    4042clear ISSM_DIR;
  • issm/trunk/test

  • issm/trunk/test/NightlyRun/python_skipped_tests.txt

    r13975 r14310  
    1111test418    needs Dakota
    1212test420    needs Dakota
     13
     14test1401,test1402
     15Roundoff error in ComputeHessian and ComputeMetric causes different meshes
     16from matlab, specifically in the handling of 0/0=nan, eps/0=inf, etc.  Since
     17the mesh is of a different size, NR fails.  (Note Matlab test1402 currently
     18fails.)
     19
     20test1109,test1110
     21Ugly crashes in solver, but same behavior as Matlab.
     22
  • issm/trunk/test/NightlyRun/runme.m

    r14067 r14310  
    7979                        strncmp(fliplr(flist(i).name),fliplr('.m'),2)&...           %File name must end by '.m'
    8080                        ~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
    8287        end
    8388end
  • 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.
    22%Pattyn and Payne 2006
    33printingflag=false;
    44
    5 L_list={5000,10000,20000,40000,80000,160000};
     5L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    66results={};
    77minvx=[];
     
    2626
    2727        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.;
    3030
    3131        %Create MPCs to have periodic boundary conditions
    32         posx=find(md.mesh.x==0);
     32        posx=find(md.mesh.x==0.);
    3333        posx2=find(md.mesh.x==max(md.mesh.x));
    3434
    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));
     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));
    3737
    3838        md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
     
    5555                set(gcf,'Color','w')
    5656                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']);
    5858        end
    5959        plotmodel(md,'data',vy,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km')
     
    6161                set(gcf,'Color','w')
    6262                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']);
    6464        end
    6565        plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km')
     
    6767                set(gcf,'Color','w')
    6868                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']);
    7070        end
    7171
    72         if(L==5000),
     72        if(L==5000.),
    7373                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,...
    7474                        'resolution',[10 10],'ylim',[10 18],'xlim',[0 5000],'title','','xlabel','')
    75         elseif(L==10000),
     75        elseif(L==10000.),
    7676                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,...
    7777                        'resolution',[10 10],'ylim',[10 30],'xlim',[0 10000],'title','','xlabel','')
    78         elseif(L==20000),
     78        elseif(L==20000.),
    7979                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,...
    8080                        'resolution',[10 10],'ylim',[0 50],'xlim',[0 20000],'title','','xlabel','')
    81         elseif(L==40000),
     81        elseif(L==40000.),
    8282                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,...
    8383                        'resolution',[10 10],'ylim',[0 80],'xlim',[0 40000],'title','','xlabel','')
    84         elseif(L==80000),
     84        elseif(L==80000.),
    8585                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,...
    8686                        'resolution',[10 10],'ylim',[0 100],'xlim',[0 80000],'title','','xlabel','')
    87         elseif(L==160000),
     87        elseif(L==160000.),
    8888                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,...
    8989                        'resolution',[10 10],'ylim',[0 120],'xlim',[0 160000],'title','','xlabel','')
     
    9292                set(gcf,'Color','w')
    9393                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']);
    9595        end
    9696end
     
    101101        set(gcf,'Color','w')
    102102        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']);
    104104end
    105105plot([5 10 20 40 80 160],maxvx);ylim([0 120]);xlim([0 160])
     
    107107        set(gcf,'Color','w')
    108108        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']);
    110110end
     111
    111112%Fields and tolerances to track changes
    112 field_names     ={ ...
     113field_names     ={...
    113114        'Vx5km','Vy5km','Vz5km',...
    114115        '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.
    22%Pattyn and Payne 2006
    33printingflag=false;
    44
    5 L_list={5000,10000,20000,40000,80000,160000};
     5L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    66results={};
    77minvx=[];
     
    1717
    1818%       %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)));
    2020%       [a,b]=find(ismember(md.mesh.elements,posnodes));
    2121%       elements=ones(md.mesh.numberofelements,1);
     
    2929        %Create dirichlet on the bed only
    3030        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.;
    3434
    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);
     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);
    4040
    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);
     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);
    4343
    44         %md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
     44%       md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
    4545
    4646        %Compute the diagnostic
    4747        md.diagnostic.abstol=NaN;
    4848        md.diagnostic.reltol=NaN;
    49         md.diagnostic.restol=1;
     49        md.diagnostic.restol=1.;
    5050        md.cluster=generic('name',oshostname(),'np',8);
    5151        md=solve(md,DiagnosticSolutionEnum());
     
    6262        %Now plot vx, vy, vz and vx on a cross section
    6363        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,
    6565                set(gcf,'Color','w')
    6666                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']);
    6868        end
    6969        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,
    7171                set(gcf,'Color','w')
    7272                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']);
    7474        end
    7575        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,
    7777                set(gcf,'Color','w')
    7878                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']);
    8080        end
    8181
    82         if(L==5000),
     82        if(L==5000.),
    8383                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,...
    8484                        'resolution',[10 10],'ylim',[10 18],'xlim',[0 5000],'title','','xlabel','')
    85         elseif(L==10000),
     85        elseif(L==10000.),
    8686                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,...
    8787                        'resolution',[10 10],'ylim',[10 30],'xlim',[0 10000],'title','','xlabel','')
    88         elseif(L==20000),
     88        elseif(L==20000.),
    8989                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,...
    9090                        'resolution',[10 10],'ylim',[0 50],'xlim',[0 20000],'title','','xlabel','')
    91         elseif(L==40000),
     91        elseif(L==40000.),
    9292                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,...
    9393                        'resolution',[10 10],'ylim',[0 80],'xlim',[0 40000],'title','','xlabel','')
    94         elseif(L==80000),
     94        elseif(L==80000.),
    9595                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,...
    9696                        'resolution',[10 10],'ylim',[0 100],'xlim',[0 80000],'title','','xlabel','')
    97         elseif(L==160000),
     97        elseif(L==160000.),
    9898                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,...
    9999                        'resolution',[10 10],'ylim',[0 120],'xlim',[0 160000],'title','','xlabel','')
    100100        end
    101         if printingflag, 
     101        if printingflag,
    102102                set(gcf,'Color','w')
    103103                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']);
    105105        end
    106106end
     
    108108%Now plot the min and max values of vx for each size of the square
    109109plot([5 10 20 40 80 160],minvx);ylim([0 18])
    110 if printingflag, 
     110if printingflag,
    111111        set(gcf,'Color','w')
    112112        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']);
    114114end
    115115plot([5 10 20 40 80 160],maxvx);ylim([0 120])
    116 if printingflag, 
     116if printingflag,
    117117        set(gcf,'Color','w')
    118118        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']);
    120120end
     121
    121122%Fields and tolerances to track changes
    122123field_names     ={...
     
    127128        'Vx80km','Vy80km','Vz80km',...
    128129        'Vx160km','Vy160km','Vz160km'
    129 }
     130};
    130131field_tolerances={...
    131132        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.
    22%Pattyn and Payne 2006
    33printingflag=false;
    44
    5 L_list={5000,10000,20000,40000,80000,160000};
     5L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    66results={};
     7minvx=[];
     8maxvx=[];
    79
    810for i=1:length(L_list),
     
    2325        md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
    2426        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.;
    2729
    2830        %Create MPCs to have periodic boundary conditions
    29         posx=find(md.mesh.x==0);
     31        posx=find(md.mesh.x==0.);
    3032        posx2=find(md.mesh.x==max(md.mesh.x));
    3133
    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 times
    33         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));
    3436
    3537        md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
     
    4951        %Now plot vx, vy, vz and vx on a cross section
    5052        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,
    5254                set(gcf,'Color','w')
    5355                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']);
    5557        end
    5658        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,
    5860                set(gcf,'Color','w')
    5961                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']);
    6163        end
    6264
    63         if(L==5000),
     65        if(L==5000.),
    6466                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,...
    6567                        'resolution',[10 10],'ylim',[6 16],'xlim',[0 5000],'title','','xlabel','')
    66         elseif(L==10000),
     68        elseif(L==10000.),
    6769                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,...
    6870                        'resolution',[10 10],'ylim',[0 40],'xlim',[0 10000],'title','','xlabel','')
    69         elseif(L==20000),
     71        elseif(L==20000.),
    7072                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,...
    7173                        'resolution',[10 10],'ylim',[0 60],'xlim',[0 20000],'title','','xlabel','')
    72         elseif(L==40000),
     74        elseif(L==40000.),
    7375                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,...
    7476                        'resolution',[10 10],'ylim',[0 100],'xlim',[0 40000],'title','','xlabel','')
    75         elseif(L==80000),
     77        elseif(L==80000.),
    7678                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,...
    7779                        'resolution',[10 10],'ylim',[0 120],'xlim',[0 80000],'title','','xlabel','')
    78         elseif(L==160000),
     80        elseif(L==160000.),
    7981                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,...
    8082                        'resolution',[10 10],'ylim',[0 120],'xlim',[0 160000],'title','','xlabel','')
    8183        end
    82         if printingflag, 
     84        if printingflag,
    8385                set(gcf,'Color','w')
    8486                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']);
    8688        end
    8789end
     
    8991%Now plot the min and max values of vx for each size of the square
    9092plot([5 10 20 40 80 160],minvx);ylim([0 14]);xlim([0 160])
    91 if printingflag, 
     93if printingflag,
    9294        set(gcf,'Color','w')
    9395        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']);
    9597end
    9698plot([5 10 20 40 80 160],maxvx);ylim([0 120]);xlim([0 160])
    97 if printingflag, 
     99if printingflag,
    98100        set(gcf,'Color','w')
    99101        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']);
    101103end
     104
    102105%Fields and tolerances to track changes
    103106field_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.
    22%Pattyn and Payne 2006
    33
    4 L_list={5000,10000,20000,40000,80000,160000};
     4L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    55results={};
    66
     
    2222
    2323        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.;
    2626
    2727        %Create MPCs to have periodic boundary conditions
    28         posx=find(md.mesh.x==0);
     28        posx=find(md.mesh.x==0.);
    2929        posx2=find(md.mesh.x==max(md.mesh.x));
    3030
    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));
     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));
    3333
    3434        md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
     
    3838        md.cluster=generic('name',oshostname(),'np',8);
    3939        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));
    4141        md.diagnostic.spcvx(pos)=md.results.DiagnosticSolution.Vx(pos);
    4242        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.
    22%Pattyn and Payne 2006
    33printingflag=false;
    44
    5 L_list={5000,10000,20000,40000,80000,160000};
     5L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    66results={};
    77minvx=[];
     
    99
    1010for i=1:length(L_list),
    11         L=L_list{i};  %in m (3 times the desired lenght for BC problems) 
     11        L=L_list{i};  %in m (3 times the desired length for BC problems) 
    1212        nx=30; %number of nodes in x direction
    1313        ny=30;
     
    1818        md=extrude(md,10,1.);
    1919
    20         md=setflowequation(md,'pattyn','all'); 
     20        md=setflowequation(md,'pattyn','all');
    2121
    2222        %Create MPCs to have periodic boundary conditions
     
    2525        md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
    2626
    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);
    2929
    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);
     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);
    3232
    3333        md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
    3434
    3535        %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.),
    4040                md.diagnostic.spcvx(pos)=15.66;
    4141                md.diagnostic.spcvy(pos)=-0.1967;
    42         elseif(L==10000),
     42        elseif(L==10000.),
    4343                md.diagnostic.spcvx(pos)=16.04;
    4444                md.diagnostic.spcvy(pos)=-0.1977;
    45         elseif(L==20000),
     45        elseif(L==20000.),
    4646                md.diagnostic.spcvx(pos)=16.53;
    4747                md.diagnostic.spcvy(pos)=-1.27;
    48         elseif(L==40000),
     48        elseif(L==40000.),
    4949                md.diagnostic.spcvx(pos)=17.23;
    5050                md.diagnostic.spcvy(pos)=-3.17;
    51         elseif(L==80000),
     51        elseif(L==80000.),
    5252                md.diagnostic.spcvx(pos)=16.68;
    5353                md.diagnostic.spcvy(pos)=-2.69;
    54         elseif(L==160000),
     54        elseif(L==160000.),
    5555                md.diagnostic.spcvx(pos)=16.03;
    5656                md.diagnostic.spcvy(pos)=-1.27;
     
    5959        %Spc the bed at zero for vz
    6060        pos=find(md.mesh.vertexonbed);
    61         md.diagnostic.spcvz(pos)=0;
     61        md.diagnostic.spcvz(pos)=0.;
    6262
    6363        %Compute the diagnostic
     
    7575        %Now plot vx, vy, vz and vx on a cross section
    7676        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,
    7878                set(gcf,'Color','w')
    7979                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']);
    8181        end
    8282        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,
    8484                set(gcf,'Color','w')
    8585                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']);
    8787        end
    8888        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,
    9090                set(gcf,'Color','w')
    9191                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']);
    9393        end
    9494
    95         if(L==5000),
     95        if(L==5000.),
    9696                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,...
    9797                        'resolution',[10 10],'ylim',[0 20],'xlim',[0 5000],'title','','xlabel','','figure',5)
    98         elseif(L==10000),
     98        elseif(L==10000.),
    9999                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,...
    100100                        'resolution',[10 10],'ylim',[13 18],'xlim',[0 10000],'title','','xlabel','')
    101         elseif(L==20000),
     101        elseif(L==20000.),
    102102                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,...
    103103                        'resolution',[10 10],'ylim',[14 22],'xlim',[0 20000],'title','','xlabel','')
    104         elseif(L==40000),
     104        elseif(L==40000.),
    105105                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,...
    106106                        'resolution',[10 10],'ylim',[10 40],'xlim',[0 40000],'title','','xlabel','')
    107         elseif(L==80000),
     107        elseif(L==80000.),
    108108                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,...
    109109                        'resolution',[10 10],'ylim',[0 80],'xlim',[0 80000],'title','','xlabel','')
    110         elseif(L==160000),
     110        elseif(L==160000.),
    111111                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,...
    112112                        'resolution',[10 10],'ylim',[0 200],'xlim',[0 160000],'title','','xlabel','')
    113113        end
    114         if printingflag, 
     114        if printingflag,
    115115                set(gcf,'Color','w')
    116116                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']);
    118118        end
    119119end
     
    121121%Now plot the min and max values of vx for each size of the square
    122122plot([5 10 20 40 80 160],minvx);ylim([4 18]);xlim([0 160])
    123 if printingflag, 
     123if printingflag,
    124124        set(gcf,'Color','w')
    125125        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']);
    127127end
    128128plot([5 10 20 40 80 160],maxvx);ylim([0 200]); xlim([0 160])
    129 if printingflag, 
     129if printingflag,
    130130        set(gcf,'Color','w')
    131131        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']);
    133133end
     134
    134135%Fields and tolerances to track changes
    135136field_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.
    22%Pattyn and Payne 2006
    33
    4 L_list={5000,10000,20000,40000,80000,160000};
     4L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    55results={};
    66
     
    1010        md=setmask(md,'',''); %ice sheet test
    1111        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)));
    1313        md=extrude(md,10,1.);
    1414
    1515        %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.),
    2020                md.diagnostic.spcvx(pos)=15.66;
    2121                md.diagnostic.spcvy(pos)=-0.1967;
    22         elseif(L==10000),
     22        elseif(L==10000.),
    2323                md.diagnostic.spcvx(pos)=16.04;
    2424                md.diagnostic.spcvy(pos)=-0.1977;
    25         elseif(L==20000),
     25        elseif(L==20000.),
    2626                md.diagnostic.spcvx(pos)=16.53;
    2727                md.diagnostic.spcvy(pos)=-1.27;
    28         elseif(L==40000),
     28        elseif(L==40000.),
    2929                md.diagnostic.spcvx(pos)=17.23;
    3030                md.diagnostic.spcvy(pos)=-3.17;
    31         elseif(L==80000),
     31        elseif(L==80000.),
    3232                md.diagnostic.spcvx(pos)=16.68;
    3333                md.diagnostic.spcvy(pos)=-2.69;
    34         elseif(L==160000),
     34        elseif(L==160000.),
    3535                md.diagnostic.spcvx(pos)=16.03;
    3636                md.diagnostic.spcvy(pos)=-1.27;
    3737        end
    3838
    39         md=setflowequation(md,'stokes','all'); 
     39        md=setflowequation(md,'stokes','all');
    4040
    4141        %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.
    22%Pattyn and Payne 2006
    33printingflag=false;
    44
    5 L_list={5000,10000,20000,40000,80000,160000};
     5L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    66results={};
    77minvx=[];
     
    2626
    2727        %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));
    3030
    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));
     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));
    3333
    3434        md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
    3535
    3636        %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.),
    4141                md.diagnostic.spcvx(pos)=16.0912;
    42         elseif(L==10000),
     42        elseif(L==10000.),
    4343                md.diagnostic.spcvx(pos)=16.52;
    44         elseif(L==20000),
     44        elseif(L==20000.),
    4545                md.diagnostic.spcvx(pos)=17.77;
    46         elseif(L==40000),
     46        elseif(L==40000.),
    4747                md.diagnostic.spcvx(pos)=19.88;
    48         elseif(L==80000),
     48        elseif(L==80000.),
    4949                md.diagnostic.spcvx(pos)=18.65;
    50         elseif(L==160000),
     50        elseif(L==160000.),
    5151                md.diagnostic.spcvx(pos)=16.91;
    5252        end
     
    5454        %Spc the bed at zero for vz
    5555        pos=find(md.mesh.vertexonbed);
    56         md.diagnostic.spcvz(pos)=0;
     56        md.diagnostic.spcvz(pos)=0.;
    5757
    5858        %Compute the diagnostic
     
    7070        %Now plot vx, vy, vz and vx on a cross section
    7171        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,
    7373                set(gcf,'Color','w')
    7474                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']);
    7676        end
    7777        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,
    7979                set(gcf,'Color','w')
    8080                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']);
    8282        end
    8383
    84         if(L==5000),
     84        if(L==5000.),
    8585                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,...
    8686                        'resolution',[10 10],'ylim',[0 20],'xlim',[0 5000],'title','','xlabel','','figure',4)
    87         elseif(L==10000),
     87        elseif(L==10000.),
    8888                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,...
    8989                        'resolution',[10 10],'ylim',[0 20],'xlim',[0 10000],'title','','xlabel','','figure',4)
    90         elseif(L==20000),
     90        elseif(L==20000.),
    9191                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,...
    9292                        'resolution',[10 10],'ylim',[0 30],'xlim',[0 20000],'title','','xlabel','','figure',4)
    93         elseif(L==40000),
     93        elseif(L==40000.),
    9494                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,...
    9595                        'resolution',[10 10],'ylim',[10 60],'xlim',[0 40000],'title','','xlabel','','figure',4)
    96         elseif(L==80000),
     96        elseif(L==80000.),
    9797                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,...
    9898                        'resolution',[10 10],'ylim',[0 200],'xlim',[0 80000],'title','','xlabel','','figure',4)
    99         elseif(L==160000),
     99        elseif(L==160000.),
    100100                plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,...
    101101                        'resolution',[10 10],'ylim',[0 400],'xlim',[0 160000],'title','','xlabel','','figure',4)
    102102        end
    103         if printingflag, 
     103        if printingflag,
    104104                set(gcf,'Color','w')
    105105                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']);
    107107        end
    108108end
     
    110110%Now plot the min and max values of vx for each size of the square
    111111plot([5 10 20 40 80 160],minvx);ylim([2 18]);xlim([0 160])
    112 if printingflag, 
     112if printingflag,
    113113        set(gcf,'Color','w')
    114114        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']);
    116116end
    117117plot([5 10 20 40 80 160],maxvx);ylim([0 300]);xlim([0 160])
    118 if printingflag, 
     118if printingflag,
    119119        set(gcf,'Color','w')
    120120        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']);
    122122end
     123
    123124%Fields and tolerances to track changes
    124125field_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.
    22%Pattyn and Payne 2006
    33
    4 L_list={5000,10000,20000,40000,80000,160000};
     4L_list={5000.,10000.,20000.,40000.,80000.,160000.};
    55results={};
    66
     
    1717        md=setflowequation(md,'pattyn','all');
    1818
    19         %We need one grd on dirichlet: the 4 corners are set to zero
     19        %We need one grid on dirichlet: the 4 corners are set to zero
    2020        md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1);
    2121        md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
    2222        md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
    2323       
    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.;
    2828
    2929        %Create MPCs to have periodic boundary conditions
    30         posx=find(md.mesh.x==0);
     30        posx=find(md.mesh.x==0.);
    3131        posx2=find(md.mesh.x==max(md.mesh.x));
    3232
    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));
     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));
    3535
    3636        md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
     
    4747        md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
    4848        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 times
     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 times
    5050        md.diagnostic.spcvx(pos)=md.results.DiagnosticSolution.Vx(pos);
    5151        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.
    22%TestE
    33%Four tests to run: - Pattyn frozen
     
    99
    1010for i=1:4,
    11         Lx=10; %in m
    12         Ly=5000; %in m
     11        Lx=10.; %in m
     12        Ly=5000.; %in m
    1313        nx=3; %number of nodes in x direction
    1414        ny=51;
     
    2626
    2727        %Create MPCs to have periodic boundary conditions
    28         posx=find(md.mesh.x==0);
     28        posx=find(md.mesh.x==0.);
    2929        posx2=find(md.mesh.x==max(md.mesh.x));
    3030        md.diagnostic.vertex_pairing=[posx,posx2];
     
    3535        md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
    3636        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.;
    4040
    4141        %Remove the spc where there is some sliding (case 3 and 4):
     
    5858        if i==1,
    5959                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,
    6161                        set(gcf,'Color','w')
    6262                        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']);
    6464                end
    6565        elseif i==2,
    6666                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,
    6868                        set(gcf,'Color','w')
    6969                        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']);
    7171                end
    7272        elseif i==3,
    7373                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,
    7575                        set(gcf,'Color','w')
    7676                        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']);
    7878                end
    7979        elseif i==4,
    8080                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,
    8282                        set(gcf,'Color','w')
    8383                        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']);
    8585                end
    8686        end
    8787end
     88
    8889%Fields and tolerances to track changes
    89 field_names     ={ ...
     90field_names     ={...
    9091        'VyPattynSliding','VzPattynSliding',...
    9192        '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.
    22%TestF
    33printingflag=false;
     4results={};
    45
    56for i=1:4,
    6         L=100000; %in m
     7        L=100000.; %in m
    78        nx=30; %numberof nodes in x direction
    89        ny=30;
    910        md=model();
    1011        md=squaremesh(md,L,L,nx,ny);
    11         %md=triangle(md,'../Exp/SquareISMIP.exp',5500.);
     12%       md=triangle(md,'../Exp/SquareISMIP.exp',5500.);
    1213        md=setmask(md,'',''); %ice sheet test
    1314        md=parameterize(md,'../Par/ISMIPF.par');
     
    2627                %Create dirichlet on the bed if no slip
    2728                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.;
    3132        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 somewhere
    34                 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.;
    3637        end
    3738        pos=find(~md.mesh.vertexonbed);
    38         md.thermal.spctemperature(pos)=255;
     39        md.thermal.spctemperature(pos)=255.;
    3940
    4041        %Create MPCs to have periodic boundary conditions
    41         posx=find(md.mesh.x==0);
     42        posx=find(md.mesh.x==0.);
    4243        posx2=find(md.mesh.x==max(md.mesh.x));
    4344
    44         posy=find(md.mesh.y==0);
     45        posy=find(md.mesh.y==0.);
    4546        posy2=find(md.mesh.y==max(md.mesh.y));
    4647
     
    4849        md.prognostic.vertex_pairing=[posx,posx2;posy,posy2];
    4950
    50         md.timestepping.time_step=3;
    51         md.timestepping.final_time=300;
     51        md.timestepping.time_step=3.;
     52        md.timestepping.final_time=300.;
    5253        md.settings.output_frequency=50;
    5354        md.prognostic.stabilization=1;
     
    6869                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])
    6970        end
    70         if printingflag, 
     71        if printingflag,
    7172                set(gcf,'Color','w')
    7273                if i==1,
    7374                        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']);
    7576                elseif i==2,
    7677                        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']);
    7879                elseif i==3,
    7980                        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']);
    8182                elseif i==4,
    8283                        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']);
    8485                end
    8586        end
    8687
    8788        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,
    8990                set(gcf,'Color','w')
    9091                if i==1,
    9192                        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']);
    9394                elseif i==2,
    9495                        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']);
    9697                elseif i==3,
    9798                        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']);
    99100                elseif i==4,
    100101                        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']);
    102103                end
    103104        end
     
    105106
    106107%Fields and tolerances to track changes
    107 field_names     ={ ...
     108field_names     ={...
    108109        'VxPattynFrozen','VyPattynFrozen','VzPattynFrozen','SurfacePattynFrozen',...
    109110        '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.
    22printingflag=false;
    33
     
    66for stabilization=1:3;
    77        %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.);
    99        md=setmask(md,'all','');
    1010        md=parameterize(md,'../Par/SquareEISMINT.par');
    11         md.surfaceforcings.mass_balance(:)=0;
     11        md.surfaceforcings.mass_balance(:)=0.;
    1212        md=setflowequation(md,'macayeal','all');
    1313        md.cluster=generic('name',oshostname(),'np',8);
     
    1515        disp('      initial velocity');
    1616        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);
    1818
    1919        %Stabilization
     
    2929        md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices+1,length(times));
    3030        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);
    3232        if stabilization==3,
    33                 pos=find(isnan(md.prognostic.spcthickness)); md.prognostic.spcthickness(pos)=500; %No NaN for DG
     33                pos=find(isnan(md.prognostic.spcthickness)); md.prognostic.spcthickness(pos)=500.; %No NaN for DG
    3434        end
    3535
     
    4343
    4444%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.);
    4949plot(s,h1,'r',s,h2,'b',s,h3,'g',s,hth,'k')
    5050legend('Art. diff.','No Art. diff.','D.G.','Theoretical')
    51 if printingflag, 
     51if printingflag,
    5252        set(gcf,'Color','w')
    5353        export_fig([issmdir() '/website/doc_pdf/validation/Images/EISMINT/IceShelf/eismintmasscthickness.pdf']);
     
    5656%Fields and tolerances to track changes
    5757field_names     ={ ...
    58         'ThicknessArtDigg','ThicknessNoArtDiff','ThicknessDG' ...
     58        'ThicknessArtDiff','ThicknessNoArtDiff','ThicknessDG' ...
    5959};
    6060field_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.
    22printingflag=false;
    33
     
    1919plotmodel(md,'data',vx,'contourlevels',{0,20,40,60,60,100,120,140,160,180,-20,-40,-60,-80,-100,-120,-140,-160,-180}, ...
    2020        'contourcolor','k')
    21 if printingflag, 
     21if printingflag,
    2222        set(gcf,'Color','w')
    2323        printmodel('eismintdiag1vx','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off');
     
    2727plotmodel(md,'data',vy,'contourlevels',{-100,-200,-300,-400,-500,-600,-700,-800,-900,-1000},...
    2828        'contourcolor','k')
    29 if printingflag, 
     29if printingflag,
    3030        set(gcf,'Color','w')
    3131        printmodel('eismintdiag1vy','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off');
  • issm/trunk/test/NightlyRun/test1203.m

    r13975 r14310  
    22printingflag=false;
    33
    4 %test 5 and 6 :
     4%test 5 and 6:
    55md=model();
    66md=triangle(md,'../Exp/SquareEISMINT.exp',5100.); %test3
     
    1111%Impose a non zero velocity on the upper boundary condition (y=max(y))
    1212pos=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);
     13md.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);
    1414
    1515%Compute solution for MacAyeal's model
     
    2323plotmodel(md,'data',vx,'contourlevels',{0,20,40,60,80,100,-20,-40,-60,-80,-100},...
    2424        'contourcolor','k')
    25 if printingflag, 
     25if printingflag,
    2626        set(gcf,'Color','w')
    2727        printmodel('eismintdiag2vx','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off');
     
    3030plotmodel(md,'data',vy,'contourlevels',{-100,-200,-300,-400,-500,-600,-700,-800,-900,-1000},...
    3131        'contourcolor','k')
    32 if printingflag, 
     32if printingflag,
    3333        set(gcf,'Color','w')
    3434        printmodel('eismintdiag2vy','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off');
  • issm/trunk/test/NightlyRun/test1204.m

    r13975 r14310  
    1111%Impose a non zero velocity on the upper boundary condition (y=max(y))
    1212pos=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);
     13md.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);
    1414
    1515%Compute solution for MacAyeal's model
     
    2121md.initialization.vy=(md.results.DiagnosticSolution.Vy);
    2222
    23 md.timestepping.time_step=1;
    24 md.timestepping.final_time=5000;
     23md.timestepping.time_step=1.;
     24md.timestepping.final_time=5000.;
    2525md.prognostic.stabilization=1;
    2626md=solve(md,TransientSolutionEnum());
    2727
    2828plotmodel(md,'data',(md.results.TransientSolution(end).Vx))
    29 if printingflag, 
     29if printingflag,
    3030        set(gcf,'Color','w')
    3131        printmodel('eisminttrans2vx','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off');
     
    3434
    3535plotmodel(md,'data',(md.results.TransientSolution(end).Vy))
    36 if printingflag, 
     36if printingflag,
    3737        set(gcf,'Color','w')
    3838        printmodel('eisminttrans2vy','png','margin','on','marginsize',25,'frame','off','resolution',2,'hardcopy','off');
     
    4141
    4242plotmodel(md,'data',(md.results.TransientSolution(end).Thickness))
    43 if printingflag, 
     43if printingflag,
    4444        set(gcf,'Color','w')
    4545        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.
    22printingflag=false;
    33
    44numlayers=10;
    5 resolution=30000;
     5resolution=30000.;
    66
    77%To begin with the numerical model
    88md=model();
    9 md=roundmesh(md,750000,resolution);
     9md=roundmesh(md,750000.,resolution);
    1010md=setmask(md,'',''); %We can not test iceshelves nor ice rises with this analytical solution
    1111md=parameterize(md,'../Par/RoundSheetStaticEISMINT.par');
     
    1313%Calculation of the analytical 2d velocity field
    1414constant=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));
     15vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1;
     16vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1;
     17vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2);
    1818
    1919%We extrude the model to have a 3d model
     
    2323%Spc the nodes on the bed
    2424pos=find(md.mesh.vertexonbed);
    25 md.diagnostic.spcvx(pos)=0;
    26 md.diagnostic.spcvy(pos)=0;
    27 md.diagnostic.spcvz(pos)=0;
     25md.diagnostic.spcvx(pos)=0.;
     26md.diagnostic.spcvy(pos)=0.;
     27md.diagnostic.spcvz(pos)=0.;
    2828
    2929%Now we can solve the problem
     
    3636vel=zeros(md.mesh.numberofvertices2d,1);
    3737
    38 node_vel=0;
    3938for 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)+...
    4343                        sqrt(vx(i+(j-1)*md.mesh.numberofvertices2d,1).^2+vy(i+(j-1)*md.mesh.numberofvertices2d,1).^2));
    4444        end
    4545        vel(i,1)=node_vel;
    46         node_vel=0;
    4746end
    4847
     
    8281caxis([0 100]);
    8382
    84 if printingflag, 
     83if printingflag,
    8584        set(gcf,'Color','w')
    8685        printmodel('hutterstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
     
    9291        'Vx','Vy','Vel', ...
    9392};
    94 field_tolerances={...
     93field_tolerances={ ...
    9594        1e-13,1e-13,1e-13, ...
    9695};
    97 field_values={
     96field_values={ ...
    9897        vx,vy,vel, ...
    9998};
  • 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.
    22printingflag=false;
    33
    44numlayers=10;
    5 resolution=30000;
     5resolution=30000.;
    66
    77%To begin with the numerical model
    88md=model();
    9 md=roundmesh(md,750000,resolution);
     9md=roundmesh(md,750000.,resolution);
    1010md=setmask(md,'',''); %We can not test iceshelves nor ice rises with this analytical solution
    1111md=parameterize(md,'../Par/RoundSheetStaticEISMINT.par');
     
    1313%Calculation of the analytical 2d velocity field
    1414constant=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));
     15vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1;
     16vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1;
     17vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2);
    1818
    1919%We extrude the model to have a 3d model
     
    2323%Spc the nodes on the bed
    2424pos=find(md.mesh.vertexonbed);
    25 md.diagnostic.spcvx(pos)=0;
    26 md.diagnostic.spcvy(pos)=0;
    27 md.diagnostic.spcvz(pos)=0;
     25md.diagnostic.spcvx(pos)=0.;
     26md.diagnostic.spcvy(pos)=0.;
     27md.diagnostic.spcvz(pos)=0.;
    2828
    2929%Now we can solve the problem
     
    3636vel=zeros(md.mesh.numberofvertices2d,1);
    3737
    38 node_vel=0;
    3938for 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)+...
    4343                        sqrt(vx(i+(j-1)*md.mesh.numberofvertices2d,1).^2+vy(i+(j-1)*md.mesh.numberofvertices2d,1).^2));
    4444        end
    4545        vel(i,1)=node_vel;
    46         node_vel=0;
    4746end
    4847
     
    8180caxis([0 100]);
    8281
    83 if printingflag, 
     82if printingflag,
    8483        set(gcf,'Color','w')
    8584        printmodel('pattynstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
     
    9190        'Vx','Vy','Vel', ...
    9291};
    93 field_tolerances={...
     92field_tolerances={ ...
    9493        1e-12,1e-12,1e-12, ...
    9594};
    96 field_values={
     95field_values={ ...
    9796        vx,vy,vel, ...
    9897};
  • 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.
    22printingflag=false;
    33
    44numlayers=10;
    5 resolution=30000;
     5resolution=30000.;
    66
    77%To begin with the numerical model
    88md=model();
    9 md=roundmesh(md,750000,resolution);
     9md=roundmesh(md,750000.,resolution);
    1010md=setmask(md,'',''); %We can not test iceshelves nor ice rises with this analytical solution
    1111md=parameterize(md,'../Par/RoundSheetStaticEISMINT.par');
     
    1313%Calculation of the analytical 2d velocity field
    1414constant=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));
     15vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1;
     16vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1;
     17vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2);
    1818
    1919%We extrude the model to have a 3d model
     
    2323%Spc the nodes on the bed
    2424pos=find(md.mesh.vertexonbed);
    25 md.diagnostic.spcvx(pos)=0;
    26 md.diagnostic.spcvy(pos)=0;
    27 md.diagnostic.spcvz(pos)=0;
     25md.diagnostic.spcvx(pos)=0.;
     26md.diagnostic.spcvy(pos)=0.;
     27md.diagnostic.spcvz(pos)=0.;
    2828
    2929%Now we can solve the problem
     
    3636vel=zeros(md.mesh.numberofvertices2d,1);
    3737
    38 node_vel=0;
    3938for 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)+...
    4343                        sqrt(vx(i+(j-1)*md.mesh.numberofvertices2d,1).^2+vy(i+(j-1)*md.mesh.numberofvertices2d,1).^2));
    4444        end
    4545        vel(i,1)=node_vel;
    46         node_vel=0;
    4746end
    4847
     
    8180caxis([0 100]);
    8281
    83 if printingflag, 
     82if printingflag,
    8483        set(gcf,'Color','w')
    8584        printmodel('stokesstatic','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
     
    9190        'Vx','Vy','Vel', ...
    9291};
    93 field_tolerances={...
     92field_tolerances={ ...
    9493        1e-12,1e-12,1e-12, ...
    9594};
    96 field_values={
     95field_values={ ...
    9796        vx,vy,vel, ...
    9897};
  • issm/trunk/test/NightlyRun/test1208.m

    r13975 r14310  
    11%EISMINT benchmark experiment A
    22numlayers=8;
    3 resolution=50000;
     3resolution=50000.;
    44
    55%To begin with the numerical model
     
    1414%Spc the nodes on the bed
    1515pos=find(md.mesh.vertexonbed);
    16 md.diagnostic.spcvx(pos)=0;
    17 md.diagnostic.spcvy(pos)=0;
    18 md.diagnostic.spcvz(pos)=0;
     16md.diagnostic.spcvx(pos)=0.;
     17md.diagnostic.spcvy(pos)=0.;
     18md.diagnostic.spcvz(pos)=0.;
    1919
    2020%Adapt the time steps to the resolution
    21 md.timestepping.time_step=15;
     21md.timestepping.time_step=15.;
    2222md.settings.output_frequency=500;
    23 md.timestepping.final_time=30000;
     23md.timestepping.final_time=30000.;
    2424md.prognostic.stabilization=1;
    2525md.thermal.stabilization=1;
  • issm/trunk/test/NightlyRun/test1301.m

    r13975 r14310  
    1010md=parameterize(md,'../Par/SquareThermal.par');
    1111md=extrude(md,3,2.);
    12 md=setflowequation(md,'Pattyn','all');
     12md=setflowequation(md,'pattyn','all');
    1313
    1414%Some conditions specific to melting test
     
    2424melting=md.basalforcings.geothermalflux/(md.materials.rho_ice*md.materials.latentheat)*md.constants.yts;
    2525
    26 %modeled  results
     26%modeled results
    2727md.cluster=generic('name',oshostname(),'np',2);
    2828md=solve(md,ThermalSolutionEnum());
     
    3030%plot results
    3131comp_melting=md.results.ThermalSolution.BasalforcingsMeltingRate;
    32 relative=abs((comp_melting-melting)./melting)*100;
    33 relative(find(comp_melting==melting))=0;
     32relative=abs((comp_melting-melting)./melting)*100.;
     33relative(find(comp_melting==melting))=0.;
    3434plotmodel(md,'data',comp_melting,'title','Modeled melting','data',melting,'title','Analytical melting',...
    3535        'data',comp_melting-melting,'title','Absolute error','data',relative,'title','Relative error [%]',...
    3636        'layer#all',1,'caxis#2',[1.02964 1.02966]*10^-4,'FontSize#all',20,'figposition','mathieu')
    37 if printingflag, 
     37if printingflag,
    3838        set(gcf,'Color','w')
    3939        printmodel('thermalmelting','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
     
    4141end
    4242
    43 
    4443%Fields and tolerances to track changes
    4544field_names     ={'BasalMelting'};
  • issm/trunk/test/NightlyRun/test1302.m

    r13975 r14310  
    99md=parameterize(md,'../Par/SquareThermal.par');
    1010md=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');
     11md=setflowequation(md,'pattyn','all');
    1212
    1313%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;
     14pos1=find(md.mesh.elementonbed);     md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.;
     15pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.;
    1616md.initialization.vz=0.1*ones(md.mesh.numberofvertices,1);
    1717md.initialization.vel=sqrt( md.initialization.vx.^2+ md.initialization.vy.^2+ md.initialization.vz.^2);
     
    2222%d2T/dz2-w*rho_ice*c/k*dT/dz=0   T(surface)=0  T(bed)=10   => T=A exp(alpha z)+B
    2323alpha=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)=10
     24A=10./(exp(alpha*(-1000.))-1.);    %A=T(bed)/(exp(alpha*bed)-1)  with bed=-1000 T(bed)=10
    2525B=-A;
    2626md.initialization.temperature=A*exp(alpha*md.mesh.z)+B;
    2727
    28 %modeled  results
     28%modeled results
    2929md.cluster=generic('name',oshostname(),'np',2);
    3030md=solve(md,ThermalSolutionEnum());
     
    3232%plot results
    3333comp_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;
     34relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100.;
     35relative(find(comp_temp==md.initialization.temperature))=0.;
    3636plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,...
    3737        'title','Analytical temperature [K]','view',3,'data',comp_temp-md.initialization.temperature,...
    3838        'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,...
    3939        'figposition','mathieu','FontSize#all',20)
    40 if printingflag, 
     40if printingflag,
    4141        set(gcf,'Color','w')
    4242        printmodel('thermaladvection','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
  • issm/trunk/test/NightlyRun/test1303.m

    r13975 r14310  
    1010md=parameterize(md,'../Par/SquareThermal.par');
    1111md=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;
     12md=setflowequation(md,'pattyn','all');
     13
     14pos1=find(md.mesh.elementonbed);     md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10.;
     15pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.;
    1516md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
    1617
     
    1819%d2T/dz2=0 T(bed)=10 T(surface)=0  => T=0*(z-bed)/thickness+10*(surface-z)/thickness
    1920%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;
     21md.initialization.temperature=10.*(md.geometry.surface-md.mesh.z)./md.geometry.thickness;
    2122
    22 %modeled  results
     23%modeled results
    2324md.cluster=generic('name',oshostname(),'np',2);
    2425md=solve(md,ThermalSolutionEnum());
     
    2627%plot results
    2728comp_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;
     29relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100.;
     30relative(find(comp_temp==md.initialization.temperature))=0.;
    3031plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,...
    3132        'title','Analytical temperature [K]','view',3,'data',comp_temp-md.initialization.temperature,...
    3233        'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,...
    3334        'figposition','mathieu','FontSize#all',20)
    34 if printingflag, 
     35if printingflag,
    3536        set(gcf,'Color','w')
    3637        printmodel('thermalconduction','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
  • issm/trunk/test/NightlyRun/test1304.m

    r13975 r14310  
    1010md=parameterize(md,'../Par/SquareThermal.par');
    1111md=extrude(md,11,1.);
    12 md=setflowequation(md,'Pattyn','all');
     12md=setflowequation(md,'pattyn','all');
    1313
    14 pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0;
     14pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0.;
    1515md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
    1616md.basalforcings.geothermalflux(:)=0.1; %100mW/m^2
     
    2121md.initialization.temperature=-0.1/md.materials.thermalconductivity*(md.mesh.z-md.geometry.surface); %G=0.1 W/m2
    2222
    23 %modeled  results
     23%modeled results
    2424md.cluster=generic('name',oshostname(),'np',2);
    2525md=solve(md,ThermalSolutionEnum());
     
    2727%plot results
    2828comp_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;
     29relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100.;
     30relative(find(comp_temp==md.initialization.temperature))=0.;
    3131plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,...
    3232        'title','Analytical temperature','view',3,'data',comp_temp-md.initialization.temperature,...
    3333        'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,...
    3434        'figposition','mathieu','FontSize#all',20)
    35 if printingflag, 
     35if printingflag,
    3636        set(gcf,'Color','w')
    3737        printmodel('thermalgeothermalflux','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
  • issm/trunk/test/NightlyRun/test1401.m

    r13975 r14310  
    11%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.;
    33printingflag=false;
    44
    55%create square mesh
    6 L=1; %in m
     6L=1.; %in m
    77nx=70; %numberof nodes in x direction
    88ny=70;
     
    1111%mesh adaptation loop YAMS
    1212md=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;
     13md.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.;
    1414plotmodel(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, 
     15if printingflag,
    1616        set(gcf,'Color','w')
    1717        printmodel('mesh1_yams1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    1919end
    2020
    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;
     21md=YamsCall(md,md.inversion.vel_obs,0.001,0.3,1.3,10.^-4);
     22md.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.;
    2323plotmodel(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, 
     24if printingflag,
    2525        set(gcf,'Color','w')
    2626        printmodel('mesh1_yams2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    2929
    3030md=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;
     31md.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.;
    3232plotmodel(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, 
     33if printingflag,
    3434        set(gcf,'Color','w')
    3535        printmodel('mesh1_yams3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    4141%mesh adaptation loop BAMG
    4242md=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;
     43md.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.;
    4444plotmodel(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, 
     45if printingflag,
    4646        set(gcf,'Color','w')
    4747        printmodel('mesh1_bamg1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    5050
    5151md.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;
     52md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.001,'hmax',0.3,'gradation',1.3,'err',10.^-4);
     53md.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.;
    5454plotmodel(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, 
     55if printingflag,
    5656        set(gcf,'Color','w')
    5757        printmodel('mesh1_bamg2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    6161md.private.bamg=NaN;
    6262md=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;
     63md.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.;
    6464plotmodel(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, 
     65if printingflag,
    6666        set(gcf,'Color','w')
    6767        printmodel('mesh1_bamg3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
  • issm/trunk/test/NightlyRun/test1402.m

    r13975 r14310  
    33
    44%create square mesh
    5 L=1; %in m
     5L=1.; %in m
    66nx=30; %numberof nodes in x direction
    77ny=30;
     
    1010%mesh adaptation loop YAMS
    1111md=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)) ;
     12u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.;
     13md.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));
    1616plotmodel(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, 
     17if printingflag,
    1818        set(gcf,'Color','w')
    1919        printmodel('mesh2_yams1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    2121end
    2222
    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)) ;
     23md=YamsCall(md,md.inversion.vel_obs,0.005,0.3,2.3,10.^-2);
     24u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.;
     25md.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));
    2828plotmodel(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, 
     29if printingflag,
    3030        set(gcf,'Color','w')
    3131        printmodel('mesh2_yams2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    3434
    3535md=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)) ;
     36u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.;
     37md.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));
    4040plotmodel(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, 
     41if printingflag,
    4242        set(gcf,'Color','w')
    4343        printmodel('mesh2_yams3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    4949%mesh adaptation loop BAMG
    5050md=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)) ;
     51u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.;
     52md.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));
    5555plotmodel(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, 
     56if printingflag,
    5757        set(gcf,'Color','w')
    5858        printmodel('mesh2_bamg1','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    6161
    6262md.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)) ;
     63md=bamg(md,'field',md.inversion.vel_obs,'hmin',0.005,'hmax',0.3,'gradation',2.3,'err',10.^-2);
     64u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.;
     65md.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));
    6868plotmodel(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, 
     69if printingflag,
    7070        set(gcf,'Color','w')
    7171        printmodel('mesh2_bamg2','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    7575md.private.bamg=NaN;
    7676md=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)) ;
     77u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.;
     78md.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));
    8181plotmodel(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, 
     82if printingflag,
    8383        set(gcf,'Color','w')
    8484        printmodel('mesh2_bamg3','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
     
    8888md.private.bamg=NaN;
    8989md=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)) ;
     90u=4.*md.mesh.x-2.; v=4.*md.mesh.y-2.;
     91md.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));
    9494plotmodel(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, 
     95if printingflag,
    9696        set(gcf,'Color','w')
    9797        printmodel('mesh2_bamgiso','png','margin','on','marginsize',25,'frame','off','resolution',1,'hardcopy','off');
  • issm/trunk/test/NightlyRun/test234.m

    r13975 r14310  
    4242md.qmu.method=dakota_method('nond_samp');
    4343md.qmu.method(end)=dmeth_params_set(md.qmu.method(end),'seed',1234,'samples',20,'sample_type','lhs');
     44if (str2num(dakotaversion())>4.2)
     45        md.qmu.method(end)=dmeth_params_set(md.qmu.method(end),'rng','rnum2')
     46end
    4447
    4548%parameters
     
    5962
    6063%Fields and tolerances to track changes
    61 md.results.dakota.importancefactors=[];
     64md.results.dakota.moments=[];
    6265for 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];
    6467end
    6568for 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];
    6770end
    68 field_names     ={'importancefactors'};
     71field_names     ={'moments'};
    6972field_tolerances={1e-11};
    7073field_values={...
    71          md.results.dakota.importancefactors,...
     74         md.results.dakota.moments,...
    7275        };
  • issm/trunk/test/NightlyRun/test235.m

    r13975 r14310  
    5959
    6060%Fields and tolerances to track changes
    61 md.results.dakota.importancefactors=[];
     61md.results.dakota.moments=[];
    6262for 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];
    6464end
    6565for 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];
    6767end
    68 field_names     ={'importancefactors'};
     68field_names     ={'moments'};
    6969field_tolerances={1e-11};
    7070field_values={...
    71          md.results.dakota.importancefactors,...
     71         md.results.dakota.moments,...
    7272        };
  • issm/trunk/test/NightlyRun/test328.m

    r13975 r14310  
    44md=setflowequation(md,'macayeal','all');
    55md.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;
    96md.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;
    117md.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);
     8md.surfaceforcings.href=md.geometry.surface;
     9md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
    1310md.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         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';
    2311md.cluster=generic('name',oshostname(),'np',3);
    2412md=solve(md,TransientSolutionEnum());
  • issm/trunk/test/NightlyRun/test328.py

    r13975 r14310  
    1515md=setflowequation(md,'macayeal','all')
    1616md.surfaceforcings.issmbgradients=1
    17 md.surfaceforcings.smb_pos_max=5000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y
    18 md.surfaceforcings.smb_pos_min=1250. + 0.00005*md.mesh.x -0.0001*md.mesh.y
    19 md.surfaceforcings.a_pos=15000. - 0.000051*md.mesh.x + 0.00011*md.mesh.y
    2017md.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.y
    2218md.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)
    2419md.transient.requested_outputs=TotalSmbEnum()
    2520md.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
     21md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
    3322md.cluster=generic('name',oshostname(),'np',3)
    3423md=solve(md,TransientSolutionEnum())
  • issm/trunk/test/NightlyRun/test329.m

    r13975 r14310  
    55md=setflowequation(md,'pattyn','all');
    66md.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;
    107md.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;
    128md.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);
    149md.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';
     10md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
    2311md.transient.requested_outputs=TotalSmbEnum();
    2412md.cluster=generic('name',oshostname(),'np',3);
     
    2614
    2715%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','TotalSmb1','Vx3','Vy3','Vz3','Vel3','Bed3','Surface3','Thickness3','Temperature3','SMB3','TotalSmb1'};
     16field_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'};
    2917field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
    3018        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  
    1616md=setflowequation(md,'pattyn','all')
    1717md.surfaceforcings.issmbgradients=1
    18 md.surfaceforcings.smb_pos_max=5000. - 0.00005*md.mesh.x + 0.0001*md.mesh.y
    19 md.surfaceforcings.smb_pos_min=1250. + 0.00005*md.mesh.x -0.0001*md.mesh.y
    20 md.surfaceforcings.a_pos=15000. - 0.000051*md.mesh.x + 0.00011*md.mesh.y
    2118md.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.y
    2319md.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)
    2520md.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
     21md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
    3322md.transient.requested_outputs=TotalSmbEnum()
    3423md.cluster=generic('name',oshostname(),'np',3)
     
    3625
    3726#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','TotalSmb1','Vx3','Vy3','Vz3','Vel3','Bed3','Surface3','Thickness3','Temperature3','SMB3','TotalSmb1']
     27field_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']
    3928field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
    4029        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  
    5555%we recover those mass fluxes through the mean of the response.
    5656%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.
    5858%also, check that the stddev are 0.
    59 md.results.dakota.importancefactors=[];
     59md.results.dakota.moments=[];
    6060for 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];
    6262end
    6363for 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];
    6565end
    66 field_names     ={'importancefactors'};
     66field_names     ={'moments'};
    6767field_tolerances={1e-11};
    6868field_values={...
    69          md.results.dakota.importancefactors,...
     69         md.results.dakota.moments,...
    7070        };
  • issm/trunk/test/Par/ISMIPA.par

    r9734 r14310  
    22
    33disp('      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));
     4md.geometry.surface=-md.mesh.x*tan(0.5*pi/180.);
     5md.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));
    66md.geometry.thickness=md.geometry.surface-md.geometry.bed;
    77
    88disp('      creating drag');
    9 md.friction.coefficient=200*ones(md.mesh.numberofvertices,1); %q=1.
     9md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1.
    1010%Take care of iceshelves: no basal drag
    1111pos=find(md.mask.elementonfloatingice);
    12 md.friction.coefficient(md.mesh.elements(pos,:))=0;
     12md.friction.coefficient(md.mesh.elements(pos,:))=0.;
    1313md.friction.p=ones(md.mesh.numberofelements,1);
    1414md.friction.q=ones(md.mesh.numberofelements,1);
    1515
    16 disp('      creating flow law paramter');
     16disp('      creating flow law parameter');
    1717md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
    18 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     18md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    1919
    2020disp('      boundary conditions for diagnostic model');
    21 %Create node on boundary fist (because we cannot use mesh)
     21%Create node on boundary first (because we cannot use mesh)
    2222md=SetIceSheetBC(md);
  • issm/trunk/test/Par/ISMIPB.par

    r9734 r14310  
    22
    33disp('      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));
     4md.geometry.surface=-md.mesh.x*tan(0.5*pi/180.);
     5md.geometry.bed=md.geometry.surface-1000.+500.*sin(md.mesh.x*2.*pi/max(md.mesh.x));
    66md.geometry.thickness=md.geometry.surface-md.geometry.bed;
    77
    88disp('      creating drag');
    9 md.friction.coefficient=200*ones(md.mesh.numberofvertices,1); %q=1.
     9md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1.
    1010%Take care of iceshelves: no basal drag
    1111pos=find(md.mask.elementonfloatingice);
    12 md.friction.coefficient(md.mesh.elements(pos,:))=0;
     12md.friction.coefficient(md.mesh.elements(pos,:))=0.;
    1313md.friction.p=ones(md.mesh.numberofelements,1);
    1414md.friction.q=ones(md.mesh.numberofelements,1);
    1515
    16 disp('      creating flow law paramter');
     16disp('      creating flow law parameter');
    1717md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
    18 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     18md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    1919
    2020disp('      boundary conditions for diagnostic model');
    21 %Create node on boundary fist (because we cannot use mesh)
     21%Create node on boundary first (because we cannot use mesh)
    2222md=SetIceSheetBC(md);
  • issm/trunk/test/Par/ISMIPC.par

    r9734 r14310  
    22
    33disp('      creating thickness');
    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;
     4md.geometry.surface=2000.-md.mesh.x*tan(0.1*pi/180.); %to have z>0
     5md.geometry.bed=md.geometry.surface-1000.;
    66md.geometry.thickness=md.geometry.surface-md.geometry.bed;
    77
    88disp('      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)));
     10md.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))));
    1111%Take care of iceshelves: no basal drag
    1212pos=find(md.mask.elementonfloatingice);
    13 md.friction.coefficient(md.mesh.elements(pos,:))=0;
     13md.friction.coefficient(md.mesh.elements(pos,:))=0.;
    1414md.friction.p=ones(md.mesh.numberofelements,1);
    1515md.friction.q=zeros(md.mesh.numberofelements,1);
    1616
    17 disp('      creating flow law paramter');
     17disp('      creating flow law parameter');
    1818md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
    19 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     19md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    2020
    21 disp('      boundary conditions for diagnostic model: ');
    22 %Create node on boundary fist (because wi can not use mesh)
     21disp('      boundary conditions for diagnostic model:');
     22%Create node on boundary first (because we can not use mesh)
    2323md=SetIceSheetBC(md);
  • issm/trunk/test/Par/ISMIPD.par

    r9734 r14310  
    22
    33disp('      creating thickness');
    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;
     4md.geometry.surface=2000.-md.mesh.x*tan(0.1*pi/180.); %to have z>0
     5md.geometry.bed=md.geometry.surface-1000.;
    66md.geometry.thickness=md.geometry.surface-md.geometry.bed;
    77
    88disp('      creating drag');
    9 md.friction.coefficient=sqrt(md.constants.yts.*(1000+1000*sin(md.mesh.x*2*pi/max(md.mesh.x))));
     9md.friction.coefficient=sqrt(md.constants.yts.*(1000.+1000.*sin(md.mesh.x*2.*pi/max(md.mesh.x))));
    1010%Take care of iceshelves: no basal drag
    1111pos=find(md.mask.elementonfloatingice);
    12 md.friction.coefficient(md.mesh.elements(pos,:))=0;
     12md.friction.coefficient(md.mesh.elements(pos,:))=0.;
    1313md.friction.p=ones(md.mesh.numberofelements,1);
    1414md.friction.q=zeros(md.mesh.numberofelements,1);
    1515
    16 disp('      creating flow law paramter');
     16disp('      creating flow law parameter');
    1717md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
    18 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     18md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    1919
    20 disp('      boundary conditions for diagnostic model: ');
    21 %Create node on boundary fist (because wi can not use mesh)
     20disp('      boundary conditions for diagnostic model:');
     21%Create node on boundary first (because we can not use mesh)
    2222md=SetIceSheetBC(md);
  • issm/trunk/test/Par/ISMIPE.par

    r13395 r14310  
    77for i=1:md.mesh.numberofvertices
    88        y=md.mesh.y(i);
    9         point1=floor(y/100)+1;
     9        point1=floor(y/100.)+1;
    1010        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);
    1414end
    1515md.geometry.thickness=md.geometry.surface-md.geometry.bed;
     
    2222md.friction.q=ones(md.mesh.numberofelements,1);
    2323
    24 disp('      creating flow law paramter');
     24disp('      creating flow law parameter');
    2525md.materials.rheology_B=6.8067*10^7*ones(md.mesh.numberofvertices,1);
    26 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     26md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    2727
    28 disp('      boundary conditions for diagnostic model: ');
    29 %Create node on boundary fist (because wi can not use mesh)
     28disp('      boundary conditions for diagnostic model:');
     29%Create node on boundary first (because we can not use mesh)
    3030md=SetIceSheetBC(md);
  • issm/trunk/test/Par/ISMIPF.par

    r9764 r14310  
    33
    44disp('      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));
     5md.geometry.surface=-md.mesh.x*tan(3.*pi/180.);
     6%md.geometry.bed=md.geometry.surface-1000.;
     7md.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));
    88md.geometry.thickness=md.geometry.surface-md.geometry.bed;
    99
    1010disp('      creating drag');
    11 md.friction.coefficient=sqrt(md.constants.yts/(2.140373*10^-7*1000))*ones(md.mesh.numberofvertices,1);
     11md.friction.coefficient=sqrt(md.constants.yts/(2.140373*10^-7*1000.))*ones(md.mesh.numberofvertices,1);
    1212md.friction.p=ones(md.mesh.numberofelements,1);
    1313md.friction.q=zeros(md.mesh.numberofelements,1);
    1414
    15 disp('      creating flow law paramter');
     15disp('      creating flow law parameter');
    1616md.materials.rheology_B=1.4734*10^14*ones(md.mesh.numberofvertices,1);
    17 md.materials.rheology_n=1*ones(md.mesh.numberofelements,1);
     17md.materials.rheology_n=1.*ones(md.mesh.numberofelements,1);
    1818md.materials.rheology_law='None';
    1919
    2020disp('      boundary conditions for diagnostic model');
    21 %Create node on boundary fist (because we cannot use mesh)
     21%Create node on boundary first (because we cannot use mesh)
    2222md=SetIceSheetBC(md);
    23 md.diagnostic.spcvx=100*ones(md.mesh.numberofvertices,1);
     23md.diagnostic.spcvx=100.*ones(md.mesh.numberofvertices,1);
    2424md.initialization.vx=zeros(md.mesh.numberofvertices,1);
    2525md.initialization.vy=zeros(md.mesh.numberofvertices,1);
     
    2727md.initialization.vel=zeros(md.mesh.numberofvertices,1);
    2828md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
    29 md.initialization.temperature=255*ones(md.mesh.numberofvertices,1);
     29md.initialization.temperature=255.*ones(md.mesh.numberofvertices,1);
    3030pos=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));
    3131md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
     
    3333md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
    3434md.prognostic.spcthickness(pos)=md.geometry.thickness(pos);
    35 md.thermal.spctemperature=255*ones(md.mesh.numberofvertices,1);
     35md.thermal.spctemperature=255.*ones(md.mesh.numberofvertices,1);
    3636md.basalforcings.geothermalflux=0.4*ones(md.mesh.numberofvertices,1);
    3737
     
    4040
    4141%Transient options
    42 md.timestepping.time_step=1;
    43 md.timestepping.final_time=10;
     42md.timestepping.time_step=1.;
     43md.timestepping.final_time=10.;
    4444md.prognostic.stabilization=1;
    4545md.thermal.stabilization=1;
  • issm/trunk/test/Par/Pig.py

    r13975 r14310  
    4848md.prognostic.stabilization=1.
    4949md.verbose=verbose(0)
    50 md.settings.waitonlock=30.
     50md.settings.waitonlock=30
    5151md.timestepping.time_step=1.
    5252md.timestepping.final_time=2.
  • issm/trunk/test/Par/RoundSheetEISMINT.par

    r9734 r14310  
    11%Ok, start defining model parameters here
    22disp('      creating thickness');
    3 md.geometry.thickness=10*ones(md.mesh.numberofvertices,1);
     3md.geometry.thickness=10.*ones(md.mesh.numberofvertices,1);
    44md.geometry.bed=zeros(md.mesh.numberofvertices,1);
    55md.geometry.surface=md.geometry.bed+md.geometry.thickness;
    66
    77disp('      creating drag');
    8 md.friction.coefficient=20*ones(md.mesh.numberofvertices,1); %q=1. %no drag is specified in the analytical solution
     8md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1); %q=1. no drag is specified in the analytical solution
    99md.friction.p=ones(md.mesh.numberofelements,1);
    1010md.friction.q=ones(md.mesh.numberofelements,1);
     
    1212disp('      creating temperatures');
    1313tmin=238.15; %K
    14 st=1.67*10^-2/1000; %k/m;
     14st=1.67*10^-2/1000.; %k/m
    1515radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2);
    1616md.initialization.temperature=(tmin+st*radius);
    1717md.basalforcings.geothermalflux=4.2*10^-2*ones(md.mesh.numberofvertices,1);
    1818
    19 disp('      creating flow law paramter');
    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);
     19disp('      creating flow law parameter');
     20md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution
     21md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    2222
    2323disp('      creating surface mass balance');
    2424smb_max=0.5; %m/yr
    25 sb=10^-2/1000; %m/yr/m
    26 rel=450*1000; %m
     25sb=10^-2/1000.; %m/yr/m
     26rel=450.*1000.; %m
    2727md.surfaceforcings.mass_balance=min(smb_max,sb*(rel-radius));
    2828
    2929disp('      creating velocities');
    3030constant=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;
     31md.inversion.vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1;
     32md.inversion.vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1;
    3333md.inversion.vel_obs=(sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2));
    3434md.initialization.vx=zeros(md.mesh.numberofvertices,1);
     
    3838
    3939%Deal with boundary conditions:
    40 disp('      boundary conditions for diagnostic model: ');
     40disp('      boundary conditions for diagnostic model:');
    4141md=SetMarineIceSheetBC(md,'../Exp/RoundFrontEISMINT.exp');
    4242
    43 radius=sqrt((md.mesh.x).*md.mesh.x+(md.mesh.y).*md.mesh.y);
     43radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2);
    4444pos=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 center
     45md.mesh.x(pos)=0.; md.mesh.y(pos)=0.; %the closest node to the center is changed to be exactly at the center
    4646
    47 md.diagnostic.spcvx(pos)=0;
    48 md.diagnostic.spcvy(pos)=0;
    49 md.diagnostic.spcvz(pos)=0;
     47md.diagnostic.spcvx(pos)=0.;
     48md.diagnostic.spcvy(pos)=0.;
     49md.diagnostic.spcvz(pos)=0.;
    5050
    5151%parallel options
    52 md.timestepping.final_time=50000;
     52md.timestepping.final_time=50000.;
    5353
    5454%Constants
    55 md.materials.rho_ice=910;
     55md.materials.rho_ice=910.;
    5656md.materials.thermalconductivity=2.1;
    5757md.materials.latentheat=3.35*10^5;
    5858md.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;
     59md.constants.yts=31556926.;
  • issm/trunk/test/Par/RoundSheetStaticEISMINT.par

    r9734 r14310  
    22hmin=0.01;
    33hmax=2756.7;
    4 radius=(sqrt((md.mesh.x).^2+(md.mesh.y).^2));
     4radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2);
    55radiusmax=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;
     6radius(find(radius>(1.-10^-9)*radiusmax))=radiusmax;    %eliminate roundoff issues in next statement
     7md.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.);
     8md.geometry.bed=0.*md.geometry.thickness;
    89md.geometry.surface=md.geometry.bed+md.geometry.thickness;
    910
    1011disp('      creating drag');
    11 md.friction.coefficient=20*ones(md.mesh.numberofvertices,1); %q=1. %no drag is specified in the analytical solution
     12md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1); %q=1. no drag is specified in the analytical solution
    1213%Take care of iceshelves: no basal drag
    1314pos=find(md.mask.elementonfloatingice);
    14 md.friction.coefficient(md.mesh.elements(pos,:))=0;
     15md.friction.coefficient(md.mesh.elements(pos,:))=0.;
    1516md.friction.p=ones(md.mesh.numberofelements,1);
    1617md.friction.q=ones(md.mesh.numberofelements,1);
     
    1819disp('      creating temperatures');
    1920tmin=238.15; %K
    20 st=1.67*10^-2/1000; %k/m;
    21 md.initialization.temperature=(tmin+st*radius);
     21st=1.67*10^-2/1000.; %k/m
     22md.initialization.temperature=tmin+st*radius;
    2223md.basalforcings.geothermalflux=4.2*10^-2*ones(md.mesh.numberofvertices,1);
    2324
    24 disp('      creating flow law paramter');
    25 md.materials.rheology_B=6.81*10^(7)*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution
    26 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     25disp('      creating flow law parameter');
     26md.materials.rheology_B=6.81*10^7*ones(md.mesh.numberofvertices,1); %to have the same B as the analytical solution
     27md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    2728
    2829disp('      creating surface mass balance');
    2930smb_max=0.5; %m/yr
    30 sb=10^-2/1000; %m/yr/m
    31 rel=450*1000; %m
     31sb=10^-2/1000.; %m/yr/m
     32rel=450.*1000.; %m
    3233md.surfaceforcings.mass_balance=min(smb_max,sb*(rel-radius));
    3334
    3435disp('      creating velocities');
    3536constant=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));
     37md.inversion.vx_obs=constant/2.*md.mesh.x.*(md.geometry.thickness).^-1;
     38md.inversion.vy_obs=constant/2.*md.mesh.y.*(md.geometry.thickness).^-1;
     39md.inversion.vel_obs=sqrt((md.inversion.vx_obs).^2+(md.inversion.vy_obs).^2);
    3940md.initialization.vx=zeros(md.mesh.numberofvertices,1);
    4041md.initialization.vy=zeros(md.mesh.numberofvertices,1);
     
    4344
    4445%Deal with boundary conditions:
    45 disp('      boundary conditions for diagnostic model: ');
     46disp('      boundary conditions for diagnostic model:');
    4647md=SetMarineIceSheetBC(md,'../Exp/RoundFrontEISMINT.exp');
    4748
    48 radius=sqrt((md.mesh.x).*md.mesh.x+(md.mesh.y).*md.mesh.y);
     49radius=sqrt((md.mesh.x).^2+(md.mesh.y).^2);
    4950pos=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 center
     51md.mesh.x(pos)=0.; md.mesh.y(pos)=0.; %the closest node to the center is changed to be exactly at the center
    5152
    52 md.diagnostic.spcvx(pos)=0;
    53 md.diagnostic.spcvy(pos)=0;
    54 md.diagnostic.spcvz(pos)=0;
     53md.diagnostic.spcvx(pos)=0.;
     54md.diagnostic.spcvy(pos)=0.;
     55md.diagnostic.spcvz(pos)=0.;
  • issm/trunk/test/Par/SquareEISMINT.par

    r9864 r14310  
    44ymin=min(md.mesh.y);
    55ymax=max(md.mesh.y);
    6 md.geometry.thickness=500*ones(md.mesh.numberofvertices,1);
     6md.geometry.thickness=500.*ones(md.mesh.numberofvertices,1);
    77md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
    88md.geometry.surface=md.geometry.bed+md.geometry.thickness;
    99
    1010disp('      creating drag');
    11 md.friction.coefficient=200*ones(md.mesh.numberofvertices,1); %q=1.
     11md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1.
    1212%Take care of iceshelves: no basal drag
    1313pos=find(md.mask.elementonfloatingice);
    14 md.friction.coefficient(md.mesh.elements(pos,:))=0;
     14md.friction.coefficient(md.mesh.elements(pos,:))=0.;
    1515md.friction.p=ones(md.mesh.numberofelements,1);
    1616md.friction.q=ones(md.mesh.numberofelements,1);
    1717
    1818disp('      creating initial values');
    19 md.initialization.temperature=(273-20)*ones(md.mesh.numberofvertices,1);
     19md.initialization.temperature=(273.-20.)*ones(md.mesh.numberofvertices,1);
    2020md.initialization.vx=zeros(md.mesh.numberofvertices,1);
    2121md.initialization.vy=zeros(md.mesh.numberofvertices,1);
     
    2424md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
    2525
    26 disp('      creating flow law paramter');
     26disp('      creating flow law parameter');
    2727md.materials.rheology_B=1.7687*10^8*ones(md.mesh.numberofvertices,1);
    28 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     28md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    2929
    3030disp('      creating surface mass balance');
    3131md.surfaceforcings.mass_balance=0.2*ones(md.mesh.numberofvertices,1); %0m/a
    32 md.basalforcings.melting_rate=0*ones(md.mesh.numberofvertices,1); %0m/a
     32md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1); %0m/a
    3333
    34 disp('      boundary conditions ');
     34disp('      boundary conditions');
    3535md=SetMarineIceSheetBC(md,'../Exp/SquareFrontEISMINT.exp');
    3636
    3737%Evolution of the ice shelf
    38 pos=find(md.mesh.y==200000); %nodes on the upper boundary condition
     38pos=find(md.mesh.y==200000.); %nodes on the upper boundary condition
    3939md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
    40 md.balancethickness.spcthickness(pos)=500;
     40md.balancethickness.spcthickness(pos)=500.;
    4141md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
    42 md.prognostic.spcthickness(pos)=500;
     42md.prognostic.spcthickness(pos)=500.;
    4343md.prognostic.stabilization=0; %Better result with no artificial diffusivity
    44 md.thermal.stabilization=0; 
    45 md.timestepping.final_time=500;
     44md.thermal.stabilization=0;
     45md.timestepping.final_time=500.;
    4646md.timestepping.time_step=1;
  • issm/trunk/test/Par/SquareSheetConstrained.py

    r13975 r14310  
    5151md.thermal.stabilization=1.
    5252md.verbose=verbose(0)
    53 md.settings.waitonlock=30.
     53md.settings.waitonlock=30
    5454md.diagnostic.restol=0.05
    5555md.steadystate.reltol=0.05
  • issm/trunk/test/Par/SquareSheetShelf.py

    r13975 r14310  
    5757md.thermal.stabilization=1
    5858md.verbose=verbose(0)
    59 md.settings.waitonlock=30.
     59md.settings.waitonlock=30
    6060md.diagnostic.restol=0.05
    6161md.steadystate.reltol=0.05
  • issm/trunk/test/Par/SquareShelf.py

    r13975 r14310  
    7070md.prognostic.stabilization = 1.
    7171md.thermal.stabilization = 1.
    72 md.settings.waitonlock = 30.
     72md.settings.waitonlock = 30
    7373md.verbose=verbose()
    7474md.diagnostic.restol = 0.10
  • issm/trunk/test/Par/SquareShelfConstrained.py

    r13975 r14310  
    5555md.thermal.stabilization=1.
    5656md.verbose = verbose(0)
    57 md.settings.waitonlock=30.
     57md.settings.waitonlock=30
    5858md.diagnostic.restol=0.05
    5959md.diagnostic.reltol=0.05
  • issm/trunk/test/Par/SquareThermal.par

    r9733 r14310  
    44
    55disp('      creating thickness');
    6 h=1000;
     6h=1000.;
    77md.geometry.thickness=h*ones(md.mesh.numberofvertices,1);
    8 md.geometry.bed=-1000*ones(md.mesh.numberofvertices,1);
     8md.geometry.bed=-1000.*ones(md.mesh.numberofvertices,1);
    99md.geometry.surface=md.geometry.bed+md.geometry.thickness;
    1010
     
    1515
    1616disp('      creating drag');
    17 md.friction.coefficient=200*ones(md.mesh.numberofvertices,1); %q=1.
     17md.friction.coefficient=200.*ones(md.mesh.numberofvertices,1); %q=1.
    1818%Take care of iceshelves: no basal drag
    1919pos=find(md.mask.elementonfloatingice);
    20 md.friction.coefficient(md.mesh.elements(pos,:))=0;
     20md.friction.coefficient(md.mesh.elements(pos,:))=0.;
    2121md.friction.p=ones(md.mesh.numberofelements,1);
    2222md.friction.q=ones(md.mesh.numberofelements,1);
    2323
    2424disp('      creating temperatures');
    25 md.initialization.temperature=(273-20)*ones(md.mesh.numberofvertices,1);
     25md.initialization.temperature=(273.-20.)*ones(md.mesh.numberofvertices,1);
    2626
    27 disp('      creating flow law paramter');
     27disp('      creating flow law parameter');
    2828md.materials.rheology_B=paterson(md.initialization.temperature);
    29 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
     29md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
    3030
    3131disp('      creating surface mass balance');
    3232md.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/a
     33md.basalforcings.melting_rate=0.*ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
    3434
    3535%Deal with boundary conditions:
     
    4141md.thermal.spctemperature(:)=md.initialization.temperature;
    4242md.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^2
     43pos=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.