Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros 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 // Teuchos
15 #include "Teuchos_Time.hpp"
16 
17 // Tempus
18 #include "Tempus_TimeEventBase.hpp"
19 
20 
21 namespace Tempus {
22 
23 
24 /** \brief TimeEventListIndex specifies a list of index events.
25  *
26  *
27  */
28 template<class Scalar>
29 class TimeEventListIndex : virtual public TimeEventBase<Scalar>
30 {
31 public:
32 
33  /// Default constructor.
35 
36  /// Construct with full argument list of data members.
37  TimeEventListIndex(std::string name, std::vector<int> indexList);
38 
39  /// Destructor
40  virtual ~TimeEventListIndex() {}
41 
42  /// \name Basic methods
43  //@{
44  /// Test if index is near a index event (within tolerance).
45  virtual bool isIndex(int index) const;
46 
47  /// How many indices until the next event. Negative indicating the last event is in the past.
48  virtual int indexToNextEvent(int index) const;
49 
50  /// Index of the next event. Negative indicating the last event is in the past.
51  virtual int indexOfNextEvent(int index) const;
52 
53  /// Test if an event occurs within the index range.
54  virtual bool eventInRangeIndex(int index1, int index2) const;
55 
56  /// Describe member data.
57  virtual void describe() const;
58  //@}
59 
60  /// \name Accessor methods
61  //@{
62  virtual std::vector<int> getIndexList() const { return indexList_; }
63  virtual void setIndexList(std::vector<int> indexList, bool sort = true);
64  virtual void addIndex(int index);
65  virtual void clearIndexList() { indexList_.clear(); }
66  //@}
67 
68 
69 protected:
70 
71  std::vector<int> indexList_; // Sorted and unique list of index events.
72 
73 };
74 
75 
76 } // namespace Tempus
77 
78 #endif // Tempus_TimeEventListIndex_decl_hpp
virtual int indexToNextEvent(int index) const
How many indices until the next event. Negative indicating the last event is in the past...
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 std::vector< int > getIndexList() const
virtual void describe() 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. Time events are points in ti...
virtual void setIndexList(std::vector< int > indexList, bool sort=true)