Chombo + EB  3.0
TimedDataIterator.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _TIMEDDATAITERATOR_H_
12 #define _TIMEDDATAITERATOR_H_
13 
14 #include "DataIndex.H"
15 #include "BoxLayout.H"
16 #include "SPMD.H"
17 #include "LayoutIterator.H"
18 #include "DataIterator.H"
19 
20 #include "NamespaceHeader.H"
21 
22 
24 {
25 public:
26 
28  {}
29 
30  ///
31  virtual bool ok() const;
32 
33  ///
34  virtual void operator++();
35 
36 public:
37  ///sets m_time values to zero
38  void clearTime();
39 
40  ///gets current time data
42  {
43  return m_time;
44  }
45 
47  {
48  return m_layout.boxArray();
49  }
50 
51  ///gets current time data in microseconds
53  {
54  return m_time;
55  }
56 
57  ///enables timing. does not set to zero. use clear time for that
58  void enableTime()
59  {
60  //only defines if not defined before
61  defineTime();
62  m_timeEnabled = true;
63  }
64 
65  ///turns off timing
66  void disableTime()
67  {
68  m_timeEnabled = false;
69  }
70 
71  /// After you are finished timing your local elements, call mergeTimes to fill-in off-processor times.
72  void mergeTime();
73 
74 private:
75  void defineTime();
79  unsigned long long m_startTime;
80 
81  int m_ibox;
82 private:
84 
85  friend class BoxLayout;
86  friend class DisjointBoxLayout;
87 
88  TimedDataIterator(const BoxLayout& boxlayout, const int* layoutID);
89 };
90 
91 
92 #include "NamespaceFooter.H"
93 #endif
Vector< Box > boxArray() const
Vector< Box > getBoxes()
Definition: TimedDataIterator.H:46
int m_ibox
Definition: TimedDataIterator.H:81
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:146
void disableTime()
turns off timing
Definition: TimedDataIterator.H:66
Vector< unsigned long long > & getTime()
gets current time data
Definition: TimedDataIterator.H:41
Definition: DataIterator.H:140
const Vector< unsigned long long > & getTime() const
gets current time data in microseconds
Definition: TimedDataIterator.H:52
unsigned long long m_startTime
Definition: TimedDataIterator.H:79
virtual bool ok() const
return true if this iterator is still in its Layout
BoxLayout m_layout
Definition: LayoutIterator.H:92
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
void enableTime()
enables timing. does not set to zero. use clear time for that
Definition: TimedDataIterator.H:58
void mergeTime()
After you are finished timing your local elements, call mergeTimes to fill-in off-processor times...
Vector< unsigned long long > m_time
Definition: TimedDataIterator.H:76
void clearTime()
sets m_time values to zero
virtual ~TimedDataIterator()
Definition: TimedDataIterator.H:27
bool m_timeDefined
Definition: TimedDataIterator.H:78
Definition: TimedDataIterator.H:23
virtual void operator++()
move the iterator to the next Box in the layout
bool m_timeEnabled
Definition: TimedDataIterator.H:77