neic-glass3  1.4.6
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
traveltime::CTravelTime Class Reference

travel time phase class More...

#include <TravelTime.h>

Collaboration diagram for traveltime::CTravelTime:
Collaboration graph

Public Member Functions

 CTravelTime (bool useForLocations=true, double minPublishable=0, double maxPublishable=180)
 CTravelTime constructor. More...
 
 CTravelTime (const CTravelTime &travelTime)
 CTravelTime copy constructor. More...
 
 ~CTravelTime ()
 CTravelTime destructor. More...
 
bool setup (std::string phase="P", std::string file="")
 Load or generate branch data. More...
 
void writeToFile (std::string fileName, double depth)
 Write out travel times to file. More...
 
void clear ()
 CTravelTime clear function. More...
 
void setTTOrigin (double lat, double lon, double depth)
 Set current geographic location. More...
 
void setTTOrigin (const glass3::util::Geo &geoOrigin)
 Set current geographic location. More...
 
double T (glass3::util::Geo *geo)
 Calculate travel time in seconds. More...
 
double T (double delta)
 Calculate travel time in seconds. More...
 
double T (int deltaIndex, int depthIndex)
 Lookup travel time in seconds. More...
 
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. More...
 
int getIndexFromDistance (double distance)
 Compute interpolation grid distance index. More...
 
double getDistanceFromIndex (int index)
 Compute distance using interpolation grid index. More...
 
int getIndexFromDepth (double depth)
 Compute interpolation grid depth index. More...
 
double getDepthFromIndex (int index)
 Compute depth using interpolation grid index. More...
 

Public Attributes

int m_iNumDistances
 An integer variable containing the array index size for the distance array. More...
 
double m_dMinimumDistance
 A double variable containing the minimum distance of the depth distance array. More...
 
double m_dMaximumDistance
 A double variable containing the maximum distance of the depth distance array. More...
 
double m_dDistanceStep
 A double variable containing the spacing, or step, between distance points in the depth distance array. More...
 
int m_iNumDepths
 An integer variable containing the array index size for the depth array. More...
 
double m_dMinimumDepth
 A double variable containing the minimum depth of the depth distance array. More...
 
double m_dMaximumDepth
 A double variable containing the maximum Depth of the depth distance array. More...
 
double m_dDepthStep
 A double variable containing the spacing, or step, between depth points in the depth distance array. More...
 
double * m_pTravelTimeArray
 An array of double values containing the travel times indexed by depth and distance. More...
 
std::string m_sPhase
 A std::string containing the name of the phase used for this CTravelTime. More...
 
bool m_bUseForLocations
 A boolean flag indicating whether this CTravelTime should be used in generating locations. More...
 
double m_dMinDeltaPublishable
 A double value representing the minimum distance in degrees this CTravelTime should be published in output messages. More...
 
double m_dMaxDeltaPublishable
 A double value representing the maximum distance in degrees this CTravelTime should be published in output messages. More...
 
double m_dDelta
 Delta in degrees used by caller to calculate distance dependent weights. More...
 
double m_dDepth
 Depth in km used by caller to calculate distance dependent weights. More...
 
glass3::util::Geo m_geoTTOrigin
 Ephemeral (temporary) glass3::util::Geo object containing current geographic location. Set by setOrigin() More...
 

Static Public Attributes

static constexpr double k_dTravelTimeInvalid = -1.0
 the value for an invalid travel time More...
 
static const std::string k_dPhaseInvalid = ""
 the string for an invalid phase name More...
 

Detailed Description

travel time phase class

The traveltime CTravelTime class is a class that loads, parses, and generates travel time phase branch over a set of valid depths for a given phase or phase class. CTravelTime supports calculating travel times based on distance or geographic location for the given phase or phase class.

Constructor & Destructor Documentation

traveltime::CTravelTime::CTravelTime ( bool  useForLocations = true,
double  minPublishable = 0,
double  maxPublishable = 180 
)
explicit

CTravelTime constructor.

The constructor for the CTravelTime class.

Parameters
useForLocations- A boolean flag indicating that this CTravelTime is usable for location
minPublishable- A double value containing the minumum distance in degrees to publish this phase.
minPublishable- A double value containing the maximum distance in degrees to publish this phase.
traveltime::CTravelTime::CTravelTime ( const CTravelTime travelTime)

CTravelTime copy constructor.

The copy constructor for the CTravelTime class.

traveltime::CTravelTime::~CTravelTime ( )

CTravelTime destructor.

The destructor for the CTravelTime class.

Member Function Documentation

double traveltime::CTravelTime::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.

Compute a bilinear interpolation from the provided values

Parameters
q_x1y1- A double containing the interpolation value for (x1, y1)
q_x1y2- A double containing the interpolation value for (x1, y2)
q_x2y1- A double containing the interpolation value for (x2, y1)
q_x2y2- A double containing the interpolation value for (x2, y2)
x1- A double containing first x interpolation coordinate
y1- A double containing first y interpolation coordinate
x2- A double containing second x interpolation coordinate
y2- A double containing second y interpolation coordinate
x- A double containing the given x coordinate
y- A double containing the given y coordinate
Returns
Returns a double containing the resulting bilinear interpolation
void traveltime::CTravelTime::clear ( )

CTravelTime clear function.

double traveltime::CTravelTime::getDepthFromIndex ( int  index)

Compute depth using interpolation grid index.

Compute a depth using the given interpolation grid index

Parameters
index- An integer value containing the interpolation grid index to use
Returns
Returns the depth
double traveltime::CTravelTime::getDistanceFromIndex ( int  index)

Compute distance using interpolation grid index.

Compute a distance using the given interpolation grid index

Parameters
index- An integer value containing the interpolation grid index to use
Returns
Returns the distance
int traveltime::CTravelTime::getIndexFromDepth ( double  depth)

Compute interpolation grid depth index.

Compute an interpolation grid index from the given depth

Parameters
depth- A double value containing the depth to use
Returns
Returns the depth index
int traveltime::CTravelTime::getIndexFromDistance ( double  distance)

Compute interpolation grid distance index.

Compute an interpolation grid index from the given distance

Parameters
distance- A double value containing the distance to use
Returns
Returns the distance index
void traveltime::CTravelTime::setTTOrigin ( double  lat,
double  lon,
double  depth 
)

Set current geographic location.

Set the current geographic location to the provided latitude, longitude, and depth. This will set pTrv1, pTrv2, dA, and dB ephemeral values used for travel time calculations.

Parameters
lat- A double value representing the latitude of the desired geographic location.
lon- A double value representing the longitude of the desired geographic location.
depth- A double value representing the depth of the desired geographic location.
void traveltime::CTravelTime::setTTOrigin ( const glass3::util::Geo geoOrigin)

Set current geographic location.

Set the current geographic location using the provided CGeo. This will set the source location used for source/receiver traveltime calculations.

Parameters
geoOrigin- A CGeo representing the lat/lon and surface depth (or elev) of the source, along with already computed concentric lat/lon and vector coordinates.
bool traveltime::CTravelTime::setup ( std::string  phase = "P",
std::string  file = "" 
)

Load or generate branch data.

Attempts to load branch data (using Load()) for a phase using a given CRay and phase std::string and filename.

Parameters
phase- A std::std::string representing the phase to use, default is "P"
file- A std::std::string representing the file to load, default is ""
double traveltime::CTravelTime::T ( glass3::util::Geo geo)

Calculate travel time in seconds.

Calculate travel time in seconds given geographic location

Parameters
geo- A pointer to a glass3::util::Geo object representing the location to calculate the travel time from
Returns
Returns the travel time in seconds, or -1.0 if there is no valid travel time
double traveltime::CTravelTime::T ( double  delta)

Calculate travel time in seconds.

Interpolate travel time in seconds given distance in degrees

Parameters
delta- A double value containing the distance in degrees to calculate travel time from
Returns
Returns the travel time in seconds, or -1.0 if there is no valid travel time
double traveltime::CTravelTime::T ( int  deltaIndex,
int  depthIndex 
)

Lookup travel time in seconds.

Lookup travel time in seconds from travel time array given distance and depth indexes

Parameters
deltaIndex- An integer value containing distance index
depthIndex- An integer value containing depth index
Returns
Returns the travel time in seconds, or -1.0 if there is no valid travel time
void traveltime::CTravelTime::writeToFile ( std::string  fileName,
double  depth 
)

Write out travel times to file.

This function prints the available travel time points for the travel time contained in this TravelTime at a given depth to a given file.

Parameters
fileName- A std::string containing the file name to write to.
depth- A double containing the depth to use

Member Data Documentation

const std::string traveltime::CTravelTime::k_dPhaseInvalid = ""
static

the string for an invalid phase name

constexpr double traveltime::CTravelTime::k_dTravelTimeInvalid = -1.0
static

the value for an invalid travel time

bool traveltime::CTravelTime::m_bUseForLocations

A boolean flag indicating whether this CTravelTime should be used in generating locations.

double traveltime::CTravelTime::m_dDelta

Delta in degrees used by caller to calculate distance dependent weights.

double traveltime::CTravelTime::m_dDepth

Depth in km used by caller to calculate distance dependent weights.

double traveltime::CTravelTime::m_dDepthStep

A double variable containing the spacing, or step, between depth points in the depth distance array.

double traveltime::CTravelTime::m_dDistanceStep

A double variable containing the spacing, or step, between distance points in the depth distance array.

double traveltime::CTravelTime::m_dMaxDeltaPublishable

A double value representing the maximum distance in degrees this CTravelTime should be published in output messages.

double traveltime::CTravelTime::m_dMaximumDepth

A double variable containing the maximum Depth of the depth distance array.

double traveltime::CTravelTime::m_dMaximumDistance

A double variable containing the maximum distance of the depth distance array.

double traveltime::CTravelTime::m_dMinDeltaPublishable

A double value representing the minimum distance in degrees this CTravelTime should be published in output messages.

double traveltime::CTravelTime::m_dMinimumDepth

A double variable containing the minimum depth of the depth distance array.

double traveltime::CTravelTime::m_dMinimumDistance

A double variable containing the minimum distance of the depth distance array.

glass3::util::Geo traveltime::CTravelTime::m_geoTTOrigin

Ephemeral (temporary) glass3::util::Geo object containing current geographic location. Set by setOrigin()

int traveltime::CTravelTime::m_iNumDepths

An integer variable containing the array index size for the depth array.

int traveltime::CTravelTime::m_iNumDistances

An integer variable containing the array index size for the distance array.

double* traveltime::CTravelTime::m_pTravelTimeArray

An array of double values containing the travel times indexed by depth and distance.

std::string traveltime::CTravelTime::m_sPhase

A std::string containing the name of the phase used for this CTravelTime.


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