aboutsummaryrefslogtreecommitdiff
path: root/src/WriteScalar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/WriteScalar.c')
-rw-r--r--src/WriteScalar.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/WriteScalar.c b/src/WriteScalar.c
index 981f30e..dbd1ab3 100644
--- a/src/WriteScalar.c
+++ b/src/WriteScalar.c
@@ -24,7 +24,7 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusBase_IOBasic_WriteScalar_c)
-static FILE *OpenScalarFile (cGH *GH,
+static FILE *OpenScalarFile (const cGH *GH,
int vindex,
const char *filename,
const char *slicename,
@@ -49,7 +49,7 @@ static FILE *OpenScalarFile (cGH *GH,
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@endvar
@var vindex
@@ -63,7 +63,7 @@ static FILE *OpenScalarFile (cGH *GH,
@vio in
@endvar
@@*/
-void IOBasic_WriteScalarGA (cGH *GH,
+void IOBasic_WriteScalarGA (const cGH *GH,
int vindex,
const char *alias)
{
@@ -85,11 +85,18 @@ void IOBasic_WriteScalarGA (cGH *GH,
char *non_const_ptr;
const char *const_ptr;
} reductions;
+ /*** FIXME: can CCTK_Reduce() have a 'const cGH *' parameter ?? ***/
+ union
+ {
+ const cGH *const_ptr;
+ cGH *non_const_ptr;
+ } GH_fake_const;
/* this union helps us to avoid compiler warning about discarding
the const qualifier from a pointer target type */
reductions.const_ptr = outScalar_reductions;
+ GH_fake_const.const_ptr = GH;
/* first, check if variable has storage assigned */
if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (vindex)))
@@ -154,8 +161,8 @@ void IOBasic_WriteScalarGA (cGH *GH,
}
/* do the reduction (all processors) */
- ierr = CCTK_Reduce (GH, 0, reduction_handle, 1, CCTK_VARIABLE_REAL,
- &reduction_value, 1, vindex);
+ ierr = CCTK_Reduce (GH_fake_const.non_const_ptr, 0, reduction_handle, 1,
+ CCTK_VARIABLE_REAL, &reduction_value, 1, vindex);
/* dump the reduction value to file by processor 0 */
if (ierr == 0 && CCTK_MyProc (GH) == 0)
@@ -234,7 +241,7 @@ void IOBasic_WriteScalarGA (cGH *GH,
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@endvar
@var vindex
@@ -248,7 +255,7 @@ void IOBasic_WriteScalarGA (cGH *GH,
@vio in
@endvar
@@*/
-void IOBasic_WriteScalarGS (cGH *GH, int vindex, const char *alias)
+void IOBasic_WriteScalarGS (const cGH *GH, int vindex, const char *alias)
{
DECLARE_CCTK_PARAMETERS
FILE *file;
@@ -322,7 +329,7 @@ void IOBasic_WriteScalarGS (cGH *GH, int vindex, const char *alias)
}
-static FILE *OpenScalarFile (cGH *GH,
+static FILE *OpenScalarFile (const cGH *GH,
int vindex,
const char *filename,
const char *slicename,