comparison +grid/evalOn.m @ 809:94f0f0b0d721 feature/poroelastic

Allow functions with variable number of arguments in grid.evalOn
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 27 Jul 2018 10:13:02 -0700
parents 0609a72dcdfe
children 77451445955f
comparison
equal deleted inserted replaced
808:442ec6c77c3f 809:94f0f0b0d721
11 11
12 gf = repmat(func,[g.N, 1]); 12 gf = repmat(func,[g.N, 1]);
13 return 13 return
14 end 14 end
15 % func should now be a function_handle 15 % func should now be a function_handle
16 assert(g.D == nargin(func),'grid:evalOn:WrongNumberOfInputs', 'The number of inputs of the function must match the dimension of the domain.') 16 assert(g.D == nargin(func) || nargin(func) < 0,'grid:evalOn:WrongNumberOfInputs', 'The number of inputs of the function must match the dimension of the domain.')
17 17
18 x = num2cell(g.points(),1); 18 x = num2cell(g.points(),1);
19 k = numberOfComponents(func); 19 k = numberOfComponents(func);
20 20
21 gf = func(x{:}); 21 gf = func(x{:});