GEOS
PeriodicEvent.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_EVENTS_PERIODICEVENT_HPP_
21 #define GEOS_EVENTS_PERIODICEVENT_HPP_
22 
23 #include "events/EventBase.hpp"
24 
25 namespace geos
26 {
27 
33 class PeriodicEvent : public EventBase
34 {
35 public:
36 
38  PeriodicEvent( const string & name,
39  Group * const parent );
40 
42  virtual ~PeriodicEvent() override;
43 
48  static string catalogName() { return "PeriodicEvent"; }
49 
59  virtual void estimateEventTiming( real64 const time,
60  real64 const dt,
61  integer const cycle,
62  DomainPartition & domain ) override;
63 
86  real64 const dt,
87  integer const cycle,
88  DomainPartition & domain );
89 
95  virtual real64 getEventTypeDtRequest( real64 const time ) override;
96 
100  virtual void cleanup( real64 const time_n,
101  integer const cycleNumber,
102  integer const eventCounter,
103  real64 const eventProgress,
104  DomainPartition & domain ) override;
105 
109  virtual void validate() const override;
110 
113 
115  struct viewKeyStruct
116  {
117  static constexpr char const * timeFrequencyString() { return "timeFrequency"; }
118  static constexpr char const * cycleFrequencyString() { return "cycleFrequency"; }
119  static constexpr char const * targetExactTimestepString() { return "targetExactTimestep"; }
120  static constexpr char const * functionNameString() { return "function"; }
121  static constexpr char const * functionInputObjectString() { return "object"; }
122  static constexpr char const * functionInputSetnameString() { return "set"; }
123  static constexpr char const * functionSetNamesString() { return "setNames"; }
124  static constexpr char const * functionStatOptionString() { return "stat"; }
125  static constexpr char const * eventThresholdString() { return "threshold"; }
126 
127  dataRepository::ViewKey timeFrequency = { timeFrequencyString() };
128  dataRepository::ViewKey cycleFrequency = { cycleFrequencyString() };
129  dataRepository::ViewKey targetExactTimestep = { targetExactTimestepString() };
130  dataRepository::ViewKey functionName = { functionNameString() };
131  dataRepository::ViewKey functionInputObject = { functionInputObjectString() };
132  dataRepository::ViewKey functionInputSetname = { functionInputSetnameString() };
133  dataRepository::ViewKey functionSetNames = { functionSetNamesString() };
134  dataRepository::ViewKey functionStatOption = { functionStatOptionString() };
135  dataRepository::ViewKey eventThreshold = { eventThresholdString() };
136  } periodicEventViewKeys;
138 
155 
156 };
157 
158 } /* namespace geos */
159 
160 #endif /* GEOS_EVENTS_PERIODICEVENT_HPP_ */
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
virtual ~PeriodicEvent() override
Destructor.
void checkOptionalFunctionThreshold(real64 const time, real64 const dt, integer const cycle, DomainPartition &domain)
Determine if an optional function f should be called, and call it if so.
string m_functionInputObject
The name of the optional function input object.
virtual real64 getEventTypeDtRequest(real64 const time) override
Get event-specifit dt requests.
integer m_targetExactTimestep
Whether to target the exact timestep.
dataRepository::Group * m_functionTarget
A pointer to an optional function.
real64 m_timeFrequency
The event time frequency.
virtual void validate() const override
Helper function to validate the consistency of the event input.
real64 m_eventThreshold
The event threshold.
static string catalogName()
Catalog name interface.
virtual void estimateEventTiming(real64 const time, real64 const dt, integer const cycle, DomainPartition &domain) override
Perform the calculations to estimate the timing of the event.
string m_functionInputSetname
The name of the optional function input set.
virtual void cleanup(real64 const time_n, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Called as the code exits the main run loop.
integer m_functionStatOption
The optional funciton's statistic option.
integer m_cycleFrequency
The event cycle frequency.
string m_functionName
The optional function's name.
PeriodicEvent(const string &name, Group *const parent)
Constructor.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1662
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
Structure to hold scoped key names.
Definition: Group.hpp:1442