From b9be6e119cc0102347d929a2382f2f34176e00ef Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 4 Oct 2006 14:43:37 +0000 Subject: Make only optional use of aliased function Coord_GroupSystem(). git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@199 94b1c47f-dcfd-45ef-a468-0854c0e9e350 --- interface.ccl | 2 +- src/Write1D.c | 20 ++++++++++++-------- src/Write2D.c | 20 ++++++++++++-------- src/Write3D.c | 20 ++++++++++++-------- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/interface.ccl b/interface.ccl index 38c8a4d..cb95317 100644 --- a/interface.ccl +++ b/interface.ccl @@ -52,4 +52,4 @@ CCTK_INT FUNCTION Coord_GroupSystem \ (CCTK_POINTER_TO_CONST IN GH, \ CCTK_STRING IN groupname) -REQUIRES FUNCTION Coord_GroupSystem +USES FUNCTION Coord_GroupSystem diff --git a/src/Write1D.c b/src/Write1D.c index 999e583..7779c86 100644 --- a/src/Write1D.c +++ b/src/Write1D.c @@ -191,16 +191,20 @@ int IOASCII_Write1D (const cGH *GH, int vindex, const char *alias) return (0); } - /* get the coordinate system associated with this grid variable */ - groupname = CCTK_GroupName (gindex); - coord_system_handle = Coord_GroupSystem (GH, groupname); - free (groupname); - dir = gdata.dim < 3 ? gdata.dim : 3; - have_coords = coord_system_handle >= 0 && - Util_TableGetIntArray (coord_system_handle, dir, - coord_handles, "COORDINATES") >= 0; + have_coords = CCTK_IsFunctionAliased ("Coord_GroupSystem"); + if (have_coords) + { + /* get the coordinate system associated with this grid variable */ + groupname = CCTK_GroupName (gindex); + coord_system_handle = Coord_GroupSystem (GH, groupname); + free (groupname); + + have_coords = coord_system_handle >= 0 && + Util_TableGetIntArray (coord_system_handle, dir, + coord_handles, "COORDINATES") >= 0; + } if (have_coords) { /* get the coordinate functions and coordinate physical minimum */ diff --git a/src/Write2D.c b/src/Write2D.c index c72e9cf..fa8246f 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -170,16 +170,20 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias) /* in general: maxdir = gdata.dim * (gdata.dim - 1) / 2; */ maxdir = gdata.dim == 2 ? 1 : 3; - /* get the coordinate system associated with this grid variable */ - groupname = CCTK_GroupName (gindex); - coord_system_handle = Coord_GroupSystem (GH, groupname); - free (groupname); - dir = gdata.dim < 3 ? gdata.dim : 3; - have_coords = coord_system_handle >= 0 && - Util_TableGetIntArray (coord_system_handle, dir, - coord_handles, "COORDINATES") >= 0; + have_coords = CCTK_IsFunctionAliased ("Coord_GroupSystem"); + if (have_coords) + { + /* get the coordinate system associated with this grid variable */ + groupname = CCTK_GroupName (gindex); + coord_system_handle = Coord_GroupSystem (GH, groupname); + free (groupname); + + have_coords = coord_system_handle >= 0 && + Util_TableGetIntArray (coord_system_handle, dir, + coord_handles, "COORDINATES") >= 0; + } if (have_coords) { /* get the coordinate functions and coordinate physical minimum */ diff --git a/src/Write3D.c b/src/Write3D.c index d4304f5..52fe554 100644 --- a/src/Write3D.c +++ b/src/Write3D.c @@ -157,15 +157,19 @@ int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias) return (-1); } - /* 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; + have_coords = CCTK_IsFunctionAliased ("Coord_GroupSystem"); + if (have_coords) + { + /* get the coordinate system associated with this grid variable */ + 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 */ -- cgit v1.2.3