aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-05-11 16:33:49 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-05-11 16:33:49 +0000
commit8f118a2cd93aca3bb8cef6ecf42a9186e90e8d3a (patch)
treebcac34fb8bfabab2f0bb0107f220b0be1b677eaa /src
parent3fc109a28403d2adcb97c254bb3ad690c2b27e40 (diff)
Splitting setup of pGH structure in PUGH_ScheduleTraverseGH()
into PUGH_InitGHBasics() and PUGH_InitGHVariables(). The former is also called by PUGH_InitGH() now so that the cGH structure passed to other thorns' InitGH() routines is initialized somehow. Untabified sources. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@218 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src')
-rw-r--r--src/GHExtension.c152
1 files changed, 96 insertions, 56 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
index e1f21f0..94de6af 100644
--- a/src/GHExtension.c
+++ b/src/GHExtension.c
@@ -74,7 +74,7 @@ void *PUGH_SetupGH(tFleshConfig *config,
nsize,
ghostsize,
CCTK_StaggerVars() ? PUGH_STAGGER : PUGH_NO_STAGGER,
- perme);
+ perme);
if (!newGH)
{
CCTK_WARN(0,"Failed to allocate memory for a pGH");
@@ -106,11 +106,11 @@ void *PUGH_SetupGH(tFleshConfig *config,
for (i=0;i<pgroup.dim;i++)
{
groupsize[i]=*size[i];
- /* Check distribution type */
- if (pgroup.disttype == DISTRIB_CONSTANT)
- {
- groupsize[i] = -groupsize[i];
- }
+ /* Check distribution type */
+ if (pgroup.disttype == DISTRIB_CONSTANT)
+ {
+ groupsize[i] = -groupsize[i];
+ }
}
}
else
@@ -165,13 +165,12 @@ void *PUGH_SetupGH(tFleshConfig *config,
}
-
/*@@
- @routine PUGH_InitGH
- @date Wed Feb 3 23:10:19 1999
- @author Tom Goodale
+ @routine PUGH_InitGHBasics
+ @date Thu May 11 2000
+ @author Thomas Radke
@desc
-
+ Initializes the basic fields of a cGH structure
@enddesc
@calls
@calledby
@@ -180,67 +179,67 @@ void *PUGH_SetupGH(tFleshConfig *config,
@endhistory
@@*/
-int PUGH_InitGH(cGH *GH)
-{
- return 0;
-}
-
-
- /*@@
- @routine PUGH_ScheduleTraverseGH
- @date Thu Jan 27 15:14:09 2000
- @author Tom Goodale
- @desc
- Fills out the cGH and then calls schedule traverse.
- @enddesc
- @calls
- @calledby
- @history
- @hdate Thu Jan 27 15:15:35 2000 @hauthor Tom Goodale
- @hdesc Was originally PUGH_rfrTraverse
- @endhistory
-
-@@*/
-int PUGH_ScheduleTraverseGH(cGH *GH,
- const char *where)
+static void PUGH_InitGHBasics (cGH *GH)
{
- int retcode;
- int var;
- int gtype;
- int ntimelevels;
- int level;
int idir;
int istag;
pGH *mypGH;
+ pGExtras *GFExtras;
mypGH = (pGH *)GH->extensions[pugh_GHExtension];
+ GFExtras = mypGH->GFExtras[GH->cctk_dim-1];
- /* FIXME */
GH->cctk_convlevel = 0;
for (idir=0;idir<GH->cctk_dim;idir++)
{
GH->cctk_levfac[idir] = 1;
- GH->cctk_nghostzones[idir] = mypGH->GFExtras[GH->cctk_dim-1]->nghostzones[idir];
- GH->cctk_lsh[idir] = mypGH->GFExtras[GH->cctk_dim-1]->lnsize[idir];
- GH->cctk_gsh[idir] = mypGH->GFExtras[GH->cctk_dim-1]->nsize[idir];
- GH->cctk_bbox[2*idir] = mypGH->GFExtras[GH->cctk_dim-1]->lb[mypGH->myproc][idir] == 0;
- GH->cctk_bbox[2*idir+1] = mypGH->GFExtras[GH->cctk_dim-1]->ub[mypGH->myproc][idir]
- == mypGH->GFExtras[GH->cctk_dim-1]->nsize[idir]-1;
- GH->cctk_lbnd[idir] = mypGH->GFExtras[GH->cctk_dim-1]->lb[mypGH->myproc][idir];
- GH->cctk_ubnd[idir] = mypGH->GFExtras[GH->cctk_dim-1]->ub[mypGH->myproc][idir];
+ GH->cctk_nghostzones[idir] = GFExtras->nghostzones[idir];
+ GH->cctk_lsh[idir] = GFExtras->lnsize[idir];
+ GH->cctk_gsh[idir] = GFExtras->nsize[idir];
+ GH->cctk_bbox[2*idir] = GFExtras->lb[mypGH->myproc][idir] == 0;
+ GH->cctk_bbox[2*idir+1] = GFExtras->ub[mypGH->myproc][idir]
+ == GFExtras->nsize[idir]-1;
+ GH->cctk_lbnd[idir] = GFExtras->lb[mypGH->myproc][idir];
+ GH->cctk_ubnd[idir] = GFExtras->ub[mypGH->myproc][idir];
for (istag=0;istag<CCTK_NSTAGGER;istag++)
{
GH->cctk_lssh[CCTK_LSSH_IDX(istag,idir)] =
- (mypGH->GFExtras[GH->cctk_dim-1]->ownership[istag][1][idir]);
+ (GFExtras->ownership[istag][1][idir]);
if (GH->cctk_bbox[2*idir+1]==0)
{
GH->cctk_lssh[CCTK_LSSH_IDX(istag,idir)]+= GH->cctk_nghostzones[idir];
}
}
}
+}
+
+
+ /*@@
+ @routine PUGH_InitGHVariables
+ @date Thu May 11 2000
+ @author Thomas Radke
+ @desc
+ Initializes the variables of a cGH structure
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+static void PUGH_InitGHVariables (cGH *GH)
+{
+ int var;
+ int gtype;
+ int ntimelevels;
+ int level;
+ pGH *mypGH;
+
+ mypGH = (pGH *)GH->extensions[pugh_GHExtension];
for(var = 0; var < mypGH->nvariables; var++)
{
@@ -255,22 +254,63 @@ int PUGH_ScheduleTraverseGH(cGH *GH,
GH->data[var][level] = mypGH->variables[var][level];
break;
case CCTK_GF :
- GH->data[var][level] =
- ((pGA ***)(mypGH->variables))[var][level]->data;
- break;
- case CCTK_ARRAY :
+ case CCTK_ARRAY :
GH->data[var][level] =
((pGA ***)(mypGH->variables))[var][level]->data;
break;
default:
- CCTK_WARN(1,"Unknown group type in PUGH_ScheduleTraverse");
+ CCTK_WARN(1,"Unknown group type in PUGH_InitGHVariables");
}
}
}
+}
+
+ /*@@
+ @routine PUGH_InitGH
+ @date Wed Feb 3 23:10:19 1999
+ @author Tom Goodale
+ @desc
+
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+int PUGH_InitGH(cGH *GH)
+{
+ PUGH_InitGHBasics (GH);
+
+ return 0;
+}
+
+
+ /*@@
+ @routine PUGH_ScheduleTraverseGH
+ @date Thu Jan 27 15:14:09 2000
+ @author Tom Goodale
+ @desc
+ Fills out the cGH and then calls schedule traverse.
+ @enddesc
+ @calls
+ @calledby
+ @history
+ @hdate Thu Jan 27 15:15:35 2000 @hauthor Tom Goodale
+ @hdesc Was originally PUGH_rfrTraverse
+ @hdate Thu May 11 2000 @hauthor Thomas Radke
+ @hdesc Splitted pGH setup into PUGH_InitGHBasics() and PUGH_InitGHVariables()
+ @endhistory
- retcode = CCTK_ScheduleTraverse(where, GH, NULL);
+@@*/
+int PUGH_ScheduleTraverseGH(cGH *GH,
+ const char *where)
+{
+ PUGH_InitGHBasics (GH);
+ PUGH_InitGHVariables (GH);
- return retcode;
+ return CCTK_ScheduleTraverse(where, GH, NULL);
}
int PUGH_GFSize(int dim, int *nsize)