diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-06-03 03:20:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-06-03 03:20:00 +0000 |
commit | eefb8afc855277e4527176e1438f4bc63b1a8104 (patch) | |
tree | 1b59afe774cce477c5a99e7df4f228c970bcbb7a /Carpet/Carpet/src/Storage.cc | |
parent | 3920ab36db559670aece85307e4a5ed7e2b9aadb (diff) |
Carpet: Make QueryGroupStorage not abort
Return an error code instead of causing an assertion failure when an
illegal group is specified, or when grid function storage is queried
in global mode.
darcs-hash:20060603032047-dae7b-b219ec996d06afdd249f4b89bb79909cdc1ddd74.gz
Diffstat (limited to 'Carpet/Carpet/src/Storage.cc')
-rw-r--r-- | Carpet/Carpet/src/Storage.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Carpet/Carpet/src/Storage.cc b/Carpet/Carpet/src/Storage.cc index 1e564375f..5121b5cd3 100644 --- a/Carpet/Carpet/src/Storage.cc +++ b/Carpet/Carpet/src/Storage.cc @@ -262,9 +262,14 @@ namespace Carpet { if (groupname) { group = CCTK_GroupIndex(groupname); } - assert (group>=0 and group<CCTK_NumGroups()); + if (group<0 or group>=CCTK_NumGroups()) { + CCTK_WARN (1, "QueryGroupStorage: illegal group specified"); + return -1; + } int const grouptype = CCTK_GroupTypeI (group); - if (is_meta_mode() or is_global_mode()) assert (grouptype != CCTK_GF); + if (is_meta_mode() or is_global_mode()) { + if (grouptype == CCTK_GF) return -2; + } int const rl = grouptype == CCTK_GF ? reflevel : 0; // Return whether storage is allocated assert (groupdata.at(group).activetimelevels.at(mglevel).at(rl) != deadbeef); |