RSTT  3.2.0
Regional Seismic Travel Time
All Classes Namespaces Files Functions Variables Typedefs Friends Macros
CrustalProfile.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 CrustalProfile_H
39 #define CrustalProfile_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 "InterpolatedProfile.h"
52 #include "Location.h"
53 #include "GreatCircle.h"
54 #include "TauPSite.h"
55 //#include "Grid.h"
56 
57 // **** _BEGIN SLBM NAMESPACE_ **************************************************
58 
59 namespace slbm {
60 
61 class GridProfile;
62 
101 {
102 
103 public:
104 
109 
114 
115  virtual ~CrustalProfile();
116 
121 
125  bool operator==(const CrustalProfile& other);
126 
130  bool operator!=(const CrustalProfile& other) {return ! (*this == other);};
131 
143  void setup(Grid& grid, const int& phase,
144  const double& lat, const double& lon, const double& depth);
145 
152  const Location& getLocation() const { return location; };
153 
154  double getEarthRadius() { return location.getEarthRadius(); };
155 
159  int getNIntervals() { return NLAYERS; };
160 
166  void getData(vector<double>& depths, vector<double>& velocities);
167 
171  double getInterfaceRadius(const int& k) { return radius[k]; };
172 
176  void getDepths(double* depths);
177 
181  double* getVelocities() { return velocity; };
182 
186  double getDepth(const int& k);
187 
191  double getVelocity(const int& k) { return velocity[k]; };
192 
205  double getPCrit(GreatCircle* greatCircle);
206 
233  void xtCrust(
234  GreatCircle* greatCircle,
235  const double& rayParameter,
236  double &xTotal,
237  double &zTotal,
238  double &sTotal,
239  double &tTotal);
240 
280  void xtCrust(
281  GreatCircle* greatCircle,
282  const double& rayParameter,
283  int layid[],
284  double x[],
285  double r[],
286  double v[],
287  double t[],
288  int& npoints);
289 
290  const int* getLayid() { return layid; };
291 
292  int getNLayid() { return nlay; };
293 
294  int getTopLayid() { return topLayid; };
295 
304  string toString(GreatCircle* greatCircle, double rayParameter);
305  string toString();
306 
307  size_t memSize();
308 
311 
314 
315  static int getClassCount();
316 
320  bool isInCrust() { return inCrust; };
321 
322 private:
323 
324  static int crustalProfileClassCount;
325 
332  Location location;
333 
337  bool inCrust;
338 
343  int phase;
344 
348  double radius[NLAYERS];
349 
353  double velocity[NLAYERS];
354 
358  int layid[NLAYERS];
359 
363  int nlay;
364 
370  int topLayid;
371 
377  int nMiddleCrust;
378 
388  double fudgeFactor;
389 
396  taup::TauPSite* cpTPS;
397 };
398 
399 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
400 //
401 // INLINE FUNCTIONS
402 //
403 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
404 
405 inline void CrustalProfile::getData(vector<double>& depths,
406  vector<double>& velocities)
407 {
408  depths.clear();
409  velocities.clear();
410  double R = getEarthRadius();
411  for (int i=0; i<getNIntervals(); i++)
412  {
413  depths.push_back(R - radius[i]);
414  velocities.push_back(velocity[i]);
415  }
416 }
417 
418 inline double CrustalProfile::getDepth(const int& k)
419 {
420  return getEarthRadius() - radius[k];
421 }
422 
423 inline void CrustalProfile::getDepths(double* depths)
424 {
425  double R = getEarthRadius();
426  for (int i=0; i<getNIntervals(); i++)
427  depths[i] = R - radius[i];
428 }
429 
430 inline double CrustalProfile::getPCrit(GreatCircle* greatCircle)
431 {
432  return radius[greatCircle->getHeadWaveInterface()]
433  / velocity[greatCircle->getHeadWaveInterface()];
434 }
435 
436 } // end slbm namespace
437 
438 #endif // CrustalProfile.h
#define SLBM_EXP_IMP
Definition: SLBMGlobals.h:180
A profile through the Earth model that stores interface radius, and interval P or S wave velocity inf...
int getNIntervals()
Retrieve the number of intervals associated with this Profile.
const int * getLayid()
CrustalProfile()
Default constructor.
double * getVelocities()
Retrieve the P or S wave velocity of each interval, in km/sec.
const Location & getLocation() const
Retrieve a const reference to the Location associated with this Profile.
double getInterfaceRadius(const int &k)
Retrieve the radius of the top of the k'th interval, in km.
taup::TauPSite * getTauPSite()
Return this CrustalProfiles TauPSite object;.
void xtCrust(GreatCircle *greatCircle, const double &rayParameter, double &xTotal, double &zTotal, double &sTotal, double &tTotal)
Compute the horizontal offset (radians) and the travel time (sec) of the ray through the crust.
void xtCrust(GreatCircle *greatCircle, const double &rayParameter, int layid[], double x[], double r[], double v[], double t[], int &npoints)
Compute the horizontal offset (radians) and the travel time (sec) of the ray through the crust.
static int getClassCount()
virtual ~CrustalProfile()
bool operator!=(const CrustalProfile &other)
Inequality operator.
double getVelocity(const int &k)
Retrieve the P or S wave velocity of the k'th interval, in km/sec.
string toString(GreatCircle *greatCircle, double rayParameter)
Returns a formatted string containing detailed information about this Profile.
CrustalProfile & operator=(const CrustalProfile &other)
Equal operator.
CrustalProfile(const CrustalProfile &CrustalProfile)
Copy constructor.
void setup(Grid &grid, const int &phase, const double &lat, const double &lon, const double &depth)
Parameterized constructor.
bool isInCrust()
true location radius > moho radius.
void setTauPSite(taup::TauPSite *tps)
Set the input TauPSite into this CrustalProfile;.
bool operator==(const CrustalProfile &other)
Equality operator.
The GreatCircle class manages information related to a great circle path between two Locations on the...
Definition: GreatCircle.h:114
const int & getHeadWaveInterface()
Retrieve the index of the head wave interface (SLBMGlobals::MANTLE for Pn, Sn; SLBMGlobals::MIDDLE_CR...
Definition: GreatCircle.h:185
A 2 dimensional, horizontal grid of GirdProfile objects.
Definition: Grid.h:91
Manages all information related to a single node in a Grid object.
Definition: GridProfile.h:71
A Profile object based on values interpolated from nearby GridProfile objects.
The Location Class manages a single point in/on the Earth, which is described by the GRS80 ellipsoid.
Definition: Location.h:78