blob: 1f7763e34acf1ef35bb852ef585d6c4d437dc7a5 [file] [log] [blame]
/*************************************************************************/
/* */
/* Copyright (c) 1994 Stanford University */
/* */
/* All rights reserved. */
/* */
/* Permission is given to use, copy, and modify this software for any */
/* non-commercial purpose as long as this copyright notice is not */
/* removed. All other uses, including redistribution in whole or in */
/* part, are forbidden without prior written permission. */
/* */
/* This software is provided with absolutely no warranty and no */
/* support. */
/* */
/*************************************************************************/
/* **************************************************************
end of subroutine jacobcalc
**************************************************************
performs the laplacian calculation for a subblock. */
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "decs.h"
void laplacalc(x,z,firstrow,lastrow,firstcol,lastcol,numrows,numcols)
double x[IMAX][JMAX];
double z[IMAX][JMAX];
int firstrow,lastrow,firstcol,lastcol,numrows,numcols;
{
int iindex;
int indexp1;
int indexm1;
int ip1;
int im1;
int i;
int j;
for (iindex=firstcol;iindex<=lastcol;iindex++) {
indexp1 = iindex+1;
indexm1 = iindex-1;
for (i=firstrow;i<=lastrow;i++) {
ip1 = i+1;
im1 = i-1;
z[i][iindex] = factlap*(x[ip1][iindex]+x[im1][iindex]+x[i][indexp1]+
x[i][indexm1]-4.*x[i][iindex]);
}
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
z[0][j] = 0.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
z[im-1][j] = 0.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
z[j][0] = 0.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
z[j][jm-1] = 0.0;
}
}
}