aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-03-18 15:30:47 -0700
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:35 +0000
commit04e117a7916eab107a03ed682d7262332805b423 (patch)
treea03b487bd94c18c0b5bf072b06b06eed8fa8e541
parentece361c5e3f8027eda95ff4ce4bdf969aac4913b (diff)
CarpetLib: Check for nans when converting to grid point indices
-rw-r--r--Carpet/CarpetLib/src/gh.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/gh.cc b/Carpet/CarpetLib/src/gh.cc
index 05c1b55ea..5ecc90a5c 100644
--- a/Carpet/CarpetLib/src/gh.cc
+++ b/Carpet/CarpetLib/src/gh.cc
@@ -348,6 +348,12 @@ locate_position (rvect const & rpos,
assert (ml>=0 and ml<mglevels());
assert (minrl>=0 and minrl<=maxrl and maxrl<=reflevels());
+ if (any(not CarpetLib::good::isfinite(rpos))) {
+ rl = -1;
+ c = -1;
+ return;
+ }
+
// Try finer levels first
for (rl = maxrl-1; rl >= minrl; --rl) {