RSTT 3.2.1 Regional Seismic Travel Time

Loading...
Searching...
No Matches
GridProfileSLBM.h
Go to the documentation of this file.
1//- ****************************************************************************
2//-
3//- Copyright 2009 National Technology & Engineering Solutions of Sandia, LLC
4//- (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
5//- Government retains certain rights in this software.
6//-
7//- BSD Open Source License
8//- All rights reserved.
9//-
10//- Redistribution and use in source and binary forms, with or without
11//- modification, are permitted provided that the following conditions are met:
12//-
13//- 1. Redistributions of source code must retain the above copyright notice,
14//- this list of conditions and the following disclaimer.
15//-
16//- 2. Redistributions in binary form must reproduce the above copyright
17//- notice, this list of conditions and the following disclaimer in the
18//- documentation and/or other materials provided with the distribution.
19//-
20//- 3. Neither the name of the copyright holder nor the names of its
21//- contributors may be used to endorse or promote products derived from
22//- this software without specific prior written permission.
23//-
24//- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25//- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26//- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27//- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28//- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29//- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30//- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31//- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32//- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33//- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34//- POSSIBILITY OF SUCH DAMAGE.
35//-
36//- ****************************************************************************
37
38#ifndef GRIDPROFILESLBM_H_
39#define GRIDPROFILESLBM_H_
40
41// **** _SYSTEM INCLUDES_ ******************************************************
42
43#include <vector>
44#include <set>
45
46 using namespace std;
47
48// **** _LOCAL INCLUDES_ *******************************************************
49
50#include "SLBMGlobals.h"
51#include "Location.h"
52#include "GeoStack.h"
53
54// **** _BEGIN SLBM NAMESPACE_ **************************************************
55
56 namespace slbm {
57
58 class InterpolatedProfile;
59 class Grid;
60
61 class SLBM_EXP_IMP GridProfileSLBM : public GridProfile
71{
72
73// let Grid objects access protected members of GridProfileSLBM.
74 friend class Grid;
75
76 public:
77
83 GridProfileSLBM(Grid& g,
84 const int& i, const double& lat,
85 const double& lon, const double& elev,
86 const double& zwater, GeoStack* gstack);
87
91 // GridProfileSLBM(const GridProfileSLBM &other);
92 // GridProfile *clone() { return new GridProfileSLBM(*this); }
93
97 ~GridProfileSLBM();
98
99 static string class_name() { return "GridProfileSLBM"; };
100
108 int getGeoStackId() { return geoStack->getIndex(); };
109
119 void getData(double* depths, double* pvelocity, double* svelocity, double* gradient);
120
131 void setData(double* depths, double* pvelocities,
132 double* svelocities, double* gradients);
133
138 void setDepths(const vector<double>& depths);
139
145 void setVelocity(const int& waveType, const vector<double>& velocity);
146
151 void setGradient(const vector<double>& gradient);
152
156 double getInterfaceRadius(const int& k);
157
163 double getInterfaceDepth(const int& k);
164
171 double getVelocity(const int& waveType, const int& k)
172 { return geoStack->getVelocity(waveType, k); };
173
178 double getMantleGradient(const int& waveType)
179 { return geoStack->getMantleGradient(waveType); };
180
184 void getInterfaceDepths(vector<double>& depths);
185
191 void getVelocity(const int& waveType, double* velocity)
192 { geoStack->getVelocity(waveType, velocity); };
193
197 void getMantleGradient(double* g) { geoStack->getMantleGradient(g); };
198
199 double getWaterThick() { return waterThick; };
200
201 protected:
202
203 Grid& grid;
204
210 GeoStack* geoStack;
211
212 double waterThick;
213
214};
215
216//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217//
218// INLINE FUNCTIONS
219//
220//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
221
222 inline double GridProfileSLBM::getInterfaceRadius(const int& k)
223{
224 // radius is the radius of the surface of the solid earth.
225 // geoStack->getDepth(k) returns the depth of top of layer k
226 // relative to surface of solid earth.
227 // The difference is the radius of the top of layer k.
228 // Layer 0 is the water layer and waterThick is the nominal
229 // thickness of the water layer. Since waterThick is only
230 // a nominal value, it is not guaranteed that top of water
231 // is at sea level.
232 if (k > 0)
233 return radius - geoStack->getDepth(k);
234 return radius + waterThick;
235}
236
237 inline void GridProfileSLBM::getData(double* d,
238 double* pv, double* sv, double* g)
239{
240 double r = getEarthRadius();
241 for (int k=0; k<NLAYERS; k++)
242 {
243 d[k] = r - getInterfaceRadius(k);
244 pv[k] = geoStack->getVelocity(PWAVE, k);
245 sv[k] = geoStack->getVelocity(SWAVE, k);
246 }
247 g[PWAVE] = geoStack->getMantleGradient(PWAVE);
248 g[SWAVE] = geoStack->getMantleGradient(SWAVE);
249}
250
251 inline double GridProfileSLBM::getInterfaceDepth(const int& k)
252{
253 // getEarthRadius is the radius of sea level.
254 return getEarthRadius() - getInterfaceRadius(k);
255}
256
257 inline void GridProfileSLBM::getInterfaceDepths(vector<double>& depths)
258{
259 depths.resize(NLAYERS);
260 double r = getEarthRadius();
261 for (int k=0; k<NLAYERS; k++)
262 depths[k] = r - getInterfaceRadius(k);
263}
264
265} // end slbm namespace
266
267#endif // GRIDPROFILESLBM_H_.h
GeoStack.h
Location.h
SLBMGlobals.h
SLBM_EXP_IMP
#define SLBM_EXP_IMP
Definition SLBMGlobals.h:180
slbm::GeoStack
Manages all information related to a single node in a Grid object.
Definition GeoStack.h:65
slbm::Grid
A 2 dimensional, horizontal grid of GirdProfile objects.
Definition Grid.h:91
slbm::GridProfile::getEarthRadius
virtual double getEarthRadius()
Definition GridProfile.h:110
slbm::GridProfile::GridProfile
GridProfile()
Definition GridProfile.h:75
slbm::GridProfileSLBM::getInterfaceDepth
double getInterfaceDepth(const int &k)
Retrieve the depth of the k'th interval, in km relative sea level.
Definition GridProfileSLBM.h:251
slbm::GridProfileSLBM::geoStack
GeoStack * geoStack
The GeoStack object that holds all the interface depths, velocities and gradients.
Definition GridProfileSLBM.h:210
slbm::GridProfileSLBM::~GridProfileSLBM
~GridProfileSLBM()
Copy constructor.
slbm::GridProfileSLBM::getInterfaceRadius
double getInterfaceRadius(const int &k)
Retrieve the radius of the k'th interval, in km.
Definition GridProfileSLBM.h:222
slbm::GridProfileSLBM::getVelocity
double getVelocity(const int &waveType, const int &k)
Retrieve the P or S velocity of the k'th interval, in km/sec.
Definition GridProfileSLBM.h:171
slbm::GridProfileSLBM::setDepths
void setDepths(const vector< double > &depths)
Set the layer depths to specified values.
slbm::GridProfileSLBM::getGeoStackId
int getGeoStackId()
Retrieve the index of the GeoStack that holds the information about model interfaces,...
Definition GridProfileSLBM.h:108
slbm::GridProfileSLBM::Grid
friend class Grid
Definition GridProfileSLBM.h:74
slbm::GridProfileSLBM::getData
void getData(double *depths, double *pvelocity, double *svelocity, double *gradient)
Retrieve all the data associated with this Profile.
Definition GridProfileSLBM.h:237
slbm::GridProfileSLBM::setVelocity
void setVelocity(const int &waveType, const vector< double > &velocity)
Set the P or S velocity to specified values.
slbm::GridProfileSLBM::getWaterThick
double getWaterThick()
Definition GridProfileSLBM.h:199
slbm::GridProfileSLBM::getInterfaceDepths
void getInterfaceDepths(vector< double > &depths)
Retrieve the depths of all intervals, in km.
Definition GridProfileSLBM.h:257
slbm::GridProfileSLBM::setData
void setData(double *depths, double *pvelocities, double *svelocities, double *gradients)
Set the P and S velocities and gradients associated with this GridProfileSLBM object to specified val...
slbm::GridProfileSLBM::class_name
static string class_name()
Definition GridProfileSLBM.h:99
slbm::GridProfileSLBM::setGradient
void setGradient(const vector< double > &gradient)
Set the P and S velocity gradients to specified values.
slbm::GridProfileSLBM::getMantleGradient
double getMantleGradient(const int &waveType)
Retrieve the P or S velocity gradient in the mantle, in 1/sec.
Definition GridProfileSLBM.h:178
slbm::GridProfileSLBM::GridProfileSLBM
GridProfileSLBM(Grid &g, const int &i, const double &lat, const double &lon, const double &elev, const double &zwater, GeoStack *gstack)
Parameterized constructor.
slbm::GridProfileSLBM::waterThick
double waterThick
Definition GridProfileSLBM.h:212
slbm::GridProfileSLBM::grid
Grid & grid
Definition GridProfileSLBM.h:203
slbm::GridProfileSLBM::getMantleGradient
void getMantleGradient(double *g)
Retrieve the P and S velocity gradients in the mantle, in 1/sec.
Definition GridProfileSLBM.h:197
slbm::GridProfileSLBM::getVelocity
void getVelocity(const int &waveType, double *velocity)
Retrieve the P or S velocities of all intervals, in km/sec.
Definition GridProfileSLBM.h:191
slbm::InterpolatedProfile
A Profile object based on values interpolated from nearby GridProfile objects.
Definition InterpolatedProfile.h:67
slbm::Location::radius
double radius
Definition Location.h:521
slbm
Definition CrustalProfile.h:59