aboutsummaryrefslogtreecommitdiff
path: root/src/Write3D.c
diff options
context:
space:
mode:
authortradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2004-05-01 21:19:43 +0000
committertradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2004-05-01 21:19:43 +0000
commit9bd4fce84980c2288099f34358853d07a3335238 (patch)
tree6f5a4c06f32b076b722d6cfff4e1d1e03dc2dfff /src/Write3D.c
parent1428cc9d574699f5d363807c327e8727c3973fc2 (diff)
Removed the hard-coded assumption of "cart%d" being the underlying coordinate
system. Now the coordinate functions provided by CoordBase are used to get the coordinate coordinate system associated with an output variable, as well as the physical coordinate ranges. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@168 94b1c47f-dcfd-45ef-a468-0854c0e9e350
Diffstat (limited to 'src/Write3D.c')
-rw-r--r--src/Write3D.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/Write3D.c b/src/Write3D.c
index 8db2f23..3220a13 100644
--- a/src/Write3D.c
+++ b/src/Write3D.c
@@ -124,13 +124,14 @@ static void WriteData (int vtype,
int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias)
{
int i, total_hsize;
- int myproc, groupindex, have_coords;
+ int myproc, gindex, have_coords;
int num_requested_hslabs, num_returned_hslabs;
char header[40], buffer[30];
char format[3][64];
FILE *file;
cGroup gdata;
- char *fullname;
+ CCTK_INT coord_system_handle, coord_handles[3];
+ char *fullname, *groupname;
void *hdata[4];
int extent_int[3];
CCTK_REAL offset[3];
@@ -143,11 +144,11 @@ int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias)
/* get the variable group information */
fullname = CCTK_FullName (vindex);
- groupindex = CCTK_GroupIndexFromVarI (vindex);
- CCTK_GroupData (groupindex, &gdata);
+ gindex = CCTK_GroupIndexFromVarI (vindex);
+ CCTK_GroupData (gindex, &gdata);
/* check if variable has storage assigned */
- if (! CCTK_QueryGroupStorageI (GH, groupindex))
+ if (! CCTK_QueryGroupStorageI (GH, gindex))
{
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"No IOASCII 3D output for '%s' (no storage)", fullname);
@@ -155,22 +156,24 @@ int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias)
return (-1);
}
- /* get the coordinate indices for CCTK_GF variables
- (CCTK_ARRAY variables never have coordinates associated) */
- vindices[0] = vindex;
- have_coords = gdata.grouptype == CCTK_GF;
+ /* get the coordinate system associated with this grid variable */
+ vindices[0] = vindex;
+ groupname = CCTK_GroupName (gindex);
+ coord_system_handle = Coord_GroupSystem (GH, groupname);
+ free (groupname);
+
+ have_coords = coord_system_handle >= 0 &&
+ Util_TableGetIntArray (coord_system_handle, 3,
+ coord_handles, "COORDINATES") >= 0;
if (have_coords)
{
+ /* get the coordinate functions and coordinate physical minimum */
for (i = 1; i <= 3; i++)
{
- vindices[i] = CCTK_CoordIndex (i, NULL, "cart3d");
+ vindices[i] = -1;
+ Util_TableGetInt (coord_handles[i-1], &vindices[i], "GAINDEX");
have_coords &= vindices[i] >= 0;
}
-
- if (! have_coords)
- {
- CCTK_WARN (8, "IOASCII_Write3D: No coordinate ranges found for 'card3d'");
- }
}
num_requested_hslabs = have_coords ? 4 : 1;