
% In this section you may modify the mesh in any way whatsoever.
    if (Steps(m)==0) && m.globalDynamicProps.doinit % First iteration
        % Zero out a lot of stuff to create a blank slate.  If you want to use the
        % GUI to set any of these things in the initial mesh, then you will need to
        % comment out the corresponding lines here.
        m.morphogens(:) = 0;
        m.morphogenclamp(:) = 0;
        m.mgen_production(:) = 0;
        m.mgen_absorption(:) = 0;
        m.seams(:) = false;
        m.mgen_dilution(:) = false;

        % Set up names for variant models.  Useful for running multiple models on a cluster.
        % Cases CASE_N2 to CASE_Q2 implement a different mechanism for
        % setting the polariser gradient
        % The first method imposes the pattern of gradients at the start
        % the second allows it to change dynamically
        m.userdata.ranges.modelname.range = { 'CASE_N','CASE_O','CASE_P','CASE_Q', 'CASE_N2','CASE_O2','CASE_P2','CASE_Q2' };  
        m.userdata.ranges.modelname.index = 3;  % CHOOSE THE CASE HERE AND ALWAYS RESTART                      
    end
    modelname = m.userdata.ranges.modelname.range{m.userdata.ranges.modelname.index};  % CLUSTER
    disp(sprintf('\nRunning %s model %s\n',mfilename, modelname));
    	
    % More examples of code for all iterations.
    % set colour of polariser gradient arrows above and below gradient
    % threshold
    m=leaf_plotoptions(m,'highgradcolor',[0,0,0],'lowgradcolor',[0.6,0.6,0]); 
    m=leaf_setproperty(m,'mingradient',0); % i.e. threshold for using polariser gradient
    % pretty up the display
    m=leaf_plotoptions(m,'decorscale',1.5);
    m=leaf_plotoptions(m,'arrowthickness',1.3);
    % To set the following from the GUI comment out the following
    % Set priorities for simultaneous plotting of multiple morphogens, if desired.
    % The following ensures that the organisers are always visible
    m = leaf_mgen_plotpriority( m, {'id_plus_org', 'id_neg_org', 'id_midorg','f_border'}, [1,2,3,4], [0.5,0.05,0.1,0.05] );
    % setup a multiplot (changes with CASE)
    switch modelname
        case 'CASE_N'  
            m = leaf_plotoptions( m, 'morphogen', {'id_g','id_plus_org','id_neg_org','f_border'});
        case 'CASE_O'
            m = leaf_plotoptions( m, 'morphogen', {'id_g','id_plus_org','id_neg_org','id_midorg','f_border'});
        case 'CASE_P'  
            m = leaf_plotoptions( m, 'morphogen', {'id_g','id_plus_org','id_neg_org','id_midorg','f_border'});
        case 'CASE_Q'

    end

    % setup stepsize here (but like other parameters, could be setup in the
    % GUI Simulation panel
    %m.globalProps.timestep=1;
    %m.globalProps.timestep=0.01;