Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_TimeEventListIndex_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_TimeEventListIndex_decl_hpp
11 #define Tempus_TimeEventListIndex_decl_hpp
12 
13 #include <vector>
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 TimeEventListIndex : virtual public TimeEventBase<Scalar> {
29  public:
32 
34  TimeEventListIndex(std::vector<int> indexList,
35  std::string name = "TimeEventListIndex");
36 
38  virtual ~TimeEventListIndex() {}
39 
41 
42 
49  virtual bool isIndex(int index) const;
50 
56  virtual int indexToNextEvent(int index) const;
57 
69  virtual int indexOfNextEvent(int index) const;
70 
80  virtual bool eventInRangeIndex(int index1, int index2) const;
81 
83  virtual void describe(Teuchos::FancyOStream &out,
84  const Teuchos::EVerbosityLevel verbLevel) const;
86 
88 
89  virtual std::vector<int> getIndexList() const { return indexList_; }
91 
99  virtual void setIndexList(std::vector<int> indexList, bool sort = true);
100 
109  virtual void addIndex(int index);
110 
112  virtual void clearIndexList() { indexList_.clear(); }
114 
124 
125  protected:
126  std::vector<int> indexList_; // Sorted and unique list of index events.
127 };
128 
129 // Nonmember Contructors
130 // ------------------------------------------------------------------------
131 
141 template <class Scalar>
144 
145 } // namespace Tempus
146 
147 #endif // Tempus_TimeEventListIndex_decl_hpp
virtual int indexToNextEvent(int index) const
How many indices until the next event.
virtual bool isIndex(int index) const
Test if index is a time event.
virtual int indexOfNextEvent(int index) const
Return the index of the next event following the input index.
TimeEventListIndex specifies a list of index events.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return a valid ParameterList with current settings.
virtual void clearIndexList()
Clear the vector of all events.
virtual void addIndex(int index)
Add the index to event vector.
Teuchos::RCP< TimeEventListIndex< Scalar > > createTimeEventListIndex(Teuchos::RCP< Teuchos::ParameterList > pList)
Nonmember Constructor via ParameterList.
virtual std::vector< int > getIndexList() const
Return a vector of event indices.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Describe member data.
virtual bool eventInRangeIndex(int index1, int index2) const
Test if an event occurs within the index range.
This class defines time events which can be used to &quot;trigger&quot; an action.
virtual void setIndexList(std::vector< int > indexList, bool sort=true)
Set the vector of event indices.