% /*@@
%   @file      FunctionReference.tex
%   @date      27 Jan 1999
%   @author    Tom Goodale, Gabrielle Allen, Gerd Lanferman
%   @desc 
%   Function Reference for the Cactus User's Guide
%   @enddesc 
%   @version $Header$      
% @@*/
\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{CmplxImag}]
  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\_CoordDir] 
  [\pageref{CoordDir}] 
  Give the direction for a given coordinate name.

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

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

\item[CCTK\_CoordRegisterData] 
  [\pageref{CoordRegisterData}] 
  Register a coordinate as belonging to a coordinate system, with a given name and direction, and
  optionally with a grid variable

\item[CCTK\_CoordRegisterRange] 
  [\pageref{CoordRegisterRange}] 
  Saves the global upper and lower bounds for a given coordinate name on a cctkGH

\item[CCTK\_CoordRegisterSystem] 
  [\pageref{CoordRegisterSystem}] 
  Registers a coordinate system with a given dimension

\item[CCTK\_CoordSystemDim] 
  [\pageref{CoordDim}] 
  Provides the dimension of a given coordinate system

\item[CCTK\_CreateDirectory]   
  [\pageref{CreateDirectory}] 
  Creates a directory

\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\_IsThornActive]   
  [\pageref{IsThornActive}] 
  Reports whether a thorn was activated in a parameter file
         
\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\_OutputGH] 
  [\pageref{OutputGH}] 

\item[CCTK\_OutputVar] 
  [\pageref{OutputVar}] 

\item[CCTK\_OutputVarAs] 
  [\pageref{OutputVarAs}] 

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

\item[CCTK\_OutputVarByMethod] 
  [\pageref{OutputVarByMethod}] 

\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\_PrintString]
  [\pageref{PrintString}]
  Prints a Cactus string to screen (from Fortran)

\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\_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}
\argument{int}{integer}{value}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{value}{error code}
\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
%%%%%


\begin{CCTKFunc}{CCTK\_Cmplx}{Turns two real numbers into a complex number}
\label{Cmplx}
\subroutine{CCTK\_COMPLEX}{}{cmpno}
\argument{CCTK\_REAL}{}{realpart}
\argument{CCTK\_REAL}{}{imagpart}
\showcargs
\begin{params}
\parameter{cmpno}{The complex number}
\parameter{realpart}{The real part of the complex number}
\parameter{imagpart}{The imaginary part of the complex number}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t cmpno = CCTK\_Cmplx(re,im)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_CmplxAbs}{Absolute value of a complex number}
\label{CmplxAbs}
\subroutine{CCTK\_COMPLEX}{}{absval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{absval}{The computed absolute value}
\parameter{realpart}{The complex number who absolute value is to be returned}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t absval = CCTK\_CmplxAbs(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_CmplxAdd}{Sum of two complex numbers}
\label{CmplxAdd}
\subroutine{CCTK\_COMPLEX}{}{addval}
\argument{CCTK\_COMPLEX}{}{inval1}
\argument{CCTK\_COMPLEX}{}{inval2}
\showcargs
\begin{params}
\parameter{addval}{The computed added value}
\parameter{inval1}{The first complex number to be summed}
\parameter{inval2}{The second complex number to be summed}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t addval = CCTK\_CmplxAdd(inval1,inval2)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_CmplxConjg}{Complex conjugate of a complex number}
\label{CmplxConjg}
\subroutine{CCTK\_COMPLEX}{}{conjgval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{conjval}{The computed conjugate}
\parameter{inval}{The complex number to be conjugated}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t conjgval = CCTK\_CmplxConjg(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_CmplxCos}{Cosine of a complex number}
\label{CmplxCos}
\subroutine{CCTK\_COMPLEX}{}{cosval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{cosval}{The computed cosine}
\parameter{inval}{The complex number to be cosined}
\end{params}
\begin{discussion}
{\bf NOT YET AVAILABLE}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t cosval = CCTK\_CmplxCos(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_CmplxDiv}{Division of two complex numbers}
\label{CmplxDiv}
\subroutine{CCTK\_COMPLEX}{}{divval}
\argument{CCTK\_COMPLEX}{}{inval1}
\argument{CCTK\_COMPLEX}{}{inval2}
\showcargs
\begin{params}
\parameter{divval}{The divided value}
\parameter{inval1}{The enumerator}
\parameter{inval1}{The denominator}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t divval = CCTK\_CmplxDiv(inval1,inval2)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_CmplxExp}{Exponent of a complex number}
\label{CmplxExp}
\subroutine{CCTK\_COMPLEX}{}{expval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{expval}{The computed exponent}
\parameter{inval}{The complex number to be exponented}
\end{params}
\begin{discussion}
{\bf NOT YET AVAILABLE}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t expval = CCTK\_CmplxExp(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_CmplxImag}{Imaginary part of a complex number}
\label{CmplxImag}
\subroutine{CCTK\_REAL}{}{imval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{imval}{The imaginary part}
\parameter{inval}{The complex number}
\end{params}
\begin{discussion}
The imaginary part of a complex number $z=a+bi$ is $b$.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t imval = CCTK\_CmplxImag(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_CmplxLog}{Logarithm of a complex number}
\label{CmplxLog}
\subroutine{CCTK\_COMPLEX}{}{logval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{logval}{The computed logarithm}
\parameter{inval}{The complex number}
\end{params}
\begin{discussion}
{\bf NOT YET AVAILABLE}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t logval = CCTK\_CmplxLog(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_CmplxMul}{Multiplication of two complex numbers}
\label{CmplxMul}
\subroutine{CCTK\_COMPLEX}{}{mulval}
\argument{CCTK\_COMPLEX}{}{inval1}
\argument{CCTK\_COMPLEX}{}{inval2}
\showcargs
\begin{params}
\parameter{mulval}{The product}
\parameter{inval1}{First complex number to be multiplied}
\parameter{inval2}{Second complex number to be multiplied}
\end{params}
\begin{discussion}
The product of two complex numbers $z_1=a_1+b_1 i$ and $z_2=a_2+b_2 i$ is
$z=(a_1 a_2 - b_1 b_2) + (a_1 b_2 + a_2 b_1)i$.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t mulval = CCTK\_CmplxMul(inval1,inval2)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



\begin{CCTKFunc}{CCTK\_CmplxReal}{Real part of a complex number}
\label{CmplxReal}
\subroutine{CCTK\_REAL}{}{reval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{reval}{The real part}
\parameter{inval}{The complex number}
\end{params}
\begin{discussion}
The real part of a complex number $z=a+bi$ is $a$.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t reval = CCTK\_CmplxReal(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_CmplxSin}{Sine of a complex number}
\label{CmplxSin}
\subroutine{CCTK\_COMPLEX}{}{sinval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{sinval}{The computed sine}
\parameter{inval}{The complex number to be Sined}
\end{params}
\begin{discussion}
{\bf NOT YET AVAILABLE}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t sinval = CCTK\_CmplxSin(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_CmplxSub}{Subtraction of two complex numbers}
\label{CmplxSub}
\subroutine{CCTK\_COMPLEX}{}{subval}
\argument{CCTK\_COMPLEX}{}{inval1}
\argument{CCTK\_COMPLEX}{}{inval2}
\showcargs
\begin{params}
\parameter{addval}{The computed subtracted value}
\parameter{inval1}{The complex number to be subtracted from}
\parameter{inval2}{The complex number to subtract}
\end{params}
\begin{discussion}
If $z_1=a_1 + b_1 i$ and $z_2 = a_2+ b_2 i$ then 
$$
z_1-z_2 = (a_1-a_2)+ (b_1 - b_2)i
$$
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t subval = CCTK\_CmplxSub(inval1,inval2)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

\begin{CCTKFunc}{CCTK\_CmplxSqrt}{Square root of a complex number}
\label{CmplxSqrt}
\subroutine{CCTK\_COMPLEX}{}{sqrtval}
\argument{CCTK\_COMPLEX}{}{inval}
\showcargs
\begin{params}
\parameter{expval}{The computed square root}
\parameter{inval}{The complex number to be square rooted}
\end{params}
\begin{discussion}
{\bf NOT YET AVAILABLE}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t sqrtval = CCTK\_CmplxSqrt(inval)};
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



\begin{CCTKFunc}{CCTK\_CoordSystemDim}{Give the dimension for a given coordinate system.}
\label{CoordDim}
\subroutine{int}{integer}{dim}
\argument{const char *}{character*(*)}{systemname}
\showargs
\begin{params}
\parameter{dim}{The dimension of the coordinate system}
\parameter{systemname}{The name of the coordinate system}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t dim = CCTK\_CoordSystemDim("cart3d")};
\\
\hfill {\bf Fortran} && {\t call  CCTK\_COORDSYSTEMDIM(dim,"spher3d")}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_CoordDir}{Give the direction for a given coordinate.}
\label{CoordDir}
\subroutine{int}{integer}{dir}
\argument{const char *}{character*(*)}{coordname}
\argument{const char *}{character*(*)}{systemname}
\showargs
\begin{params}
\parameter{dir}{The direction of the coordinate}
\parameter{coordname}{The name assigned to this coordinate}
\parameter{systemname}{The name of the coordinate system}
\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 direction = CCTK\_CoordDir("xdir","cart3d")};
\\
\hfill {\bf Fortran} && {\t call  CCTK\_COORDDIR(direction,"radius","spher3d")}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


\begin{CCTKFunc}{CCTK\_CoordIndex}{Give the grid variable index for a given coordinate.}
\label{CoordIndex}
\subroutine{int}{integer}{index}
\argument{int}{integer}{direction}
\argument{const char *}{character*(*)}{coordname}
\argument{const char *}{character*(*)}{systemname}
\showargs
\begin{params}
\parameter{index}{The coordinates associated grid variable index}
\parameter{direction}{The direction of the coordinate in this coordinate system}
\parameter{coordname}{The name assigned to this coordinate}
\parameter{systemname}{The coordinate system for this coordinate}
\end{params}
\begin{discussion}
The coordinate name is independent of the grid variable name. 
To find the index, the coordinate system name must be given, and either
the coordinate direction or the coordinate name. The coordinate name 
will be used if the coordinate direction is given as -1, otherwise the
coordinate name will be used.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t index = CCTK\_CoordIndex(1,"xdir","cart3d")};
\\
\hfill {\bf Fortran} && one = 1
\\
&& {\t call  CCTK\_COORDINDEX(index,one,"radius","spher2d")}
\\
\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}
\label{CoordRange}
\subroutine{int}{integer}{ierr}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{CCTK\_REAL}{CCTK\_REAL}{lower}
\argument{CCTK\_REAL}{CCTK\_REAL}{upper}
\argument{int}{integer}{direction}
\argument{const char *}{character*(*)}{coordname}
\argument{const char *}{character*(*)}{systemname}
\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{direction}{Direction of coordinate in coordinate system}
\parameter{coordname}{Coordinate name}
\parameter{systemname}{Coordinate system name}
\end{params}
\begin{discussion}
The coordinate name is independent of the grid function name. 
The coordinate range is registered by {\t CCTK\_CoordRegisterRange}.
To find the range, the coordinate system name must be given, and either
the coordinate direction or the coordinate name. The coordinate name 
will be used if the coordinate direction is given as -1, otherwise the
coordinate name will be used.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t ierr = CCTK\_CoordRange(cctkGH,*xmin,*xmax,-1,"xdir","mysystem") };
\\
\hfill {\bf Fortran} && {\t call CCTK\_COORDRANGE(ierr,cctkGH,Rmin,Rmax,-1,"radius","sphersystem")}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

% Coord.c
\begin{CCTKFunc}{CCTK\_CoordRegisterData}{Define a coordinate in a given coordinate
system.}
\label{CoordRegisterData}
\subroutine{int}{integer}{ierr}
\argument{int}{integer}{direction}
\argument{const char *}{character*(*)}{gvname}
\argument{const char *}{character*(*)}{coordname}
\argument{const char *}{character*(*)}{systemname}
\showargs
\begin{params}
\parameter{ierr}{Error code}
\parameter{dimension}{Direction of coordinate in coordinate system}
\parameter{gvname}{Name of grid variable associated with coordinate}
\parameter{coordname}{Name of this coordinate}
\parameter{systemname}{Name of this coordinate system}
\end{params}
\begin{discussion}
There must already be a coordinate system registered, 
using {\tt CCTK\_CoordRegisterSystem}.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t ierr = CCTK\_CoordRegisterData(1,"coordthorn::myx","x2d","cart2d")};
\\
\hfill {\bf Fortran} && two = 2
\\
&&{\t call CCTK\_COORDREGISTERDATA(ierr,two,"coordthorn::mytheta","spher3d")}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

% Coord.c
\begin{CCTKFunc}{CCTK\_CoordRegisterRange}{Assign the global maximum and minimum 
values of a coordinate on a given grid hierachy}
\label{CoordRegisterRange}
\subroutine{int}{integer}{ierr}
\argument{cGH *}{CCTK\_POINTER}{cctkGH}
\argument{CCTK\_REAL}{CCTK\_REAL}{min}
\argument{CCTK\_REAL}{CCTK\_REAL}{max}
\argument{int}{integer}{direction}
\argument{const char *}{character*(*)}{coordname}
\argument{const char *}{character*(*)}{systemname}
\showargs
\begin{params}
\parameter{ierr}{Error code}
\parameter{dimension}{Pointer to CCTK grid hierachy}
\parameter{min}{Global minimum of coordinate}
\parameter{max}{Global maximum of coordinate}
\parameter{direction}{Direction of coordinate in coordinate system}
\parameter{coordname}{Name of coordinate in coordinate system}
\parameter{systemname}{Name of this coordinate system}
\end{params}
\begin{discussion}
There must already
be a coordinate registered with the given name, with {\t CCTK\_CoordRegisterData}. 
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\_CoordRegisterRange(cctkGH,-1.0,1.0,1,"x2d","cart2d")};
\\
\hfill {\bf Fortran} && min = 0 
\\
&& max = 3.1415d0/2.0d0
\\
&& two = 2
\\
&&{\t call CCTK\_COORDREGISTERRANGE(ierr,min,max,two,"coordthorn::mytheta","spher3d")}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}

% Coord.c
\begin{CCTKFunc}{CCTK\_CoordRegisterSystem}{Assigns a coordinate system with
a chosen name and dimension}
\label{CoordRegisterSystem}
\subroutine{int}{integer}{ierr}
\argument{int}{integer}{dimension}
\argument{const char *}{character*(*)}{systemname}
\showargs
\begin{params}
\parameter{ierr}{Error code}
\parameter{dimension}{Dimension of coordinate system}
\parameter{systemname}{Unique name assigned to coordinate system}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t ierr = CCTK\_CoordRegisterSystem(3,"cart3d")};
\\
\hfill {\bf Fortran} && three = 3
\\
&&{\t call CCTK\_COORDREGISTERSYSTEM(ierr,three,"sphersystem")}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}


% Coord.c
\begin{CCTKFunc}{CCTK\_CreateDirectory}{Create a directory with required permissions}
\label{CreateDirectory}
\subroutine{int}{integer}{ierr}
\argument{const char *}{character*(*)}{pathname}
\argument{int}{integer}{mode}
\showargs
\begin{params}
\parameter{ierr}{Error code}
\parameter{pathname}{Directory to create}
\parameter{mode}{Permission mode for new directory as an octal number}
\end{params}
\begin{discussion}
To create a directory readable by everyone, but writeable only by the user runnning the code, the permission mode would be 0755.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t ierr = CCTK\_CreateDirectory("Results/New",0755) };
\\
\hfill {\bf Fortran} && {\t call CCTK\_CREATEDIRECTORY(ierr,"Results/New",0755)}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\begin{tabular}{ll}
0 & Directory successfully created\\
-1 & Memory allocation failed\\
-2 & Failed to create directory\\
-3 & pathname exists but is not a directory\\
\end{tabular}
\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}
Grid variables with communication enabled will have their ghost zones communicated during a call
to {\tt CCTK\_SyncGroup}. In general, this function does not need to be used, since communication
is automatically enabled for grid variables who have assigned storage via the {\tt schedule.ccl} 
file.
\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}
In general this function does not need to be used, since storage assignment is best handled by
the Cactus scheduler via a thorn's {\tt schedule.ccl} file.
\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 compares a Cactus parameter with a string, and performs a 
case-independent comparison, returning one if the strings are the same, 
and zero if they differ. 
\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}
\argument{int}{integer}{value}
\showargs
\begin{params}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{value}{error code}
\end{params}
\begin{discussion}
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}




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


% 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}


\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\_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}
\function{int}{}{ierr}
\argument{int}{}{group}
\argument{cGroup *}{}{pgroup}
\showcargs
\begin{params}
\parameter{ierr}{0 for success, negative for failure}
\parameter{group}{group index}
\parameter{pgroup}{returns a pointer to a structure containing group information}
\end{params}
\begin{discussion}
The cGroup structure contains the information
\begin{itemize}
\item grouptype: The group type
\item vartype: The type of variables in the group
\item stagtype: The type of grid staggering for arrays
\item dim: The dimension of variables in the group
\item numvars: The number of variables in the group
\item ntimelevels: The number of timelevels for variables in the group
\end{itemize}
No Fortran routine exists at the moment. 
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t cGroup pgroup;}\\
	       && {\t index = CCTK\_GroupIndex("evolve::scalars")}\\
               &&{\t ierr = CCTK\_GroupData(index,\&pgroup);}\\
               && {\t vtype = pgroup.vartype;}
\\
\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 the given in its fully qualified form, that is {\t <implementation>::<group>} for a public or protected group, and {\t <thornname>::<group>} for a private 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\_OutputVarAs}{}
\label{OutputVarAs}
\subroutine{int}{}{istat}
\argument{cGH *}{}{cctkGH}
\argument{const char *}{character*(*)}{variable}
\argument{const char *}{character*(*)}{alias}
\showargs
\begin{params}
\parameter{istat}{return flag}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{variable}{full name of variable to output}
\parameter{alias}{name to base output file on}
\end{params}
\begin{discussion}
Output a variable {\t variable} looping over all registered methods. 
The output should take place if at all possible,
if the appropriate file exists the data is appended, otherwise a new
file is created. Uses {\t alias} as the name of the variable for the purpose
of constructing a filename.
\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\_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{istat}{return flag}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{variable}{full name of variable to output}
\parameter{method}{method to use for output}
\parameter{alias}{name to base output file on}
\end{params}
\begin{discussion}
Output a variable {\t variable} using the method {\t method} if it is 
registered. Uses {\t alias} as the name of the variable for the purpose
of constructing a filename. The output should take place if at all possible,
if the appropriate file exists the data is appended, otherwise a new
file is created.
\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\_OutputVarByMethod}{}
\label{OutputVarAsMethod}
\subroutine{int}{}{istat}
\argument{cGH *}{}{cctkGH}
\argument{const char *}{character*(*)}{variable}
\argument{const char *}{character*(*)}{method}
\showargs
\begin{params}
\parameter{istat}{return flag}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{variable}{full name of variable to output}
\parameter{method}{method to use for output}
\end{params}
\begin{discussion}
Output a variable {\t variable} using the method {\t method} if it is 
registered. The output should take place if at all possible,
if the appropriate file exists the data is appended, otherwise a new
file is created.
\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\_OutputVar}{}
\label{OutputVar}
\subroutine{int}{}{istat}
\argument{cGH *}{}{cctkGH}
\argument{const char *}{character*(*)}{variable}
\showargs
\begin{params}
\parameter{istat}{return flag}
\parameter{cctkGH}{pointer to CCTK grid hierarchy}
\parameter{variable}{full name of variable to output}
\end{params}
\begin{discussion}
Output a variable {\t variable} looping over all registered methods. 
The output should take place if at all possible,
if the appropriate file exists the data is appended, otherwise a new
file is created.
\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\_PrintString}{Prints a Cactus string}
\label{PrintString}
\subroutine{}{}{}
\argument{char *}{CCTK\_STRING}{string}
\showargs
\begin{params}
\parameter{string}{The string to print}
\end{params}
\begin{discussion}
This routine can be used to print Cactus string variables and parameters
from Fortran.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t CCTK\_PrintString(string\_param) ;}
\\
\hfill {\bf Fortran} && {\t call CCTK\_PRINTSTRING(string\_param)}\\
\\
\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
%%%%%

\begin{CCTKFunc}{CCTK\_ReductionHandle}{Handle for given reduction method}
\label{ReductionHandle}
\function{int}{integer}{handle}
\argument{const char *}{character*(*)}{reduction}
\showargs
\begin{params}
\parameter{handle}{handle returned for this method}
\parameter{name}{name of the reduction method required}
\end{params}
\begin{discussion}
Reduction methods should be registered at {\t CCTK\_STARTUP}. Note that
integer reduction handles are used to call {\t CCTK\_Reduce} to avoid
problems with passing Fortran strings. Note that the name of the reduction
operator is case dependent.
\end{discussion}
\begin{examples}
\begin{tabular}{@{}p{3cm}cp{11cm}}
\hfill {\bf C} && {\t handle = CCTK\_ReductionHandle("maximum") };
\\
\hfill {\bf Fortran} && {\t call CCTK\_ReductionHandle(handle,"maximum")}
\\
\end{tabular}
\end{examples}
\begin{errorcodes}
\end{errorcodes}
\end{CCTKFunc}



\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\_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}


%%%%%
% 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 which have communication enabled 
will be synchronised. This is usually equivalent to the variables 
which have storage assigned, unless communication has been explicitly
turned off with a call to {\tt CCTK\_DisableGroupComm}.

Note that an alternative to calling {\tt CCTK\_SyncGroup} explicitly 
from within a thorn, is to use the {\tt SYNC} keyword in a thorns
{\tt schedule.ccl} file to indicate which groups of variables need 
to be synchronised on exit from the routine. This latter method is 
the preferred method from synchronising variables.
\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 the given in its fully qualified form, that is {\t <implementation>::<variable>} for a public or protected variabe, and {\t <thornname>::<variable>} for a private 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}