Commit 73c327f2 authored by Jakob Gabriel's avatar Jakob Gabriel
Browse files

quantity.Discrete.int: bugfix of yesterdays bugfix for special case I forgot...

parent 40a1f149
......@@ -81,7 +81,7 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
%% input parser
myParser = misc.Parser();
myParser.addParameter('gridName', [], @(g) isstr(g) || iscell(g));
myParser.addParameter('gridName', [], @(g) ischar(g) || iscell(g));
myParser.addParameter('grid', [], @(g) isnumeric(g) || iscell(g));
myParser.addParameter('name', string(), @isstr);
myParser.addParameter('figureID', 1, @isnumeric);
......@@ -225,6 +225,7 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
end
function o = quantity.Operator(obj)
A = cell(size(obj, 3), 1);
for k = 1:size(obj, 3)
A{k} = obj(:,:,k);
end
......@@ -1551,10 +1552,6 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
elseif nargin == 2 || nargin == 4
% (obj, z) OR (obj, z, a, b)
intGridName = varargin{1};
if nargin == 4
assert((varargin{2} == a) && (varargin{3} == b), ...
'only integration from beginning to end of domain is implemented');
end
elseif nargin == 3
% (obj, a, b)
a = varargin{1};
......@@ -1566,12 +1563,16 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
I = obj.int(intGridName{2:end}, a(2:end), b(2:end));
return
end
[idxGrid, isGrid] = obj.gridIndex(intGridName);
if nargin == 4
assert(all((varargin{2} == a(idxGrid)) & (varargin{3} == b(idxGrid))), ...
'only integration from beginning to end of domain is implemented');
end
%% do the integration over one dimension
I = obj.copy();
% get index of the variables that should be considered for
% integration
[idxGrid, isGrid] = obj.gridIndex(intGridName);
[domainIdx{1:obj(1).nargin}] = deal(':');
currentGrid = obj(1).grid{ idxGrid };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment