diff options
author | tradke <tradke@1c20744c-e24a-42ec-9533-f5004cb800e5> | 2003-02-10 17:19:25 +0000 |
---|---|---|
committer | tradke <tradke@1c20744c-e24a-42ec-9533-f5004cb800e5> | 2003-02-10 17:19:25 +0000 |
commit | bfcdabcd04c25991fbdd2aa22eac183fdc7c71fe (patch) | |
tree | bddc53efa6905ca159dc446270c4dabe9d407c1c | |
parent | d05788a57ae1d662dfde8de594d71129cc6ad025 (diff) |
Tolerate negative variable indices which should be treated as a no-op for the
corresponding input array entry.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHInterp/trunk@49 1c20744c-e24a-42ec-9533-f5004cb800e5
-rw-r--r-- | src/InterpGridArrays.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/InterpGridArrays.c b/src/InterpGridArrays.c index 3fc2ab0..39de534 100644 --- a/src/InterpGridArrays.c +++ b/src/InterpGridArrays.c @@ -267,8 +267,8 @@ int PUGHInterp_InterpGridArrays (const cGH *GH, /* allocate some temporary arrays */ origin_local = malloc (2 * N_dims * sizeof (CCTK_REAL)); delta = origin_local + N_dims; - input_arrays = malloc (N_input_arrays * sizeof (void *)); - input_array_dims = malloc ((N_dims + 2*N_input_arrays) * sizeof (CCTK_INT)); + input_arrays = calloc (N_input_arrays, sizeof (void *)); + input_array_dims = calloc (N_dims + 2*N_input_arrays, sizeof (CCTK_INT)); input_array_types = input_array_dims + N_dims; input_array_time_levels = input_array_dims + N_dims + N_input_arrays; @@ -309,6 +309,13 @@ int PUGHInterp_InterpGridArrays (const cGH *GH, (but their dimensionality can be less) */ for (i = retval = 0; i < N_input_arrays; i++) { + /* tolerate negative variable indices which should be treated as no-ops + for the corresponding input array entries */ + if (input_array_indices[i] < 0) + { + continue; + } + if (CCTK_GroupDynamicData (GH, CCTK_GroupIndexFromVarI(input_array_indices[i]), &group_data) < 0) |