SLBM_C_shell  2.7.0
Functions | Variables
/nfs/thummper/devlpool/sballar/RSTT/SLBM_Root/install/SLBM_Root/SLBM_C_shell/include/slbm_C_shell.h File Reference

Functions

int slbm_shell_getVersion (char *str)
 Retrieve the SLBM Version number.
int slbm_shell_getErrorMessage (char *str)
 Retrieve last error message.
int slbm_shell_create ()
 Instantiate a SLBM Interface object.
int slbm_shell_create_fixedEarthRadius (double *radius)
 Instantiate a SLBM Interface object with fixed earth radius.
int slbm_shell_delete ()
 Deletes the SlbmInterface object instantiated with the call slbm_shell_create().
int slbm_shell_loadVelocityModelBinary (const char *modelDirectory)
 Load the velocity model into memory from files located in the specified directory.
int slbm_shell_specifyOutputDirectory (const char *directoryName)
 Specify the directory where the model that is currently in memory should be written to the next time that saveVelocityModelBinary() is called.
int slbm_shell_saveVelocityModelBinary ()
 Write the model currently in memory out to files. The model is written to a directory which was previously specified with a call to specifyOutputDirectory().
int slbm_shell_loadVelocityModel (const char *modelFileName)
 Load the velocity model into memory from the specified file.
int slbm_shell_saveVelocityModel (const char *modelFileName)
 Save the velocity model currently in memory to the specified file.
int slbm_shell_createGreatCircle (char *phase, double *sourceLat, double *sourceLon, double *sourceDepth, double *receiverLat, double *receiverLon, double *receiverDepth)
 Instantiate a new GreatCircle object between two locations.
int slbm_shell_isValid ()
 Returns true if the current GreatCirlce object has been instantiated and is ready to be interrogated.
int slbm_shell_clear ()
 Delete the current GreatCircle object from memory and clear the pool of stored CrustalProfile objects. The model Grid is not deleted and remains accessible.
int slbm_shell_getDistance (double *dist)
 Retrieve the source-receiver separation, in radians.
int slbm_shell_getSourceDistance (double *dist)
 Retrieve horizontal offset below the source, in radians.
int slbm_shell_getReceiverDistance (double *dist)
 Retrieve horizontal offset below the receiver, in radians.
int slbm_shell_getHeadwaveDistance (double *dist)
 Retrieve angular distance traveled by the ray below the headwave interface, in radians.
int slbm_shell_getHeadwaveDistanceKm (double *dist)
 Retrieve horizontal distance traveled by the ray below the headwave interface, in radians.
int slbm_shell_getTravelTime (double *travelTime)
 Retrieve the total travel time for the GreatCircle, in seconds.
int slbm_shell_getTravelTimeComponents (double *tTotal, double *tSource, double *tReceiver, double *tHeadwave, double *tGradient)
 Retrieve the total travel time and the 4 components that contribute to it for the current GreatCircle.
int slbm_shell_getWeights (int nodeId[], double weight[], int *nWeights)
 Retrieve the weight assigned to each grid node that was touched by the GreatCircle.
int slbm_shell_getWeightsSource (int nodeids[], double weights[])
 Retrieve the node IDs and the interpolation coefficients for the source CrustalProfile.
int slbm_shell_getWeightsReceiver (int nodeids[], double weights[])
 Retrieve the node IDs and the interpolation coefficients for the receiver CrustalProfile.
int slbm_shell_toString (char *str, int verbosity)
 Returns a human-readable string representation of the GreatCircle object.
int slbm_shell_getNGridNodes (int *numGridNodes)
 Retrieve the number of Grid nodes in the Earth model.
int slbm_shell_getNHeadWavePoints (int *npoints)
 Retrieve the number of LayerProfile objects positioned along the head wave interface.
int slbm_shell_getGridData (int *nodeId, double *latitude, double *longitude, double *depth, double *pvelocity, double *svelocity, double *gradient)
 Retrieve the lat (radians), lon (radians), interface depths (km), P and S wave interval velocities (km/sec) and P and S mantle gradient (1/sec) information associated with a specified node in the velocity grid.
int slbm_shell_setGridData (int *nodeId, double *depth, double *pvelocity, double *svelocity, double *gradient)
 Modify the velocity and gradient information associated with a specified node in the Grid.
int slbm_shell_getGreatCircleData (char *phase, double *path_increment, double sourceDepth[], double sourceVelocity[], double receiverDepth[], double receiverVelocity[], double headWaveVelocity[], double gradient[], int neighbors[][nCoefficients], double coefficients[][nCoefficients], int *npoints)
 Retrieve the data required for input to the travel time calculation, for the current GreatCircle object.
int slbm_shell_getInterpolatedPoint (double *lat, double *lon, int *nodeId, double *coefficients, double *depth, double *pvelocity, double *svelocity, double *pgradient, double *sgradient)
 Retrieve interpolated data from the earth model at a single specified latitude, longitude.
int slbm_shell_getInterpolatedTransect (double lat[], double lon[], int *nLatLon, int nodeId[][nCoefficients], double coefficients[][nCoefficients], double depth[][NLAYERS], double pvelocity[][NLAYERS], double svelocity[][NLAYERS], double pgradient[NLAYERS], double sgradient[NLAYERS], int *nInvalid)
 Retrieve interpolated data from the earth model along a transect defined by equal sized, 1 dimensional arrays of latitude and longitude.
int slbm_shell_initializeActiveNodes (double *latmin, double *lonmin, double *latmax, double *lonmax)
 Initialize an iterator that will return all the nodes in the grid that fall within the specified lat, lon range.
int slbm_shell_getNActiveNodes (int *nNodes)
int slbm_shell_getGridNodeId (int activeNodeId, int *gridNodeId)
int slbm_shell_getActiveNodeId (int gridNodeId)
int slbm_shell_getNodeHitCount (int *nodeId, int *hitCount)
int slbm_shell_getNodeNeighbors (int *nid, int neighbors[], int *nNeighbors)
 Retrieve the node IDs of the nodes that surround the specified node.
int slbm_shell_getNodeNeighborInfo (int *nid, int neighbors[], double distance[], double azimuth[], int *nNeighbors)
 Retrieve the node IDs of the nodes that surround the specified node.
int slbm_shell_getNodeSeparation (int *node1, int *node2, double *distance)
int slbm_shell_getNodeAzimuth (int *node1, int *node2, double *azimuth)
int slbm_shell_getTravelTimeUncertainty (int *phase, double *distance, double *uncertainty)
 Retrieve the travel time uncertainty in sec for specified phase, distance.
int slbm_shell_getTTUncertainty (double *uncertainty)
 Retrieve travel time uncertainty in sec using the phase and distance specified in last call to getGreatCircle().
int slbm_shell_getSlownessUncertainty (int *phase, double *distance, double *uncert)
 Retrieve the slowness uncertainty in sec/radian for specified phase, distance.
int slbm_shell_getSHUncertainty (double *slownessUncertainty)
 Retrieve uncertainty of the horizontal slowness, in seconds/radian using the phase and distance specified in last call to getGreatCircle().
int slbm_shell_getZhaoParameters (double *Vm, double *Gm, double *H, double *C, double *Cm, int *udSign)
 Retrieve some of the parameters that contribute to the calculation of of total travel time using the Zhao algorithm.
int slbm_shell_getActiveNodeWeights (int nodeId[], double weight[], int *nWeights)
 Retrieve the weight assigned to each active node that was touched by the GreatCircle.
int slbm_shell_getActiveNodeWeightsSource (int nodeids[], double weights[])
 Retrieve the active node IDs and the interpolation coefficients for the source CrustalProfile.
int slbm_shell_getActiveNodeWeightsReceiver (int nodeids[], double weights[])
 Retrieve the active node IDs and the interpolation coefficients for the receiver CrustalProfile.
int slbm_shell_getActiveNodeNeighbors (int *nid, int neighbors[], int *nNeighbors)
 Retrieve the node IDs of the nodes that surround the specified node.
int slbm_shell_getActiveNodeNeighborInfo (int *nid, int neighbors[], double distance[], double azimuth[], int *nNeighbors)
 Retrieve the node IDs of the nodes that surround the specified node.
int slbm_shell_getActiveNodeData (int *nodeId, double *latitude, double *longitude, double depth[NLAYERS], double pvelocity[NLAYERS], double svelocity[NLAYERS], double gradient[2])
 Retrieve the lat (radians), lon (radians), interface depths (km), P and S wave interval velocities (km/sec) and P and S mantle gradient (1/sec) information associated with a specified active node in the velocity grid.
int slbm_shell_setActiveNodeData (int *nodeId, double depth[NLAYERS], double pvelocity[NLAYERS], double svelocity[NLAYERS], double gradient[2])
 Modify the velocity and gradient information associated with a specified active node in the Grid.
int slbm_shell_setCHMax (double *chMax)
 Set the value of chMax. c is the zhao c parameter and h is the turning depth of the ray below the moho. Zhao method only valid for c*h << 1. When c*h > chMax, then slbm will throw an exception.
int slbm_shell_getCHMax (double *chMax)
 Retrieve the current value of chMax. c is the zhao c parameter and h is the turning depth of the ray below the moho. Zhao method only valid for c*h << 1. When c*h > chMax, then slbm will throw an exception.
int slbm_shell_getAverageMantleVelocity (int *type, double *velocity)
 Retrieve the average P or S wave mantle velocity that is specified in the model input file, in km/sec.
int slbm_shell_setAverageMantleVelocity (int *type, double *velocity)
 Set the average P or S wave mantle velocity that is recorded in the model input file, in km/sec.
int slbm_shell_getTessId (char *tessId)
 Retrieve the tessellation ID of the model currently in memory.
int slbm_shell_getFractionActive (double *fractionActive)
 Retrieve the fraction of the path length of the current GreatCircle object that is within the currently defined active region.
int slbm_shell_setMaxDistance (const double *maxDistance)
 Set the maximum source-receiver separation for Pn/Sn phase, in radians.
int slbm_shell_getMaxDistance (double *maxDistance)
 Retrieve the current value for the maximum source-receiver separation, in radians.
int slbm_shell_setMaxDepth (const double *maxDepth)
 Set the maximum source depth for Pn/Sn phase, in km.
int slbm_shell_getMaxDepth (double *maxDepth)
 Retrieve the current value for the maximum source depth, in km.
int slbm_shell_getPgLgComponents (double *tTotal, double *tTaup, double *tHeadwave, double *pTaup, double *pHeadwave, double *trTaup, double *trHeadwave)
 Retrieve information about Pg/Lg travel time calculations.
int slbm_shell_getSlowness (double *slowness)
 Retrieve the horizontal slowness, i.e., the derivative of travel time wrt to receiver-source distance, in seconds/radian.
int slbm_shell_get_dtt_dlat (double *dtt_dlat)
 Retrieve the derivative of travel time wrt to source latitude, in seconds/radian.
int slbm_shell_get_dtt_dlon (double *dtt_dlon)
 Retrieve the derivative of travel time wrt to source longitude, in seconds/radian.
int slbm_shell_get_dtt_ddepth (double *dtt_ddepth)
 Retrieve the derivative of travel time wrt to source depth, in seconds/km.
int slbm_shell_getDistAz (double aLat, double aLon, double bLat, double bLon, double *distance, double *azimuth, double naValue)
 compute distance and azimuth between two points, A and B (all quantities are in radians).
int slbm_shell_movePoint (double aLat, double aLon, double distance, double azimuth, double *bLat, double *bLon)
 Find point B that is the specified distance and azimuth from point A. All quantities are in radians.
int slbm_shell_getGreatCircleLocations (double latitude[], double longitude[], double depth[], int *npoints)
 Retrieve the latitudes, longitudes and depths of all the profile positions along the moho.
int slbm_shell_getGreatCirclePoints (double aLat, double aLon, double bLat, double bLon, int npoints, double latitude[], double longitude[])
 Retrieve an array of lat, lon points along a great circle path between two specified points, a and b.
int slbm_shell_getGreatCirclePointsOnCenters (double aLat, double aLon, double bLat, double bLon, int npoints, double latitude[], double longitude[])
 Retrieve an array of lat, lon points along a great circle path between two specified points, a and b.
int slbm_shell_getPiercePointSource (double *lat, double *lon, double *depth)
 Retrieve the latitude and longitude of the moho pierce point below the source, in radians.
int slbm_shell_getPiercePointReceiver (double *lat, double *lon, double *depth)
 Retrieve the latitude and longitude of the moho pierce point below the receiver, in radians.
int slbm_shell_getDelDistance (double *delDistance)
 Retrieve del_distance in radians.
int slbm_shell_setDelDistance (double delDistance)
 Set the value of del_distance, radians.
int slbm_shell_getDelDepth (double *delDepth)
 Retrieve del_depth in km.
int slbm_shell_setDelDepth (double delDepth)
 Set the value of del_depth, in km.
int slbm_shell_setPathIncrement (double pathIncrement)
 Set the desired spacing of great circle nodes along the head wave interface, in radians.
int slbm_shell_getPathIncrement (double *pathIncrement)
 Retrieve the current value of the spacing of great circle nodes along the head wave interface, in radians.

Variables

static const char * SlbmVersion = "2.8.2"
static const int PWAVE = 0
static const int SWAVE = 1
 Convenience constant for S wave index.
static const int Pn = 0
 Convenience constant for Pn phase.
static const int Sn = 1
 Convenience constant for Sn phase.
static const int Pg = 2
 Convenience constant for Pg phase.
static const int Lg = 3
 Convenience constant for Lg phase.
static const int WATER = 0
static const int SEDIMENT1 = 1
static const int SEDIMENT2 = 2
static const int SEDIMENT3 = 3
static const int UPPER_CRUST = 4
static const int MIDDLE_CRUST_N = 5
static const int MIDDLE_CRUST_G = 6
static const int LOWER_CRUST = 7
static const int MANTLE = 8
static const int NLAYERS = 9
static const int TOP_LAYER = 1
static const int nCoefficients = 3

Detailed Description

FILE slbm_C_shell.h

DESCRIPTION
Proto types for the SLBM C Shell Interface

A "C" Interface to the SLBM C++ library, providing access to all supported functionality.

The slbm_C_shell Interface (C++) manages a connection to the C++ SLBM library and provides C compatible functions. To make this work, 4 conditions must be met:
1) The C++ shared objects libslbm.so and libslbmCshell.so must both be accessible via the LD_LIBRARY_PATH.
2) The C application must be linked to libslbm.so and libslbmCshell.so
3) The C application must execute the command: slbm_shell_create();
4) The C application must execute the command: slbm_shell_loadVelocityModelBinary();

If all of these conditions are successfully met, then the the C application can use the slbm_C_shell interface through the shared object library libslbmCshell.so to access all the methods described in this document.

Almost all functions in the C interface return an integer error code that will be 0 if the function completed successfully or a positive error code if the function generated some sort of error. Applications should check the value of the returned error code after each function call. If the returned error code is > 0 then function slbm_shell_getErrorMessage() can be called to retrieve an errorMessage that provides information about the error. Some of the most important error codes are listed in the followng table.

CodeFunctionMessage
106Grid::reaDataBuffererFromFileCould not open velocity model file.
200GreatCircle_Xg constructorPg/Lg not valid because source or receiver is below the Moho.
201GreatCircle_Xn::computeTravelTimeSource-receiver separation exceeds maximum value.
202GreatCircle_Xn::computeTravelTimeSource depth exceeds maximum value.
203GreatCircle_Xn::computeTravelTimeCrustHorizontal offset below the source plus horizontal offset below the receiver is greater than the source-receiver separation
300GreatCircle_Xn::computeTravelTimeCrustnIterations == 10000
301GreatCircle_Xn::computeTravelTimeCrustc*H is greater than ch_max.
302GreatCircle_Xn::computeTravelTimeMantleCould not converge on stable ray parameter.
303GreatCircle_Xn::computeTravelTimeMantlesearch for minimum H failed.
304GreatCircle_Xn::computeTravelTimeMantlec*H > ch_max.
305GreatCircle_Xn::brentToo many iterations.
400GreatCircle_Xg::computeTravelTimecomputeTravelTimeTaup() and computeTravelTimeHeadwave() both returned NA_VALUE.
401GreatCircle_Xn::computeTravelTimeReceiver depth below Moho is illegal.
402GreatCircle_Xn::computeTravelTimeCrustSource is too close to the receiver.

The libslbmCshell.so maintains a C++ Grid object, which manages interaction with the Earth model. The Earth model is loaded by calling the loadVelocityModel(String) method, described below. This Grid object remains in memory until deleted with the command slbm_shell_delete(), or a different Earth model is loaded with another call to loadVelocityModel(String).

libslbmCshell.so also maintains a single instance of a C++ GreatCircle object which is instantiated with a call to createGreatCircle(). Once instantiated, many slbm_C_shell methods can retrieve information from this GreatCircle object, such as getTravelTime(), getWeights(), toString(int), and more. Once instantiated, the GreatCircle can be interrogated until it is replaced with another GreatCircle by a subsequent call to createGreatCircle(), or is deleted by clear().

The Grid object stores a vector of map objects which associates the phase and Location of a CrustalProfile object with a pointer to the instance of the CrustalProfile. When createGreatCircle() is called with a latitude, longitude and depth which has been used before, the Grid object will return a pointer to the existing CrustalProfile object, thereby enhancing performance. This vector of maps is cleared when clear() is called. The implications of all this is that applications that loop over many calls to createGreatCircle() will see a performance improvement if clear() is not called within the loop. However, for problems where the number of sources and/or receivers is so large that memory becomes an issue, applications could call clear() within the loop to save memory.

All calculations assume the Earth is defined by a GRS80 ellipsoid. For a description of how points along a great circle are calculated see geovectors.pdf

Company: Sandia National Laboratories

Author: Sandy Ballard


Function Documentation

int slbm_shell_clear ( )

Delete the current GreatCircle object from memory and clear the pool of stored CrustalProfile objects. The model Grid is not deleted and remains accessible.

The Grid object owned by SlbmInterface stores a vector of map objects which associates the phase and Location of a CrustalProfile object with a pointer to the instance of the CrustalProfile. When createGreatCircle() is called with a latitude, longitude and depth which has been used before, the Grid object will return a pointer to the existing CrustalProfile object, thereby enhancing performance. This vector of maps is cleared when SlbmInterface::clear() is called. The implications of all this is that applications that loop over many calls to createGreatCircle() will see a performance improvement if clear() is not called within the loop. However, for problems with a huge number of sources and or receivers, if memory becomes an issue, applications could call clear() within the loop to save memory.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_create ( )

Instantiate a SLBM Interface object.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_create_fixedEarthRadius ( double *  radius)

Instantiate a SLBM Interface object fixing the earth radius to the double value passed in argument list.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_createGreatCircle ( char *  phase,
double *  sourceLat,
double *  sourceLon,
double *  sourceDepth,
double *  receiverLat,
double *  receiverLon,
double *  receiverDepth 
)

Instantiate a new GreatCircle object between two locations.

Parameters:
phasethe phase that this GreatCircle is to support. Recognized phases are Pn, Sn, Pg and Lg.
sourceLatthe geographic latitude of the source in radians.
sourceLonthe longitude of source in radians.
sourceDepththe depth of the source in km.
receiverLatthe geographic latitude of the receiver in radians.
receiverLonthe longitude of the receiver in radians.
receiverDepththe depth of the receiver in km.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_delete ( )

Deletes the SlbmInterface object instaniated with the call slbm_shell_create().

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_get_dtt_ddepth ( double *  dtt_ddepth)

Retrieve the derivative of travel time wrt to source depth, in seconds/km.

Parameters:
dtt_ddepththe derivative of travel time wrt to source depth.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_get_dtt_dlat ( double *  dtt_dlat)

Retrieve the derivative of travel time wrt to source latitude, in seconds/radian.

Parameters:
dtt_dlatthe derivative of travel time wrt to source latitude.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_get_dtt_dlon ( double *  dtt_dlon)

Retrieve the derivative of travel time wrt to source longitude, in seconds/radian.

Parameters:
dtt_dlonthe derivative of travel time wrt to source longitude.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getActiveNodeData ( int *  nodeId,
double *  latitude,
double *  longitude,
double  depth[NLAYERS],
double  pvelocity[NLAYERS],
double  svelocity[NLAYERS],
double  gradient[2] 
)

Retrieve the interface depth, velocity and gradient information associated with a specified active node in the velocity grid.

Parameters:
nodeIdthe active node ID of the grid point in the model (zero based index).
latitudethe latitude of the grid node in radians.
longitudethe longitude of the grid node in radians.
depththe depths of all the model interfaces, in km.
pvelocityan array containing the P velocities of all the intervals at the specified grid node, in km/sec.
svelocityan array containing the S velocities of all the intervals at the specified grid node, in km/sec.
gradienta 2-element array containing the P and S velocity gradients in the mantle, in 1/sec.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getActiveNodeId ( int  gridNodeId)

Retrieve the active node ID that corresponds to a specified grid node ID.

int slbm_shell_getActiveNodeNeighborInfo ( int *  nid,
int  neighbors[],
double  distance[],
double  azimuth[],
int *  nNeighbors 
)

Retrieve the node IDs of the nodes that surround the specified node.

The caller must supply int array neighbors which is dimensioned large enough to hold the maximum number of neighbors that a node can have, which is 8. The actual number of neighbors is returned in nNeighbors.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getActiveNodeNeighbors ( int *  nid,
int  neighbors[],
int *  nNeighbors 
)

Retrieve the node IDs of the nodes that surround the specified node.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getActiveNodeWeights ( int  nodeId[],
double  weight[],
int *  nWeights 
)

Retrieve the weight assigned to each active node that Retrieve the weight assigned to each node that was touched by the GreatCircle.

A map which associates an instance of a GridProfile object with a double weight is initialized. Then every LayerProfile on the head wave interface between the source and receiver is visited and the angular distance, d, that the ray traveled in the horizontal segment is retrieved. If d > 0, then the neighboring GridProfile objects that contributed to the interpolated value of the LayerProfile are visited. The product of d * R * C is added to the weight associated with that GridProfile object, where R is the radius of the head wave interface for the LayerProfile object being evaluated, and C is the interpolation coefficient for the GridProfile - LayerProfile pair under consideration. Then, all the GridProfile objects in the map are visited, the grid node IDs extracted into int array nodeId, and the weight extracted into double array weight.

Note: Only grid nodes touched by this GreatCircle are included in the output. Each grid node is included only once, even though more than one LayerProfile object may have contributed some weight to it. The sum of all the weights will equal the horizontal distance traveled by the ray along the head wave interface, from the source pierce point to the receiver pierce point, in km.

Parameters:
nodeIdthe active node IDs of all the grid nodes touched by the current GreatCircle.
weightthe weights of all the grid nodes touched by the current GreatCircle. Calling application must dimension this array large enough to handle any possible size.
nWeightsthe number of elements in nodeId and weight. Calling application must dimension this array large enough to handle any possible size.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getActiveNodeWeightsReceiver ( int  nodeids[],
double  weights[] 
)

Retrieve the active node IDs and the interpolation coefficients for the receiver CrustalProfile. There will be BaseObject::nCoefficients of each. The sum of the weights will equal 1.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getActiveNodeWeightsSource ( int  nodeids[],
double  weights[] 
)

Retrieve the active node IDs and the interpolation coefficients for the source CrustalProfile. There will be BaseObject::nCoefficients of each. The sum of the weights will equal 1.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getAverageMantleVelocity ( int *  type,
double *  velocity 
)

Retrieve the average P or S wave mantle velocity that is specified in the model input file. This value is used in the calculation of the Zhao c parameter.

Parameters:
typespecify either BaseObject::PWAVE or BaseObject::SWAVE.
velocitythe P or S wave velocity is returned in this parameter, in km/sec.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getCHMax ( double *  chMax)

Retrieve the current value of chMax. c is the zhao c parameter and h is the turning depth of the ray below the moho. Zhao method only valid for c*h << 1. When c*h > chMax, then slbm will throw an exception. This call retrieves global parameter BaseObject::ch_max

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getDelDepth ( double *  delDepth)

Retrieve current value of del_depth, in km. This is the vertical separation between two points used to compute the derivative of travel time with respect to depth.

Parameters:
delDepthvertical separation in km.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getDelDistance ( double *  delDistance)

Retrieve current value of del_distance, in radians. This is the horizontal separation between two points used to compute horizontal slowness and the derivative of travel time with respect to lat and lon.

Parameters:
delDistancehorizontal separation in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getDistance ( double *  dist)

Retrieve the source-receiver separation, in radians.

Parameters:
distthe source-receiver separation is returned in distance. If the GreatCircle is invalid, distance will equal BaseObject::NA_VALUE.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getDistAz ( double  aLat,
double  aLon,
double  bLat,
double  bLon,
double *  distance,
double *  azimuth,
double  naValue 
)

compute distance and azimuth between two points, A and B (all quantities are in radians). Computed distance will range between 0 and PI and azimuth will range from -PI to PI. If distance is zero, or if A is located at north or south pole, azimuth will be set to naValue.

Parameters:
aLatthe latitude of the first specified point, in radians.
aLonthe longitude of the first specified point, in radians.
bLatthe latitude of the second specified point, in radians.
bLonthe longitude of the second specified point, in radians.
distancefrom point A to point B, in radians.
azimuthfrom point A to point B, in radians.
naValuevalue to return if result is invalid, in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getErrorMessage ( char *  str)

Retrieves last error message. This method should be called following any function call that returns a "1" indicating an error has occurred. The string is populated with the text obtained from the SLBMException::emessage attribute.

Parameters:
stra char pointer to contain the err message. NOTE: user should allocate storage for approximately 500 chars.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getFractionActive ( double *  fractionActive)

Retrieve the fraction of the path length of the current GreatCircle object that is within the currently defined active region.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getGreatCircleData ( char *  phase,
double *  path_increment,
double  sourceDepth[],
double  sourceVelocity[],
double  receiverDepth[],
double  receiverVelocity[],
double  headWaveVelocity[],
double  gradient[],
int  neighbors[][nCoefficients],
double  coefficients[][nCoefficients],
int *  npoints 
)

Retrieve the data required for input to the travel time calculation, for the current GreatCircle object.

Parameters:
phasethe phase supported by the current GreatCircle. Will be one of Pn, Sn, Pg, Lg.
path_incrementthe actual horizontal separation of the LayerProfile objects along the head wave interface, in radians. The actual separation will be reduced from the value requested in the call to createGreatCircle() in order that some number of equal sized increments will exactly fit between the source and receiver.
sourceDepththe depths of all the model interfaces below the source, in km.
sourceVelocitythe P or S velocity of each interval below the source, in km/sec.
receiverDepththe depths of all the model interfaces below the receiver, in km.
receiverVelocitythe P or S velocity of each interval below the receiver, in km/sec.
headWaveVelocitythe P or S velocity at the center of each horizontal segment between the source and the receiver, in km/sec. The first horizontal segment starts at the source, the last horizontal segment ends at the receiver, and each one is of size path_increment. The head wave velocities are interpolated at the center of each of these horizontal segments, just below the head wave interface.
gradientthe P or S velocity gradient in the mantle at the center of each horizontal segment of the head wave, in 1/sec. For Pg and Lg, the values will be BaseObject::NA_VALUE.
neighborsthe nodeIds of the neighboring grid nodes used to derive the interpolated data at each head wave profile.
coefficientsthe interpolation coefficients applied to each element of neighbors
npointsthe number of horizontal increments sampled along the head wave interface. To discover this number before calling this method call getNHeadWavePoints().
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getGreatCircleLocations ( double  latitude[],
double  longitude[],
double  depth[],
int *  npoints 
)

Retrieve the latitudes, longitudes and depths of all the profile positions along the moho. Profile positions are located at the center of each segment of the head wave interface between the source and receiver. The first position is located path_increment/2 radians from the source, the last profile position is located path_increment/2 radians from the receiver, and the others are spaced path_increment radians apart.

Parameters:
latitudethe latitude at the center of each headwave segment, in radians.
longitudethe longitude at the center of each headwave segment, in radians.
depththe depth of the headwave interface at the center of each headwave segment, in km.
npointsthe number of horizontal increments sampled along the head wave interface.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getGreatCirclePoints ( double  aLat,
double  aLon,
double  bLat,
double  bLon,
int  npoints,
double  latitude[],
double  longitude[] 
)

Retrieve an array of lat, lon points along a great circle path between two specified points. The great circle path between a and b is divided into npoints-1 equal size cells and the computed points are located at the boundaries of those cells. First point will coincide with point a and last point with point b.

Parameters:
aLatthe latitude of the first specified point, in radians.
aLonthe longitude of the first specified point, in radians.
bLatthe latitude of the second specified point, in radians.
bLonthe longitude of the second specified point, in radians.
npointsthe desired number of points along the great circle, in radians.
latitudethe latitudes of the points along the great circle, in radians.
longitudethe longitudes of the points along the great circle, in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getGreatCirclePointsOnCenters ( double  aLat,
double  aLon,
double  bLat,
double  bLon,
int  npoints,
double  latitude[],
double  longitude[] 
)

Retrieve an array of lat, lon points along a great circle path between two specified points. The great circle path between a and b is divided into npoints equal size cells and the computed points are located at the centers of those cells.

Parameters:
aLatthe latitude of the first specified point, in radians.
aLonthe longitude of the first specified point, in radians.
bLatthe latitude of the second specified point, in radians.
bLonthe longitude of the second specified point, in radians.
npointsthe desired number of points along the great circle
latitudethe latitudes of the points along the great circle, in radians.
longitudethe longitudes of the points along the great circle, in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getGridData ( int *  nodeId,
double *  latitude,
double *  longitude,
double *  depth,
double *  pvelocity,
double *  svelocity,
double *  gradient 
)

Retrieve the interface depth, velocity and gradient information associated with a specified node in the velocity grid.

Parameters:
nodeIdthe node ID of the grid point in the model (zero based index).
latitudethe latitude of the grid node in radians.
longitudethe longitude of the grid node in radians.
depththe depths of all the model interfaces, in km.
pvelocityan array containing the P velocities of all the intervals at the specified grid node, in km/sec.
svelocityan array containing the S velocities of all the intervals at the specified grid node, in km/sec.
gradienta 2-element array containing the P and S velocity gradients in the mantle, in 1/sec.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getGridNodeId ( int  activeNodeId,
int *  gridNodeId 
)

Retrieve the grid node ID that corresponds to a specified active node ID.

int slbm_shell_getHeadwaveDistance ( double *  dist)

Retrieve the angular distance traveled by the ray below the headwave interface, in radians. This is the total distance minus the horizontal offsets below the source and receiver. getSourceDistance() + getReceiverDistance() + getHeadwaveDistance() = getDistance().

Parameters:
distthe angular distance traveled by the ray below the headwave interface, in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getHeadwaveDistanceKm ( double *  dist)

Retrieve horizontal distance traveled by the ray below the headwave interface, in km. This is the sum of path_increment(i) * R(i) where path_increment(i) is the angular distance traveled by the ray in each angular distance increment along the head wave interface, and R(i) is the radius of the head wave interface in that same horizontal increment.

Parameters:
distthe horizontal distance traveled by the ray below the headwave interface, in km.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getInterpolatedPoint ( double *  lat,
double *  lon,
int *  nodeId,
double *  coefficients,
double *  depth,
double *  pvelocity,
double *  svelocity,
double *  pgradient,
double *  sgradient 
)

Retrieve interpolated data from the earth model at a single specified latitude, longitude.

Parameters:
latthe latitude where information is to be interpolated, in radians.
lonthe longitude where information is to be interpolated, in radians.
nodeIdthe nodeIds of the grid nodes that were involved in the interpolation.
coefficientsthe interpolation coefficients that were applied to the information from the neighboring grid nodes.
depththe depths of the tops of the interfaces in the Earth model, in km. There will be one of these for each layer of the model.
pvelocitythe P velocities of each layer of the model, in km/sec.
svelocitythe S velocities of each layer of the model, in km/sec.
pgradientthe mantle P velocity gradient, in 1/sec.
sgradientthe mantle S velocity gradient, in 1/sec.
Returns:
true if successful. If not successful, nodeIds are all -1 and all other returned arrays are populated with BaseObject::NA_VALUE.
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getInterpolatedTransect ( double  lat[],
double  lon[],
int *  nLatLon,
int  nodeId[][nCoefficients],
double  coefficients[][nCoefficients],
double  depth[][NLAYERS],
double  pvelocity[][NLAYERS],
double  svelocity[][NLAYERS],
double  pgradient[NLAYERS],
double  sgradient[NLAYERS],
int *  nInvalid 
)

Retrieve interpolated data from the earth model along a transect defined by equal sized, 1 dimensional arrays of latitude and longitude.

Parameters:
latthe latitudes along the transect, in radians.
lonthe longitudes along the transect, in radians.
nLatLonthe number of interpolated points along the transect.
nodeIdthe nodeIds of the grid nodes that were involved in the interpolations. There will be BaseObject::nCoefficients of these.
coefficientsthe interpolation coefficients that were applied to the information from the neighboring grid nodes. There will be BaseObject::nCoefficients of these.
depththe depths of the tops of the interfaces in the Earth model, in km.
pvelocitythe P velocities of each layer of the model, in km/sec.
svelocitythe S velocities of each layer of the model, in km/sec.
pgradientthe mantle P velocity gradient, in 1/sec.
sgradientthe mantle S velocity gradient, in 1/sec.
nInvalidthe number of points that were out of model range. For any points outside of the model range, nodeIds are all -1 and all other returned arrays are populated with BaseObject::NA_VALUE.
Returns:
"0" if all points were in model range (nInvalid == 0).
int slbm_shell_getMaxDepth ( double *  maxDepth)

Retrieve the current value for the maximum source depth, in km.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getMaxDistance ( double *  maxDistance)

Retrieve the current value for the maximum source-receiver separation, in radians.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getNActiveNodes ( int *  nNodes)

Retrieve the number of active nodes in the Grid.

int slbm_shell_getNGridNodes ( int *  numGridNodes)

Retrieve the number of Grid nodes in the Earth model.

Parameters:
numGridNodesthe number of elements in the grid
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getNHeadWavePoints ( int *  npoints)

Retrieve the number of LayerProfile objects positioned along the head wave interface. It is useful to call this method before calling getGreatCircleData() since the value returned by this method will be the number of elements that will be populated in parameters headWaveVelocity[], neighbors[] and coefficients[].

Parameters:
npointsnumber of LayerProfle objects.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getNodeAzimuth ( int *  node1,
int *  node2,
double *  azimuth 
)

Retrieve the azimuth from grid node1 to grid node2, radians.

int slbm_shell_getNodeHitCount ( int *  nodeId,
int *  hitCount 
)

Retrieve the number of times that node has been 'touched' by a GreatCircle object.

int slbm_shell_getNodeNeighborInfo ( int *  nid,
int  neighbors[],
double  distance[],
double  azimuth[],
int *  nNeighbors 
)

Retrieve the node IDs of the nodes that surround the specified node.

The caller must supply int array neighbors which is dimensioned large enough to hold the maximum number of neighbors that a node can have, which is 8. The actual number of neighbors is returned in nNeighbors.

int slbm_shell_getNodeNeighbors ( int *  nid,
int  neighbors[],
int *  nNeighbors 
)

Retrieve the node IDs of the nodes that surround the specified node.

The caller must supply int array neighbors which is dimensioned large enough to hold the maximum number of neighbors that a node can have, which is 8. The actual number of neighbors is returned in nNeighbors.

int slbm_shell_getNodeSeparation ( int *  node1,
int *  node2,
double *  distance 
)

Retrieve the angular separation of two grid nodes, in radians.

int slbm_shell_getPathIncrement ( double *  pathIncrement)

Retrieve the current value of the spacing of great circle nodes along the head wave interface, in radians. The actual spacing will be reduced from the requested value in order that an integral number of equally spaced LayerProfile objects will exactly span the source-receiver separation. The default value is 0.1 degrees.

Parameters:
thecurrent value of the spacing of great circle nodes along the head wave interface, in radians.
int slbm_shell_getPgLgComponents ( double *  tTotal,
double *  tTaup,
double *  tHeadwave,
double *  pTaup,
double *  pHeadwave,
double *  trTaup,
double *  trHeadwave 
)

Retrieve information about Pg/Lg travel time calculations. This method only returns useful information when the phase is Pg or Lg. For Pn and Sn, all information is returned as SLBMGlobals::NA_VALUE.

Parameters:
tTotalis the total travel time in seconds. It will be exactly equal to the lesser of tTaup or tHeadwave, except that if tTaup is equal to SLBMGlobals::NA_VALUE, then tTotal will equal tHeadwave.
tTaupis the taup travel time in seconds. If this value is equal to SLBMGlobals::NA_VALUE, it means that the taup calculation failed for some reason (shadow zones, etc.).
tHeadwaveis the headwave travel time in secods
pTaupTauP ray parameter.
pHeadwaveheadwave ray parameter.
trTaupis the radius at which the taup ray turned, in km.
trHeadwaveis the radius at which the headwave ray turned, in km.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getPiercePointReceiver ( double *  lat,
double *  lon,
double *  depth 
)

Retrieve the latitude and longitude of the moho pierce point below the receiver, in radians. For Pg, Lg an exception is thrown.

Parameters:
latthe latitude of the receiver pierce point, in radians.
lonthe longitude of the receiver pierce point, in radians.
depthmoho depth in km below sea level
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getPiercePointSource ( double *  lat,
double *  lon,
double *  depth 
)

Retrieve the latitude and longitude of the moho pierce point below the source, in radians. For Pg, Lg and sources in the mantle an exception is thrown.

Parameters:
latthe latitude of the source pierce point, in radians.
lonthe longitude of the source pierce point, in radians.
depthmoho depth in km below sea level
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getReceiverDistance ( double *  dist)

Retrieve horizontal offset below the receiver, in radians. This is the angular distance between the location of the receiver and the receiver pierce point where the ray impinged on the headwave interface.

Parameters:
distthe horizontal offset below the receiver, in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getSHUncertainty ( double *  slownessUncertainty)

Retrieve uncertainty of the horizontal slowness, in seconds/radian, using the phase and distance specified in last call to getGreatCircle().

Parameters:
slownessUncertaintyuncertainty of the horizontal slowness, in seconds/radian.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getSlowness ( double *  slowness)

Retrieve the horizontal slowness, in seconds/radian.

Parameters:
slownessthe derivative of travel time wrt to source latitude.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getSlownessUncertainty ( int *  phase,
double *  distance,
double *  uncert 
)

Retrieve the slowness uncertainty in sec/radian for specified phase, distance.

Parameters:
phasePn, Sn, Pg or Lg
distancesource-receiver separation in radians.
uncertreturns the uncertainty in sec/radian
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getSourceDistance ( double *  dist)

Retrieve horizontal offset below the source, in radians. This is the angular distance between the location of the source and the source pierce point where the ray impinged on the headwave interface.

Parameters:
distthe horizontal offset below the source, in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getTessId ( char *  tessId)

Retrieve the tessellation ID of the model currently in memory.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getTravelTime ( double *  travelTime)

Retrieve the total travel time for the GreatCircle, in seconds.

Parameters:
travelTimethe total travel time in seconds is returned in travelTime. If the GreatCircle is invalid, travelTime will equal BaseObject::NA_VALUE.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getTravelTimeComponents ( double *  tTotal,
double *  tSource,
double *  tReceiver,
double *  tHeadwave,
double *  tGradient 
)

Retrieve the total travel time and the 4 components that contribute to it for the current GreatCircle. If the greatCircle is invalid, tTotal and all the components will equal BaseObject::NA_VALUE.

Parameters:
tTotalthe total travel time, in seconds.
tSourcethe crustal travel time below the source, in seconds.
tReceiverthe crustal travel time below the receiver, in seconds.
tHeadwavethe head wave travel time, in seconds.
tGradientthe Zhao gradient correction term, in seconds. For GreatCircle objects that support Pg and Lg, this is always 0.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getTravelTimeUncertainty ( int *  phase,
double *  distance,
double *  uncertainty 
)

Retrieve the travel time uncertainty in sec for specified phase, distance.

Parameters:
phasePn, Sn, Pg or Lg
distancesource-receiver separation in radians.
uncertreturns the uncertainty in sec
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getTTUncertainty ( double *  uncertainty)

Retrieve travel time uncertainty in sec using the phase and distance specified in last call to getGreatCircle().

Parameters:
travelTimeUncertaintyuncertainty of the travel time in seconds.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getVersion ( char *  str)

Retrieve the SLBM Version number.

Parameters:
stra char pointer to contain the version number. NOTE: user should allocate storage for approximately 10 chars.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getWeights ( int  nodeId[],
double  weight[],
int *  nWeights 
)

Retrieve the weight assigned to each grid node that was touched by the GreatCircle.

A map which associates an instance of a GridProfile object with a double weight is initialized. Then every LayerProfile on the head wave interface between the source and receiver is visited and the angular distance, d, that the ray traveled in the horizontal segment is retrieved. If d > 0, then the neighboring GridProfile objects that contributed to the interpolated value of the LayerProfile are visited. The product of d * R * C is added to the weight associated with that GridProfile object, where R is the radius of the head wave interface for the LayerProfile object being evaluated, and C is the interpolation coefficient for the GridProfile - LayerProfile pair under consideration. Then, all the GridProfile objects in the map are visited, the grid node IDs extracted into int array nodeId, and the weight extracted into double array weight.

Note: Only grid nodes touched by this GreatCircle are included in the output. Each grid node is included only once, even though more than one LayerProfile object may have contributed some weight to it. The sum of all the weights will equal the horizontal distance traveled by the ray along the head wave interface, from the source pierce point to the receiver pierce point, in km.

Parameters:
nodeIdthe node IDs of all the grid nodes touched by the current GreatCircle.
weightthe weights of all the grid nodes touched by the current GreatCircle. Calling application must dimension this array large enough to handle any possible size.
nWeightsthe number of elements in nodeId and weight. Calling application must dimension this array large enough to handle any possible size.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getWeightsReceiver ( int  nodeids[],
double  weights[] 
)

Retrieve the node IDs and the interpolation coefficients for the receiver CrustalProfile. There will be BaseObject::nCoefficients of each. The sum of the weights will equal 1.

Parameters:
nodeids[]the nodeIds that influenced the interpolated values at the receiver.
weights[]the interpolation coefficients applied to the grid nodes that influenced the interpolated values at the receiver.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getWeightsSource ( int  nodeids[],
double  weights[] 
)

Retrieve the node IDs and the interpolation coefficients for the source CrustalProfile. There will be BaseObject::nCoefficients of each. The sum of the weights will equal 1.

Parameters:
nodeids[]the nodeIds that influenced the interpolated values at the source.
weights[]the interpolation coefficients applied to the grid nodes that influenced the interpolated values at the source.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_getZhaoParameters ( double *  Vm,
double *  Gm,
double *  H,
double *  C,
double *  Cm,
int *  udSign 
)

Retrieve some of the parameters that contribute to the calculation of of total travel time using the Zhao algorithm. This method only returns meaningful results for phases Pn and Sn. For Pg and Lg, all the parameters of type double are returned with values BaseObject::NA_VALUE and udSign is returned with value of -999.

Parameters:
Vmthe velocity at the top of the mantle averaged along the Moho between the source and receiver pierce points.
Gmthe velocity gradient at the top of the mantle averaged along the Moho between the source and receiver pierce points.
Hthe turning depth of the ray relative to the Moho
Ca constant whose product with V0 gives the mantle velocity gradient for a flat Earth. V0 is the velocity of the top of the mantle averaged over the whole model.
Cma constant whose product with Vm gives the mantle velocity gradient for a flat Earth.
udSigna value of 0 indicates the source is in the crust. +1 indicates the ray leaves a mantle source in the downgoing direction. -1 indicates the ray leaves a mantle source in an upgoing direction.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_initializeActiveNodes ( double *  latmin,
double *  lonmin,
double *  latmax,
double *  lonmax 
)

Initialize an iterator that will return all the active nodes in the grid, one at a time (see method nextActiveNode() below). Active nodes includes all grid nodes that fall within the specified range of latitude and longitude. Lats and lons must be specified in radians. Lonmin and lonmax should -PI <= lon <= PI.

int slbm_shell_isValid ( )

Returns true if the current GreatCirlce object has been instantiated and is ready to be interrogated.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_loadVelocityModel ( const char *  modelFileName)

Load the velocity model into memory.

Parameters:
modelFileNamethe full or relative path plus
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_loadVelocityModelBinary ( const char *  modelDirectory)

Load the velocity model into memory from files located in the specified directory. Slbm expects the specified modelDirectory to exist and to contain two binary files: geostacks and connectivity. It also expects there to exist a directory called tess at the same diretory level as the specified directory and for that directory to contain the binary file that specifies the tessellation with which the model data is to be associated. For example, assume the following directory structure:

/SLBM_Root
/models
/tess
450fe54afbf70f1a2f62c30d249c5643
/unified_crust20
connectivity
geostacks
/unified_iasp
connectivity
geostacks

To access model unified_crust20, you would specify modelDirectory = SLBM_Root/models/unified_crust20. Note that the name of the tessellation file is embedded in the unified_crust20/connectivity file and slbm will expect to find that file by appending "/../tess/{filename)" onto the end of the specified modelDirectory parameter.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_movePoint ( double  aLat,
double  aLon,
double  distance,
double  azimuth,
double *  bLat,
double *  bLon 
)

Find point B that is the specified distance and azimuth from point A.

Parameters:
aLatthe latitude of the first specified point, in radians.
aLonthe longitude of the first specified point, in radians.
distancefrom point A to point B, in radians.
azimuthfrom point A to point B, in radians.
bLatthe latitude of the second specified point, in radians.
bLonthe longitude of the second specified point, in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_saveVelocityModel ( const char *  modelFileName)

Save the velocity model currently in memory to the specified file. Attempting to save the model to the same file from which the model was originally read will result in an exception. If the file already exists, it will be overwritten without warning or backup.

Parameters:
modelFileNamethe full or relative path plus file name of the file to which the earth model is to be written.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_saveVelocityModelBinary ( )

Write the model currently in memory out to files. The model is written to a directory which was previously specified with a call to specifyOutputDirectory().

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setActiveNodeData ( int *  nodeId,
double  depth[NLAYERS],
double  pvelocity[NLAYERS],
double  svelocity[NLAYERS],
double  gradient[2] 
)

Modify the velocity and gradient information associated with a specified active node in the Grid.

Parameters:
nodeIdthe node number of the grid point in the model. (zero based index).
depthan array containing the depths of the tops of the layers, in km
pvelocityan array containing the P velocities of all the intervals at the specified grid node, in km/sec.
svelocityan array containing the S velocities of all the intervals at the specified grid node, in km/sec.
gradienta 2-element array containing the P and S velocity gradients in the mantle, in 1/sec.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setAverageMantleVelocity ( int *  type,
double *  velocity 
)

Set the average P or S wave mantle velocity that is specified in the model input file. This value is used in the calculation of the Zhao c parameter.

Parameters:
typespecify either BaseObject::PWAVE or BaseObject::SWAVE.
velocitythe P or S wave velocity that is to be set, in km/sec. This value will be stored in the model file, if the model file is written to file by a call to saveVelocityModel() subsequent to a call to this method.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setCHMax ( double *  chMax)

Set the value of chMax. c is the zhao c parameter and h is the turning depth of the ray below the moho. Zhao method only valid for c*h << 1. When c*h > chMax, then slbm will throw an exception. This call modifies global parameter BaseObject::ch_max

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setDelDepth ( double  delDepth)

Set the value of del_depth, in km. This is the vertical separation between two points used to compute the derivative of travel time with respect to depth.

Parameters:
delDepthvertical separation in km.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setDelDistance ( double  delDistance)

Set the value of del_distance, in radians. This is the horizontal separation between two points used to compute horizontal slowness and the derivative of travel time with respect to lat and lon.

Parameters:
delDistancehorizontal separation in radians.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setGridData ( int *  nodeId,
double *  depth,
double *  pvelocity,
double *  svelocity,
double *  gradient 
)

Modify the velocity and gradient information associated with a specified node in the Grid.

Parameters:
nodeIdthe node number of the grid point in the model. (zero based index).
depthan array containing the depths of the tops of all the interfaces.
pvelocityan array containing the P velocities of all the intervals at the specified grid node, in km/sec.
svelocityan array containing the S velocities of all the intervals at the specified grid node, in km/sec.
gradienta 2-element array containing the P and S velocity gradients in the mantle, in 1/sec.
Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setMaxDepth ( const double *  maxDepth)

Set the maximum source depth for Pn/Sn phase, in km. Source depths greater than the specified value will result in an exception being thrown in createGreatCircle(). Default value is 9999 km.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setMaxDistance ( const double *  maxDistance)

Set the maximum source-receiver separation for Pn/Sn phase, in radians. Source-receiver separations greater than the specified value will result in an exception being thrown in createGreatCircle(). Default value is PI radians.

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_setPathIncrement ( double  pathIncrement)

Set the desired spacing of great circle nodes along the head wave interface, in radians. The actual spacing will be reduced from the requested value in order that an integral number of equally spaced LayerProfile objects will exactly span the source-receiver separation. Defaults to 0.1 degrees if not specified.

Parameters:
thedesired spacing of great circle nodes along the head wave interface, in radians.
int slbm_shell_specifyOutputDirectory ( const char *  directoryName)

Specify the directory where the model that is currently in memory should be written to the next time that slbm_shell_saveVelocityModelBinary() is called. A call to specifyOutputDirectory() will check to make sure that the specified directory exists. If it does not exist, slbm will attempt to create it. Then slbm will write a very small file called deleteme.buf to the specified directory and then delete that file. All of this is done to ensure that when the model is actually written to the specified directory, the probability of error is minimized. Call method saveVelocityModelBinary() to actually write the model to the specified directory.

Note that specified directory name is associated with the Grid object currently in memory. If the current Grid object is deleted and a different Grid object loaded, the directoryName will be reset to "".

Returns:
"0" if this call was successful, positive error code if this call generated an error.
int slbm_shell_toString ( char *  str,
int  verbosity 
)

Returns a human-readable string representation of the GreatCircle object.

Parameters:
stra char pointer. NOTE: User should allocate memory to accomodate 10000 chars.
verbosityspecifies the amount of information that is to be included in the return string. Each verbosity level includes all information in preceeding verbosity levels.
  • 0 : nothing. An empty string is returned.
  • 1 : total distance and travel time summary
  • 2 : gradient correction information for Pn/Sn. Nothing for Pg/Lg
  • 3 : Source and receiver CrustalProfile information.
  • 4 : Grid node weights.
  • 5 : Head wave interface profiles
  • 6 : Interpolation coefficients for great circle nodes on the head wave interface.
Returns:
"0" if this call was successful, positive error code if this call generated an error.

Variable Documentation

const int Lg = 3 [static]

Convenience constant for Lg phase

const int LOWER_CRUST = 7 [static]
const int MANTLE = 8 [static]
const int MIDDLE_CRUST_G = 6 [static]
const int MIDDLE_CRUST_N = 5 [static]
const int nCoefficients = 3 [static]
const int NLAYERS = 9 [static]
const int Pg = 2 [static]

Convenience constant for Pg phase

const int Pn = 0 [static]

Convenience constant for Pn phase

const int PWAVE = 0 [static]

Convenience constant for P wave index.

const int SEDIMENT1 = 1 [static]
const int SEDIMENT2 = 2 [static]
const int SEDIMENT3 = 3 [static]
const char* SlbmVersion = "2.8.2" [static]
const int Sn = 1 [static]

Convenience constant for Sn phase

const int SWAVE = 1 [static]

Convenience constant for S wave index

const int TOP_LAYER = 1 [static]
const int UPPER_CRUST = 4 [static]
const int WATER = 0 [static]