diff options
Diffstat (limited to 'src/WriteScalar.c')
-rw-r--r-- | src/WriteScalar.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/WriteScalar.c b/src/WriteScalar.c index 118b48b..51986e8 100644 --- a/src/WriteScalar.c +++ b/src/WriteScalar.c @@ -147,19 +147,9 @@ static int IOBasic_WriteScalarGA (const cGH *GH, int vindex, const char *alias) char format_str[15]; const char *file_extension; iobasic_reduction_t *reduction; - /*** FIXME: can CCTK_Reduce() have a 'const cGH *' parameter ?? ***/ - union - { - const cGH *const_ptr; - cGH *non_const_ptr; - } GH_fake_const; DECLARE_CCTK_PARAMETERS - /* this union helps us to avoid compiler warning about discarding - the const qualifier from a pointer target type */ - GH_fake_const.const_ptr = GH; - /* set output format */ sprintf (format_str, "%%%s\t%%%s\n", out_format, out_format); @@ -167,15 +157,14 @@ static int IOBasic_WriteScalarGA (const cGH *GH, int vindex, const char *alias) file_extension = CCTK_Equals (outScalar_style, "gnuplot") ? ".asc" : ".xg"; /* get the GH extension handle for IOBasic */ - myGH = (iobasicGH *) CCTK_GHExtension (GH, "IOBasic"); + myGH = CCTK_GHExtension (GH, "IOBasic"); reduction = myGH->scalar_reductions[vindex].reductions; /* now loop over all reduction operators */ while (reduction) { /* do the reduction (all processors) */ - reduction->is_valid = CCTK_Reduce (GH_fake_const.non_const_ptr, 0, - reduction->handle, 1, + reduction->is_valid = CCTK_Reduce (GH, 0, reduction->handle, 1, CCTK_VARIABLE_REAL, &reduction->value, 1, vindex) == 0; if (! reduction->is_valid) @@ -190,9 +179,9 @@ static int IOBasic_WriteScalarGA (const cGH *GH, int vindex, const char *alias) if (new_filename_scheme) { /* allocate filename string buffer and build the filename */ - filename = (char *) malloc (strlen (myGH->out_dir) + - strlen (alias) + strlen (reduction->name) + - strlen (file_extension) + 2); + filename = malloc (strlen (myGH->out_dir) + + strlen (alias) + strlen (reduction->name) + + strlen (file_extension) + 2); sprintf (filename, "%s%s_%s%s", myGH->out_dir, alias, reduction->name, file_extension); } @@ -221,8 +210,8 @@ static int IOBasic_WriteScalarGA (const cGH *GH, int vindex, const char *alias) } /* allocate filename string buffer and build the filename */ - filename = (char *) malloc (strlen (myGH->out_dir) + - strlen (alias) + strlen (file_extension)+5); + filename = malloc (strlen (myGH->out_dir) + + strlen (alias) + strlen (file_extension)+5); sprintf (filename, "%s%s_%s.tl", myGH->out_dir, alias, file_extension); } @@ -308,7 +297,7 @@ static int IOBasic_WriteScalarGS (const cGH *GH, int vindex, const char *alias) sprintf (format_str_int, "%%%s\t%%d\n", out_format); /* get the GH extensions for IOBasic */ - myGH = (iobasicGH *) CCTK_GHExtension (GH, "IOBasic"); + myGH = CCTK_GHExtension (GH, "IOBasic"); /* set the output file extension according to the output style */ if (new_filename_scheme) @@ -321,8 +310,8 @@ static int IOBasic_WriteScalarGS (const cGH *GH, int vindex, const char *alias) } /* build the output filename */ - filename = (char *) malloc (strlen (myGH->out_dir) + strlen (alias) + - strlen (file_extension) + 1); + filename = malloc (strlen (myGH->out_dir) + strlen (alias) + + strlen (file_extension) + 1); sprintf (filename, "%s%s%s", myGH->out_dir, alias, file_extension); /* create/reopen the file */ @@ -382,8 +371,8 @@ static FILE *OpenScalarFile (const cGH *GH, /* get the GH extension handles for IOUtil and IOBasic */ - myGH = (iobasicGH *) CCTK_GHExtension (GH, "IOBasic"); - ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO"); + myGH = CCTK_GHExtension (GH, "IOBasic"); + ioUtilGH = CCTK_GHExtension (GH, "IO"); /* get the variable's full name */ fullname = CCTK_FullName (vindex); |