aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/Timers.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Carpet/Carpet/src/Timers.cc')
-rw-r--r--Carpet/Carpet/src/Timers.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/Carpet/Carpet/src/Timers.cc b/Carpet/Carpet/src/Timers.cc
index 313d1d034..01d502aa3 100644
--- a/Carpet/Carpet/src/Timers.cc
+++ b/Carpet/Carpet/src/Timers.cc
@@ -16,7 +16,7 @@
#include <Timers.hh>
#include <TimerNode.hh>
-
+#include "variables.hh"
namespace Carpet {
@@ -31,6 +31,11 @@ namespace Carpet {
/// not associate it with a point in the timer hierarchy.
Timer::Timer (const string &name_p) : d_name(name_p)
{
+ d_tree = &main_timer_tree;
+ }
+
+ Timer::Timer (const string &name_p, TimerTree *tree) : d_name(name_p), d_tree(tree)
+ {
}
/// Destroy a timer
@@ -44,7 +49,7 @@ namespace Carpet {
/// never started.
void Timer::instantiate ()
{
- TimerNode *current_timer = TimerNode::getCurrentTimer();
+ TimerNode *current_timer = d_tree->current;
assert(current_timer);
current_timer->getChildTimer(name())->instantiate();
}
@@ -53,7 +58,7 @@ namespace Carpet {
/// of the most recently started timer that has not been stopped.
void Timer::start ()
{
- TimerNode *current_timer = TimerNode::getCurrentTimer();
+ TimerNode *current_timer = d_tree->current;
assert(current_timer);
current_timer->getChildTimer(name())->start();
}
@@ -61,7 +66,7 @@ namespace Carpet {
/// Stop the timer - it must be the most recently started timer
void Timer::stop ()
{
- TimerNode *current = TimerNode::getCurrentTimer();
+ TimerNode *current = d_tree->current;
if (current->getName() != name())
CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
"Trying to stop enclosing timer '%s' before enclosed time '%s'",
@@ -78,6 +83,6 @@ namespace Carpet {
/// Return the current time of the timer as a double
double Timer::getTime ()
{
- return TimerNode::getCurrentTimer()->getTime();
+ return d_tree->current->getTime();
}
} // namespace Carpet