aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Haas <rhaas@tapir.caltech.edu>2013-10-11 11:56:50 -0700
committerRoland Haas <rhaas@tapir.caltech.edu>2013-10-11 23:49:08 -0700
commitc83793e7f141d969bad07757ed970aa053a3ad57 (patch)
tree3e0b9aba462bd208648377041f2f4b805403809c
parentbe2bd96c56aa6dd5b1fb6654b130f3e44e049e8e (diff)
Carpet: skip CheckFence routine if electric_fence is off
enumerating the variables is expensive enough to show up in the timer output
-rw-r--r--Carpet/Carpet/param.ccl4
-rw-r--r--Carpet/Carpet/src/CallFunction.cc4
2 files changed, 8 insertions, 0 deletions
diff --git a/Carpet/Carpet/param.ccl b/Carpet/Carpet/param.ccl
index 90aca4e83..6e24a05da 100644
--- a/Carpet/Carpet/param.ccl
+++ b/Carpet/Carpet/param.ccl
@@ -606,3 +606,7 @@ BOOLEAN adaptive_stepsize "Allow adaptive timestep sizes"
BOOLEAN use_unusedpoints_mask "Turn on storage and usage of 'unusedpoints_mask'" STEERABLE=recover
{
} "no"
+
+SHARES: CarpetLib
+
+USES BOOLEAN electric_fence
diff --git a/Carpet/Carpet/src/CallFunction.cc b/Carpet/Carpet/src/CallFunction.cc
index 224a66346..494f2864c 100644
--- a/Carpet/Carpet/src/CallFunction.cc
+++ b/Carpet/Carpet/src/CallFunction.cc
@@ -473,7 +473,11 @@ namespace Carpet {
void CheckFence (cGH const * const cctkGH, cFunctionData * attribute)
{
+ DECLARE_CCTK_PARAMETERS;
+
if (is_meta_mode()) return; // meta mode has no accessible variables
+ // enumerating the grid variables is expensive
+ if (not electric_fence) return;
Timers::Timer timer("FenceCheck");
timer.start();