#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>

/*
 * This file collects the declarations of the various functions and type-definitions that need to be  accessible globally.
 * */


/*this struct is used to save the starting configuration of the potential,
 *where .pos[0]=x1, .pos[1]=x2, .pos[2]=y1, .pos[3]=y2 of the rectangle.
 * */

typedef struct {
 int pos[4];
 double val;
pot;

/*struct for plot parameters such as point type, line width etc.
 * */

typedef struct{
        int lwptuvxy;
        char data[1000], label[1000], color[100];
plotinfo;


#ifndef MYIO_C
        extern void write_phi(char *outdouble *dataint Xint Y);
        extern void print_phi(double *dataint Xint Y);
        extern void plot_data(char *outdirchar *plotchar *titlechar *xlabelchar *ylabel,
                        double *rangeint npiplotinfo *pi);
        extern void plot_data_color(char *outdirchar *plotchar *titlechar *xlabelchar *ylabel,
                        double *rangeint Xint Yint npiplotinfo *pi);
        extern void plot_data_vecfield(char *outdirchar *plotchar *titlechar *xlabelchar *ylabel,
                        double *rangeint Xint Yint npiplotinfo *pi);
#endif

#ifndef FUNCTIONS_C
        extern void check_file(char *inchar *tags);
        extern int map(int ixint *xint *yint Xint Y);
        extern void jacobi(int Xint Ydouble NPdouble *phiint NPHI,
                        pot *phi0int NGROUNDint **groundchar *difchar *logf);
        extern void red_black(int Xint Ydouble NPdouble *phiint NPHI,
                        pot *phi0char *difchar *logf);
        extern void gauss_seidel(int Xint Ydouble NPdouble *phiint NPHI,
                        pot *phi0char *difchar *logf);
        extern int check_potential(int ixint iyint NPHIpot *phi0);
        extern int check_ground(int ixint iyint NGROUNDint **ground);
#endif