Mercurial > repos > public > sbplib
comparison +multiblock/DiffOp.m @ 392:30ff8879162e feature/beams
Better input parsing for multiblock DiffOp.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 12 Jan 2017 17:17:58 +0100 |
parents | 33b2ef863519 |
children | 225765e345c4 324c927d8b1d |
comparison
equal
deleted
inserted
replaced
391:1afd33f719df | 392:30ff8879162e |
---|---|
92 error('multiblock:DiffOp:DiffOp:InvalidGridDoHand', 'doHand must be a function handle or a cell array of length grid.nBlocks'); | 92 error('multiblock:DiffOp:DiffOp:InvalidGridDoHand', 'doHand must be a function handle or a cell array of length grid.nBlocks'); |
93 end | 93 end |
94 | 94 |
95 if isempty(doParam) | 95 if isempty(doParam) |
96 getParam = @(i){}; | 96 getParam = @(i){}; |
97 elseif iscell(doParam) && length(doParam) == grid.nBlocks() | 97 return |
98 end | |
99 | |
100 if ~iscell(doParam) | |
101 getParam = @(i)doParam; | |
102 return | |
103 end | |
104 | |
105 % doParam is a non-empty cell-array | |
106 | |
107 if length(doParam) == grid.nBlocks() && all(cellfun(@iscell, doParam)) | |
108 % doParam is a cell-array of cell-arrays | |
98 getParam = @(i)doParam{i}; | 109 getParam = @(i)doParam{i}; |
99 else | 110 return |
100 getParam = @(i)doParam; | |
101 end | 111 end |
112 | |
113 getParam = @(i)doParam; | |
102 end | 114 end |
103 end | 115 end |
104 | 116 |
105 function ops = splitOp(obj, op) | 117 function ops = splitOp(obj, op) |
106 % Splits a matrix operator into a cell-matrix of matrix operators for | 118 % Splits a matrix operator into a cell-matrix of matrix operators for |