%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%
%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%
%\%%%\%%.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   %%\%%%\%
%\%%%\%% \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ /%%\%%%\%
%\%%%\%%  `-/-'   `-`-'   `-`-'   `-`-'   `-`-'   `-`-'   `-`-'   `-`-'   -`-'%%\%%%\%
%\%%%\%%-.___ %\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\% ("""%%\%%%\%
%\%%%\%%  (__)%\%\                                                   \%\%)("")%%\%%%\%
%\%%%\%%   __)%\%\             TIME EVOLUTION ITERATION              \%\%) "")%%\%%%\%
%\%%%\%%  (__)%\%\                     ~ MAIN ~                      \%\%)("")%%\%%%\%
%\%%%\%%   __)%\%\                                                   \%\%) "")%%\%%%\%
%\%%%\%%  (__,%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%,-"" %%\%%%\%
%\%%%\%%.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   .-.-.   %%\%%%\%
%\%%%\%% \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ /%%\%%%\%
%\%%%\%%  `-`-'   `-`-'   `-`-'   `-`-'   `-`-'   `-`-'   `-`-'   `-`-'   -`-'%%\%%%\%
%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%
%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%%\%%


% This is the main script to run to perform any time evolution based
% iteration scheme. This script first has the user specify the dimension of
% the spatial domain that a periodic solution of Euler is to be computed on



%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %
%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %


% Prompt the user for the dimension of the spatial domain to use

prompt_banner = [newline, '%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%', newline, ...
    '%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%', newline, ...
    '%%\\:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._\\%%', newline, ...
    '%%\\:._.:%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%~*:._\\%%', newline, ...
    '%%\\:._.:%_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_ %~*:._\\%%', newline, ...
    '%%\\:._.:%|                                                     |%~*:._\\%%', newline, ...
    '%%\\:._.:%|      COMPUTATION OF PERIODIC SOLUTIONS OF THE       |%~*:._\\%%', newline, ...
    '%%\\:._.:%|    EULER EQUATIONS --- TIME EVOLUTION ITERATION     |%~*:._\\%%', newline, ...
    '%%\\:._.:%|                                                     |%~*:._\\%%', newline, ...
    '%%\\:._.:%▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔\\_/▔%~*:._\\%%', newline, ...
    '%%\\:._.:%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%\\%~*:._\\%%', newline, ...
    '%%\\:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._\\%%', newline, ...
    '%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%', newline, ...
    '%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%%\\%%', newline];

prompt_main = [newline, 'Input the dimension of the spatial domain to compute a solution on:', newline, ...
    '[Currently, 1D (the line) and 2D (the disc) are supported. Support for 3D (the ball) to be added]', newline];

spatial_dimension = 3.5;

prompt_nonInteger = [newline, 'Error: spatial dimension must be an integer', newline];
prompt_3D = [newline, 'Error: 3D computations, in particular computations on the ball, are still being added. Must select between 1D and 2D spatial domain', newline];
prompt_4D = [newline, 'Error: at the current time, there are no plans to add support for computations on 4D+ spatial domains. Must select between 1D and 2D spatial domain', newline];


% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %
%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %


spatial_dimension = input([prompt_banner,prompt_main,newline]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if mod(spatial_dimension,1) ~= 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    disp(prompt_nonInteger);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif spatial_dimension == 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    disp(prompt_3D);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif spatial_dimension > 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    disp(prompt_4D);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


while mod(spatial_dimension,1) ~= 0 || spatial_dimension > 2

    spatial_dimension = input([prompt_main,newline]);

    if mod(spatial_dimension,1) ~= 0

        disp(prompt_nonInteger);

    elseif spatial_dimension == 3

        disp(prompt_3D);

    elseif spatial_dimension > 3

        disp(prompt_4D);

    end

end


% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %
%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %