summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authoreschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-07-04 01:25:29 +0000
committereschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-07-04 01:25:29 +0000
commit5890fa36427bdea8efe70079e3cd1e5612312e77 (patch)
tree47d730568fc835f8f37d54728de142c767699f3d /src/main
parentd9fda6d54df1e6de28a99e812e6c5769e4d9be4a (diff)
Introduce cctk_ash, retire cctk_lssh
Introduce cctk_ash, describing the process-local array shape that has been allocated. This may be larger than cctk_lsh, the process-local shape that should be used. Retire cctk_lssh and related infrastructure to handle staggered grid functions. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4841 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main')
-rw-r--r--src/main/DebugDefines.c16
-rw-r--r--src/main/Groups.c47
-rw-r--r--src/main/GroupsOnGH.c102
-rw-r--r--src/main/Stagger.c440
-rw-r--r--src/main/make.code.defn1
5 files changed, 64 insertions, 542 deletions
diff --git a/src/main/DebugDefines.c b/src/main/DebugDefines.c
index bc7a68eb..b7a1ea9c 100644
--- a/src/main/DebugDefines.c
+++ b/src/main/DebugDefines.c
@@ -79,7 +79,7 @@ int CCTK_GFIndex2D (const cGH *GH, int i, int j)
i, j, GH->cctk_lsh[0], GH->cctk_lsh[1]);
}
#endif
- return (i + GH->cctk_lsh[0]*j);
+ return (i + GH->cctk_ash[0]*j);
}
int CCTK_GFIndex3D (const cGH *GH, int i, int j, int k)
@@ -95,7 +95,7 @@ int CCTK_GFIndex3D (const cGH *GH, int i, int j, int k)
i, j, k, GH->cctk_lsh[0], GH->cctk_lsh[1], GH->cctk_lsh[2]);
}
#endif
- return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*k));
+ return (i + GH->cctk_ash[0]*(j + GH->cctk_ash[1]*k));
}
int CCTK_GFIndex4D (const cGH *GH, int i, int j, int k, int l)
@@ -112,7 +112,7 @@ int CCTK_GFIndex4D (const cGH *GH, int i, int j, int k, int l)
i, j, k, l, GH->cctk_lsh[0], GH->cctk_lsh[1], GH->cctk_lsh[2], GH->cctk_lsh[3]);
}
#endif
- return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*(k + GH->cctk_lsh[2] * l)));
+ return (i + GH->cctk_ash[0]*(j + GH->cctk_ash[1]*(k + GH->cctk_ash[2] * l)));
}
int CCTK_VectGFIndex0D (const cGH *GH, int n)
@@ -147,7 +147,7 @@ int CCTK_VectGFIndex1D (const cGH *GH, int i, int n)
n);
}
#endif
- return (i + GH->cctk_lsh[0]*n);
+ return (i + GH->cctk_ash[0]*n);
}
int CCTK_VectGFIndex2D (const cGH *GH, int i, int j, int n)
@@ -169,7 +169,7 @@ int CCTK_VectGFIndex2D (const cGH *GH, int i, int j, int n)
n);
}
#endif
- return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*n));
+ return (i + GH->cctk_ash[0]*(j + GH->cctk_ash[1]*n));
}
int CCTK_VectGFIndex3D (const cGH *GH, int i, int j, int k, int n)
@@ -192,7 +192,7 @@ int CCTK_VectGFIndex3D (const cGH *GH, int i, int j, int k, int n)
n);
}
#endif
- return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*(k + GH->cctk_lsh[2]*n)));
+ return (i + GH->cctk_ash[0]*(j + GH->cctk_ash[1]*(k + GH->cctk_ash[2]*n)));
}
int CCTK_VectGFIndex4D (const cGH *GH, int i, int j, int k, int l, int n)
@@ -216,6 +216,6 @@ int CCTK_VectGFIndex4D (const cGH *GH, int i, int j, int k, int l, int n)
n);
}
#endif
- return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*(k + GH->cctk_lsh[2]*
- (l + GH->cctk_lsh[3]*n))));
+ return (i + GH->cctk_ash[0]*(j + GH->cctk_ash[1]*(k + GH->cctk_ash[2]*
+ (l + GH->cctk_ash[3]*n))));
}
diff --git a/src/main/Groups.c b/src/main/Groups.c
index cf501a53..6716692f 100644
--- a/src/main/Groups.c
+++ b/src/main/Groups.c
@@ -24,7 +24,6 @@
#include "cctk_Types.h"
#include "cctk_ActiveThorns.h"
-#include "cctki_Stagger.h"
#include "cctki_Groups.h"
#include "util_Expression.h"
@@ -159,8 +158,7 @@ typedef struct
/* The types. */
int gtype,
vtype,
- dtype,
- staggertype;
+ dtype;
int gscope;
@@ -209,15 +207,12 @@ static int *group_of_variable = NULL;
static int maxdim = 0;
static int gfdim = 0;
-static int staggered = 0;
-
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
static cGroupDefinition *CCTKi_SetupGroup (const char *implementation,
const char *name,
- int staggercode,
int n_variables,
int vectorlength);
static CCTK_INT **CCTKi_ExtractSize (int dimension,
@@ -227,24 +222,6 @@ static CCTK_INT **CCTKi_ExtractSize (int dimension,
static int CCTKi_ParamExpressionToInt(const char *expression, const char *thorn);
- /*@@
- @routine CCTK_StaggerVars
- @date
- @author Gerd Lanfermann
- @desc
- Checks if staggered group(s) exist
- @enddesc
-
- @returntype int
- @returndesc
- 0 if no staggered group exists, non-zero otherwise
- @endreturndesc
-@@*/
-int CCTK_StaggerVars (void)
-{
- return (staggered);
-}
-
/*@@
@routine CCTK_GroupIndex
@@ -1119,7 +1096,6 @@ int CCTK_GroupData (int group, cGroup *gp)
gp->numvars = groups[group].n_variables;
gp->vectorlength = groups[group].vectorlength;
gp->numtimelevels = groups[group].n_timelevels;
- gp->stagtype = groups[group].staggertype;
gp->tagstable = groups[group].tags_table;
if(groups[group].vararraysize)
@@ -2340,11 +2316,10 @@ void CCTKi_PrintGroupInfo (void)
for (group_num = 0; group_num < n_groups; group_num++)
{
- printf ("GROUP INFO: GrpNo./imp_name/name/stag %d >%s< >%s< %d\n",
+ printf ("GROUP INFO: GrpNo./imp_name/name %d >%s< >%s<\n",
group_num,
groups[group_num].implementation,
- groups[group_num].name,
- groups[group_num].staggertype);
+ groups[group_num].name);
}
}
#endif
@@ -2371,7 +2346,6 @@ int CCTKi_CreateGroup (const char *gname,
const char *gscope,
int dimension,
int ntimelevels,
- const char *stype,
const char *dtype,
const char *size,
const char *ghostsize,
@@ -2383,7 +2357,6 @@ int CCTKi_CreateGroup (const char *gname,
{
int retval;
int groupscope;
- int staggercode;
int variable;
int vectorlength;
@@ -2404,9 +2377,6 @@ int CCTKi_CreateGroup (const char *gname,
va_start (ap, n_basevars);
- /* get the staggercode */
- staggercode = CCTKi_ParseStaggerString (dimension, imp, gname, stype);
-
if (vararraysize)
{
vararraysize = Util_Strdup(vararraysize);
@@ -2426,12 +2396,12 @@ int CCTKi_CreateGroup (const char *gname,
groupscope = CCTK_GroupScopeNumber (gscope);
if (groupscope == CCTK_PUBLIC || groupscope == CCTK_PROTECTED)
{
- group = CCTKi_SetupGroup (imp, gname, staggercode,
+ group = CCTKi_SetupGroup (imp, gname,
n_basevars * vectorlength, vectorlength);
}
else if (groupscope == CCTK_PRIVATE)
{
- group = CCTKi_SetupGroup (thorn, gname, staggercode,
+ group = CCTKi_SetupGroup (thorn, gname,
n_basevars * vectorlength, vectorlength);
}
else
@@ -2447,7 +2417,6 @@ int CCTKi_CreateGroup (const char *gname,
group->gtype = CCTK_GroupTypeNumber (gtype);
group->vtype = CCTK_VarTypeNumber (vtype);
group->gscope = groupscope;
- group->staggertype = staggercode;
group->dtype = CCTK_GroupDistribNumber (dtype);
group->n_timelevels = ntimelevels;
group->tags_string = Util_Strdup(tags);
@@ -2491,10 +2460,6 @@ int CCTKi_CreateGroup (const char *gname,
{
maxdim = dimension;
}
- if (staggercode > 0)
- {
- staggered = 1;
- }
group->size = CCTKi_ExtractSize (dimension, thorn, size, gname);
group->ghostsize = CCTKi_ExtractSize (dimension, thorn, ghostsize, gname);
@@ -2572,7 +2537,6 @@ const char *CCTK_GroupImplementationI(int group)
@@*/
static cGroupDefinition *CCTKi_SetupGroup (const char *implementation,
const char *name,
- int staggercode,
int n_variables,
int vectorlength)
{
@@ -2625,7 +2589,6 @@ static cGroupDefinition *CCTKi_SetupGroup (const char *implementation,
strcpy (groups[n_groups].name, name);
groups[n_groups].number = n_groups;
- groups[n_groups].staggertype = staggercode;
groups[n_groups].n_variables = n_variables;
groups[n_groups].vectorlength = vectorlength;
diff --git a/src/main/GroupsOnGH.c b/src/main/GroupsOnGH.c
index 5dc3dbd1..55a4f5da 100644
--- a/src/main/GroupsOnGH.c
+++ b/src/main/GroupsOnGH.c
@@ -109,29 +109,29 @@ void CCTK_FCALL CCTK_FNAME (CCTK_GrouplshVN)
const int *dim,
int *lsh,
ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGI)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashGI)
(int *ierr,
const cGH **cctkGH,
const int *dim,
- int *lssh,
+ int *ash,
const int *groupindex);
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGN)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashGN)
(int *ierr,
const cGH **cctkGH,
const int *dim,
- int *lssh,
+ int *ash,
ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVI)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashVI)
(int *ierr,
const cGH **cctkGH,
const int *dim,
- int *lssh,
+ int *ash,
const int *varindex);
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVN)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashVN)
(int *ierr,
const cGH **cctkGH,
const int *dim,
- int *lssh,
+ int *ash,
ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_GroupgshGI)
(int *ierr,
@@ -1226,21 +1226,21 @@ void CCTK_FCALL CCTK_FNAME (CCTK_GrouplshVN)
/********************************************************************
- ******************** Group local stagger shape ***************
+ ******************** Group local allocated shape *************
********************************************************************/
/*@@
- @routine CCTK_GrouplsshGI
+ @routine CCTK_GroupashGI
@date 2011-03-16
@author Erik Schnetter
@desc
- Returns the lssh for a variable group
+ Returns the ash for a variable group
@enddesc
@@*/
-int CCTK_GrouplsshGI(const cGH *cctkGH,
- int size,
- int *lssh,
- int groupindex)
+int CCTK_GroupashGI(const cGH *cctkGH,
+ int size,
+ int *ash,
+ int groupindex)
{
int retval = 0;
int ierr;
@@ -1250,144 +1250,144 @@ int CCTK_GrouplsshGI(const cGH *cctkGH,
ierr = CCTK_GroupDynamicData(cctkGH,groupindex,&data);
- if (ierr == 0 && (data.dim == 0 || data.lssh))
+ if (ierr == 0 && (data.dim == 0 || data.ash))
{
- if (CCTK_NSTAGGER*data.dim != size)
+ if (data.dim != size)
{
retval = -1;
- usesize = (CCTK_NSTAGGER*data.dim < size) ? CCTK_NSTAGGER*data.dim : size;
+ usesize = (data.dim < size) ? data.dim : size;
groupname = CCTK_GroupName (groupindex);
CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_GrouplsshGI: Incorrect size %d supplied, "
+ "CCTK_GroupashGI: Incorrect size %d supplied, "
"group '%s' has dimension %d, copying %d integers",
size,groupname,data.dim,usesize);
free (groupname);
}
- memcpy(lssh,(const int *)data.lssh,usesize*sizeof(int));
+ memcpy(ash,(const int *)data.ash,usesize*sizeof(int));
}
else
{
retval = -2;
CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_GrouplsshGI: Data not available from driver thorn");
+ "CCTK_GroupashGI: Data not available from driver thorn");
}
return retval;
}
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGI)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashGI)
(int *ierr,
const cGH **cctkGH,
const int *size,
- int *lssh,
+ int *ash,
const int *groupindex)
{
- *ierr = CCTK_GrouplsshGI (*cctkGH, *size, lssh, *groupindex);
+ *ierr = CCTK_GroupashGI (*cctkGH, *size, ash, *groupindex);
}
-int CCTK_GrouplsshGN(const cGH *cctkGH,
- int size,
- int *lssh,
- const char *groupname)
+int CCTK_GroupashGN(const cGH *cctkGH,
+ int size,
+ int *ash,
+ const char *groupname)
{
int retval;
int gindex = CCTK_GroupIndex(groupname);
if (gindex > -1)
{
- retval = CCTK_GrouplsshGI(cctkGH,size,lssh,gindex);
+ retval = CCTK_GroupashGI(cctkGH,size,ash,gindex);
}
else
{
retval = -4;
CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_GrouplsshGN: Group index not found for %s",groupname);
+ "CCTK_GroupashGN: Group index not found for %s",groupname);
}
return retval;
}
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGN)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashGN)
(int *ierr,
const cGH **cctkGH,
const int *size,
- int *lssh,
+ int *ash,
ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (groupname)
- *ierr = CCTK_GrouplsshGN (*cctkGH, *size, lssh, groupname);
+ *ierr = CCTK_GroupashGN (*cctkGH, *size, ash, groupname);
free (groupname);
}
-int CCTK_GrouplsshVI(const cGH *cctkGH,
- int size,
- int *lssh,
- int varindex)
+int CCTK_GroupashVI(const cGH *cctkGH,
+ int size,
+ int *ash,
+ int varindex)
{
int retval;
int gindex = CCTK_GroupIndexFromVarI(varindex);
if (gindex > -1)
{
- retval = CCTK_GrouplsshGI(cctkGH,size,lssh,gindex);
+ retval = CCTK_GroupashGI(cctkGH,size,ash,gindex);
}
else
{
retval = -4;
CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_GrouplsshVI: Group index not found for variable index %d",
+ "CCTK_GroupashVI: Group index not found for variable index %d",
varindex);
}
return retval;
}
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVI)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashVI)
(int *ierr,
const cGH **cctkGH,
const int *size,
- int *lssh,
+ int *ash,
const int *varindex)
{
- *ierr = CCTK_GrouplsshVI (*cctkGH, *size, lssh, *varindex);
+ *ierr = CCTK_GroupashVI (*cctkGH, *size, ash, *varindex);
}
-int CCTK_GrouplsshVN(const cGH *cctkGH,
- int size,
- int *lssh,
- const char *varname)
+int CCTK_GroupashVN(const cGH *cctkGH,
+ int size,
+ int *ash,
+ const char *varname)
{
int retval;
int gindex = CCTK_GroupIndexFromVar(varname);
if (gindex > -1)
{
- retval = CCTK_GrouplsshGI(cctkGH,size,lssh,gindex);
+ retval = CCTK_GroupashGI(cctkGH,size,ash,gindex);
}
else
{
retval = -4;
CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_GrouplsshVN: Group index not found for %s",varname);
+ "CCTK_GroupashVN: Group index not found for %s",varname);
}
return retval;
}
-void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVN)
+void CCTK_FCALL CCTK_FNAME (CCTK_GroupashVN)
(int *ierr,
const cGH **cctkGH,
const int *size,
- int *lssh,
+ int *ash,
ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (varname)
- *ierr = CCTK_GrouplsshVN (*cctkGH, *size, lssh, varname);
+ *ierr = CCTK_GroupashVN (*cctkGH, *size, ash, varname);
free (varname);
}
diff --git a/src/main/Stagger.c b/src/main/Stagger.c
deleted file mode 100644
index 67aa8c0f..00000000
--- a/src/main/Stagger.c
+++ /dev/null
@@ -1,440 +0,0 @@
- /*@@
- @file Stagger.c
- @date Thu Jan 27 15:32:28 2000
- @author Gerd Lanfermann
- @desc
- Stuff to deal with staggering.
- @enddesc
- @version $Header$
- @@*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "cctk_Flesh.h"
-#include "cctk_FortranString.h"
-#include "cctk_Groups.h"
-#include "cctk_Types.h"
-#include "cctk_WarnLevel.h"
-
-#include "cctk_Stagger.h"
-#include "cctki_Stagger.h"
-
-static const char *rcsid = "$Header$";
-
-CCTK_FILEVERSION(main_Stagger_c);
-
-/********************************************************************
- ********************* Fortran Wrappers ***********************
- ********************************************************************/
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerIndexGI)
- (int *stagcode, int *gindex);
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerIndexGN)
- (int *scode, ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_StaggerIndex)
- (int *scode, ONE_FORTSTRING_ARG);
-void CCTK_FCALL CCTK_FNAME (CCTK_StaggerDirIndex)
- (int *dsi, int *dir, int *gsi);
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerDirArray)
- (int *ierr, int *dindex, int *dim, int *gsc);
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerDirArrayGI)
- (int *ierr, int *dindex, int *dim, int *gi);
-void CCTK_FCALL CCTK_FNAME (CCTK_StaggerDirName)
- (int *dsc, int *dir, ONE_FORTSTRING_ARG);
-
-/********************************************************************
- ********************* External Routines **********************
- ********************************************************************/
-
-
- /*@@
- @routine CCTK_GroupStaggerIndexGI
- @date
- @author
- @desc retuns the stagger code for a given group index
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTK_GroupStaggerIndexGI(int gindex)
-{
- cGroup group;
- int sc;
- CCTK_GroupData(gindex, &group);
- sc = group.stagtype;
- return(sc);
-}
-
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerIndexGI)
- (int *stagcode, int *gindex)
-{
- *stagcode = CCTK_GroupStaggerIndexGI(*gindex);
-}
-
-
- /*@@
- @routine CCTK_GroupStaggerIndexGN
- @date
- @author Gerd Lanfermann
- @desc returns the stagger index for a given group name
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTK_GroupStaggerIndexGN(const char *gname)
-{
- int gindex;
- gindex = CCTK_GroupIndex(gname);
- return(CCTK_GroupStaggerIndexGI(gindex));
-}
-
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerIndexGN)
- (int *scode, ONE_FORTSTRING_ARG)
-{
- ONE_FORTSTRING_CREATE(gname)
- int gindex;
- gindex = CCTK_GroupIndex(gname);
- *scode = CCTK_GroupStaggerIndexGI(gindex);
- free(gname);
-}
-
-
- /*@@
- @routine CCTK_StaggerIndex
- @date
- @author Gerd Lanfermann
- @desc returns the stagger index for a given stagger name
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTK_StaggerIndex(const char *stype)
-{
- int i,scode,base,dim,m;
-
- base = 1;
- scode= 0;
- dim = strlen(stype);
-
- for (i=0;i<dim;i++)
- {
-
- switch (toupper(stype[i]))
- {
- case 'M':m=0; break;
- case 'C':m=1; break;
- case 'P':m=2; break;
- default:
- CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_StaggerIndex: Unknown stagger type %s",stype);
- return(-1);
- }
- scode+= m*base;
- base = CCTK_NUM_STAGGER * base;
- }
- return(scode);
-}
-
-void CCTK_FCALL CCTK_FNAME (CCTK_StaggerIndex)
- (int *scode, ONE_FORTSTRING_ARG)
-{
- ONE_FORTSTRING_CREATE(sname);
- *scode = CCTK_StaggerIndex(sname);
- free(sname);
-}
-
-
-/*@@
- @routine CCTK_StaggerDirIndex
- @date
- @author Gerd Lanfermann
- @desc returns the stagger index in a direction <dir>
- when given the staggerindex <sc>.
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTK_StaggerDirIndex(int dir, int si)
-{
- int val,b,dsi=0;
- static int hash[4],hashed=0;
-
- if (hashed==0)
- {
- hash[0]= 1;
- hash[1]= 3;
- hash[2]= 9;
- hash[3]=27;
- hashed = 1;
- }
-
- for (b=CCTK_NSTAG;b>=0;b--)
- {
- val = (int)(si / hash[b]);
- si = si % hash[b];
- if (dir==b)
- {
- dsi = val;
- break;
- }
- }
- return(dsi);
-}
-
-
-
-void CCTK_FCALL CCTK_FNAME (CCTK_StaggerDirIndex)
- (int *dsi, int *dir, int *gsi)
-{
- /* accept fortran indexing [1..]: decrease the directional index
- for the call to the C routine. */
- *dsi = CCTK_StaggerDirIndex((*dir)-1, *gsi);
-}
-
-
-
-/*@@
- @routine CCTK_StaggerDirIndexArray
- @date
- @author Gerd Lanfermann
- @desc returns the stagger index for all direction in
- an array <dindex> of size <dim> when given the staggerindex <sc>.
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTK_StaggerDirArray(int *dindex , int dim, int sindex)
-{
- int val,b;
- static int hash[4],hashed=0;
-
- if (hashed==0)
- {
- hash[0]= 1;
- hash[1]= 3;
- hash[2]= 9;
- hash[3]=27;
- hashed = 1;
- }
-
- if (dim>4)
- {
- CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_StaggerDirArray: Dimension %d exceeds maximum of 4",dim);
- return(-1);
- }
-
- for (b=CCTK_NSTAG;b>=0;b--)
- {
- val = (int)(sindex / hash[b]);
- sindex = sindex % hash[b];
- if (b<dim) dindex[b] = val;
- }
- return(0);
-}
-
-
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerDirArray)
- (int *ierr, int *dindex, int *dim, int *gsc)
-{
- /* accept fortran indexing [1..]: decrease the directional index
- for the call to the C routine. */
- *ierr = CCTK_StaggerDirArray(dindex, *dim, *gsc);
-}
-
- /*@@
- @routine CCTK_GroupStaggerDirArrayGI
- @date
- @author Gerd Lanfermann
- @desc returns the stagger index for all direction in
- an array <dindex> of size <dim> when given the group
- index <gi>
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTK_GroupStaggerDirArrayGI(int *dindex, int dim, int gi)
-{
- int si,ierr;
- si = CCTK_GroupStaggerIndexGI(gi);
- ierr= CCTK_StaggerDirArray(dindex, dim, si);
- return ierr;
-}
-
-void CCTK_FCALL CCTK_FNAME (CCTK_GroupStaggerDirArrayGI)
- (int *ierr, int *dindex, int *dim, int *gi)
-{
- *ierr = CCTK_GroupStaggerDirArrayGI(dindex, *dim, *gi);
-}
-
-
- /*@@
- @routine CCTK_StaggerDirName
- @date
- @author Gerd Lanfermann
- @desc returns the directional staggering in direction <dir>
- for a given stagger name <stype>.
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTK_StaggerDirName(int dir, const char *stype)
-{
- int scode;
- char hs[7]="MMMMMM";
-
- sprintf(hs,"%s",stype);
-
- if (dir> (int) strlen(hs))
- {
- CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_StaggerDirName: Stagger name too short for direction %d",
- dir);
- }
-
- switch (toupper(hs[dir]))
- {
- case 'M': scode = 0; break;
- case 'C': scode = 1; break;
- case 'P': scode = 2; break;
- default:
- CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTK_StaggerDirName: Unknown stagger type %s",hs);
- return(-1);
- }
- return(scode);
-}
-
-void CCTK_FCALL CCTK_FNAME (CCTK_StaggerDirName)
- (int *dsc, int *dir, ONE_FORTSTRING_ARG)
-{
- ONE_FORTSTRING_CREATE(sname);
-
- *dsc = CCTK_StaggerDirName((*dir)-1,sname);
-
- free(sname);
-}
-
-
-
-
-
-
- /*@@
- @routine CCTKi_ParseStaggerString
- @date
- @author Gerd Lanfermann
- @desc returns the stagger index for a string. Similar routines
- as CCTK_StaggerIndexName, but does more error checking since
- it is called during Group setup and if things go wrong, the used
- has a better idea where he specified wrong settings.
-
- @enddesc
- @calls
- @calledby
- @history
-
- @endhistory
-
-@@*/
-
-int CCTKi_ParseStaggerString(int dim,
- const char *imp,
- const char *gname,
- const char *stype)
-{
- int i,m;
- int base = 1;
- int scode = 0;
- char hs[11];
-
- if (dim>10)
- {
- CCTK_VWarn(0,__LINE__,__FILE__,"Cactus",
- "CCTKi_ParseStaggerString: Dimension %d exceeds maximum of 10",
- dim);
- }
-
- /* change possible SHORTCUTS into the official notation*/
- if (CCTK_Equals(stype,"NONE"))
- {
- sprintf(hs,"MMMMMMMMMM");
- }
- else if (CCTK_Equals(stype,"CELL"))
- {
- sprintf(hs,"CCCCCCCCCC");
- }
- else
- {
- if ((int) strlen(stype)!=dim)
- {
- CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTKi_ParseStaggerString: Staggering %s for %s unequal to group dimension %d",
- stype,gname,dim);
- }
-
- sprintf(hs,"%s",stype);
- }
-
- for (i=0;i<dim;i++)
- {
- switch (toupper(hs[i]))
- {
- case 'M':m=0; break;
- case 'C':m=1; break;
- case 'P':m=2; break;
- default:
- CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
- "CCTKi_ParseStaggerString: Unknown stagger type %s for %s::%s",
- stype,imp,gname);
- return(-1);
- }
- scode+= m*base;
- base = 3 * base;
- }
-
- return scode;
-}
diff --git a/src/main/make.code.defn b/src/main/make.code.defn
index d6bfe986..756fc564 100644
--- a/src/main/make.code.defn
+++ b/src/main/make.code.defn
@@ -35,7 +35,6 @@ ScheduleInterface.c\
SetParams.c\
SetupCache.c\
ShutdownCactus.c\
-Stagger.c\
Subsystems.c\
Termination.c\
Traverse.c\