Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros 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_TimeEventBase.hpp"
19 
20 
21 namespace Tempus {
22 
23 
24 /** \brief TimeEventRangeIndex specifies a start, stop and stride index.
25  *
26  *
27  */
28 template<class Scalar>
29 class TimeEventRangeIndex : virtual public TimeEventBase<Scalar>
30 {
31 public:
32 
33  /// Default constructor.
35 
36  /// Construct with full argument list of data members.
37  TimeEventRangeIndex(std::string name, int start, int stop, int stride);
38 
39  /// Destructor
40  virtual ~TimeEventRangeIndex() {}
41 
42  /// \name Basic methods
43  //@{
44  /// Test if index is a time event.
45  virtual bool isIndex(int index) const;
46 
47  /// How many indices until the next event. Negative indicating the last event is in the past.
48  virtual int indexToNextEvent(int index) const;
49 
50  /// Index of the next event. Negative indicating the last event is in the past.
51  virtual int indexOfNextEvent(int index) const;
52 
53  /// Test if an event occurs within the index range.
54  virtual bool eventInRangeIndex(int index1, int index2) const;
55 
56  /// Describe member data.
57  virtual void describe() const;
58  //@}
59 
60  /// \name Accessor methods
61  //@{
62  virtual void setIndexRange(int start, int stop, int stride)
63  { setIndexStart(start); setIndexStop(stop); setIndexStride(stride); }
64 
65  virtual int getIndexStart() const { return start_; }
66  virtual void setIndexStart(int start);
67 
68  virtual int getIndexStop() const { return stop_; }
69  virtual void setIndexStop(int stop);
70 
71  virtual int getIndexStride() const { return stride_; }
72  virtual void setIndexStride(int stride);
73 
74  virtual int getNumEvents() const { return numEvents_; }
75  virtual void setNumEvents();
76  //@}
77 
78 
79 protected:
80 
81  int start_;
82  int stop_;
83  int stride_;
84  unsigned numEvents_;
85 
86 };
87 
88 
89 } // namespace Tempus
90 
91 #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)