Mercurial > repos > public > sbplib
comparison +multiblock/evalOn.m @ 1133:92dc0a3b5d5d feature/laplace_curvilinear_test
Generalize multiblock.evalOn() to work for a mix of function handles and grid functions
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Mon, 27 May 2019 16:52:28 -0700 |
parents | 442ec6c77c3f |
children |
comparison
equal
deleted
inserted
replaced
1132:375f73edbbd4 | 1133:92dc0a3b5d5d |
---|---|
13 nBlocks = length(grids); | 13 nBlocks = length(grids); |
14 gf = cell(nBlocks, 1); | 14 gf = cell(nBlocks, 1); |
15 | 15 |
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 if isa(f{i}, 'function_handle') |
19 gf{i} = grid.evalOn(grids{i}, f{i}); | |
20 else | |
21 gf{i} = f{i}; | |
22 end | |
19 end | 23 end |
20 else | 24 else |
21 for i = 1:nBlocks | 25 for i = 1:nBlocks |
22 gf{i} = grid.evalOn(grids{i}, @(varargin)f{i}(t,varargin{:})); | 26 if isa(f{i}, 'function_handle') |
27 gf{i} = grid.evalOn(grids{i}, @(varargin)f{i}(t,varargin{:})); | |
28 else | |
29 gf{i} = f{i}; | |
30 end | |
23 end | 31 end |
24 end | 32 end |
25 | 33 |
26 gf = blockmatrix.toMatrix(gf); | 34 gf = blockmatrix.toMatrix(gf); |
27 end | 35 end |