Mercurial > repos > public > sbplib
comparison +multiblock/evalOn.m @ 808:442ec6c77c3f feature/poroelastic
Make multiblock.evalOn work for any dimension
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 27 Jul 2018 10:03:21 -0700 |
parents | cee0b381d714 |
children | 92dc0a3b5d5d |
comparison
equal
deleted
inserted
replaced
807:cee0b381d714 | 808:442ec6c77c3f |
---|---|
16 if isempty(t) | 16 if isempty(t) |
17 for i = 1:nBlocks | 17 for i = 1:nBlocks |
18 gf{i} = grid.evalOn(grids{i}, f{i}); | 18 gf{i} = grid.evalOn(grids{i}, f{i}); |
19 end | 19 end |
20 else | 20 else |
21 dim = nargin(f{1}) - 1; | |
22 for i = 1:nBlocks | 21 for i = 1:nBlocks |
23 switch dim | 22 gf{i} = grid.evalOn(grids{i}, @(varargin)f{i}(t,varargin{:})); |
24 case 1 | |
25 gf{i} = grid.evalOn(grids{i}, @(x)f{i}(t,x)); | |
26 case 2 | |
27 gf{i} = grid.evalOn(grids{i}, @(x,y)f{i}(t,x,y)); | |
28 case 3 | |
29 gf{i} = grid.evalOn(grids{i}, @(x,y,z)f{i}(t,x,y,z)); | |
30 end | |
31 end | 23 end |
32 end | 24 end |
33 | 25 |
34 gf = blockmatrix.toMatrix(gf); | 26 gf = blockmatrix.toMatrix(gf); |
35 end | 27 end |