diff options
author | allen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 1999-10-17 11:15:53 +0000 |
---|---|---|
committer | allen <allen@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 1999-10-17 11:15:53 +0000 |
commit | e4b6654873ce74c6246b32ad6ac57239901f6b1a (patch) | |
tree | 3075232428210c422eb52caabfd90bf14704193c /src/GHExtension.c | |
parent | b1ad68a65f9b11ffd7c586b9971e5c7efdc680c9 (diff) |
Adding infrastructure for 1D and 2D GFs ... but haven't added decomposition
and copying code yet
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@97 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/GHExtension.c')
-rw-r--r-- | src/GHExtension.c | 141 |
1 files changed, 99 insertions, 42 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c index d881db7..d02f67f 100644 --- a/src/GHExtension.c +++ b/src/GHExtension.c @@ -13,8 +13,6 @@ #include <stdlib.h> #include "cctk.h" -#include "cctk_Flesh.h" -#include "cctk_Groups.h" #include "pugh.h" #include "cctk_parameters.h" @@ -24,19 +22,102 @@ static char *rcsid = "$Header$"; extern int PUGH_GHExtension; -pGH *SetupPGH(void *callerid, int nx, int ny, int nz, int ghost_size, int stagger); +pGH *SetupPGH(void *callerid, + int dim, + int *nsize, + int *ghostsize, + int stagger); void *pugh_SetupGH(tFleshConfig *config, int convergence_level, cGH *GH) { + DECLARE_CCTK_PARAMETERS + pGH *newGH; int group; int gtype, vtype, dim, n_variables, n_timelevels; + int *nsize; + int *ghostsize; + int dir; + + dim = 3; + + nsize = (int *)malloc(dim*sizeof(int)); + ghostsize = (int *)malloc(dim*sizeof(int)); + + if (global_nsize > 0) + { + for (dir=0;dir<dim;dir++) + { + nsize[dir] = global_nsize; + } + } + else + { + if (local_nsize > 0) + { + for (dir=0;dir<dim;dir++) + { + nsize[dir] = -local_nsize; + } + } + else + { + if (dim>0) + { + if (local_nx > 0) + { + nsize[0] = -local_nx; + } + else + { + nsize[0] = global_nx; + } + } + + if (dim>1) + { + if (local_ny > 0) + { + nsize[1] = -local_ny; + } + else + { + nsize[1] = global_ny; + } + } + + if (dim>2) + { + if (local_nz > 0) + { + nsize[2] = -local_nz; + } + else + { + nsize[2] = global_nz; + } + } + } + } - newGH = SetupPGH(GH,global_nx, global_ny, global_nz, - ghost_size, PUGH_NO_STAGGER); + if (ghost_size>-1) + { + for (dir=0;dir<dim;dir++) + { + ghostsize[dir] = ghost_size; + } + } + else + { + ghostsize[0] = ghost_size_x; + ghostsize[1] = ghost_size_y; + ghostsize[2] = ghost_size_z; + } + + newGH = SetupPGH(GH,dim,nsize, ghostsize, PUGH_NO_STAGGER); if(!newGH) { @@ -57,6 +138,8 @@ void *pugh_SetupGH(tFleshConfig *config, } + free(nsize); + free(ghostsize); return newGH; } @@ -73,52 +156,26 @@ int pugh_rfrTraverseGH(cGH *GH, int rfrpoint) int gtype; pGH *mypGH; int ntimelevels; - int level; + int level,idir; mypGH = (pGH *)GH->extensions[PUGH_GHExtension]; - GH->cctk_levfac[0] = 1; - GH->cctk_levfac[1] = 1; - GH->cctk_levfac[2] = 1; - /* Fix me */ GH->cctk_convlevel = 1; - GH->cctk_nghostzones[0] = 1; - GH->cctk_nghostzones[1] = 1; - GH->cctk_nghostzones[2] = 1; - GH->cctk_lsh[0] = mypGH->lnx; - GH->cctk_gsh[0] = mypGH->nx; - - GH->cctk_bbox[0] = mypGH->lb[mypGH->myproc][0] == 0; - GH->cctk_bbox[1] = mypGH->ub[mypGH->myproc][0] == mypGH->nx-1; - - if(GH->cctk_dim > 1) + for (idir=0;idir<GH->cctk_dim;idir++) { - GH->cctk_lsh[1] = mypGH->lny; - GH->cctk_gsh[1] = mypGH->ny; - - GH->cctk_bbox[2] = mypGH->lb[mypGH->myproc][1] == 0; - GH->cctk_bbox[3] = mypGH->ub[mypGH->myproc][1] == mypGH->ny-1; - + GH->cctk_levfac[idir] = 1; + GH->cctk_nghostzones[idir] = mypGH->nghostzones[idir]; + GH->cctk_lsh[idir] = mypGH->lnsize[idir]; + GH->cctk_gsh[idir] = mypGH->nsize[idir]; + GH->cctk_bbox[2*idir] = mypGH->lb[mypGH->myproc][idir] == 0; + GH->cctk_bbox[2*idir+1] = mypGH->ub[mypGH->myproc][idir] + == mypGH->nsize[idir]-1; + GH->cctk_lbnd[idir] = mypGH->lb[mypGH->myproc][idir]; + GH->cctk_ubnd[idir] = mypGH->ub[mypGH->myproc][idir]; } - if(GH->cctk_dim > 2) - { - GH->cctk_lsh[2] = mypGH->lnz; - GH->cctk_gsh[2] = mypGH->nz; - - GH->cctk_bbox[4] = mypGH->lb[mypGH->myproc][2] == 0; - GH->cctk_bbox[5] = mypGH->ub[mypGH->myproc][2] == mypGH->nz-1; - - } - - for(dim = 0; dim < GH->cctk_dim; dim++) - { - GH->cctk_lbnd[dim] = mypGH->lb[mypGH->myproc][dim]; - GH->cctk_ubnd[dim] = mypGH->ub[mypGH->myproc][dim]; - } - for(var = 0; var < mypGH->nvariables; var++) { |