Tempus  Version of the Day
Time Integration
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 // Teuchos
15 #include "Teuchos_Time.hpp"
16 
17 // Tempus
18 #include "Tempus_config.hpp"
19 #include "Tempus_TimeEventBase.hpp"
20 
21 
22 namespace Tempus {
23 
24 
29 template<class Scalar>
30 class TimeEventListIndex : virtual public TimeEventBase<Scalar>
31 {
32 public:
33 
36 
38  TimeEventListIndex(std::string name, std::vector<int> indexList);
39 
41  virtual ~TimeEventListIndex() {}
42 
44 
45  virtual bool isIndex(int index) const;
47 
49  virtual int indexToNextEvent(int index) const;
50 
52  virtual int indexOfNextEvent(int index) const;
53 
55  virtual bool eventInRangeIndex(int index1, int index2) const;
56 
58  virtual void describe() const;
60 
62 
63  virtual std::vector<int> getIndexList() const { return indexList_; }
64  virtual void setIndexList(std::vector<int> indexList, bool sort = true);
65  virtual void addIndex(int index);
66  virtual void clearIndexList() { indexList_.clear(); }
68 
69 
70 protected:
71 
72  std::vector<int> indexList_; // Sorted and unique list of index events.
73 
74 };
75 
76 
77 } // namespace Tempus
78 
79 #endif // Tempus_TimeEventListIndex_decl_hpp
virtual bool isIndex(int index) const
Test if index is near a index event (within tolerance).
virtual int indexOfNextEvent(int index) const
Index of the next event. Negative indicating the last event is in the past.
TimeEventListIndex specifies a list of index events.
virtual int indexToNextEvent(int index) const
How many indices until the next event. Negative indicating the last event is in the past...
This class defines time events which can be used to "trigger" an action. Time events are points in ti...
virtual std::vector< int > getIndexList() const
virtual void setIndexList(std::vector< int > indexList, bool sort=true)
virtual void describe() const
Describe member data.
virtual bool eventInRangeIndex(int index1, int index2) const
Test if an event occurs within the index range.