/*@@ @file GroupsOnGH.c @date Tues April 6 @author Gabrielle Allen @desc GH specific Routines to deal with groups. @enddesc @@*/ #include #include #include #include #include "flesh.h" #include "Misc.h" #include "Groups.h" #include "WarnLevel.h" #include "GroupsOnGH.h" /*#define DEBUG_GROUPS*/ static char *rcsid = "$Header$"; /*@@ @routine CCTK_VarDataPtr @date Tue 6th April 1999 @author Gabrielle Allen @desc Passes back a variable data pointer, given a full name and timelevel @enddesc @calls @history @endhistory @var GH @vdesc Pointer to Grid Hierachy @vtype cGH * @vio in @vcomment @endvar @var fullvarname @vdesc Full name of the grid variable @vtype char * @vio in @vcomment Format :: @endvar @var timelevel @vdesc Index of timelevel on which data is required @vtype int @vio in @vcomment @endvar @returntype void * @returndesc Pointer to the required data, should be cast to required type @endreturndesc @version $Header$ @@*/ void *CCTK_VarDataPtr(cGH *GH, int timelevel, char *fullvarname) { int index; void *retval=NULL; index = CCTK_VarIndex(fullvarname); if (index >= 0) { retval = GH->data[index][timelevel]; } else CCTK_WARN(1,"Invalid index in CCTK_VarDataPtr"); #ifdef DEBUG_GROUPS CCTK_PRINTSEPARATOR printf("In CCTK_VarDataPtr\n----------------------------\n"); printf(" Data pointer for %s (%d) is %x\n",fullvarname,index,retval); CCTK_PRINTSEPARATOR #endif return retval; } /*@@ @routine CCTK_VarDataPtrI @date Tue 6th April 1999 @author Gabrielle Allen @desc Passes back a variable data pointer, given a variable index and timelevel @enddesc @calls @history @endhistory @var GH @vdesc Pointer to Grid Hierachy @vtype cGH * @vio in @vcomment @endvar @var varindex @vdesc Index of grid variable @vtype int @vio in @vcomment Assumed to be in correct range @endvar @var timelevel @vdesc Index of timelevel on which data is required @vtype int @vio in @vcomment @endvar @returntype void * @returndesc Pointer to the required data, should be cast to required type @endreturndesc @version $Header$ @@*/ void *CCTK_VarDataPtrI(cGH *GH, int timelevel, int varindex) { return GH->data[varindex][timelevel]; } /*@@ @routine CCTK_VarDataPtrB @date Tue 6th April 1999 @author Gabrielle Allen @desc Passes back a variable data pointer, given either a variable index or a full name and timelevel @enddesc @calls @history @endhistory @var GH @vdesc Pointer to Grid Hierachy @vtype cGH * @vio in @vcomment @endvar @var varindex @vdesc Index of grid variable @vtype int @vio in @vcomment Assumed to be in correct range @endvar @var fullvarname @vdesc Full name of the grid variable @vtype char * @vio in @vcomment Format :: @endvar @var timelevel @vdesc Index of timelevel on which data is required @vtype int @vio in @vcomment @endvar @returntype void * @returndesc Pointer to the required data, should be cast to required type @endreturndesc @version $Header$ @@*/ void *CCTK_VarDataPtrB(cGH *GH, int timelevel, int varindex, char *fullvarname) { if (fullvarname) { return CCTK_VarDataPtr(GH, timelevel, fullvarname); } else { return CCTK_VarDataPtrI(GH, timelevel, varindex); } }