00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _TIMEDDATAITERATOR_H_ 00012 #define _TIMEDDATAITERATOR_H_ 00013 00014 #include "DataIndex.H" 00015 #include "BoxLayout.H" 00016 #include "SPMD.H" 00017 #include "LayoutIterator.H" 00018 #include "DataIterator.H" 00019 00020 #include "NamespaceHeader.H" 00021 00022 00023 class TimedDataIterator : public DataIterator 00024 { 00025 public: 00026 00027 virtual ~TimedDataIterator() 00028 {} 00029 00030 /// 00031 virtual bool ok() const; 00032 00033 /// 00034 virtual void operator++(); 00035 00036 public: 00037 ///sets m_time values to zero 00038 void clearTime(); 00039 00040 ///gets current time data 00041 Vector<unsigned long long>& getTime() 00042 { 00043 return m_time; 00044 } 00045 00046 Vector<Box> getBoxes() 00047 { 00048 return m_layout.boxArray(); 00049 } 00050 00051 ///gets current time data in microseconds 00052 const Vector<unsigned long long>& getTime() const 00053 { 00054 return m_time; 00055 } 00056 00057 ///enables timing. does not set to zero. use clear time for that 00058 void enableTime() 00059 { 00060 //only defines if not defined before 00061 defineTime(); 00062 m_timeEnabled = true; 00063 } 00064 00065 ///turns off timing 00066 void disableTime() 00067 { 00068 m_timeEnabled = false; 00069 } 00070 00071 /// After you are finished timing your local elements, call mergeTimes to fill-in off-processor times. 00072 void mergeTime(); 00073 private: 00074 int m_size; 00075 void defineTime(); 00076 Vector<unsigned long long> m_time; 00077 bool m_timeEnabled; 00078 bool m_timeDefined; 00079 unsigned long long m_startTime; 00080 00081 int m_ibox; 00082 private: 00083 TimedDataIterator(); 00084 00085 friend class BoxLayout; 00086 friend class DisjointBoxLayout; 00087 00088 TimedDataIterator(const BoxLayout& boxlayout, const int* layoutID); 00089 }; 00090 00091 00092 #include "NamespaceFooter.H" 00093 #endif