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: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef Tempus_TimeEventIndexRange_decl_hpp
11 #define Tempus_TimeEventIndexRange_decl_hpp
12 
13 #include <tuple>
14 
15 #include "Teuchos_Time.hpp"
17 
18 #include "Tempus_config.hpp"
19 #include "Tempus_TimeEventBase.hpp"
20 
21 namespace Tempus {
22 
27 template <class Scalar>
28 class TimeEventRangeIndex : virtual public TimeEventBase<Scalar> {
29  public:
32 
34  TimeEventRangeIndex(int start, int stop, int stride, std::string name = "");
35 
37  virtual ~TimeEventRangeIndex() {}
38 
40 
41 
48  virtual bool isIndex(int index) const;
49 
55  virtual int indexToNextEvent(int index) const;
56 
68  virtual int indexOfNextEvent(int index) const;
69 
79  virtual bool eventInRangeIndex(int index1, int index2) const;
80 
82  virtual void describe(Teuchos::FancyOStream &out,
83  const Teuchos::EVerbosityLevel verbLevel) const;
85 
87 
88 
96  virtual void setIndexRange(int start, int stop, int stride)
97  {
98  setIndexStart(start);
99  setIndexStop(stop);
100  setIndexStride(stride);
101  }
102 
104  virtual int getIndexStart() const { return start_; }
106  virtual void setIndexStart(int start);
107 
109  virtual int getIndexStop() const { return stop_; }
111  virtual void setIndexStop(int stop);
112 
114  virtual int getIndexStride() const { return stride_; }
116  virtual void setIndexStride(int stride);
117 
119  virtual int getNumEvents() const { return numEvents_; }
120 
122  virtual void setNumEvents();
124 
134 
135  protected:
136  int start_;
137  int stop_;
138  int stride_;
139  unsigned numEvents_;
140 };
141 
142 // Nonmember Contructors
143 // ------------------------------------------------------------------------
144 
154 template <class Scalar>
157 
158 } // namespace Tempus
159 
160 #endif // Tempus_TimeEventIndexRange_decl_hpp
virtual void setIndexStart(int start)
Set the start of the index range.
TimeEventRangeIndex specifies a start, stop and stride index.
virtual int getNumEvents() const
Return the number of events.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Describe member data.
virtual int getIndexStride() const
Return the stride of the index range.
virtual int indexToNextEvent(int index) const
How many indices until the next event.
virtual int getIndexStart() const
Return the start of the index range.
virtual void setIndexStride(int stride)
Set the stride of the index range.
This class defines time events which can be used to &quot;trigger&quot; an action.
virtual void setNumEvents()
Set the number of events from start_, stop_ and stride_.
virtual void setIndexStop(int stop)
Set the stop of the index range.
virtual int getIndexStop() const
Return the stop of the index range.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return a valid ParameterList with current settings.
virtual bool eventInRangeIndex(int index1, int index2) const
Test if an event occurs within the index range.
virtual int indexOfNextEvent(int index) const
Return the index of the next event following the input index.
virtual bool isIndex(int index) const
Test if index is a time event.
Teuchos::RCP< TimeEventRangeIndex< Scalar > > createTimeEventRangeIndex(Teuchos::RCP< Teuchos::ParameterList > pList)
Nonmember Constructor via ParameterList.
unsigned numEvents_
Number of events in index range.
virtual void setIndexRange(int start, int stop, int stride)
Set the range of event indices.