GEOSX
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
geosx::PeriodicEvent Class Reference

#include <PeriodicEvent.hpp>

Inheritance diagram for geosx::PeriodicEvent:
Inheritance graph
[legend]

Public Member Functions

 PeriodicEvent (const std::string &name, Group *const parent)
 Constructor. More...
 
virtual ~PeriodicEvent () override
 Destructor.
 
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. More...
 
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. More...
 
virtual real64 GetEventTypeDtRequest (real64 const time) override
 Get event-specifit dt requests. More...
 
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. More...
 
- Public Member Functions inherited from geosx::EventBase
 EventBase (std::string const &name, Group *const parent)
 Main constructor. More...
 
virtual ~EventBase () override
 Destructor.
 
virtual void SignalToPrepareForExecution (real64 const time, real64 const dt, integer const cycle, dataRepository::Group *domain) override
 If the event forecast is equal to 1, then signal the targets to prepare for execution during the next cycle. More...
 
virtual void Execute (real64 const time_n, real64 const dt, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, dataRepository::Group *domain) override
 If the event forecast is equal to 0, then call the step function on its target and/or children. More...
 
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. More...
 
virtual GroupCreateChild (string const &childKey, string const &childName) override
 Creates a new sub-Group using the ObjectCatalog functionality. More...
 
virtual void ExpandObjectCatalogs () override
 Expand any catalogs in the data structure.
 
void GetTargetReferences ()
 Process input data to retrieve targeted objects internally. The target object for an event may be specified via the keyword "target" in the input xml. This string is empty by default and uses GetGroupByPath() method in Group, which returns a pointer to the target using a unix-style path as an input (both absolute and relative paths work). This involves a lot of string parsing, so we do it once during initialization.
 
virtual void CheckEvents (real64 const time, real64 const dt, integer const cycle, dataRepository::Group *domain)
 Events are triggered based upon their forecast values, which are defined as the expected number of code cycles before they are executed. This method will call EstimateEventTiming (defined in each subclass) on this event and its children. More...
 
virtual real64 GetTimestepRequest (real64 const time) override
 Collect time-step size requests from targets and/or children. More...
 
void GetExecutionOrder (array1d< integer > &eventCounters)
 Count the number of events/sub-events. More...
 
void SetProgressIndicator (array1d< integer > &eventCounters)
 Update the event progress for the event/sub-events. More...
 
integer GetExitFlag ()
 Get the sum of the exit flags for the event/sub-events from the last execution. More...
 
void SetExitFlag (integer flag)
 Set this event objects exit flag. More...
 
real64 GetCurrentEventDtRequest () const
 Get the current time increment request for this event. More...
 
integer getForecast () const
 Get the forecast of the current event. More...
 
bool isReadyForExec () const
 Check if the event is ready for execution. More...
 
bool hasToPrepareForExec () const
 Check if the event must be preparing for execution. More...
 
bool isIdle () const
 Check if the event is idle. More...
 
- Public Member Functions inherited from geosx::ExecutableGroup
void SetTimestepBehavior (integer const behavior)
 Set the timestep behavior for a target. More...
 
integer GetTimestepBehavior ()
 Get the target's time step behavior. More...
 
- Public Member Functions inherited from geosx::dataRepository::Group
 Group (std::string const &name, Group *const parent)
 Constructor. More...
 
 Group (Group &&source)
 Move constructor. More...
 
virtual ~Group ()
 Destructor, deletes all Groups and Wrappers owned by this Group.
 
 Group ()=delete
 Deleted default constructor.
 
 Group (Group const &)=delete
 Deleted copy constructor.
 
 Group (Group const &&)=delete
 Deleted move constructor.
 
Groupoperator= (Group const &)=delete
 Deleted copy assignment operator. More...
 
Groupoperator= (Group &&)=delete
 Deleted move assignment operator. More...
 
virtual const std::type_info & get_typeid () const
 Get typeid for current group. More...
 
bool CheckTypeID (std::type_info const &typeToCheck) const
 Check a type_info against the type_info of this Group. More...
 
void PrintDataHierarchy (integer indent=0)
 Prints the data hierarchy recursively. More...
 
string dumpInputOptions () const
 
template<typename T = Group>
T * RegisterGroup (std::string const &name, std::unique_ptr< T > newObject)
 Register a new Group as a sub-group of current Group. More...
 
template<typename T = Group>
T * RegisterGroup (std::string const &name, T *newObject)
 Register a new Group as a sub-group of current Group. More...
 
template<typename T = Group>
T * RegisterGroup (std::string const &name)
 Register a new Group as a sub-group of current Group. More...
 
template<typename T = Group>
T * RegisterGroup (subGroupMap::KeyIndex const &keyIndex)
 Register a new Group as a sub-group of current Group. More...
 
template<typename T = Group, typename TBASE = Group>
T * RegisterGroup (std::string const &name, std::string const &catalogName)
 Register a new Group as a sub-group of current Group. More...
 
void deregisterGroup (std::string const &name)
 Removes a child group from this group. More...
 
template<typename T = Group>
T * GetGroup (localIndex index)
 Retrieve a sub-group from the current Group using an index. More...
 
template<typename T = Group>
T const * GetGroup (localIndex index) const
 Retrieve a sub-group from the current Group using an index. More...
 
template<typename T = Group>
T * GetGroup (string const &name)
 Retrieve a sub-group from the current Group using a string. More...
 
template<typename T = Group>
T const * GetGroup (string const &name) const
 Retrieve a sub-group from the current Group using a string. More...
 
template<typename T = Group>
T & getGroupReference (string const &key)
 
template<typename T = Group>
T const & getGroupReference (string const &key) const
 
template<typename T = Group>
T & GetGroupReference (subGroupMap::KeyIndex const &key)
 
template<typename T = Group>
T const & GetGroupReference (subGroupMap::KeyIndex const &key) const
 
template<typename T = Group>
T * GetGroup (subGroupMap::KeyIndex const &key)
 Retrieve a sub-group from the current Group using a KeyIndexT. More...
 
template<typename T = Group>
T const * GetGroup (subGroupMap::KeyIndex const &key) const
 Retrieve a sub-group from the current Group using a KeyIndexT. More...
 
template<typename T = Group>
T * GetGroupByPath (string const &path)
 Retrieve a group from the hierarchy using a path. More...
 
template<typename T = Group>
T const * GetGroupByPath (string const &path) const
 Retrieve a group from the hierarchy using a path. More...
 
subGroupMapGetSubGroups ()
 Get the subgroups object. More...
 
subGroupMap const & GetSubGroups () const
 Get the subgroups object. More...
 
localIndex numSubGroups () const
 return the number of sub groups in this Group More...
 
bool hasGroup (std::string const &name) const
 Check whether a sub-group exists. More...
 
template<typename GROUPTYPE = Group, typename ... GROUPTYPES, typename LAMBDA >
void forSubGroups (LAMBDA lambda)
 Apply the given functor to subgroups that can be casted to one of specified types. More...
 
template<typename GROUPTYPE = Group, typename ... GROUPTYPES, typename LAMBDA >
void forSubGroups (LAMBDA lambda) const
 Apply the given functor to subgroups that can be casted to one of specified types. More...
 
template<typename GROUPTYPE = Group, typename ... GROUPTYPES, typename LOOKUP_CONTAINER , typename LAMBDA >
void forSubGroups (LOOKUP_CONTAINER const &subGroupKeys, LAMBDA lambda)
 
template<typename GROUPTYPE = Group, typename ... GROUPTYPES, typename LOOKUP_CONTAINER , typename LAMBDA >
void forSubGroups (LOOKUP_CONTAINER const &subGroupKeys, LAMBDA lambda) const
 
template<typename LAMBDA >
void forWrappers (LAMBDA lambda)
 Apply the given functor to wrappers. More...
 
template<typename LAMBDA >
void forWrappers (LAMBDA lambda) const
 Apply the given functor to wrappers. More...
 
template<typename TYPE , typename ... TYPES, typename LAMBDA >
void forWrappers (LAMBDA lambda)
 Apply the given functor to wrappers that can be cast to one of specified types. More...
 
template<typename TYPE , typename ... TYPES, typename LAMBDA >
void forWrappers (LAMBDA lambda) const
 Apply the given functor to wrappers that can be cast to one of specified types. More...
 
void Initialize (Group *const group)
 Run initialization functions on this and all subgroups. More...
 
virtual void InitializationOrder (string_array &order)
 Sets the initialization order for sub-Groups. More...
 
void InitializePostInitialConditions (Group *const group)
 Initialization routine to be called after calling ApplyInitialConditions(). More...
 
void postRestartInitializationRecursive (Group *const domain)
 Initialization routine to be called after calling reading a restart file. More...
 
void ProcessInputFileRecursive (xmlWrapper::xmlNode &targetNode)
 Recursively read values using ProcessInputFile() from the input file and put them into the wrapped values for this group. More...
 
void PostProcessInputRecursive ()
 Recursively call PostProcessInput() to apply post processing after reading input values.
 
template<typename T , typename TBASE = T>
Wrapper< TBASE > * registerWrapper (std::string const &name, wrapperMap::KeyIndex::index_type *const rkey=nullptr)
 Create and register a Wrapper around a new object. More...
 
template<typename T , typename TBASE = T>
Wrapper< TBASE > * registerWrapper (Group::wrapperMap::KeyIndex const &viewKey)
 
template<typename T >
Wrapper< T > * registerWrapper (std::string const &name, std::unique_ptr< T > newObject)
 Register a Wrapper around a given object and take ownership. More...
 
template<typename T >
Wrapper< T > * registerWrapper (std::string const &name, T *newObject)
 Register a Wrapper around an existing object, does not take ownership of the object. More...
 
WrapperBaseregisterWrapper (string const &name, std::unique_ptr< WrapperBase > wrapper)
 Register and take ownership of an existing Wrapper. More...
 
void deregisterWrapper (string const &name)
 Removes a Wrapper from this group. More...
 
void GenerateDataStructureSkeleton (integer const level)
 Build a complete datastructure for schema generation. More...
 
virtual void SetSchemaDeviations (xmlWrapper::xmlNode schemaRoot, xmlWrapper::xmlNode schemaParent, integer documentationType)
 Inform the schema generator of any deviations between the xml and GEOS data structures. More...
 
virtual void RegisterDataOnMeshRecursive (Group *const meshBodies)
 Calls RegisterDataOnMesh() recursively. More...
 
virtual void RegisterDataOnMesh (Group *const meshBodies)
 Register data on mesh entities. More...
 
virtual localIndex PackSize (string_array const &wrapperNames, integer const recursive, bool on_device=false) const
 Get the size required to pack a list of wrappers. More...
 
virtual localIndex PackSize (string_array const &wrapperNames, arrayView1d< localIndex const > const &packList, integer const recursive, bool on_device=false) const
 Get the size required to pack a list of indices within a list of wrappers. More...
 
virtual localIndex Pack (buffer_unit_type *&buffer, string_array const &wrapperNames, integer const recursive, bool on_device=false) const
 Pack a list of wrappers to a buffer. More...
 
virtual localIndex Pack (buffer_unit_type *&buffer, string_array const &wrapperNames, arrayView1d< localIndex const > const &packList, integer const recursive, bool on_device=false) const
 Pack a list of indices within a list of wrappers. More...
 
virtual localIndex Unpack (buffer_unit_type const *&buffer, arrayView1d< localIndex > &packList, integer const recursive, bool on_device=false)
 Unpack a buffer. More...
 
WrapperBase const * getWrapperBase (indexType const index) const
 Retrieve a WrapperBase stored in this group. More...
 
WrapperBasegetWrapperBase (indexType const index)
 Retrieve a WrapperBase stored in this group. More...
 
WrapperBase const * getWrapperBase (std::string const &name) const
 Retrieve a WrapperBase stored in this group. More...
 
WrapperBasegetWrapperBase (std::string const &name)
 Retrieve a WrapperBase stored in this group. More...
 
WrapperBase const * getWrapperBase (wrapperMap::KeyIndex const &keyIndex) const
 Retrieve a WrapperBase stored in this group. More...
 
WrapperBasegetWrapperBase (wrapperMap::KeyIndex const &keyIndex)
 Retrieve a WrapperBase stored in this group. More...
 
indexType getWrapperIndex (std::string const &name) const
 
wrapperMap const & wrappers () const
 Get access to the internal wrapper storage. More...
 
wrapperMapwrappers ()
 Get access to the internal wrapper storage. More...
 
template<typename LOOKUP_TYPE >
bool hasWrapper (LOOKUP_TYPE const &lookup) const
 Check if a wrapper exists. More...
 
template<typename T , typename LOOKUP_TYPE >
Wrapper< T > const * getWrapper (LOOKUP_TYPE const &index) const
 Retrieve a Wrapper stored in this group. More...
 
template<typename T , typename LOOKUP_TYPE >
Wrapper< T > * getWrapper (LOOKUP_TYPE const &index)
 Retrieve a Wrapper stored in this group. More...
 
template<typename T >
Wrapper< T > const * getWrapper (char const *const key) const
 Retrieve a Wrapper stored in this group. More...
 
template<typename T >
Wrapper< T > * getWrapper (char const *const key)
 Retrieve a Wrapper stored in this group. More...
 
template<typename T , typename LOOKUP_TYPE >
GEOSX_DECLTYPE_AUTO_RETURN getReference (LOOKUP_TYPE const &lookup) const
 Look up a wrapper and get reference to wrapped object. More...
 
template<typename T , typename LOOKUP_TYPE >
T & getReference (LOOKUP_TYPE const &lookup)
 Look up a wrapper and get reference to wrapped object. More...
 
template<typename T >
GEOSX_DECLTYPE_AUTO_RETURN getReference (char const *const name) const
 
template<typename T >
T & getReference (char const *const name)
 
virtual void resize (localIndex const newSize)
 Resize the group and all contained wrappers that resize with parent. More...
 
virtual void reserve (indexType const newsize)
 Set the new capacity and reserve it in all wrappers that resize with parent. More...
 
localIndex capacity () const
 Get the "capacity" of the group, which determines the capacity of resizable wrappers. More...
 
localIndex size () const
 Get the "size" of the group, which determines the number of elements in resizable wrappers. More...
 
const string getName () const
 Get group name. More...
 
GroupgetParent ()
 Access the group's parent. More...
 
Group const * getParent () const
 Access the group's parent. More...
 
localIndex getIndexInParent () const
 Get the group's index withing its parent group. More...
 
integer sizedFromParent () const
 Check whether this Group is resized when its parent is resized. More...
 
GroupsetSizedFromParent (int val)
 Set whether this wrapper is resized when its parent is resized. More...
 
RestartFlags getRestartFlags () const
 Get flags that control restart output of this group. More...
 
void setRestartFlags (RestartFlags flags)
 Set flags that control restart output of this group. More...
 
InputFlags getInputFlags () const
 Get input flags for schema generation. More...
 
void setInputFlags (InputFlags flags)
 Set input flags for schema generation. More...
 
conduit::Node & getConduitNode ()
 Get the Conduit node object associated with this group. More...
 
void prepareToWrite ()
 Register the group and its wrappers with Conduit.
 
void finishWriting ()
 Write the group and its wrappers into Conduit.
 
void loadFromConduit ()
 Read the group and its wrappers from Conduit.
 
void enableLogLevelInput ()
 Enable verbosity input for object.
 
integer getLogLevel () const
 
template<typename T >
group_cast ()
 Downcast this Group. More...
 
template<typename T >
group_cast () const
 Downcast this Group. More...
 

Static Public Member Functions

static string CatalogName ()
 Catalog name interface. More...
 
- Static Public Member Functions inherited from geosx::EventBase
static string CatalogName ()
 Catalog name interface. More...
 
static CatalogInterface::CatalogTypeGetCatalog ()
 Get the singleton catalog for this class. More...
 
- Static Public Member Functions inherited from geosx::dataRepository::Group
template<typename T0 , typename T1 , typename ... CASTTYPES, typename CONTAINERTYPE , typename LAMBDA >
static bool applyLambdaToContainer (CONTAINERTYPE &container, LAMBDA &&lambda)
 Apply a given functor to a container if the container can be cast to one of the specified types. More...
 
static CatalogInterface::CatalogTypeGetCatalog ()
 Get the singleton catalog for this class. More...
 
template<typename T >
static T group_cast (Group *group)
 Downcast a Group *. More...
 
template<typename T >
static T group_cast (Group const *group)
 Downcast a Group const *. More...
 

Public Attributes

dataRepository::Groupm_functionTarget
 A pointer to an optional function.
 
real64 m_timeFrequency
 The event time frequency.
 
integer m_cycleFrequency
 The event cycle frequency.
 
integer m_targetExactTimestep
 Whether to target the exact timestep.
 
string m_functionName
 The optional function's name.
 
string m_functionInputObject
 The name of the optional function input object.
 
string m_functionInputSetname
 The name of the optional function input set.
 
integer m_functionStatOption
 The optional funciton's statistic option.
 
real64 m_eventThreshold
 The event threshold.
 

Additional Inherited Members

- Public Types inherited from geosx::EventBase
using CatalogInterface = dataRepository::CatalogInterface< EventBase, std::string const &, Group *const >
 Catalog interface.
 
- Public Types inherited from geosx::dataRepository::Group
using subGroupMap = MappedVector< Group, Group *, keyType, indexType >
 The template specialization of MappedVector to use for the collection of sub-Group objects.
 
using wrapperMap = MappedVector< WrapperBase, WrapperBase *, keyType, indexType >
 The template specialization of MappedVector to use for the collection wrappers objects.
 
using CatalogInterface = dataRepository::CatalogInterface< Group, std::string const &, Group *const >
 Type alias for catalog interface used by this class. See CatalogInterface.
 
- Protected Member Functions inherited from geosx::EventBase
void setReadyForExec ()
 Define the event as ready for execution.
 
void setPrepareForExec ()
 Define that the event should prepare for execution.
 
void setIdle ()
 Define the event as idle.
 
void setForecast (integer forecast)
 Sets the forecast. More...
 
bool isActive (real64 const time) const
 Is the event active? More...
 
ExecutableGroupGetEventTarget () const
 Get the target of this event. More...
 
- Protected Member Functions inherited from geosx::dataRepository::Group
virtual void PostProcessInput ()
 
virtual void InitializePreSubGroups (Group *const group)
 Called by Initialize() prior to initializing sub-Groups. More...
 
virtual void InitializePostSubGroups (Group *const group)
 Called by Initialize() after to initializing sub-Groups. More...
 
virtual void InitializePostInitialConditions_PreSubGroups (Group *const group)
 Called by InitializePostInitialConditions() prior to initializing sub-Groups. More...
 
virtual void InitializePostInitialConditions_PostSubGroups (Group *const group)
 Called by InitializePostInitialConditions() after to initializing sub-Groups. More...
 
virtual void postRestartInitialization (Group *const domain)
 Performs initialization required after reading from a restart file. More...
 
- Protected Attributes inherited from geosx::EventBase
real64 m_lastTime
 The last time the event occurred.
 
integer m_lastCycle
 The last cycle the event occurred.
 

Detailed Description

An event type for periodic events (using either time or cycle as a basis).

Definition at line 32 of file PeriodicEvent.hpp.

Constructor & Destructor Documentation

◆ PeriodicEvent()

geosx::PeriodicEvent::PeriodicEvent ( const std::string &  name,
Group *const  parent 
)

Constructor.

Parameters
[in]namethe name of this object manager
[in]parentthe parent Group

Member Function Documentation

◆ CatalogName()

static string geosx::PeriodicEvent::CatalogName ( )
inlinestatic

Catalog name interface.

Returns
This type's catalog name.

Definition at line 47 of file PeriodicEvent.hpp.

◆ CheckOptionalFunctionThreshold()

void geosx::PeriodicEvent::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.

Parameters
timeThe current simulation time.
dtThe current simulation time increment.
cycleThe current simulation cycle.
domainThe DomainPartition upcast to a Group. If the event forecast is zero, and an optional function (f) is specified, then this method will be called to see if the event should be triggered or ignored. For example, this could be used to periodically check the condition of the mesh, and trigger a cleanup if necessary.

If functionInputObject is not specified:

  • The argument to the function will be the current time
  • The event will be executed if f(t) >= eventThreshold

If functionInputObject is specified:

  • The function will be called on the object, with the arguments given by functionInputSetname
  • The function manager will return a set of statistics
  • functionStatOption selects the statistic to compare against the eventThreshold (0 = min, 1 = average, 2 = max)
  • The event will be executed if f(object, arguments)[stat] >= eventThreshold

◆ Cleanup()

virtual void geosx::PeriodicEvent::Cleanup ( real64 const  time_n,
integer const  cycleNumber,
integer const  eventCounter,
real64 const  eventProgress,
dataRepository::Group domain 
)
overridevirtual

Called as the code exits the main run loop.

Parameters
[in]time_ncurrent time level
[in]cycleNumberglobal cycle number
[in]eventCounterindex of event that triggered execution
[in]eventProgressfractional progress in current cycle
[in,out]domainthe physical domain

Reimplemented from geosx::ExecutableGroup.

◆ EstimateEventTiming()

virtual void geosx::PeriodicEvent::EstimateEventTiming ( real64 const  time,
real64 const  dt,
integer const  cycle,
dataRepository::Group domain 
)
overridevirtual

Perform the calculations to estimate the timing of the event.

Parameters
timeThe current simulation time.
dtThe current simulation time increment.
cyclethe current simulation cycle.
domainThe problem domain up-cast to a Group.
Note
Estimate the expected number of cycles until an event is expected to trigger. The event frequency can be specified in terms of:
  • time (timeFrequency > 0, units = seconds)
  • or cycle (cycleFrequency >= 0, units = cycles)
In addition, there is an optional function input that will be called if the the nominal forecast (based on timing) is zero.

Implements geosx::EventBase.

◆ GetEventTypeDtRequest()

virtual real64 geosx::PeriodicEvent::GetEventTypeDtRequest ( real64 const  time)
overridevirtual

Get event-specifit dt requests.

Parameters
timeThe current simulation time.
Returns
The requested time step. Grab the next time-step. If requested, then limit the requested dt to exactly match the time frequency

Reimplemented from geosx::EventBase.


The documentation for this class was generated from the following file: