RSTT  3.2.0
Regional Seismic Travel Time
All Classes Namespaces Files Functions Variables Typedefs Friends Macros
QueryProfile.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 QueryProfile_H
39 #define QueryProfile_H
40 
41 // **** _SYSTEM INCLUDES_ ******************************************************
42 
43 #include <vector>
44 
45 using namespace std;
46 
47 // **** _LOCAL INCLUDES_ *******************************************************
48 
49 #include "SLBMGlobals.h"
50 #include "InterpolatedProfile.h"
51 
52 // **** _BEGIN SLBM NAMESPACE_ **************************************************
53 
54 namespace slbm {
55 
56 class Grid;
57 class GridProfile;
58 
68 {
69 
70 public:
71 
79  QueryProfile(Grid& grid, Location& location);
80 
85 
87 
92 
96  bool operator==(const QueryProfile& other);
97 
101  bool operator!=(const QueryProfile& other) {return ! (*this == other);};
102 
106  int nIntervals() { return NLAYERS; };
107 
113  void getData(
114  int* nodeIds,
115  double* coefficients,
116  int& nNeighbors,
117  double* depths,
118  double* pvelocities,
119  double* svelocities,
120  double& pgradient,
121  double& sgradient
122  );
123 
124  vector<int>& getNodeIds() { return nodeIds; };
125 
129  double* getDepth() { return depth; };
130 
134  double* getVelocity(const int& waveType)
135  { return (waveType==PWAVE ? pvelocity : svelocity); };
136 
140  double* getMantleGradient() { return gradient; };
141 
145  string toString();
146 
147  static int getClassCount();
148 
149 private:
150 
151  static int queryProfileClassCount;
152 
153  Location location;
154 
155  vector<int> nodeIds;
156 
160  double depth[NLAYERS];
161 
165  double pvelocity[NLAYERS];
166 
170  double svelocity[NLAYERS];
171 
175  double gradient[2];
176 
177 };
178 
179 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180 //
181 // INLINE FUNCTIONS
182 //
183 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 
185 inline void QueryProfile::getData(
186  int* nodeids,
187  double* coeff,
188  int& n,
189  double* d,
190  double* pv,
191  double* sv,
192  double& pg,
193  double& sg
194  )
195 {
196  getWeights(nodeids, coeff, n);
197 
198  for (int i=0; i<NLAYERS; i++)
199  {
200  d[i] = depth[i];
201  pv[i] = pvelocity[i];
202  sv[i] = svelocity[i];
203  }
204 
205  pg = gradient[PWAVE];
206  sg = gradient[SWAVE];
207 }
208 
209 } // end slbm namespace
210 
211 #endif // QueryProfile.h
#define SLBM_EXP_IMP
Definition: SLBMGlobals.h:180
A 2 dimensional, horizontal grid of GirdProfile objects.
Definition: Grid.h:91
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
An InterpolatedProfile object that also has information about the the P and S wave velocity as a func...
Definition: QueryProfile.h:68
vector< int > & getNodeIds()
Definition: QueryProfile.h:124
bool operator!=(const QueryProfile &other)
Inequality operator.
Definition: QueryProfile.h:101
double * getMantleGradient()
Retrieve the P or S wave velocity gradient, in 1/sec.
Definition: QueryProfile.h:140
QueryProfile(const QueryProfile &QueryProfile)
Copy constructor.
static int getClassCount()
QueryProfile(Grid &grid, Location &location)
Parameterized constructor.
string toString()
Returns a formatted string containing detailed information about this Profile.
int nIntervals()
Retrieve the number of intervals associated with this Profile.
Definition: QueryProfile.h:106
bool operator==(const QueryProfile &other)
Equality operator.
double * getVelocity(const int &waveType)
Retrieve the P or S wave velocity of the k'th interval, in km/sec.
Definition: QueryProfile.h:134
QueryProfile & operator=(const QueryProfile &other)
Equal operator.
double * getDepth()
Retrieve the depth of the top of the k'th interval, in km.
Definition: QueryProfile.h:129