Fix splash2 benchmark

During the last commit of splash2 benchmark it seems before committing
when we ran "make clean", it effectively undid what the patch at below
link did
http://www.capsl.udel.edu/splash/Download.html

Fix this since without this it is not possible to build the arcane
splash2 benchmark.
This commit is contained in:
Sanchayan Maity 2017-04-26 21:33:02 +05:30
parent 2fcc51c2c1
commit 0f4b39775c
135 changed files with 9862 additions and 8916 deletions

View File

@ -6,7 +6,7 @@ CFLAGS := $(CFLAGS) -Wpadded -Winline -Wpointer-arith -Wsign-compare -Wendif-lab
LDFLAGS := -lm libpthread.a m5op_x86.o
BASEDIR := $(HOME)/GitSource/gem5/splash2/codes
MACROS := $(BASEDIR)/null_macros/c.m4.null.POSIX_BARRIER
MACROS := $(BASEDIR)/null_macros/c.m4.null.POSIX
M4 := m4 -s -Ulen -Uindex
x = *

View File

@ -798,7 +798,7 @@ void find_my_bodies(nodeptr mycell, long work, long direction, long ProcessId)
l = (leafptr) mycell;
for (i = 0; i < l->num_bodies; i++) {
if (work >= Local[ProcessId].workMin - .1) {
if ((Local[ProcessId].mynbody+2) > maxmybody) {
if((Local[ProcessId].mynbody+2) > maxmybody) {
error("find_my_bodies: Processor %ld needs more than %ld bodies; increase fleaves\n", ProcessId, maxmybody);
}
Local[ProcessId].mybodytab[Local[ProcessId].mynbody++] =
@ -811,7 +811,7 @@ void find_my_bodies(nodeptr mycell, long work, long direction, long ProcessId)
}
}
else {
for (i = 0; (i < NSUB) && (work < (Local[ProcessId].workMax - .1)); i++){
for(i = 0; (i < NSUB) && (work < (Local[ProcessId].workMax - .1)); i++){
qptr = Subp(mycell)[Child_Sequence[direction][i]];
if (qptr!=NULL) {
if ((work+Cost(qptr)) >= (Local[ProcessId].workMin -.1)) {

View File

@ -69,7 +69,7 @@ void gravsub(register nodeptr p, long ProcessId)
mor3 = phii / Local[ProcessId].drsq;
MULVS(ai, Local[ProcessId].dr, mor3);
ADDV(Local[ProcessId].acc0, Local[ProcessId].acc0, ai);
if (Type(p) != BODY) { /* a body-cell/leaf interaction? */
if(Type(p) != BODY) { /* a body-cell/leaf interaction? */
Local[ProcessId].mynbcterm++;
#ifdef QUADPOLE
dr5inv = 1.0/(Local[ProcessId].drsq * Local[ProcessId].drsq * drabs);

View File

@ -374,7 +374,7 @@ void hackcofm(long ProcessId)
for (i = 0; i < NSUB; i++) {
r = Subp(q)[i];
if (r != NULL) {
while (!Done(r)) {
while(!Done(r)) {
/* wait */
}
Mass(q) += Mass(r);

View File

@ -21,14 +21,13 @@
#ifndef _STDINC_H_
#define _STDINC_H_
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/times.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#define error(msg, ...) printf(msg, ##__VA_ARGS__);
/*
* STREAM: a replacement for FILE *.
@ -60,7 +59,7 @@ typedef char byte;
*/
typedef char *string;
/*
* REAL: default type is double;
*/
@ -99,7 +98,7 @@ typedef real (*rproc)();
#define FOUR_PI 12.56637061435917295385
#define HALF_PI 1.57079632679489661923
#define FRTHRD_PI 4.18879020478639098462
/*
* ABS: returns the absolute value of its argument
* MAX: returns the argument with the highest value
@ -108,13 +107,13 @@ typedef real (*rproc)();
#define ABS(x) (((x) < 0) ? -(x) : (x))
#include "code.h"
#include "code_io.h"
#include "defs.h"
#include "getparam.h"
#include "grav.h"
#include "load.h"
#include "util.h"
#include "vectmath.h"
#include "defs.h"
#include "code.h"
#include "util.h"
#include "load.h"
#include "code_io.h"
#include "grav.h"
#include "getparam.h"
#endif

View File

@ -14,13 +14,12 @@
/* */
/*************************************************************************/
#include <cmath>
#include <cstdio>
#include "box.h"
#include <stdio.h>
#include <math.h>
#include "defs.h"
#include "memory.h"
#include "particle.h"
#include "box.h"
/* How many boxes can fit on one line */
#define BOXES_PER_LINE 4

View File

@ -14,15 +14,14 @@
/* */
/*************************************************************************/
#include <cfloat>
#include <cstdio>
#include "box.h"
#include "construct_grid.h"
#include <stdio.h>
#include <float.h>
#include "defs.h"
#include "memory.h"
#include "particle.h"
#include "box.h"
#include "partition_grid.h"
#include "construct_grid.h"
#define MY_PARTICLES (Local[my_id].Particles)
#define MY_NUM_PARTICLES (Local[my_id].Num_Particles)

View File

@ -14,11 +14,11 @@
/* */
/*************************************************************************/
#include "box.h"
#include "cost_zones.h"
#include "defs.h"
#include "memory.h"
#include "box.h"
#include "partition_grid.h"
#include "cost_zones.h"
#define NUM_DIRECTIONS 4

View File

@ -14,10 +14,9 @@
/* */
/*************************************************************************/
#include <cmath>
#include <cstdarg>
#include <cstdio>
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include "defs.h"
#include "memory.h"

View File

@ -17,11 +17,11 @@
#ifndef _Defs_H
#define _Defs_H 1
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <limits.h>
/* Define booleans */
#ifdef TRUE

View File

@ -66,20 +66,19 @@
*/
#include <cerrno>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "box.h"
#include "construct_grid.h"
#include "cost_zones.h"
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "defs.h"
#include "interactions.h"
#include "memory.h"
#include "particle.h"
#include "box.h"
#include "partition_grid.h"
#include "cost_zones.h"
#include "construct_grid.h"
#include "interactions.h"
#define BASE ((((double) 4) - sqrt((double) 2)) / sqrt((double) 2))
#define MAX_LINE_SIZE 100

View File

@ -14,15 +14,14 @@
/* */
/*************************************************************************/
#include <cmath>
#include <cstdio>
#include "box.h"
#include <stdio.h>
#include <math.h>
#include "defs.h"
#include "interactions.h"
#include "memory.h"
#include "particle.h"
#include "box.h"
#include "partition_grid.h"
#include "interactions.h"
static real Inv[MAX_EXPANSION_TERMS + 1];
static real OverInc[MAX_EXPANSION_TERMS + 1];

View File

@ -14,8 +14,7 @@
/* */
/*************************************************************************/
#include <cfloat>
#include <float.h>
#include "defs.h"
#include "memory.h"

View File

@ -17,9 +17,9 @@
#ifndef _Memory_H
#define _Memory_H 1
#include "box.h"
#include "defs.h"
#include "particle.h"
#include "box.h"
#define MAX_LOCKS 2048

View File

@ -14,11 +14,9 @@
/* */
/*************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include "defs.h"
#include "memory.h"
#include "particle.h"

View File

@ -14,13 +14,12 @@
/* */
/*************************************************************************/
#include <climits>
#include <cmath>
#include "box.h"
#include <math.h>
#include <limits.h>
#include "defs.h"
#include "memory.h"
#include "particle.h"
#include "box.h"
#include "partition_grid.h"
#define DIVISOR(x) ((x <= 20) ? 1 : ((x - 20) * 50))

View File

@ -17,8 +17,8 @@
#ifndef _Partition_H
#define _Partition_H 1
#include "box.h"
#include "defs.h"
#include "box.h"
/* Void function type */
typedef void (*partition_function)(long my_id, box *b);

View File

@ -19,10 +19,9 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "decs.h"
void jacobcalc(double ***x, double ***y, double ***z, long pid, long firstrow, long lastrow, long firstcol, long lastcol)

View File

@ -19,10 +19,9 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "decs.h"
void jacobcalc2(double ****x, double ****y, double ****z, long psiindex, long pid, long firstrow, long lastrow, long firstcol, long lastcol)

View File

@ -18,10 +18,9 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "decs.h"
void laplacalc(long procid, double ****x, double ****z, long psiindex, long firstrow, long lastrow, long firstcol, long lastcol)

View File

@ -56,11 +56,10 @@ MAIN_ENV
#define DOWNRIGHT 7
#define PAGE_SIZE 4096
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
struct multi_struct *multi;

View File

@ -21,11 +21,10 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
/* perform multigrid (w cycles) */
@ -371,7 +370,7 @@ void rescal(long kf, long my_num)
t2b = (double **) rhs_multi[my_num][kf];
t2c = (double **) rhs_multi[my_num][krc];
if17=2*(istart-1);
for (ic=istart;ic<=iend;ic++) {
for(ic=istart;ic<=iend;ic++) {
if17+=2;
i_int_factor = (ic+i_off) * i_int_coeff[krc] * 0.5;
jf = 2 * (jstart - 1);
@ -383,7 +382,7 @@ void rescal(long kf, long my_num)
t1f = (double *) t2a[if17-2];
t1g = (double *) t2a[if17-3];
t1h = (double *) t2b[if17-2];
for (jc=jstart;jc<=jend;jc++) {
for(jc=jstart;jc<=jend;jc++) {
jf+=2;
j_int_factor = (jc+j_off)*j_int_coeff[krc] * 0.5;
@ -484,7 +483,7 @@ void intadd(long kc, long my_num)
t2a = (double **) q_multi[my_num][kc];
t2b = (double **) q_multi[my_num][kf];
if17 = 2*(istart-1);
for (ic=istart;ic<=iend;ic++) {
for(ic=istart;ic<=iend;ic++) {
if17+=2;
i_int_factor1= ((imx[kc]-2)-(ic+i_off-1)) * (i_int_coeff[kf]);
i_int_factor2= (ic+i_off) * i_int_coeff[kf];
@ -495,7 +494,7 @@ void intadd(long kc, long my_num)
t1c = (double *) t2a[ic+1];
t1d = (double *) t2b[if17];
t1e = (double *) t2b[if17-1];
for (jc=jstart;jc<=jend;jc++) {
for(jc=jstart;jc<=jend;jc++) {
jf+=2;
j_int_factor1= ((jmx[kc]-2)-(jc+j_off-1)) * (j_int_coeff[kf]);
j_int_factor2= (jc+j_off) * j_int_coeff[kf];

View File

@ -20,11 +20,10 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
void slave()
@ -223,30 +222,30 @@ eof(double) +
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 0.0;
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = 0.0;
}
}
@ -265,29 +264,29 @@ eof(double) +
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 0.0;
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = 0.0;
}
}
@ -307,29 +306,29 @@ eof(double) +
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 1.0;
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 1.0;
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 1.0;
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = 1.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = 0.0;
}
}
@ -366,10 +365,10 @@ eof(double) +
t2a = (double **) rhs_multi[procid][numlev-1];
t2b = (double **) psib[procid];
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1a[j] = t1b[j] * ressqr;
}
}
@ -377,24 +376,24 @@ eof(double) +
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1a[j] = t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1a[j] = t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t2a[i][0] = t2b[i][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t2a[i][jm-1] = t2b[i][jm-1];
}
}
@ -438,12 +437,12 @@ eof(double) +
t2a = (double **) q_multi[procid][numlev-1];
t2b = (double **) psib[procid];
fac = 1.0 / (4.0 - ressqr*eig2);
for (i=ist;i<=ien;i++) {
for(i=ist;i<=ien;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
t1c = (double *) t2b[i-1];
t1d = (double *) t2b[i+1];
for (j=jst;j<=jen;j++) {
for(j=jst;j<=jen;j++) {
t1a[j] = fac * (t1d[j]+t1c[j]+t1b[j+1]+t1b[j-1] -
ressqr*t1b[j]);
}
@ -451,10 +450,10 @@ eof(double) +
multig(procid);
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1b[j] = t1a[j];
}
}
@ -482,29 +481,29 @@ eof(double) +
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psibipriv = psibipriv + 0.5*t1a[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psibipriv = psibipriv + 0.5*t1a[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psibipriv = psibipriv + 0.5*t2a[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psibipriv = psibipriv + 0.5*t2a[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
psibipriv = psibipriv + t1a[iindex];
}
}
@ -524,7 +523,7 @@ eof(double) +
between the two psim matrices; otherwise, let the single process
work on one first and then the other */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) psim[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
t2a[0][0] = 0.0;
@ -540,29 +539,29 @@ eof(double) +
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 0.0;
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = 0.0;
}
}
@ -570,7 +569,7 @@ eof(double) +
/* initialize psi matrices the same way */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) psi[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
t2a[0][0] = 0.0;
@ -586,29 +585,29 @@ eof(double) +
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 0.0;
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = 0.0;
}
}
@ -637,7 +636,7 @@ eof(double) +
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
sintemp = pi*((double) j+j_off)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
@ -646,7 +645,7 @@ eof(double) +
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
sintemp = pi*((double) j+j_off)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
@ -654,7 +653,7 @@ eof(double) +
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 0.0;
}
}
@ -662,13 +661,13 @@ eof(double) +
sintemp = pi*((double) jm-1+j_off)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = curlt;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
sintemp = pi*((double) iindex+j_off)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
@ -741,32 +740,32 @@ eof(double) +
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j]+t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j] + t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2a[j][0]+t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2a[j][jm-1] +
t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1a[iindex] + t1b[iindex];
}
}
@ -791,31 +790,31 @@ eof(double) +
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j]+t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j]+t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2a[j][0]+t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2a[j][jm-1] + t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1a[iindex] + t1b[iindex];
}
}

View File

@ -20,11 +20,10 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
void slave2(long procid, long firstrow, long lastrow, long numrows, long firstcol, long lastcol, long numcols)
@ -96,29 +95,29 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 0.0;
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = 0.0;
}
}
@ -138,29 +137,29 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = 0.0;
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = 0.0;
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = 0.0;
}
}
@ -169,7 +168,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
note that psi(i,j,2) represents the psi3 array in
the original equations */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) work1[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
t2a[0][0] = 0;
@ -209,7 +208,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
t1c = (double *) t2c[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1b[j]-t1c[j];
}
}
@ -217,25 +216,25 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
t1c = (double *) t2c[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1b[j]-t1c[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2b[j][0]-t2c[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2b[j][jm-1]-t2c[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
t1c = (double *) t2c[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1b[iindex] - t1c[iindex];
}
}
@ -261,38 +260,38 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
hh1*t2c[im-1][jm-1];
}
if (gp[procid].neighbors[UP] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[0][j] = hh3*t2a[0][j]+hh1*t2c[0][j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[im-1][j] = hh3*t2a[im-1][j] +
hh1*t2c[im-1][j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = hh3*t2a[j][0]+hh1*t2c[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = hh3*t2a[j][jm-1] +
hh1*t2c[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1c = (double *) t2c[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = hh3*t1a[iindex] + hh1*t1c[iindex];
}
}
/* set values of temparray{1,3} to psim{1,3} */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) temparray[procid][psiindex];
t2b = (double **) psi[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
@ -308,30 +307,30 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t2a[im-1][jm-1] = t2b[im-1][jm-1];
}
if (gp[procid].neighbors[UP] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[0][j] = t2b[0][j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[im-1][j] = t2b[im-1][j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1b[iindex];
}
}
@ -349,7 +348,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
set values of psi{1,3} to psim{1,3} */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) psi[procid][psiindex];
t2b = (double **) psim[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
@ -365,30 +364,30 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t2a[im-1][jm-1] = t2b[im-1][jm-1];
}
if (gp[procid].neighbors[UP] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[0][j] = t2b[0][j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[im-1][j] = t2b[im-1][j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1b[iindex];
}
}
@ -398,7 +397,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
into the work7 array; first part of a three-laplacian
calculation to compute the friction terms */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) work7[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
t2a[0][0] = 0;
@ -421,7 +420,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
elements of every column the corresponding value in the
one-dimenional f array */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) work1[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
t2a[0][0] = t2a[0][0] + f[0];
@ -436,28 +435,28 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t2a[im-1][jm-1]=t2a[im-1][jm-1] + f[jmx[numlev-1]-1];
}
if (gp[procid].neighbors[UP] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[0][j] = t2a[0][j] + f[j+j_off];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t2a[im-1][j] = t2a[im-1][j] + f[j+j_off];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2a[j][0] + f[j+i_off];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2a[j][jm-1] + f[j+i_off];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex]=t1a[iindex] + f[iindex+j_off];
}
}
@ -476,14 +475,14 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
put the jacobian of the work1{1,2} and psi{1,3} arrays
(the latter currently in temparray) in the work5{1,2} arrays */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
jacobcalc2(work1,temparray,work5,psiindex,procid,firstrow,lastrow,
firstcol,lastcol);
}
/* set values of psim{1,3} to temparray{1,3} */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
t2a = (double **) psim[procid][psiindex];
t2b = (double **) temparray[procid][psiindex];
if ((gp[procid].neighbors[UP] == -1) && (gp[procid].neighbors[LEFT] == -1)) {
@ -501,31 +500,31 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1b[iindex];
}
}
@ -534,7 +533,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
/* put the laplacian of the work7{1,2} arrays in the work4{1,2}
arrays; second step in the three-laplacian friction calculation */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
laplacalc(procid,work7,work4,psiindex,
firstrow,lastrow,firstcol,lastcol);
}
@ -557,7 +556,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
/* put the laplacian of the work4{1,2} arrays in the work7{1,2}
arrays; third step in the three-laplacian friction calculation */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
laplacalc(procid,work4,work7,psiindex,
firstrow,lastrow,firstcol,lastcol);
}
@ -630,7 +629,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t1f = (double *) t2f[0];
t1g = (double *) t2g[0];
t1h = (double *) t2h[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1c[j]-t1d[j] +
eig2*t1g[j]+h1inv*t1h[j] +
lf*t1e[j]-lf*t1f[j];
@ -648,7 +647,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t1f = (double *) t2f[im-1];
t1g = (double *) t2g[im-1];
t1h = (double *) t2h[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1c[j] -
t1d[j]+eig2*t1g[j] +
h1inv*t1h[j]+lf*t1e[j] -
@ -659,7 +658,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2c[j][0]-t2d[j][0] +
eig2*t2g[j][0]+h1inv*t2h[j][0] +
lf*t2e[j][0]-lf*t2f[j][0];
@ -669,7 +668,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2c[j][jm-1] -
t2d[j][jm-1]+eig2*t2g[j][jm-1] +
h1inv*t2h[j][jm-1]+lf*t2e[j][jm-1] -
@ -680,7 +679,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
t1c = (double *) t2c[i];
@ -689,7 +688,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t1f = (double *) t2f[i];
t1g = (double *) t2g[i];
t1h = (double *) t2h[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1c[iindex] -
t1d[iindex]+eig2*t1g[iindex] +
h1inv*t1h[iindex]+lf*t1e[iindex] -
@ -736,10 +735,10 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t2b = (double **) ga[procid];
t2c = (double **) oldga[procid];
t2d = (double **) q_multi[procid][numlev-1];
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1a[j] = t1b[j] * ressqr;
}
}
@ -747,33 +746,33 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
if (gp[procid].neighbors[UP] == -1) {
t1d = (double *) t2d[0];
t1b = (double *) t2b[0];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1d[j] = t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1d = (double *) t2d[im-1];
t1b = (double *) t2b[im-1];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1d[j] = t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t2d[i][0] = t2b[i][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t2d[i][jm-1] = t2b[i][jm-1];
}
}
fac = 1.0 / (4.0 - ressqr*eig2);
for (i=ist;i<=ien;i++) {
for(i=ist;i<=ien;i++) {
t1d = (double *) t2d[i];
t1c = (double *) t2c[i];
for (j=jst;j<=jen;j++) {
for(j=jst;j<=jen;j++) {
t1d[j] = t1c[j];
}
}
@ -798,11 +797,11 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
/* copy the solution for use as initial guess in next time-step */
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t1b = (double *) t2b[i];
t1c = (double *) t2c[i];
t1d = (double *) t2d[i];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1b[j] = t1d[j];
t1c[j] = t1d[j];
}
@ -837,29 +836,29 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psiaipriv = psiaipriv + 0.5*t1a[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psiaipriv = psiaipriv + 0.5*t1a[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psiaipriv = psiaipriv + 0.5*t2a[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psiaipriv = psiaipriv + 0.5*t2a[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
psiaipriv = psiaipriv + t1a[iindex];
}
}
@ -903,31 +902,31 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j]+f4*t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j]+f4*t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2a[j][0]+f4*t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2a[j][jm-1]+f4*t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1a[iindex]+f4*t1b[iindex];
}
}
@ -936,43 +935,43 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t2b = (double **) gb[procid];
t2c = (double **) oldgb[procid];
t2d = (double **) q_multi[procid][numlev-1];
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1a[j] = t1b[j] * ressqr;
}
}
if (gp[procid].neighbors[UP] == -1) {
t1d = (double *) t2d[0];
t1b = (double *) t2b[0];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1d[j] = t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1d = (double *) t2d[im-1];
t1b = (double *) t2b[im-1];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1d[j] = t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t2d[i][0] = t2b[i][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t2d[i][jm-1] = t2b[i][jm-1];
}
}
fac = 1.0 / (4.0 - ressqr*eig2);
for (i=ist;i<=ien;i++) {
for(i=ist;i<=ien;i++) {
t1d = (double *) t2d[i];
t1c = (double *) t2c[i];
for (j=jst;j<=jen;j++) {
for(j=jst;j<=jen;j++) {
t1d[j] = t1c[j];
}
}
@ -988,11 +987,11 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
gp[procid].multi_time += (multi_end - multi_start);
}
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
t1b = (double *) t2b[i];
t1c = (double *) t2c[i];
t1d = (double *) t2d[i];
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
t1b[j] = t1d[j];
t1c[j] = t1d[j];
}
@ -1044,7 +1043,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t1b = (double *) t2b[0];
t1c = (double *) t2c[0];
t1d = (double *) t2d[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1d[j] = t1b[j]+hh3*t1a[j];
t1c[j] = t1b[j]-hh1*t1a[j];
}
@ -1054,30 +1053,30 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
t1b = (double *) t2b[im-1];
t1c = (double *) t2c[im-1];
t1d = (double *) t2d[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1d[j] = t1b[j]+hh3*t1a[j];
t1c[j] = t1b[j]-hh1*t1a[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2d[j][0] = t2b[j][0]+hh3*t2a[j][0];
t2c[j][0] = t2b[j][0]-hh1*t2a[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2d[j][jm-1] = t2b[j][jm-1]+hh3*t2a[j][jm-1];
t2c[j][jm-1] = t2b[j][jm-1]-hh1*t2a[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
t1c = (double *) t2c[i];
t1d = (double *) t2d[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1d[iindex] = t1b[iindex] + hh3*t1a[iindex];
t1c[iindex] = t1b[iindex] - hh1*t1a[iindex];
}
@ -1118,32 +1117,32 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j] + timst*t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j] + timst*t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2a[j][0] + timst*t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2a[j][jm-1] +
timst*t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1a[iindex] + timst*t1b[iindex];
}
}
@ -1168,33 +1167,33 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
if (gp[procid].neighbors[UP] == -1) {
t1a = (double *) t2a[0];
t1b = (double *) t2b[0];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j] + timst*t1b[j];
}
}
if (gp[procid].neighbors[DOWN] == -1) {
t1a = (double *) t2a[im-1];
t1b = (double *) t2b[im-1];
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
t1a[j] = t1a[j] + timst*t1b[j];
}
}
if (gp[procid].neighbors[LEFT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][0] = t2a[j][0] + timst*t2b[j][0];
}
}
if (gp[procid].neighbors[RIGHT] == -1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
t2a[j][jm-1] = t2a[j][jm-1] +
timst*t2b[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
t1a = (double *) t2a[i];
t1b = (double *) t2b[i];
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
t1a[iindex] = t1a[iindex] + timst*t1b[iindex];
}
}

View File

@ -16,9 +16,8 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "decs.h"
void subblock()

View File

@ -17,10 +17,9 @@
/* does the arakawa jacobian calculation (of the x and y matrices,
putting the results in the z matrix) for a subblock. */
#include <cmath>
#include <cstdio>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "decs.h"
void jacobcalc(double x[IMAX][JMAX], double y[IMAX][JMAX], double z[IMAX][JMAX], long pid, long firstrow, long lastrow, long firstcol, long lastcol, long numrows, long numcols)

View File

@ -20,10 +20,9 @@
performs the laplacian calculation for a subblock. */
#include <cmath>
#include <cstdio>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "decs.h"
void laplacalc(double x[IMAX][JMAX], double z[IMAX][JMAX], long firstrow, long lastrow, long firstcol, long lastcol, long numrows, long numcols)

View File

@ -23,11 +23,10 @@
/* */
/*************************************************************************/
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
MAIN_ENV

View File

@ -19,11 +19,10 @@
iterations, w cycles, and the method of half-injection for
residual computation */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
/* perform multigrid (w cycles) */
@ -306,11 +305,11 @@ void rescal(long kf, long my_num)
factor = 4.0 - eig2 * hf * hf;
if17=2*(istart-1);
for (ic=istart;ic<=iend;ic++) {
for(ic=istart;ic<=iend;ic++) {
if17+=2;
i_int_factor = ic * i_int_coeff[krc] * 0.5;
jf = 2 * (jstart - 1);
for (jc=jstart;jc<=jend;jc++) {
for(jc=jstart;jc<=jend;jc++) {
jf+=2;
j_int_factor = jc*j_int_coeff[krc] * 0.5;
/* method of half-injection uses 2.0 instead of 4.0 */
@ -389,7 +388,7 @@ void intadd(long kc, long my_num)
iend = gp[my_num].rel_start_y[kc] + gp[my_num].rel_num_y[kc] - 1;
jend = gp[my_num].rel_start_x[kc] + gp[my_num].rel_num_x[kc] - 1;
if17 = 2*(istart-1);
for (ic=istart;ic<=iend;ic++) {
for(ic=istart;ic<=iend;ic++) {
if17+=2;
ifine1 = if17-1;
@ -399,7 +398,7 @@ void intadd(long kc, long my_num)
jf = 2*(jstart-1);
for (jc=jstart;jc<=jend;jc++) {
for(jc=jstart;jc<=jend;jc++) {
jf+=2;
jfine1 = jf-1;
jfine2 = jf;

View File

@ -18,10 +18,10 @@
subroutine slave
**************** */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
@ -103,7 +103,7 @@ void slave()
ysca1 = 0.5*ysca;
if (procid == MASTER) {
for (iindex = 0;iindex<=jm-1;iindex++) {
for(iindex = 0;iindex<=jm-1;iindex++) {
y = ((double) iindex)*res;
wrk2->f[iindex] = f0+beta*(y-ysca1);
}
@ -122,28 +122,28 @@ void slave()
fields2->psium[im-1][jm-1]=0.0;
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psium[0][j] = 0.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psium[im-1][j] = 0.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psium[j][0] = 0.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psium[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields2->psium[i][iindex] = 0.0;
}
}
@ -160,27 +160,27 @@ void slave()
fields2->psilm[im-1][jm-1]=0.0;
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psilm[0][j] = 0.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psilm[im-1][j] = 0.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psilm[j][0] = 0.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psilm[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields2->psilm[i][iindex] = 0.0;
}
}
@ -198,27 +198,27 @@ void slave()
wrk1->psib[im-1][jm-1]=1.0;
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->psib[0][j] = 1.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->psib[im-1][j] = 1.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->psib[j][0] = 1.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->psib[j][jm-1] = 1.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk1->psib[i][iindex] = 0.0;
}
}
@ -249,35 +249,35 @@ BARRIER(bars->barrier,nprocs)
if (jend == jm-2) {
jend = jm-1;
}
for (i=istart;i<=iend;i++) {
for (j=jstart;j<=jend;j++) {
for(i=istart;i<=iend;i++) {
for(j=jstart;j<=jend;j++) {
multi->rhs_multi[numlev-1][i][j] = wrk1->psib[i][j] * ressqr;
}
}
if (istart == 0) {
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
multi->q_multi[numlev-1][0][j] = wrk1->psib[0][j];
}
}
if (iend == im-1) {
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
multi->q_multi[numlev-1][im-1][j] = wrk1->psib[im-1][j];
}
}
if (jstart == 0) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
multi->q_multi[numlev-1][i][0] = wrk1->psib[i][0];
}
}
if (jend == jm-1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
multi->q_multi[numlev-1][i][jm-1] = wrk1->psib[i][jm-1];
}
}
fac = 1.0 / (4.0 - ressqr*eig2);
for (i=ist;i<=ien;i++) {
for (j=jst;j<=jen;j++) {
for(i=ist;i<=ien;i++) {
for(j=jst;j<=jen;j++) {
multi->q_multi[numlev-1][i][j] = fac * (wrk1->psib[i+1][j] +
wrk1->psib[i-1][j] + wrk1->psib[i][j+1] + wrk1->psib[i][j-1] -
ressqr*wrk1->psib[i][j]);
@ -290,8 +290,8 @@ BARRIER(bars->barrier,nprocs)
#endif
multig(procid);
for (i=istart;i<=iend;i++) {
for (j=jstart;j<=jend;j++) {
for(i=istart;i<=iend;i++) {
for(j=jstart;j<=jend;j++) {
wrk1->psib[i][j] = multi->q_multi[numlev-1][i][j];
}
}
@ -317,27 +317,27 @@ BARRIER(bars->barrier,nprocs)
psibipriv=psibipriv+0.25*(wrk1->psib[im-1][jm-1]);
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psibipriv = psibipriv + 0.5*wrk1->psib[0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psibipriv = psibipriv + 0.5*wrk1->psib[im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psibipriv = psibipriv + 0.5*wrk1->psib[j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psibipriv = psibipriv + 0.5*wrk1->psib[j][jm-1];
}
}
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for (i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
psibipriv = psibipriv + wrk1->psib[i][iindex];
}
}
@ -351,7 +351,7 @@ BARRIER(bars->barrier,nprocs)
global->psibi = global->psibi + psibipriv;
UNLOCK(locks->psibilock)
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
fields->psim[psiindex][0][0] = 0.0;
}
@ -365,27 +365,27 @@ BARRIER(bars->barrier,nprocs)
fields->psim[psiindex][im-1][jm-1] = 0.0;
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psim[psiindex][0][j] = 0.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psim[psiindex][im-1][j] = 0.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psim[psiindex][j][0] = 0.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psim[psiindex][j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields->psim[psiindex][i][iindex] = 0.0;
}
}
@ -393,7 +393,7 @@ BARRIER(bars->barrier,nprocs)
/* initialize psi matrices the same way */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
fields->psi[psiindex][0][0] = 0.0;
}
@ -407,27 +407,27 @@ BARRIER(bars->barrier,nprocs)
fields->psi[psiindex][im-1][jm-1] = 0.0;
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[psiindex][0][j] = 0.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[psiindex][im-1][j] = 0.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[psiindex][j][0] = 0.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[psiindex][j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields->psi[psiindex][i][iindex] = 0.0;
}
}
@ -454,7 +454,7 @@ BARRIER(bars->barrier,nprocs)
frcng->tauz[im-1][jm-1] = frcng->tauz[0][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
sintemp = pi*((double) j)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
@ -462,7 +462,7 @@ BARRIER(bars->barrier,nprocs)
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
sintemp = pi*((double) j)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
@ -470,7 +470,7 @@ BARRIER(bars->barrier,nprocs)
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
frcng->tauz[j][0] = 0.0;
}
}
@ -478,15 +478,15 @@ BARRIER(bars->barrier,nprocs)
sintemp = pi*((double) jmm1)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
frcng->tauz[j][jm-1] = curlt;
}
}
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
sintemp = pi*((double) iindex)*res/ysca1;
sintemp = sin(sintemp);
curlt = factor*sintemp;
for (i=firstrow;i<=lastrow;i++) {
for(i=firstrow;i<=lastrow;i++) {
frcng->tauz[i][iindex] = curlt;
}
}
@ -552,27 +552,27 @@ BARRIER(bars->barrier,nprocs)
fields2->psium[im-1][jm-1] = fields2->psium[im-1][jm-1]+fields->psim[0][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psium[0][j] = fields2->psium[0][j]+fields->psim[0][0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psium[im-1][j] = fields2->psium[im-1][j]+fields->psim[0][im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psium[j][0] = fields2->psium[j][0]+fields->psim[0][j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psium[j][jm-1] = fields2->psium[j][jm-1]+fields->psim[0][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields2->psium[i][iindex] = fields2->psium[i][iindex]+fields->psim[0][i][iindex];
}
}
@ -592,27 +592,27 @@ BARRIER(bars->barrier,nprocs)
fields2->psilm[im-1][jm-1] = fields2->psilm[im-1][jm-1]+fields->psim[1][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psilm[0][j] = fields2->psilm[0][j]+fields->psim[1][0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields2->psilm[im-1][j] = fields2->psilm[im-1][j]+fields->psim[1][im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psilm[j][0] = fields2->psilm[j][0]+fields->psim[1][j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields2->psilm[j][jm-1] = fields2->psilm[j][jm-1]+fields->psim[1][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields2->psilm[i][iindex] = fields2->psilm[i][iindex]+fields->psim[1][i][iindex];
}
}

View File

@ -18,11 +18,10 @@
subroutine slave2
**************** */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "decs.h"
void slave2(long procid, long firstrow, long lastrow, long numrows, long firstcol, long lastcol, long numcols)
@ -72,27 +71,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk1->ga[im-1][jm-1]=0.0;
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->ga[0][j] = 0.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->ga[im-1][j] = 0.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->ga[j][0] = 0.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->ga[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk1->ga[i][iindex] = 0.0;
}
}
@ -110,27 +109,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk1->gb[im-1][jm-1]=0.0;
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->gb[0][j] = 0.0;
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->gb[im-1][j] = 0.0;
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->gb[j][0] = 0.0;
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->gb[j][jm-1] = 0.0;
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk1->gb[i][iindex] = 0.0;
}
}
@ -139,7 +138,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
note that psi(i,j,2) represents the psi3 array in
the original equations */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
wrk3->work1[psiindex][0][0] = 0;
}
@ -172,27 +171,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk3->work2[im-1][jm-1] = fields->psi[0][im-1][jm-1]-fields->psi[1][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk3->work2[0][j] = fields->psi[0][0][j]-fields->psi[1][0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk3->work2[im-1][j] = fields->psi[0][im-1][j]-fields->psi[1][im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk3->work2[j][0] = fields->psi[0][j][0]-fields->psi[1][j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk3->work2[j][jm-1] = fields->psi[0][j][jm-1]-fields->psi[1][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk3->work2[i][iindex] = fields->psi[0][i][iindex]-fields->psi[1][i][iindex];
}
}
@ -214,34 +213,34 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk2->work3[im-1][jm-1] = hh3*fields->psi[0][im-1][jm-1]+hh1*fields->psi[1][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk2->work3[0][j] = hh3*fields->psi[0][0][j]+hh1*fields->psi[1][0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk2->work3[im-1][j] = hh3*fields->psi[0][im-1][j]+hh1*fields->psi[1][im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk2->work3[j][0] = hh3*fields->psi[0][j][0]+hh1*fields->psi[1][j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk2->work3[j][jm-1] = hh3*fields->psi[0][j][jm-1]+hh1*fields->psi[1][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk2->work3[i][iindex] = hh3*fields->psi[0][i][iindex]+hh1*fields->psi[1][i][iindex];
}
}
/* set values of temparray{1,3} to psim{1,3} */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
wrk5->temparray[psiindex][0][0] = fields->psi[psiindex][0][0];
}
@ -255,28 +254,28 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk5->temparray[psiindex][im-1][jm-1] = fields->psi[psiindex][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk5->temparray[psiindex][0][j] = fields->psi[psiindex][0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk5->temparray[psiindex][im-1][j] = fields->psi[psiindex][im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk5->temparray[psiindex][j][0] = fields->psi[psiindex][j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk5->temparray[psiindex][j][jm-1] = fields->psi[psiindex][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk5->temparray[psiindex][i][iindex] = fields->psi[psiindex][i][iindex];
}
}
@ -294,7 +293,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
set values of psi{1,3} to psim{1,3} */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
fields->psi[psiindex][0][0] = fields->psim[psiindex][0][0];
}
@ -308,28 +307,28 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
fields->psi[psiindex][im-1][jm-1] = fields->psim[psiindex][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[psiindex][0][j] = fields->psim[psiindex][0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[psiindex][im-1][j] = fields->psim[psiindex][im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[psiindex][j][0] = fields->psim[psiindex][j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[psiindex][j][jm-1] = fields->psim[psiindex][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields->psi[psiindex][i][iindex] = fields->psim[psiindex][i][iindex];
}
}
@ -339,7 +338,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
into the work7 array; first part of a three-laplacian
calculation to compute the friction terms */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
wrk5->work7[psiindex][0][0] = 0;
}
@ -360,7 +359,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
elements of every column the corresponding value in the
one-dimenional f array */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
wrk3->work1[psiindex][0][0] = wrk3->work1[psiindex][0][0] + wrk2->f[0];
}
@ -374,27 +373,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk3->work1[psiindex][im-1][jm-1] = wrk3->work1[psiindex][im-1][jm-1] + wrk2->f[jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk3->work1[psiindex][0][j] = wrk3->work1[psiindex][0][j] + wrk2->f[j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk3->work1[psiindex][im-1][j] = wrk3->work1[psiindex][im-1][j] + wrk2->f[j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk3->work1[psiindex][j][0] = wrk3->work1[psiindex][j][0] + wrk2->f[j];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk3->work1[psiindex][j][jm-1] = wrk3->work1[psiindex][j][jm-1] + wrk2->f[j];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk3->work1[psiindex][i][iindex] = wrk3->work1[psiindex][i][iindex] +
wrk2->f[iindex];
}
@ -414,7 +413,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
put the jacobian of the work1{1,2} and psi{1,3} arrays
(the latter currently in temparray) in the work5{1,2} arrays */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
jacobcalc(wrk3->work1[psiindex],wrk5->temparray[psiindex],
wrk4->work5[psiindex],procid,firstrow,lastrow,firstcol,lastcol,numrows,numcols);
}
@ -422,7 +421,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
/* set values of psim{1,3} to temparray{1,3} */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
if (procid == MASTER) {
fields->psim[psiindex][0][0] = wrk5->temparray[psiindex][0][0];
}
@ -436,27 +435,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
fields->psim[psiindex][im-1][jm-1] = wrk5->temparray[psiindex][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psim[psiindex][0][j] = wrk5->temparray[psiindex][0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psim[psiindex][im-1][j] = wrk5->temparray[psiindex][im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psim[psiindex][j][0] = wrk5->temparray[psiindex][j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psim[psiindex][j][jm-1] = wrk5->temparray[psiindex][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields->psim[psiindex][i][iindex] = wrk5->temparray[psiindex][i][iindex];
}
}
@ -465,7 +464,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
/* put the laplacian of the work7{1,2} arrays in the work4{1,2}
arrays; second step in the three-laplacian friction calculation */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
laplacalc(wrk5->work7[psiindex],
wrk4->work4[psiindex],
firstrow,lastrow,firstcol,lastcol,numrows,numcols);
@ -490,7 +489,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
/* put the laplacian of the work4{1,2} arrays in the work7{1,2}
arrays; third step in the three-laplacian friction calculation */
for (psiindex=0;psiindex<=1;psiindex++) {
for(psiindex=0;psiindex<=1;psiindex++) {
laplacalc(wrk4->work4[psiindex],
wrk5->work7[psiindex],
firstrow,lastrow,firstcol,lastcol,numrows,numcols);
@ -538,7 +537,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
frcng->tauz[im-1][jm-1]+lf*hh1*wrk5->work7[0][im-1][jm-1]+lf*hh3*wrk5->work7[1][im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->ga[0][j] = wrk4->work5[0][0][j]-wrk4->work5[1][0][j]+eig2*
wrk6->work6[0][j]+h1inv*frcng->tauz[0][j]+lf*wrk5->work7[0][0][j]-lf*wrk5->work7[0][0][j];
wrk1->gb[0][j] = hh1*wrk4->work5[0][0][j]+hh3*wrk4->work5[1][0][j]+hinv*
@ -546,7 +545,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->ga[im-1][j] = wrk4->work5[0][im-1][j]-wrk4->work5[1][im-1][j]+eig2*
wrk6->work6[im-1][j]+h1inv*frcng->tauz[im-1][j]+
lf*wrk5->work7[0][im-1][j]-lf*wrk5->work7[1][im-1][j];
@ -556,7 +555,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->ga[j][0] = wrk4->work5[0][j][0]-wrk4->work5[1][j][0]+eig2*
wrk6->work6[j][0]+h1inv*frcng->tauz[j][0]+lf*wrk5->work7[0][j][0]-lf*wrk5->work7[1][j][0];
wrk1->gb[j][0] = hh1*wrk4->work5[0][j][0]+hh3*wrk4->work5[1][j][0]+hinv*
@ -564,7 +563,7 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->ga[j][jm-1] = wrk4->work5[0][j][jm-1]-wrk4->work5[1][j][jm-1]+eig2*
wrk6->work6[j][jm-1]+h1inv*frcng->tauz[j][jm-1]+
lf*wrk5->work7[0][j][jm-1]-lf*wrk5->work7[1][j][jm-1];
@ -573,8 +572,8 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
lf*hh3*wrk5->work7[1][j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk1->ga[i][iindex] = wrk4->work5[0][i][iindex]-wrk4->work5[1][i][iindex]+eig2*
wrk6->work6[i][iindex]+h1inv*frcng->tauz[i][iindex]+
lf*wrk5->work7[0][i][iindex]-lf*wrk5->work7[1][i][iindex];
@ -614,35 +613,35 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
if (jend == jm-2) {
jend = jm-1;
}
for (i=istart;i<=iend;i++) {
for (j=jstart;j<=jend;j++) {
for(i=istart;i<=iend;i++) {
for(j=jstart;j<=jend;j++) {
multi->rhs_multi[numlev-1][i][j] = wrk1->ga[i][j] * ressqr;
}
}
if (istart == 0) {
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
multi->q_multi[numlev-1][0][j] = wrk1->ga[0][j];
}
}
if (iend == im-1) {
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
multi->q_multi[numlev-1][im-1][j] = wrk1->ga[im-1][j];
}
}
if (jstart == 0) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
multi->q_multi[numlev-1][i][0] = wrk1->ga[i][0];
}
}
if (jend == jm-1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
multi->q_multi[numlev-1][i][jm-1] = wrk1->ga[i][jm-1];
}
}
fac = 1.0 / (4.0 - ressqr*eig2);
for (i=ist;i<=ien;i++) {
for (j=jst;j<=jen;j++) {
for(i=ist;i<=ien;i++) {
for(j=jst;j<=jen;j++) {
multi->q_multi[numlev-1][i][j] = guess->oldga[i][j];
}
}
@ -664,8 +663,8 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
/* copy the solution for use as initial guess in next time-step */
for (i=istart;i<=iend;i++) {
for (j=jstart;j<=jend;j++) {
for(i=istart;i<=iend;i++) {
for(j=jstart;j<=jend;j++) {
wrk1->ga[i][j] = multi->q_multi[numlev-1][i][j];
guess->oldga[i][j] = multi->q_multi[numlev-1][i][j];
}
@ -700,27 +699,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
psiaipriv=psiaipriv+0.25*(wrk1->ga[im-1][jm-1]);
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psiaipriv = psiaipriv + 0.5*wrk1->ga[0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
psiaipriv = psiaipriv + 0.5*wrk1->ga[im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psiaipriv = psiaipriv + 0.5*wrk1->ga[j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
psiaipriv = psiaipriv + 0.5*wrk1->ga[j][jm-1];
}
}
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for (i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
psiaipriv = psiaipriv + wrk1->ga[i][iindex];
}
}
@ -761,27 +760,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk1->ga[im-1][jm-1] = wrk1->ga[im-1][jm-1]+f4*wrk1->psib[im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->ga[0][j] = wrk1->ga[0][j]+f4*wrk1->psib[0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk1->ga[im-1][j] = wrk1->ga[im-1][j]+f4*wrk1->psib[im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->ga[j][0] = wrk1->ga[j][0]+f4*wrk1->psib[j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk1->ga[j][jm-1] = wrk1->ga[j][jm-1]+f4*wrk1->psib[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk1->ga[i][iindex] = wrk1->ga[i][iindex]+f4*wrk1->psib[i][iindex];
}
}
@ -790,35 +789,35 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
#else
BARRIER(bars->barrier,nprocs)
#endif
for (i=istart;i<=iend;i++) {
for (j=jstart;j<=jend;j++) {
for(i=istart;i<=iend;i++) {
for(j=jstart;j<=jend;j++) {
multi->rhs_multi[numlev-1][i][j] = wrk1->gb[i][j] * ressqr;
}
}
if (istart == 0) {
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
multi->q_multi[numlev-1][0][j] = wrk1->gb[0][j];
}
}
if (iend == im-1) {
for (j=jstart;j<=jend;j++) {
for(j=jstart;j<=jend;j++) {
multi->q_multi[numlev-1][im-1][j] = wrk1->gb[im-1][j];
}
}
if (jstart == 0) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
multi->q_multi[numlev-1][i][0] = wrk1->gb[i][0];
}
}
if (jend == jm-1) {
for (i=istart;i<=iend;i++) {
for(i=istart;i<=iend;i++) {
multi->q_multi[numlev-1][i][jm-1] = wrk1->gb[i][jm-1];
}
}
fac = 1.0 / (4.0 - ressqr*eig2);
for (i=ist;i<=ien;i++) {
for (j=jst;j<=jen;j++) {
for(i=ist;i<=ien;i++) {
for(j=jst;j<=jen;j++) {
multi->q_multi[numlev-1][i][j] = guess->oldgb[i][j];
}
}
@ -834,8 +833,8 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
gp[procid].multi_time += (multi_end - multi_start);
}
for (i=istart;i<=iend;i++) {
for (j=jstart;j<=jend;j++) {
for(i=istart;i<=iend;i++) {
for(j=jstart;j<=jend;j++) {
wrk1->gb[i][j] = multi->q_multi[numlev-1][i][j];
guess->oldgb[i][j] = multi->q_multi[numlev-1][i][j];
}
@ -877,32 +876,32 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
wrk2->work3[im-1][jm-1] = wrk1->gb[im-1][jm-1]+hh3*wrk1->ga[im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk2->work3[0][j] = wrk1->gb[0][j]+hh3*wrk1->ga[0][j];
wrk3->work2[0][j] = wrk1->gb[0][j]-hh1*wrk1->ga[0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
wrk2->work3[im-1][j] = wrk1->gb[im-1][j]+hh3*wrk1->ga[im-1][j];
wrk3->work2[im-1][j] = wrk1->gb[im-1][j]-hh1*wrk1->ga[im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk2->work3[j][0] = wrk1->gb[j][0]+hh3*wrk1->ga[j][0];
wrk3->work2[j][0] = wrk1->gb[j][0]-hh1*wrk1->ga[j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
wrk2->work3[j][jm-1] = wrk1->gb[j][jm-1]+hh3*wrk1->ga[j][jm-1];
wrk3->work2[j][jm-1] = wrk1->gb[j][jm-1]-hh1*wrk1->ga[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
wrk2->work3[i][iindex] = wrk1->gb[i][iindex]+hh3*wrk1->ga[i][iindex];
wrk3->work2[i][iindex] = wrk1->gb[i][iindex]-hh1*wrk1->ga[i][iindex];
}
@ -936,27 +935,27 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
fields->psi[0][im-1][jm-1] = fields->psi[0][im-1][jm-1] + timst*wrk2->work3[im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[0][0][j] = fields->psi[0][0][j] + timst*wrk2->work3[0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[0][im-1][j] = fields->psi[0][im-1][j] + timst*wrk2->work3[im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[0][j][0] = fields->psi[0][j][0] + timst*wrk2->work3[j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[0][j][jm-1] = fields->psi[0][j][jm-1] + timst*wrk2->work3[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields->psi[0][i][iindex] = fields->psi[0][i][iindex] + timst*wrk2->work3[i][iindex];
}
}
@ -974,28 +973,28 @@ void slave2(long procid, long firstrow, long lastrow, long numrows, long firstco
fields->psi[1][im-1][jm-1] = fields->psi[1][im-1][jm-1] + timst*wrk3->work2[im-1][jm-1];
}
if (firstrow == 1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[1][0][j] = fields->psi[1][0][j] + timst*wrk3->work2[0][j];
}
}
if ((firstrow+numrows) == im-1) {
for (j=firstcol;j<=lastcol;j++) {
for(j=firstcol;j<=lastcol;j++) {
fields->psi[1][im-1][j] = fields->psi[1][im-1][j] + timst*wrk3->work2[im-1][j];
}
}
if (firstcol == 1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[1][j][0] = fields->psi[1][j][0] + timst*wrk3->work2[j][0];
}
}
if ((firstcol+numcols) == jm-1) {
for (j=firstrow;j<=lastrow;j++) {
for(j=firstrow;j<=lastrow;j++) {
fields->psi[1][j][jm-1] = fields->psi[1][j][jm-1] + timst*wrk3->work2[j][jm-1];
}
}
for (i=firstrow;i<=lastrow;i++) {
for (iindex=firstcol;iindex<=lastcol;iindex++) {
for(i=firstrow;i<=lastrow;i++) {
for(iindex=firstcol;iindex<=lastcol;iindex++) {
fields->psi[1][i][iindex] = fields->psi[1][i][iindex] + timst*wrk3->work2[i][iindex];
}
}

View File

@ -14,7 +14,7 @@
/* */
/*************************************************************************/
#include <cstdio>
#include <stdio.h>
EXTERN_ENV;
@ -37,7 +37,7 @@ void radiosity_averaging(Element *elem, long mode, long process_id)
Vertex pc ;
long reverse ;
if ( ! LEAF_ELEMENT(elem) )
if( ! LEAF_ELEMENT(elem) )
{
create_radavg_task( elem->center, mode, process_id ) ;
create_radavg_task( elem->top, mode, process_id ) ;
@ -46,7 +46,7 @@ void radiosity_averaging(Element *elem, long mode, long process_id)
return ;
}
else if ( mode == RAD_AVERAGING_MODE )
else if( mode == RAD_AVERAGING_MODE )
{
/* Compute center point */
center_point( &elem->ev1->p, &elem->ev2->p, &elem->ev3->p, &pc ) ;
@ -62,7 +62,7 @@ void radiosity_averaging(Element *elem, long mode, long process_id)
{
/* Normalize it */
LOCK(elem->ev1->ev_lock->lock);
if ( elem->ev1->weight != 1.0 )
if( elem->ev1->weight != 1.0 )
{
inv_weight = (float)1.0 / elem->ev1->weight ;
elem->ev1->col.r *= inv_weight ;
@ -73,7 +73,7 @@ void radiosity_averaging(Element *elem, long mode, long process_id)
UNLOCK(elem->ev1->ev_lock->lock);
LOCK(elem->ev2->ev_lock->lock);
if ( elem->ev2->weight != 1.0 )
if( elem->ev2->weight != 1.0 )
{
inv_weight = (float)1.0 / elem->ev2->weight ;
elem->ev2->col.r *= inv_weight ;
@ -84,7 +84,7 @@ void radiosity_averaging(Element *elem, long mode, long process_id)
UNLOCK(elem->ev2->ev_lock->lock);
LOCK(elem->ev3->ev_lock->lock);
if ( elem->ev3->weight != 1.0 )
if( elem->ev3->weight != 1.0 )
{
inv_weight = (float)1.0 / elem->ev3->weight ;
elem->ev3->col.r *= inv_weight ;
@ -101,7 +101,7 @@ static void add_radiosity_to_vertex(Edge *edge, long reverse, Element *elem, Ver
ElemVertex *ev ;
float weight ;
if ( reverse )
if( reverse )
ev = edge->pb ;
else
ev = edge->pa ;
@ -176,28 +176,28 @@ void display_scene(long fill_sw, long patch_sw, long mesh_sw, long interaction_s
/* Set matrix */
g_setup_view( view_rot_x, view_rot_y, view_dist, view_zoom ) ;
if ( fill_sw == 2 )
if( fill_sw == 2 )
{
/* Fill surfaces */
display_elements_in_bsp_tree( DISPLAY_SHADED, process_id ) ;
}
if ( fill_sw == 1 )
if( fill_sw == 1 )
{
/* Fill surfaces */
display_elements_in_bsp_tree( DISPLAY_FILLED, process_id ) ;
}
if ( mesh_sw )
if( mesh_sw )
{
/* Draw mesh */
g_color( G_BLUE ) ;
display_elements_in_bsp_tree( DISPLAY_EDGEONLY, process_id ) ;
}
if ( patch_sw )
if( patch_sw )
{
g_color( G_RED ) ;
display_patches_in_bsp_tree( DISPLAY_EDGEONLY, process_id ) ;
}
if ( interaction_sw )
if( interaction_sw )
{
g_color( G_GREEN ) ;
display_interactions_in_bsp_tree(process_id) ;
@ -218,9 +218,9 @@ void display_patch(Patch *patch, long mode, long process_id)
Vertex p_buf[4] ;
Rgb c_buf[4] ;
if ( mode == DISPLAY_SHADED )
if( mode == DISPLAY_SHADED )
{
if ( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
if( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
return ;
p_buf[0] = patch->p1 ;
@ -232,9 +232,9 @@ void display_patch(Patch *patch, long mode, long process_id)
g_spolygon( 3, p_buf, c_buf ) ;
}
else if ( mode == DISPLAY_FILLED )
else if( mode == DISPLAY_FILLED )
{
if ( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
if( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
return ;
p_buf[0] = patch->p1 ;
@ -275,16 +275,16 @@ void display_element(Element *element, long mode, long process_id)
{
Vertex p_buf[4] ;
if ( inner_product( &element->patch->plane_equ.n, &view_vec ) < F_ZERO )
if( inner_product( &element->patch->plane_equ.n, &view_vec ) < F_ZERO )
return ;
if ( mode == DISPLAY_SHADED )
if( mode == DISPLAY_SHADED )
{
_display_shaded_triangle( element->ev1, element->ev2,
element->ev3,
element->e12, element->e23, element->e31, process_id ) ;
}
else if ( mode == DISPLAY_FILLED )
else if( mode == DISPLAY_FILLED )
{
g_rgb( element->rad ) ;
p_buf[0] = element->ev1->p ;
@ -361,7 +361,7 @@ static void _disp_interactions(Element *elem, Interaction *inter, long mode, lon
/* Display interactions only with a particular patch */
if ( (mode == DISPLAY_HALF_INTERACTIONS)
if( (mode == DISPLAY_HALF_INTERACTIONS)
&& (inter->destination->patch->seq_no >= elem->patch->seq_no ) )
return ;
@ -417,24 +417,24 @@ void display_interactions_in_bsp_tree(long process_id)
void ps_display_scene(long fill_sw, long patch_sw, long mesh_sw, long interaction_sw, long process_id)
{
if ( fill_sw )
if( fill_sw )
{
/* Fill surfaces */
ps_display_elements_in_bsp_tree( DISPLAY_SHADED, process_id ) ;
}
if ( mesh_sw )
if( mesh_sw )
{
/* Draw mesh */
ps_linewidth( 0.5 ) ;
ps_display_elements_in_bsp_tree( DISPLAY_EDGEONLY, process_id ) ;
}
if ( patch_sw )
if( patch_sw )
{
/* Draw patches */
ps_linewidth( 1.2 ) ;
ps_display_patches_in_bsp_tree( DISPLAY_EDGEONLY, process_id ) ;
}
if ( interaction_sw )
if( interaction_sw )
{
/* Draw interactions */
ps_linewidth( 0.2 ) ;
@ -454,9 +454,9 @@ void ps_display_patch(Patch *patch, long mode, long process_id)
Vertex p_buf[4] ;
Rgb c_buf[4] ;
if ( mode == DISPLAY_SHADED )
if( mode == DISPLAY_SHADED )
{
if ( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
if( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
return ;
p_buf[0] = patch->p1 ;
p_buf[1] = patch->p2 ;
@ -467,9 +467,9 @@ void ps_display_patch(Patch *patch, long mode, long process_id)
ps_spolygon( 3, p_buf, c_buf ) ;
}
else if ( mode == DISPLAY_FILLED )
else if( mode == DISPLAY_FILLED )
{
if ( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
if( inner_product( &patch->plane_equ.n, &view_vec ) < F_ZERO )
return ;
p_buf[0] = patch->p1 ;
p_buf[1] = patch->p2 ;
@ -512,9 +512,9 @@ void ps_display_element(Element *element, long mode, long process_id)
Vertex p_buf[4] ;
Rgb c_buf[4] ;
if ( mode == DISPLAY_SHADED )
if( mode == DISPLAY_SHADED )
{
if ( inner_product( &element->patch->plane_equ.n, &view_vec )
if( inner_product( &element->patch->plane_equ.n, &view_vec )
< F_ZERO )
return ;
p_buf[0] = element->ev1->p ;
@ -526,9 +526,9 @@ void ps_display_element(Element *element, long mode, long process_id)
ps_spolygon( 3, p_buf, c_buf ) ;
}
else if ( mode == DISPLAY_FILLED )
else if( mode == DISPLAY_FILLED )
{
if ( inner_product( &element->patch->plane_equ.n, &view_vec )
if( inner_product( &element->patch->plane_equ.n, &view_vec )
< F_ZERO )
return ;
p_buf[0] = element->ev1->p ;
@ -589,7 +589,7 @@ static void _ps_disp_interactions(Element *elem, Interaction *inter, long mode,
Element *edst ;
/* Display interactions only with a particular patch */
if ( (mode == DISPLAY_HALF_INTERACTIONS)
if( (mode == DISPLAY_HALF_INTERACTIONS)
&& (inter->destination->patch->seq_no >= elem->patch->seq_no ) )
return ;

View File

@ -23,7 +23,7 @@
*/
#include <cstdio>
#include <stdio.h>
EXTERN_ENV;
@ -65,11 +65,11 @@ void foreach_element_in_patch(Patch *patch, void (*func)(), long arg1, long pro
static void _foreach_element(Element *elem, void (*func)(), long arg1, long process_id)
{
if ( elem == 0 )
if( elem == 0 )
return ;
/* Process children */
if ( ! LEAF_ELEMENT( elem ) )
if( ! LEAF_ELEMENT( elem ) )
{
_foreach_element( elem->center, func, arg1, process_id ) ;
_foreach_element( elem->top, func, arg1, process_id ) ;
@ -90,11 +90,11 @@ void foreach_leaf_element_in_patch(Patch *patch, void (*func)(), long arg1, lon
static void _foreach_leaf_element(Element *elem, void (*func)(), long arg1, long process_id )
{
if ( elem == 0 )
if( elem == 0 )
return ;
/* Process children */
if ( LEAF_ELEMENT( elem ) )
if( LEAF_ELEMENT( elem ) )
func( elem, arg1, process_id ) ;
else
{
@ -141,11 +141,11 @@ void ff_refine_elements(Element *e1, Element *e2, long level, long process_id)
subdiv_advice = error_analysis( e1, e2, &i12, &i21, process_id ) ;
/* Execute subdivision procedure */
if ( NO_INTERACTION(subdiv_advice) )
if( NO_INTERACTION(subdiv_advice) )
/* Two elements are mutually invisible. Do nothing */
return ;
else if ( NO_REFINEMENT_NECESSARY(subdiv_advice) )
else if( NO_REFINEMENT_NECESSARY(subdiv_advice) )
{
/* Create links and finish the job */
inter = get_interaction(process_id) ;
@ -162,12 +162,12 @@ void ff_refine_elements(Element *e1, Element *e2, long level, long process_id)
/* Update cost variable */
pc1 = &global->patch_cost[ e1->patch->seq_no ] ;
pc2 = &global->patch_cost[ e2->patch->seq_no ] ;
if ( pc1->n_total_inter <= 13 )
if( pc1->n_total_inter <= 13 )
cost1 = (long)ceil(e1->area / Area_epsilon) ;
else
cost1 = 1 ;
if ( pc2->n_total_inter <= 13 )
if( pc2->n_total_inter <= 13 )
cost2 = (long)ceil(e2->area / Area_epsilon) ;
else
cost2 = 1 ;
@ -183,7 +183,7 @@ void ff_refine_elements(Element *e1, Element *e2, long level, long process_id)
#endif
}
else if ( REFINE_PATCH_1(subdiv_advice) )
else if( REFINE_PATCH_1(subdiv_advice) )
{
/* Refine patch 1 */
subdivide_element( e1, process_id ) ;
@ -224,13 +224,13 @@ long error_analysis(Element *e1, Element *e2, Interaction *inter12, Interaction
/* Check visibility */
cc = patch_intersection( &e1->patch->plane_equ,
&e2->ev1->p, &e2->ev2->p, &e2->ev3->p, process_id ) ;
if ( NEGATIVE_SIDE(cc) )
if( NEGATIVE_SIDE(cc) )
/* If negative or on the plane, then do nothing */
return( _NO_INTERACTION ) ;
cc = patch_intersection( &e2->patch->plane_equ,
&e1->ev1->p, &e1->ev2->p, &e1->ev3->p, process_id ) ;
if ( NEGATIVE_SIDE(cc) )
if( NEGATIVE_SIDE(cc) )
/* If negative or on the plane, then do nothing */
return( _NO_INTERACTION ) ;
@ -261,14 +261,14 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
visibility_val = NO_VISIBILITY_NECESSARY(subdiv)?
(float)1.0 : VISIBILITY_UNDEF ;
if ( REFINE_PATCH_1(subdiv) )
if( REFINE_PATCH_1(subdiv) )
{
/* Refine this element */
/* (1) Make sure it has children */
subdivide_element( elem, process_id ) ;
/* (2) For each of the patch, create an interaction */
if ( element_completely_invisible( elem->center, e_dst, process_id ) == 0 )
if( element_completely_invisible( elem->center, e_dst, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem->center, e_dst, pi, process_id ) ;
@ -276,7 +276,7 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
insert_vis_undef_interaction( elem->center, pi, process_id ) ;
new_inter++ ;
}
if ( element_completely_invisible( elem->top, e_dst, process_id ) == 0 )
if( element_completely_invisible( elem->top, e_dst, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem->top, e_dst, pi, process_id ) ;
@ -284,7 +284,7 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
insert_vis_undef_interaction( elem->top, pi, process_id ) ;
new_inter++ ;
}
if ( element_completely_invisible( elem->left, e_dst, process_id ) == 0 )
if( element_completely_invisible( elem->left, e_dst, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem->left, e_dst, pi, process_id ) ;
@ -292,7 +292,7 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
insert_vis_undef_interaction( elem->left, pi, process_id ) ;
new_inter++ ;
}
if ( element_completely_invisible( elem->right, e_dst, process_id ) == 0 )
if( element_completely_invisible( elem->right, e_dst, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem->right, e_dst, pi, process_id ) ;
@ -311,7 +311,7 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
NOTE: Use *inter as a place holder to link 4 new interactions
since *prev may be NULL */
if ( element_completely_invisible( elem, e_dst->center, process_id ) == 0 )
if( element_completely_invisible( elem, e_dst->center, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem, e_dst->center, pi, process_id ) ;
@ -319,7 +319,7 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
insert_vis_undef_interaction( elem, pi, process_id ) ;
new_inter++ ;
}
if ( element_completely_invisible( elem, e_dst->top, process_id ) == 0 )
if( element_completely_invisible( elem, e_dst->top, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem, e_dst->top, pi, process_id ) ;
@ -327,7 +327,7 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
insert_vis_undef_interaction( elem, pi, process_id ) ;
new_inter++ ;
}
if ( element_completely_invisible( elem, e_dst->left, process_id ) == 0 )
if( element_completely_invisible( elem, e_dst->left, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem, e_dst->left, pi, process_id ) ;
@ -335,7 +335,7 @@ static long bf_refine_element(long subdiv, Element *elem, Interaction *inter, l
insert_vis_undef_interaction( elem, pi, process_id ) ;
new_inter++ ;
}
if ( element_completely_invisible( elem, e_dst->right, process_id ) == 0 )
if( element_completely_invisible( elem, e_dst->right, process_id ) == 0 )
{
pi = get_interaction(process_id) ;
compute_formfactor( elem, e_dst->right, pi, process_id ) ;
@ -372,12 +372,12 @@ void bf_error_analysis_list(Element *elem, Interaction *i_list, long process_id)
long delta_n_inter = 0 ;
while ( inter )
while( inter )
{
/* Analyze error */
subdiv_advice = bf_error_analysis( elem, inter, process_id ) ;
if ( NO_REFINEMENT_NECESSARY(subdiv_advice) )
if( NO_REFINEMENT_NECESSARY(subdiv_advice) )
{
/* Go on to the next interaction */
prev = inter ;
@ -389,7 +389,7 @@ void bf_error_analysis_list(Element *elem, Interaction *i_list, long process_id)
/* Remove this interaction from the list */
refine_inter = inter ;
inter = inter->next ;
if ( prev == 0 )
if( prev == 0 )
i_list = inter ;
else
prev->next = inter ;
@ -405,7 +405,7 @@ void bf_error_analysis_list(Element *elem, Interaction *i_list, long process_id)
}
/* Link good interactions to elem->intearctions */
if ( i_len > 0 )
if( i_len > 0 )
{
LOCK(elem->elem_lock->lock);
prev->next = elem->interactions ;
@ -416,7 +416,7 @@ void bf_error_analysis_list(Element *elem, Interaction *i_list, long process_id)
#if PATCH_ASSIGNMENT == PATCH_ASSIGNMENT_COSTBASED
/* Update patch interaction count */
if ( delta_n_inter != 0 )
if( delta_n_inter != 0 )
{
Patch_Cost *pc ;
@ -453,7 +453,7 @@ long bf_error_analysis(Element *elem, Interaction *inter, long process_id)
= B FV + B (Ferr V + F Verr + Ferr Verr)
*/
if ( (0.0 < inter->visibility) && (inter->visibility < 1.0) )
if( (0.0 < inter->visibility) && (inter->visibility < 1.0) )
visibility_error = 1.0 ;
else
visibility_error = FF_VISIBILITY_ERROR ;
@ -467,21 +467,21 @@ long bf_error_analysis(Element *elem, Interaction *inter, long process_id)
+ visibility_error * inter->formfactor_err) * rad_avg ;
/* If BF is smaller than the threshold, then not subdivide */
if ( (total_error <= BFepsilon) && (elem->n_interactions <= 10) )
if( (total_error <= BFepsilon) && (elem->n_interactions <= 10) )
return( _NO_REFINEMENT_NECESSARY ) ;
else if ( total_error <= BFepsilon * 0.5 )
else if( total_error <= BFepsilon * 0.5 )
return( _NO_REFINEMENT_NECESSARY ) ;
/* Subdivide light source or receiver whichever is larger */
if ( elem->area > inter->destination->area )
if( elem->area > inter->destination->area )
{
if ( elem->area > Area_epsilon )
if( elem->area > Area_epsilon )
/* Subdivide this element (receiver) */
return( _REFINE_PATCH_1 | vis_code ) ;
}
else
{
if ( inter->destination->area > Area_epsilon )
if( inter->destination->area > Area_epsilon )
/* Subdivide source element */
return( _REFINE_PATCH_2 | vis_code ) ;
@ -518,7 +518,7 @@ long radiosity_converged(long process_id)
prev_total += 1.0e-4 ;
difference = fabs( (current_total / prev_total) - (float)1.0 ) ;
if ( verbose_mode )
if( verbose_mode )
{
rad = global->total_energy ;
rad.r /= global->total_patch_area ;
@ -531,7 +531,7 @@ long radiosity_converged(long process_id)
printf( "Difference %.2f%%\n", difference * 100.0 ) ;
}
if ( difference <= Energy_epsilon )
if( difference <= Energy_epsilon )
return( 1 ) ;
else
return( 0 ) ;
@ -558,7 +558,7 @@ void subdivide_element(Element *e, long process_id)
LOCK(e->elem_lock->lock);
/* Check if the element already has children */
if ( ! _LEAF_ELEMENT(e) )
if( ! _LEAF_ELEMENT(e) )
{
UNLOCK(e->elem_lock->lock);
return ;
@ -710,7 +710,7 @@ void process_rays(Element *e, long process_id)
/* For each interaction, do BF-error-analysis */
bf_error_analysis_list( e, i_list, process_id ) ;
if ( e->n_vis_undef_inter == 0 )
if( e->n_vis_undef_inter == 0 )
process_rays3( e, process_id ) ;
else
/* Some interactions were refined.
@ -736,7 +736,7 @@ static void process_rays2(Element *e, long process_id)
/* For each interaction, do BF-error-analysis */
bf_error_analysis_list( e, i_list, process_id ) ;
if ( e->n_vis_undef_inter == 0 )
if( e->n_vis_undef_inter == 0 )
process_rays3( e, process_id ) ;
else
/* Some interactions were refined.
@ -755,7 +755,7 @@ static void process_rays3(Element *e, long process_id)
gather_rays( e, process_id ) ;
/* Now visit children */
if ( ! LEAF_ELEMENT(e) )
if( ! LEAF_ELEMENT(e) )
{
/* Compute radiosity that is pushed to descendents */
rad_push.r = e->rad_in.r + e->rad_subtree.r ;
@ -822,7 +822,7 @@ static void elem_join_operation(Element *e, Element *ec, long process_id)
#endif
while ( e != 0 )
while( e != 0 )
{
/* Get radiosity of the child and add to my radiosity */
LOCK(e->elem_lock->lock);
@ -833,7 +833,7 @@ static void elem_join_operation(Element *e, Element *ec, long process_id)
join_flag = (e->join_counter == 0) ;
UNLOCK(e->elem_lock->lock);
if ( join_flag == 0 )
if( join_flag == 0 )
/* Other children are not finished. Return. */
return ;
@ -892,7 +892,7 @@ static void gather_rays(Element *elem, long process_id)
/* Return immediately if there is no interaction */
if ( (inter = elem->interactions) == 0 )
if( (inter = elem->interactions) == 0 )
{
elem->rad_subtree.r = 0.0 ;
elem->rad_subtree.g = 0.0 ;
@ -907,7 +907,7 @@ static void gather_rays(Element *elem, long process_id)
rad_elem.g = 0.0 ;
rad_elem.b = 0.0 ;
while ( inter )
while( inter )
{
/* Be careful !
Use FF(out) to compute incoming energy */
@ -951,13 +951,13 @@ long element_completely_invisible(Element *e1, Element *e2, long process_id)
/* Check visibility */
cc = patch_intersection( &e1->patch->plane_equ,
&e2->ev1->p, &e2->ev2->p, &e2->ev3->p, process_id ) ;
if ( NEGATIVE_SIDE(cc) )
if( NEGATIVE_SIDE(cc) )
/* If negative or on the plane, then do nothing */
return( 1 ) ;
cc = patch_intersection( &e2->patch->plane_equ,
&e1->ev1->p, &e1->ev2->p, &e1->ev3->p, process_id ) ;
if ( NEGATIVE_SIDE(cc) )
if( NEGATIVE_SIDE(cc) )
/* If negative or on the plane, then do nothing */
return( 1 ) ;
@ -981,7 +981,7 @@ Element *get_element(long process_id)
LOCK(global->free_element_lock);
/* Test pointer */
if ( global->free_element == 0 )
if( global->free_element == 0 )
{
printf( "Fatal: Ran out of element buffer\n" ) ;
UNLOCK(global->free_element_lock);
@ -1049,7 +1049,7 @@ void init_elemlist(long process_id)
long i ;
/* Initialize Element free list */
for ( i = 0 ; i < MAX_ELEMENTS-1 ; i++ )
for( i = 0 ; i < MAX_ELEMENTS-1 ; i++ )
{
global->element_buf[i].center = &global->element_buf[i+1] ;
/* Initialize lock variable */
@ -1110,10 +1110,10 @@ void foreach_interaction_in_element(Element *elem, void (*func)(), long arg1, lo
{
Interaction *inter ;
if ( elem == 0 )
if( elem == 0 )
return ;
for ( inter = elem->interactions ; inter ; inter = inter->next )
for( inter = elem->interactions ; inter ; inter = inter->next )
func( elem, inter, arg1, process_id ) ;
}
@ -1147,18 +1147,18 @@ void compute_formfactor(Element *e_src, Element *e_dst, Interaction *inter, long
ff_c1 = compute_diff_disc_formfactor( &pc1_src, e_src, &pc_dst, e_dst, process_id ) ;
ff_c2 = compute_diff_disc_formfactor( &pc2_src, e_src, &pc_dst, e_dst, process_id ) ;
ff_c3 = compute_diff_disc_formfactor( &pc3_src, e_src, &pc_dst, e_dst, process_id ) ;
if ( ff_c < 0 ) ff_c = 0 ;
if ( ff_c1 < 0 ) ff_c1 = 0 ;
if ( ff_c2 < 0 ) ff_c2 = 0 ;
if ( ff_c3 < 0 ) ff_c3 = 0 ;
if( ff_c < 0 ) ff_c = 0 ;
if( ff_c1 < 0 ) ff_c1 = 0 ;
if( ff_c2 < 0 ) ff_c2 = 0 ;
if( ff_c3 < 0 ) ff_c3 = 0 ;
ff_avg = (ff_c + ff_c1 + ff_c2 + ff_c3) * (float)0.25 ;
ff_min = ff_max = ff_c ;
if ( ff_min > ff_c1 ) ff_min = ff_c1 ;
if ( ff_min > ff_c2 ) ff_min = ff_c2 ;
if ( ff_min > ff_c3 ) ff_min = ff_c3 ;
if ( ff_max < ff_c1 ) ff_max = ff_c1 ;
if ( ff_max < ff_c2 ) ff_max = ff_c2 ;
if ( ff_max < ff_c3 ) ff_max = ff_c3 ;
if( ff_min > ff_c1 ) ff_min = ff_c1 ;
if( ff_min > ff_c2 ) ff_min = ff_c2 ;
if( ff_min > ff_c3 ) ff_min = ff_c3 ;
if( ff_max < ff_c1 ) ff_max = ff_c1 ;
if( ff_max < ff_c2 ) ff_max = ff_c2 ;
if( ff_max < ff_c3 ) ff_max = ff_c3 ;
/* (2) Compute FF(diff-disc) from the 3 vertices of the source */
ff_1 = compute_diff_disc_formfactor( &e_src->ev1->p, e_src,
@ -1170,26 +1170,26 @@ void compute_formfactor(Element *e_src, Element *e_dst, Interaction *inter, long
/* (3) Find FF min and max */
ff_min = ff_max = ff_c ;
if ( ff_min > ff_1 ) ff_min = ff_1 ;
if ( ff_min > ff_2 ) ff_min = ff_2 ;
if ( ff_min > ff_3 ) ff_min = ff_3 ;
if ( ff_max < ff_1 ) ff_max = ff_1 ;
if ( ff_max < ff_2 ) ff_max = ff_2 ;
if ( ff_max < ff_3 ) ff_max = ff_3 ;
if( ff_min > ff_1 ) ff_min = ff_1 ;
if( ff_min > ff_2 ) ff_min = ff_2 ;
if( ff_min > ff_3 ) ff_min = ff_3 ;
if( ff_max < ff_1 ) ff_max = ff_1 ;
if( ff_max < ff_2 ) ff_max = ff_2 ;
if( ff_max < ff_3 ) ff_max = ff_3 ;
/* (4) Clip FF(diff-disc) if it is negative */
if ( ff_avg < 0 )
if( ff_avg < 0 )
ff_avg = 0 ;
inter->formfactor_out = ff_avg ;
/* (5) Then find maximum difference from the FF at the center */
ff_err = (ff_max - ff_avg) ;
if ( ff_err < (ff_avg - ff_min) )
if( ff_err < (ff_avg - ff_min) )
ff_err = ff_avg - ff_min ;
inter->formfactor_err = ff_err ;
/* (6) Correct visibility if partially visible */
if ( (ff_avg < 0) && (inter->visibility == 0) )
if( (ff_avg < 0) && (inter->visibility == 0) )
/* All ray missed the visible portion of the elements.
Set visibility to a non-zero value manually */
/** inter->visibility = FF_VISIBILITY_ERROR **/ ;
@ -1244,10 +1244,10 @@ static float compute_diff_disc_formfactor(Vertex *p, Element *e_src, Vertex *p_d
ff_c3= _diff_disc_formfactor( p, e_src, &p_c3, quarter_area,
&e_dst->patch->plane_equ.n, process_id ) ;
if ( ff_c < 0 ) ff_c = 0 ;
if ( ff_c1 < 0 ) ff_c1 = 0 ;
if ( ff_c2 < 0 ) ff_c2 = 0 ;
if ( ff_c3 < 0 ) ff_c3 = 0 ;
if( ff_c < 0 ) ff_c = 0 ;
if( ff_c1 < 0 ) ff_c1 = 0 ;
if( ff_c2 < 0 ) ff_c2 = 0 ;
if( ff_c3 < 0 ) ff_c3 = 0 ;
return( ff_c + ff_c1 + ff_c2 + ff_c3 ) ;
}
@ -1256,7 +1256,7 @@ static float compute_diff_disc_formfactor(Vertex *p, Element *e_src, Vertex *p_d
void compute_interaction(Element *e_src, Element *e_dst, Interaction *inter, long subdiv, long process_id)
{
/* (1) Check visibility. */
if ( NO_VISIBILITY_NECESSARY(subdiv) )
if( NO_VISIBILITY_NECESSARY(subdiv) )
inter->visibility = 1.0 ;
else
inter->visibility = VISIBILITY_UNDEF ;
@ -1296,7 +1296,7 @@ void delete_interaction(Element *elem, Interaction *prev, Interaction *inter, lo
{
/* Remove from the list */
LOCK(elem->elem_lock->lock);
if ( prev == 0 )
if( prev == 0 )
elem->interactions = inter->next ;
else
prev->next = inter->next ;
@ -1323,7 +1323,7 @@ void delete_vis_undef_interaction(Element *elem, Interaction *prev, Interaction
{
/* Remove from the list */
LOCK(elem->elem_lock->lock);
if ( prev == 0 )
if( prev == 0 )
elem->vis_undef_inter = inter->next ;
else
prev->next = inter->next ;
@ -1349,7 +1349,7 @@ Interaction *get_interaction(long process_id)
LOCK(global->free_interaction_lock);
/* Test pointer */
if ( global->free_interaction == 0 )
if( global->free_interaction == 0 )
{
printf( "Fatal: Ran out of interaction buffer\n" ) ;
UNLOCK(global->free_interaction_lock);
@ -1402,7 +1402,7 @@ void init_interactionlist(long process_id)
long i ;
/* Initialize Interaction free list */
for ( i = 0 ; i < MAX_INTERACTIONS-1 ; i++ )
for( i = 0 ; i < MAX_INTERACTIONS-1 ; i++ )
global->interaction_buf[i].next = &global->interaction_buf[i+1] ;
global->interaction_buf[ MAX_INTERACTIONS-1 ].next = 0 ;
global->free_interaction = global->interaction_buf ;

View File

@ -8,9 +8,8 @@
*
***************************************************************/
#include <math.h>
#include <stdio.h>
#include <math.h>
#include "pslib.h"
#define SCREEN_WIDTH (6.0*72)
@ -70,7 +69,7 @@ static double cdet(Matrix *m, long r0, long r1, long r2, long c0, long c1, long
long ps_open(char *file)
{
if ( (ps_fd = fopen( file, "w" )) == 0 )
if( (ps_fd = fopen( file, "w" )) == 0 )
{
perror( file ) ;
return( 0 ) ;
@ -97,7 +96,7 @@ long ps_open(char *file)
void ps_close()
{
if ( ps_fd == 0 )
if( ps_fd == 0 )
return ;
@ -118,7 +117,7 @@ void ps_close()
void ps_linewidth(float w)
{
if ( ps_fd == 0 )
if( ps_fd == 0 )
return ;
fprintf( ps_fd, "%f setlinewidth\n", w ) ;
@ -137,7 +136,7 @@ void ps_line(Vertex *p1, Vertex *p2)
Vertex2 v1, v2 ;
float x1, y1, x2, y2 ;
if ( ps_fd == 0 )
if( ps_fd == 0 )
return ;
v1.v[0] = p1->x ; v1.v[1] = p1->y ; v1.v[2] = p1->z ; v1.v[3] = 1.0 ;
@ -167,7 +166,7 @@ void ps_polygonedge(long n, Vertex *p_list)
Vertex2 v ;
long i ;
if ( ps_fd == 0 )
if( ps_fd == 0 )
return ;
/* Transform */
@ -180,7 +179,7 @@ void ps_polygonedge(long n, Vertex *p_list)
dcy = v.v[1] / v.v[3] ;
fprintf( ps_fd, "newpath\n%f %f moveto\n", dcx, dcy ) ;
for ( i = 1 ; i < n ; i++ )
for( i = 1 ; i < n ; i++ )
{
/* Transform */
v.v[0] = p_list[i].x ;
@ -210,7 +209,7 @@ void ps_polygon(long n, Vertex *p_list)
Vertex2 v ;
long i ;
if ( ps_fd == 0 )
if( ps_fd == 0 )
return ;
/* Transform */
@ -223,7 +222,7 @@ void ps_polygon(long n, Vertex *p_list)
dcy = v.v[1] / v.v[3] ;
fprintf( ps_fd, "newpath\n%f %f moveto\n", dcx, dcy ) ;
for ( i = 1 ; i < n ; i++ )
for( i = 1 ; i < n ; i++ )
{
/* Transform */
v.v[0] = p_list[i].x ;
@ -254,7 +253,7 @@ void ps_spolygon(long n, Vertex *p_list, Rgb *c_list)
long i ;
float gray_scale ;
if ( ps_fd == 0 )
if( ps_fd == 0 )
return ;
/* Transform */
@ -267,7 +266,7 @@ void ps_spolygon(long n, Vertex *p_list, Rgb *c_list)
dcy = v.v[1] / v.v[3] ;
fprintf( ps_fd, "newpath\n%f %f moveto\n", dcx, dcy ) ;
for ( i = 1 ; i < n ; i++ )
for( i = 1 ; i < n ; i++ )
{
/* Transform */
v.v[0] = p_list[i].x ;
@ -282,9 +281,9 @@ void ps_spolygon(long n, Vertex *p_list, Rgb *c_list)
}
gray_scale = c_list[0].g ;
if ( gray_scale > 1.0 )
if( gray_scale > 1.0 )
gray_scale = 1.0 ;
else if ( gray_scale < 0.0 )
else if( gray_scale < 0.0 )
gray_scale = 0.0 ;
fprintf( ps_fd, "closepath %f setgray fill\n", gray_scale ) ;
@ -414,12 +413,12 @@ static void gset_unit_matrix(Matrix *mtx)
long row, col ;
/* Clear the matrix */
for ( row = 0 ; row < 4 ; row++ )
for ( col = 0 ; col < 4 ; col++ )
for( row = 0 ; row < 4 ; row++ )
for( col = 0 ; col < 4 ; col++ )
mtx->m[row][col] = 0.0 ;
/* Set 1.0s along diagonal line */
for ( row = 0 ; row < 4 ; row++ )
for( row = 0 ; row < 4 ; row++ )
mtx->m[row][row] = 1.0 ;
}
@ -444,18 +443,18 @@ static void gconcatenate_matrix(long precat, Matrix *m1, Matrix *m2)
/* Swap pointer according to the concatenation mode */
dest = m1 ;
if ( precat == 1 )
if( precat == 1 )
{
m1 = m2 ;
m2 = dest ;
}
/* concatenate it */
for ( row = 0 ; row < 4 ; row++ )
for ( col = 0 ; col < 4 ; col++ )
for( row = 0 ; row < 4 ; row++ )
for( col = 0 ; col < 4 ; col++ )
{
temp.m[row][col] = 0.0 ;
for ( scan = 0 ; scan < 4 ; scan++ )
for( scan = 0 ; scan < 4 ; scan++ )
temp.m[row][col] +=
m1->m[row][scan] * m2->m[scan][col];
}
@ -660,13 +659,13 @@ static double det(Matrix *m)
/* Expand with respect to column 4 */
det_sum = 0.0 ;
if ( m->m[0][3] != 0.0 )
if( m->m[0][3] != 0.0 )
det_sum -= m->m[0][3] * cdet( m, 1, 2, 3, 0, 1, 2 ) ;
if ( m->m[1][3] != 0.0 )
if( m->m[1][3] != 0.0 )
det_sum += m->m[1][3] * cdet( m, 0, 2, 3, 0, 1, 2 ) ;
if ( m->m[2][3] != 0.0 )
if( m->m[2][3] != 0.0 )
det_sum -= m->m[2][3] * cdet( m, 0, 1, 3, 0, 1, 2 ) ;
if ( m->m[3][3] != 0.0 )
if( m->m[3][3] != 0.0 )
det_sum += m->m[3][3] * cdet( m, 0, 1, 2, 0, 1, 2 ) ;
return( det_sum ) ;

View File

@ -24,7 +24,7 @@
*
*************************************************************************/
#include <cstdio>
#include <stdio.h>
EXTERN_ENV;
@ -124,7 +124,7 @@ void init_modeling_tasks(long process_id)
extern ModelDataBase room_model[] ;
extern ModelDataBase largeroom_model[] ;
if ( ! check_task_counter() )
if( ! check_task_counter() )
return ;
switch( model_selector )
@ -161,7 +161,7 @@ static void init_room_model_tasks(ModelDataBase *model, long process_id)
{
ModelDataBase *pm ;
for ( pm = model ; pm->type != MODEL_NULL ; pm++ )
for( pm = model ; pm->type != MODEL_NULL ; pm++ )
create_modeling_task( &pm->model, pm->type, process_id ) ;
}

View File

@ -24,7 +24,7 @@
*
*************************************************************************/
#include <cstdio>
#include <stdio.h>
EXTERN_ENV;
@ -60,18 +60,18 @@ void foreach_patch_in_bsp(void (*func)(), long arg1, long process_id)
static void _foreach_patch(Patch *node, void (*func)(), long arg1, long process_id)
{
if ( node == 0 )
if( node == 0 )
return ;
/* Process subtree(-) */
if ( node->bsp_negative )
if( node->bsp_negative )
_foreach_patch( node->bsp_negative, func, arg1, process_id ) ;
/* Apply function to this node */
func( node, arg1, process_id ) ;
/* Process subtree(+) */
if ( node->bsp_positive )
if( node->bsp_positive )
_foreach_patch( node->bsp_positive, func, arg1, process_id ) ;
}
@ -99,38 +99,38 @@ static void _foreach_d_s_patch(Vertex *svec, Patch *node, void (*func)(), long a
{
float sign ;
if ( node == 0 )
if( node == 0 )
return ;
/* Compute inner product */
sign = inner_product( svec, &node->plane_equ.n ) ;
if ( sign >= 0.0 )
if( sign >= 0.0 )
{
/* The vector is approaching from the negative side of the patch */
/* Process subtree(-) */
if ( node->bsp_negative )
if( node->bsp_negative )
_foreach_d_s_patch( svec, node->bsp_negative, func, arg1, process_id ) ;
/* Apply function to this node */
func( node, arg1, process_id ) ;
/* Process subtree(+) */
if ( node->bsp_positive )
if( node->bsp_positive )
_foreach_d_s_patch( svec, node->bsp_positive, func, arg1, process_id ) ;
}
else
{
/* Process subtree(+) */
if ( node->bsp_positive )
if( node->bsp_positive )
_foreach_d_s_patch( svec, node->bsp_positive, func, arg1, process_id ) ;
/* Apply function to this node */
func( node, arg1, process_id ) ;
/* Process subtree(-) */
if ( node->bsp_negative )
if( node->bsp_negative )
_foreach_d_s_patch( svec, node->bsp_negative, func, arg1, process_id ) ;
}
}
@ -155,9 +155,9 @@ void define_patch(Patch *patch, Patch *root, long process_id)
LOCK(global->bsp_tree_lock);
/* If this is the first patch, link directly */
if ( parent == 0 )
if( parent == 0 )
{
if ( global->bsp_root == 0 )
if( global->bsp_root == 0 )
{
/* This is really the first patch */
global->bsp_root = patch ;
@ -176,16 +176,16 @@ void define_patch(Patch *patch, Patch *root, long process_id)
}
/* Traverse the BSP tree and get to the leaf node */
while ( 1 )
while( 1 )
{
/* Check the sign */
xing_code = patch_intersection( &parent->plane_equ, &patch->p1,
&patch->p2, &patch->p3, process_id ) ;
/* Traverse down the tree according to the sign */
if ( POSITIVE_SIDE( xing_code ) )
if( POSITIVE_SIDE( xing_code ) )
{
if ( parent->bsp_positive == 0 )
if( parent->bsp_positive == 0 )
{
/* Insert the patch */
parent->bsp_positive = patch ;
@ -200,9 +200,9 @@ void define_patch(Patch *patch, Patch *root, long process_id)
/* Traverse down to the subtree(+) */
parent = parent->bsp_positive ;
}
else if ( NEGATIVE_SIDE( xing_code ) )
else if( NEGATIVE_SIDE( xing_code ) )
{
if ( parent->bsp_negative == 0 )
if( parent->bsp_negative == 0 )
{
/* Insert the patch */
parent->bsp_negative = patch ;
@ -255,23 +255,23 @@ void split_patch(Patch *patch, Patch *node, long xing_code, long process_id)
c3 = P3_CODE( xing_code ) ;
/* Classify intersection type */
if ( c1 == c2 )
if( c1 == c2 )
/* P3 is on the oposite side */
split_into_3( patch, patch->ev3, patch->ev1, patch->ev2,
patch->e31, patch->e12, patch->e23, node, process_id) ;
else if ( c1 == c3 )
else if( c1 == c3 )
/* P2 is on the oposite side */
split_into_3( patch, patch->ev2, patch->ev3, patch->ev1,
patch->e23, patch->e31, patch->e12, node, process_id ) ;
else if ( c2 == c3 )
else if( c2 == c3 )
/* P1 is on the oposite side */
split_into_3( patch, patch->ev1, patch->ev2, patch->ev3,
patch->e12, patch->e23, patch->e31, node, process_id ) ;
else if ( c1 == POINT_ON_PLANE )
else if( c1 == POINT_ON_PLANE )
/* P1 is on the plane. P2 and P3 are on the oposite side */
split_into_2( patch, patch->ev1, patch->ev2, patch->ev3,
patch->e12, patch->e23, patch->e31, node, process_id ) ;
else if ( c2 == POINT_ON_PLANE )
else if( c2 == POINT_ON_PLANE )
/* P2 is on the plane. P3 and P1 are on the oposite side */
split_into_2( patch, patch->ev2, patch->ev3, patch->ev1,
patch->e23, patch->e31, patch->e12, node, process_id ) ;
@ -302,14 +302,14 @@ static void split_into_3(Patch *patch, ElemVertex *ev1, ElemVertex *ev2, ElemVer
/* NOTE: Length of P1-P2 and P1-P3 are at least 2*F_COPLANAR.
So, no check is necessary before division */
u2 = h1 / (h1 - h2) ;
if ( (rev_e12 = EDGE_REVERSE( e12, ev1, ev2 )) )
if( (rev_e12 = EDGE_REVERSE( e12, ev1, ev2 )) )
subdivide_edge( e12, u2, process_id ) ;
else
subdivide_edge( e12, (float)1.0 - u2, process_id ) ;
ev_a = e12->ea->pb ;
u3 = h1 / (h1 - h3) ;
if ( (rev_e31 = EDGE_REVERSE( e31, ev3, ev1 )) )
if( (rev_e31 = EDGE_REVERSE( e31, ev3, ev1 )) )
subdivide_edge( e31, (float)1.0 - u3, process_id ) ;
else
subdivide_edge( e31, u3, process_id ) ;
@ -391,7 +391,7 @@ static void split_into_2(Patch *patch, ElemVertex *ev1, ElemVertex *ev2, ElemVer
/* NOTE: Length of P2-P3 is at least 2*F_COPLANAR.
So, no check is necessary before division */
u2 = h2 / (h2 - h3) ;
if ( (rev_e23 = EDGE_REVERSE( e23, ev2, ev3 )) )
if( (rev_e23 = EDGE_REVERSE( e23, ev2, ev3 )) )
subdivide_edge( e23, u2, process_id ) ;
else
subdivide_edge( e23, (float)1.0 - u2, process_id ) ;
@ -488,20 +488,20 @@ void refine_newpatch(Patch *patch, long newpatch, long process_id)
Patch *new_patch = (Patch *)newpatch ;
/* Check sequence number */
if ( patch->seq_no >= new_patch->seq_no )
if( patch->seq_no >= new_patch->seq_no )
/* Racing condition due to multiprocessing */
return ;
/* Check visibility */
cc = patch_intersection( &patch->plane_equ,
&new_patch->p1, &new_patch->p2, &new_patch->p3, process_id ) ;
if ( NEGATIVE_SIDE(cc) )
if( NEGATIVE_SIDE(cc) )
/* If negative or on the plane, then do nothing */
return ;
cc = patch_intersection( &new_patch->plane_equ,
&patch->p1, &patch->p2, &patch->p3, process_id ) ;
if ( NEGATIVE_SIDE(cc) )
if( NEGATIVE_SIDE(cc) )
/* If negative or on the plane, then do nothing */
return ;
@ -526,7 +526,7 @@ Patch *get_patch(long process_id)
LOCK(global->free_patch_lock);
/* Test pointer */
if ( global->free_patch == 0 )
if( global->free_patch == 0 )
{
printf( "Fatal: Ran out of patch buffer\n" ) ;
UNLOCK(global->free_patch_lock);
@ -566,7 +566,7 @@ void init_patchlist(long process_id)
long i ;
/* Initialize Patch free list */
for ( i = 0 ; i < MAX_PATCHES-1 ; i++ )
for( i = 0 ; i < MAX_PATCHES-1 ; i++ )
{
global->patch_buf[i].bsp_positive = &global->patch_buf[i+1] ;
global->patch_buf[i].seq_no = i ;
@ -581,7 +581,7 @@ void init_patchlist(long process_id)
#if PATCH_ASSIGNMENT == PATCH_ASSIGNMENT_COSTBASED
/* Initialize Patch_Cost structure */
for ( i = 0 ; i < MAX_PATCHES ; i++ )
for( i = 0 ; i < MAX_PATCHES ; i++ )
{
global->patch_cost[i].patch = &global->patch_buf[i] ;
global->patch_cost[i].cost_lock
@ -710,9 +710,9 @@ long point_intersection(PlaneEqu *plane, Vertex *point, long process_id)
long result_code = 0 ;
/* Compare H(x,y,z) against allowance */
if ( (h = plane_equ( plane, point, process_id )) < -F_COPLANAR )
if( (h = plane_equ( plane, point, process_id )) < -F_COPLANAR )
result_code |= POINT_NEGATIVE_SIDE ;
if ( h > F_COPLANAR )
if( h > F_COPLANAR )
result_code |= POINT_POSITIVE_SIDE ;
return( result_code ) ;

View File

@ -22,15 +22,12 @@
*
***************************************************************/
#include <cstdio>
#include <cstring>
#include <stdio.h>
#include <string.h>
#if defined(SGI_GL)
#include <gl.h>
#if defined(GL_NASA)
#include <panel.h>
#endif
#endif
@ -160,7 +157,7 @@ int main(int argc, char *argv[])
choices[2].init_value = model_selector ;
/* Initialize graphic device */
if ( batch_mode == 0 )
if( batch_mode == 0 )
{
g_init(argc, argv) ;
setup_view( DFLT_VIEW_ROT_X, DFLT_VIEW_ROT_Y,
@ -172,7 +169,7 @@ int main(int argc, char *argv[])
/* Allocate global shared memory and initialize */
global = (Global *) G_MALLOC(sizeof(Global)) ;
if ( global == 0 )
if( global == 0 )
{
printf( "Can't allocate memory\n" ) ;
exit(1) ;
@ -208,7 +205,7 @@ int main(int argc, char *argv[])
*/
if ( batch_mode )
if( batch_mode )
{
/* In batch mode, create child processes and start immediately */
@ -216,7 +213,7 @@ int main(int argc, char *argv[])
CLOCK( time_rad_start );
global->index = 0;
for ( i = 0 ; i < n_processors ; i++ )
for( i = 0 ; i < n_processors ; i++ )
{
taskqueue_id[i] = assign_taskq(0) ;
}
@ -283,16 +280,9 @@ int main(int argc, char *argv[])
min_vertex_time = timing[i]->vertex_time;
}
printf("\n\n%8s%20lu%20lu%12lu%12lu\n","Max", max_rad_time, max_refine_time,
max_wait_time, max_vertex_time);
printf("\n%8s%20lu%20lu%12lu%12lu\n","Min", min_rad_time, min_refine_time,
min_wait_time, min_vertex_time);
printf("\n%8s%20lu%20lu%12lu%12lu\n","Avg",
(long) (((double) total_rad_time) /
((double) (1.0 * n_processors))),
(long) (((double) total_refine_time) / ((double) (1.0 * n_processors))),
(long) (((double) total_wait_time) / ((double) (1.0 * n_processors))),
(long) (((double) total_vertex_time) / ((double) (1.0 * n_processors))));
printf("\n\n%8s%20lu%20lu%12lu%12lu\n","Max", max_rad_time, max_refine_time, max_wait_time, max_vertex_time);
printf("\n%8s%20lu%20lu%12lu%12lu\n","Min", min_rad_time, min_refine_time, min_wait_time, min_vertex_time);
printf("\n%8s%20lu%20lu%12lu%12lu\n","Avg", (long) (((double) total_rad_time) / ((double) (1.0 * n_processors))), (long) (((double) total_refine_time) / ((double) (1.0 * n_processors))), (long) (((double) total_wait_time) / ((double) (1.0 * n_processors))), (long) (((double) total_vertex_time) / ((double) (1.0 * n_processors))));
printf("\n\n");
}
@ -354,9 +344,9 @@ void start_radiosity(long val)
val = g_get_choice_val( ap, &choices[0] ) ;
#endif
if ( val == CHOICE_RAD_RUN )
if( val == CHOICE_RAD_RUN )
{
if ( state == -1 )
if( state == -1 )
{
printf( "Please reset first\007\n" ) ;
return ;
@ -456,9 +446,9 @@ void start_radiosity(long val)
state = -1 ;
}
else if ( val == CHOICE_RAD_STEP )
else if( val == CHOICE_RAD_STEP )
{
if ( state == -1 )
if( state == -1 )
{
printf( "Please reset first\007\n" ) ;
return ;
@ -488,7 +478,7 @@ void start_radiosity(long val)
break ;
case 1:
if ( init_ray_tasks(0) )
if( init_ray_tasks(0) )
{
BARRIER(global->barrier, n_processors);
process_tasks(0) ;
@ -512,7 +502,7 @@ void start_radiosity(long val)
disp_mesh_switch, disp_interaction_switch, 0) ;
}
else if ( val == CHOICE_RAD_RESET )
else if( val == CHOICE_RAD_RESET )
{
/* Initialize global variables again */
init_global(0) ;
@ -566,11 +556,11 @@ void change_display(long val)
return ;
}
if ( disp_fill_switch == 0 )
if( disp_fill_switch == 0 )
disp_fill_mode = 0 ;
else
{
if ( disp_shade_switch == 0 )
if( disp_shade_switch == 0 )
disp_fill_mode = 1 ;
else
disp_fill_mode = 2 ;
@ -753,7 +743,7 @@ void utility_tools(long val)
print_statistics( stdout, 0 ) ;
break ;
case CHOICE_UTIL_STAT_FILE:
if ( (fd = fopen( "radiosity_stat", "w" )) == 0 )
if( (fd = fopen( "radiosity_stat", "w" )) == 0 )
{
perror( "radiosity_stat" ) ;
break ;
@ -814,7 +804,7 @@ void radiosity()
process_tasks(process_id) ;
/* Gather rays & do BF refinement */
while ( init_ray_tasks(process_id) )
while( init_ray_tasks(process_id) )
{
/* Wait till tasks are put in the queue */
BARRIER(global->barrier, n_processors);
@ -886,7 +876,7 @@ long init_ray_tasks(long process_id)
/* If this is not the first process to initialize, then return */
LOCK(global->avg_radiosity_lock);
if ( ! check_task_counter() )
if( ! check_task_counter() )
{
conv = global->converged ;
UNLOCK(global->avg_radiosity_lock);
@ -909,7 +899,7 @@ long init_ray_tasks(long process_id)
UNLOCK(global->avg_radiosity_lock);
/* If radiosity converged, then return 0 */
if ( conv )
if( conv )
return( 0 ) ;
@ -918,7 +908,7 @@ long init_ray_tasks(long process_id)
The 'cost_sum' is not locked since no one is processing rays
at this moment */
for ( crnt_qid = 0 ; crnt_qid < n_taskqueues ; crnt_qid++ )
for( crnt_qid = 0 ; crnt_qid < n_taskqueues ; crnt_qid++ )
queue_cost[ crnt_qid ] = 0 ;
avg_cost_of_q = global->cost_estimate_sum / n_taskqueues ;
@ -964,29 +954,29 @@ static void _init_ray_tasks_cost2(Patch *p, long layer, long process_id)
pc = &global->patch_cost[ p->seq_no ] ;
c_est = pc->cost_estimate ;
if ( c_est < 0 )
if( c_est < 0 )
/* Already processed */
return ;
if ( c_est < avg_cost_of_patch * layer )
if( c_est < avg_cost_of_patch * layer )
return ;
/* Find the first available queue */
min_cost_q = 0 ;
min_cost = queue_cost[ 0 ] ;
for ( qid = 0 ; qid < n_taskqueues ; qid++ )
for( qid = 0 ; qid < n_taskqueues ; qid++ )
{
if ( (c_est + queue_cost[ qid ]) <= avg_cost_of_q )
if( (c_est + queue_cost[ qid ]) <= avg_cost_of_q )
break ;
if ( min_cost > queue_cost[ qid ] )
if( min_cost > queue_cost[ qid ] )
{
min_cost_q = qid ;
min_cost = queue_cost[ qid ] ;
}
}
if ( qid >= n_taskqueues )
if( qid >= n_taskqueues )
{
/* All queues are nearly full. Put to min-cost queue */
qid = min_cost_q ;
@ -1025,7 +1015,7 @@ void init_radavg_tasks(long mode, long process_id)
{
/* If this is not the first process to initialize, then return */
if ( ! check_task_counter() )
if( ! check_task_counter() )
return ;
/* Create RadAvg tasks */
@ -1108,36 +1098,36 @@ static void parse_args(int argc, char *argv[])
long cnt ;
/* Parse arguments */
for ( cnt = 1 ; cnt < argc ; cnt++ )
for( cnt = 1 ; cnt < argc ; cnt++ )
{
if ( strcmp( argv[cnt], "-p" ) == 0 ) {
if( strcmp( argv[cnt], "-p" ) == 0 ) {
sscanf( argv[++cnt], "%ld", &n_processors ) ;
n_taskqueues = n_processors;
}
else if ( strcmp( argv[cnt], "-tq" ) == 0 )
else if( strcmp( argv[cnt], "-tq" ) == 0 )
sscanf( argv[++cnt], "%ld", &n_tasks_per_queue ) ;
else if ( strcmp( argv[cnt], "-ae" ) == 0 )
else if( strcmp( argv[cnt], "-ae" ) == 0 )
sscanf( argv[++cnt], "%f", &Area_epsilon ) ;
else if ( strcmp( argv[cnt], "-pr" ) == 0 )
else if( strcmp( argv[cnt], "-pr" ) == 0 )
sscanf( argv[++cnt], "%ld", &N_inter_parallel_bf_refine ) ;
else if ( strcmp( argv[cnt], "-pv" ) == 0 )
else if( strcmp( argv[cnt], "-pv" ) == 0 )
sscanf( argv[++cnt], "%ld", &N_visibility_per_task ) ;
else if ( strcmp( argv[cnt], "-bf" ) == 0 )
else if( strcmp( argv[cnt], "-bf" ) == 0 )
sscanf( argv[++cnt], "%f", &BFepsilon ) ;
else if ( strcmp( argv[cnt], "-en" ) == 0 )
else if( strcmp( argv[cnt], "-en" ) == 0 )
sscanf( argv[++cnt], "%f", &Energy_epsilon ) ;
else if ( strcmp( argv[cnt], "-batch" ) == 0 )
else if( strcmp( argv[cnt], "-batch" ) == 0 )
batch_mode = 1 ;
else if ( strcmp( argv[cnt], "-verbose" ) == 0 )
else if( strcmp( argv[cnt], "-verbose" ) == 0 )
verbose_mode = 1 ;
else if ( strcmp( argv[cnt], "-s" ) == 0 )
else if( strcmp( argv[cnt], "-s" ) == 0 )
dostats = 1 ;
else if ( strcmp( argv[cnt], "-room" ) == 0 )
else if( strcmp( argv[cnt], "-room" ) == 0 )
model_selector = MODEL_ROOM_DATA ;
else if ( strcmp( argv[cnt], "-largeroom" ) == 0 )
else if( strcmp( argv[cnt], "-largeroom" ) == 0 )
model_selector = MODEL_LARGEROOM_DATA ;
else if (( strcmp( argv[cnt], "-help" ) == 0 ) || ( strcmp( argv[cnt], "-h" ) == 0 ) || ( strcmp( argv[cnt], "-H" ) == 0 )) {
else if(( strcmp( argv[cnt], "-help" ) == 0 ) || ( strcmp( argv[cnt], "-h" ) == 0 ) || ( strcmp( argv[cnt], "-H" ) == 0 )) {
print_usage() ;
exit(0) ;
}
@ -1145,25 +1135,25 @@ static void parse_args(int argc, char *argv[])
/* Then check the arguments */
if ( (n_processors < 1) || (MAX_PROCESSORS < n_processors) )
if( (n_processors < 1) || (MAX_PROCESSORS < n_processors) )
{
fprintf( stderr, "Bad number of processors: %ld\n",
n_processors ) ;
exit(1) ;
}
if ( (n_taskqueues < 1) || (MAX_TASKQUEUES < n_taskqueues) )
if( (n_taskqueues < 1) || (MAX_TASKQUEUES < n_taskqueues) )
{
fprintf( stderr, "Bad number of task queues: %ld\n",
n_taskqueues ) ;
exit(1) ;
}
/* Check epsilon values */
if ( Area_epsilon < 0.0 )
if( Area_epsilon < 0.0 )
{
fprintf( stderr, "Area epsilon must be positive\n" ) ;
exit(1) ;
}
if ( BFepsilon < 0.0 )
if( BFepsilon < 0.0 )
{
fprintf( stderr, "BFepsilon must be within [0,1]\n" ) ;
exit(1) ;

View File

@ -20,7 +20,7 @@
*
***************************************************************/
#include <cstdio>
#include <stdio.h>
EXTERN_ENV;
@ -77,7 +77,7 @@ void print_statistics(FILE *fd, long process_id)
total_match1 = 0 ;
total_match0 = 0 ;
for ( i = 0 ; i < MAX_INTERACTION_PER_ELEMENT ; i++ )
for( i = 0 ; i < MAX_INTERACTION_PER_ELEMENT ; i++ )
{
elem_interaction[i].count = 0 ;
elem_interaction[i].area = 0 ;
@ -92,21 +92,21 @@ void print_statistics(FILE *fd, long process_id)
fprintf( fd, " Histogram of interactions/elem\n" ) ;
fprintf( fd, "\t Interactions Occurrence\n" ) ;
fprintf( fd, "\t -------------------------------\n" ) ;
if ( many_interaction.count > 0 )
if( many_interaction.count > 0 )
{
fprintf( fd, "\t (Over %d) %ld (%f)\n",
MAX_INTERACTION_PER_ELEMENT,
many_interaction.count,
many_interaction.area / many_interaction.count ) ;
}
for ( i = MAX_INTERACTION_PER_ELEMENT ;
for( i = MAX_INTERACTION_PER_ELEMENT ;
elem_interaction[i].count == 0 ; i-- ) ;
for ( ; i >= 0 ; i-- )
for( ; i >= 0 ; i-- )
{
if ( elem_interaction[i].count == 0 )
if( elem_interaction[i].count == 0 )
continue ;
if ( elem_interaction[i].count == 0 )
if( elem_interaction[i].count == 0 )
fprintf( fd, "\t %ld %ld (---)\n",
i, elem_interaction[i].count ) ;
@ -213,7 +213,7 @@ void print_per_process_info(FILE *fd, long process)
fprintf( fd, "\t\tPatch cache hit ratio: %.2f%%\n",
ps->total_patch_cache_hit * 100 /
(ps->total_patch_cache_check + 0.01) ) ;
for ( cache_line = 0 ; cache_line < PATCH_CACHE_SIZE ; cache_line++ )
for( cache_line = 0 ; cache_line < PATCH_CACHE_SIZE ; cache_line++ )
fprintf( fd, "\t\t (level %ld): %.2f%%\n",
cache_line,
ps->patch_cache_hit[cache_line] * 100 /
@ -221,7 +221,7 @@ void print_per_process_info(FILE *fd, long process)
/* Per iteration info */
fprintf( fd, "\t\tPer iteration info.\n" ) ;
for ( iteration = 0 ; iteration < global->iteration_count ; iteration++ )
for( iteration = 0 ; iteration < global->iteration_count ; iteration++ )
{
fprintf( fd, "\t\t [%ld] Interaction comp: %ld\n",
iteration, ps->per_iteration[iteration].visibility_comp ) ;
@ -234,9 +234,9 @@ void print_per_process_info(FILE *fd, long process)
fprintf( fd, "\t\t Process_task wait count: %ld\n",
ps->per_iteration[iteration].process_tasks_wait ) ;
e = ps->per_iteration[iteration].last_pr_task ;
if ( e == 0 )
if( e == 0 )
continue ;
if ( e->parent == 0 )
if( e->parent == 0 )
{
fprintf( fd, "\t\t Last task: Patch level\n" ) ;
fprintf( fd, "\t\t (%ld root inter)\n",
@ -289,7 +289,7 @@ void get_patch_stat(Patch *patch, long dummy, long process_id)
total_invisible_interactions += n_invisible_interactions ;
#if PATCH_ASSIGNMENT == PATCH_ASSIGNMENT_COSTBASED
if ( n_interactions_in_patch
if( n_interactions_in_patch
!= global->patch_cost[patch->seq_no].n_total_inter )
{
printf( "Error: patch(%d) Inter counted: %d (n_total_inter %d)\n",
@ -310,7 +310,7 @@ void get_elem_stat(Element *elem, long dummy, long process_id)
n_elements_in_patch++ ;
while ( elem->area < min_elem_area )
while( elem->area < min_elem_area )
{
min_elem_area *= 0.25 ;
n_equiv_elem_in_patch *= 4 ;
@ -318,21 +318,21 @@ void get_elem_stat(Element *elem, long dummy, long process_id)
/* Classify visibility */
n_interactions_in_patch += elem->n_interactions ;
for ( pi = elem->interactions ; pi ; pi = pi->next )
for( pi = elem->interactions ; pi ; pi = pi->next )
{
if ( pi->visibility == 0.0 )
if( pi->visibility == 0.0 )
i_visible++ ;
else if ( pi->visibility == 1.0 )
else if( pi->visibility == 1.0 )
c_visible++ ;
else
p_visible++ ;
}
if ( i_visible + c_visible + p_visible != elem->n_interactions )
if( i_visible + c_visible + p_visible != elem->n_interactions )
printf( "Fatal: Interactions count miss match\n" ) ;
if ( elem->n_vis_undef_inter != 0 )
if( elem->n_vis_undef_inter != 0 )
printf( "Fatal: Visibility undef list count non zero(%ld)\n",
elem->n_vis_undef_inter ) ;
if ( elem->vis_undef_inter != 0 )
if( elem->vis_undef_inter != 0 )
printf( "Fatal: Visibility undef list not empty\n" ) ;
n_comp_visible_interactions += c_visible ;
@ -340,7 +340,7 @@ void get_elem_stat(Element *elem, long dummy, long process_id)
/* Count interactions / element */
if ( elem->n_interactions > MAX_INTERACTION_PER_ELEMENT )
if( elem->n_interactions > MAX_INTERACTION_PER_ELEMENT )
{
many_interaction.count++ ;
many_interaction.area += elem->area ;
@ -352,7 +352,7 @@ void get_elem_stat(Element *elem, long dummy, long process_id)
}
/* Analyze object coherence */
if ( ! LEAF_ELEMENT( elem ) )
if( ! LEAF_ELEMENT( elem ) )
{
match0 = match1 = match2 = match3 = 0 ;
@ -379,7 +379,7 @@ void count_interaction(Element *es, Element *e1, Element *e2, Element *e3, long
Interaction *pi ;
long occurrence ;
for ( pi = es->interactions ; pi ; pi = pi->next )
for( pi = es->interactions ; pi ; pi = pi->next )
{
occurrence = search_intearction( e1->interactions, pi, process_id ) ;
occurrence += search_intearction( e2->interactions, pi, process_id ) ;
@ -396,9 +396,9 @@ void count_interaction(Element *es, Element *e1, Element *e2, Element *e3, long
long search_intearction(Interaction *int_list, Interaction *inter, long process_id)
{
while ( int_list )
while( int_list )
{
if ( int_list->destination == inter->destination )
if( int_list->destination == inter->destination )
return( 1 ) ;
int_list = int_list->next ;
@ -419,9 +419,9 @@ void print_running_time(long process_id)
time_diff = time_rad_end - time_rad_start ;
time_diff1 = time_rad_end - timing[0]->rad_start;
if ( time_diff < 0 )
if( time_diff < 0 )
time_diff += CLOCK_MAX_VAL ;
if ( time_diff1 < 0 )
if( time_diff1 < 0 )
time_diff1 += CLOCK_MAX_VAL ;
printf( "\tOverall start time\t%20lu\n", time_rad_start);
@ -441,11 +441,11 @@ void print_fork_time(long process_id)
{
long pid ;
if ( n_processors <= 1 )
if( n_processors <= 1 )
return ;
printf( "\tProcess fork overhead\n" ) ;
for ( pid = 0 ; pid < n_processors-1 ; pid++ )
for( pid = 0 ; pid < n_processors-1 ; pid++ )
{
printf( "\t Process %ld %.2f mS\n",
pid,
@ -469,7 +469,7 @@ void init_stat_info(long process_id)
long i ;
StatisticalInfo *ps ;
for ( pid = 0 ; pid < MAX_PROCESSORS ; pid++ )
for( pid = 0 ; pid < MAX_PROCESSORS ; pid++ )
{
ps = &global->stat_info[ pid ] ;
ps->total_modeling_tasks = 0 ;
@ -484,10 +484,10 @@ void init_stat_info(long process_id)
ps->total_patch_cache_check = 0 ;
ps->total_patch_cache_hit = 0 ;
for ( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
for( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
ps->patch_cache_hit[i] = 0 ;
for ( i = 0 ; i < MAX_ITERATION_INFO ; i++ )
for( i = 0 ; i < MAX_ITERATION_INFO ; i++ )
{
ps->per_iteration[ i ].visibility_comp = 0 ;
ps->per_iteration[ i ].ray_intersect_test = 0 ;

View File

@ -21,8 +21,7 @@ of the program, as well as lobal data structure declarations */
#ifndef _RADIOSITY_H
#define _RADIOSITY_H
#include <cmath>
#include <math.h>
include(parallel.h)
include(patch.h)
include(model.h)
@ -30,6 +29,7 @@ include(task.h)
#include "glib.h"
#include "pslib.h"
/****************************************
*
* Configuration Parameters

View File

@ -28,7 +28,7 @@
EXTERN_ENV;
#include <cstdio>
#include <stdio.h>
include(radiosity.h)

View File

@ -21,7 +21,7 @@
*
*************************************************************************/
#include <cstdio>
#include <stdio.h>
EXTERN_ENV;
@ -305,7 +305,7 @@ ElemVertex *get_elemvertex(long process_id)
{
ElemVertex *ev ;
if ( sobj_struct[process_id].n_local_free_elemvertex == 0 )
if( sobj_struct[process_id].n_local_free_elemvertex == 0 )
{
LOCK(global->free_elemvertex_lock);
if ( MAX_ELEMVERTICES - global->free_elemvertex
@ -355,7 +355,7 @@ void init_elemvertex(long process_id)
global->free_elemvertex = 0 ;
/* Allocate locks */
for ( ev_cnt = 0 ; ev_cnt < MAX_ELEMVERTICES ; ev_cnt++ )
for( ev_cnt = 0 ; ev_cnt < MAX_ELEMVERTICES ; ev_cnt++ )
global->elemvertex_buf[ ev_cnt ].ev_lock
= get_sharedlock( SHARED_LOCK_SEGANY, process_id ) ;
@ -390,14 +390,14 @@ void foreach_leaf_edge(Edge *edge, long reverse, void (*func)(), long arg1, long
{
Edge *first, *second ;
if ( edge == 0 )
if( edge == 0 )
return ;
if ( (edge->ea == 0) && (edge->eb == 0) )
if( (edge->ea == 0) && (edge->eb == 0) )
func( edge, reverse, arg1, arg2, process_id ) ;
else
{
if ( reverse )
if( reverse )
{
first = edge->eb ;
second = edge->ea ;
@ -407,9 +407,9 @@ void foreach_leaf_edge(Edge *edge, long reverse, void (*func)(), long arg1, long
first = edge->ea ;
second = edge->eb ;
}
if ( first )
if( first )
foreach_leaf_edge( first, reverse, func, arg1, arg2, process_id ) ;
if ( second )
if( second )
foreach_leaf_edge( second, reverse, func, arg1, arg2, process_id ) ;
}
}
@ -452,7 +452,7 @@ void subdivide_edge(Edge *e, float a_ratio, long process_id)
LOCK(e->edge_lock->lock);
/* Check if the element already has children */
if ( ! _LEAF_EDGE(e) )
if( ! _LEAF_EDGE(e) )
{
UNLOCK(e->edge_lock->lock);
return ;
@ -499,7 +499,7 @@ Edge *get_edge(long process_id)
{
Edge *edge ;
if ( sobj_struct[process_id].n_local_free_edge == 0 )
if( sobj_struct[process_id].n_local_free_edge == 0 )
{
LOCK(global->free_edge_lock);
if ( MAX_EDGES - global->free_edge < N_EDGE_ALLOCATE )
@ -548,7 +548,7 @@ void init_edge(long process_id)
global->free_edge = 0 ;
/* Allocate locks */
for ( edge_cnt = 0 ; edge_cnt < MAX_EDGES ; edge_cnt++ )
for( edge_cnt = 0 ; edge_cnt < MAX_EDGES ; edge_cnt++ )
global->edge_buf[ edge_cnt ].edge_lock
= get_sharedlock( SHARED_LOCK_SEG0, process_id ) ;
@ -583,7 +583,7 @@ void init_sharedlock(long process_id)
{
long i ;
for ( i = 0 ; i < MAX_SHARED_LOCK ; i++ )
for( i = 0 ; i < MAX_SHARED_LOCK ; i++ )
{
LOCKINIT(global->sh_lock[i].lock);
}
@ -627,7 +627,7 @@ Shared_Lock *get_sharedlock(long segment, long process_id)
/* Update the lock counter */
sobj_struct[process_id].lock_alloc_counter++ ;
if ( sobj_struct[process_id].lock_alloc_counter >= MAX_SHARED_LOCK )
if( sobj_struct[process_id].lock_alloc_counter >= MAX_SHARED_LOCK )
sobj_struct[process_id].lock_alloc_counter = 0 ;
return( pshl ) ;

View File

@ -24,7 +24,7 @@
*
*************************************************************************/
#include <cstdio>
#include <stdio.h>
EXTERN_ENV;
@ -67,7 +67,7 @@ void process_tasks(long process_id)
t = DEQUEUE_TASK( taskqueue_id[process_id], QUEUES_VISITED, process_id ) ;
retry_entry:
while ( t )
while( t )
{
switch( t->task_type )
{
@ -107,7 +107,7 @@ void process_tasks(long process_id)
LOCK(global->pbar_lock);
/* Reset the barrier counter if not initialized */
if ( global->pbar_count >= n_processors )
if( global->pbar_count >= n_processors )
global->pbar_count = 0 ;
/* Increment the counter */
@ -115,16 +115,16 @@ void process_tasks(long process_id)
UNLOCK(global->pbar_lock);
/* barrier spin-wait loop */
while ( global->pbar_count < n_processors )
while( global->pbar_count < n_processors )
{
/* Wait for a while and then retry dequeue */
if ( _process_task_wait_loop() )
if( _process_task_wait_loop() )
break ;
/* Waited for a while but other processors are still running.
Poll the task queue again */
t = DEQUEUE_TASK( taskqueue_id[process_id], QUEUES_VISITED, process_id ) ;
if ( t )
if( t )
{
/* Task found. Exit the barrier and work on it */
LOCK(global->pbar_lock);
@ -145,9 +145,9 @@ long _process_task_wait_loop()
long finished = 0 ;
/* Wait for a while and then retry */
for ( i = 0 ; i < 1000 && ! finished ; i++ )
for( i = 0 ; i < 1000 && ! finished ; i++ )
{
if ( ((i & 0xff) == 0) && ((volatile long)global->pbar_count >= n_processors) )
if( ((i & 0xff) == 0) && ((volatile long)global->pbar_count >= n_processors) )
finished = 1 ;
}
@ -193,7 +193,7 @@ void create_ff_refine_task(Element *e1, Element *e2, long level, long process_id
Task *t ;
/* Check existing parallelism */
if ( taskq_too_long(&global->task_queue[ taskqueue_id[process_id] ]) )
if( taskq_too_long(&global->task_queue[ taskqueue_id[process_id] ]) )
{
/* Task queue is too long. Solve it immediately */
ff_refine_elements( e1, e2, level, process_id ) ;
@ -217,7 +217,7 @@ void create_ff_refine_task(Element *e1, Element *e2, long level, long process_id
void create_ray_task(Element *e, long process_id)
{
/* Check existing parallelism */
if ( ((e->n_interactions + e->n_vis_undef_inter)
if( ((e->n_interactions + e->n_vis_undef_inter)
< N_inter_parallel_bf_refine)
|| taskq_too_long(&global->task_queue[ taskqueue_id[process_id] ]) )
{
@ -257,11 +257,11 @@ void create_visibility_tasks(Element *e, void (*k)(), long process_id)
long tasks_created = 0 ;
/* Check number of hard problems */
for ( top = e->vis_undef_inter ; top ; top = top->next )
if ( top->visibility == VISIBILITY_UNDEF )
for( top = e->vis_undef_inter ; top ; top = top->next )
if( top->visibility == VISIBILITY_UNDEF )
total_undefs++ ;
if ( total_undefs == 0 )
if( total_undefs == 0 )
{
/* No process needs to be created. Call the continuation
immediately */
@ -270,7 +270,7 @@ void create_visibility_tasks(Element *e, void (*k)(), long process_id)
}
/* Check existing parallelism */
if ( (total_undefs < N_visibility_per_task)
if( (total_undefs < N_visibility_per_task)
|| taskq_too_long(&global->task_queue[ taskqueue_id[process_id] ]) )
{
/* Task size is small, or the queue is too long.
@ -293,24 +293,24 @@ void create_visibility_tasks(Element *e, void (*k)(), long process_id)
/ N_visibility_per_task ;
remainder = 0 ;
i_cnt = 0 ;
for ( top = e->vis_undef_inter, tail = top ; tail ; tail = tail->next )
for( top = e->vis_undef_inter, tail = top ; tail ; tail = tail->next )
{
i_cnt++ ;
if ( tail->visibility != VISIBILITY_UNDEF )
if( tail->visibility != VISIBILITY_UNDEF )
continue ;
remainder += n_tasks ;
if ( remainder >= total_undefs )
if( remainder >= total_undefs )
{
/* Create a task */
/* For the last task, append following (easy) interactions
if there is any */
tasks_created++ ;
if ( tasks_created >= n_tasks )
for ( ; tail->next ; tail = tail->next, i_cnt++ ) ;
if( tasks_created >= n_tasks )
for( ; tail->next ; tail = tail->next, i_cnt++ ) ;
/* Set task descriptor */
t = get_task(process_id) ;
@ -337,7 +337,7 @@ void create_visibility_tasks(Element *e, void (*k)(), long process_id)
void create_radavg_task(Element *e, long mode, long process_id)
{
/* Check existing parallelism */
if ( (e->n_interactions < N_inter_parallel_bf_refine)
if( (e->n_interactions < N_inter_parallel_bf_refine)
|| taskq_too_long(&global->task_queue[ taskqueue_id[process_id] ]) )
{
/* Task size is too small or queue is too long.
@ -384,7 +384,7 @@ void enqueue_task(long qid, Task *task, long mode)
/* Lock the task queue */
LOCK(tq->q_lock);
if ( tq->tail == 0 )
if( tq->tail == 0 )
{
/* The first task in the queue */
tq->tail = task ;
@ -394,7 +394,7 @@ void enqueue_task(long qid, Task *task, long mode)
else
{
/* Usual case */
if ( mode == TASK_APPEND )
if( mode == TASK_APPEND )
{
tq->tail->next = task ;
tq->tail = task ;
@ -433,37 +433,37 @@ Task *dequeue_task(long qid, long max_visit, long process_id)
long offset ;
/* Check number of queues to be visited */
if ( max_visit > n_taskqueues )
if( max_visit > n_taskqueues )
max_visit = n_taskqueues ;
/* Get next task */
while ( visit_count < max_visit )
while( visit_count < max_visit )
{
/* Select a task queue */
tq = &global->task_queue[ qid ] ;
/* Check the length (test-test&set) */
if ( tq->n_tasks > 0 )
if( tq->n_tasks > 0 )
{
/* Lock the task queue */
LOCK(tq->q_lock);
if ( tq->top )
if( tq->top )
{
if ( qid == taskqueue_id[process_id] )
if( qid == taskqueue_id[process_id] )
{
t = tq->top ;
tq->top = t->next ;
if ( tq->top == 0 )
if( tq->top == 0 )
tq->tail = 0 ;
tq->n_tasks-- ;
}
else
{
/* Get tail */
for ( prev = 0, t = tq->top ; t->next ;
for( prev = 0, t = tq->top ; t->next ;
prev = t, t = t->next ) ;
if ( prev == 0 )
if( prev == 0 )
tq->top = 0 ;
else
prev->next = 0 ;
@ -484,9 +484,9 @@ Task *dequeue_task(long qid, long max_visit, long process_id)
sign = -sign ;
qid += offset ;
if ( qid < 0 )
if( qid < 0 )
qid += n_taskqueues ;
else if ( qid >= n_taskqueues )
else if( qid >= n_taskqueues )
qid -= n_taskqueues ;
}
@ -511,22 +511,22 @@ Task *get_task(long process_id)
long retry_count = 0 ;
/* First, check local task queue */
if ( task_struct[process_id].local_free_task == 0 )
if( task_struct[process_id].local_free_task == 0 )
{
/* If empty, allocate task objects from the shared list */
q_id = taskqueue_id[process_id] ;
while ( task_struct[process_id].local_free_task == 0 )
while( task_struct[process_id].local_free_task == 0 )
{
tq = &global->task_queue[ q_id ] ;
if ( tq->n_free > 0 )
if( tq->n_free > 0 )
{
LOCK(tq->f_lock);
if ( tq->free )
if( tq->free )
{
/* Scan the free list */
for ( i = 1, p = tq->free ;
for( i = 1, p = tq->free ;
(i < N_ALLOCATE_LOCAL_TASK) && p->next ;
i++, p = p->next ) ;
@ -542,11 +542,11 @@ Task *get_task(long process_id)
}
/* Try next task queue */
if ( ++q_id >= n_taskqueues )
if( ++q_id >= n_taskqueues )
q_id = 0 ;
/* Check retry count */
if ( ++retry_count > MAX_TASKGET_RETRY )
if( ++retry_count > MAX_TASKGET_RETRY )
{
fprintf( stderr, "Panic(P%ld):No free task\n",
process_id ) ;
@ -587,11 +587,11 @@ void free_task(Task *task, long process_id)
task_struct[process_id].n_local_free_task++ ;
/* If local list is too long, export some tasks */
if ( task_struct[process_id].n_local_free_task >= (N_ALLOCATE_LOCAL_TASK * 2) )
if( task_struct[process_id].n_local_free_task >= (N_ALLOCATE_LOCAL_TASK * 2) )
{
tq = &global->task_queue[ taskqueue_id[process_id] ] ;
for ( i = 1, p = task_struct[process_id].local_free_task ;
for( i = 1, p = task_struct[process_id].local_free_task ;
i < N_ALLOCATE_LOCAL_TASK ; i++, p = p->next ) ;
/* Update local list */
@ -634,7 +634,7 @@ void init_taskq(long process_id)
/* Initialize task queues */
task_per_queue = (MAX_TASKS + n_taskqueues - 1) / n_taskqueues ;
for ( qid = 0 ; qid < n_taskqueues ; qid++ )
for( qid = 0 ; qid < n_taskqueues ; qid++ )
{
/* Initialize free list */
if (task_index + task_per_queue > MAX_TASKS )
@ -642,7 +642,7 @@ void init_taskq(long process_id)
else
n_tasks = task_per_queue ;
for ( i = task_index ; i < task_index + n_tasks - 1 ; i++ )
for( i = task_index ; i < task_index + n_tasks - 1 ; i++ )
global->task_buf[i].next = &global->task_buf[i+1] ;
global->task_buf[ i ].next = 0 ;
@ -684,12 +684,12 @@ long check_task_counter()
LOCK(global->task_counter_lock);
if ( global->task_counter == 0 )
if( global->task_counter == 0 )
/* First processor */
flag = 1 ;
global->task_counter++ ;
if ( global->task_counter >= n_processors )
if( global->task_counter >= n_processors )
global->task_counter = 0 ;
UNLOCK(global->task_counter_lock);
@ -713,7 +713,7 @@ long assign_taskq(long process_id)
qid = task_struct[process_id].crnt_taskq_id++ ;
if ( task_struct[process_id].crnt_taskq_id >= n_taskqueues )
if( task_struct[process_id].crnt_taskq_id >= n_taskqueues )
task_struct[process_id].crnt_taskq_id = 0 ;
return( qid ) ;
@ -731,7 +731,7 @@ long assign_taskq(long process_id)
void print_task(Task *task)
{
if ( task == 0 )
if( task == 0 )
{
printf( "Task (NULL)\n" ) ;
return ;
@ -770,7 +770,7 @@ void print_taskq(Task_Queue *tq)
Task *t ;
printf( "TaskQ: %ld tasks in the queue\n", taskq_length(tq) ) ;
for ( t = taskq_top(tq) ; t ; t = t->next )
for( t = taskq_top(tq) ; t ; t = t->next )
{
printf( " " ) ;
print_task( t ) ;

View File

@ -21,8 +21,8 @@
*
***************************************************************/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
EXTERN_ENV;
@ -143,7 +143,7 @@ void get_test_rays(Vertex *p_src, Ray *v, long no, long process_id)
Vertex p_dst ;
float fv1, fv2 ;
if ( no > VISI_RAYS_MAX )
if( no > VISI_RAYS_MAX )
no = VISI_RAYS_MAX ;
for (i = 0, g_index = 0 ; i < no; i++, g_index++) {
@ -330,37 +330,37 @@ long traverse_bsp(Patch *src_node, Vertex *p, Ray *ray, float r_min, float r_max
/* (1) Check patch cache */
if ( check_patch_cache( p, ray, r_min, r_max, process_id ) )
if( check_patch_cache( p, ray, r_min, r_max, process_id ) )
return( 1 ) ;
/* (2) Check S+(src_node) */
if ( traverse_subtree( src_node->bsp_positive, p, ray, r_min, r_max, process_id ) )
if( traverse_subtree( src_node->bsp_positive, p, ray, r_min, r_max, process_id ) )
return( 1 ) ;
/* (3) Continue in-order traversal till root is encountered */
for ( parent = src_node->bsp_parent, visited_child = src_node ;
for( parent = src_node->bsp_parent, visited_child = src_node ;
parent ;
visited_child = parent, parent = parent->bsp_parent )
{
/* Check intersection at this node */
advice = intersection_type( parent, p, ray, &t, r_min, r_max ) ;
if ( (advice != POSITIVE_SUBTREE_ONLY) && (advice != NEGATIVE_SUBTREE_ONLY) )
if( (advice != POSITIVE_SUBTREE_ONLY) && (advice != NEGATIVE_SUBTREE_ONLY) )
{
if ( test_intersection( parent, p, ray, t, process_id ) )
if( test_intersection( parent, p, ray, t, process_id ) )
return( 1 ) ;
r_min = t - VIS_RANGE_MARGIN ;
}
/* Traverse unvisited subtree of the node */
if ( (parent->bsp_positive == visited_child) && (advice != POSITIVE_SUBTREE_ONLY) )
if( (parent->bsp_positive == visited_child) && (advice != POSITIVE_SUBTREE_ONLY) )
{
if ( traverse_subtree( parent->bsp_negative, p, ray, r_min, r_max, process_id ) )
if( traverse_subtree( parent->bsp_negative, p, ray, r_min, r_max, process_id ) )
return( 1 ) ;
}
else if ( (parent->bsp_positive != visited_child) && (advice != NEGATIVE_SUBTREE_ONLY) )
else if( (parent->bsp_positive != visited_child) && (advice != NEGATIVE_SUBTREE_ONLY) )
{
if ( traverse_subtree( parent->bsp_positive, p, ray, r_min, r_max, process_id ) )
if( traverse_subtree( parent->bsp_positive, p, ray, r_min, r_max, process_id ) )
return( 1 ) ;
}
}
@ -389,39 +389,39 @@ long traverse_subtree(Patch *node, Vertex *p, Ray *ray, float r_min, float r_max
long advice ;
if ( node == 0 )
if( node == 0 )
return( 0 ) ;
advice = intersection_type( node, p, ray, &t, r_min, r_max ) ;
if ( advice == POSITIVE_SIDE_FIRST )
if( advice == POSITIVE_SIDE_FIRST )
{
/* The ray is approaching from the positive side of the patch */
if ( traverse_subtree( node->bsp_positive, p, ray,
if( traverse_subtree( node->bsp_positive, p, ray,
r_min, t + VIS_RANGE_MARGIN, process_id ) )
return( 1 ) ;
if ( test_intersection( node, p, ray, t, process_id ) )
if( test_intersection( node, p, ray, t, process_id ) )
return( 1 ) ;
return( traverse_subtree( node->bsp_negative, p, ray,
t - VIS_RANGE_MARGIN, r_max, process_id ) ) ;
}
else if ( advice == NEGATIVE_SIDE_FIRST )
else if( advice == NEGATIVE_SIDE_FIRST )
{
/* The ray is approaching from the negative side of the patch */
if ( traverse_subtree( node->bsp_negative, p, ray,
if( traverse_subtree( node->bsp_negative, p, ray,
r_min, t + VIS_RANGE_MARGIN, process_id ) )
return( 1 ) ;
if ( test_intersection( node, p, ray, t, process_id ) )
if( test_intersection( node, p, ray, t, process_id ) )
return( 1 ) ;
return( traverse_subtree( node->bsp_positive, p, ray,
t - VIS_RANGE_MARGIN, r_max, process_id ) ) ;
}
else if ( advice == POSITIVE_SUBTREE_ONLY )
else if( advice == POSITIVE_SUBTREE_ONLY )
return( traverse_subtree( node->bsp_positive, p, ray,
r_min, r_max, process_id ) ) ;
else if ( advice == NEGATIVE_SUBTREE_ONLY )
else if( advice == NEGATIVE_SUBTREE_ONLY )
return( traverse_subtree( node->bsp_negative, p, ray,
r_min, r_max, process_id ) ) ;
else
@ -469,11 +469,11 @@ long intersection_type(Patch *patch, Vertex *p, Ray *ray, float *tval, float ra
r_dot_n = nx * ray->x + ny * ray->y + nz * ray->z ;
dist = patch->plane_equ.c + p->x * nx + p->y * ny + p->z * nz ;
if ( (-(float)F_ZERO < r_dot_n) && (r_dot_n < (float)F_ZERO) )
if( (-(float)F_ZERO < r_dot_n) && (r_dot_n < (float)F_ZERO) )
{
if ( dist > (float)F_COPLANAR )
if( dist > (float)F_COPLANAR )
return( POSITIVE_SUBTREE_ONLY ) ;
else if ( dist < -F_COPLANAR )
else if( dist < -F_COPLANAR )
return( NEGATIVE_SUBTREE_ONLY ) ;
return( ON_THE_PLANE ) ;
@ -482,23 +482,23 @@ long intersection_type(Patch *patch, Vertex *p, Ray *ray, float *tval, float ra
t = -dist / r_dot_n ;
*tval = t ;
if ( t < range_min )
if( t < range_min )
{
if ( r_dot_n >= 0 )
if( r_dot_n >= 0 )
return( POSITIVE_SUBTREE_ONLY ) ;
else
return( NEGATIVE_SUBTREE_ONLY ) ;
}
else if ( t > range_max )
{
if ( r_dot_n >= 0 )
if( r_dot_n >= 0 )
return( NEGATIVE_SUBTREE_ONLY ) ;
else
return( POSITIVE_SUBTREE_ONLY ) ;
}
else
{
if ( r_dot_n >= 0 )
if( r_dot_n >= 0 )
return( NEGATIVE_SIDE_FIRST ) ;
else
return( POSITIVE_SIDE_FIRST ) ;
@ -517,16 +517,16 @@ long test_intersection(Patch *patch, Vertex *p, Ray *ray, float tval, long proce
/* Rays always hit the destination. Note that (R.Ndest) is already
checked by visibility() */
if ( patch == vis_struct[process_id].v_dest_patch )
if( patch == vis_struct[process_id].v_dest_patch )
{
vis_struct[process_id].pool_dst_hits++ ;
return( 1 ) ;
}
if ( patch_tested( patch, process_id ) )
if( patch_tested( patch, process_id ) )
return( 0 ) ;
if ( v_intersect( patch, p, ray, tval ) )
if( v_intersect( patch, p, ray, tval ) )
{
/* Store it in the patch-cache */
update_patch_cache( patch, process_id ) ;
@ -563,7 +563,7 @@ void update_patch_cache(Patch *patch, long process_id)
long i ;
/* Shift current contents */
for ( i = PATCH_CACHE_SIZE-1 ; i > 0 ; i-- )
for( i = PATCH_CACHE_SIZE-1 ; i > 0 ; i-- )
vis_struct[process_id].patch_cache[i] = vis_struct[process_id].patch_cache[i-1] ;
/* Store the new patch data */
@ -579,9 +579,9 @@ long check_patch_cache(Vertex *p, Ray *ray, float r_min, float r_max, long proce
Patch *temp ;
long advice ;
for ( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
for( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
{
if ( (vis_struct[process_id].patch_cache[i] == 0)
if( (vis_struct[process_id].patch_cache[i] == 0)
|| (vis_struct[process_id].patch_cache[i] == vis_struct[process_id].v_dest_patch)
|| (vis_struct[process_id].patch_cache[i] == vis_struct[process_id].v_src_patch) )
continue ;
@ -589,14 +589,14 @@ long check_patch_cache(Vertex *p, Ray *ray, float r_min, float r_max, long proce
advice = intersection_type( vis_struct[process_id].patch_cache[i], p, ray, &t, r_min, r_max ) ;
/* If no intersection, then skip */
if ( (advice == POSITIVE_SUBTREE_ONLY)
if( (advice == POSITIVE_SUBTREE_ONLY)
|| (advice == NEGATIVE_SUBTREE_ONLY) )
continue ;
if ( (advice == ON_THE_PLANE) || v_intersect( vis_struct[process_id].patch_cache[i], p, ray, t ) )
if( (advice == ON_THE_PLANE) || v_intersect( vis_struct[process_id].patch_cache[i], p, ray, t ) )
{
/* Change priority */
if ( i > 0 )
if( i > 0 )
{
temp = vis_struct[process_id].patch_cache[ i-1 ] ;
vis_struct[process_id].patch_cache[ i-1 ] = vis_struct[process_id].patch_cache[ i ] ;
@ -617,7 +617,7 @@ void init_patch_cache(long process_id)
{
long i ;
for ( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
for( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
vis_struct[process_id].patch_cache[ i ] = 0 ;
}
@ -626,9 +626,9 @@ long patch_tested(Patch *p, long process_id)
{
long i ;
for ( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
for( i = 0 ; i < PATCH_CACHE_SIZE ; i++ )
{
if ( p == vis_struct[process_id].patch_cache[i] )
if( p == vis_struct[process_id].patch_cache[i] )
return( 1 ) ;
}
@ -714,9 +714,9 @@ float visibility(Element *e1, Element *e2, long n_rays, long process_id)
void compute_visibility_values(Element *elem, Interaction *inter, long n_inter, long process_id)
{
for ( ; n_inter > 0 ; inter = inter->next, n_inter-- )
for( ; n_inter > 0 ; inter = inter->next, n_inter-- )
{
if ( inter->visibility != VISIBILITY_UNDEF )
if( inter->visibility != VISIBILITY_UNDEF )
continue ;
vis_struct[process_id].bsp_nodes_visited = 0 ;
@ -764,6 +764,6 @@ void visibility_task(Element *elem, Interaction *inter, long n_inter, void (*k)(
#endif
/* Call continuation if this is the last task finished. */
if ( new_vis_undef_count == 0 )
if( new_vis_undef_count == 0 )
k( elem, process_id ) ;
}

View File

@ -25,11 +25,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* InquireBoundBoxValues - return min and max bound values for each coordinate axis

View File

@ -26,11 +26,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
GRID *gridlist = NULL;
/*

View File

@ -25,12 +25,13 @@
* routines to manipulate lights, colors, and to print the environment.
*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "rt.h"
/*
* Define environment specification opcodes.
*/

View File

@ -31,11 +31,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
static struct /* Runlength pixel definition. */
{
U8 r, g, b; /* Color. */

View File

@ -27,14 +27,14 @@
*/
#include <stdio.h>
#include <fcntl.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <string.h>
#include "rt.h"
/*
* Allocate and initialize sphere function pointer array.
*/

View File

@ -25,9 +25,8 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
VOID prn_voxel(VOXEL *v)

View File

@ -26,11 +26,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* Huniform_defaults - setup the five HUG parameter defaults

View File

@ -23,9 +23,8 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*

View File

@ -26,11 +26,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* Intersect - intersect ray with objects in linked list

View File

@ -80,11 +80,11 @@
#define VERSION "1.00"
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
CHAR *ProgName = "RAYTRACE"; /* The program name. */
INT nprocs = 1; /* The number of processors to use. */
INT MaxGlobMem = 32; /* Maximum global memory needed (MB).*/

View File

@ -25,11 +25,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
typedef REAL GJMATRIX[4][8]; /* Matrix for Gauss-Jordan inversion.*/

View File

@ -29,11 +29,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
#define CKSM 0x55AA55AA
#define PAGESIZE (4*1024)
#define THRESHOLD (sizeof(NODE) + 16)

View File

@ -25,11 +25,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* PolyName - return the object name

View File

@ -35,9 +35,8 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
#define PAGE_SIZE 4096

View File

@ -14,12 +14,11 @@
/* */
/*************************************************************************/
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "tiff_rgba_io.h"
#include <stdio.h>
#include <unistd.h>
#include <malloc.h>
#include <stdlib.h>
typedef short SHORT;
typedef long LONG;

View File

@ -25,7 +25,6 @@ static char sccsid[] = "@(#)savemap.c 1.3 2/6/9q";
#include <stdio.h>
#include <stdlib.h>
#include <tiffio.h>
#include "tiff_rgba_io.h"
#define streq(a,b) (strcmp(a,b) == 0)

View File

@ -28,11 +28,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* SpecularDirection - compute reflected ray

View File

@ -25,11 +25,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* SphName - return the object name

View File

@ -25,9 +25,8 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*

View File

@ -25,11 +25,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
#define X_NORM 1
#define Y_NORM 2
#define Z_NORM 3

View File

@ -30,11 +30,12 @@
*/
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "rt.h"
/*
* NAME
* PutJob - put another job into pid's work pool

View File

@ -17,7 +17,6 @@
/********** storing/loading of large arrays to/from files **********/
#include <fcntl.h>
#include "incl.h"
#define PMODE 0644 /* RW for owner, R for group, R for others */

View File

@ -21,15 +21,13 @@
*************************************************************************/
#include <sys/types.h>
#include <climits>
#include <cmath> /* Definitions for mathematical library */
#include <cstdio> /* Definitions for standard I/O library */
#include "address.h" /* Map address macros */
#include "user_options.h" /* User options defined at compile time */
#include "const.h" /* Constant definitions */
#include "my_types.h" /* User defined type */
#include "global.h" /* Global variables */
#include "macros.h" /* Definition of general C macros */
#include "my_types.h" /* User defined type */
#include "user_options.h" /* User options defined at compile time */
#include "address.h" /* Map address macros */
#include <stdio.h> /* Definitions for standard I/O library */
#include <math.h> /* Definitions for mathematical library */
#include <limits.h>
#include <sys/types.h>

View File

@ -26,13 +26,11 @@
*************************************************************************/
#include <sys/resource.h>
#include <sys/time.h>
#include <climits>
#include <cstring>
#include "incl.h"
#include <string.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <limits.h>
#include "tiffio.h"
#define SH_MEM_AMT 60000000

View File

@ -20,8 +20,7 @@
* *
******************************************************************************/
#include <cstring>
#include <string.h>
#include "incl.h"
/* The following declarations show the layout of the .den file. */

View File

@ -21,8 +21,7 @@
* *
******************************************************************************/
#include <cstring>
#include <string.h>
#include "incl.h"
/* The following declarations show the layout of the .norm file. */

View File

@ -20,8 +20,7 @@
* *
******************************************************************************/
#include <cstring>
#include <string.h>
#include "incl.h"
#define WRITE_PYR(IBIT,ILEVEL,IZ,IY,IX)\

View File

@ -21,8 +21,7 @@
* *
******************************************************************************/
#include <cstring>
#include <string.h>
#include "incl.h"
/* The following declarations show the layout of the .opc file. */

View File

@ -268,7 +268,7 @@ void Trace_Ray(foutx, fouty, pixel_address)
/* Popping can be repeated until parent boxes match */
/* or until next box is at starting level. */
while (level < starting_level) {
if (next_ivoxel[X]>>(level+1) !=
if(next_ivoxel[X]>>(level+1) !=
ivoxel[X]>>(level+1) ||
next_ivoxel[Y]>>(level+1) !=
ivoxel[Y]>>(level+1) ||

View File

@ -15,11 +15,11 @@
/*************************************************************************/
EXTERN_ENV
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
/* this routine puts the molecules back inside the box if they are out */
void BNDRY(long ProcID)

View File

@ -15,15 +15,14 @@
/*************************************************************************/
EXTERN_ENV
#include <cstdio>
#include "cnst.h"
#include "fileio.h"
#include "frcnst.h"
#include "global.h"
#include "parameters.h"
#include <stdio.h>
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "frcnst.h"
#include "fileio.h"
#include "parameters.h"
#include "global.h"
/* set up some constants
* N : NORDER + 1 = 7 for a sixth-order method

View File

@ -15,8 +15,7 @@
/*************************************************************************/
EXTERN_ENV
#include <cmath>
#include <math.h>
#include "global.h"
/* return the value of a with the same sign as b */

View File

@ -15,16 +15,16 @@
/*************************************************************************/
EXTERN_ENV
#include "math.h"
#include "stdio.h"
#include "mdvar.h"
#include "water.h"
#include "cnst.h"
#include "fileio.h"
#include "global.h"
#include "math.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "stdio.h"
#include "water.h"
#include "global.h"
void INITIA()
{

View File

@ -15,15 +15,15 @@
/*************************************************************************/
EXTERN_ENV
#include "cnst.h"
#include "global.h"
#include "math.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
double ****PFORCES;

View File

@ -15,15 +15,15 @@
/*************************************************************************/
EXTERN_ENV
#include "frcnst.h"
#include "global.h"
#include "math.h"
#include "mddata.h"
#include "frcnst.h"
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "water.h"
#include "wwpot.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
void INTRAF(double *VIR, long ProcID)
{

View File

@ -15,12 +15,12 @@
/*************************************************************************/
EXTERN_ENV
#include "global.h"
#include "math.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
/* this routine computes kinetic energy in each of the three spatial
dimensions, and puts the computed values in the SUM array */

View File

@ -15,16 +15,16 @@
/*************************************************************************/
EXTERN_ENV
#include "cnst.h"
#include "fileio.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "stdio.h"
#include "parameters.h"
#include "mdvar.h"
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "mddata.h"
#include "fileio.h"
#include "split.h"
#include "global.h"
/************************************************************************/

View File

@ -15,15 +15,15 @@
/*************************************************************************/
EXTERN_ENV
#include "frcnst.h"
#include "global.h"
#include "math.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "frcnst.h"
#include "water.h"
#include "wwpot.h"
#include "math.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
void POTENG(double *POTA, double *POTR, double *PTRF, long ProcID)
{

View File

@ -15,11 +15,11 @@
/*************************************************************************/
EXTERN_ENV
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
/* predicts new values for displacement and its five derivatives
*

View File

@ -15,16 +15,16 @@
/*************************************************************************/
EXTERN_ENV
#include <cmath>
#include "cnst.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "stdio.h"
#include <math.h>
#include "parameters.h"
#include "mdvar.h"
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "mddata.h"
#include "global.h"
void SYSCNS() /* sets up some system constants */
{

View File

@ -44,21 +44,20 @@
*/
MAIN_ENV
#include <cstdio>
#include <cstring>
#include <stdio.h>
#include <string.h>
#include "split.h"
/* include files for declarations */
#include "parameters.h"
#include "mdvar.h"
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "mddata.h"
#include "fileio.h"
#include "frcnst.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "water.h"
#include "wwpot.h"
long NMOL,NORDER,NATMO,NATMO3,NMOL1;
long NATOMS;

View File

@ -16,13 +16,12 @@
EXTERN_ENV
#include <cstdio>
#include "global.h"
#include "mddata.h"
#include <stdio.h>
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
void BNDRY(long ProcID) /* this routine puts the molecules back inside the box if they are out */
{

View File

@ -16,16 +16,15 @@
EXTERN_ENV
#include <cstdio>
#include "cnst.h"
#include "fileio.h"
#include "frcnst.h"
#include "global.h"
#include "mddata.h"
#include "parameters.h"
#include <stdio.h>
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "frcnst.h"
#include "fileio.h"
#include "parameters.h"
#include "mddata.h"
#include "global.h"
/* set up some constants; this routine is executed by
* a single processor before others are created

View File

@ -16,12 +16,11 @@
EXTERN_ENV
#include <cmath>
#include "global.h"
#include "mddata.h"
#include <math.h>
#include "parameters.h"
#include "mddata.h"
#include "water.h"
#include "global.h"
/* return the value of a with the same sign as b */
#define sign(a,b) (b < 0 ) ? ( (a < 0) ? a : -a) : ( (a < 0) ? -a : a)

View File

@ -16,17 +16,16 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include "mdvar.h"
#include "water.h"
#include "cnst.h"
#include "fileio.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "water.h"
#include "global.h"
void INITIA()
{

View File

@ -16,17 +16,16 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include "cnst.h"
#include "global.h"
#include "mddata.h"
#include <stdio.h>
#include <math.h>
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
void INTERF(long DEST, double *VIR, long ProcID)
{

View File

@ -16,17 +16,16 @@
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "frcnst.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "water.h"
#include "wwpot.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
void INTRAF(double *VIR, long ProcID)
{

View File

@ -16,13 +16,12 @@
EXTERN_ENV
#include <cmath>
#include "global.h"
#include "mddata.h"
#include <math.h>
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
/* this routine computes kinetic energy in each of the three spatial
dimensions, and puts the computed values in the SUM array */

View File

@ -16,17 +16,17 @@
EXTERN_ENV
#include <cstdio>
#include <stdio.h>
#include "cnst.h"
#include "fileio.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "mdvar.h"
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "mddata.h"
#include "fileio.h"
#include "split.h"
#include "global.h"
/************************************************************************/

View File

@ -16,16 +16,15 @@
EXTERN_ENV
#include <cmath>
#include "frcnst.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "split.h"
#include "frcnst.h"
#include "water.h"
#include "wwpot.h"
#include <math.h>
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
void POTENG(double *POTA, double *POTR, double *PTRF, long ProcID)
{

View File

@ -16,11 +16,11 @@
EXTERN_ENV
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "mddata.h"
#include "split.h"
#include "global.h"
/* predicts new values for displacement and its five derivatives
* using Gear's sixth-order predictor-corrector method

View File

@ -15,16 +15,17 @@
/*************************************************************************/
EXTERN_ENV
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <math.h>
#include "cnst.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "mdvar.h"
#include "water.h"
#include "wwpot.h"
#include "cnst.h"
#include "mddata.h"
#include "global.h"
void SYSCNS() /* sets up some system constants */
{

View File

@ -45,22 +45,22 @@ MAIN_ENV
(and not have fewer boxes than processors).
*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stdio.h>
#include <string.h>
#include <math.h>
/* include files for declarations */
#include "cnst.h"
#include "fileio.h"
#include "frcnst.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "randno.h"
#include "split.h"
#include "water.h"
#include "wwpot.h"
#include "mddata.h"
#include "global.h"
long NATOMS;
long I2;

View File

@ -16,8 +16,7 @@
EXTERN_ENV
#include <cstdio>
#include <stdio.h>
#include "matrix.h"
long *next_in_super, *member_of, *super_parent;

View File

@ -16,8 +16,7 @@
EXTERN_ENV
#include <cmath>
#include <math.h>
#include "matrix.h"
#define MISS_COST 4.74

View File

@ -16,9 +16,8 @@
EXTERN_ENV
#include <cmath>
#include "matrix.h"
#include <math.h>
long vMiss=0, wMiss=0, xMiss=0, yMiss=0; /* Local but don't care */
extern long BS;

View File

@ -16,9 +16,8 @@
EXTERN_ENV
#include <cmath>
#include "matrix.h"
#include <math.h>
double *TriBSolve(BMatrix LB, double *b, long *PERM)
{

Some files were not shown because too many files have changed in this diff Show More