GEOSX
PeriodicEvent.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOSX_MANAGERS_EVENTS_PERIODICEVENT_HPP_
20 #define GEOSX_MANAGERS_EVENTS_PERIODICEVENT_HPP_
21 
23 
24 namespace geosx
25 {
26 
32 class PeriodicEvent : public EventBase
33 {
34 public:
35 
37  PeriodicEvent( const std::string & name,
38  Group * const parent );
39 
41  virtual ~PeriodicEvent() override;
42 
47  static string CatalogName() { return "PeriodicEvent"; }
48 
58  virtual void EstimateEventTiming( real64 const time,
59  real64 const dt,
60  integer const cycle,
61  dataRepository::Group * domain ) override;
62 
84  void CheckOptionalFunctionThreshold( real64 const time,
85  real64 const dt,
86  integer const cycle,
87  dataRepository::Group * domain );
88 
94  virtual real64 GetEventTypeDtRequest( real64 const time ) override;
95 
99  virtual void Cleanup( real64 const time_n,
100  integer const cycleNumber,
101  integer const eventCounter,
102  real64 const eventProgress,
103  dataRepository::Group * domain ) override;
104 
105 
108 
110  struct viewKeyStruct
111  {
112  static constexpr auto timeFrequencyString = "timeFrequency";
113  static constexpr auto cycleFrequencyString = "cycleFrequency";
114  static constexpr auto targetExactTimestepString = "targetExactTimestep";
115  static constexpr auto functionNameString = "function";
116  static constexpr auto functionInputObjectString = "object";
117  static constexpr auto functionInputSetnameString = "set";
118  static constexpr auto functionSetNamesString = "setNames";
119  static constexpr auto functionStatOptionString = "stat";
120  static constexpr auto eventThresholdString = "threshold";
121 
122  dataRepository::ViewKey timeFrequency = { "timeFrequency" };
123  dataRepository::ViewKey cycleFrequency = { "cycleFrequency" };
124  dataRepository::ViewKey targetExactTimestep = { "targetExactTimestep" };
125  dataRepository::ViewKey functionName = { "function" };
126  dataRepository::ViewKey functionInputObject = { "object" };
127  dataRepository::ViewKey functionInputSetname = { "set" };
128  dataRepository::ViewKey functionSetNames = { "setNames" };
129  dataRepository::ViewKey functionStatOption = { "stat" };
130  dataRepository::ViewKey eventThreshold = { "threshold" };
131  } periodicEventViewKeys;
133 
150 
151 };
152 
153 } /* namespace geosx */
154 
155 #endif /* GEOSX_MANAGERS_EVENTS_PERIODICEVENT_HPP_ */
integer m_targetExactTimestep
Whether to target the exact timestep.
real64 m_timeFrequency
The event time frequency.
real64 m_eventThreshold
The event threshold.
string m_functionInputObject
The name of the optional function input object.
integer m_cycleFrequency
The event cycle frequency.
virtual real64 GetEventTypeDtRequest(real64 const time) override
Get event-specifit dt requests.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:136
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1545
string m_functionInputSetname
The name of the optional function input set.
void CheckOptionalFunctionThreshold(real64 const time, real64 const dt, integer const cycle, dataRepository::Group *domain)
Determine if an optional function f should be called, and call it if so.
string m_functionName
The optional function's name.
virtual void EstimateEventTiming(real64 const time, real64 const dt, integer const cycle, dataRepository::Group *domain) override
Perform the calculations to estimate the timing of the event.
static string CatalogName()
Catalog name interface.
dataRepository::Group * m_functionTarget
A pointer to an optional function.
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
integer m_functionStatOption
The optional funciton's statistic option.
PeriodicEvent(const std::string &name, Group *const parent)
Constructor.
virtual void Cleanup(real64 const time_n, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, dataRepository::Group *domain) override
Called as the code exits the main run loop.
virtual ~PeriodicEvent() override
Destructor.
std::string string
String type.
Definition: DataTypes.hpp:131