RSTT 3.2.1 Regional Seismic Travel Time

Loading...
Searching...
No Matches
UncertaintyPDU.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 UncertaintyPDU_H
39#define UncertaintyPDU_H
40
41// **** _SYSTEM INCLUDES_ ******************************************************
42
43#include <string>
44#include <vector>
45#include <list>
46#include <map>
47
48#include "SLBMGlobals.h"
49#include "IFStreamAscii.h"
50#include "IFStreamBinary.h"
51#include "UncertaintyPIU.h"
52#include "CpuTimer.h"
53
54 using namespace std;
55
56// **** _BEGIN SLBM NAMESPACE_ **************************************************
57
58 namespace slbm {
59
60 // **** _LOCAL INCLUDES_ *******************************************************
61
80 class SLBM_EXP UncertaintyPDU
81 {
82
83 public:
84
88 UncertaintyPDU();
89
95 UncertaintyPDU(int phase);
96
102 UncertaintyPDU(const string& phase);
103
110 UncertaintyPDU(string modelPath, int phase);
111
112 // \brief Parameterized constructor that loads path dependent model error
119 UncertaintyPDU(string modelPath, const string& phase);
120
124 UncertaintyPDU(const UncertaintyPDU& u);
125
129 virtual ~UncertaintyPDU();
130
134 UncertaintyPDU& operator=(const UncertaintyPDU& u);
135
142 virtual bool operator == (const UncertaintyPDU& other) const;
143 virtual bool operator != (const UncertaintyPDU& other) const { return !(*this == other); } ;
144
151 bool operator!=(const UncertaintyPDU& other) { return !(*this == other); }
152
160 static UncertaintyPDU* getUncertainty(ifstream& input, int phase);
161
168 static UncertaintyPDU* getUncertainty(ifstream& input, const string& phase);
169
177 static UncertaintyPDU* getUncertainty(geotess::IFStreamAscii& input);
178
186 static UncertaintyPDU* getUncertainty(geotess::IFStreamBinary& input);
187
195 static UncertaintyPDU* getUncertainty(const string& modelPath, int phase);
196
197 void readFile(ifstream& fin);
198
199 void readFile(geotess::IFStreamAscii& fin);
200
201 void readFile(geotess::IFStreamBinary& fin);
202
203 void writeFile(geotess::IFStreamAscii& output);
204
205 void writeFile(geotess::IFStreamBinary& fout);
206
207 void writeFile(const string& directoryName);
208
214 int getPhase() const {
215 return phaseNum;
216 }
217
223 const string getPhaseStr() const {
224 return getPhase(phaseNum);
225 }
226
230 const string& getLoadedFileName() const {
231 return fname;
232 }
233
239 const string& getGridId() const {
240 return gridId;
241 }
242
256 double getUncertainty(double distance,
257 const vector<int>& crustNodeIds, const vector<double>& crustWeights,
258 const vector<int>& headWaveNodeIds, const vector<double>& headWaveWeights,
259 const vector<vector<int> >& headWaveNodeNeighbors, const bool& calcRandomError = false,
260 bool printDebugInfo = false);
261
265 bool isRandomErrorDefined() const {
266 return (pathUncRandomError.size() > 0);
267 }
268
269 string toStringTable();
270
271 string toStringFile();
272
273 static string getPhase(const int& phaseIndex)
274 {
275 return UncertaintyPIU::getPhase(phaseIndex);
276 }
277
278 static int getPhase(const string& phase)
279 {
280 return UncertaintyPIU::getPhase(phase);
281 }
282
283 vector<double>& getPathUncCrustError() {
284 return pathUncCrustError;
285 }
286
287 const vector<double>& getPathUncCrustError() const {
288 return pathUncCrustError;
289 }
290
291 vector<vector<double> >& getPathUncRandomError() {
292 return pathUncRandomError;
293 }
294
295 const vector<vector<double> >& getPathUncRandomError() const {
296 return pathUncRandomError;
297 }
298
299 vector<double>& getPathUncDistanceBins() {
300 return pathUncDistanceBins;
301 }
302
303 const vector<double>& getPathUncDistanceBins() const {
304 return pathUncDistanceBins;
305 }
306
307 vector<vector<double> >& getPathUncModelError() {
308 return pathUncModelError;
309 }
310
311 const vector<vector<double> >& getPathUncModelError() const {
312 return pathUncModelError;
313 }
314
315 vector<vector<double> >& getPathUncBias() {
316 return pathUncBias;
317 }
318
319 const vector<vector<double> >& getPathUncBias() const {
320 return pathUncBias;
321 }
322
323 string toString();
324
327 map<string, string> properties;
328
329 vector<string> keys;
330
331
332 private:
333
339 void readFile(const string& filename);
340
346 string fname;
347
351 int phaseNum;
352
359 string gridId;
360
365 vector<double> pathUncCrustError;
366
371 vector<double> pathUncDistanceBins;
372
379 vector<vector<double> > pathUncRandomError;
380
386 vector<vector<double> > pathUncModelError;
387
393 vector<vector<double> > pathUncBias;
394
395 };
396
397} // end slbm namespace
398
399#endif // UncertaintyPDU_H
SLBMGlobals.h
SLBM_EXP
#define SLBM_EXP
Definition SLBMGlobals.h:181
UncertaintyPIU.h
slbm::UncertaintyPDU::readFile
void readFile(geotess::IFStreamBinary &fin)
slbm::UncertaintyPDU::getPhase
int getPhase() const
A public convenience accessor used to verify the error data for the correct model phase is loaded in ...
Definition UncertaintyPDU.h:214
slbm::UncertaintyPDU::UncertaintyPDU
UncertaintyPDU(int phase)
Parameterized constructor that defines an empty path path specific model error for the input phase.
slbm::UncertaintyPDU::getUncertainty
double getUncertainty(double distance, const vector< int > &crustNodeIds, const vector< double > &crustWeights, const vector< int > &headWaveNodeIds, const vector< double > &headWaveWeights, const vector< vector< int > > &headWaveNodeNeighbors, const bool &calcRandomError=false, bool printDebugInfo=false)
Returns the model uncertainty as a function of angular distance (degrees), crustal grid vertex indice...
slbm::UncertaintyPDU::UncertaintyPDU
UncertaintyPDU(const string &phase)
Parameterized constructor that that defines an empty path path specific model error for the input pha...
slbm::UncertaintyPDU::getLoadedFileName
const string & getLoadedFileName() const
Returns loaded file name or "not specified".
Definition UncertaintyPDU.h:230
slbm::UncertaintyPDU::readFile
void readFile(geotess::IFStreamAscii &fin)
slbm::UncertaintyPDU::getPathUncRandomError
vector< vector< double > > & getPathUncRandomError()
Definition UncertaintyPDU.h:291
slbm::UncertaintyPDU::toStringFile
string toStringFile()
slbm::UncertaintyPDU::getPhase
static int getPhase(const string &phase)
Definition UncertaintyPDU.h:278
slbm::UncertaintyPDU::toString
string toString()
slbm::UncertaintyPDU::getPathUncCrustError
const vector< double > & getPathUncCrustError() const
Definition UncertaintyPDU.h:287
slbm::UncertaintyPDU::writeFile
void writeFile(geotess::IFStreamBinary &fout)
slbm::UncertaintyPDU::writeFile
void writeFile(const string &directoryName)
slbm::UncertaintyPDU::getPathUncCrustError
vector< double > & getPathUncCrustError()
Definition UncertaintyPDU.h:283
slbm::UncertaintyPDU::operator=
UncertaintyPDU & operator=(const UncertaintyPDU &u)
Assignment operator.
slbm::UncertaintyPDU::getPathUncRandomError
const vector< vector< double > > & getPathUncRandomError() const
Definition UncertaintyPDU.h:295
slbm::UncertaintyPDU::getUncertainty
static UncertaintyPDU * getUncertainty(geotess::IFStreamAscii &input)
slbm::UncertaintyPDU::operator!=
bool operator!=(const UncertaintyPDU &other)
Definition UncertaintyPDU.h:151
slbm::UncertaintyPDU::getUncertainty
static UncertaintyPDU * getUncertainty(const string &modelPath, int phase)
slbm::UncertaintyPDU::getPathUncModelError
vector< vector< double > > & getPathUncModelError()
Definition UncertaintyPDU.h:307
slbm::UncertaintyPDU::toStringTable
string toStringTable()
slbm::UncertaintyPDU::getPathUncDistanceBins
vector< double > & getPathUncDistanceBins()
Definition UncertaintyPDU.h:299
slbm::UncertaintyPDU::getPathUncBias
const vector< vector< double > > & getPathUncBias() const
Definition UncertaintyPDU.h:319
slbm::UncertaintyPDU::keys
vector< string > keys
Definition UncertaintyPDU.h:329
slbm::UncertaintyPDU::getPathUncDistanceBins
const vector< double > & getPathUncDistanceBins() const
Definition UncertaintyPDU.h:303
slbm::UncertaintyPDU::UncertaintyPDU
UncertaintyPDU(const UncertaintyPDU &u)
Copy constructor.
slbm::UncertaintyPDU::~UncertaintyPDU
virtual ~UncertaintyPDU()
Destructor.
slbm::UncertaintyPDU::readFile
void readFile(ifstream &fin)
slbm::UncertaintyPDU::getPathUncModelError
const vector< vector< double > > & getPathUncModelError() const
Definition UncertaintyPDU.h:311
slbm::UncertaintyPDU::UncertaintyPDU
UncertaintyPDU(string modelPath, int phase)
Parameterized constructor that loads path dependent model error definition from a specified file.
slbm::UncertaintyPDU::getPhase
static string getPhase(const int &phaseIndex)
Definition UncertaintyPDU.h:273
slbm::UncertaintyPDU::UncertaintyPDU
UncertaintyPDU(string modelPath, const string &phase)
slbm::UncertaintyPDU::getGridId
const string & getGridId() const
Returns the grid id for which this path dependent uncertainty objects data are defined.
Definition UncertaintyPDU.h:239
slbm::UncertaintyPDU::getPathUncBias
vector< vector< double > > & getPathUncBias()
Definition UncertaintyPDU.h:315
slbm::UncertaintyPDU::properties
map< string, string > properties
A map to store metadata like phase, gridId, nBins, nVertices, etc..
Definition UncertaintyPDU.h:327
slbm::UncertaintyPDU::getUncertainty
static UncertaintyPDU * getUncertainty(geotess::IFStreamBinary &input)
slbm::UncertaintyPDU::isRandomErrorDefined
bool isRandomErrorDefined() const
Returns true if random error is defined.
Definition UncertaintyPDU.h:265
slbm::UncertaintyPDU::writeFile
void writeFile(geotess::IFStreamAscii &output)
slbm::UncertaintyPDU::getUncertainty
static UncertaintyPDU * getUncertainty(ifstream &input, int phase)
slbm::UncertaintyPDU::UncertaintyPDU
UncertaintyPDU()
Default constructor.
slbm::UncertaintyPDU::getUncertainty
static UncertaintyPDU * getUncertainty(ifstream &input, const string &phase)
slbm::UncertaintyPDU::getPhaseStr
const string getPhaseStr() const
A public convenience accessor used to verify the error data for the correct model phase is loaded in ...
Definition UncertaintyPDU.h:223
slbm::UncertaintyPIU::getPhase
int getPhase()
A public convenience accessor used to verify the error data for the correct model phase is loaded in ...
Definition UncertaintyPIU.h:501
slbm
Definition CrustalProfile.h:59