Mercurial > repos > public > sbplib
comparison +multiblock/evalOn.m @ 805:1caeb4dffdf9 feature/poroelastic
Fix formatting of multiblock.evalOn
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 26 Jul 2018 18:34:38 -0700 |
parents | 1f1d2a271d61 |
children | f779b5aca5eb |
comparison
equal
deleted
inserted
replaced
804:1f1d2a271d61 | 805:1caeb4dffdf9 |
---|---|
1 % Useful for evaulating forcing functions with different functional expressions for each block | 1 % Useful for evaulating forcing functions with different functional expressions for each block |
2 % f: cell array of function handles fi | 2 % f: cell array of function handles fi |
3 % f_i = f_i(x1,y,...,t) | 3 % f_i = f_i(x1,y,...,t) |
4 % t: time point. If not specified, it is assumed that the functions take only spatial arguments. | 4 % t: time point. If not specified, it is assumed that the functions take only spatial arguments. |
5 function gf = evalOn(g, f, t) | 5 function gf = evalOn(g, f, t) |
6 default_arg('t',[]); | 6 default_arg('t',[]); |
7 | 7 |
8 grids = g.grids; | 8 grids = g.grids; |
9 nBlocks = length(grids); | 9 nBlocks = length(grids); |
10 gf = cell(nBlocks,1); | 10 gf = cell(nBlocks,1); |
11 | 11 |
12 if isempty(t) | 12 if isempty(t) |
13 for i = 1:nBlocks | 13 for i = 1:nBlocks |
14 grid.evalOn(grids{i}, f{i} ); | 14 grid.evalOn(grids{i}, f{i} ); |
15 end | 15 end |
16 else | 16 else |
17 dim = nargin(f{1}) - 1; | 17 dim = nargin(f{1}) - 1; |
18 for i = 1:nBlocks | 18 for i = 1:nBlocks |
19 switch dim | 19 switch dim |
20 case 1 | 20 case 1 |
21 gf{i} = grid.evalOn(grids{i}, @(x)f{i}(x,t) ); | 21 gf{i} = grid.evalOn(grids{i}, @(x)f{i}(x,t) ); |
22 case 2 | 22 case 2 |
23 gf{i} = grid.evalOn(grids{i}, @(x,y)f{i}(x,y,t) ); | 23 gf{i} = grid.evalOn(grids{i}, @(x,y)f{i}(x,y,t) ); |
24 case 3 | 24 case 3 |
25 gf{i} = grid.evalOn(grids{i}, @(x,y,z)f{i}(x,y,z,t) ); | 25 gf{i} = grid.evalOn(grids{i}, @(x,y,z)f{i}(x,y,z,t) ); |
26 end | 26 end |
27 end | 27 end |
28 end | |
29 | |
30 gf = blockmatrix.toMatrix(gf); | |
28 end | 31 end |
29 | |
30 gf = blockmatrix.toMatrix(gf); |