%% Snyder Cuboid
clc

dynamicCaseName = 'paracetamolGrowth';
% caseList = {'original', 'reduced', 'reducedScaled', 'scaled', 'scaledReduced'};
caseList = {'scaledReduced'};

%% simulation
% execute simulation
% executeLocalPbeCase(dynamicCaseName);
% load simulation data
[result pbeDef] = loadLocalPbeResult(dynamicCaseName);
% generate point sets for approximation
% generatePointSets(result, pbeDef, ...
%     struct('nBin', 50, 'nSample', 1000, ...
%            'viewStatistics', 0, 'caseName', dynamicCaseName)...
%     )

%% Approximation
generateProjections(pbeDef, 2, dynamicCaseName, caseList, {'volume', ...
    'volume'});
% generateProjections(pbeDef, 2, dynamicCaseName, caseList, {'surface', ...
%     'surface'});

%% eval
% dataApprox = evaluateConfinedProjection(dynamicCaseName, ...
%     [dynamicCaseName '_2_PCA_scaledReduced'])
% dataApprox = evaluateConfinedProjection(dynamicCaseName, ...
%     [dynamicCaseName '_2_volume_scaledReduced'])
dataApprox = evaluateConfinedProjection(dynamicCaseName, ...
    [dynamicCaseName '_2_volume_scaledReduced'])

%% Compute dynamical evolution for approximation
% write pbe definition(s)
% writePbeDefinitionForProjection(dynamicCaseName, 'PCA', caseList, 2);
% writePbeDefinitionForProjection(dynamicCaseName, 'volume', caseList, 2);
% writePbeDefinitionForProjection(dynamicCaseName, 'surface', caseList, 2);
% thisCase = [dynamicCaseName '_2_volume_scaledReduced'];
% thisCase = [dynamicCaseName '_2_volume_scaledReduced'];
thisCase = [dynamicCaseName '_2_PCA_scaledReduced'];
executeLocalPbeCase(thisCase)
% eval
evaluateConfinedSimulation(dynamicCaseName, thisCase)

%% Compute simple approach
thisCase = [dynamicCaseName '_2_volume_scaledReduced_simple'];
executeLocalPbeCase(thisCase)
evaluateConfinedSimulation(dynamicCaseName, thisCase, 0)