24.02.2014 Views

Parallel Processing: A KISS Approach - University of North Dakota

Parallel Processing: A KISS Approach - University of North Dakota

Parallel Processing: A KISS Approach - University of North Dakota

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

***********************************************/<br />

void UPDATE_M(void) {<br />

int i, j;<br />

for (j = 1; j < (Height-1); j++) {<br />

for (i = 1; i < (Width-1); i++) {<br />

M[j][i] = Mprime[j][i];<br />

}<br />

}<br />

}<br />

/***********************************************/<br />

/* The SUM_M routine calculates the sum <strong>of</strong> the */<br />

/* data. */<br />

/* */<br />

/* I would expect the user would want to */<br />

/* modify this code to fit their application. */<br />

/***********************************************/<br />

double SUM_M(void) {<br />

int i, j;<br />

double sum;<br />

sum = 0.0;<br />

for (j = 1; j < (Height-1); j++) {<br />

for (i = 1; i < (Width-1); i++) {<br />

sum += M[j][i];<br />

}<br />

}<br />

return sum;<br />

}<br />

/***********************************************************/<br />

/* GENERATION ROUTINES */<br />

/***********************************************************/<br />

/***********************************************/<br />

/* LOAD_BALANCE */<br />

/* This routine does the following: */<br />

/* 1. Call functions to inialize the data. */<br />

/* 2. Call the function to process each */<br />

/* iteration <strong>of</strong> the data. */<br />

/* */<br />

/* I would expect the user would want to */<br />

/* modify this code to fit their application. */<br />

/***********************************************/<br />

void LOAD_BALANCE(void) {<br />

// Define required parameters.<br />

int i, j;<br />

int startTime, stopTime;<br />

int iteration;<br />

double newSum, oldSum;<br />

double convergence;<br />

/***********************************************/<br />

/* Define user specific parameters. */<br />

/* */<br />

/* It is expected that the user will replace */<br />

28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!