RSTT  3.2.0
Regional Seismic Travel Time
All Classes Namespaces Files Functions Variables Typedefs Friends Macros
GreatCircle_Xn.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 GreatCircle_Xn_H
39 #define GreatCircle_Xn_H
40 
41 // **** _SYSTEM INCLUDES_ ******************************************************
42 
43 #include <vector>
44 #include <string>
45 #include <iostream>
46 
47 using namespace std;
48 
49 // **** _LOCAL INCLUDES_ *******************************************************
50 
51 #include "SLBMGlobals.h"
52 #include "GreatCircle.h"
53 #include "Grid.h"
54 #include "Location.h"
55 #include "CrustalProfile.h"
56 #include "LayerProfile.h"
57 
58 // **** _BEGIN SLBM NAMESPACE_ **************************************************
59 
60 namespace slbm {
61 
62 // **** _CLASS DEFINITION_ *****************************************************
63 //
80 {
81 
82 public:
83 
101  const int& _phase,
102  Grid& _grid,
103  const double& latSource,
104  const double& lonSource,
105  const double& depthSource,
106  const double& latReceiver,
107  const double& lonReceiver,
108  const double& depthReceiver,
109  const double& chMax);
110 
117 
122 
127 
128  void getZhaoParameters(double& Vm, double& Gm, double& H, double& C, double& Cm, int& udSign);
129 
148  string toString(const int& verbosity);
149 
150 private:
151 
155  double ch_max;
156 
162  double Vm;
163 
169  double Gm;
170 
176  double H;
177 
181  double rMoho;
182  double rZm;
183 
189  int udSign;
190 
191  double V0;
192 
198  void computeTravelTime();
199 
200  bool inCrust;
201 
202  void computeTravelTimeCrust();
203 
204  void computeTravelTimeMantle();
205 
206  double c, cm, zm, zhao_r, cz, cmz;
207 
208  const double cmin;
209 
210  double func(const double& h);
211 
212  void mnbrak(double &ax, double &bx, double &cx,
213  double &fa, double &fb, double &fc);
214 
215  double brent(const double ax, const double bx, const double cx,
216  const double tol, double &xmin);
217 
218  void SWAP(double &a, double &b) {double dum=a; a=b; b=dum;}
219 
220  double SIGN(const double &a, const double &b)
221  {return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);};
222 
223  void shft3(double &a, double &b, double &cc, const double d)
224  { a=b; b=cc; cc=d;};
225 
226 };
227 
228 inline void GreatCircle_Xn::getZhaoParameters(double& Vm_, double& Gm_, double& H_, double& C_, double& Cm_, int& udSign_)
229 {
230  Vm_ = Vm;
231  Gm_ = Gm;
232  H_ = H;
233  C_ = c;
234  Cm_ = cm;
235  udSign_ = udSign;
236 }
237 
238 } // end slbm namespace
239 
240 #endif // GreatCircle_Xn.h
#define SLBM_EXP_IMP
Definition: SLBMGlobals.h:180
The GreatCircle_Xn class manages information related to a great circle path between two Locations on ...
GreatCircle_Xn & operator=(const GreatCircle_Xn &other)
Equal operator.
string toString(const int &verbosity)
Retrieve a formatted string providing a detailed description of the information managed by this Great...
GreatCircle_Xn(const int &_phase, Grid &_grid, const double &latSource, const double &lonSource, const double &depthSource, const double &latReceiver, const double &lonReceiver, const double &depthReceiver, const double &chMax)
Parameterized constructor.
GreatCircle_Xn(const GreatCircle_Xn &other)
Copy constructor.
~GreatCircle_Xn()
Destructor. Deletes the source and receiver CrustalProfile objects and all LayerProfile objects creat...
The GreatCircle class manages information related to a great circle path between two Locations on the...
Definition: GreatCircle.h:114
A 2 dimensional, horizontal grid of GirdProfile objects.
Definition: Grid.h:91