aboutsummaryrefslogtreecommitdiff
path: root/src/DumpVar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/DumpVar.c')
-rw-r--r--src/DumpVar.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/DumpVar.c b/src/DumpVar.c
index a6ca440..949d3fb 100644
--- a/src/DumpVar.c
+++ b/src/DumpVar.c
@@ -11,7 +11,7 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusIO_IOJpeg_DumpVar_c)
-static int IOJpeg_Output (cGH *GH,
+static int IOJpeg_Output (const cGH *GH,
int vindex,
CCTK_REAL *data,
int sdim,
@@ -19,7 +19,7 @@ static int IOJpeg_Output (cGH *GH,
FILE *fid);
-int IOJpeg_DumpVar (cGH *GH,
+int IOJpeg_DumpVar (const cGH *GH,
int vindex,
int timelevel,
IOJpegGeo_t *geo,
@@ -118,17 +118,25 @@ int IOJpeg_DumpVar (cGH *GH,
-static int IOJpeg_Output (cGH *GH,
+static int IOJpeg_Output (const cGH *GH,
int vindex,
CCTK_REAL *data,
int sdim,
int *hsize,
FILE *fid)
{
- DECLARE_CCTK_PARAMETERS
-
unsigned char *dataout=(unsigned char *)malloc(3*hsize[0]*hsize[1]);
CCTK_REAL min,max;
+ /*** FIXME: can CCTK_Reduce() have a 'const cGH *' parameter ?? ***/
+ union
+ {
+ const cGH *const_ptr;
+ cGH *non_const_ptr;
+ } GH_fake_const;
+ DECLARE_CCTK_PARAMETERS
+
+
+ GH_fake_const.const_ptr = GH;
if (sdim!=2) return(-1);
@@ -141,10 +149,10 @@ static int IOJpeg_Output (cGH *GH,
{
int reduction_handle;
reduction_handle = CCTK_ReductionHandle ("maximum");
- CCTK_Reduce (GH, 0, reduction_handle, 1,
+ CCTK_Reduce (GH_fake_const.non_const_ptr, 0, reduction_handle, 1,
CCTK_VARIABLE_REAL,&max, 1, vindex);
reduction_handle = CCTK_ReductionHandle ("minimum");
- CCTK_Reduce (GH, 0, reduction_handle, 1,
+ CCTK_Reduce (GH_fake_const.non_const_ptr, 0, reduction_handle, 1,
CCTK_VARIABLE_REAL,&min, 1, vindex);
}
@@ -166,6 +174,7 @@ static int IOJpeg_Output (cGH *GH,
fid);
}
- free(dataout);
- return(1);
+ free (dataout);
+
+ return (1);
}