RSTT
3.2.0
Regional Seismic Travel Time
|
A 2 dimensional, horizontal grid of GirdProfile objects. More...
#include <Grid.h>
Public Member Functions | |
Grid () | |
Default constructor. More... | |
virtual | ~Grid () |
Destructor. More... | |
virtual bool | operator== (const Grid &other) |
Equality operator. More... | |
virtual bool | operator!= (const Grid &other) |
Inequality operator. More... | |
virtual void | clear () |
Clears and releases all memory held by this Grid object. More... | |
virtual void | loadFromFile (const string &filename) |
Load the depth, velocity and gradient information from an ascii flat file. More... | |
virtual void | loadFromDirectory (const string &dirName) |
Load the depth, velocity and gradient information from binary files in specified directory. More... | |
virtual void | loadFromDataBuffer (util::DataBuffer &buffer) |
Load the depth, velocity and gradient information from DataBuffer. More... | |
virtual void | saveVelocityModel (util::DataBuffer &buffer) |
Save the Earth model currently in memory, to a DataBuffer. More... | |
virtual void | saveVelocityModel (const string &filename, const int &format) |
Save the Earth model currently in memory, to an ascii flat file. More... | |
virtual int | getBufferSize () const |
virtual bool | is_directory (const string &dir) |
virtual int | getNNodes () |
Retrieve the number of nodes in the model. More... | |
virtual int | getNIntervals () |
Retrieve the number of intervals in each Profile. More... | |
virtual GridProfile * | getProfile (const int &nodeId) |
Retrieve a pointer to the GridProfile that is node (i, j) in this Grid. More... | |
virtual GreatCircle * | getGreatCircle (const int &phase, const double &latSource, const double &lonSource, const double &depthSource, const double &latReceiver, const double &lonReceiver, const double &depthReceiver, const double &delta, const double &ch_max) |
Retrieve a GreatCircle object between a source and a receiver. More... | |
virtual CrustalProfile * | getReceiverProfile (const int &phase, const double &lat, const double &lon, const double &depth) |
Retrieve a CrustalProfile containing data appropriate for the specified phase at the specified location. More... | |
virtual CrustalProfile * | getSourceProfile (const int &phase, const double &lat, const double &lon, const double &depth) |
virtual void | clearCrustalProfiles () |
Delete all the CrustalProfile objects managed by this Grid. More... | |
virtual LayerProfile * | getLayerProfile (GreatCircle *greatCircle, Location &location) |
Retrieve a LayerProfile containing data appropriate for the specified GreatCircle, at the specified geographic latitude and longitude. More... | |
virtual QueryProfile * | getQueryProfile (Location &location) |
Retrieve a QueryProfile containing all available model information, at the latitude and longitude of the specified Location. More... | |
vector< vector< UncertaintyPIU * > > & | getUncertainty () |
vector< vector< UncertaintyPIU * > > & | getUncertaintyPIU () |
UncertaintyPIU & | getUncertaintyPIU (int phase, int attribute) |
vector< UncertaintyPDU * > & | getUncertaintyPDU () |
UncertaintyPDU & | getUncertaintyPDU (int phase) |
virtual double | getAverageMantleVelocity (const int &waveType) |
Retrieve the average P or S wave velocity of the mantle, in km/sec. More... | |
virtual void | setAverageMantleVelocity (const int &waveType, const double &velocity) |
Retrieve the average P or S wave velocity of the mantle, in km/sec. More... | |
virtual int | getNCrustalProfiles () |
virtual bool | findProfile (Location &location, vector< GridProfile * > &neighbors, vector< int > &nodeIds, vector< double > &coefficients) |
Find the neighboring GridProfile objects and associated interpolation coefficients at a specified Location. More... | |
void | initializeActiveNodes (double activeNodeLatMin, double activeNodeLonMin, double activeNodeLatMax, double activeNodeLonMax) |
Specify the latitude, longitude range in radians that will define which grid nodes are also active nodes. More... | |
void | initializeActiveNodes (GeoTessPolygon *polygon) |
Specify the Polygon that will define which grid nodes are also active nodes. More... | |
virtual int | getNActiveNodes () |
Retrieve the number of active nodes. More... | |
void | clearActiveNodes () |
virtual int | getGridNodeId (int activeNodeId) |
Retrieve the grid node id that corresponds to a specified active node id. More... | |
virtual int | getActiveNodeId (int nodeId) |
Retrieve the grid node id that corresponds to a specified active node id. More... | |
virtual void | getNodeNeighbors (const int &nodeId, int neighbors[], int &nNeighbors) |
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node. More... | |
virtual void | getNodeNeighbors (const int &nodeId, vector< int > &neighbors) |
Retrieve the grid node ids of the nodes that are direct neighbors of the specified grid node. More... | |
virtual void | getNodeNeighborInfo (const int &nodeId, int neighbors[], double distance[], double azimuth[], int &nNeighbors) |
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node. More... | |
virtual void | getNodeNeighborInfo (const int &nodeId, vector< int > &neighbors, vector< double > &distance, vector< double > &azimuth) |
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node. More... | |
virtual void | getActiveNodeNeighbors (const int &nodeid, int neighbors[], int &nNeighbors) |
virtual void | getActiveNodeNeighbors (const int &nodeid, vector< int > &neighbors) |
virtual void | getActiveNodeNeighborInfo (const int &nid, int neighbors[], double distance[], double azimuth[], int &nNeighbors) |
virtual void | getActiveNodeNeighborInfo (const int &nid, vector< int > &neighbors, vector< double > &distance, vector< double > &azimuth) |
virtual void | getNodeSeparation (const int &node1, const int &node2, double &distance) |
Retrieve the angular separation in radians between any pair of. More... | |
virtual void | getNodeAzimuth (const int &node1, const int &node2, double &azimuth) |
Retrieve the azimuth in radians from one grid node to another. More... | |
virtual void | getNodeHitCount (const int &nodeId, int &hitCount) |
virtual void | clearNodeHitCount () |
virtual int | addGeoStack (GeoStack *geoStack) |
virtual size_t | memSize () |
virtual size_t | memSizeCrustalProfiles () |
virtual string | getTessId () |
string & | getModelPath () |
virtual string | toString () |
virtual void | setInterpolatorType (const string &interpolatorType) |
virtual string | getInterpolatorType () |
const string | getOutputDirectory () |
void | specifyOutputDirectory (const string &outputDir) |
virtual GeoTessModelSLBM * | getModel () |
Static Public Member Functions | |
static Grid * | getGrid (const string &modelDirectory) |
static Grid * | getGrid (util::DataBuffer &buffer) |
static bool | fileExists (const string &fileName) |
static string | class_name () |
Protected Member Functions | |
void | writeBufferToFile (util::DataBuffer &buffer, string fileName) |
void | reaDataBuffererFromFile (util::DataBuffer &buffer, string dirname, string fileName) |
Protected Attributes | |
string | modelPath |
The name of the file or directory from which the velocity model was loaded. More... | |
vector< GridProfile * > | profiles |
The GridProfile objects which constitute the nodes in a Grid object. More... | |
vector< int > | activeNodes |
GeoTessModelSLBM * | model |
GeoTessPolygon * | polygon |
CrustalProfileStore * | sources |
CrustalProfileStore * | receivers |
vector< vector< UncertaintyPIU * > > | piu |
vector< UncertaintyPDU * > | pdu |
A 2 dimensional, horizontal grid of GirdProfile objects.
A 2 dimensional, horizontal grid of GridProfile objects.
When an application or another object in the slbm library requests a CrustalProfile object by calling Grid::getCrustalProfile() Grid will check to see if it already has a pointer to a CrustalProfile object for the same phase and at the same Location. If it does, it will return a pointer to the existing CrustalProfile object. If it does not, it will create a new CrustalProfile object and return that. The map of crustalProfiles can be cleared by calling clearCrustalProfiles(). The CrustalProfile objects owned by a Grid object are deleted in the Grid destructor.
slbm::Grid::Grid | ( | ) |
Default constructor.
Default constructor.
|
virtual |
Destructor.
Destructor.
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
inlinestatic |
|
virtual |
Clears and releases all memory held by this Grid object.
Clears and releases all memory held by this Grid object.
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
void slbm::Grid::clearActiveNodes | ( | ) |
|
inlinevirtual |
Delete all the CrustalProfile objects managed by this Grid.
Delete all the CrustalProfile objects managed by this Grid.
|
inlinestatic |
|
virtual |
Find the neighboring GridProfile objects and associated interpolation coefficients at a specified Location.
Given a Location, find the GridProfile objects that surround the Location and compute the interpolation coefficient for each of those surrounding GridProfile objects. Interpolated values will equal the sum of the values at the GridProfile objects times the corresponding interpolation coefficient.
This method is called by getCrustalProfile() and getMantleProfile() to compute InterpolatedProfile objects.
location | the Location of the desired profile |
neighbors | the GridProfile objects which surround the specified Location. |
nodeIds | the indices of the nodes correspondingn to each neighbor. |
coefficients | the interpolation coefficient corresponding to each neighbor. |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
inlinevirtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Retrieve the average P or S wave velocity of the mantle, in km/sec.
Retrieve the average P or S wave velocity of the mantle. These values are retrieved from the header information in the velocity model file.
waveType | either SLBMGlobals::PWAVE or SLBMGlobals::SWAVE. |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Retrieve a GreatCircle object between a source and a receiver.
Retrieve a GreatCircle object composed of two CrustalProfile objects, one at either end of the GreatCircle, and a number of equally spaced LayerProfile objects positioned along the interface where the head wave will travel.
phase | the phase that this GreatCircle is to support. Must be one of SLBMGlobals::Pn, SLBMGlobals::Sn, SLBMGlobals::Pg or SLBMGlobals::Lg. |
latSource | the geographic latitude at the source end of the GreatCircle, in radians. |
lonSource | the geographic longitude at the source end of the GreatCircle, in radians. |
depthSource | the depth of the source, km |
latReceiver | the geographic latitude at the receiver end of the GreatCircle, in radians. |
lonReceiver | the geographic longitude at the receiver end of the GreatCircle, in radians. |
depthReceiver | the depth of the receiver, in km. |
delta | the desired horizontal separation of the LayerProfile objects along the head wave interface, in radians. The actual separation will be reduced from the requested value somewhat in order that some number of equal sized increments will exactly fit between the source and receiver. |
ch_max | 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 > ch_max, then slbm will throw an exception. |
|
static |
|
static |
|
inlinevirtual |
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
inlinevirtual |
Retrieve a LayerProfile containing data appropriate for the specified GreatCircle, at the specified geographic latitude and longitude.
Retrieve a LayerProfile containing data appropriate for the specified GreatCircle, at the specified geographic latitude and longitude. For phases Pn and Sn the profile will include data for the mantle. For Pg and Lg, the profile will include data for the middle crust. For Pn and Pg, the velocity stored in the profile will be the P wave velocity and for Sn and Lg the velocity will be the S wave velocity. For Pn and Sn, the gradient will be the P or S wave velocity gradient in the mantle. For Pg and Lg the gradient will be SLBMGlobals::NA_VALUE.
greatCircle | the GreatCircle that the returned LayerProfile object is to support. |
location | the Location of the LayerProfile |
|
inlinevirtual |
Reimplemented in slbm::GridGeoTess.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
Retrieve the azimuth in radians from one grid node to another.
Retrieve the azimuth in radians from one grid node to another.
Reimplemented in slbm::GridGeoTess.
|
inlinevirtual |
|
virtual |
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node.
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node. Also returs the angular distance and azimuth from the specified grid node to each of its neighbors. Distances and azimuths are in radians.
Reimplemented in slbm::GridGeoTess.
|
virtual |
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node.
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node. Also returns the angular distance and azimuth from the specified grid node to each of its neighbors. Distances and azimuths are in radians.
Reimplemented in slbm::GridGeoTess.
|
virtual |
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node.
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node.
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Retrieve the grid node ids of the nodes that are direct neighbors of the specified grid node.
Retrieve the grid node ids of the nodes that are direct neighbors of the specified grid node.
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Retrieve the angular separation in radians between any pair of.
Retrieve the angular separation in radians between any pair of
Reimplemented in slbm::GridGeoTess.
|
inlinevirtual |
Retrieve a pointer to the GridProfile that is node (i, j) in this Grid.
Retrieve a pointer to the GridProfile that is node (i, j) in this Grid.
nodeId | the node index of the desired grid node. |
|
inlinevirtual |
Retrieve a QueryProfile containing all available model information, at the latitude and longitude of the specified Location.
Retrieve a QueryProfile containing all available model information, at the latitude and longitude of the specified Location.
location | the Location of the QueryProfile |
|
inlinevirtual |
Retrieve a CrustalProfile containing data appropriate for the specified phase at the specified location.
Retrieve a CrustalProfile at the specified location. For phases Pn and Sn the profile will include all intervals down to and including the mantle. For Pg and Lg, the profile will include intervals down to and including the middle crust. For Pn and Pg, the velocities stored in the profile will be P wave velocities and for Sn and Lg the velocities will be S wave velocities. No gradient information is stored in CrustalProfile objects.
phase | the phase for which the CrustalProfile is appropriate. Must be one of Pn, Sn, Pg, Lg which are int constants defined in SLBMGlobals.h |
lat | the geographic latitude in radians. |
lon | the geographic longitude in radians. |
depth | the depth of the source or receiver, in km. |
|
inlinevirtual |
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
inline |
Retrieve an nPhases by nAttributes array of UncertaintyPIU objects. The 4 phases are 0:Pn, 1:Sn, 2:Pg, 3:Lg. The 3 attributes are 0:TT, 1:SH, 2:AZ.
|
inline |
Retrieve an nPhases array of UncertaintyPDU objects. The 4 phases are 0:Pn, 1:Sn, 2:Pg, 3:Lg.
|
inline |
|
inline |
|
inline |
Retrieve the uncertainty for specified phase and attribute
phase | one of 0:Pn, 1:Sn, 2:Pg, 3:Lg. |
attribute | one of 0:TT, 1:SH, 2:AZ. |
void slbm::Grid::initializeActiveNodes | ( | double | activeNodeLatMin, |
double | activeNodeLonMin, | ||
double | activeNodeLatMax, | ||
double | activeNodeLonMax | ||
) |
Specify the latitude, longitude range in radians that will define which grid nodes are also active nodes.
Specify the latitude, longitude range in radians that will define which grid nodes are also active nodes. Active nodes are defined as follows: Each triangle in the tessellation is visited. If any one of the three nodes which define the triangle is located within the specified latitude, longitude range, then all three of the nodes are active nodes.
void slbm::Grid::initializeActiveNodes | ( | GeoTessPolygon * | polygon | ) |
Specify the Polygon that will define which grid nodes are also active nodes.
Specify the Polygon that will define which grid nodes are also active nodes. Active nodes are defined as follows: Visit every node in the grid. If it is inside the polygon, then set it to be an active node and set all of its immediate neighbors active as well.
|
virtual |
|
virtual |
Load the depth, velocity and gradient information from DataBuffer.
Load the Earth model information from DataBuffer
buffer | the DataBuffer from which to load the model |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Load the depth, velocity and gradient information from binary files in specified directory.
Load the Earth model information from binary files in specified directory
dirName | the name of directory from which to load the model |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Load the depth, velocity and gradient information from an ascii flat file.
Load the Earth model information from an ascii flat file.
filename | the name of the ascii flat file containing the data. |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
inlinevirtual |
|
virtual |
Equality operator.
Equality operator.
|
protected |
|
virtual |
Save the Earth model currently in memory, to an ascii flat file.
Save the Earth model currently in memory, to an ascii flat file. An exception will be thrown if the speficied filename is the same as the name of the file from which the Earth model was originally loaded with loadVelocityModel()
Reimplemented in slbm::GridGeoTess, and slbm::GridSLBM.
|
virtual |
Save the Earth model currently in memory, to a DataBuffer.
Save the Earth model currently in memory, to to a DataBuffer.
buffer | the DataBuffer to which to save the model |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Retrieve the average P or S wave velocity of the mantle, in km/sec.
Retrieve the average P or S wave velocity of the mantle. These values are retrieved from the header information in the velocity model file.
waveType | either SLBMGlobals::PWAVE or SLBMGlobals::SWAVE. |
velocity | (output) the average P or S wave mantle velocity, in km/sec. |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
void slbm::Grid::specifyOutputDirectory | ( | const string & | outputDir | ) |
|
virtual |
Reimplemented in slbm::GridSLBM, and slbm::GridGeoTess.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
The GridProfile objects which constitute the nodes in a Grid object.
The GridProfile objects which constitute the nodes in a Grid object.
|
protected |
|
protected |