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 #include "Teuchos_Time.hpp"
16 
17 #include "Tempus_config.hpp"
18 #include "Tempus_TimeEventBase.hpp"
19 
20 namespace Tempus {
21 
26 template <class Scalar>
27 class TimeEventRangeIndex : virtual public TimeEventBase<Scalar> {
28  public:
31 
33  TimeEventRangeIndex(int start, int stop, int stride, std::string name = "");
34 
36  virtual ~TimeEventRangeIndex() {}
37 
39 
40 
47  virtual bool isIndex(int index) const;
48 
54  virtual int indexToNextEvent(int index) const;
55 
67  virtual int indexOfNextEvent(int index) const;
68 
78  virtual bool eventInRangeIndex(int index1, int index2) const;
79 
81  virtual void describe(Teuchos::FancyOStream &out,
82  const Teuchos::EVerbosityLevel verbLevel) const;
84 
86 
87 
95  virtual void setIndexRange(int start, int stop, int stride)
96  {
97  setIndexStart(start);
98  setIndexStop(stop);
99  setIndexStride(stride);
100  }
101 
103  virtual int getIndexStart() const { return start_; }
105  virtual void setIndexStart(int start);
106 
108  virtual int getIndexStop() const { return stop_; }
110  virtual void setIndexStop(int stop);
111 
113  virtual int getIndexStride() const { return stride_; }
115  virtual void setIndexStride(int stride);
116 
118  virtual int getNumEvents() const { return numEvents_; }
119 
121  virtual void setNumEvents();
123 
133 
134  protected:
135  int start_;
136  int stop_;
137  int stride_;
138  unsigned numEvents_;
139 };
140 
141 // Nonmember Contructors
142 // ------------------------------------------------------------------------
143 
153 template <class Scalar>
156 
157 } // namespace Tempus
158 
159 #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.