From 26630e62ebef2152ad01721979cbb82887390a7b Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 4 Oct 2006 14:44:53 +0000 Subject: Make only optional use of aliased function Coord_GetDefaultSystem(). git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@249 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a --- interface.ccl | 2 +- src/Utils.c | 36 ++++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/interface.ccl b/interface.ccl index 8ffef18..0fe09ba 100644 --- a/interface.ccl +++ b/interface.ccl @@ -10,7 +10,7 @@ CCTK_INT FUNCTION Coord_GetDefaultSystem \ (CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN systemdim) -REQUIRES FUNCTION Coord_GetDefaultSystem +USES FUNCTION Coord_GetDefaultSystem CCTK_INT FUNCTION IO_TruncateOutputFiles \ diff --git a/src/Utils.c b/src/Utils.c index d1def3d..0b22bd9 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -321,19 +321,23 @@ int IOUtil_1DLines (const cGH *GH, CCTK_REAL *const *const origin_phys, int *const *slice_center) { - int dim, dir, coord_system_handle, have_coords, have_origin_index, len; + int dim, dir, coord_system_handle = -1, have_coords, have_origin_index, len; char *coord_system_name; - CCTK_INT *coord_handles; + CCTK_INT *coord_handles = NULL; CCTK_REAL *lower, *upper, *delta; /* get the default coordinate system associated with this grid dimension */ coord_system_name = NULL; - coord_system_handle = Coord_GetDefaultSystem (GH, num_dims); - coord_handles = malloc (num_dims * sizeof (CCTK_INT)); - have_coords = coord_system_handle >= 0 && - Util_TableGetIntArray (coord_system_handle, num_dims, - coord_handles, "COORDINATES") >= 0; + have_coords = CCTK_IsFunctionAliased ("Coord_GetDefaultSystem"); + if (have_coords) + { + coord_system_handle = Coord_GetDefaultSystem (GH, num_dims); + coord_handles = malloc (num_dims * sizeof (CCTK_INT)); + have_coords = coord_system_handle >= 0 && + Util_TableGetIntArray (coord_system_handle, num_dims, + coord_handles, "COORDINATES") >= 0; + } if (have_coords) { len = Util_TableGetString (coord_system_handle, 0, NULL, "NAME"); @@ -500,19 +504,23 @@ int IOUtil_2DPlanes (const cGH *GH, const CCTK_REAL *origin_phys, int *slice_center) { - int have_coords, have_origin_index, len, coord_system_handle, dir; + int have_coords, have_origin_index, len, coord_system_handle = -1, dir; char *coord_system_name; - CCTK_INT *coord_handles; + CCTK_INT *coord_handles = NULL; CCTK_REAL *lower, *upper, *delta; /* get the default coordinate system associated with this grid dimension */ coord_system_name = NULL; - coord_system_handle = Coord_GetDefaultSystem (GH, num_dims); - coord_handles = malloc (num_dims * sizeof (CCTK_INT)); - have_coords = coord_system_handle >= 0 && - Util_TableGetIntArray (coord_system_handle, num_dims, - coord_handles, "COORDINATES") >= 0; + have_coords = CCTK_IsFunctionAliased ("Coord_GetDefaultSystem"); + if (have_coords) + { + coord_system_handle = Coord_GetDefaultSystem (GH, num_dims); + coord_handles = malloc (num_dims * sizeof (CCTK_INT)); + have_coords = coord_system_handle >= 0 && + Util_TableGetIntArray (coord_system_handle, num_dims, + coord_handles, "COORDINATES") >= 0; + } if (have_coords) { len = Util_TableGetString (coord_system_handle, 0, NULL, "NAME"); -- cgit v1.2.3