neic-glass3  1.4.6
Node.h
Go to the documentation of this file.
1 /*****************************************
2  * This file is documented for Doxygen.
3  * If you modify this file please update
4  * the comments so that Doxygen will still
5  * be able to work.
6  ****************************************/
7 #ifndef NODE_H
8 #define NODE_H
9 
10 #include <geo.h>
11 #include <vector>
12 #include <memory>
13 #include <string>
14 #include <utility>
15 #include <mutex>
16 #include <tuple>
17 #include <atomic>
18 #include <set>
19 #include "Link.h"
20 
21 namespace glasscore {
22 
23 // forward declarations
24 class CPick;
25 class CPickList;
26 class CSite;
27 class CWeb;
28 class CTrigger;
29 
46 class CNode {
47  public:
51  CNode();
52 
74  CNode(std::string name, double lat, double lon, double z, double resolution,
75  double maxDepth, bool aseismic);
76 
80  ~CNode();
81 
85  void clear();
86 
90  void clearSiteLinks();
91 
113  bool initialize(std::string name, double lat, double lon, double z,
114  double resolution, double maxDepth, bool aseismic);
115 
139  bool linkSite(std::shared_ptr<CSite> site, std::shared_ptr<CNode> node,
140  double distDeg, double travelTime1, std::string phase1,
141  double travelTime2 = -1, std::string phase2 = "");
142 
151  bool unlinkSite(std::shared_ptr<CSite> site);
152 
160  bool unlinkLastSite();
161 
179  std::shared_ptr<CTrigger> nucleate(double tOrigin, CPickList* parentThread);
180 
196  double getSignificance(double tObservedTT, double travelTime,
197  double distDeg);
198 
208  std::shared_ptr<CSite> getSite(std::string siteID);
209 
218  std::shared_ptr<CSite> getLastSite();
219 
225  void sortSiteLinks();
226 
234  std::string getSitesString();
235 
241  int getSiteLinksCount() const;
242 
249  bool getEnabled() const;
250 
257  void setEnabled(bool enabled);
258 
263  double getLatitude() const;
264 
269  double getLongitude() const;
270 
275  double getDepth() const;
276 
282  double getMaxDepth() const;
283 
289  bool getAseismic() const;
290 
296  glass3::util::Geo getGeo() const;
297 
303  double getResolution() const;
304 
309  CWeb* getWeb() const;
310 
315  void setWeb(CWeb* web);
316 
322  double getMaxSiteDistance() const;
323 
330  const std::string& getName() const;
331 
336  std::string getID() const;
337 
343  void addSource(std::string source);
344 
345  private:
350  CWeb * m_pWeb;
351 
357  std::string m_sName;
358 
362  std::atomic<double> m_dLatitude;
363 
367  std::atomic<double> m_dLongitude;
368 
372  std::atomic<double> m_dDepth;
373 
378  std::atomic<double> m_dMaxDepth;
379 
384  std::atomic<bool> m_bAseismic;
385 
390  std::atomic<double> m_dMaxSiteDistance;
391 
396  std::atomic<double> m_dResolution;
397 
402  std::atomic<bool> m_bEnabled;
403 
408  std::set<std::string> m_SourceSet;
409 
414  std::vector<SiteLink> m_vSiteLinkList;
415 
419  mutable std::mutex m_SiteLinkListMutex;
420 
428  mutable std::recursive_mutex m_NodeMutex;
429 
430  // constants
439  static constexpr double k_dTravelTimePickSelectionWindow = 120.0;
440 
445  static constexpr double k_dDepthShellResolutionKm = 100.0;
446 
451  static constexpr double k_dGridPointVsResolutionRatio = 0.7071;
452 
459  static constexpr double k_residualDistanceAllowanceFactor = 2.;
460 };
461 } // namespace glasscore
462 #endif // NODE_H
double getDepth() const
Get the depth for this node.
Definition: Node.cpp:849
bool unlinkSite(std::shared_ptr< CSite > site)
CNode node-site and site-node unlinker.
Definition: Node.cpp:169
glasscore pick list class
Definition: PickList.h:62
bool getAseismic() const
Gets a flag indicating that the node is in an aseismic area.
Definition: Node.cpp:859
glasscore detection node class
Definition: Node.h:46
std::shared_ptr< CSite > getLastSite()
CNode get last site function.
Definition: Node.cpp:770
int getSiteLinksCount() const
Gets the number of sites linked to this node.
Definition: Node.cpp:817
double getLatitude() const
Get the latitude for this node.
Definition: Node.cpp:834
double getMaxSiteDistance() const
Get the maximum site distance for this node.
Definition: Node.cpp:897
bool initialize(std::string name, double lat, double lon, double z, double resolution, double maxDepth, bool aseismic)
CNode initialization funcion.
Definition: Node.cpp:110
double getSignificance(double tObservedTT, double travelTime, double distDeg)
CNode significance function.
Definition: Node.cpp:703
std::string getID() const
Get the unique id for this web.
Definition: Node.cpp:889
void setEnabled(bool enabled)
Sets a flag indicating that the node is enabled for nucleation. Typically a node is only disabled whe...
Definition: Node.cpp:829
bool unlinkLastSite()
CNode unlink last by distance site from node.
Definition: Node.cpp:238
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.
Definition: Node.cpp:795
geographic coordinate conversion class
Definition: geo.h:25
void clearSiteLinks()
Delink all sites to/from this node.
Definition: Node.cpp:89
void sortSiteLinks()
CNode site link sort function.
Definition: Node.cpp:786
std::shared_ptr< CTrigger > nucleate(double tOrigin, CPickList *parentThread)
CNode Nucleation function.
Definition: Node.cpp:272
bool getEnabled() const
Gets a flag indicating that the node is enabled for nucleation. Typically a node is only disabled whe...
Definition: Node.cpp:824
glass3::util::Geo getGeo() const
Get the combined node location (latitude, longitude, depth) as a CGeo object.
Definition: Node.cpp:864
void setWeb(CWeb *web)
Sets a pointer to the parent CWeb that created and holds this node.
Definition: Node.cpp:878
~CNode()
CNode destructor.
Definition: Node.cpp:67
void clear()
CNode clear function.
Definition: Node.cpp:71
double getResolution() const
Gets the resolution of the web that created this node.
Definition: Node.cpp:844
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.
Definition: Node.cpp:129
CWeb * getWeb() const
Gets a pointer to the parent CWeb that created and holds this node.
Definition: Node.cpp:872
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 on...
Definition: Node.cpp:884
void addSource(std::string source)
Add to the allowed pick sources for this node.
Definition: Node.cpp:903
double getLongitude() const
Get the longitude for this node.
Definition: Node.cpp:839
The namespace containing the core algorithm.
Definition: Correlation.h:17
CNode()
CNode constructor.
Definition: Node.cpp:54
std::shared_ptr< CSite > getSite(std::string siteID)
CNode site used function.
Definition: Node.cpp:744
double getMaxDepth() const
Get the maximum depth for triggers made at this node.
Definition: Node.cpp:854
glasscore detection web class
Definition: Web.h:46