comparison +scheme/+bc/verifyFormat.m @ 869:d356f1a22d4f bcSetupExperiment

Start organizing the code
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Sep 2018 09:19:03 +0200
parents
children f190e35bb57a
comparison
equal deleted inserted replaced
868:57760d7088ad 869:d356f1a22d4f
1 function verifyBcFormat(bcs, diffOp)
2 for i = 1:length(bcs)
3 assertType(bcs{i}, 'struct');
4 assertStructFields(bcs{i}, {'type', 'boundary'});
5
6 if ~isfield(bcs{i}, 'data') || isempty(bcs{i}.data)
7 continue
8 end
9
10 if ~isa(bcs{i}.data, 'function_handle')
11 error('bcs{%d}.data should be a function of time or a function of time and space',i);
12 end
13
14 b = diffOp.grid.getBoundary(bcs{i}.boundary);
15
16 dim = size(b,2);
17
18 if nargin(bcs{i}.data) == 1
19 % Grid data (only function of time)
20 assertSize(bcs{i}.data(0), 1, size(b));
21 elseif nargin(bcs{i}.data) ~= 1+dim
22 error('sbplib:scheme:bcSetup:DataWrongNumberOfArguments', 'bcs{%d}.data has the wrong number of input arguments. Must be either only time or time and space.', i);
23 end
24 end
25 end