\begin{cactuspart}{4}{FunctionReference}{$RCSfile$}{$Revision$}
\renewcommand{\thepage}{\Alph{part}\arabic{page}}

\chapter{Cactus Functions}

In this section all Cactus functions are described. These functions are
callable from Fortran or C thorns. Note that whereas all functions are
available from C, not all are currently available from Fortran.

\section{Functions Alphabetically}

\begin{Lentry}

\item[CCTK\_Abort] 
  [\pageref{Abort}] 

\item[CCTK\_ArrayGroupSize] 
  [\pageref{ArrayGroupSize}]
  Give the size of the variables in a group, from the name

\item[CCTK\_ArrayGroupSizeB] 
  [\pageref{ArrayGroupSizeB}] 
  Give the size of the variables in a group, from either the name of the index

\item[CCTK\_ArrayGroupSizeI] 
  [\pageref{ArrayGroupSizeI}] 
  Give the size of the variables in a group, from the group index

\item[CCTK\_Barrier]
  [\pageref{Barrier}] 

\item[CCTK\_Cmplx]
  [\pageref{Cmplx}]
  Turns two real numbers into a complex number (only C)

\item[CCTK\_CmplxAbs]
  [\pageref{CmplxAbs}]
  Returns the absolute value of a complex number (only C)

\item[CCTK\_CmplxAdd]
  [\pageref{CmplxAdd}]
  Returns the sum of two complex numbers (only C)

\item[CCTK\_CmplxConjg]
  [\pageref{CmplxConjg}]
  Returns the complex conjugate of a complex number (only C)

\item[CCTK\_CmplxCos]
  [\pageref{CmplxCos}]
  Returns the Cosine of a complex number (only C) [not yet available]

\item[CCTK\_CmplxDiv]
  [\pageref{CmplxDiv}]
  Returns the division of two complex numbers (only C)

\item[CCTK\_CmplxExp]
  [\pageref{CmplxExp}]
  Returns the Exponentiation of a complex number (only C) [not yet available]

\item[CCTK\_CmplxImag]
  [\pageref{CmplxReal}]
  Returns the imaginary part of a complex number (only C)

\item[CCTK\_CmplxLog]
  [\pageref{CmplxLog}]
  Returns the Logarithm of a complex number (only C) [not yet available]

\item[CCTK\_CmplxMul]
  [\pageref{CmplxMul}]
  Returns the multiplication of two complex numbers (only C)

\item[CCTK\_CmplxReal]
  [\pageref{CmplxReal}]
  Returns the real part of a complex number (only C)

\item[CCTK\_CmplxSin]
  [\pageref{CmplxSin}]
  Returns the Sine of a complex number (only C) [not yet available]

\item[CCTK\_CmplxSub]
  [\pageref{CmplxSub}]
  Returns the subtraction of two complex numbers (only C)

\item[CCTK\_CmplxSqrt]
  [\pageref{CmplxSqrt}]
  Returns the square root of a complex number (only C) [not yet available]

\item[CCTK\_CoordIndex] 
  [\pageref{CoordIndex}] 
  Give the GF index for a given coordinate name.

\item[CCTK\_CoordRange] 
  [\pageref{CoordRange}] 
  Return the global upper and lower bounds for a given coordinate name

\item[CCTK\_DecomposeName] 
  [\pageref{DecomposeName}] 
  Given the full name of a variable/group, separates the name returning both the implementation and the variable/group

\item[CCTK\_DisableGroupComm] 
  [\pageref{DisableGroupComm}] 
  Disable the communication for a group

\item[CCTK\_DisableGroupStorage] 
  [\pageref{DisableGroupStorage}] 
  Disable the storage for a group

\item[CCTK\_EnableGroupComm] 
  [\pageref{EnableGroupComm}] 
  Enable the communication for a group

\item[CCTK\_EnableGroupStorage] 
  [\pageref{EnableGroupStorage}] 
  Enable the storage for a group

\item[CCTK\_Equals] 
  [\pageref{Equals}] 
  Check for equality of strings

\item[CCTK\_Exit]
  [\pageref{Equals}] 


\item[CCTK\_FirstVarIndex]   
  [\pageref{FirstVarIndex}] 
  Given a group name returns the first variable index in the group

\item[CCTK\_FirstVarIndexI]   
  [\pageref{FirstVarIndexI}] 
  Given a group index returns the first variable index in the group

\item[CCTK\_FortranString]
  [\pageref{FortranString}]
  Changes a C string into a Fortran string

\item[CCTK\_FullName] 
  [\pageref{FullName}] 
  Given a variable index, returns the full name of the variable

\item[CCTK\_GroupData]   
  [\pageref{GroupData}] 
  Given a group index, returns information about the variables held in the group

\item[CCTK\_GHExtensionHandle]   
  [\pageref{GHExtensionHandle}] 
  Get the handle associated with a extension to the Cactus GH structure

\item[CCTK\_GroupIndex]   
  [\pageref{GroupIndex}] 
  Get the index number for a group name

\item[CCTK\_GroupIndexFromVar]   
  [\pageref{GroupIndexFromVar}] 
  Given a variable name, returns the index of the associated group

\item[CCTK\_GroupIndexFromVarI]   
  [\pageref{GroupIndexFromVarI}] 
  Given a variable index, returns the index of the associated group

\item[CCTK\_GroupName]   
  [\pageref{GroupName}] 
  Given a group index, returns the group name

\item[CCTK\_GroupNameFromVarI]   
  [\pageref{GroupNameFromVarI}] 
  Given a variable index, return the name of the associated group

\item[CCTK\_GroupTypeFromVarI]   
  [\pageref{GroupTypeFromVarI}] 
  Provides group type index from the group index

\item[CCTK\_ImpFromVarI]   
  [\pageref{ImpFromVarI}] 
  Given a variable index, returns the implementation name

\item[CCTK\_INFO]   
  [\pageref{INFO}] 
  Prints an information message
         
\item[CCTK\_MaxDim]   
  [\pageref{MaxDim}] 
  Get the maximum dimension of any grid variable 

\item[CCTK\_MyProc]   
  [\pageref{MyProc}] 
  Get the local processor number

\item[CCTK\_NumGroups]   
  [\pageref{NumGroups}] 
  Get the number of groups of variables compiled in the code

\item[CCTK\_NumTimeLevelsFromVarI]   
  [\pageref{NumTimeLevelsFromVarI}] 
  Gives the number of timelevels for a variable

\item[CCTK\_NumTimeLevelsFromVar]   
  [\pageref{NumTimeLevelsFromVar}] 
  Gives the number of timelevels for a variable

\item[CCTK\_NumVars]   
  [\pageref{NumVars}] 
  Get the number of grid variables compiled in the code

\item[CCTK\_NumVarsInGroupI]   
  [\pageref{NumVarsInGroupI}] 
  Provides the number of variables in a group from the group index

\item[CCTK\_NumVarsInGroup]   
  [\pageref{NumVarsInGroup}] 
  Provides the number of variables in a group from the group name

\item[CCTK\_nProcs]    
  [\pageref{nProcs}] 
  Get the total number of processors used

\item[CCTK\_OutputVarAsByMethod] 
  [\pageref{OutputVarAsByMethod}] 

\item[CCTK\_OutputGH] 
  [\pageref{OutputGH}] 

\item[CCTK\_ParallelInit] 
  [\pageref{ParallelInit}] 

\item[CCTK\_PARAMWARN] 
  [\pageref{PARAMWARN}] 
  Prints a warning from parameter checking, and possibly stops the code

\item[CCTK\_PrintGroup] 
  [\pageref{PrintGroup}] 
  Prints a group name from its index

\item[CCTK\_PrintVar] 
  [\pageref{PrintVar}] 
  Prints a variable name from its index

\item[CCTK\_QueryGroupStorage] 
  [\pageref{QueryGroupStorage}] 

\item[CCTK\_QueryGroupStorageI] 
  [\pageref{QueryGroupStorageI}] 

\item[CCTK\_Reduce] 
  [\pageref{Reduce}] 
  Perform a reduction operation using a registered operator

\item[CCTK\_ReductionHandle] 
  [\pageref{ReductionHandle}] 
  Get the handle for a registered reduction operator

\item[CCTK\_RegisterBanner] 
  [\pageref{RegisterBanner}] 
  Register a banner for a thorn

\item[CCTK\_RegisterCoord] 
  [\pageref{RegisterCoord}] 
  Register a grid function name as identifying a coordinate with a given coordinate name and direction.

\item[CCTK\_RegisterCoordI] 
  [\pageref{RegisterCoordI}] 
  Register a grid function index as identifying a coordinate with a given coordinate name and direction.

\item[CCTK\_RegisterCoordRange] 
  [\pageref{RegisterCoordRange}] 
  Saves the global upper and lower bounds for a given coordinate name

\item[CCTK\_RegisterGHExtension] 
  [\pageref{RegisterGHExtension}] 
  Register the name of an extension to the Cactus GH.

\item[CCTK\_RegisterGHExtensionInitGH] 
  [\pageref{RegisterGHExtensionInitGH}] 
  Register a routine for providing initialisation for an extension to the Cactus GH

\item[CCTK\_RegisterGHExtensionSetupGH]  
  [\pageref{RegisterGHExtensionSetupGH}] 
  Register a routine for setting up an extension to the Cactus GH

\item[CCTK\_RegisterGHExtensionrfrTraverseGH] 
  [\pageref{RegisterGHExtensionrfrTraverseGH}] 
  Register a routine for an extension to the Cactus GH which is run before any RFR traverse

\item[CCTK\_RegisterIOMethod] 
  [\pageref{RegisterIOMethod}] 
  Register an IO method name

\item[CCTK\_RegisterIOMethodOutputGH] 
  [\pageref{RegisterIOMethodOutputGH}] 

\item[CCTK\_RegisterIOMethodOutputVarAs] 
  [\pageref{RegisterIOMethodOutputVarAs}] 

\item[CCTK\_RegisterIOMethodTimeToOutput] 
  [\pageref{RegisterIOMethodTimeToOutput}] 
  Register a routine for deciding if it is time to output for an IO method 

\item[CCTK\_RegisterIOMethodTriggerOutput] 
  [\pageref{RegisterIOMethodTriggerOutput}] 
  Register a routine for dealing with trigger output for an IO method

\item[CCTK\_RegisterReductionOperator] 
  [\pageref{RegisterReductionOperator}] 
  Register a function as providing a reduction operation

\item[CCTK\_SetupGH] 
  [\pageref{SetupGH}] 

\item[CCTK\_SyncGroup] 
  [\pageref{SyncGroup}] 
  Synchronize the ghost zones for a group of variables

\item[CCTK\_VarDataPtr]
  [\pageref{VarDataPtr}] 
  Returns the data pointer for a grid variable

\item[CCTK\_VarDataPtrB]
  [\pageref{VarDataPtrB}] 
  Returns the data pointer for a grid variable from the variable index or name

\item[CCTK\_VarDataPtrI]
  [\pageref{VarDataPtrI}] 
  Returns the data pointer for a grid variable from the variable index

\item[CCTK\_VarIndex]
   [\pageref{VarIndex}] 
  Get the index for a variable

\item[CCTK\_VarName] 
  [\pageref{VarName}] 
  Given a variable index, returns the variable name

\item[CCTK\_VarTypeI] 
  [\pageref{VarTypeI}] 
  Provides variable type index from the variable index

\item[CCTK\_WARN] 
  [\pageref{WARN}] 
  Prints a warning message and possibly stops the code

\end{Lentry}


\section{Full Description of Functions}

%%%%%
% AAA
%%%%%


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_Abort}{Exit the code abruptly}
\label{Abort}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% cctk_Comm.h
\begin{CCTKFunc}{CCTK\_ArrayGroupSize}{}
\label{ArrayGroupSize}
\subroutine{int *}{}{size}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{groupindex}
\argument{int}{}{dir}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% cctk_Comm.h
\begin{CCTKFunc}{CCTK\_ArrayGroupSize}{}
\label{ArrayGroupSize}
\subroutine{int *}{}{size}
\argument{cGH *}{}{cctkGH}
\argument{const char *}{}{groupname}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_ArrayGroupSizeB}{}
\label{ArrayGroupSizeB}
\subroutine{int *}{}{size}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{groupindex}
\argument{int}{}{dir}
\argument{const char *}{}{groupname}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_ArrayGroupSizeI}{}
\label{ArrayGroupSizeI}
\subroutine{int *}{}{size}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{dir}
\argument{int}{}{index}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{dir}{coordinate direction}
\parameter{index}{group index}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

%%%%%
% BBB
%%%%%


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_Barrier}{}
\label{Barrier}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


%%%%%
% CCC
%%%%%



% Coord.c
\begin{CCTKFunc}{CCTK\_CoordIndex}{Give the GF index for a given coordinate name.}
\label{CoordIndex}
\subroutine{int}{integer}{index}
\argument{const char *}{character*(*)}{coordname}
\showargs
\begin{params}
\parameter{index}{The coordinates associated GF index}
\parameter{coordname}{The name assigned to this coordinate}
\end{params}
\begin{discussion}
The coordinate name is independent of the grid function name. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_CoordIndex(`xdir')};
\\
\hfill {\bf Fortran} && {\t call  CCTK\_COORDINDEX(`radius')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Coord.c
\begin{CCTKFunc}{CCTK\_CoordRange}{Return the global upper and lower bounds for a given coordinate name}
\label{CoordRange}
\subroutine{int}{integer}{ierr}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{CCTK\_REAL}{CCTK\_REAL}{lower}
\argument{CCTK\_REAL}{CCTK\_REAL}{upper}
\argument{const char *}{character*(*)}{coordname}
\showargs
\begin{params}
\parameter{ierr}{Error code}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{lower}{Global lower bound of the coordinate (POINTER in C)}
\parameter{upper}{Global upper bound of the coordinate (POINTER in C)}
\parameter{coordname}{Coordinate name}
\end{params}
\begin{discussion}
The coordinate name is independent of the grid function name. The coordinate range
is registered by {\t CCTK\_RegisterCoordRange}.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t ierr = CCTK\_CoordRange(cctkGH,*xmin,*xmax,`xdir') };
\\
\hfill {\bf Fortran} && {\t call CCTK\_COORDRANGE(ierr,cctkGH,Rmin,Rmax,`radius')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


%%%%%
% DDD
%%%%%


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_DisableGroupComm}{Turn communications off for a group of grid variables}
\label{DisableGroupComm}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{const char *}{character*(*)}{group}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
Turning off communications means that ghost zones will not be communicated during a call to {\tt CCTK\_SyncGroup}. By default communications are all off.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_DisableGroupStorage}{Free the storage associated with a group of grid variables}
\label{DisableGroupStorage}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{const char *}{character*(*)}{group}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_DecomposeName}{Given the full name of a variable/group, separates the name returning both the implementation and the variable/group}
\label{DecomposeName}
\subroutine{int}{integer}{istat}
\argument{char *}{}{fullname}
\argument{char **}{}{imp}
\argument{char **}{}{name}
\showcargs
\begin{params}
\parameter{istat}{Status flag returned by routine}
\parameter{fullname}{The full name of the group/variable}
\parameter{imp}{The implementation name}
\parameter{name}{The group/variable name}
\end{params}
\begin{discussion}
No Fortran routine exists at the moment. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t istat = CCTK\_DecomposeName(`evolve::scalars',imp,name)}\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


%%%%%
% EEE
%%%%%





% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_EnableGroupComm}{Turn communications on for a group of grid variables}
\label{EnableGroupComm}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{const char *}{character*(*)}{group}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
Turning on communications means that ghost zones will be communicated during
a call to {\tt CCTK\_SyncGroup}.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_EnableGroupStorage}{Assign the storage for a group of grid variables}
\label{EnableGroupStorage}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{const char *}{character*(*)}{group}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_Exit}{Exit the code cleanly}
\label{Exit}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_Equals}{Check for string equality}
\label{Equals}
\function{int}{integer}{istat}
\argument{const char *}{character*(*)}{string1}
\argument{const char *}{character*(*)}{string2}
\showargs
\begin{params}
\parameter{istat}{returns success or failure of equality}
\parameter{string1}{first string to be compared}
\parameter{string2}{second string to be compared}
\end{params}
\begin{discussion}
This function returns one if the strings are equals, for all other
values the strings are not equals. Note that the input strings in fortran
can be either string literals (`mystring') or CCTK string parameters
(defined by the macro {\tt CCTK\_DECLARE\_PARAMETERS} to be {\t CCTK\_POINTER}.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



%%%%%
% FFF
%%%%%

\begin{CCTKFunc}{CCTK\_FortranString}{Changes a C string into a Fortran string}
\label{FortranString}
\subroutine{int}{integer}{nchar}
\argument{const char *}{character*(*)}{strout}
\argument{const char *}{CCTK\_STRING}{strin}
\showargs
\begin{params}
\parameter{nchar}{The number of characters in the C string, not counting the null terminator}
\parameter{strout}{The fortran string which on output contains the C string as the first nchar characters}
\parameter{strin}{The (pointer to the) C string containing the null terminator}
\end{params}
\begin{discussion}
String or keyword parameters in Cactus are passed into Fortran routines as 
pointers to C strings. This means that they cannot be directly used as Fortran
strings. This routine allows a Fortran string to be created from such a C string. Note that the Fortran string must be defined to have at least the same expected length as the C string. This routine is only callable from Fortran.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf Fortran} && \\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_FirstVarIndex}{Given a group name returns the first variable index in the group}
\label{FirstVarIndex}
\subroutine{int}{integer}{firstvar}
\argument{const char *}{character*(*)}{group}
\showargs
\begin{params}
\parameter{firstvar}{The the first variable index in the given group}
\parameter{group}{The group name}
\end{params}
\begin{discussion}

\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t firstvar = CCTK\_FirstVarIndex(`evolve::scalars') ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_GroupIndex(index,`evolve::scalars')}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_FirstVarIndexI}{Given a group index returns the first variable index in the group}
\label{FirstVarIndexI}
\subroutine{int}{integer}{firstvar}
\argument{int}{integer}{group}
\showargs
\begin{params}
\parameter{firstvar}{The the first variable index in the given group}
\parameter{group}{The group index}
\end{params}
\begin{discussion}

\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_GroupIndex(`evolve::scalars')}\\
               &&{\t firstvar = CCTK\_FirstVarIndexI(index) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_GroupIndex(index,3)}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_FullName}{Given a variable index, returns the full name of the variable}
\label{FullName}
\subroutine{char *}{integer}{fullname}
\argument{int}{integer}{index}
\showcargs
\begin{params}
\parameter{implementation}{The full variable name}
\parameter{index}{The variable index}
\end{params}
\begin{discussion}
No Fortran routine exists at the moment. The full variable name is in
the form {\t <implementation>::<variable>}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi')}\\
               &&{\t fullname = CCTK\_FullName(index) ;}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




%%%%%
% GGG
%%%%%

% cctk_GHExtensions.h
\begin{CCTKFunc}{CCTK\_GHExtensionHandle}{Get the handle associated with a extension to the Cactus GH structure}
\label{GHExtensionHandle}
\subroutine{int}{integer}{handle}
\argument{const char *}{character*(*)}{name}
\showargs
\begin{params}
\parameter{handle}{The GH extension handle}
\parameter{group}{The name of the GH extension}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t handle =  CCTK\_GHExtension(`myExtension') ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_GHExtension(handle,`myExtension')}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_GroupTypeFromVarI}{Provides group type index from the group index}
\label{GroupTypeFromVarI}
\subroutine{int}{integer}{type}
\argument{int}{integer}{index}
\showargs
\begin{params}
\parameter{type}{The group type index}
\parameter{group}{The group index}
\end{params}
\begin{discussion}
The group type index indicates the type of variables in the group. 
Either scalars, grid functions or arrays. The group type can be checked
with the Cactus provided macros for {\t GROUP\_SCALAR}, {\t GROUP\_GF}, {\t GROUP\_ARRAY}.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_GroupIndex(`evolve::scalars')}\\
               &&{\t array = (GROUP\_ARRAY == CCTK\_GroupTypeFromVarI(index)) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_GROUPTYPEFROMVARI(type,3)}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_GroupName}{Given a group index, returns the group name}
\label{GroupName}
\subroutine{char *}{integer}{name}
\argument{int}{integer}{index}
\showcargs
\begin{params}
\parameter{name}{The group name}
\parameter{index}{The group index}
\end{params}
\begin{discussion}
No Fortran routine exists at the moment. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_GroupIndex(`evolve::scalars')}\\
               &&{\t name = CCTK\_GroupName(index) ;}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}





% Groups.c
\begin{CCTKFunc}{CCTK\_GroupData}{Given a group index, returns information about the variables held in the group.}
\label{GroupData}
\subroutine{int}{integer}{istat}
\argument{int}{integer}{group}
\argument{int *}{integer}{gtype}
\argument{int *}{integer}{vtype}
\argument{int *}{integer}{dim}
\argument{int *}{integer}{nvars}
\argument{int *}{integer}{ntimelevels}
\showcargs
\begin{params}
\parameter{istat}{Returns one if a group with the given index was found, and zero otherwise}
\parameter{group}{The group index}
\parameter{gtype}{The group type}
\parameter{vtype}{The type of variables in the group}
\parameter{dim}{The dimension of variables in the group}
\parameter{nvars}{The number of variables in the group}
\parameter{ntimelevels}{The number of timelevels for variables in the group}
\end{params}
\begin{discussion}
No Fortran routine exists at the moment. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_GroupIndex(`evolve::scalars')}\\
               &&{\t istat = CCTK\_GroupData(index,gtype,vtype,dim,nvars,ntimelevels);}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_GroupNameFromVarI}{Given a variable index, return the name of the associated group}
\label{GroupNameFromVarI}
\subroutine{char *}{character*(*)}{group}
\argument{int}{integer}{varindex}
\showcargs
\begin{params}
\parameter{group}{The name of the group}
\parameter{varindex}{The index of the variable}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi');} \\
               && {\t group = CCTK\_GroupNameFromVarI(index) ;}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_GroupIndexFromVarI}{Given a variable index, returns the index of the associated group}
\label{GroupIndexFromVarI}
\subroutine{int}{integer}{groupindex}
\argument{int}{integer}{varindex}
\showargs
\begin{params}
\parameter{groupindex}{The index of the group}
\parameter{varindex}{The index of the variable}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi');} \\
               && {\t groupindex = CCTK\_GroupIndexFromVarI(index) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_VARINDEX(`evolve::phi')}\\
                     &&call {\t CCTK\_GROUPINDEXFROMVARI(groupindex,index)};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_GroupIndexFromVar}{Given a variable name, returns the index of the associated group}
\label{GroupIndexFromVar}
\subroutine{int}{integer}{groupindex}
\argument{const char *}{character*(*)}{name}
\showargs
\begin{params}
\parameter{groupindex}{The index of the group}
\parameter{name}{The full name of the variable}
\end{params}
\begin{discussion}
The variable name should be in the form {\t <implementation>::<variable>}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t groupindex = CCTK\_GroupIndexFromVar(`evolve::phi') ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_GROUPINDEXFROMVAR(groupindex,`evolve::phi')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_GroupIndex}{Get the index number for a group name}
\label{GroupIndex}
\subroutine{int}{integer}{index}
\argument{const char *}{character*(*)}{groupname}
\showargs
\begin{params}
\parameter{groupname}{The name of the group}
\end{params}
\begin{discussion}
The group name should be given in the form {\t <implementation>::<group>}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_GroupIndex(`evolve::scalars') };
\\
\hfill {\bf Fortran} && call {\t CCTK\_GroupIndex(index,`evolve::scalars')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


%%%%%
% HHH
%%%%%

%%%%%
% III
%%%%%





% Groups.c
\begin{CCTKFunc}{CCTK\_ImpFromVarI}{Given a variable index, returns the implementation name}
\label{ImpFromVarI}
\subroutine{char *}{integer}{implementation}
\argument{int}{integer}{index}
\showcargs
\begin{params}
\parameter{implementation}{The implementation name}
\parameter{index}{The variable index}
\end{params}
\begin{discussion}
No Fortran routine exists at the moment
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi')}\\
               &&{\t implementation = CCTK\_ImpFromVarI(index) ;}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}





% WarnLevel.c
\begin{CCTKFunc}{CCTK\_INFO}{Prints an information message}
\label{INFO}
\subroutine{}{}{}
\argument{const char *}{character*(*)}{message}
\showargs
\begin{params}
\parameter{message}{The information message}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t CCTK\_INFO(`Entering interpolator') };
\\
\hfill {\bf Fortran} && {\t call CCTK\_INFO(`Inside interpolator')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% cctk_Interp.h
\begin{CCTKFunc}{CCTK\_Interp}{Perform an interpolatation, using a chosen method}
\label{Interp}
\subroutine{int}{integer}{num}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{int}{integer}{handle}
\argument{int}{integer}{nPoints}
\argument{int}{integer}{nDims}
\argument{int}{integer}{nInFields}
\argument{int}{integer}{nOutFields}
\argument{...}{...}{}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{handle}{handle for interpolation method}
\parameter{nPoints}{number of points to be interpolated on this processor}
\parameter{nDims}{number of passed coordinate fields}
\parameter{nInFields}{number of passed input fields}
\parameter{nOutFields}{number of passed output fields}
\parameter{...}{variable argument list containing coordinate details andvariable indices, described below}
\end{params}
\begin{discussion}
The handle for a given interpolation method can be found using
{\t CCTK\_InterpHandle}. The variable argument list contains
information in the order:
\begin{itemize}
\item{} nDim integers containing ??
\item{} nDim coordinate grid indices
\item{} nDim coordinate variable types
\item{} nDim coordinate origins
\item{} nDim grid spacings
\item{} nInFields indices for the fields to be interpolated from
\item{} nInFields variable types for the fields to be interpolated from
\item{} nOutFields indices for the fields to be interpolated to
\item{} nOutFields variable types for the fields to be interpolated to
\end{itemize}

\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc} 





% Groups.c
\begin{CCTKFunc}{CCTK\_InterpHandle}{Return the handle for a given interpolation operator}
\label{InterpHandle}
\subroutine{int}{integer}{handle}
\argument{const char *}{character*(*)}{operator}
\showargs
\begin{params}
\parameter{hnadle}{Handle for the interpolation operator}
\parameter{operator}{Name of interpolation operator}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc} 

%%%%%
% JJJ
%%%%%

%%%%%
% KKK
%%%%%

%%%%%
% LLL
%%%%%

%%%%%
% MMM
%%%%%


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_MyProc}{Returns the number of the local processor for a parallel run}
\label{MyProc}
\function{int}{integer}{myproc}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
For a single processor run this call will return zero. For multiprocessor
runs, this call will return $0\leq myproc < {\t CCTK\_nProcs(cctkGH)}$.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_MaxDim}{Get the maximum dimension of any grid variable }
\label{MaxDim}
\subroutine{int}{integer}{dim}
\showargs
\begin{params}
\parameter{dim}{The maximum dimension}
\end{params}
\begin{discussion}
Note that the maximum dimension will depend on the compiled thorn list,
and not the active thorn list.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t dim = CCTK\_MaxDim() };
\\
\hfill {\bf Fortran} && {\t call  CCTK\_MaxDim(dim)};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


%%%%%
% NNN
%%%%%



% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_nProcs}{Returns the number of processors being used for a parallel run}
\label{nProcs}
\function{int}{integer}{nprocs}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
For a single processor run this call will return one. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_NumTimeLevelsFromVarI}{Gives the number of timelevels for a variable}
\label{NumTimeLevelsFromVarI}
\subroutine{int}{integer}{numlevels}
\argument{int}{integer}{index}
\showargs
\begin{params}
\parameter{numlevels}{The number of timelevels}
\parameter{index}{The variable index}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi')}\\
               &&{\t numlevels = CCTK\_NumTimeLevelsFromVarI(index) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_NUMTIMELEVELSFROMVARI(numlevels,3)}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_NumTimeLevelsFromVar}{Gives the number of timelevels for a variable}
\label{NumTimeLevelsFromVar}
\subroutine{int}{integer}{numlevels}
\argument{const char *}{character*(*)}{name}
\showargs
\begin{params}
\parameter{name}{The full variable name}
\parameter{numlevels}{The number of timelevels}
\end{params}
\begin{discussion}
The variable name should be in the form {\t <implementation>::<variable>}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t numlevels = CCTK\_NumTimeLevelsFromVar(`evolve::phi') ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_NUMTIMELEVELSFROMVAR(numlevels,`evolve::phi')}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_NumVarsInGroupI}{Provides the number of variables in a group from the group index}
\label{NumVarsInGroupI}
\subroutine{int}{integer}{num}
\argument{int}{integer}{index}
\showargs
\begin{params}
\parameter{num}{The number of variables in the group}
\parameter{group}{The group index}
\end{params}
\begin{discussion}

\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_GroupIndex(`evolve::scalars')}\\
               &&{\t firstvar = CCTK\_NumVarsInGroupI(index) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_NUMVARSINGROUPI(firstvar,3)}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_NumVarsInGroup}{Provides the number of variables in a group from the group name}
\label{}
\subroutine{int}{integer}{num}
\argument{const char *}{character*(*)}{name}
\showargs
\begin{params}
\parameter{num}{The number of variables in the group}
\parameter{group}{The full group name}
\end{params}
\begin{discussion}
The group name should be given in the form {\t <implementation>::<group>}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t numvars = CCTK\_NumVarsInGroup(`evolve::scalars') ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_NUMVARSINGROUP(numvars,`evolve::scalars')}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_NumGroups}{Get the number of groups of variables compiled in the code}
\label{NumGroups}
\subroutine{int}{integer}{number}
\showargs
\begin{params}
\parameter{number}{The number of groups compiled from the thorns {\t interface.ccl} files}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t number = CCTK\_NumGroups() };
\\
\hfill {\bf Fortran} && call {\t CCTK\_NumGroups(number)};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% Groups.c
\begin{CCTKFunc}{CCTK\_NumVars}{Get the number of grid variables compiled in the code}
\label{NumVars}
\subroutine{int}{integer}{number}
\showargs
\begin{params}
\parameter{number}{The number of grid variables compiled from the thorns {\t interface.ccl} files}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t number = CCTK\_NumVars() };
\\
\hfill {\bf Fortran} && call {\t CCTK\_NumVars(number)};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




%%%%%
% OOO
%%%%%


% IOOverloadables.h
\begin{CCTKFunc}{CCTK\_OutputVarAsByMethod}{}
\label{OutputVarAsByMethod}
\subroutine{int}{}{istat}
\argument{cGH *}{}{cctkGH}
\argument{const char *}{character*(*)}{variable}
\argument{const char *}{character*(*)}{method}
\argument{const char *}{character*(*)}{alias}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% IOOverloadables.h
\begin{CCTKFunc}{CCTK\_OutputGH}{}
\label{OutputGH}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



%%%%%
% PPP
%%%%%




% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_ParallelInit}{}
\label{ParallelInit}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Groups.c
\begin{CCTKFunc}{CCTK\_PrintGroup}{Prints a group name from its index}
\label{PrintGroup}
\subroutine{}{}{}
\argument{int}{integer}{index}
\showargs
\begin{params}
\parameter{index}{The group index}
\end{params}
\begin{discussion}
This routine is for debugging purposes for Fortran programmers.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t CCTK\_PrintGroup(1) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_PRINTGROUP(1)}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_PrintVar}{Prints a variable name from its index}
\label{PrintVar}
\subroutine{}{}{}
\argument{int}{integer}{index}
\showargs
\begin{params}
\parameter{index}{The variable index}
\end{params}
\begin{discussion}
This routine is for debugging purposes for Fortran programmers.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t CCTK\_PrintVar(1) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_PRINTVAR(1)}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% WarnLevel.c
\begin{CCTKFunc}{CCTK\_PARAMWARN}{Prints a warning from parameter checking, and possibly stops the code}
\label{PARAMWARN}
\subroutine{}{}{}
\argument{const char *}{character*(*)}{message}
\showargs
\begin{params}
\parameter{message}{The warning message}
\end{params}
\begin{discussion}
The call should be used in routines registered at the RFR point {\t CCTK\_PARAMCHECK}
to indicate that there is parameter error or conflict and the code should 
terminate. The code will terminate only after all the parameters have been 
checked.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t CCTK\_PARAMWARN(`Mass cannot be negative') };
\\
\hfill {\bf Fortran} && {\t call  CCTK\_PARAMWARN(`Inside interpolator')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



%%%%%
% QQQ
%%%%%


% cctk_Comm.h
\begin{CCTKFunc}{CCTK\_QueryGroupStorage}{}
\label{QueryGroupStorage}
\subroutine{int}{}{storage}
\argument{cGH *}{}{cctkGH}
\argument{const char *}{}{groupname}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% cctk_Comm.h
\begin{CCTKFunc}{CCTK\_QueryGroupStorageI}{}
\label{QueryGroupStorageI}
\subroutine{int}{}{storage}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{groupindex}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% CommOverloadables.h
\begin{CCTKFunc}{CCTK\_QueryGroupStorageB}{}
\label{QueryGroupStorageB}
\subroutine{int}{}{storage}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{groupindex}
\argument{const char *}{}{groupname}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



%%%%%
% RRR
%%%%%


% cctk_IOMethods.h
\begin{CCTKFunc}{CCTK\_RegisterIOMethod}{}
\label{RegisterIOMethod}
\function{int}{integer}{handle}
\argument{const char *}{}{name}
\showargs
\begin{params}
\parameter{handle}{handle returned by registration}
\parameter{name}{name of the IO method}
\end{params}
\begin{discussion}
IO methods should be registered at {\t CCTK\_STARTUP}. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% cctk_IOMethods.h
\begin{CCTKFunc}{CCTK\_RegisterIOMethodOutputGH}{Register a routine for an IO method which will be called from {\tt CCTK\_OutputGH}.}
\label{RegisterIOMethodOutputGH}
\function{int}{integer}{istat}
\argument{int}{}{handle}
\argument{int}{}{(* func)(cGH *)}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% cctk_IOMethods.h
\begin{CCTKFunc}{CCTK\_RegisterIOMethodTimeToOutput}{Register a routine for an IO method which will decide if it is time for the method to output.}
\label{RegisterIOMethodTimeToOutput}
\function{int}{integer}{istat}
\argument{int}{}{handle}
\argument{int}{}{(* func)(cGH *,int)}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% cctk_IOMethods.h
\begin{CCTKFunc}{CCTK\_RegisterIOMethodTriggerOutput}{Register a routine for an IO method which will handle trigger output}
\label{RegisterIOMethodTriggerOutput}
\function{int}{integer}{istat}
\argument{int}{}{handle}
\argument{int}{}{(* func)(cGH *,int)}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% cctk_IOMethods.h
\begin{CCTKFunc}{CCTK\_RegisterIOMethodOutputVarAs}{Register a routine for an IO method which will provide aliased variable output}
\label{RegisterIOMethodOutputVarAs}
\function{int}{integer}{istat}
\argument{int}{}{handle}
\argument{int}{}{(* func)(cGH *,const char*, const char *)}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% cctk_GHExtensions.h
\begin{CCTKFunc}{CCTK\_RegisterGHExtension}{Register an extension to the CactusGH}
\label{RegisterGHExtension}
\function{int}{}{istat}
\argument{const char *}{}{name}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

% cctk_GHExtensions.h
\begin{CCTKFunc}{CCTK\_RegisterGHExtensionSetupGH}{Register a function which will set up a given extension to the Cactus GH}
\label{RegisterGHExtensionSetupGH}
\function{int}{}{istat}
\argument{int}{}{handle}
\argument{void *}{}{(*func)(tFleshConfig *, int, cGH *)}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

% cctk_GHExtensions.h
\begin{CCTKFunc}{CCTK\_RegisterGHExtensionInitGH}{Register a function which will initialise a given extension to the Cactus GH}
\label{RegisterGHExtensionInitGH}
\function{int}{}{istat}
\argument{int}{}{handle}
\argument{void *}{}{(*func)(cGH *)}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

% cctk_GHExtensions.h
\begin{CCTKFunc}{CCTK\_RegisterGHExtensionrfrTraverseGH}{Register a routine which will be called to fill out an extension to a Cactus GH before a traverse of the RFR tree.}
\label{RegisterGHExtensionrfrTraverseGH}
\function{int}{}{istat}
\argument{int}{}{handle}
\argument{void *}{}{(*func)(cGH *,int)}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% cctk_Interp.h
\begin{CCTKFunc}{CCTK\_RegisterInterpOperator}{Register a function
  which will provide an interpolation operator}
\label{RegisterInterpOperator}
\subroutine{int}{}{handle}
\argument{int}{}{(*function)(REGISTER\_INTERP\_ARGLIST)}
\argument{const char *}{}{name}
\showcargs
\begin{params}
\parameter{handle}{Handle from the registration}
\parameter{function}{Routine containing interpolation operator}
\parameter{name}{Name of interpolation operator}
\end{params}
\begin{discussion}
The argument list {\t REGISTER\_INTERP\_ARGLIST} 
 for the interpolation operator routine is
\begin{description}
\item[cGH *GH]
        Pointer to CCTK grid hierachy (in)
\item[int nPoints]
        Number of points to be interpolated on this processor (in)
\item[int nDims]
        Number of coordinate dimensions for each point (in)
\item[int nInFields]
        Number of input fields to interpolate from (in)
\item[int nOutFields]
        Number of output fields to interpolate to (in)
\item[int *dims]
        Size nDims array with dimensions of the underlying grid (in)
\item[void **coords]
        Void *array of size nDims with coordinates of points to interpolate at (in)
\item[int *coordTypes]
        size ndims array with variable type of coordinate fields (in)
\item[void *origin]
        size ndims array with origin of the underlying grid (in)
\item[void *delta]
        size ndims array with gridspacing of the underlying grid (in)
\item[void **inFields]
        size nInFields *array of input fields to interpolate on (in)
\item[int *inTypes]
        size ndims array with variable types of input fields (in)
\item[void **outFields]
        size nOutFields *array of output fields to interpolate to (out)
\item[int *outTypes]
        size ndims array with variable types of output fields (in)
\end{description}
\end{discussion}
\begin{examples}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}





% Coord.c
\begin{CCTKFunc}{CCTK\_RegisterCoordI}{Register a grid function index as identifying a coordinate with a given coordinate name and direction.}
\label{RegisterCoordI}
\subroutine{int}{integer}{handle}
\argument{int}{integer}{direction}
\argument{int}{integer}{index}
\argument{const char *}{character*(*)}{name}
\showargs
\begin{params}
\parameter{handle}{On success returns zero or a positive registration handle. Error codes have negative values.}
\parameter{direction}{The coordinate cartesian direction}
\parameter{index}{The index of the grid function representing the coordinate}
\parameter{name}{The name of the coordinate}
\end{params}
\begin{discussion}
The coordinate name is independent of the grid function name. The direction should be given 
as zero for a non-cartesian index. Currently only CCTK\_REAL grid functions can be registered 
as coordinates.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(``MyImp::MyGF'');} \\
               && {\t handle = CCTK\_RegisterCoordI(1,index,`xdir')};
\\
\hfill {\bf Fortran} && {\t call  CCTK\_REGISTERCOORDI(handle,0,14,`radius')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% Coord.c
\begin{CCTKFunc}{CCTK\_RegisterCoord}{Register a grid function name as identifying a coordinate with a given coordinate name and direction.}
\label{RegisterCoord}
\subroutine{int}{integer}{handle}
\argument{int}{integer}{direction}
\argument{const char *}{character*(*)}{gfname}
\argument{const char *}{character*(*)}{coordname}
\showargs
\begin{params}
\parameter{handle}{On success returns a zero or positive registration handle. Error codes have negative values.}
\parameter{direction}{The coordinate cartesian direction}
\parameter{gfname}{The full name of the grid function representing the coordinate}
\parameter{coordname}{The name of the coordinate}
\end{params}
\begin{discussion}
The coordinate name is independent of the grid function name. The direction should be given 
as zero for a non-cartesian index. Currently only CCTK\_REAL grid functions can be registered 
as coordinates.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t handle = CCTK\_RegisterCoord(1,`MyImp::MyGF',`xdir')};
\\
\hfill {\bf Fortran} && {\t call  CCTK\_REGISTERCOORD(handle,0,`MyImp::MyGF',`radius')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% Coord.c
\begin{CCTKFunc}{CCTK\_RegisterBanner}{Register a banner for a thorn}
\label{RegisterBanner}
\subroutine{void}{}{}
\argument{const char *}{character*(*)}{message}
\showargs
\begin{params}
\parameter{message}{String which will be displayed as a banner}
\end{params}
\begin{discussion}
The banner must be registered during {\t CCTK\_STARTUP}. The banners are
displayed in the order in which they are registered.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t CCTK\_RegisterBanner(`My Thorn: Does Something Useful')};
\\
\hfill {\bf Fortran} && {\t call CCTK\_REGISTERBANNER(`*** MY THORN ***')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



% Coord.c
\begin{CCTKFunc}{CCTK\_RegisterCoordRange}{Saves the global upper and lower bounds for a given coordinate name}
\label{RegisterCoordRange}
\subroutine{int}{integer}{ierr}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{CCTK\_REAL}{CCTK\_REAL}{lower}
\argument{CCTK\_REAL}{CCTK\_REAL}{upper}
\argument{const char *}{character*(*)}{coordname}
\showargs
\begin{params}
\parameter{ierr}{Error code}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{lower}{Global lower bound of the coordinate}
\parameter{upper}{Global upper bound of the coordinate}
\parameter{coordname}{Coordinate name}
\end{params}
\begin{discussion}
The coordinate name is independent of the grid function name. There must already
be a coordinate registered with the given name, with {\t CCTK\_RegisterCoord}. 
The coordinate range
can be accessed by {\t CCTK\_CoordRange}. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t ierr = CCTK\_RegisterCoordRange(xmin,xmax,`xdir') };
\\
\hfill {\bf Fortran} && {\t call CCTK\_REGISTERCOORDRANGE(ierr,Rmin,Rmax,`radius')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



%%%%%
% SSS
%%%%%


% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_SetupGH}{Setup a new GH}
\label{SetupGH}
\subroutine{cGH *}{}{cctkGH}
\argument{tFleshConfig}{}{config}
\argument{int}{}{convlevel}
\showcargs
\begin{params}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% CommOverloadables.c
\begin{CCTKFunc}{CCTK\_SyncGroup}{Synchronise the ghostzones for a group of grid variables}
\label{SyncGroup}
\subroutine{int}{integer}{istat}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{const char *}{character*(*)}{group}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\end{params}
\begin{discussion}
Only those grid variables who have communication enabled will be synchronised.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



%%%%%
% TTT
%%%%%

%%%%%
% UUU
%%%%%

%%%%%
% VVV
%%%%%


% Groups.c
\begin{CCTKFunc}{CCTK\_VarIndex}{Get the index for a variable}
\label{VarIndex}
\subroutine{int}{integer}{index}
\argument{const char *}{character*(*)}{varname}
\showargs
\begin{params}
\parameter{varname}{The name of the variable}
\end{params}
\begin{discussion}
The variable name should be given in the form {\t <implementation>::<variable>}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi') };
\\
\hfill {\bf Fortran} && {\t call CCTK\_VarIndex(index,`evolve::phi')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_VarName}{Given a variable index, returns the variable name}
\label{VarName}
\subroutine{char *}{integer}{name}
\argument{int}{integer}{index}
\showcargs
\begin{params}
\parameter{name}{The  variable name}
\parameter{index}{The variable index}
\end{params}
\begin{discussion}
No Fortran routine exists at the moment. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi')}\\
               &&{\t name = CCTK\_VarName(index) ;}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




% Groups.c
\begin{CCTKFunc}{CCTK\_VarTypeI}{Provides variable type index from the variable index}
\label{VarTypeI}
\subroutine{int}{integer}{type}
\argument{int}{integer}{index}
\showargs
\begin{params}
\parameter{type}{The variable type index}
\parameter{group}{The variable index}
\end{params}
\begin{discussion}
The variable type index indicates the type of the variable. 
Either character, int, complex or real. The group type can be checked
with the Cactus provided macros for {\t CCTK\_VARIABLE\_INT}, {\t CCTK\_VARIABLE\_REAL}, {\t CCTK\_VARIABLE\_COMPLEX} or {\t CCTK\_VARIABLE\_CHAR}.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_VarIndex(`evolve::phi')}\\
               &&{\t real = (CCTK\_VARIABLE\_REAL == CCTK\_VarTypeI(index)) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_VARTYPEI(type,3)}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_VarDataPtr}{Returns the data pointer for a grid variable}
\label{VarDataPtr}
\subroutine{void *}{}{ptr}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{timelevel}
\argument{char *}{}{name}
\showcargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{timelevel}{The timelevel of the grid variable}
\parameter{name}{The full name of the variable}
\end{params}
\begin{discussion}
The variable name should be in the form {\t <implementation>::<variable>}.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t myVar = (CCTK\_REAL *)(CCTK\_VarDataPtr(GH,0,`imp::realvar'))}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_VarDataPtrI}{Returns the data pointer for a grid variable from the variable index}
\label{VarDataPtrI}
\subroutine{void *}{}{ptr}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{timelevel}
\argument{int}{}{index}
\showcargs
\begin{params}
\parameter{cctkGH}{}
\parameter{timelevel}{The timelevel of the grid variable}
\parameter{index}{The index of the variable}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t myVar = (CCTK\_REAL *)(CCTK\_VarDataPtr(GH,0,CCTK\_VarIndex(`imp::realvar')))}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_VarDataPtrB}{Returns the data pointer for a grid variable from the variable index or the variable name}
\label{VarDataPtrB}
\subroutine{void *}{}{ptr}
\argument{cGH *}{}{cctkGH}
\argument{int}{}{timelevel}
\argument{int}{}{index}
\argument{char *}{}{name} 
\showcargs
\begin{params}
\parameter{ptr}{a void pointer to the grid variable data}
\parameter{cctkGH}{}
\parameter{timelevel}{The timelevel of the grid variable}
\parameter{index}{The index of the variable}
\parameter{name}{The full name of the variable}
\end{params}
\begin{discussion}
If the name if {\t NULL} the index will be used, if the index is negative the name will be used.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t myVar = (CCTK\_REAL *)(CCTK\_VarDataPtrB(GH,0,CCTK\_VarIndex(`imp::realvar'),NULL))}\\
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



%%%%%
% WWW
%%%%%



% WarnLevel.c
\begin{CCTKFunc}{CCTK\_WARN}{Prints a warning message and possibly stops the code}
\label{WARN}
\subroutine{}{}{}
\argument{int}{integer}{level}
\argument{const char *}{character*(*)}{warning}
\showargs
\begin{params}
\parameter{level}{The warning level, lower numbers are the severest warnings}
\parameter{warning}{The warning message}
\end{params}
\begin{discussion}
By default Cactus stops on a level 0 warning, and prints any level 1 warnings.
This behavious can be changed on the command line.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t CCTK\_WARN(1,`This is not a good idea') };
\\
\hfill {\bf Fortran} && {\t call CCTK\_WARN(0,`Divide by zero')};
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



\end{cactuspart}