|
neic-glass3
1.4.6
|
glasscore detection web class More...
#include <Web.h>


Public Member Functions | |
| CWeb (int numThreads=0, int sleepTime=100, int checkInterval=300) | |
| CWeb constructor. More... | |
| CWeb (std::string name, double thresh, int numDetect, int numNucleate, int resolution, bool update, bool save, bool allowControllingWebs, std::shared_ptr< traveltime::CTravelTime > firstTrav, std::shared_ptr< traveltime::CTravelTime > secondTrav, int numThreads=0, int sleepTime=100, int checkInterval=300, double aziTaper=360.0, double maxDepth=800.0, double aSeismicThresh=-1.0, int numASeismicNucleate=-1) | |
| CWeb advanced constructor. More... | |
| ~CWeb () | |
| CWeb destructor. More... | |
| void | clear () override |
| CWeb clear function. More... | |
| bool | receiveExternalMessage (std::shared_ptr< json::Object > com) |
| CWeb communication recieveing function. More... | |
| bool | initialize (std::string name, double thresh, int numDetect, int numNucleate, int resolution, bool update, bool save, bool allowControllingWebs, std::shared_ptr< traveltime::CTravelTime > firstTrav, std::shared_ptr< traveltime::CTravelTime > secondTrav, double aziTaper=360.0, double maxDepth=800.0, double aSeismicThresh=-1.0, int numASeismicNucleate=-1) |
| CWeb initialization function. More... | |
| bool | generateLocalGrid (std::shared_ptr< json::Object > gridConfiguration) |
| Generate a local detection grid. More... | |
| bool | generateExplicitGrid (std::shared_ptr< json::Object > gridConfiguration) |
| Generate a detection grid with explicit nodes. More... | |
| bool | generateGlobalGrid (std::shared_ptr< json::Object > gridConfiguration) |
| Generate a global detection grid. More... | |
| bool | loadGridConfiguration (std::shared_ptr< json::Object > gridConfiguration) |
| Load the common grid configuration. More... | |
| bool | loadTravelTimes (json::Object *gridConfiguration) |
| Load the travel times for this web. More... | |
| bool | loadFilters (std::shared_ptr< json::Object > gridConfiguration) |
| Load web filters. More... | |
| bool | loadWebSiteList () |
| Load web site list. More... | |
| void | sortSiteListForNode (double lat, double lon, double depth) |
| Sort site list. More... | |
| bool | addSiteToSiteList (std::shared_ptr< CSite > site) |
| Add site to this web's sitelist This function adds the given site to the site list local to this web. More... | |
| bool | removeSiteFromSiteList (std::shared_ptr< CSite > site) |
| Remove site from this web's sitelist This function Removes the given site to the site list local to this web. More... | |
| std::shared_ptr< CNode > | generateNode (double lat, double lon, double z, double resol) |
| Create new node. More... | |
| bool | addNode (std::shared_ptr< CNode > node) |
| Add node to list. More... | |
| std::shared_ptr< CNode > | generateNodeSites (std::shared_ptr< CNode > node) |
| Create list of sites for node. More... | |
| void | addSite (std::shared_ptr< CSite > site) |
| Add site to this web This function adds the given site to the list of nodes linked to this web and restructure node site lists. More... | |
| void | removeSite (std::shared_ptr< CSite > site) |
| Remove site from this web This function removes the given site to the list of nodes linked to this web and restructure node site lists. More... | |
| bool | nodesHaveSite (std::shared_ptr< CSite > site) |
| Check if the nodes in this web has a site This function checks to see if the given site is used by any of the nodes in this web, used by CWebList. More... | |
| bool | isSiteAllowed (std::shared_ptr< CSite > site, bool checkEnabled=true) |
| Check to see if site allowed This function checks to see if a given site is allowed in the web by checking the given site against the configured site filters. More... | |
| void | addJob (std::function< void()> newjob) |
| add a job More... | |
| double | getAzimuthTaper () const |
| Get the azimuth taper used for this web. More... | |
| double | getMaxDepth () const |
| Get the maximum depth used for this web. More... | |
| const CSiteList * | getSiteList () const |
| Get the CSiteList pointer used by this web for site lookups. More... | |
| void | setSiteList (CSiteList *siteList) |
| Set the CSiteList pointer used by this web for site lookups. More... | |
| bool | getUpdate () const |
| Gets a flag indicating whether this web supports updates. More... | |
| bool | getSaveGrid () const |
| Gets a flag indicating whether this web supports saving its nodes to an external file. More... | |
| bool | getAllowControllingWebs () const |
| Gets a boolean flag that stores whether this web will allow other (smaller) webs to override it's nucleation thresholds. More... | |
| double | getNodeResolution () const |
| Gets the node resolution of this web. More... | |
| double | getNucleationStackThreshold () const |
| Gets the nucleation minimum stack threshold used for this web. More... | |
| int | getNumStationsPerNode () const |
| Gets the number of stations to link to each node in this web. More... | |
| int | getNucleationDataCountThreshold () const |
| Gets the nucleation data minimum threshold used for this web. More... | |
| const std::string & | getName () const |
| Gets the name of this web. More... | |
| const std::shared_ptr< traveltime::CTravelTime > & | getNucleationTravelTime1 () const |
| Gets the primary nucleation travel time for this web. More... | |
| const std::shared_ptr< traveltime::CTravelTime > & | getNucleationTravelTime2 () const |
| Gets the secondary nucleation travel time for this web. More... | |
| int | getNetworksFilterSize () const |
| Get the number of network filters for this web. More... | |
| int | getSitesFilterSize () const |
| Get the number of site filters for this web. More... | |
| bool | getUseOnlyTeleseismicStations () const |
| Gets the flag indicating whether this web should only use sites flagged as UseForTeleseismic. More... | |
| int | size () const |
| Get the number of nodes in this web. More... | |
| glass3::util::WorkState | work () override |
| Web work function. More... | |
| bool | getZoneStatsAseismic (double dLat, double dLon) |
| zone stats aseismic retrieval function More... | |
| double | getZoneStatsMaxDepth (double dLat, double dLon) |
| zone stats max depth retrieval function More... | |
| double | getASeismicNucleationStackThreshold () const |
| Gets the aseismic nucleation minimum stack threshold used for this web. More... | |
| int | getASeismicNucleationDataCountThreshold () const |
| Gets the aseismic nucleation data (picks) minimum threshold used for this web. More... | |
| double | isWithin (double dLat, double dLon) |
| is coordinate within web 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... | |
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 detection web class
The CWeb class represents a detection graph database. CWeb contains the list of all the detection nodes.
CWeb uses a background thread to handle live reconfiguration / updates of the web.
CWeb uses smart pointers (std::shared_ptr).
|
explicit |
CWeb constructor.
The constructor for the CWeb class.
| numThreads | - An integer containing the desired number of background threads to process web updates. |
| sleepTime | - An integer containing the amount of time to sleep in milliseconds between jobs. Default 10 |
| checkInterval | - An integer containing the amount of time in seconds between status checks. -1 to disable status checks. Default 300. |
| glasscore::CWeb::CWeb | ( | std::string | name, |
| double | thresh, | ||
| int | numDetect, | ||
| int | numNucleate, | ||
| int | resolution, | ||
| bool | update, | ||
| bool | save, | ||
| bool | allowControllingWebs, | ||
| std::shared_ptr< traveltime::CTravelTime > | firstTrav, | ||
| std::shared_ptr< traveltime::CTravelTime > | secondTrav, | ||
| int | numThreads = 0, |
||
| int | sleepTime = 100, |
||
| int | checkInterval = 300, |
||
| double | aziTaper = 360.0, |
||
| double | maxDepth = 800.0, |
||
| double | aSeismicThresh = -1.0, |
||
| int | numASeismicNucleate = -1 |
||
| ) |
CWeb advanced constructor.
The advanced constructor for the CWeb class. Initializes members to provided values.
| name | - A std::string containing the name of the web. |
| thresh | - A double value containing this web's nucleation threshold. |
| numDetect | - An integer value containing the number of sites to link with each node in the web. |
| numNucleate | - An integer value containing the number of sites required for the web to nucleate an event. |
| resolution | - A double value containing the desired resolution for this web |
| update | - A boolean flag indicating whether this web is allowed to update |
| save | - A boolean flag indicating whether this web should save it's nodes to a file |
| allowControllingWebs | - A boolean flag indicating whether this web will allow other (smaller) webs to override it's nucleation thresholds |
| firstTrav | - A shared pointer to the first CTravelTime object to use for travel time lookups. |
| secondTrav | - A shared pointer to the second CTravelTime object to use for travel time lookups. |
| numThreads | - An integer containing the desired number of background threads to process web updates, if set to 0, glass will halt until the web update is completed. Default 0. |
| sleepTime | - An integer containing the amount of time to sleep in milliseconds between jobs. Default 10 |
| checkInterval | - An integer containing the amount of time in seconds between status checks. -1 to disable status checks. Default 60. |
| aziTaper | = A double value containing the azimuth taper to be used, defaults to 360 |
| maxDepth | = A double value containing the maximum allowable depth defaults to 800 km. |
| aSeismicThresh | = An optional double value containing this web's aseismic nucleation threshold, -1.0 to disable. |
| numASeismicNucleate | = An optional integer value containing the number of sites required for the web to nucleate an event at an aseismic node, -1 to disable |
| void glasscore::CWeb::addJob | ( | std::function< void()> | newjob | ) |
add a job
Adds a job to the queue of jobs to be run by the background thread
| newjob | - A std::function<void()> bound to the function containing the job to run |
| bool glasscore::CWeb::addNode | ( | std::shared_ptr< CNode > | node | ) |
Add node to list.
This function adds a new node to the list of nodes
| node | - A std::shared_ptr to the node to add |
| void glasscore::CWeb::addSite | ( | std::shared_ptr< CSite > | site | ) |
Add site to this web This function adds the given site to the list of nodes linked to this web and restructure node site lists.
| site | - A shared_ptr to a CSite object containing the site to add |
| bool glasscore::CWeb::addSiteToSiteList | ( | std::shared_ptr< CSite > | site | ) |
Add site to this web's sitelist This function adds the given site to the site list local to this web.
| site | - A shared_ptr to a CSite object containing the site to add |
|
overridevirtual |
CWeb clear function.
The clear function for the CWeb class.
Reimplemented from glass3::util::BaseClass.
| bool glasscore::CWeb::generateExplicitGrid | ( | std::shared_ptr< json::Object > | gridConfiguration | ) |
Generate a detection grid with explicit nodes.
This function initializes this web to the provided configuration and generates a detection grid of explicitly defined nodes
| gridConfiguration | - A pointer to a json::object containing desired node configuration |
| bool glasscore::CWeb::generateGlobalGrid | ( | std::shared_ptr< json::Object > | gridConfiguration | ) |
Generate a global detection grid.
This function initializes this web to the provided configuration and generates a global detection grid of nodes
| gridConfiguration | - A pointer to a json::object containing desired node configuration |
| bool glasscore::CWeb::generateLocalGrid | ( | std::shared_ptr< json::Object > | gridConfiguration | ) |
Generate a local detection grid.
This function initializes this web to the provided configuration and generates a local detection grid of nodes
| gridConfiguration | - A pointer to a json::object containing desired node grid configuration |
| std::shared_ptr< CNode > glasscore::CWeb::generateNode | ( | double | lat, |
| double | lon, | ||
| double | z, | ||
| double | resol | ||
| ) |
Create new node.
This function creates a new node centered on the provided latitude, longitude, depth, and spatial resolution. The new node is linked to the N closest sites (stations) where N is defined by nDetect.
| lat | - A double variable containing the latitude to use |
| lon | - A double variable containing the longitude to use |
| z | - A double variable containing the depth to use |
| resol | - A double variable containing the spatial resolution to use |
Create list of sites for node.
This function links a node to the N closest sites (stations) where N is defined by nDetect.
| node | - A std::shared_ptr to the node to link sites to |
| bool glasscore::CWeb::getAllowControllingWebs | ( | ) | const |
Gets a boolean flag that stores whether this web will allow other (smaller) webs to override it's nucleation thresholds.
| int glasscore::CWeb::getASeismicNucleationDataCountThreshold | ( | ) | const |
Gets the aseismic nucleation data (picks) minimum threshold used for this web.
| double glasscore::CWeb::getASeismicNucleationStackThreshold | ( | ) | const |
Gets the aseismic nucleation minimum stack threshold used for this web.
| double glasscore::CWeb::getAzimuthTaper | ( | ) | const |
Get the azimuth taper used for this web.
| double glasscore::CWeb::getMaxDepth | ( | ) | const |
Get the maximum depth used for this web.
| const std::string & glasscore::CWeb::getName | ( | ) | const |
Gets the name of this web.
| int glasscore::CWeb::getNetworksFilterSize | ( | ) | const |
Get the number of network filters for this web.
| double glasscore::CWeb::getNodeResolution | ( | ) | const |
Gets the node resolution of this web.
| int glasscore::CWeb::getNucleationDataCountThreshold | ( | ) | const |
Gets the nucleation data minimum threshold used for this web.
| double glasscore::CWeb::getNucleationStackThreshold | ( | ) | const |
Gets the nucleation minimum stack threshold used for this web.
| const std::shared_ptr< traveltime::CTravelTime > & glasscore::CWeb::getNucleationTravelTime1 | ( | ) | const |
Gets the primary nucleation travel time for this web.
| const std::shared_ptr< traveltime::CTravelTime > & glasscore::CWeb::getNucleationTravelTime2 | ( | ) | const |
Gets the secondary nucleation travel time for this web.
| int glasscore::CWeb::getNumStationsPerNode | ( | ) | const |
Gets the number of stations to link to each node in this web.
| bool glasscore::CWeb::getSaveGrid | ( | ) | const |
Gets a flag indicating whether this web supports saving its nodes to an external file.
| const CSiteList * glasscore::CWeb::getSiteList | ( | ) | const |
| int glasscore::CWeb::getSitesFilterSize | ( | ) | const |
Get the number of site filters for this web.
| bool glasscore::CWeb::getUpdate | ( | ) | const |
Gets a flag indicating whether this web supports updates.
| bool glasscore::CWeb::getUseOnlyTeleseismicStations | ( | ) | const |
Gets the flag indicating whether this web should only use sites flagged as UseForTeleseismic.
| bool glasscore::CWeb::getZoneStatsAseismic | ( | double | dLat, |
| double | dLon | ||
| ) |
zone stats aseismic retrieval function
This function gets whether zone stats says a given latitude and longitude is aseismic
| dLat | - A double containing the latitude to use |
| dLon | - A double containing the longitude to use |
| double glasscore::CWeb::getZoneStatsMaxDepth | ( | double | dLat, |
| double | dLon | ||
| ) |
zone stats max depth retrieval function
This function gets the zone stats max depth for a given latitude and longitude from zonestats
| dLat | - A double containing the latitude to use |
| dLon | - A double containing the longitude to use |
| bool glasscore::CWeb::initialize | ( | std::string | name, |
| double | thresh, | ||
| int | numDetect, | ||
| int | numNucleate, | ||
| int | resolution, | ||
| bool | update, | ||
| bool | save, | ||
| bool | allowControllingWebs, | ||
| std::shared_ptr< traveltime::CTravelTime > | firstTrav, | ||
| std::shared_ptr< traveltime::CTravelTime > | secondTrav, | ||
| double | aziTaper = 360.0, |
||
| double | maxDepth = 800.0, |
||
| double | aSeismicThresh = -1.0, |
||
| int | numASeismicNucleate = -1 |
||
| ) |
CWeb initialization function.
| name | - A std::string containing the name of the web. |
| thresh | - A double value containing this web's nucleation threshold. |
| numDetect | - An integer value containing the number of sites to link with each node in the web. |
| numNucleate | - An integer value containing the number of sites required for the web to nucleate an event. |
| resolution | - A double value containing the desired resolution for this web |
| update | - A boolean flag indicating whether this web is allowed to update |
| save | - A boolean flag indicating whether this web should save it's nodes to a file |
| allowControllingWebs | - A boolean flag indicating whether this web will allow other (smaller) webs to override it's nucleation thresholds |
| firstTrav | - A shared pointer to the first CTravelTime object to use for travel time lookups. |
| secondTrav | - A shared pointer to the second CTravelTime object to use for travel time lookups. |
| aziTaper | = A double value containing the azimuth taper to be used, defaults to 360 |
| maxDepth | = A double value containing the maximum allowable depth defaults to 800 km. |
| aSeismicThresh | = An optional double value containing this web's aseismic nucleation threshold, -1.0 to disable. |
| numASeismicNucleate | = An optional integer value containing the number of sitesrequired for the web to nucleate an event, -1 to disable |
| bool glasscore::CWeb::isSiteAllowed | ( | std::shared_ptr< CSite > | site, |
| bool | checkEnabled = true |
||
| ) |
Check to see if site allowed This function checks to see if a given site is allowed in the web by checking the given site against the configured site filters.
| site | - A shared pointer to a CSite object containing the site to check |
| checkEnabled | - A bool indicating whether to check the site enabled and use flags, default true |
| double glasscore::CWeb::isWithin | ( | double | dLat, |
| double | dLon | ||
| ) |
is coordinate within web function
This function checks to see if the provided coordinates are within the web.
| dLat | - A double containing the latitude to use |
| dLon | - A double containing the longitude to use |
| bool glasscore::CWeb::loadFilters | ( | std::shared_ptr< json::Object > | gridConfiguration | ) |
Load web filters.
This function loads the various filter lists used in selecting eligible sites from the provided cofiguration
| gridConfiguration | - A pointer to a json::object containing the web configuration |
| bool glasscore::CWeb::loadGridConfiguration | ( | std::shared_ptr< json::Object > | gridConfiguration | ) |
Load the common grid configuration.
This function initializes this web to the provided configuration
| gridConfiguration | - A pointer to a json::object containing desired configuration |
| bool glasscore::CWeb::loadTravelTimes | ( | json::Object * | gridConfiguration | ) |
Load the travel times for this web.
This function loads the travel times used by this web using the provided configuration
| gridConfiguration | - A pointer to a json::object containing the web configuration |
| bool glasscore::CWeb::loadWebSiteList | ( | ) |
Load web site list.
This function loads the list of eligible sites (stations) to be used by this web, filtering out unused/disabled sites and sites excluded by the site filters via isSiteAllowed(). This list is stored in vSite.
| bool glasscore::CWeb::nodesHaveSite | ( | std::shared_ptr< CSite > | site | ) |
| bool glasscore::CWeb::receiveExternalMessage | ( | std::shared_ptr< json::Object > | com | ) |
CWeb communication recieveing function.
The function used by CWeb to recieve communication (such as configuration or input data), from outside the glasscore library, or it's parent CGlass.
Supports Global (genrate global grid) Shell (generate grid at single depth), Grid (generate local grid), Single (generate single node), GetWeb (generate output message detailing detection graph database) inputs.
| com | - A pointer to a json::object containing the communication. |
| void glasscore::CWeb::removeSite | ( | std::shared_ptr< CSite > | site | ) |
Remove site from this web This function removes the given site to the list of nodes linked to this web and restructure node site lists.
| site | - A shared pointer to a CSite object containing the site to remove |
| bool glasscore::CWeb::removeSiteFromSiteList | ( | std::shared_ptr< CSite > | site | ) |
Remove site from this web's sitelist This function Removes the given site to the site list local to this web.
| site | - A shared_ptr to a CSite object containing the site to remove |
| void glasscore::CWeb::setSiteList | ( | CSiteList * | siteList | ) |
| int glasscore::CWeb::size | ( | ) | const |
Get the number of nodes in this web.
| void glasscore::CWeb::sortSiteListForNode | ( | double | lat, |
| double | lon, | ||
| double | depth | ||
| ) |
Sort site list.
This function sorts a list of sites stored in vSite in increasing distance from the given location at 0 depth. The function also populates the distance between the given location and the site as part of the std::pair in vSite.
| lat | - A double variable containing the latitude to use in degrees |
| lon | - A double variable containing the longitude to use in degrees |
| depth | - A double variable containing the depth to use in km |
|
overridevirtual |
Web work function.
Update a web in the background
Implements glass3::util::ThreadBaseClass.
1.8.11