From 2c294a2c35524f87c480668a04469cb7355adc2f Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 23 Oct 2002 09:08:31 +0000 Subject: Fix to output complex variables in xgraph format. This closes PR CactusBase/1264. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@134 94b1c47f-dcfd-45ef-a468-0854c0e9e350 --- src/Write1D.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Write1D.c b/src/Write1D.c index 46cb6b9..f4d73d5 100644 --- a/src/Write1D.c +++ b/src/Write1D.c @@ -23,6 +23,7 @@ #include "cctk.h" #include "cctk_Parameters.h" #include "Hyperslab.h" +#include "util_Table.h" #include "CactusBase/IOUtil/src/ioGH.h" #include "CactusBase/IOUtil/src/ioutil_AdvertisedFiles.h" #include "ioASCIIGH.h" @@ -46,20 +47,21 @@ CCTK_FILEVERSION(CactusBase_IOASCII_Write1D_c) const CCTK_REAL *_coord = (const CCTK_REAL *) hdata[1]; \ \ \ - for (_h = hstart; _h < hstride * hsize; _h += hstride) \ + for (_h = hstart; _h < hsize; _h++) \ { \ if (_coord) \ { \ - fprintf (file, fmt, (double) _coord[_h], (c_type) _hdata[_h]); \ + fprintf (file, fmt, (double) _coord[_h], \ + (c_type) _hdata[_h * hstride]); \ } \ else \ { \ - fprintf (file, fmt, _h, (c_type) _hdata[_h]); \ + fprintf (file, fmt, _h, (c_type) _hdata[_h * hstride]); \ } \ \ if (is_complex && hstride == 1) \ { \ - fprintf (file, format[2], (c_type) _hdata[_h+1]); \ + fprintf (file, format[2], (c_type) _hdata[_h + 1]); \ } \ fputc ('\n', file); \ } \ @@ -128,7 +130,7 @@ int IOASCII_Write1D (const cGH *GH, int vindex, const char *alias) { asciiioGH *myGH; int do_dir[4], coord_index[3]; - int i, dir, myproc, groupindex, have_coords; + int i, dir, myproc, groupindex, have_coords, mapping, table; #if 0 int lower, upper; #endif @@ -142,7 +144,7 @@ int IOASCII_Write1D (const cGH *GH, int vindex, const char *alias) CCTK_REAL offset; CCTK_REAL coord_lower[3]; CCTK_INT *origin, *direction; - CCTK_INT mapping, hsize, extent; + CCTK_INT hsize, extent; CCTK_INT vindices[2]; void *hdata[2]; DECLARE_CCTK_PARAMETERS @@ -330,16 +332,20 @@ fprintf (stderr, "%d/%d\n", origin[dir], extent); memset (origin, 0, gdata.dim * sizeof (CCTK_INT)); } - - + table = out_physical_boundaries ? + Util_TableCreateFromString ("with_ghostzones = 1") : -1; mapping = Hyperslab_DefineGlobalMappingByIndex (GH, vindex, 1, direction, origin, &extent, NULL, /* downsample */ - -1, /* table handle */ + table, NULL /* conversion fn */, &hsize); + if (table >= 0) + { + Util_TableDestroy (table); + } if (mapping < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, -- cgit v1.2.3