neic-glass3  1.4.6
TravelTime.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 TRAVELTIME_H
8 #define TRAVELTIME_H
9 
10 #include <json.h>
11 #include <geo.h>
12 #include <memory>
13 #include <vector>
14 #include <string>
15 
24 namespace traveltime {
25 
35 class CTravelTime {
36  public:
49  explicit CTravelTime(bool useForLocations = true, double minPublishable = 0,
50  double maxPublishable = 180);
51 
57  CTravelTime(const CTravelTime &travelTime);
58 
64  ~CTravelTime();
65 
77  bool setup(std::string phase = "P", std::string file = "");
78 
88  void writeToFile(std::string fileName, double depth);
89 
93  void clear();
94 
109  void setTTOrigin(double lat, double lon, double depth);
110 
122  void setTTOrigin(const glass3::util::Geo &geoOrigin);
123 
134  double T(glass3::util::Geo *geo);
135 
146  double T(double delta);
147 
159  double T(int deltaIndex, int depthIndex);
160 
178  double bilinearInterpolation(double q_x1y1, double q_x1y2, double q_x2y1,
179  double q_x2y2, double x1, double y1, double x2, double y2, double x,
180  double y);
181 
190  int getIndexFromDistance(double distance);
191 
201  double getDistanceFromIndex(int index);
202 
211  int getIndexFromDepth(double depth);
212 
222  double getDepthFromIndex(int index);
223 
224 
230 
236 
242 
248 
254 
260 
266 
271  double m_dDepthStep;
272 
278 
283  std::string m_sPhase;
284 
290 
296 
302 
307  double m_dDelta;
308 
313  double m_dDepth;
314 
320 
321  // constants
325  static constexpr double k_dTravelTimeInvalid = -1.0;
326 
330  static const std::string k_dPhaseInvalid;
331 };
332 } // namespace traveltime
333 #endif // TRAVELTIME_H
double m_dMinDeltaPublishable
A double value representing the minimum distance in degrees this CTravelTime should be published in o...
Definition: TravelTime.h:295
bool setup(std::string phase="P", std::string file="")
Load or generate branch data.
Definition: TravelTime.cpp:157
void writeToFile(std::string fileName, double depth)
Write out travel times to file.
Definition: TravelTime.cpp:92
double m_dMinimumDepth
A double variable containing the minimum depth of the depth distance array.
Definition: TravelTime.h:259
double bilinearInterpolation(double q_x1y1, double q_x1y2, double q_x2y1, double q_x2y2, double x1, double y1, double x2, double y2, double x, double y)
Compute bilinear interpolation.
Definition: TravelTime.cpp:449
double getDepthFromIndex(int index)
Compute depth using interpolation grid index.
Definition: TravelTime.cpp:435
double m_dMaximumDistance
A double variable containing the maximum distance of the depth distance array.
Definition: TravelTime.h:241
static constexpr double k_dTravelTimeInvalid
the value for an invalid travel time
Definition: TravelTime.h:325
double * m_pTravelTimeArray
An array of double values containing the travel times indexed by depth and distance.
Definition: TravelTime.h:277
double m_dMaximumDepth
A double variable containing the maximum Depth of the depth distance array.
Definition: TravelTime.h:265
double m_dDepth
Depth in km used by caller to calculate distance dependent weights.
Definition: TravelTime.h:313
traveltime namespace phase travel time classes and functions
double m_dMinimumDistance
A double variable containing the minimum distance of the depth distance array.
Definition: TravelTime.h:235
geographic coordinate conversion class
Definition: geo.h:25
~CTravelTime()
CTravelTime destructor.
Definition: TravelTime.cpp:61
double m_dMaxDeltaPublishable
A double value representing the maximum distance in degrees this CTravelTime should be published in o...
Definition: TravelTime.h:301
bool m_bUseForLocations
A boolean flag indicating whether this CTravelTime should be used in generating locations.
Definition: TravelTime.h:289
double getDistanceFromIndex(int index)
Compute distance using interpolation grid index.
Definition: TravelTime.cpp:395
int getIndexFromDepth(double depth)
Compute interpolation grid depth index.
Definition: TravelTime.cpp:409
double m_dDepthStep
A double variable containing the spacing, or step, between depth points in the depth distance array...
Definition: TravelTime.h:271
std::string m_sPhase
A std::string containing the name of the phase used for this CTravelTime.
Definition: TravelTime.h:283
void clear()
CTravelTime clear function.
Definition: TravelTime.cpp:66
travel time phase class
Definition: TravelTime.h:35
void setTTOrigin(double lat, double lon, double depth)
Set current geographic location.
Definition: TravelTime.cpp:289
int m_iNumDepths
An integer variable containing the array index size for the depth array.
Definition: TravelTime.h:253
double m_dDistanceStep
A double variable containing the spacing, or step, between distance points in the depth distance arra...
Definition: TravelTime.h:247
static const std::string k_dPhaseInvalid
the string for an invalid phase name
Definition: TravelTime.h:330
double T(glass3::util::Geo *geo)
Calculate travel time in seconds.
Definition: TravelTime.cpp:304
int getIndexFromDistance(double distance)
Compute interpolation grid distance index.
Definition: TravelTime.cpp:369
double m_dDelta
Delta in degrees used by caller to calculate distance dependent weights.
Definition: TravelTime.h:307
int m_iNumDistances
An integer variable containing the array index size for the distance array.
Definition: TravelTime.h:229
glass3::util::Geo m_geoTTOrigin
Ephemeral (temporary) glass3::util::Geo object containing current geographic location. Set by setOrigin()
Definition: TravelTime.h:319
CTravelTime(bool useForLocations=true, double minPublishable=0, double maxPublishable=180)
CTravelTime constructor.
Definition: TravelTime.cpp:17