summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2008-04-07 02:41:08 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2008-04-07 02:41:08 +0000
commit2802d63d6f953d6d53886f653d5a74ff6b2f1319 (patch)
tree3a4a4c75f911200309f27858f6302cac81afc990
parent52662f132be42e5f8d77f3b9f7c4fd31fe47ff1c (diff)
Add a new function CCTK_MaxGFDim to the flesh which returns the
(maximum) dimension of all grid functions. Cactus can currently not handle the case where one uses grid arrays of dimension D while grid functions have a dimension less than D. During initialisation, Cactus sets cctk_dim to the largest dimension of all grid variables in all active thorns. This is arguably wrong; cctk_dim should be set to the (maximum) dimension of the grid functions. This patch adds a new function CCTK_MaxGFDim to the flesh which returns the (maximum) dimension of all grid functions. This function is used to set cctk_dim. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4476 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r--doc/ReferenceManual/CCTKReference.tex28
-rw-r--r--src/comm/CactusDefaultComm.c4
-rw-r--r--src/include/cctk_Groups.h1
-rw-r--r--src/main/Groups.c27
4 files changed, 58 insertions, 2 deletions
diff --git a/doc/ReferenceManual/CCTKReference.tex b/doc/ReferenceManual/CCTKReference.tex
index ca9de66d..ffac6aa5 100644
--- a/doc/ReferenceManual/CCTKReference.tex
+++ b/doc/ReferenceManual/CCTKReference.tex
@@ -465,6 +465,9 @@ from Fortran.
\item[\code{CCTK\_MaxDim}] [\pageref{CCTK-MaxDim}]
Get the maximum dimension of any grid variable
+\item[\code{CCTK\_MaxGFDim}] [\pageref{CCTK-MaxGFDim}]
+ Get the maximum dimension of all grid functions
+
\item[\code{CCTK\_MaxTimeLevels}] [\pageref{CCTK-MaxTimeLevels}]
Gives the maximum number of timelevels for a group
@@ -7046,6 +7049,31 @@ and not the active thorn list.
\end{CCTKFunc}
+\begin{CCTKFunc}{CCTK\_MaxGFDim}{Get the maximum dimension of all grid
+ functions }
+\label{CCTK-MaxGFDim}
+\subroutine{int}{integer}{dim}
+\showargs
+\begin{params}
+\parameter{dim}{The maximum dimension of all grid functions}
+\end{params}
+\begin{discussion}
+Note that the maximum dimension will depend only on the active thorn list,
+and not the compiled thorn list.
+\end{discussion}
+\begin{examples}
+\begin{tabular}{@{}p{3cm}cp{11cm}}
+\hfill {\bf C} && {\t dim = CCTK\_MaxGFDim() };
+\\
+\hfill {\bf Fortran} && {\t call CCTK\_MaxGFDim(dim)}
+\\
+\end{tabular}
+\end{examples}
+\begin{errorcodes}
+\end{errorcodes}
+\end{CCTKFunc}
+
+
\begin{CCTKFunc}{CCTK\_MaxTimeLevels}{Gives the number of timelevels for a group}
\label{CCTK-MaxTimeLevels}
diff --git a/src/comm/CactusDefaultComm.c b/src/comm/CactusDefaultComm.c
index b4b3741e..1cbc82e3 100644
--- a/src/comm/CactusDefaultComm.c
+++ b/src/comm/CactusDefaultComm.c
@@ -112,7 +112,7 @@ int CactusDefaultInterpGridArrays (const cGH *GH, int N_dims,
@desc
Default cactus SetupGH routine.
@enddesc
- @calls CCTK_MaxDim
+ @calls CCTK_MaxGFDim
CCTK_NumVars
CCTK_MaxTimeLevelsVI
CCTK_NumGroups
@@ -157,7 +157,7 @@ cGH *CactusDefaultSetupGH(tFleshConfig *config, int convergence_level)
thisGH = malloc(sizeof(cGH));
if(thisGH)
{
- thisGH->cctk_dim = CCTK_MaxDim();
+ thisGH->cctk_dim = CCTK_MaxGFDim();
/* Need this to be at least one otherwise the memory allocation will fail */
cctk_dim = thisGH->cctk_dim;
diff --git a/src/include/cctk_Groups.h b/src/include/cctk_Groups.h
index 9b44008c..0d101a76 100644
--- a/src/include/cctk_Groups.h
+++ b/src/include/cctk_Groups.h
@@ -64,6 +64,7 @@ int CCTK_GroupTypeI(int group);
const char *CCTK_ImpFromVarI(int var);
int CCTK_MaxDim(void);
+int CCTK_MaxGFDim(void);
int CCTK_NumGroups(void);
diff --git a/src/main/Groups.c b/src/main/Groups.c
index 7596dcb8..40d80a29 100644
--- a/src/main/Groups.c
+++ b/src/main/Groups.c
@@ -82,6 +82,8 @@ void CCTK_FCALL CCTK_FNAME (CCTK_ImpFromVarI)
(int *nchars, int *var, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_MaxDim)
(int *dim);
+void CCTK_FCALL CCTK_FNAME (CCTK_MaxGFDim)
+ (int *dim);
void CCTK_FCALL CCTK_FNAME (CCTK_MaxTimeLevels)
(int *num, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_MaxTimeLevelsGI)
@@ -454,6 +456,31 @@ void CCTK_FCALL CCTK_FNAME (CCTK_MaxDim)
/*@@
+ @routine CCTK_MaxGFDim
+ @date 2008-03-19
+ @author Erik Schnetter
+ @desc
+ Gets the maximum dimension of all grid function groups.
+ @enddesc
+
+ @returntype int
+ @returndesc
+ the maximum dimension of all grid function groups
+ @endreturndesc
+@@*/
+int CCTK_MaxGFDim (void)
+{
+ return (gfdim);
+}
+
+void CCTK_FCALL CCTK_FNAME (CCTK_MaxGFDim)
+ (int *dim)
+{
+ *dim = CCTK_MaxGFDim ();
+}
+
+
+ /*@@
@routine CCTK_NumVars
@date Mon Feb 8 12:04:50 1999
@author Tom Goodale