//  TEXTOUT.C
//  Functions for text output.
//  © 2021 Peter J. Meyer

#include "iss.h"

#define PAUSE false
#define STANDARD_LATTICE_TYPES_ONLY true

static void display_common_input_data_format_1(void);
static void display_percolation_input_data_format_1(void);
static void display_spin_model_input_data_format_1(void);
static void display_common_input_data_format_2(void);
static void display_percolation_input_data_format_2(void);
static void display_spin_model_input_data_format_2(void);

/*------------------------*/
void display_copyright(void)
{
printf("%s, Version %.2f, Copyright 2000 Peter Meyer\n",exe_name,version_no);
}

/*------------------*/
void show_notice(void)
{
printf("\nThis program accompanies a thesis submitted to the University");
printf("\nof Derby in July 2000 for the degree of Master of Philosophy.");
printf("\nAny use of this program other than to verify results of research");
printf("\nreported in the thesis should be undertaken only after consultation");
printf("\nwith the author of this software.\n");
printf("\nPress a key to continue ...");
if ( getch() == 27 )
    exit(0);
printf("\n");
}

/*---------------------*/
void display_syntax(void)
{
printf("\nSyntax: %s input_file_1.IN [input_file_2.IN [...]]",exe_name);
printf("\nOutput data file has same name with extension .OUT.");
//  printf("\nMap file has same name with extension .MAP.");
#if SAVE_MEASUREMENTS
printf("\nMeasurements file has same name with extension .MEA.");
#endif
printf("\nFor the format of the input data use: %s /F\n",exe_name);
exit(0);
}

/*--------------------------------*/
void display_input_data_format(void)
{
int ch;

#if DOES_PERCOLATION_THRESHOLDS
printf("\nFor info re determination of percolation thresholds press 'P'."
       "\nFor info re spin model dynamics press 'S'.  Otherwise press Escape.   \n");

ch = getch();
ch -= 32*(ch>'Z');
#else
ch = 'S';
#endif

if ( ch == 'P' || ch == 'S' ) 
    {    
    printf("\n------------  ISM V%.2f INPUT PARAMETERS "
        "(%s)  ------------",version_no,
        (ch=='P' ? "PERCOLATION THRESHOLDS" : "SPIN MODEL DYNAMICS" ));

    printf("\nParameter name      Permitted values");

    #if DOES_PERCOLATION_THRESHOLDS
    printf("\ngoal:               %s",
        (ch=='P' ? "Si[te percolation threshold] | Bo[nd percolation threshold]" : 
        "Sp[in model dynamics]"));
    #endif

    display_common_input_data_format_1();

    if ( ch == 'P' )
        display_percolation_input_data_format_1();
    else
        display_spin_model_input_data_format_1();

    display_common_input_data_format_2();

    if ( ch == 'P' )
        display_percolation_input_data_format_2();
    else if ( ch == 'S' )
        display_spin_model_input_data_format_2();
    }

printf("\n");
exit(0);
}

/*------------------------------------------------*/
static void display_common_input_data_format_1(void)
{
#if TETRAHEDRAL_LATTICE_IMPLEMENTED
printf("\nlattice type:       SQU | HON | TRI | DTR | CUB | DIA | QUA | TET | HC4 | HD4");
#elif STANDARD_LATTICE_TYPES_ONLY
printf("\nlattice type:       SQU | HON | TRI | CUB | DIA | HC4");
#else
printf("\nlattice type:       SQU | HON | TRI | DTR | CUB | DIA | QUA | HC4 | HD4");
#endif
//  Lattice types:            Square | Honeycomb | Triangular    | Double triangular
//                          | Cubic  | Diamond   | Quadrilateral | Tetrahedral 
//                          | Hypercubic (4d)    | Hyperdiamond (4d)

#if MAJOR_AXIS_SPECIFICATION_PERMITTED
printf("\nmajor axis:         %d - %d   //  If honeycomb or diamond lattice.",
                              MIN_MAJOR_AXIS,MAX_MAJOR_AXIS);
#endif
}

/*-----------------------------------------------------*/
static void display_percolation_input_data_format_1(void)
{
printf("\nlattice size:       %d - %d (2d), %d - %d (3d), %d - %d (4d)",
                              MIN_SIZE_PT,max_size[0][2],MIN_SIZE_PT,max_size[0][3],
                              MIN_SIZE_PT,max_size[0][4]);
}

/*----------------------------------------------------*/
static void display_spin_model_input_data_format_1(void)
{
printf("\nlattice size:       %d - %d (2d), %d - %d (3d), %d - %d (4d)",MIN_SIZE,max_size[0][2],
                              MIN_SIZE,max_size[0][3],MIN_SIZE,max_size[0][4]);
printf("\nmodel:              Is[ing] | q-[state Potts]");
printf("\nq-value:            %d - %d    //  q-state Potts model only",
                              MIN_Q_VALUE,MAX_Q_VALUE);
printf("\ndynamics:           ME[tropolis] | GL[auber] | SW[endsen-Wang] | WO[lff]");
#if ALTERNATIVE_SPIN_SELECTIONS
printf("\nspin selection:     RA[ndom] | CH[eckerboard]  //  ME or GL only");
#endif
printf("\ntemperature:        %.3f - %.3f  //  or \"critical\"",
                              MIN_TEMPERATURE,MAX_TEMPERATURE);
printf("\ntemperatures:       //  Separate multiple temperatures with commas");
printf("\ninitial magnetization:  -1.0 - +1.0  //  >= -1/(q-1) for q-state Potts");
}

/*------------------------------------------------*/
static void display_common_input_data_format_2(void)
{
printf("\nsite concentration:  %.3f - %.3f",
                              MIN_CONCENTRATION,MAX_CONCENTRATION);
printf("\nbond concentration:  %.3f - %.3f",
                              MIN_CONCENTRATION,MAX_CONCENTRATION);
}

/*-----------------------------------------------------*/
static void display_percolation_input_data_format_2(void)
{
printf("\nprecision:                  %d - %d    //  decimal places",
    MIN_PRECISION,MAX_PRECISION);
}

/*----------------------------------------------------*/
static void display_spin_model_input_data_format_2(void)
{
#if PAUSE
int ch;
unsigned int i, j;
#endif

printf("\nnumber of configurations:   1 - %s  //  1 for a non-diluted lattice",
    ultoa_commas(MAX_NUM_CONFIGURATIONS,temp));
printf("\nnumber of spin assignments: 1 - %s",ultoa_commas(MAX_NUM_SPIN_ASSIGNMENTS,temp));
printf("\nnumber of repetitions:      1 - %d      //  Using different random numbers",
                                      MAX_NUM_REPETITIONS);
printf("\nnumber of timeslices:       %d - %s",MIN_NUM_TIME_SLICES,
                                      ultoa_commas(MAX_NUM_TIME_SLICES,temp));
printf("\nstep length:                1 - %s   //  timesteps between timeslices",
                                      ultoa_commas(MAX_STEP_LENGTH,temp));
printf("\npercentage range for mean:  %d - %d",
                                      MIN_PERCENTAGE_RANGE_FOR_MEAN,MAX_PERCENTAGE_RANGE_FOR_MEAN);

#if PAUSE
strcpy(temp,"Press a key ...");
printf("\n%s",temp);
ch = getch();
j = strlen(temp);
for ( i=0; i<j; i++ )
    printf("\b");

if ( ch == ESCAPE )
    {
    for ( i=0; i<j; i++ )
        printf(" ");
    }
else
#else
printf("\n");
#endif
    {
    printf("Use \"Y[es]\" or \"N[o]\" for the following (1st three required):");
    printf("\nprecompute nn sites:    absolute magnetization:    timeslice values:");
    printf("\nsecond moment:          autocorrelation:           map file:");
    printf("\ninternal energy:        Binder cumulant:           log values:");
    printf("\nadjust zero initial magnetization:");
    #if false
    printf("\npercolation correlation length:");
    printf("\nthermal correlation length A:           thermal correlation length B:");
    #endif
    }
}