aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@eff87b29-5268-4891-90a3-a07138403961>2001-11-05 15:23:52 +0000
committertradke <tradke@eff87b29-5268-4891-90a3-a07138403961>2001-11-05 15:23:52 +0000
commit483c228a6183b80970c9361464141d26baef6e87 (patch)
tree4e7d8bec2454256a86e819a691d284fe5b092e96
parent51703c806aee00d866f7c7dfba66f6e1678a28d7 (diff)
Added const qualifier to the 'cGH *' argument of some more IO functions.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusIO/IOJpeg/trunk@47 eff87b29-5268-4891-90a3-a07138403961
-rw-r--r--src/DumpVar.c27
-rw-r--r--src/IOJpeg.h14
-rw-r--r--src/Output2D.c8
-rw-r--r--src/ParseGeometry.c2
-rw-r--r--src/Startup.c15
-rw-r--r--src/Write2D.c2
6 files changed, 38 insertions, 30 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);
}
diff --git a/src/IOJpeg.h b/src/IOJpeg.h
index 89871b7..0fbda45 100644
--- a/src/IOJpeg.h
+++ b/src/IOJpeg.h
@@ -43,14 +43,14 @@ typedef struct IOJpegGH {
} IOJpegGH;
/* function prototypes */
-int IOJpeg_Output2DGH (cGH *GH);
-int IOJpeg_Output2DVarAs (cGH *GH, const char *fullname, const char *alias);
-int IOJpeg_TimeFor2D (cGH *GH, int vindex);
-int IOJpeg_TriggerOutput2D (cGH *GH, int vindex);
-int IOJpeg_Write2D (cGH *GH, int vindex, const char *alias);
-void IOJpeg_DefaultGeo(cGH *GH, int sdim, IOJpegGeo_t *geo);
+int IOJpeg_Output2DGH (const cGH *GH);
+int IOJpeg_Output2DVarAs (const cGH *GH, const char *fullname, const char *alias);
+int IOJpeg_TimeFor2D (const cGH *GH, int vindex);
+int IOJpeg_TriggerOutput2D (const cGH *GH, int vindex);
+int IOJpeg_Write2D (const cGH *GH, int vindex, const char *alias);
+void IOJpeg_DefaultGeo(const cGH *GH, int sdim, IOJpegGeo_t *geo);
int IOJpeg_SetDirection (IOJpegGeo_t *geometry, int direction);
-int IOJpeg_DumpVar (cGH *GH, int vindex, int timelevel, IOJpegGeo_t *geo, FILE *fid);
+int IOJpeg_DumpVar (const cGH *GH, int vindex, int timelevel, IOJpegGeo_t *geo, FILE *fid);
int WriteJPEGToFileRGB(int nx, /* width of image in pixels */
int ny, /* height of the image in pixels */
diff --git a/src/Output2D.c b/src/Output2D.c
index 0c63945..a548ce4 100644
--- a/src/Output2D.c
+++ b/src/Output2D.c
@@ -30,7 +30,7 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg);
@endhistory
@@*/
-int IOJpeg_Output2DGH (cGH *GH)
+int IOJpeg_Output2DGH (const cGH *GH)
{
DECLARE_CCTK_PARAMETERS
int i;
@@ -82,7 +82,7 @@ int IOJpeg_Output2DGH (cGH *GH)
}
-int IOJpeg_Output2DVarAs (cGH *GH, const char *fullname, const char *alias)
+int IOJpeg_Output2DVarAs (const cGH *GH, const char *fullname, const char *alias)
{
DECLARE_CCTK_PARAMETERS
int vindex,ierr=0;
@@ -109,7 +109,7 @@ int IOJpeg_Output2DVarAs (cGH *GH, const char *fullname, const char *alias)
return (ierr);
}
-int IOJpeg_TimeFor2D (cGH *GH, int vindex)
+int IOJpeg_TimeFor2D (const cGH *GH, int vindex)
{
IOJpegGH *myGH;
@@ -142,7 +142,7 @@ int IOJpeg_TimeFor2D (cGH *GH, int vindex)
return (1);
}
-int IOJpeg_TriggerOutput2D (cGH *GH, int vindex)
+int IOJpeg_TriggerOutput2D (const cGH *GH, int vindex)
{
DECLARE_CCTK_PARAMETERS
IOJpegGH *myGH;
diff --git a/src/ParseGeometry.c b/src/ParseGeometry.c
index 860ec14..556c69d 100644
--- a/src/ParseGeometry.c
+++ b/src/ParseGeometry.c
@@ -14,7 +14,7 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusIO_IOJpeg_ParseGeometry_c)
-void IOJpeg_DefaultGeo(cGH *GH, int sdim, IOJpegGeo_t *geo) {
+void IOJpeg_DefaultGeo(const cGH *GH, int sdim, IOJpegGeo_t *geo) {
DECLARE_CCTK_PARAMETERS
asciiioGH *asGH;
diff --git a/src/Startup.c b/src/Startup.c
index 895bbdd..e5c19ae 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -3,19 +3,18 @@
#include "cctk.h"
#include "cctk_Parameters.h"
-void IOJpeg_Startup (void);
-int IOJpeg_Output2DGH(cGH *GH);
-int IOJpeg_TriggerOutput2D(cGH *GH, int);
-int IOJpeg_TimeFor2D(cGH *GH, int);
-int IOJpeg_Output2DVarAs(cGH *GH, const char *var, const char *alias);
-
-void *IOJpeg_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH);
-int IOJpeg_InitGH (cGH *GH);
+#include "IOJpeg.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusIO_IOJpeg_Startup_c)
+
+void *IOJpeg_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH);
+int IOJpeg_InitGH (cGH *GH);
+
+void IOJpeg_Startup (void);
+
void IOJpeg_Startup (void)
{
DECLARE_CCTK_PARAMETERS
diff --git a/src/Write2D.c b/src/Write2D.c
index 027a7f8..985c856 100644
--- a/src/Write2D.c
+++ b/src/Write2D.c
@@ -70,7 +70,7 @@ CCTK_FILEVERSION(CactusIO_IOJpeg_Write2D_c)
@endhistory
@@*/
-int IOJpeg_Write2D (cGH *GH, int vindex, const char *alias)
+int IOJpeg_Write2D (const cGH *GH, int vindex, const char *alias)
{
DECLARE_CCTK_PARAMETERS
int timelevel;