aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2001-11-05 15:05:15 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2001-11-05 15:05:15 +0000
commit91eb9c5c135c85a14c103c2e02fa6acf3b61ec20 (patch)
tree155ad5619c6c6371ac8623fdfdd84ef8a0ab4c6f /src
parent0385777ba3cdcd7b5262d4d877acc8bda3508498 (diff)
Added const qualifier to the 'cGH *' argument of some more IO functions.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@221 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src')
-rw-r--r--src/DumpGH.c26
-rw-r--r--src/DumpVar.c38
-rw-r--r--src/Output2D.c16
-rw-r--r--src/Output3D.c20
-rw-r--r--src/Write2D.c4
-rw-r--r--src/Write3D.c12
-rw-r--r--src/ioFlexGH.h26
7 files changed, 75 insertions, 67 deletions
diff --git a/src/DumpGH.c b/src/DumpGH.c
index ccdf9c1..bacad8a 100644
--- a/src/DumpGH.c
+++ b/src/DumpGH.c
@@ -34,8 +34,8 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_DumpGH_c)
void IOFlexIO_ConditionallyDumpGH (cGH *GH);
void IOFlexIO_TerminationDumpGH (cGH *GH);
void IOFlexIO_InitialDataDumpGH (cGH *GH);
-void IOFlexIOi_DumpParameters (cGH *GH, IOFile iof);
-void IOFlexIOi_DumpGHExtensions (cGH *GH, IOFile iof);
+void IOFlexIOi_DumpParameters (const cGH *GH, IOFile iof);
+void IOFlexIOi_DumpGHExtensions (const cGH *GH, IOFile iof);
/*@@
@@ -175,7 +175,7 @@ void IOFlexIO_InitialDataDumpGH (cGH *GH)
@endhistory
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH
+ @vtype const cGH *
@vio in
@endvar
@var iof
@@ -184,7 +184,7 @@ void IOFlexIO_InitialDataDumpGH (cGH *GH)
@vio in
@endvar
@@*/
-void IOFlexIOi_DumpParameters (cGH *GH, IOFile iof)
+void IOFlexIOi_DumpParameters (const cGH *GH, IOFile iof)
{
char *parameters;
@@ -213,7 +213,7 @@ void IOFlexIOi_DumpParameters (cGH *GH, IOFile iof)
@endhistory
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH
+ @vtype const cGH *
@vio in
@endvar
@var iof
@@ -222,7 +222,7 @@ void IOFlexIOi_DumpParameters (cGH *GH, IOFile iof)
@vio in
@endvar
@@*/
-void IOFlexIOi_DumpGHExtensions (cGH *GH, IOFile iof)
+void IOFlexIOi_DumpGHExtensions (const cGH *GH, IOFile iof)
{
CCTK_INT4 i_temp;
CCTK_REAL d_temp;
@@ -282,7 +282,7 @@ void IOFlexIOi_DumpGHExtensions (cGH *GH, IOFile iof)
@@*/
-void IOFlexIO_DumpGH (cGH *GH, int called_from)
+void IOFlexIO_DumpGH (const cGH *GH, int called_from)
{
DECLARE_CCTK_PARAMETERS
char dumpfname [1024], tmpfname [1024];
@@ -296,7 +296,15 @@ void IOFlexIO_DumpGH (cGH *GH, int called_from)
flexioGH *myGH;
static char **dumpfnames = NULL; /* dump filename ring buffer */
static int findex = 0; /* index into ring buffer */
+ /*** FIXME: can CCTK_SyncGroup() have a 'const cGH *' parameter ?? ***/
+ union
+ {
+ const cGH *const_ptr;
+ cGH *non_const_ptr;
+ } GH_fake_const;
+
+ GH_fake_const.const_ptr = GH;
/* Get the handles for IOUtil and IOFlexIO extensions */
ioUtilGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")];
@@ -325,7 +333,7 @@ void IOFlexIO_DumpGH (cGH *GH, int called_from)
for (vindex = 0; vindex < CCTK_NumGroups (); vindex++)
if (CCTK_IsImplementationActive (CCTK_ImpFromVarI (
CCTK_FirstVarIndexI (vindex))))
- CCTK_SyncGroupI (GH, vindex);
+ CCTK_SyncGroupI (GH_fake_const.non_const_ptr, vindex);
/* get the base filename ... */
IOUtil_PrepareFilename (GH, NULL, dumpfname, called_from,
@@ -387,7 +395,7 @@ void IOFlexIO_DumpGH (cGH *GH, int called_from)
}
/* sync the group */
- CCTK_SyncGroupI (GH, gindex);
+ CCTK_SyncGroupI (GH_fake_const.non_const_ptr, gindex);
/* dump all timelevels except the oldest (for multi-level groups) */
CCTK_GroupData (gindex, &gdata);
diff --git a/src/DumpVar.c b/src/DumpVar.c
index 285877a..5ca15ca 100644
--- a/src/DumpVar.c
+++ b/src/DumpVar.c
@@ -58,20 +58,20 @@ typedef struct {
/* local function prototypes */
-static void IOFlexIO_DumpGS (cGH *GH, int vindex, int timelevel, IOFile iof,
+static void IOFlexIO_DumpGS (const cGH *GH, int vindex, int timelevel, IOFile iof,
int flexio_type);
-static void IOFlexIO_DumpGA (cGH *GH, int vindex, int timelevel, IOFile iof,
+static void IOFlexIO_DumpGA (const cGH *GH, int vindex, int timelevel, IOFile iof,
dumpInfo_t *info);
-static void IOFlexIO_getDumpData (cGH *GH, int vindex, int timelevel,
+static void IOFlexIO_getDumpData (const cGH *GH, int vindex, int timelevel,
void **outme, int *free_outme, CCTK_INT4 *geom, int element_size);
-static void IOFlexIO_eachProcDump (cGH *GH, int vindex, int timelevel,
+static void IOFlexIO_eachProcDump (const cGH *GH, int vindex, int timelevel,
void *outme, CCTK_INT4 *geom, IOFile iof, int flexio_type);
-static void IOFlexIO_AddChunkAttributes (cGH *GH, int vindex, CCTK_INT4 *geom,
+static void IOFlexIO_AddChunkAttributes (const cGH *GH, int vindex, CCTK_INT4 *geom,
IOFile iof);
-static void IOFlexIO_AddCommonAttributes (cGH *GH, int vindex, int timelevel,
+static void IOFlexIO_AddCommonAttributes (const cGH *GH, int vindex, int timelevel,
CCTK_INT4 *gsz, IOFile iof);
#ifdef CCTK_MPI
-static void IOFlexIO_procDump (IOFile iof, cGH *GH, int vindex, void *outme,
+static void IOFlexIO_procDump (IOFile iof, const cGH *GH, int vindex, void *outme,
CCTK_INT4 *geom, int flexio_type);
#endif
@@ -89,7 +89,7 @@ static void IOFlexIO_procDump (IOFile iof, cGH *GH, int vindex, void *outme,
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH
+ @vtype const cGH *
@vio in
@endvar
@var vindex
@@ -111,7 +111,7 @@ static void IOFlexIO_procDump (IOFile iof, cGH *GH, int vindex, void *outme,
@endhistory
@@*/
-void IOFlexIO_DumpVar (cGH *GH, int vindex, int timelevel, IOFile iof)
+void IOFlexIO_DumpVar (const cGH *GH, int vindex, int timelevel, IOFile iof)
{
pGH *pughGH;
ioGH *ioUtilGH;
@@ -250,7 +250,7 @@ int IOFlexIO_DataType (int cctk_type)
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH
+ @vtype const cGH *
@vio in
@endvar
@var vindex
@@ -277,7 +277,7 @@ int IOFlexIO_DataType (int cctk_type)
@endhistory
@@*/
-static void IOFlexIO_DumpGS (cGH *GH, int vindex, int timelevel, IOFile iof,
+static void IOFlexIO_DumpGS (const cGH *GH, int vindex, int timelevel, IOFile iof,
int flexio_type)
{
ioGH *ioUtilGH;
@@ -310,7 +310,7 @@ static void IOFlexIO_DumpGS (cGH *GH, int vindex, int timelevel, IOFile iof,
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH
+ @vtype const cGH *
@vio in
@endvar
@var vindex
@@ -341,7 +341,7 @@ static void IOFlexIO_DumpGS (cGH *GH, int vindex, int timelevel, IOFile iof,
@endhistory
@@*/
-static void IOFlexIO_DumpGA (cGH *GH, int vindex, int timelevel, IOFile iof,
+static void IOFlexIO_DumpGA (const cGH *GH, int vindex, int timelevel, IOFile iof,
dumpInfo_t *info)
{
DECLARE_CCTK_PARAMETERS
@@ -508,7 +508,7 @@ static void IOFlexIO_DumpGA (cGH *GH, int vindex, int timelevel, IOFile iof,
output files
@endhistory
@@*/
-static void IOFlexIO_AddCommonAttributes (cGH *GH, int vindex, int timelevel,
+static void IOFlexIO_AddCommonAttributes (const cGH *GH, int vindex, int timelevel,
CCTK_INT4 *gsz, IOFile iof)
{
DECLARE_CCTK_PARAMETERS
@@ -627,7 +627,7 @@ static void IOFlexIO_AddCommonAttributes (cGH *GH, int vindex, int timelevel,
@hdesc Abstracted WRITE_ATTRIBUTE to merge in Szu-Wen's Panda calls.
@endhistory
@@*/
-static void IOFlexIO_AddChunkAttributes (cGH *GH, int vindex, CCTK_INT4 *geom,
+static void IOFlexIO_AddChunkAttributes (const cGH *GH, int vindex, CCTK_INT4 *geom,
IOFile iof)
{
int vdim;
@@ -674,7 +674,7 @@ static void IOFlexIO_AddChunkAttributes (cGH *GH, int vindex, CCTK_INT4 *geom,
@endhistory
@var GH
@vdesc Identifies grid hierachy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -716,7 +716,7 @@ static void IOFlexIO_AddChunkAttributes (cGH *GH, int vindex, CCTK_INT4 *geom,
@vio in
@endvar
@@*/
-static void IOFlexIO_getDumpData (cGH *GH, int vindex, int timelevel,
+static void IOFlexIO_getDumpData (const cGH *GH, int vindex, int timelevel,
void **outme, int *free_outme, CCTK_INT4 *geom, int element_size)
{
DECLARE_CCTK_PARAMETERS
@@ -941,7 +941,7 @@ static void IOFlexIO_getDumpData (cGH *GH, int vindex, int timelevel,
@hdesc Made into subroutine
@endhistory
@@*/
-static void IOFlexIO_eachProcDump (cGH *GH, int vindex, int timelevel,
+static void IOFlexIO_eachProcDump (const cGH *GH, int vindex, int timelevel,
void *outme, CCTK_INT4 *geom, IOFile iof, int flexio_type)
{
int i, dim, *chunk_dims;
@@ -982,7 +982,7 @@ static void IOFlexIO_eachProcDump (cGH *GH, int vindex, int timelevel,
@endhistory
@@*/
#ifdef CCTK_MPI
-static void IOFlexIO_procDump (IOFile iof, cGH *GH, int vindex, void *outme,
+static void IOFlexIO_procDump (IOFile iof, const cGH *GH, int vindex, void *outme,
CCTK_INT4 *geom, int flexio_type)
{
ioGH *ioUtilGH;
diff --git a/src/Output2D.c b/src/Output2D.c
index b4c1989..b738784 100644
--- a/src/Output2D.c
+++ b/src/Output2D.c
@@ -42,13 +42,13 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg);
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@*/
-int IOFlexIO_Output2DGH (cGH *GH)
+int IOFlexIO_Output2DGH (const cGH *GH)
{
DECLARE_CCTK_PARAMETERS
int i;
@@ -105,7 +105,7 @@ int IOFlexIO_Output2DGH (cGH *GH)
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -123,7 +123,7 @@ int IOFlexIO_Output2DGH (cGH *GH)
@endvar
@@*/
-int IOFlexIO_Output2DVarAs (cGH *GH, const char *fullname, const char *alias)
+int IOFlexIO_Output2DVarAs (const cGH *GH, const char *fullname, const char *alias)
{
DECLARE_CCTK_PARAMETERS
int vindex;
@@ -158,7 +158,7 @@ int IOFlexIO_Output2DVarAs (cGH *GH, const char *fullname, const char *alias)
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -171,7 +171,7 @@ int IOFlexIO_Output2DVarAs (cGH *GH, const char *fullname, const char *alias)
@@*/
-int IOFlexIO_TimeFor2D (cGH *GH, int vindex)
+int IOFlexIO_TimeFor2D (const cGH *GH, int vindex)
{
flexioGH *myGH;
@@ -221,7 +221,7 @@ int IOFlexIO_TimeFor2D (cGH *GH, int vindex)
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -233,7 +233,7 @@ int IOFlexIO_TimeFor2D (cGH *GH, int vindex)
@endvar
@@*/
-int IOFlexIO_TriggerOutput2D (cGH *GH, int vindex)
+int IOFlexIO_TriggerOutput2D (const cGH *GH, int vindex)
{
DECLARE_CCTK_PARAMETERS
flexioGH *myGH;
diff --git a/src/Output3D.c b/src/Output3D.c
index be0bf0e..94b9177 100644
--- a/src/Output3D.c
+++ b/src/Output3D.c
@@ -25,8 +25,8 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_Output3D_c)
/* function prototypes */
-int IOFlexIO_Output3DVarAs (cGH *GH, const char *var, const char *alias);
-int IOFlexIO_TimeFor3D (cGH *GH, int vindex);
+int IOFlexIO_Output3DVarAs (const cGH *GH, const char *var, const char *alias);
+int IOFlexIO_TimeFor3D (const cGH *GH, int vindex);
static int CheckOutputVar (int vindex);
static void CheckSteerableParameters (flexioGH *myGH);
static void SetOutputFlag (int vindex, const char *optstring, void *arg);
@@ -45,13 +45,13 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg);
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@*/
-int IOFlexIO_Output3DGH (cGH *GH)
+int IOFlexIO_Output3DGH (const cGH *GH)
{
DECLARE_CCTK_PARAMETERS
int i;
@@ -106,7 +106,7 @@ int IOFlexIO_Output3DGH (cGH *GH)
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -124,7 +124,7 @@ int IOFlexIO_Output3DGH (cGH *GH)
@endvar
@@*/
-int IOFlexIO_Output3DVarAs (cGH *GH, const char *fullname, const char *alias)
+int IOFlexIO_Output3DVarAs (const cGH *GH, const char *fullname, const char *alias)
{
DECLARE_CCTK_PARAMETERS
int vindex;
@@ -159,7 +159,7 @@ int IOFlexIO_Output3DVarAs (cGH *GH, const char *fullname, const char *alias)
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -171,7 +171,7 @@ int IOFlexIO_Output3DVarAs (cGH *GH, const char *fullname, const char *alias)
@endvar
@@*/
-int IOFlexIO_TimeFor3D (cGH *GH, int vindex)
+int IOFlexIO_TimeFor3D (const cGH *GH, int vindex)
{
flexioGH *myGH;
@@ -220,7 +220,7 @@ int IOFlexIO_TimeFor3D (cGH *GH, int vindex)
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -232,7 +232,7 @@ int IOFlexIO_TimeFor3D (cGH *GH, int vindex)
@endvar
@@*/
-int IOFlexIO_TriggerOutput3D (cGH *GH, int vindex)
+int IOFlexIO_TriggerOutput3D (const cGH *GH, int vindex)
{
DECLARE_CCTK_PARAMETERS
flexioGH *myGH;
diff --git a/src/Write2D.c b/src/Write2D.c
index a3f0673..4838e81 100644
--- a/src/Write2D.c
+++ b/src/Write2D.c
@@ -47,7 +47,7 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_Write2D_c)
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -65,7 +65,7 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_Write2D_c)
@endvar
@@*/
-void IOFlexIO_Write2D (cGH *GH, int vindex, const char *alias)
+void IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias)
{
DECLARE_CCTK_PARAMETERS
int dir; /* looper for directions */
diff --git a/src/Write3D.c b/src/Write3D.c
index e13999b..4b8286d 100644
--- a/src/Write3D.c
+++ b/src/Write3D.c
@@ -48,13 +48,13 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_Write3D_c)
/* Function prototypes from other files in this thorn */
-void IOFlexIOi_DumpGHExtensions (cGH *GH, IOFile iof);
-void IOFlexIOi_DumpParameters (cGH *GH, IOFile iof);
+void IOFlexIOi_DumpGHExtensions (const cGH *GH, IOFile iof);
+void IOFlexIOi_DumpParameters (const cGH *GH, IOFile iof);
/* local function prototypes */
-static IEEEfile_3D_t *IOFlexIO_Get3Dfile (cGH *GH, const char *alias,
+static IEEEfile_3D_t *IOFlexIO_Get3Dfile (const cGH *GH, const char *alias,
int *isNewFile);
/*@@
@@ -102,7 +102,7 @@ static IEEEfile_3D_t *IOFlexIO_Get3Dfile (cGH *GH, const char *alias,
@endhistory
@var GH
@vdesc Pointer to CCTK GH
- @vtype cGH
+ @vtype const cGH *
@vio in
@vcomment
@endvar
@@ -119,7 +119,7 @@ static IEEEfile_3D_t *IOFlexIO_Get3Dfile (cGH *GH, const char *alias,
@vcomment
@endvar
@@*/
-void IOFlexIO_Write3D (cGH *GH, int vindex, const char *alias)
+void IOFlexIO_Write3D (const cGH *GH, int vindex, const char *alias)
{
DECLARE_CCTK_PARAMETERS
ioGH *ioUtilGH;
@@ -274,7 +274,7 @@ void IOFlexIO_Write3D (cGH *GH, int vindex, const char *alias)
@endhistory
@@*/
-static IEEEfile_3D_t *IOFlexIO_Get3Dfile (cGH *GH, const char *alias,
+static IEEEfile_3D_t *IOFlexIO_Get3Dfile (const cGH *GH, const char *alias,
int *isNewFile)
{
DECLARE_CCTK_PARAMETERS
diff --git a/src/ioFlexGH.h b/src/ioFlexGH.h
index 2eb37a7..4f08edc 100644
--- a/src/ioFlexGH.h
+++ b/src/ioFlexGH.h
@@ -143,19 +143,19 @@ typedef struct IOFlexIOGH
/* prototypes of functions to be registered */
-int IOFlexIO_Output2DGH (cGH *GH);
-int IOFlexIO_TriggerOutput2D (cGH *GH, int);
-int IOFlexIO_TimeFor2D (cGH *GH, int);
-int IOFlexIO_Output2DVarAs (cGH *GH, const char *var, const char *alias);
-int IOFlexIO_Output3DGH (cGH *GH);
-int IOFlexIO_TriggerOutput3D (cGH *GH, int);
-int IOFlexIO_TimeFor3D (cGH *GH, int);
-int IOFlexIO_Output3DVarAs (cGH *GH, const char *var, const char *alias);
+int IOFlexIO_Output2DGH (const cGH *GH);
+int IOFlexIO_TriggerOutput2D (const cGH *GH, int);
+int IOFlexIO_TimeFor2D (const cGH *GH, int);
+int IOFlexIO_Output2DVarAs (const cGH *GH, const char *var, const char *alias);
+int IOFlexIO_Output3DGH (const cGH *GH);
+int IOFlexIO_TriggerOutput3D (const cGH *GH, int);
+int IOFlexIO_TimeFor3D (const cGH *GH, int);
+int IOFlexIO_Output3DVarAs (const cGH *GH, const char *var, const char *alias);
/* other function prototypes */
-void IOFlexIO_Write2D (cGH *GH, int vindex, const char *alias);
-void IOFlexIO_Write3D (cGH *GH, int vindex, const char *alias);
-void IOFlexIO_DumpVar (cGH *GH, int vindex, int timelevel, IOFile iof);
-void IOFlexIO_IEEEIOStructDump (cGH *GH, IOFile iof);
-void IOFlexIO_DumpGH (cGH *GH, int called_from);
+void IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias);
+void IOFlexIO_Write3D (const cGH *GH, int vindex, const char *alias);
+void IOFlexIO_DumpVar (const cGH *GH, int vindex, int timelevel, IOFile iof);
+void IOFlexIO_IEEEIOStructDump (const cGH *GH, IOFile iof);
+void IOFlexIO_DumpGH (const cGH *GH, int called_from);
int IOFlexIO_DataType (int cctk_type);