RSTT  3.2.0
Regional Seismic Travel Time
All Classes Namespaces Files Functions Variables Typedefs Friends Macros
GridProfileGeoTess.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 GRIDPROFILEGEOTESS_H_
39 #define GRIDPROFILEGEOTESS_H_
40 
41 // **** _SYSTEM INCLUDES_ ******************************************************
42 
43 #include <vector>
44 #include <set>
45 #include <map>
46 
47 using namespace std;
48 
49 // **** _LOCAL INCLUDES_ *******************************************************
50 
51 #include "CPPGlobals.h"
52 #include "GeoTessProfile.h"
53 
54 using namespace geotess;
55 
56 #include "SLBMGlobals.h"
57 #include "Location.h"
58 #include "GeoStack.h"
59 
60 // **** _BEGIN SLBM NAMESPACE_ **************************************************
61 
62 namespace slbm {
63 
64 class InterpolatedProfile;
65 class Grid;
66 
77 {
78 
79 // let Grid objects access protected members of GridProfileGeoTess.
80 friend class Grid;
81 
82 public:
83 
89  GridProfileGeoTess(Grid& g, const int& nodeId, Location& location);
90 
95 
100 
101  static string class_name() { return "GridProfileGeoTess"; };
102 
110  int getGeoStackId() { return -1; };
111 
121  void getData(double* depths, double* pvelocity, double* svelocity, double* gradient);
122 
133  void setData(double depths[NLAYERS], double pvelocities[NLAYERS],
134  double svelocities[NLAYERS], double gradients[2]);
135 
140  void setDepths(const vector<double>& depths);
141 
147  void setVelocity(const int& waveType, const vector<double>& velocity);
148 
153  void setGradient(const vector<double>& gradient);
154 
158  double getInterfaceRadius(const int& k)
159  { return gtProfiles[NLAYERS-k]->getRadiusTop(); }
160 
166  double getInterfaceDepth(const int& k)
167  { return earthRadius - gtProfiles[NLAYERS-k]->getRadiusTop(); }
168 
175  double getVelocity(const int& waveType, const int& k)
176  { return gtProfiles[NLAYERS-k]->getValueTop(waveType); };
177 
182  double getMantleGradient(const int& waveType)
183  { return gtProfiles[0]->getValueTop(waveType); };
184 
188  void getInterfaceDepths(vector<double>& depths);
189 
197  void getVelocity(const int& waveType, double* velocities)
198  { for (int k=0; k<NLAYERS; k++) velocities[k] = gtProfiles[NLAYERS-k]->getValueTop(waveType); }
199 
205  void getMantleGradient(double* g)
206  { g[PWAVE] = gtProfiles[0]->getValueTop(PWAVE); g[SWAVE] = gtProfiles[0]->getValueTop(SWAVE); }
207 
208  double getWaterThick()
209  { return gtProfiles[NLAYERS]->getRadiusTop()-gtProfiles[NLAYERS-1]->getRadiusTop(); }
210 
211 protected:
212 
214 
215  // A 1D array of GeoTess Profile objects with NLAYERS elements.
216  // Each Profile spans one of the layers of the model.
217  GeoTessProfile** gtProfiles;
218 
220 
221 };
222 
223 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224 //
225 // INLINE FUNCTIONS
226 //
227 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228 
229 inline void GridProfileGeoTess::getData(double* d,
230  double* pv, double* sv, double* g)
231 {
232  for (int k=0; k<NLAYERS; k++)
233  {
234  d[k] = getEarthRadius()-gtProfiles[NLAYERS-k]->getRadiusTop();
235  pv[k] = gtProfiles[NLAYERS-k]->getValueTop(PWAVE);
236  sv[k] = gtProfiles[NLAYERS-k]->getValueTop(SWAVE);
237  }
238  g[PWAVE] = gtProfiles[0]->getValueTop(PWAVE);
239  g[SWAVE] = gtProfiles[0]->getValueTop(SWAVE);
240 }
241 
242 inline void GridProfileGeoTess::getInterfaceDepths(vector<double>& depths)
243 {
244  depths.resize(NLAYERS);
245  for (int k=0; k<NLAYERS; k++)
246  depths[k] = earthRadius - gtProfiles[NLAYERS-k]->getRadiusTop();
247 }
248 
249 } // end slbm namespace
250 
251 #endif // GRIDPROFILEGEOTESS_H_.h
#define SLBM_EXP_IMP
Definition: SLBMGlobals.h:180
A 2 dimensional, horizontal grid of GirdProfile objects.
Definition: Grid.h:91
Manages all information related to a single node in a Grid object.
void setDepths(const vector< double > &depths)
Set the layer depths to specified values.
void setGradient(const vector< double > &gradient)
Set the P and S velocity gradients to specified values.
int getGeoStackId()
Retrieve the index of the GeoStack that holds the information about model interfaces,...
double getVelocity(const int &waveType, const int &k)
Retrieve the P or S velocity of the k'th interval, in km/sec.
~GridProfileGeoTess()
Destructor.
double getInterfaceDepth(const int &k)
Retrieve the depth of the k'th interval, in km relative sea level.
GridProfileGeoTess(Grid &g, const int &nodeId, Location &location)
Parameterized constructor.
void setVelocity(const int &waveType, const vector< double > &velocity)
Set the P or S velocity to specified values.
GeoTessProfile ** gtProfiles
double getMantleGradient(const int &waveType)
Retrieve the P or S velocity gradient in the mantle, in 1/sec.
double getInterfaceRadius(const int &k)
Retrieve the radius of the k'th interval, in km.
void getMantleGradient(double *g)
Retrieve the P and S velocity gradients in the mantle, in 1/sec.
GridProfileGeoTess(const GridProfileGeoTess &other)
Copy constructor.
void setData(double depths[NLAYERS], double pvelocities[NLAYERS], double svelocities[NLAYERS], double gradients[2])
Set the P and S velocities and gradients associated with this GridProfileGeoTess object to specified ...
void getVelocity(const int &waveType, double *velocities)
Retrieve the P or S velocities of all intervals, in km/sec.
Manages all information related to a single node in a Grid object.
Definition: GridProfile.h:71
The Location Class manages a single point in/on the Earth, which is described by the GRS80 ellipsoid.
Definition: Location.h:78