view assertSize.m @ 774:66eb4a2bbb72 feature/grids

Remove default scaling of the system. The scaling doens't seem to help actual solutions. One example that fails in the flexural code. With large timesteps the solutions seems to blow up. One particular example is profilePresentation on the tdb_presentation_figures branch with k = 0.0005
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 18 Jul 2018 15:42:52 -0700
parents dec0447cbf2c
children a72038b1f709
line wrap: on
line source

% Assert that array A has the size s.
function assertSize(A,varargin)
    if length(varargin) == 1
        s = varargin{1};
        errmsg = sprintf('Expected %s to have size %s, got: %s',inputname(1), toString(s), toString(size(A)));
        assert(all(size(A) == s), errmsg);
    elseif length(varargin) == 2
        dim = varargin{1};
        s = varargin{2};

        errmsg = sprintf('Expected %s to have size %d along dimension %d, got: %d',inputname(1), s, dim, size(A,dim));
        assert(size(A,dim) == s, errmsg);
    else
        error('Expected 2 or 3 arguments to assertSize()');
    end
end