/* heat.h Chris Nevison June 24, 1997 This file contains specifications for functions for setting up and solving the heat equation on a rectangular surface, using the ??????????? iterative method. The boundary values of the rectangle are held constant. */ int CreateDblMat(int numrows, int numcols, double initval, double * * * mat); /* pre: *mat is uninitialized or NULL */ /* post: *mat is a numrows x numcols matrix of doubles */ /* with value initval. */ /* if there is insufficient memory, return 0 */ /* otherwise return 1 */ void UpdateMat(double * * matin, int numrows, int numcols, double * * matout, double * maxdif); /* pre: matin and matout are initialized numrows x numcols */ /* arrays of doubles. */ /* post: matout contains values such that the boundary */ /* values are the same as the boundary values for */ /* matin and interior values are the average of the */ /* four (or eight) nearest neighbors. maxdif is the */ /* maximum difference between corresponding values */ /* of the two arrays. */ void SolveHeat(double * row0, double * rowmax, double * col0, double * colmax, int numrows, int numcols, double tol, int maxiter, double * * * mat); /* pre: row0 and rowmax each have numcols entries, */ /* col0 and colmax each have numrows entries, */ /* row0[0] = col0[0]; row0[numcols-1] = colmax[0]; */ /* rowmax[0] = col0[numrows-1]; */ /* rowmax[numcols-1] = colmax[[numrows-1]; */ /* tol > 0; maxiter > 0; */ /* *mat is uninitialized or NULL. */ /* post: *mat is a numrows x numcols matrix whose entries */ /* of the heat equation with boundary values fixed at */ /* the values given by row0, rowmax, col0, and colmax */ /* computed using the ?????????? iterative method */ /* with accuracy given by tol unless maxiter iterations*/ /* are reached. */ void FindMinMax(int numrows, int numcols, double * * mat, double * minval, double * maxval); /* pre: mat is a numrows x numcols array of doubles */ /* post: minval and maxval are the minimum and maximum */ /* values, respectively, in mat. */ void ReadHeatBndry(FILE * infile, int * numrows, int * numcols, double * * row0, double * * rowmax, double * * col0, double * * colmax); /* pre: infile is open and ready for reading, formatted to */ /* contain the number of rows and number of columns */ /* for the rectangular region (two ints), followed by */ /* the initial values for the first and last rows and */ /* the first and last columns of the regions */ /* (2 * numcols + 2 * numrows double values) */ /* post: The number of rows and number of columns have been */ /* assigned to the parameters numrows and numcols; */ /* row0 and rowmax are each allocated space for */ /* numcols double values and col0 and colmax are */ /* each allocated space for numrows double values; */ /* the first and last row values have been assigned to */ /* parameters row0 and rowmax, and the first and last */ /* column values have been assigned to the parameters */ /* col0 and colmax. */ /* row0[0] = col0[0]; row0[numcols-1] = colmax[0]; */ /* rowmax[0] = col0[numrows-1]; */ /* rowmax[numcols-1] = colmax[numrows-1] */