aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@eff87b29-5268-4891-90a3-a07138403961>2002-05-27 08:18:27 +0000
committertradke <tradke@eff87b29-5268-4891-90a3-a07138403961>2002-05-27 08:18:27 +0000
commit2a2cf1a50ecfab73a2b2c926e30ae6920a019e83 (patch)
tree33e2a072bb5cbf93d4ae1ce74bb32e98eb22739b
parent7a1ae55dcd0f351822346df6ecdd4c5312d1a747 (diff)
Make use of Tom's extensions to parameter declarations:
USE some_parameter AS alias. git-svn-id: http://svn.cactuscode.org/arrangements/CactusIO/IOJpeg/trunk@70 eff87b29-5268-4891-90a3-a07138403961
-rw-r--r--param.ccl6
-rw-r--r--src/Output.c19
-rw-r--r--src/Startup.c35
-rw-r--r--src/Write.c12
-rw-r--r--src/ioJpegGH.h3
-rw-r--r--src/make.code.defn2
6 files changed, 35 insertions, 42 deletions
diff --git a/param.ccl b/param.ccl
index 7dc3157..eecad08 100644
--- a/param.ccl
+++ b/param.ccl
@@ -2,7 +2,7 @@
# $Header$
#############################################################################
-### declare IOASCII parameters
+### declare IOJpeg parameters
#############################################################################
private:
@@ -129,8 +129,8 @@ INT out2D_xyplane_zi "z-index (from 0) for 2D planes in xy" STEERABLE = RECOVER
#############################################################################
shares: IO
-#FIXME: want USES STRING out_dir AS default_out_dir
-#FIXME: want USES INT out_every AS default_out_every
+USES STRING out_dir AS io_out_dir
+USES INT out_every AS io_out_every
USES KEYWORD verbose
USES REAL out_yzplane_x
USES REAL out_xzplane_y
diff --git a/src/Output.c b/src/Output.c
index 214ec12..1f2c8ff 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -17,7 +17,7 @@
#include "ioJpegGH.h"
/* the rcs ID and its dummy function to use it */
-static const char *rcsid = "$Id$";
+static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusIO_IOJpeg_Output_c)
/* define this if you want debug output */
@@ -213,7 +213,7 @@ int IOJpeg_TimeFor (const cGH *GH, int vindex)
int IOJpeg_TriggerOutput (const cGH *GH, int vindex)
{
int retval;
- ioJpegGH *myGH;
+ const ioJpegGH *myGH;
/* do the output */
@@ -221,7 +221,7 @@ int IOJpeg_TriggerOutput (const cGH *GH, int vindex)
if (retval == 0)
{
/* register variable as having output this iteration */
- myGH = (ioJpegGH *) CCTK_GHExtension (GH, "IOJpeg");
+ myGH = (const ioJpegGH *) CCTK_GHExtension (GH, "IOJpeg");
myGH->out_last[vindex] = GH->cctk_iteration;
}
@@ -229,7 +229,9 @@ int IOJpeg_TriggerOutput (const cGH *GH, int vindex)
}
-/**************************** local functions ******************************/
+/********************************************************************
+ ******************** Internal Routines ************************
+ ********************************************************************/
/* check if steerable parameters have changed */
static void CheckSteerableParameters (ioJpegGH *myGH)
{
@@ -240,12 +242,7 @@ static void CheckSteerableParameters (ioJpegGH *myGH)
/* how often to output */
i = myGH->out_every_default;
- myGH->out_every_default = out_every;
- if (myGH->out_every_default < 0)
- {
- myGH->out_every_default = *(const CCTK_INT *)
- CCTK_ParameterGet ("out_every", CCTK_ImplementationThorn ("IO"), NULL);
- }
+ myGH->out_every_default = out_every >= 0 ? out_every : io_out_every;
/* report if frequency changed */
if (myGH->out_every_default != i && ! CCTK_Equals (verbose, "none"))
@@ -346,7 +343,7 @@ static int CheckOutputVar (int vindex)
static void SetOutputFlag (int vindex, const char *optstring, void *arg)
{
char *endptr;
- ioJpegGH *myGH = (ioJpegGH *) arg;
+ const ioJpegGH *myGH = (const ioJpegGH *) arg;
if (CheckOutputVar (vindex) == 0)
diff --git a/src/Startup.c b/src/Startup.c
index d7406c0..10bbe54 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -2,9 +2,9 @@
@file Startup.c
@date Thu 18 April 2002
@author Thomas Radke
- @desc
+ @desc
Startup routines for IOJpeg.
- @enddesc
+ @enddesc
@version $Id$
@@*/
@@ -19,7 +19,7 @@
#include "ioJpegGH.h"
/* the rcs ID and its dummy function to use it */
-static const char *rcsid = "$Id$";
+static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusIO_IOJpeg_Startup_c)
@@ -32,25 +32,24 @@ void IOJpeg_Startup (void);
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
-static void *IOJpeg_SetupGH (tFleshConfig *config, int conv_level, cGH *GH);
+static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH);
/*@@
@routine IOJpeg_Startup
@date Thu 18 April 2002
@author Thomas Radke
- @desc
+ @desc
The startup registration routine for IOJpeg.
Registers the GH extensions needed for IOJpeg
along with its setup routine.
- @enddesc
+ @enddesc
@calls CCTK_RegisterGHExtension
CCTK_RegisterGHExtensionSetupGH
@@*/
void IOJpeg_Startup (void)
{
- CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("IOJpeg"),
- IOJpeg_SetupGH);
+ CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension("IOJpeg"), SetupGH);
}
@@ -58,12 +57,12 @@ void IOJpeg_Startup (void)
******************** Internal Routines ************************
********************************************************************/
/*@@
- @routine IOJpeg_SetupGH
+ @routine SetupGH
@date Thu 18 April 2002
@author Thomas Radke
- @desc
+ @desc
Allocates and sets up IOJpeg's GH extension structure
- @enddesc
+ @enddesc
@calls CCTK_RegisterIOMethod
CCTK_RegisterIOMethodOutputGH
@@ -82,7 +81,7 @@ void IOJpeg_Startup (void)
@vio unused
@endvar
@var GH
- @vdesc Pointer to CCTK grid hierarchy
+ @vdesc pointer to CCTK grid hierarchy
@vtype cGH *
@vio in
@endvar
@@ -92,7 +91,7 @@ void IOJpeg_Startup (void)
pointer to the allocated GH extension structure
@endreturndesc
@@*/
-static void *IOJpeg_SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
+static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
{
int i, numvars;
ioJpegGH *myGH;
@@ -102,16 +101,15 @@ static void *IOJpeg_SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
/* suppress compiler warnings about unused variables */
(void) (config + 0);
(void) (conv_level + 0);
- (void) (GH + 0);
/* allocate the GH extension and its components */
myGH = (ioJpegGH *) malloc (sizeof (ioJpegGH));
if (! myGH)
{
- CCTK_WARN (0, "IOJpeg_SetupGH: Unable to allocate memory for GH");
+ CCTK_WARN (0, "Unable to allocate memory for GH");
}
- /* register the IOJpeg routines as output methods */
+ /* register the IOJpeg routines as I/O method "IOJpeg" */
i = CCTK_RegisterIOMethod ("IOJpeg");
CCTK_RegisterIOMethodOutputGH (i, IOJpeg_OutputGH);
CCTK_RegisterIOMethodOutputVarAs (i, IOJpeg_OutputVarAs);
@@ -139,8 +137,7 @@ static void *IOJpeg_SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
/* get the name for IOJpeg's output directory */
if (*out_dir == 0)
{
- out_dir = *(const char **)
- CCTK_ParameterGet ("out_dir", CCTK_ImplementationThorn ("IO"), NULL);
+ out_dir = io_out_dir;
}
/* omit the directory if it's the current working dir */
@@ -159,7 +156,7 @@ static void *IOJpeg_SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
if (i < 0)
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "IOJpeg_SetupGH: problem creating IOJpeg output directory '%s'",
+ "Problem creating IOJpeg output directory '%s'",
myGH->out_dir);
}
else if (i >= 0 && CCTK_Equals (verbose, "full"))
diff --git a/src/Write.c b/src/Write.c
index 531e49d..aee3ded 100644
--- a/src/Write.c
+++ b/src/Write.c
@@ -19,7 +19,7 @@
#include "ioJpegGH.h"
/* the rcs ID and its dummy function to use it */
-static const char *rcsid = "$Id$";
+static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusIO_IOJpeg_Write_c)
@@ -45,7 +45,7 @@ static void WriteData (const cGH *GH, int vindex, const char *alias, int dim,
WriteData
@var GH
- @vdesc Pointer to CCTK GH
+ @vdesc pointer to CCTK GH
@vtype const cGH *
@vio in
@endvar
@@ -71,7 +71,7 @@ static void WriteData (const cGH *GH, int vindex, const char *alias, int dim,
@@*/
int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias)
{
- ioJpegGH *myGH;
+ const ioJpegGH *myGH;
int i, total_hsize;
int dir, dir_i, dir_j, maxdir, myproc, groupindex;
cGroup gdata;
@@ -107,7 +107,7 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias)
/* get the handle for IOJpeg extensions */
myproc = CCTK_MyProc (GH);
- myGH = (ioJpegGH *) CCTK_GHExtension (GH, "IOJpeg");
+ myGH = (const ioJpegGH *) CCTK_GHExtension (GH, "IOJpeg");
/* set the minimum/maximum for the colormap */
if (CCTK_Equals (colormap, "custom"))
@@ -235,7 +235,7 @@ static void WriteData (const cGH *GH, int vindex, const char *alias, int dim,
{
FILE *file;
unsigned char *dataout;
- ioJpegGH *myGH;
+ const ioJpegGH *myGH;
ioAdvertisedFileDesc advertised_file;
char *filename, *fullname;
char slicename[30];
@@ -243,7 +243,7 @@ static void WriteData (const cGH *GH, int vindex, const char *alias, int dim,
DECLARE_CCTK_PARAMETERS
- myGH = (ioJpegGH *) CCTK_GHExtension (GH, "IOJpeg");
+ myGH = (const ioJpegGH *) CCTK_GHExtension (GH, "IOJpeg");
/* allocate the RGB image buffer */
dataout = (unsigned char *) malloc (3 * hsize[0] * hsize[1]);
diff --git a/src/ioJpegGH.h b/src/ioJpegGH.h
index 2f3d849..41ae67d 100644
--- a/src/ioJpegGH.h
+++ b/src/ioJpegGH.h
@@ -4,14 +4,13 @@
@author Thomas Radke
@desc
The extensions to the GH structure from IOJpeg.
+ @enddesc
@version $Header$
@@*/
#ifndef IOJPEG_IOJPEGGH_H_
#define IOJPEG_IOJPEGGH_H_ 1
-#include "StoreNamedData.h"
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/make.code.defn b/src/make.code.defn
index 07c6877..704c484 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -1,4 +1,4 @@
-# Main make.code.defn file for thorn IOSkeleton
+# Main make.code.defn file for thorn IOJpeg
# $Header$
# Source files in this directory