RSTT: rstt/SLBM/include/GridProfileSLBM.h Source File

RSTT 3.1.0 Regional Seismic Travel Time

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
96 ~GridProfileSLBM();
97
98 static string class_name() { return "GridProfileSLBM"; };
99
107 int getGeoStackId() { return geoStack->getIndex(); };
108
118 void getData(double* depths, double* pvelocity, double* svelocity, double* gradient);
119
130 void setData(double* depths, double* pvelocities,
131 double* svelocities, double* gradients);
132
137 void setDepths(const vector<double>& depths);
138
144 void setVelocity(const int& waveType, const vector<double>& velocity);
145
150 void setGradient(const vector<double>& gradient);
151
155 double getInterfaceRadius(const int& k);
156
162 double getInterfaceDepth(const int& k);
163
170 double getVelocity(const int& waveType, const int& k)
171 { return geoStack->getVelocity(waveType, k); };
172
177 double getMantleGradient(const int& waveType)
178 { return geoStack->getMantleGradient(waveType); };
179
183 void getInterfaceDepths(vector<double>& depths);
184
190 void getVelocity(const int& waveType, double* velocity)
191 { geoStack->getVelocity(waveType, velocity); };
192
196 void getMantleGradient(double* g) { geoStack->getMantleGradient(g); };
197
198 double getWaterThick() { return waterThick; };
199
200 protected:
201
202 Grid& grid;
203
209 GeoStack* geoStack;
210
211 double waterThick;
212
213 };
214
215 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
216 //
217 // INLINE FUNCTIONS
218 //
219 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220
221 inline double GridProfileSLBM::getInterfaceRadius(const int& k)
222 {
223 // radius is the radius of the surface of the solid earth.
224 // geoStack->getDepth(k) returns the depth of top of layer k
225 // relative to surface of solid earth.
226 // The difference is the radius of the top of layer k.
227 // Layer 0 is the water layer and waterThick is the nominal
228 // thickness of the water layer. Since waterThick is only
229 // a nominal value, it is not guaranteed that top of water
230 // is at sea level.
231 if (k > 0)
232 return radius - geoStack->getDepth(k);
233 return radius + waterThick;
234 }
235
236 inline void GridProfileSLBM::getData(double* d,
237 double* pv, double* sv, double* g)
238 {
239 double r = getEarthRadius();
240 for (int k=0; k<NLAYERS; k++)
241 {
242 d[k] = r - getInterfaceRadius(k);
243 pv[k] = geoStack->getVelocity(PWAVE, k);
244 sv[k] = geoStack->getVelocity(SWAVE, k);
245 }
246 g[PWAVE] = geoStack->getMantleGradient(PWAVE);
247 g[SWAVE] = geoStack->getMantleGradient(SWAVE);
248 }
249
250 inline double GridProfileSLBM::getInterfaceDepth(const int& k)
251 {
252 // getEarthRadius is the radius of sea level.
253 return getEarthRadius() - getInterfaceRadius(k);
254 }
255
256 inline void GridProfileSLBM::getInterfaceDepths(vector<double>& depths)
257 {
258 depths.resize(NLAYERS);
259 double r = getEarthRadius();
260 for (int k=0; k<NLAYERS; k++)
261 depths[k] = r - getInterfaceRadius(k);
262 }
263
264 } // end slbm namespace
265
266 #endif // GRIDPROFILESLBM_H_.h
slbm::GeoStack
Manages all information related to a single node in a Grid object.
Definition: GeoStack.h:65
slbm::GridProfileSLBM::geoStack
GeoStack * geoStack
The GeoStack object that holds all the interface depths, velocities and gradients.
Definition: GridProfileSLBM.h:209
slbm::GridProfileSLBM::class_name
static string class_name()
Definition: GridProfileSLBM.h:98
slbm::GridProfileSLBM::getMantleGradient
double getMantleGradient(const int &waveType)
Retrieve the P or S velocity gradient in the mantle, in 1/sec.
Definition: GridProfileSLBM.h:177
slbm::GridProfileSLBM::GridProfileSLBM
GridProfileSLBM(const GridProfileSLBM &other)
Copy constructor.
GeoStack.h
slbm::GridProfileSLBM::getGeoStackId
int getGeoStackId()
Retrieve the index of the GeoStack that holds the information about model interfaces,...
Definition: GridProfileSLBM.h:107
slbm::GridProfileSLBM::waterThick
double waterThick
Definition: GridProfileSLBM.h:211
slbm::GridProfileSLBM::getMantleGradient
void getMantleGradient(double *g)
Retrieve the P and S velocity gradients in the mantle, in 1/sec.
Definition: GridProfileSLBM.h:196
SLBMGlobals.h
slbm::GridProfile
Manages all information related to a single node in a Grid object.
Definition: GridProfile.h:71
slbm::Grid
A 2 dimensional, horizontal grid of GirdProfile objects.
Definition: Grid.h:90
slbm::GridProfileSLBM::setVelocity
void setVelocity(const int &waveType, const vector< double > &velocity)
Set the P or S velocity to specified values.
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:170
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_EXP_IMP
#define SLBM_EXP_IMP
Definition: SLBMGlobals.h:180
slbm::GridProfileSLBM::setDepths
void setDepths(const vector< double > &depths)
Set the layer depths to specified values.
slbm::GridProfileSLBM::grid
Grid & grid
Definition: GridProfileSLBM.h:198
Location.h
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:190
slbm::GridProfileSLBM
Manages all information related to a single node in a Grid object.
Definition: GridProfileSLBM.h:71
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::getWaterThick
double getWaterThick()
Definition: GridProfileSLBM.h:198
slbm::GridProfileSLBM::~GridProfileSLBM
~GridProfileSLBM()
Destructor.
slbm::GridProfileSLBM::setGradient
void setGradient(const vector< double > &gradient)
Set the P and S velocity gradients to specified values.
slbm
Definition: CrustalProfile.h:59