20 #ifndef GEOS_EVENTS_EVENTSBASE_HPP_
21 #define GEOS_EVENTS_EVENTSBASE_HPP_
43 Group *
const parent );
68 real64 const eventProgress,
97 virtual Group *
createChild(
string const & childKey,
string const & childName )
override;
155 return std::numeric_limits< real64 >::max();
183 static constexpr
char const * eventTargetString() {
return "target"; }
184 static constexpr
char const * beginTimeString() {
return "beginTime"; }
185 static constexpr
char const * endTimeString() {
return "endTime"; }
186 static constexpr
char const * forceDtString() {
return "forceDt"; }
187 static constexpr
char const * maxEventDtString() {
return "maxEventDt"; }
188 static constexpr
char const * lastTimeString() {
return "lastTime"; }
189 static constexpr
char const * lastCycleString() {
return "lastCycle"; }
190 static constexpr
char const * eventForecastString() {
return "eventForecast"; }
191 static constexpr
char const * targetExactStartStopString() {
return "targetExactStartStop"; }
192 static constexpr
char const * currentSubEventString() {
return "currentSubEvent"; }
193 static constexpr
char const * isTargetExecutingString() {
return "isTargetExecuting"; }
194 static constexpr
char const * finalDtStretchString() {
return "finalDtStretch"; }
241 {
return m_eventForecast; }
248 {
return m_eventForecast <= 0; }
255 {
return m_eventForecast == 1; }
262 {
return m_eventForecast > 1; }
270 return m_eventTarget;
279 { m_eventForecast = 0; }
285 { m_eventForecast = 1; }
291 { m_eventForecast = std::numeric_limits< decltype( m_eventForecast ) >::max(); }
302 { m_eventForecast = forecast; }
317 {
return ( time >= m_beginTime ) && ( time < m_endTime ); }
325 {
return isActive( time ) || isZero( time - m_endTime ); }
334 string m_eventTarget;
340 integer m_targetExactStartStop;
348 real64 m_currentEventDtRequest;
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
real64 m_lastTime
The last time the event occurred.
void setPrepareForExec()
Define that the event should prepare for execution.
virtual Group * createChild(string const &childKey, string const &childName) override
Creates a new sub-Group using the ObjectCatalog functionality.
virtual void expandObjectCatalogs() override
Expand any catalogs in the data structure.
integer getForecast() const
Get the forecast of the current event.
void setExitFlag(integer flag)
Set this event objects exit flag.
EventBase(string const &name, Group *const parent)
Main constructor.
void step(real64 const time, real64 const dt, integer const cycle, dataRepository::Group *domain)
Call the execute method on the target and/or children if present.
virtual real64 getTimestepRequest(real64 const time) override
Collect time-step size requests from targets and/or children.
virtual void validate() const
Helper function to validate the consistency of the event input.
real64 getCurrentEventDtRequest() const
Get the current time increment request for this event.
bool isReadyForCleanup(real64 const time) const
Is the event ready for cleanup?
bool isReadyForExec() const
Check if the event is ready for execution.
integer getExitFlag()
Get the sum of the exit flags for the event/sub-events from the last execution.
virtual ~EventBase() override
Destructor.
virtual real64 getEventTypeDtRequest(real64 const time)
Get event-specifit dt requests.
bool isActive(real64 const time) const
Is the event active?
string getEventName() const
Get the string name of the target.
void setReadyForExec()
Define the event as ready for execution.
ExecutableGroup * getEventTarget() const
Get the target of this event.
void getExecutionOrder(array1d< integer > &eventCounters)
Count the number of events/sub-events.
virtual void signalToPrepareForExecution(real64 const time, real64 const dt, integer const cycle, DomainPartition &domain) override
If the event forecast is equal to 1, then signal the targets to prepare for execution during the next...
virtual bool execute(real64 const time_n, real64 const dt, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
If the event forecast is equal to 0, then call the step function on its target and/or children.
bool isIdle() const
Check if the event is idle.
void setProgressIndicator(array1d< integer > &eventCounters)
Update the event progress for the event/sub-events.
virtual void checkEvents(real64 const time, real64 const dt, integer const cycle, DomainPartition &domain)
Events are triggered based upon their forecast values, which are defined as the expected number of co...
virtual void estimateEventTiming(real64 const time, real64 const dt, integer const cycle, DomainPartition &domain)=0
Perform the calculations to estimate the timing of the event.
void setForecast(integer forecast)
Sets the forecast.
void getTargetReferences()
Process input data to retrieve targeted objects internally. The target object for an event may be spe...
void setIdle()
Define the event as idle.
integer m_lastCycle
The last cycle the event occurred.
static CatalogInterface::CatalogType & getCatalog()
Get the singleton catalog for this Group.
bool hasToPrepareForExec() const
Check if the event must be preparing for execution.
This class provides the base class/interface for the catalog value objects.
std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
This is the type that will be used for the catalog. The catalog is actually instantiated in the BASET...
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
double real64
64-bit floating point type.
std::int32_t integer
Signed integer type.
Array< T, 1 > array1d
Alias for 1D array.
Structure to hold scoped key names.