summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ReferenceManual/CCTKReference.tex227
-rw-r--r--src/include/cctk_GroupsOnGH.h7
-rw-r--r--src/main/GroupsOnGH.c194
3 files changed, 417 insertions, 11 deletions
diff --git a/doc/ReferenceManual/CCTKReference.tex b/doc/ReferenceManual/CCTKReference.tex
index e1b86845..8605a206 100644
--- a/doc/ReferenceManual/CCTKReference.tex
+++ b/doc/ReferenceManual/CCTKReference.tex
@@ -332,6 +332,22 @@ from Fortran.
Given a variable name, return an array of the local size
of the variable in each dimension
+\item[\code{CCTK\_GrouplsshGI}] [\pageref{CCTK-GrouplsshGI}]
+ Given a group index, return an array of the local stagger size
+ of the group in each dimension
+
+\item[\code{CCTK\_GrouplsshGN}] [\pageref{CCTK-GrouplsshGN}]
+ Given a group name, return an array of the local stagger size
+ of the group in each dimension
+
+\item[\code{CCTK\_GrouplsshVI}] [\pageref{CCTK-GrouplsshVI}]
+ Given a variable index, return an array of the local stagger size
+ of the variable in each dimension
+
+\item[\code{CCTK\_GrouplsshVN}] [\pageref{CCTK-GrouplsshVN}]
+ Given a variable name, return an array of the local stagger size
+ of the variable in each dimension
+
\item[\code{CCTK\_GroupName}] [\pageref{CCTK-GroupName}]
Given a group index, returns the group name
@@ -3956,16 +3972,20 @@ a pointer to a caller-supplied data structure to store the group data
\begin{Discussion}
This function returns information about the given grid hierarchy.
The data structure used to store the information in is of type cGroupDynamicData.
-The members of this structure that are set are :
+The members of this structure that are set are:
\begin{itemize}
-\item{dim:} The number of dimensions in this grid hierarchy.
-\item {lsh:} The local(on this processor) size.
+\item{dim:} The number of dimensions in this group.
+\item{lsh:} The (process-)local size.
+\item{lssh:} The (process-)local stagger size.
\item{gsh:} The global grid size.
-\item{lbnd:} An array of integers containing the lowest index of the local grid as seen on the global grid.(These use zero based indexing)
-\item{ubnd:} An arry of integers containing the largest index of the local grid as seen on the global grid.(These use zero based indexing)
-\item{nghostzones:} An array of integers with the number of ghostzones for each dimension.
-\item{bbox:} An array of integers containing which indicate whether the boundaries are internal(e.g. artificial boundaries between processors) or actual physical boundaries. A value of 1 indicates an actual physical boundary while a 0 indicates an internal one.
-\item{activetimelevels:}An array of which time levels this grid hierarchy is active.
+\item{lbnd:} The lowest index of the local grid as seen on the global
+ grid. (These use zero based indexing.)
+\item{ubnd:} The largest index of the local grid as seen on the global
+ grid. (These use zero based indexing.)
+\item{nghostzones:} The number of ghostzones for each dimension.
+\item{bbox:} Values indicating whether these are inter-process
+ boundaries (0) or physical boundaries (1).
+\item{activetimelevels:} The number of active time levels.
\end{itemize}-
\end{Discussion}
@@ -4083,6 +4103,12 @@ Returns the local size for a given group.
\begin{SeeAlso}{CCTK\_GrouplshVI, CCTK\_GrouplshVN}
Returns the local size for a given variable.
\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshGI, CCTK\_GrouplsshGN}
+Returns the local stagger size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshVI, CCTK\_GrouplsshVN}
+Returns the local stagger size for a given variable.
+\end{SeeAlso}
\end{SeeAlsoSection}
\end{FunctionDescription}
@@ -4156,6 +4182,12 @@ Returns the local size for a given group.
\begin{SeeAlso}{CCTK\_GrouplshVI, CCTK\_GrouplshVN}
Returns the local size for a given variable.
\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshGI, CCTK\_GrouplsshGN}
+Returns the local size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshVI, CCTK\_GrouplsshVN}
+Returns the local size for a given variable.
+\end{SeeAlso}
\end{SeeAlsoSection}
\end{FunctionDescription}
@@ -4483,15 +4515,21 @@ The local size in each dimension for a given group is returned in a user-supplie
\end{Discussion}
\begin{SeeAlsoSection}
+\begin{SeeAlso}{CCTK\_GroupgshGI, CCTK\_GroupgshGN}
+Returns the global size for a given group.
+\end{SeeAlso}
\begin{SeeAlso}{CCTK\_GroupgshVI, CCTK\_GroupgshVN}
Returns the global size for a given variable.
\end{SeeAlso}
-\begin{SeeAlso}{CCTK\_GrouplshGI, CCTK\_GrouplshGN}
-Returns the local size for a given group.
-\end{SeeAlso}
\begin{SeeAlso}{CCTK\_GrouplshVI, CCTK\_GrouplshVN}
Returns the local size for a given variable.
\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshGI, CCTK\_GrouplsshGN}
+Returns the local stagger size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshVI, CCTK\_GrouplsshVN}
+Returns the local stagger size for a given variable.
+\end{SeeAlso}
\end{SeeAlsoSection}
\end{FunctionDescription}
@@ -4565,6 +4603,173 @@ Returns the global size for a given variable.
\begin{SeeAlso}{CCTK\_GrouplshGI, CCTK\_GrouplshGN}
Returns the local size for a given group.
\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshGI, CCTK\_GrouplsshGN}
+Returns the local stagger size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshVI, CCTK\_GrouplsshVN}
+Returns the local stagger size for a given variable.
+\end{SeeAlso}
+\end{SeeAlsoSection}
+\end{FunctionDescription}
+
+
+%Entering a function description for CCTK\_GrouplsshGI, CCTK\_GrouplsshGN
+\begin{FunctionDescription}{CCTK\_GrouplsshGI, CCTK\_GrouplsshGN}
+\label{CCTK-GrouplsshGI}
+\label{CCTK-GrouplsshGN}
+Given a group index or name, return an array of the local stagger size
+of the group in each dimension for each stagger type
+
+\begin{SynopsisSection}
+\begin{Synopsis}{C}
+\begin{verbatim}
+#include "cctk.h"
+
+int status = CCTK_GrouplsshGI(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ int groupindex);
+
+int status = CCTK_GrouplsshGN(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ const char *groupname);
+\end{verbatim}
+\end{Synopsis}
+\begin{Synopsis}{Fortran}
+\begin{verbatim}
+call CCTK_GrouplsshGI(status, cctkGH, size, lssh, groupindex)
+
+call CCTK_GrouplsshGN(status, cctkGH, size, lssh, groupname)
+
+integer status
+CCTK_POINTER cctkGH
+integer size
+integer lssh(size)
+integer groupindex
+character*(*) groupname
+\end{verbatim}
+\end{Synopsis}
+\end{SynopsisSection}
+
+\begin{ResultSection}
+\begin{Result}{0} success \end{Result}
+\begin{Result}{-1} incorrect dimension supplied \end{Result}
+\begin{Result}{-2} data not available from driver \end{Result}
+\begin{Result}{-3} called on a scalar group \end{Result}
+\begin{Result}{-4} invalid group name \end{Result}
+\end{ResultSection}
+
+\begin{ParameterSection}
+\begin{Parameter}{cctkGH ($\ne$ NULL)} Pointer to a valid Cactus grid hierarchy. \end{Parameter}
+\begin{Parameter}{size ($\ge 1$)} Size of output array, should be at
+least CCTK_NSTAGGER * dimensions of group. \end{Parameter}
+\begin{Parameter}{lssh ($\ne$ NULL)} Pointer to array which will hold the return values. \end{Parameter}
+\begin{Parameter}{groupindex} Index of the group. \end{Parameter}
+\begin{Parameter}{groupname} Name of the group. \end{Parameter}
+\end{ParameterSection}
+
+\begin{Discussion}
+The local stagger size in each dimension for each stagger type for a given group is returned in a user-supplied array buffer.
+\end{Discussion}
+
+\begin{SeeAlsoSection}
+\begin{SeeAlso}{CCTK\_GroupgshGI, CCTK\_GroupgshGN}
+Returns the global size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GroupgshVI, CCTK\_GroupgshVN}
+Returns the global size for a given variable.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplshGI, CCTK\_GrouplshGN}
+Returns the local size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplshVI, CCTK\_GrouplshVN}
+Returns the local size for a given variable.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshVI, CCTK\_GrouplsshVN}
+Returns the local stagger size for a given variable.
+\end{SeeAlso}
+\end{SeeAlsoSection}
+\end{FunctionDescription}
+
+
+%Entering a function description for CCTK\_GrouplsshVI, CCTK\_GrouplsshVN
+\begin{FunctionDescription}{CCTK\_GrouplsshVI, CCTK\_GrouplsshVN}
+\label{CCTK-GrouplsshVI}
+\label{CCTK-GrouplsshVN}
+Given a variable index or its full name, return an array of the local
+stagger size of the variable in each dimension for each stagger type
+
+\begin{SynopsisSection}
+\begin{Synopsis}{C}
+\begin{verbatim}
+#include "cctk.h"
+
+int status = CCTK_GrouplsshVI(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ int varindex);
+
+int status = CCTK_GrouplsshVN(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ const char *varname);
+\end{verbatim}
+\end{Synopsis}
+\begin{Synopsis}{Fortran}
+\begin{verbatim}
+call CCTK_GrouplsshVI(status, cctkGH, size, lssh, varindex)
+
+call CCTK_GrouplsshVN(status, cctkGH, size, lssh, varname)
+
+integer status
+CCTK_POINTER cctkGH
+integer size
+integer lssh(size)
+integer varindex
+character*(*) varname
+\end{verbatim}
+\end{Synopsis}
+\end{SynopsisSection}
+
+\begin{ResultSection}
+\begin{Result}{0} success \end{Result}
+\begin{Result}{-1} incorrect dimension supplied \end{Result}
+\begin{Result}{-2} data not available from driver \end{Result}
+\begin{Result}{-3} called on a scalar group \end{Result}
+\begin{Result}{-4} invalid variable index \end{Result}
+\end{ResultSection}
+
+\begin{ParameterSection}
+\begin{Parameter}{status} Return value. \end{Parameter}
+\begin{Parameter}{cctkGH ($\ne$ NULL)} Pointer to a valid Cactus grid hierarchy. \end{Parameter}
+\begin{Parameter}{size ($\ge 1$)} Size of output array, should be at
+least CCTK_NSTAGGER * dimensions of group. \end{Parameter}
+\begin{Parameter}{lssh ($\ne$ NULL)} Pointer to array which will hold the return values. \end{Parameter}
+\begin{Parameter}{varindex} Variable index. \end{Parameter}
+\begin{Parameter}{varname} Variable's full name. \end{Parameter}
+\end{ParameterSection}
+
+\begin{Discussion}
+The local stagger size in each dimension for each stagger type for a given variable is returned in a user-supplied array buffer.
+\end{Discussion}
+
+\begin{SeeAlsoSection}
+\begin{SeeAlso}{CCTK\_GroupgshGI, CCTK\_GroupgshGN}
+Returns the global size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GroupgshVI, CCTK\_GroupgshVN}
+Returns the global size for a given variable.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplshGI, CCTK\_GrouplshGN}
+Returns the local size for a given group.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplshVI, CCTK\_GrouplshVN}
+Returns the local size for a given variable.
+\end{SeeAlso}
+\begin{SeeAlso}{CCTK\_GrouplsshGI, CCTK\_GrouplsshGN}
+Returns the local stagger size for a given group.
+\end{SeeAlso}
\end{SeeAlsoSection}
\end{FunctionDescription}
diff --git a/src/include/cctk_GroupsOnGH.h b/src/include/cctk_GroupsOnGH.h
index 7db63b3f..e2e38c96 100644
--- a/src/include/cctk_GroupsOnGH.h
+++ b/src/include/cctk_GroupsOnGH.h
@@ -18,6 +18,8 @@ typedef struct GROUPDYNAMICDATA
const int *lsh;
const int *lbnd;
const int *ubnd;
+#define CCTK_GROUPDYNAMICDATA_HAS_LSSH
+ const int *lssh;
const int *bbox;
const int *nghostzones;
int activetimelevels;
@@ -53,6 +55,11 @@ int CCTK_GrouplshVN(const cGH *GH, int dim, int *lsh, const char *varname);
int CCTK_GrouplshGI(const cGH *GH, int dim, int *lsh, int groupindex);
int CCTK_GrouplshVI(const cGH *GH, int dim, int *lsh, int varindex);
+int CCTK_GrouplsshGN(const cGH *GH, int dim, int *lssh, const char *groupname);
+int CCTK_GrouplsshVN(const cGH *GH, int dim, int *lssh, const char *varname);
+int CCTK_GrouplsshGI(const cGH *GH, int dim, int *lssh, int groupindex);
+int CCTK_GrouplsshVI(const cGH *GH, int dim, int *lssh, int varindex);
+
int CCTK_GroupgshGN(const cGH *GH, int dim, int *gsh, const char *groupname);
int CCTK_GroupgshVN(const cGH *GH, int dim, int *gsh, const char *varname);
int CCTK_GroupgshGI(const cGH *GH, int dim, int *gsh, int groupindex);
diff --git a/src/main/GroupsOnGH.c b/src/main/GroupsOnGH.c
index 1269ba0d..5dc3dbd1 100644
--- a/src/main/GroupsOnGH.c
+++ b/src/main/GroupsOnGH.c
@@ -13,6 +13,7 @@
#include <string.h>
#include "cctk_Comm.h"
+#include "cctk_Constants.h"
#include "cctk_Flesh.h"
#include "cctk_FortranString.h"
#include "cctk_Groups.h"
@@ -108,6 +109,30 @@ void CCTK_FCALL CCTK_FNAME (CCTK_GrouplshVN)
const int *dim,
int *lsh,
ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGI)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *dim,
+ int *lssh,
+ const int *groupindex);
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGN)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *dim,
+ int *lssh,
+ ONE_FORTSTRING_ARG);
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVI)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *dim,
+ int *lssh,
+ const int *varindex);
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVN)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *dim,
+ int *lssh,
+ ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_GroupgshGI)
(int *ierr,
const cGH **cctkGH,
@@ -1201,6 +1226,174 @@ void CCTK_FCALL CCTK_FNAME (CCTK_GrouplshVN)
/********************************************************************
+ ******************** Group local stagger shape ***************
+ ********************************************************************/
+
+ /*@@
+ @routine CCTK_GrouplsshGI
+ @date 2011-03-16
+ @author Erik Schnetter
+ @desc
+ Returns the lssh for a variable group
+ @enddesc
+@@*/
+int CCTK_GrouplsshGI(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ int groupindex)
+{
+ int retval = 0;
+ int ierr;
+ int usesize = size; /* Actual number of integers copied */
+ char *groupname;
+ cGroupDynamicData data;
+
+ ierr = CCTK_GroupDynamicData(cctkGH,groupindex,&data);
+
+ if (ierr == 0 && (data.dim == 0 || data.lssh))
+ {
+ if (CCTK_NSTAGGER*data.dim != size)
+ {
+ retval = -1;
+ usesize = (CCTK_NSTAGGER*data.dim < size) ? CCTK_NSTAGGER*data.dim : size;
+ groupname = CCTK_GroupName (groupindex);
+ CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
+ "CCTK_GrouplsshGI: 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));
+ }
+ else
+ {
+ retval = -2;
+ CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
+ "CCTK_GrouplsshGI: Data not available from driver thorn");
+ }
+ return retval;
+}
+
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGI)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *size,
+ int *lssh,
+ const int *groupindex)
+{
+ *ierr = CCTK_GrouplsshGI (*cctkGH, *size, lssh, *groupindex);
+}
+
+
+
+int CCTK_GrouplsshGN(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ const char *groupname)
+{
+ int retval;
+ int gindex = CCTK_GroupIndex(groupname);
+
+ if (gindex > -1)
+ {
+ retval = CCTK_GrouplsshGI(cctkGH,size,lssh,gindex);
+ }
+ else
+ {
+ retval = -4;
+ CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
+ "CCTK_GrouplsshGN: Group index not found for %s",groupname);
+ }
+
+ return retval;
+}
+
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshGN)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *size,
+ int *lssh,
+ ONE_FORTSTRING_ARG)
+{
+ ONE_FORTSTRING_CREATE (groupname)
+ *ierr = CCTK_GrouplsshGN (*cctkGH, *size, lssh, groupname);
+ free (groupname);
+}
+
+
+
+int CCTK_GrouplsshVI(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ int varindex)
+{
+ int retval;
+ int gindex = CCTK_GroupIndexFromVarI(varindex);
+
+ if (gindex > -1)
+ {
+ retval = CCTK_GrouplsshGI(cctkGH,size,lssh,gindex);
+ }
+ else
+ {
+ retval = -4;
+ CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
+ "CCTK_GrouplsshVI: Group index not found for variable index %d",
+ varindex);
+ }
+
+ return retval;
+}
+
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVI)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *size,
+ int *lssh,
+ const int *varindex)
+{
+ *ierr = CCTK_GrouplsshVI (*cctkGH, *size, lssh, *varindex);
+}
+
+
+
+int CCTK_GrouplsshVN(const cGH *cctkGH,
+ int size,
+ int *lssh,
+ const char *varname)
+{
+ int retval;
+ int gindex = CCTK_GroupIndexFromVar(varname);
+
+ if (gindex > -1)
+ {
+ retval = CCTK_GrouplsshGI(cctkGH,size,lssh,gindex);
+ }
+ else
+ {
+ retval = -4;
+ CCTK_VWarn(1,__LINE__,__FILE__,"Cactus",
+ "CCTK_GrouplsshVN: Group index not found for %s",varname);
+ }
+
+ return retval;
+}
+
+void CCTK_FCALL CCTK_FNAME (CCTK_GrouplsshVN)
+ (int *ierr,
+ const cGH **cctkGH,
+ const int *size,
+ int *lssh,
+ ONE_FORTSTRING_ARG)
+{
+ ONE_FORTSTRING_CREATE (varname)
+ *ierr = CCTK_GrouplsshVN (*cctkGH, *size, lssh, varname);
+ free (varname);
+}
+
+
+
+/********************************************************************
******************* Group Global Shape ***********************
********************************************************************/
@@ -1535,6 +1728,7 @@ void CCTK_FCALL CCTK_FNAME (CCTK_GroupnghostzonesVN)
}
+
/********************************************************************
******************** Group bbox ***********************
********************************************************************/