% Input:
% L: Matrix (containing row-wise direction vectors)
% X0: function handle (Support function of the initial set)
% U: function handle (Support function of the free input)
% delta: double (sampling time)
% Scenario: String 'SpaceEx/ConstU/NoScale/AlgoInv/AlgoInv2'
% N: integer (number of sets to generate)
% options: cell array
% state: structure

% Output:
% omegas: cell array of function handles (support functions in the flowpipe)
% results: matrix (evaluations in directions from L of the sets in the
% flowpipe)

% Description:
% Generates the flowpipe of a dynamic system using the specified Scenario
% (delegates everything to subroutines dpending on the Scenario to use)

function [omegas,results] = generateFlowpipe(L,X0,U,delta,Scenario,N,options,state)

if strcmp(Scenario, 'ConstU')
    fprintf('\n Using Scenario for piecewise constant input...\n');
    
    [omegas,results] = algoConstU(state.A,state.B,delta,L,N,U,X0,2,options);
    
elseif strcmp(Scenario, 'SpaceEx')
    fprintf('\n Using SpaceEx Scenario...\n');
    
    [omegas,results] = algoSpaceEx(state.A,state.B,delta,L,N,U,X0,options);
    
elseif strcmp(Scenario, 'AlgoInv')    
    fprintf('\n Using AlgoInv Scenario...\n');
    
    [omegas,results] = algoInv(L,delta,U,X0,N,state,options);
    
elseif strcmp(Scenario, 'AlgoInv2')    
    fprintf('\n Using AlgoInv2 = SpaceEx with Invariants Scenario...\n');
    omegas = [];
    [results] = algoInv2(L,delta,U,X0,N,state,options);
else
    %fprintf('\n using "old" Scenario...\n');
    fprintf('\n using NoScale Scenario...\n');
    
    omegas = [];
    [results] = algoOld(L,state.A,state.B,delta,U,X0,N,Scenario,options);
end;