Mercurial > repos > public > sbplib
diff +grid/evalOn.m @ 812:6b83dcb46f54 feature/grids
Merge with feature/poroelastic
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 27 Jul 2018 10:31:51 -0700 |
parents | 77451445955f |
children |
line wrap: on
line diff
--- a/+grid/evalOn.m Thu Jul 26 17:47:21 2018 -0700 +++ b/+grid/evalOn.m Fri Jul 27 10:31:51 2018 -0700 @@ -13,18 +13,18 @@ return end % func should now be a function_handle - assert(g.D == nargin(func),'grid:evalOn:WrongNumberOfInputs', 'The number of inputs of the function must match the dimension of the domain.') + 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.') x = num2cell(g.points(),1); - k = numberOfComponents(func); + k = numberOfComponents(func, g.D); gf = func(x{:}); gf = reorderComponents(gf, k); end % Find the number of vector components of func -function k = numberOfComponents(func) - x0 = num2cell(ones(1,nargin(func))); +function k = numberOfComponents(func, dim) + x0 = num2cell(ones(1, dim)); f0 = func(x0{:}); assert(size(f0,2) == 1, 'grid:evalOn:VectorValuedWrongDim', 'A vector valued function must be given as a column vector'); k = length(f0);