Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
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"
16#include "Teuchos_ParameterList.hpp"
17
18#include "Tempus_config.hpp"
20
21namespace Tempus {
22
27template <class Scalar>
28class TimeEventRangeIndex : virtual public TimeEventBase<Scalar> {
29 public:
32
34 TimeEventRangeIndex(int start, int stop, int stride, std::string name = "");
35
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
133 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
134
135 protected:
136 int start_;
137 int stop_;
139 unsigned numEvents_;
140};
141
142// Nonmember Contructors
143// ------------------------------------------------------------------------
144
154template <class Scalar>
155Teuchos::RCP<TimeEventRangeIndex<Scalar> > createTimeEventRangeIndex(
156 Teuchos::RCP<Teuchos::ParameterList> pList);
157
158} // namespace Tempus
159
160#endif // Tempus_TimeEventIndexRange_decl_hpp
This class defines time events which can be used to "trigger" an action.
TimeEventRangeIndex specifies a start, stop and stride index.
virtual int getIndexStop() const
Return the stop of the index range.
virtual bool isIndex(int index) const
Test if index is a time event.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Describe member data.
virtual void setIndexStop(int stop)
Set the stop of the index range.
virtual int indexOfNextEvent(int index) const
Return the index of the next event following the input index.
virtual void setIndexRange(int start, int stop, int stride)
Set the range of event indices.
virtual bool eventInRangeIndex(int index1, int index2) const
Test if an event occurs within the index range.
unsigned numEvents_
Number of events in index range.
virtual void setIndexStart(int start)
Set the start of the index range.
virtual int getNumEvents() const
Return the number of events.
virtual void setNumEvents()
Set the number of events from start_, stop_ and stride_.
virtual int indexToNextEvent(int index) const
How many indices until the next event.
virtual int getIndexStride() const
Return the stride of the index range.
virtual int getIndexStart() const
Return the start of the index range.
virtual void setIndexStride(int stride)
Set the stride of the index range.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return a valid ParameterList with current settings.
Teuchos::RCP< TimeEventRangeIndex< Scalar > > createTimeEventRangeIndex(Teuchos::RCP< Teuchos::ParameterList > pList)
Nonmember Constructor via ParameterList.