RSTT 3.2.1 Regional Seismic Travel Time

Loading...
Searching...
No Matches
GeoStack.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 GeoStack_H
39#define GeoStack_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
52// **** _BEGIN SLBM NAMESPACE_ **************************************************
53
54 namespace slbm {
55
56 class SLBM_EXP_IMP GeoStack
65{
66
67 public:
68
72 GeoStack();
73
74 GeoStack(const int& index, double* depths, double* pvelocities,
75 double* svelocities, double* gradients);
76
80 ~GeoStack();
81
85 GeoStack(const GeoStack& GeoStack);
86
90 GeoStack& operator=(const GeoStack& other);
91
95 bool operator==(const GeoStack& other);
96
100 bool operator!=(const GeoStack& other) {return ! (*this == other);};
101
102 int getRefCount() { return refCount; };
103
104 void incRefCount() { ++refCount; };
105
106 void decRefCount() { --refCount; };
107
108 void setRefCount(const int& count) { refCount = count; };
109
110 int getIndex() { return index; };
111
112 void setIndex(const int& idx) { index = idx; };
113
123 void getData(double* depths,
124 double* pvelocity, double* svelocity, double* gradient);
125
136 void setData(double* depths, double* pvelocities, double* svelocities, double* gradients);
137
142 void setDepth(const vector<double>& z);
143
149 void setVelocity(const int& waveType, const vector<double>& velocity);
150
155 void setGradient(const vector<double>& gradient);
156
160 double getDepth(const int& k) { return depth[k]; };
161
162 double* getDepth() { return depth; };
163
170 double getVelocity(const int& waveType, const int& k);
171
176 double getMantleGradient(const int& waveType);
177
183 void getVelocity(const int& waveType, double* velocity);
184
188 void getMantleGradient(double* g) { g[0] = gradient[0]; g[1] = gradient[1]; };
189
199 bool hasLowVelocityZone();
200
206 string toString();
207
208 static int getClassCount();
209
210 bool thicknessTest();
211
212 protected:
213
214 static int geoStackClassCount;
215
216 int index;
217
218 int refCount;
219
225 double depth[NLAYERS];
226
232 double pvelocity[NLAYERS];
233 double svelocity[NLAYERS];
234
238 double gradient[2];
239
240};
241
242//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243//
244// INLINE FUNCTIONS
245//
246//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
247
248 inline void GeoStack::getData(double* d, double* pv, double* sv, double* g)
249{
250 for (int i=0; i<NLAYERS; i++)
251 {
252 d[i] = depth[i];
253 pv[i] = pvelocity[i];
254 sv[i] = svelocity[i];
255 }
256 g[PWAVE] = gradient[PWAVE];
257 g[SWAVE] = gradient[SWAVE];
258}
259
260 inline void GeoStack::setData(double* depths, double* pvelocities,
261 double* svelocities, double* gradients)
262{
263 for (int i=0; i<NLAYERS; i++)
264 {
265 depth[i] = depths[i];
266 pvelocity[i] = pvelocities[i];
267 svelocity[i] = svelocities[i];
268 }
269 gradient[PWAVE] = gradients[PWAVE];
270 gradient[SWAVE] = gradients[SWAVE];
271
272 thicknessTest();
273}
274
275 inline double GeoStack::getVelocity(const int& waveType, const int& k)
276{
277 if (waveType == PWAVE)
278 return pvelocity[k];
279 return svelocity[k];
280}
281
282 inline double GeoStack::getMantleGradient(const int& waveType)
283{
284 return gradient[waveType];
285}
286
287 inline void GeoStack::getVelocity(const int& waveType, double* v)
288{
289 if (waveType == PWAVE)
290 for (int k=0; k<NLAYERS; ++k)
291 v[k] = pvelocity[k];
292 else
293 for (int k=0; k<NLAYERS; ++k)
294 v[k] = svelocity[k];
295}
296
297 inline void GeoStack::setDepth(const vector<double>& z)
298{
299 for (int i=0; i<NLAYERS; i++)
300 depth[i] = z[i];
301
302 thicknessTest();
303}
304
305 inline void GeoStack::setVelocity(const int& waveType, const vector<double>& v)
306{
307 if (waveType == PWAVE)
308 for (int i=0; i<NLAYERS; i++)
309 pvelocity[i] = v[i];
310 else if (waveType == SWAVE)
311 for (int i=0; i<NLAYERS; i++)
312 svelocity[i] = v[i];
313}
314
315 inline void GeoStack::setGradient(const vector<double>& g)
316{
317 gradient[PWAVE] = g[PWAVE];
318 gradient[SWAVE] = g[SWAVE];
319}
320
321} // end slbm namespace
322
323#endif // GeoStack.h
SLBMGlobals.h
SLBM_EXP_IMP
#define SLBM_EXP_IMP
Definition SLBMGlobals.h:180
slbm::GeoStack::depth
double depth[NLAYERS]
depth of the top of each interval, in km.
Definition GeoStack.h:225
slbm::GeoStack::getDepth
double getDepth(const int &k)
Retrieve the depth of the k'th interval, in km.
Definition GeoStack.h:160
slbm::GeoStack::getMantleGradient
double getMantleGradient(const int &waveType)
Retrieve the P or S velocity gradient in the mantle, in 1/sec.
Definition GeoStack.h:282
slbm::GeoStack::~GeoStack
~GeoStack()
Destructor.
slbm::GeoStack::GeoStack
GeoStack(const GeoStack &GeoStack)
Copy constructor.
slbm::GeoStack::getVelocity
double getVelocity(const int &waveType, const int &k)
Retrieve the P or S velocity of the k'th interval, in km/sec.
Definition GeoStack.h:275
slbm::GeoStack::decRefCount
void decRefCount()
Definition GeoStack.h:106
slbm::GeoStack::setRefCount
void setRefCount(const int &count)
Definition GeoStack.h:108
slbm::GeoStack::hasLowVelocityZone
bool hasLowVelocityZone()
Return true if (1) any finite thickness layer above the middle crust has a velocity that exceeds the ...
slbm::GeoStack::geoStackClassCount
static int geoStackClassCount
Definition GeoStack.h:214
slbm::GeoStack::incRefCount
void incRefCount()
Definition GeoStack.h:104
slbm::GeoStack::setGradient
void setGradient(const vector< double > &gradient)
Set the P and S velocity gradients to specified values.
Definition GeoStack.h:315
slbm::GeoStack::setIndex
void setIndex(const int &idx)
Definition GeoStack.h:112
slbm::GeoStack::svelocity
double svelocity[NLAYERS]
Definition GeoStack.h:233
slbm::GeoStack::thicknessTest
bool thicknessTest()
slbm::GeoStack::refCount
int refCount
Definition GeoStack.h:218
slbm::GeoStack::operator==
bool operator==(const GeoStack &other)
Equality operator.
slbm::GeoStack::getMantleGradient
void getMantleGradient(double *g)
Retrieve the P and S velocity gradients in the mantle, in 1/sec.
Definition GeoStack.h:188
slbm::GeoStack::GeoStack
GeoStack(const int &index, double *depths, double *pvelocities, double *svelocities, double *gradients)
slbm::GeoStack::setVelocity
void setVelocity(const int &waveType, const vector< double > &velocity)
Set the P or S velocity to specified values.
Definition GeoStack.h:305
slbm::GeoStack::index
int index
Definition GeoStack.h:216
slbm::GeoStack::getDepth
double * getDepth()
Definition GeoStack.h:162
slbm::GeoStack::operator!=
bool operator!=(const GeoStack &other)
Inequality operator.
Definition GeoStack.h:100
slbm::GeoStack::getClassCount
static int getClassCount()
slbm::GeoStack::setData
void setData(double *depths, double *pvelocities, double *svelocities, double *gradients)
Set the P and S velocities and gradients associated with this GeoStack object to specified values.
Definition GeoStack.h:260
slbm::GeoStack::getData
void getData(double *depths, double *pvelocity, double *svelocity, double *gradient)
Retrieve all the data associated with this Profile.
Definition GeoStack.h:248
slbm::GeoStack::getIndex
int getIndex()
Definition GeoStack.h:110
slbm::GeoStack::GeoStack
GeoStack()
Default constructor.
slbm::GeoStack::getRefCount
int getRefCount()
Definition GeoStack.h:102
slbm::GeoStack::operator=
GeoStack & operator=(const GeoStack &other)
Equal operator.
slbm::GeoStack::toString
string toString()
Return the information content of this GeoStack formatted in small text table.
slbm::GeoStack::setDepth
void setDepth(const vector< double > &z)
Set the layer depths to specified values.
Definition GeoStack.h:297
slbm::GeoStack::pvelocity
double pvelocity[NLAYERS]
The P and S velocity of each layer, in km/sec.
Definition GeoStack.h:232
slbm::GeoStack::gradient
double gradient[2]
P and S velocity gradients in the mantle, in 1/sec.
Definition GeoStack.h:238
slbm
Definition CrustalProfile.h:59