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 
21 namespace Tempus {
22 
23 
28 template<class Scalar>
29 class TimeEventListIndex : virtual public TimeEventBase<Scalar>
30 {
31 public:
32 
35 
37  TimeEventListIndex(std::vector<int> indexList,
38  std::string name = "TimeEventListIndex");
39 
41  virtual ~TimeEventListIndex() {}
42 
44 
45 
52  virtual bool isIndex(int index) const;
53 
59  virtual int indexToNextEvent(int index) const;
60 
72  virtual int indexOfNextEvent(int index) const;
73 
83  virtual bool eventInRangeIndex(int index1, int index2) const;
84 
86  virtual void describe(Teuchos::FancyOStream &out,
87  const Teuchos::EVerbosityLevel verbLevel) const;
89 
91 
92  virtual std::vector<int> getIndexList() const { return indexList_; }
94 
102  virtual void setIndexList(std::vector<int> indexList, bool sort = true);
103 
112  virtual void addIndex(int index);
113 
115  virtual void clearIndexList() { indexList_.clear(); }
117 
127 
128 
129 protected:
130 
131  std::vector<int> indexList_; // Sorted and unique list of index events.
132 
133 };
134 
135 
136 // Nonmember Contructors
137 // ------------------------------------------------------------------------
138 
148 template<class Scalar>
151 
152 
153 } // namespace Tempus
154 
155 #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.