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: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_TimeEventListIndex_decl_hpp
10 #define Tempus_TimeEventListIndex_decl_hpp
11 
12 #include <vector>
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 TimeEventListIndex : virtual public TimeEventBase<Scalar> {
28  public:
31 
33  TimeEventListIndex(std::vector<int> indexList,
34  std::string name = "TimeEventListIndex");
35 
37  virtual ~TimeEventListIndex() {}
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  virtual std::vector<int> getIndexList() const { return indexList_; }
90 
98  virtual void setIndexList(std::vector<int> indexList, bool sort = true);
99 
108  virtual void addIndex(int index);
109 
111  virtual void clearIndexList() { indexList_.clear(); }
113 
123 
124  protected:
125  std::vector<int> indexList_; // Sorted and unique list of index events.
126 };
127 
128 // Nonmember Contructors
129 // ------------------------------------------------------------------------
130 
140 template <class Scalar>
143 
144 } // namespace Tempus
145 
146 #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.