/* * poisson.h * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <mpi.h> /* * constants */ #define EPS 2.0E-4 /* max. global error */ #define IT_MAX 1000 /* max. no. of iterations*/ #define QUAD_DIST 0.40 /* geometry parameter of charge distribution */ #define TAG_DOWN 1 #define TAG_UP 2 #define TAG_RING 3 /* * data types */ typedef enum {FALSE, TRUE} Boolean; typedef struct { int gx; /* global array, x size */ int gy; /* y size */ int lx; /* local array, x size */ int ly; /* y size */ int llc_x; /* lower left corner of local array in global array, x coord */ int llc_y; /* y coord */ } Decomposition; /* describes the decomposition of an array */ /* (without ghostpoints) */ typedef struct { MPI_Comm comm; /* communicator with topology */ int me; /* my rank */ int up; /* rank of upper neighbour */ int down; /* rank of lower neighbour */ int my_x; /* my x coordinate */ } Grid; /* describes the processor grid */ /* * function declarations */ int startup(int argc, char *argv[], Decomposition *oned, Grid *grid1d); void oned_init(dmatrix *a, dmatrix *b, dmatrix *f, Decomposition oned); void exchange(dmatrix a, Decomposition oned, Grid grid1d); double sweep1d(dmatrix a, dmatrix f, dmatrix b, Decomposition oned); double exchange_and_sweep1d(dmatrix a, dmatrix f, dmatrix b, Decomposition oned, Grid grid); void dump(dmatrix a, Decomposition oned, Grid grid); void finalize(dmatrix a, dmatrix b, dmatrix f, Grid *grid);