Changeset 589 for soft/giet_vm/applications/ocean/laplacalc.C
- Timestamp:
- Jul 8, 2015, 3:57:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/ocean/laplacalc.C
r581 r589 1 /*************************************************************************/ 2 /* */ 3 /* Copyright (c) 1994 Stanford University */ 4 /* */ 5 /* All rights reserved. */ 6 /* */ 7 /* Permission is given to use, copy, and modify this software for any */ 8 /* non-commercial purpose as long as this copyright notice is not */ 9 /* removed. All other uses, including redistribution in whole or in */ 10 /* part, are forbidden without prior written permission. */ 11 /* */ 12 /* This software is provided with absolutely no warranty and no */ 13 /* support. */ 14 /* */ 15 /*************************************************************************/ 1 #line 115 "/Users/alain/soc/giet_vm/applications/ocean/null_macros/c.m4.null.GIET" 16 2 17 /* Performs the laplacian calculation for a subblock */18 19 EXTERN_ENV20 21 #include <stdio.h>22 #include <math.h>23 24 #include "decs.h"25 26 void laplacalc(long procid, double ****x, double ****z, long psiindex, long firstrow, long lastrow, long firstcol, long lastcol)27 {28 long iindex;29 long indexp1;30 long indexm1;31 long ip1;32 long im1;33 long i;34 long j;35 double **t2a;36 double **t2b;37 double *t1a;38 double *t1b;39 double *t1c;40 double *t1d;41 42 t2a = (double **) x[procid][psiindex];43 j = gp[procid].neighbors[UP];44 if (j != -1) {45 t1a = (double *) t2a[0];46 t1b = (double *) x[j][psiindex][im - 2];47 for (i = 1; i <= lastcol; i++) {48 t1a[i] = t1b[i];49 }50 }51 j = gp[procid].neighbors[DOWN];52 if (j != -1) {53 t1a = (double *) t2a[im - 1];54 t1b = (double *) x[j][psiindex][1];55 for (i = 1; i <= lastcol; i++) {56 t1a[i] = t1b[i];57 }58 }59 j = gp[procid].neighbors[LEFT];60 if (j != -1) {61 t2b = (double **) x[j][psiindex];62 for (i = 1; i <= lastrow; i++) {63 t2a[i][0] = t2b[i][jm - 2];64 }65 }66 j = gp[procid].neighbors[RIGHT];67 if (j != -1) {68 t2b = (double **) x[j][psiindex];69 for (i = 1; i <= lastrow; i++) {70 t2a[i][jm - 1] = t2b[i][1];71 }72 }73 74 t2a = (double **) x[procid][psiindex];75 t2b = (double **) z[procid][psiindex];76 for (i = firstrow; i <= lastrow; i++) {77 ip1 = i + 1;78 im1 = i - 1;79 t1a = (double *) t2a[i];80 t1b = (double *) t2b[i];81 t1c = (double *) t2a[ip1];82 t1d = (double *) t2a[im1];83 for (iindex = firstcol; iindex <= lastcol; iindex++) {84 indexp1 = iindex + 1;85 indexm1 = iindex - 1;86 t1b[iindex] = factlap * (t1c[iindex] + t1d[iindex] + t1a[indexp1] + t1a[indexm1] - 4. * t1a[iindex]);87 }88 }89 90 if (gp[procid].neighbors[UP] == -1) {91 t1b = (double *) t2b[0];92 for (j = firstcol; j <= lastcol; j++) {93 t1b[j] = 0.0;94 }95 }96 if (gp[procid].neighbors[DOWN] == -1) {97 t1b = (double *) t2b[im - 1];98 for (j = firstcol; j <= lastcol; j++) {99 t1b[j] = 0.0;100 }101 }102 if (gp[procid].neighbors[LEFT] == -1) {103 for (j = firstrow; j <= lastrow; j++) {104 t2b[j][0] = 0.0;105 }106 }107 if (gp[procid].neighbors[RIGHT] == -1) {108 for (j = firstrow; j <= lastrow; j++) {109 t2b[j][jm - 1] = 0.0;110 }111 }112 113 }
Note: See TracChangeset
for help on using the changeset viewer.