Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_TimeEventRangeIndex_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_TimeEventIndexRange_decl_hpp
10 #define Tempus_TimeEventIndexRange_decl_hpp
11 
12 #include <tuple>
13 
14 // Teuchos
15 #include "Teuchos_Time.hpp"
16 
17 // Tempus
18 #include "Tempus_config.hpp"
19 #include "Tempus_TimeEventBase.hpp"
20 
21 
22 namespace Tempus {
23 
24 
29 template<class Scalar>
30 class TimeEventRangeIndex : virtual public TimeEventBase<Scalar>
31 {
32 public:
33 
36 
38  TimeEventRangeIndex(std::string name, int start, int stop, int stride);
39 
41  virtual ~TimeEventRangeIndex() {}
42 
44 
45  virtual bool isIndex(int index) const;
47 
49  virtual int indexToNextEvent(int index) const;
50 
52  virtual int indexOfNextEvent(int index) const;
53 
55  virtual bool eventInRangeIndex(int index1, int index2) const;
56 
58  virtual void describe() const;
60 
62 
63  virtual void setIndexRange(int start, int stop, int stride)
64  { setIndexStart(start); setIndexStop(stop); setIndexStride(stride); }
65 
66  virtual int getIndexStart() const { return start_; }
67  virtual void setIndexStart(int start);
68 
69  virtual int getIndexStop() const { return stop_; }
70  virtual void setIndexStop(int stop);
71 
72  virtual int getIndexStride() const { return stride_; }
73  virtual void setIndexStride(int stride);
74 
75  virtual int getNumEvents() const { return numEvents_; }
76  virtual void setNumEvents();
78 
79 
80 protected:
81 
82  int start_;
83  int stop_;
84  int stride_;
85  unsigned numEvents_;
86 
87 };
88 
89 
90 } // namespace Tempus
91 
92 #endif // Tempus_TimeEventIndexRange_decl_hpp
TimeEventRangeIndex specifies a start, stop and stride index.
virtual int indexToNextEvent(int index) const
How many indices until the next event. Negative indicating the last event is in the past...
This class defines time events which can be used to &quot;trigger&quot; an action. Time events are points in ti...
virtual void describe() const
Describe member data.
virtual bool eventInRangeIndex(int index1, int index2) const
Test if an event occurs within the index range.
virtual int indexOfNextEvent(int index) const
Index of the next event. Negative indicating the last event is in the past.
virtual bool isIndex(int index) const
Test if index is a time event.
virtual void setIndexRange(int start, int stop, int stride)