Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
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"
16#include "Teuchos_ParameterList.hpp"
17
18#include "Tempus_config.hpp"
20
21namespace Tempus {
22
27template <class Scalar>
28class TimeEventListIndex : virtual public TimeEventBase<Scalar> {
29 public:
32
34 TimeEventListIndex(std::vector<int> indexList,
35 std::string name = "TimeEventListIndex");
36
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
90 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
123 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
124
125 protected:
126 std::vector<int> indexList_; // Sorted and unique list of index events.
127};
128
129// Nonmember Contructors
130// ------------------------------------------------------------------------
131
141template <class Scalar>
142Teuchos::RCP<TimeEventListIndex<Scalar> > createTimeEventListIndex(
143 Teuchos::RCP<Teuchos::ParameterList> pList);
144
145} // namespace Tempus
146
147#endif // Tempus_TimeEventListIndex_decl_hpp
This class defines time events which can be used to "trigger" an action.
TimeEventListIndex specifies a list of index events.
virtual bool eventInRangeIndex(int index1, int index2) const
Test if an event occurs within the index range.
virtual void setIndexList(std::vector< int > indexList, bool sort=true)
Set the vector of event indices.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Describe member data.
virtual void addIndex(int index)
Add the index to event vector.
virtual bool isIndex(int index) const
Test if index is a time event.
virtual void clearIndexList()
Clear the vector of all events.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return a valid ParameterList with current settings.
virtual std::vector< int > getIndexList() const
Return a vector of event indices.
virtual int indexToNextEvent(int index) const
How many indices until the next event.
virtual int indexOfNextEvent(int index) const
Return the index of the next event following the input index.
Teuchos::RCP< TimeEventListIndex< Scalar > > createTimeEventListIndex(Teuchos::RCP< Teuchos::ParameterList > pList)
Nonmember Constructor via ParameterList.