From bdc9e64dc21109384094c8281022037471080d9b Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 23 Oct 2002 09:06:16 +0000 Subject: Fix in outputting also the imaginary part of complex variables. This closes PR CactusBase/1265. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@133 94b1c47f-dcfd-45ef-a468-0854c0e9e350 --- src/Write2D.c | 14 +++++++++++--- src/Write3D.c | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Write2D.c b/src/Write2D.c index 0274c12..07c07e2 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -14,6 +14,7 @@ #include "cctk.h" #include "cctk_Parameters.h" +#include "util_Table.h" #include "Hyperslab.h" #include "CactusBase/IOUtil/src/ioGH.h" #include "CactusBase/IOUtil/src/ioutil_AdvertisedFiles.h" @@ -126,6 +127,7 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias) asciiioGH *myGH; int i, total_hsize, num_requested_hslabs, num_returned_hslabs; int dir, dir_i, dir_j, maxdir, myproc, groupindex, have_coords; + int mapping, table; cGroup gdata; int coord_index[3]; CCTK_REAL coord_lower[3]; @@ -134,7 +136,6 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias) char header[40], buffer[30]; char *fullname; int extent_int[3]; - CCTK_INT mapping; CCTK_REAL offset[2]; CCTK_INT vindices[3], origin[3], extent[2], direction[6], hsize[2]; void *hdata[3]; @@ -256,14 +257,21 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias) memset (direction, 0, sizeof (direction)); direction[dir_i] = direction[gdata.dim + dir_j] = 1; + table = out_physical_boundaries ? + Util_TableCreateFromString ("with_ghostzones = 1") : -1; + mapping = Hyperslab_DefineGlobalMappingByIndex (GH, vindex, 2, 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, @@ -517,7 +525,7 @@ static void WriteData (int vtype, DECLARE_CCTK_PARAMETERS - is_complex = strncmp (CCTK_VarTypeName (vtype), "CCTK_COMPLEX", 12) == 0; + is_complex = !strncmp (CCTK_VarTypeName (vtype), "CCTK_VARIABLE_COMPLEX", 21); sprintf (complex_fmt_string, "\t\t%%%s", out_format); /* print out header */ diff --git a/src/Write3D.c b/src/Write3D.c index 8375616..5e2de18 100644 --- a/src/Write3D.c +++ b/src/Write3D.c @@ -14,6 +14,7 @@ #include "cctk.h" #include "cctk_Parameters.h" +#include "util_Table.h" #include "Hyperslab.h" #include "CactusBase/IOUtil/src/ioGH.h" #include "CactusBase/IOUtil/src/ioutil_AdvertisedFiles.h" @@ -135,7 +136,7 @@ int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias) void *hdata[4]; int extent_int[3]; CCTK_REAL offset[3]; - CCTK_INT mapping; + int mapping, table; CCTK_INT vindices[4], extent[3], hsize[3]; const CCTK_INT origin[] = {0, 0, 0}, direction[] = {1, 0, 0, 0, 1, 0, 0, 0, 1}; @@ -213,15 +214,22 @@ int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias) extent[i] = extent_int[i]; } + table = out_physical_boundaries ? + Util_TableCreateFromString ("with_ghostzones = 1") : -1; + /* get the hyperslab mapping */ mapping = Hyperslab_DefineGlobalMappingByIndex (GH, vindex, 3, 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, @@ -422,7 +430,7 @@ static void WriteData (int vtype, return; } - is_complex = strncmp (CCTK_VarTypeName (vtype), "CCTK_COMPLEX", 12) == 0; + is_complex = !strncmp (CCTK_VarTypeName (vtype), "CCTK_VARIABLE_COMPLEX", 21); /* print out header */ fputs (header, file); -- cgit v1.2.3