diff options
author | tradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a> | 2006-10-04 14:44:53 +0000 |
---|---|---|
committer | tradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a> | 2006-10-04 14:44:53 +0000 |
commit | 26630e62ebef2152ad01721979cbb82887390a7b (patch) | |
tree | d60e007b36261b762020c0d0342aa7c6549d843b /src/Utils.c | |
parent | 6593d63390bf4493aac9bbd1f530a152b71d567c (diff) |
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
Diffstat (limited to 'src/Utils.c')
-rw-r--r-- | src/Utils.c | 36 |
1 files changed, 22 insertions, 14 deletions
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"); |