neic-glass3  1.4.6
Public Member Functions | List of all members
glasscore::CNode Class Reference

glasscore detection node class More...

#include <Node.h>

Collaboration diagram for glasscore::CNode:
Collaboration graph

Public Member Functions

 CNode ()
 CNode constructor. More...
 
 CNode (std::string name, double lat, double lon, double z, double resolution, double maxDepth, bool aseismic)
 CNode advanced constructor. More...
 
 ~CNode ()
 CNode destructor. More...
 
void clear ()
 CNode clear function. More...
 
void clearSiteLinks ()
 Delink all sites to/from this node. More...
 
bool initialize (std::string name, double lat, double lon, double z, double resolution, double maxDepth, bool aseismic)
 CNode initialization funcion. More...
 
bool linkSite (std::shared_ptr< CSite > site, std::shared_ptr< CNode > node, double distDeg, double travelTime1, std::string phase1, double travelTime2=-1, std::string phase2="")
 CNode node-site and site-node linker. More...
 
bool unlinkSite (std::shared_ptr< CSite > site)
 CNode node-site and site-node unlinker. More...
 
bool unlinkLastSite ()
 CNode unlink last by distance site from node. More...
 
std::shared_ptr< CTriggernucleate (double tOrigin, CPickList *parentThread)
 CNode Nucleation function. More...
 
double getSignificance (double tObservedTT, double travelTime, double distDeg)
 CNode significance function. More...
 
std::shared_ptr< CSitegetSite (std::string siteID)
 CNode site used function. More...
 
std::shared_ptr< CSitegetLastSite ()
 CNode get last site function. More...
 
void sortSiteLinks ()
 CNode site link sort function. More...
 
std::string getSitesString ()
 Generates a string that contains each site link, including the siteID, latitude, longitude, and depth. This string is generated when optionally creating web files that are used for tuning the web using third party programs. More...
 
int getSiteLinksCount () const
 Gets the number of sites linked to this node. More...
 
bool getEnabled () const
 Gets a flag indicating that the node is enabled for nucleation. Typically a node is only disabled when it is being reconfigured. More...
 
void setEnabled (bool enabled)
 Sets a flag indicating that the node is enabled for nucleation. Typically a node is only disabled when it is being reconfigured. More...
 
double getLatitude () const
 Get the latitude for this node. More...
 
double getLongitude () const
 Get the longitude for this node. More...
 
double getDepth () const
 Get the depth for this node. More...
 
double getMaxDepth () const
 Get the maximum depth for triggers made at this node. More...
 
bool getAseismic () const
 Gets a flag indicating that the node is in an aseismic area. More...
 
glass3::util::Geo getGeo () const
 Get the combined node location (latitude, longitude, depth) as a CGeo object. More...
 
double getResolution () const
 Gets the resolution of the web that created this node. More...
 
CWebgetWeb () const
 Gets a pointer to the parent CWeb that created and holds this node. More...
 
void setWeb (CWeb *web)
 Sets a pointer to the parent CWeb that created and holds this node. More...
 
double getMaxSiteDistance () const
 Get the maximum site distance for this node. More...
 
const std::string & getName () const
 Gets the name of the parent CWeb that created and holds this node This name is used to ensure that only one node triggers per web during site nucleation. More...
 
std::string getID () const
 Get the unique id for this web. More...
 
void addSource (std::string source)
 Add to the allowed pick sources for this node. More...
 

Detailed Description

glasscore detection node class

The CNode class represents a single detection node in the detection graph database. A CNode is linked to one or more sites (seismic stations), as part of the overall detection graph database. A detection node consists of the location (latitude, longitude, and depth) of the detection node, the spatial resolution of the node, a list of the links to the sites, and a list of picks currently being nucleated.

CNode uses the nucleate function to evaluate the likelihood of a hypocenter existing centered on the node based on all picks each site linked to the node

CNode uses smart pointers (std::shared_ptr).

Constructor & Destructor Documentation

glasscore::CNode::CNode ( )

CNode constructor.

glasscore::CNode::CNode ( std::string  name,
double  lat,
double  lon,
double  z,
double  resolution,
double  maxDepth,
bool  aseismic 
)

CNode advanced constructor.

Construct a node using the provided latitude, longitude, and depth.

Parameters
name- A string containing the name of the parent web for this node
lat- A double value containing the latitude to use for this node in degrees
lon- A double value containing the longitude to use for this node in degrees
z- A double value containing the depth to use for this node in kilometers
resolution- A double value containing the inter-node resolution in kilometers
maxDepth- A double value containing the maximum trigger depth in kilometers
aseismic- A boolean flag indicating whether this node is in an aseismic area
glasscore::CNode::~CNode ( )

CNode destructor.

Member Function Documentation

void glasscore::CNode::addSource ( std::string  source)

Add to the allowed pick sources for this node.

Parameters
source- A std::string containing a pick source (author) string to add to the list of allowed sources for this node
void glasscore::CNode::clear ( )

CNode clear function.

void glasscore::CNode::clearSiteLinks ( )

Delink all sites to/from this node.

bool glasscore::CNode::getAseismic ( ) const

Gets a flag indicating that the node is in an aseismic area.

Returns
Returns a boolean flag, true if the node is aseismic, false otherwise
double glasscore::CNode::getDepth ( ) const

Get the depth for this node.

Returns
Returns a double containing the node depth in kilometers
bool glasscore::CNode::getEnabled ( ) const

Gets a flag indicating that the node is enabled for nucleation. Typically a node is only disabled when it is being reconfigured.

Returns
Returns a boolean flag, true if the node is enabled, false otherwise
glass3::util::Geo glasscore::CNode::getGeo ( ) const

Get the combined node location (latitude, longitude, depth) as a CGeo object.

Returns
Returns a glass3::util::Geo object containing the combined location.
std::string glasscore::CNode::getID ( ) const

Get the unique id for this web.

Returns
Returns a std::string containing the node web
std::shared_ptr< CSite > glasscore::CNode::getLastSite ( )

CNode get last site function.

Get the last site linked to the node

Returns
Returns a shared pointer to the last CSite object if found, null otherwise
double glasscore::CNode::getLatitude ( ) const

Get the latitude for this node.

Returns
Returns a double containing the node latitude in degrees
double glasscore::CNode::getLongitude ( ) const

Get the longitude for this node.

Returns
Returns a double containing the node longitude in degrees
double glasscore::CNode::getMaxDepth ( ) const

Get the maximum depth for triggers made at this node.

Returns
Returns a double containing the maximum depth for triggers made in kilometers
double glasscore::CNode::getMaxSiteDistance ( ) const

Get the maximum site distance for this node.

Returns
Returns a double containing the maximum site distance for this node in degrees.
const std::string & glasscore::CNode::getName ( ) const

Gets the name of the parent CWeb that created and holds this node This name is used to ensure that only one node triggers per web during site nucleation.

Returns
Returns a std::string containing the web name
double glasscore::CNode::getResolution ( ) const

Gets the resolution of the web that created this node.

Returns
Returns a double value containing the resolution of the web that created this node in kilometers
double glasscore::CNode::getSignificance ( double  tObservedTT,
double  travelTime,
double  distDeg 
)

CNode significance function.

Given an observed time and a link to a site, compute the best significance value from the traveltime contained in the link to this node.

Parameters
tObservedTT- A double value containing the observed travel time
travelTime- A double value containing the first calculated travel time
distDeg- A double value containing the distance between the station and the node in degrees
Returns
Returns significance if there is a valid travel time, -1.0 otherwise
std::shared_ptr< CSite > glasscore::CNode::getSite ( std::string  siteID)

CNode site used function.

Given a site id, check to see if the site is used by the node

Parameters
siteID- A string containing the id of the site to get
Returns
Returns a shared_ptr to a the CSite used by the node, NULL if not found
int glasscore::CNode::getSiteLinksCount ( ) const

Gets the number of sites linked to this node.

Returns
Returns an integer containing the count of sites linked to this node
std::string glasscore::CNode::getSitesString ( )

Generates a string that contains each site link, including the siteID, latitude, longitude, and depth. This string is generated when optionally creating web files that are used for tuning the web using third party programs.

Returns
the sites string
CWeb * glasscore::CNode::getWeb ( ) const

Gets a pointer to the parent CWeb that created and holds this node.

Returns
Returns a pointer to the parent CWeb
bool glasscore::CNode::initialize ( std::string  name,
double  lat,
double  lon,
double  z,
double  resolution,
double  maxDepth,
bool  aseismic 
)

CNode initialization funcion.

Initialize a node using the provided latitude, longitude, and depth.

Parameters
name- A string containing the name of the parent web for this node
lat- A double value containing the latitude to use for this node in degrees
lon- A double value containing the longitude to use for this node in degrees
z- A double value containing the depth to use for this node in kilometers
resolution- A double value containing the inter-node resolution in kilometers
maxDepth- A double value containing the maximum trigger depth in kilometers
aseismic- A boolean flag indicating whether this node is in an aseismic area
bool glasscore::CNode::linkSite ( std::shared_ptr< CSite site,
std::shared_ptr< CNode node,
double  distDeg,
double  travelTime1,
std::string  phase1,
double  travelTime2 = -1,
std::string  phase2 = "" 
)

CNode node-site and site-node linker.

Add a link to/from this node to the provided site using the provided travel time

NOTE: The node is required as parameter because issues occurred linking and unlinking (deleting) using this-> The solution was to pass a pointer to the node in this function.

Parameters
distDeg- A double value containing the distance in degrees between the node and the site.
travelTime1- A double value containing the first travel time to use for the link
phase1- A std::string containing the first travel time phase code
travelTime2- A double value containing the optional second travel time to use for the link, defaults to -1 (no travel time)
phase2- A std::string containing the second travel time phase code, defaults to "" (no travel time)
site- A shared_ptr<CSite> to the site to link
node- A shared_ptr<CNode> to the node to link (should be itself)
Returns
- Returns true if successful, false otherwise
std::shared_ptr< CTrigger > glasscore::CNode::nucleate ( double  tOrigin,
CPickList parentThread 
)

CNode Nucleation function.

Given an origin time, compute a number representing the stacked PDF of a hypocenter centered on this node, by computing the PDF of each pick at each site linked to this node and totaling (stacking) them up. Picks with authors that are not in the set of allowed sources are not nuclated. Picks without authors or sources are always nuclated.

Parameters
tOrigin- A double value containing the proposed origin time to use in Gregorian seconds
parentThread- A pointer to the parent CPickList thread to allow nucleate to call the CPickList thread status update function, the owner of this pointer is the CPickList object
Returns
Returns true if the node nucleated an event, false otherwise
void glasscore::CNode::setEnabled ( bool  enabled)

Sets a flag indicating that the node is enabled for nucleation. Typically a node is only disabled when it is being reconfigured.

Parameters
enabled- a boolean flag, true if the node is enabled, false otherwise
void glasscore::CNode::setWeb ( CWeb web)

Sets a pointer to the parent CWeb that created and holds this node.

Parameters
web- a pointer to the parent CWeb
void glasscore::CNode::sortSiteLinks ( )

CNode site link sort function.

Sort the list of sites linked to this node by distance from node

bool glasscore::CNode::unlinkLastSite ( )

CNode unlink last by distance site from node.

Remove the last site by distance to/from this node

Returns
- Returns true if successful, false otherwise
bool glasscore::CNode::unlinkSite ( std::shared_ptr< CSite site)

CNode node-site and site-node unlinker.

Remove the given site to/from this node

Parameters
site- A std::shared_ptr<CSite> to the site to remove
Returns
- Returns true if successful, false otherwise

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