|
neic-glass3
1.4.6
|
glasscore hypocenter list class More...
#include <HypoList.h>


Public Member Functions | |
| CHypoList (int numThreads=1, int sleepTime=50, int checkInterval=300) | |
| CHypoList constructor. More... | |
| ~CHypoList () | |
| CHypoList destructor. More... | |
| bool | addHypo (std::shared_ptr< CHypo > hypo, bool scheduleProcessing=true, CPickList *parentThread=NULL) |
| Add hypo to list. More... | |
| bool | associateData (std::shared_ptr< CPick > pk) |
| Try to associate pick to a hypo in the list. More... | |
| bool | fitData (std::shared_ptr< CPick > pk) |
| Try to fit pick to a hypo in the list. More... | |
| bool | associateData (std::shared_ptr< CCorrelation > corr) |
| Try to associate correlation to a hypo in the list. More... | |
| void | clear () override |
| CHypoList clear function. More... | |
| bool | receiveExternalMessage (std::shared_ptr< json::Object > com) |
| CHypoList communication receiving function. More... | |
| bool | processHypo (std::shared_ptr< CHypo > hyp) |
| Process provided hypocenter. More... | |
| int | getHypoProcessingQueueLength () |
| Get the current length of the hypocenter processing queue. More... | |
| std::vector< std::weak_ptr< CHypo > > | getHypos (double t1, double t2) |
| Get list of CHypos in given time range. More... | |
| int | getMaxAllowableHypoCount () const |
| Gets the maximum number of hypocenters this list will hold. More... | |
| int | getCountOfTotalHyposProcessed () const |
| Get the total number of hypos processed by this list. More... | |
| int | length () const |
| Get the current number of hypos contained in this list. More... | |
| bool | findAndMergeMatchingHypos (std::shared_ptr< CHypo > hyp) |
| Merge hypos close in space time. More... | |
| int | appendToHypoProcessingQueue (std::shared_ptr< CHypo > hyp) |
| Append hypo to processing queue. More... | |
| std::shared_ptr< CHypo > | getNextHypoFromProcessingQueue () |
| Get first hypo from processing queue. More... | |
| void | removeHypo (std::shared_ptr< CHypo > hypo, bool reportCancel=true) |
| Remove hypo from list. More... | |
| bool | requestHypo (std::shared_ptr< json::Object > com) |
| Cause CHypoList to generate a Hypo message for a hypocenter. More... | |
| bool | resolveData (std::shared_ptr< CHypo > hypo, bool allowStealing=true) |
| Ensure all supporting belong to hypo. More... | |
| void | setMaxAllowableHypoCount (int hypoMax) |
| Set the maximum number of hypos that this list will support. More... | |
| glass3::util::WorkState | work () override |
| Hypolist work function. More... | |
Public Member Functions inherited from glass3::util::ThreadBaseClass | |
| ThreadBaseClass () | |
| ThreadBaseClass constructor. More... | |
| ThreadBaseClass (std::string threadName, int sleepTimeMS=100, int numThreads=1, int checkInterval=300) | |
| An advanced constructor that sets up the ThreadBaseClass with a provided thread name, sleep between work time duration, number of threads, and statsus check interval. More... | |
| ~ThreadBaseClass () | |
| ThreadBaseClass destructor. More... | |
| virtual bool | start () |
| work thread start function More... | |
| virtual bool | stop () |
| work thread stop function More... | |
| int | getNumThreads () |
| Retrieves the number of work threads. More... | |
| void | setNumThreads (int numThreads) |
| Sets the number of work threads. More... | |
| void | setThreadHealth (bool health=true) |
| Function to set thread health. More... | |
| virtual bool | healthCheck () |
| work threads check function More... | |
| void | setSleepTime (int sleepTimeMS) |
| Sets the time to sleep between work() calls. More... | |
| int | getSleepTime () |
| Retrieves the time to sleep between work() calls. More... | |
| glass3::util::ThreadState | getWorkThreadsState () |
| Function to get the work threads state. More... | |
| void | setHealthCheckInterval (int interval) |
| Function to set work threads health check interval. More... | |
| int | getHealthCheckInterval () |
| Function to retrieve the work threads health check interval. More... | |
| bool | getTerminate () |
| Function to retrieve whether the thread should terminate. More... | |
| const std::string & | getThreadName () |
| Function to retrieve the name of the work threads. More... | |
| std::time_t | getAllLastHealthy (size_t *pThreadId) |
| Function to retrieve the oldest time any of the work threads last updated their health status as healthy. More... | |
Public Member Functions inherited from glass3::util::BaseClass | |
| BaseClass () | |
| BaseClass constructor. More... | |
| virtual | ~BaseClass () |
| BaseClass destructor. More... | |
| virtual bool | setup (std::shared_ptr< const json::Object > config) |
| BaseClass configuration function. More... | |
| const std::shared_ptr< const json::Object > | getConfig () |
| bool | getSetup () |
| Retrieves the class member boolean flag indicating whether the class has been setup, set to true if setup was successful. More... | |
| const std::string & | getDefaultAgencyId () |
| Function to retrieve the name of the default agency id. More... | |
| void | setDefaultAgencyId (const std::string &id) |
| Function to set the name of the default agency id. More... | |
| const std::string & | getDefaultAuthor () |
| Function to retrieve the name of the default author. More... | |
| void | setDefaultAuthor (const std::string &author) |
| Function to set the name of the default author. More... | |
Static Public Attributes | |
| static constexpr double | k_nHypoSearchPastDurationForPick = 3600 |
| The duration in seconds to search into the past for hypos matching a pick. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from glass3::util::ThreadBaseClass | |
| void | setWorkThreadsState (glass3::util::ThreadState state) |
| Function to set threads state. More... | |
| void | workLoop () |
| ThreadBaseClass work loop function. More... | |
| void | setLastHealthy (std::time_t now) |
| Function to set the last time the work thread was healthy. More... | |
Protected Attributes inherited from glass3::util::ThreadBaseClass | |
| std::vector< std::thread > | m_WorkThreads |
| the std::vector that contains the work std::thread objects More... | |
| std::map< std::thread::id, std::atomic< int > > | m_ThreadHealthMap |
| A std::map containing the epoch times as std::atomic<double>> that each work thread was last marked as healthy, identified by the thread id. More... | |
Protected Attributes inherited from glass3::util::BaseClass | |
| std::shared_ptr< const json::Object > | m_Config |
| A shared pointer to the json::Object that holds the configuration. More... | |
| std::atomic< bool > | m_bIsSetup |
| the boolean flag indicating whether the class has been setup, set to true if setup was successful. More... | |
| std::string | m_DefaultAgencyID |
| A std::string containing the default agency id to use in parsing if one is not provided. More... | |
| std::string | m_DefaultAuthor |
| A std::string containing the default author to use in parsing if one is not provided. More... | |
glasscore hypocenter list class
The CHypoList class is the class that maintains a std::map of all the earthquake hypocenters being considered by glasscore.
CHypoList also maintains a std::vector mapping the double hypo origin time (in Gregorian seconds) to the std::string hypo id
CHypoList also maintains a std::vector of std::string ids of hypos to be processed
CHypoList contains functions to support hypocenter refinement, new data association, and requesting output data.
CHypoList uses smart pointers (std::shared_ptr).
|
explicit |
CHypoList constructor.
The constructor for the CHypoList class.
| numThreads | - An integer containing the number of threads in the pool. Default 1 |
| sleepTime | - An integer containing the amount of time to sleep in milliseconds between jobs. Default 50 |
| checkInterval | - An integer containing the amount of time in seconds between status checks. -1 to disable status checks. Default 300. |
| bool glasscore::CHypoList::addHypo | ( | std::shared_ptr< CHypo > | hypo, |
| bool | scheduleProcessing = true, |
||
| CPickList * | parentThread = NULL |
||
| ) |
Add hypo to list.
Add the given hypocenter to the vector and map, if the new hypocenter causes the number of hypocenters in the vector/map to exceed the configured maximum, remove the oldest hypocenter from the list/map.
Adds the hypocenter to the processing queue, and optionally schedules it for processing
| hypo | - A std::shared_ptr to the hypocenter to add |
| scheduleProcessing | - A boolean flag indicating whether to automatically schedule processing when the hypo is added, defaults to true |
| parentThread | - A pointer to a CPickList parent to write thread status to |
| int glasscore::CHypoList::appendToHypoProcessingQueue | ( | std::shared_ptr< CHypo > | hyp | ) |
Append hypo to processing queue.
Append the given hypocenter to the processing queue if it is not already in the queue.
| hyp | - A std::shared_ptr to the hypocenter to add |
| bool glasscore::CHypoList::associateData | ( | std::shared_ptr< CPick > | pk | ) |
Try to associate pick to a hypo in the list.
Attempt to associate the given pick to a hypocenter in the list
Adds the hypocenter to the processing queue if a pick was associated.
| pk | - A std::shared_ptr to the pick to associate. |
| bool glasscore::CHypoList::associateData | ( | std::shared_ptr< CCorrelation > | corr | ) |
Try to associate correlation to a hypo in the list.
Attempt to associate the given correlation to a hypocenter in the list
Adds the hypocenter to the processing queue if a correlation was associated.
| corr | - A std::shared_ptr to the correlation to associate. |
|
overridevirtual |
CHypoList clear function.
Reimplemented from glass3::util::BaseClass.
| bool glasscore::CHypoList::findAndMergeMatchingHypos | ( | std::shared_ptr< CHypo > | hyp | ) |
Merge hypos close in space time.
This function attempts to merge the picks of the given hypo and other hypos within a time/distance range into a target hypo. This function prefers a reported hypo over an unreported hypo when selecting the merge target. If the targeted hypo's resultant stack value is high enough then the target hypo keeps the picks, and the donor hypo(s) are canceled / removed.
| hyp | - a shared_ptr to the CHypo to start the merge process with |
| bool glasscore::CHypoList::fitData | ( | std::shared_ptr< CPick > | pk | ) |
Try to fit pick to a hypo in the list.
Attempt to fit the given pick to a hypocenter in the list
| pk | - A std::shared_ptr to the pick to associate. |
| int glasscore::CHypoList::getCountOfTotalHyposProcessed | ( | ) | const |
Get the total number of hypos processed by this list.
| int glasscore::CHypoList::getHypoProcessingQueueLength | ( | ) |
Get the current length of the hypocenter processing queue.
| std::vector< std::weak_ptr< CHypo > > glasscore::CHypoList::getHypos | ( | double | t1, |
| double | t2 | ||
| ) |
Get list of CHypos in given time range.
Get a list of hypocenters in vHypo with origin time within given range
| t1 | - Starting time of selection range |
| t2 | - Ending time of selection range |
| int glasscore::CHypoList::getMaxAllowableHypoCount | ( | ) | const |
Gets the maximum number of hypocenters this list will hold.
| std::shared_ptr< CHypo > glasscore::CHypoList::getNextHypoFromProcessingQueue | ( | ) |
Get first hypo from processing queue.
Get the first valid hypocenter from the processing queue.
| int glasscore::CHypoList::length | ( | ) | const |
Get the current number of hypos contained in this list.
| bool glasscore::CHypoList::processHypo | ( | std::shared_ptr< CHypo > | hyp | ) |
Process provided hypocenter.
Process the provided hypocenter by localizing, scavenging, pruning, performing cancel checks, and output message generation. The hypocenter is put back on the processing queue if the hypo is changed and not canceled.
| hyp | - A std::shared_ptr to the hypocenter to have its pick assocations resolved. |
| bool glasscore::CHypoList::receiveExternalMessage | ( | std::shared_ptr< json::Object > | com | ) |
CHypoList communication receiving function.
The function used by CHypoList to receive communication (such as configuration or input data), from outside the glasscore library, or it's parent CGlass.
Supports the ReqHypo (generate output hypocenter message) input.
| com | - A pointer to a json::object containing the communication. |
| void glasscore::CHypoList::removeHypo | ( | std::shared_ptr< CHypo > | hypo, |
| bool | reportCancel = true |
||
| ) |
Remove hypo from list.
Remove given hypocenter from the underlying multiset. Also, unlink any associated data, and optionally generate a cancelation message.
| hypo | - A std::shared_ptr to the hypocenter to remove |
| reportCancel | A boolean flag indicating whether to report a cancel message when the hypo is removed |
| bool glasscore::CHypoList::requestHypo | ( | std::shared_ptr< json::Object > | com | ) |
Cause CHypoList to generate a Hypo message for a hypocenter.
Causes CHypoList to generate a json formatted hypocenter message for the id in the given ReqHypo message and send a pointer to this object to CGlass (and out of glasscore) by calling the hypo's Hypo() function
| com | - A pointer to a json::object containing the id of the hypocenter to use |
| bool glasscore::CHypoList::resolveData | ( | std::shared_ptr< CHypo > | hypo, |
| bool | allowStealing = true |
||
| ) |
Ensure all supporting belong to hypo.
Search through all supporting data in the given hypocenter's lists, using the hypo affinity functions to determine whether the data best fits the hypocenter or not.
Note that this function is in hypolist for threading deadlock reasons
| hypo | - A shared_ptr to a CHypo to resolve |
| allowStealing | - A boolean flag indicating whether to allow resolveData to steal data, defaults to true |
| void glasscore::CHypoList::setMaxAllowableHypoCount | ( | int | hypoMax | ) |
Set the maximum number of hypos that this list will support.
| hypoMax | - an integer containing the maximum number of hypos that this list will support |
|
overridevirtual |
Hypolist work function.
Process the next hypo on the processing queue. Typically hypocenters are added to the processing queue because they are either new, or have been modified by another part of glasscore.
A process count is set when a hypocenter is first scheduled (by addHypo() or associate()) for processing. Hypocenters are only processed a limited number of times, up to the overall glasscore process limit. Any additional after this requires that new supporting data be added to the hypo via associateData()
Implements glass3::util::ThreadBaseClass.
|
static |
The duration in seconds to search into the past for hypos matching a pick.
1.8.11