summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-10-26 14:23:31 +0000
committereschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-10-26 14:23:31 +0000
commite91cde0953119fa01d92174413643e889adbb98e (patch)
tree484912fa90f1a1e3262e03d154a9ffb938f3f14f /src
parent80f043ecb43335a3c1862b8a6ffde4332703f069 (diff)
Use CCTKi_VarDataPtrI in CCTK_DECLARE_ARGUMENTS
Introduce new function CCTKi_VarDataPtrI which does not emit warnings. Use it when defining CCTK_DECLARE_ARGUMENTS. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4898 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r--src/include/cctki_GroupsOnGH.h26
-rw-r--r--src/main/GroupsOnGH.c45
2 files changed, 70 insertions, 1 deletions
diff --git a/src/include/cctki_GroupsOnGH.h b/src/include/cctki_GroupsOnGH.h
new file mode 100644
index 00000000..f2fc72b2
--- /dev/null
+++ b/src/include/cctki_GroupsOnGH.h
@@ -0,0 +1,26 @@
+ /*@@
+ @header cctki_GroupsOnGH.h
+ @date 2012-10-26
+ @author Erik Schnetter
+ @desc
+ Prototypes and constants for internal group functions which use GH structure.
+ @enddesc
+ @version $Header$
+ @@*/
+
+#ifndef _CCTKI_GROUPSONGH_H_
+#define _CCTKI_GROUPSONGH_H_
+
+/* Prototypes */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *CCTKi_VarDataPtrI(const cGH *GH, int timelevel, int varindex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/main/GroupsOnGH.c b/src/main/GroupsOnGH.c
index 55a4f5da..d3b02935 100644
--- a/src/main/GroupsOnGH.c
+++ b/src/main/GroupsOnGH.c
@@ -21,6 +21,8 @@
#include "cctk_Misc.h"
#include "cctk_WarnLevel.h"
+#include "cctki_GroupsOnGH.h"
+
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(main_GroupsOnGH_c);
@@ -369,11 +371,52 @@ void CCTK_FCALL CCTK_FNAME(CCTK_VarDataPtrI)
}
/*@@
+ @routine CCTKi_VarDataPtrI
+ @date 2012-10-26
+ @author Erik Schnetter
+ @desc
+ Passes back a variable data pointer, given a variable index and timelevel.
+ This function does not output any warnings.
+ @enddesc
+
+ @var GH
+ @vdesc Pointer to Grid Hierachy
+ @vtype const cGH *
+ @vio in
+ @endvar
+
+ @var vindex
+ @vdesc Index of grid variable
+ @vtype int
+ @vio in
+ @endvar
+
+ @var timelevel
+ @vdesc Index of timelevel on which data is required
+ @vtype int
+ @vio in
+ @endvar
+
+ @returntype void *
+ @returndesc Pointer to the required data, should be cast to required type
+ @endreturndesc
+@@*/
+void *CCTKi_VarDataPtrI(const cGH *GH, int timelevel, int vindex)
+{
+ int numtimelevels = CCTK_MaxTimeLevelsVI (vindex);
+ if (timelevel < 0 || timelevel >= numtimelevels)
+ {
+ return NULL;
+ }
+ return GH->data[vindex][timelevel];
+}
+
+ /*@@
@routine CCTK_VarDataPtrB
@date Tue 6th April 1999
@author Gabrielle Allen
@desc
- Passes back a variable data pointer, given either a variable index
+ Passes back a variable data pointer, given either a variable index
or a full name and timelevel
@enddesc