RSTT  3.1.0
Regional Seismic Travel Time
UncertaintyPathDep.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 UncertaintyPathDep_H
39 #define UncertaintyPathDep_H
40 
41 // **** _SYSTEM INCLUDES_ ******************************************************
42 
43 #include <string>
44 #include <vector>
45 
46 #include "SLBMGlobals.h"
47 #include "IFStreamAscii.h"
48 #include "IFStreamBinary.h"
49 #include "Uncertainty.h"
50 
51 using namespace std;
52 
53 // **** _BEGIN SLBM NAMESPACE_ **************************************************
54 
55 namespace slbm {
56 
57  // **** _LOCAL INCLUDES_ *******************************************************
58 
78  {
79 
80  public:
81 
86 
92  UncertaintyPathDep(int phase);
93 
99  UncertaintyPathDep(const string& phase);
100 
107  UncertaintyPathDep(string modelPath, int phase);
108 
109  // \brief Parameterized constructor that loads path dependent model error
116  UncertaintyPathDep(string modelPath, const string& phase);
117 
122 
127 
132 
139  bool operator==(const UncertaintyPathDep& other);
140 
147  bool operator!=(const UncertaintyPathDep& other) { return !(*this == other); }
148 
156  static UncertaintyPathDep* getUncertainty(ifstream& input, int phase);
157 
164  static UncertaintyPathDep* getUncertainty(ifstream& input, const string& phase);
165 
173  static UncertaintyPathDep* getUncertainty(geotess::IFStreamAscii& input, int phase);
174 
182  static UncertaintyPathDep* getUncertainty(geotess::IFStreamAscii& input, const string& phase);
183 
191  static UncertaintyPathDep* getUncertainty(geotess::IFStreamBinary& input, int phase);
192 
200  static UncertaintyPathDep* getUncertainty(geotess::IFStreamBinary& input, const string& phase);
201 
209  static UncertaintyPathDep* getUncertainty(const string& modelPath, int phase);
210 
211  void readFile(ifstream& fin);
212 
213  void readFile(geotess::IFStreamAscii& fin);
214 
215  void readFile(geotess::IFStreamBinary& fin);
216 
217  void writeFile(geotess::IFStreamAscii& output);
218 
219  void writeFile(geotess::IFStreamBinary& fout);
220 
226  int getPhase() const {
227  return phaseNum;
228  }
229 
235  const string getPhaseStr() const {
236  return getPhase(phaseNum);
237  }
238 
242  const string& getLoadedFileName() const {
243  return fname;
244  }
245 
251  const string& getGridId() const {
252  return gridId;
253  }
254 
268  double getUncertainty(double distance,
269  const vector<int>& crustNodeIds, const vector<double>& crustWeights,
270  const vector<int>& headWaveNodeIds, const vector<double>& headWaveWeights,
271  const vector<vector<int> >& headWaveNodeNeighbors, const bool& calcRandomError = false,
272  bool printDebugInfo = false);
273 
277  bool isRandomErrorDefined() const {
278  return (pathUncRandomError.size() > 0);
279  }
280 
281  string toStringTable();
282 
283  string toStringFile();
284 
285  static string getPhase(const int& phaseIndex)
286  {
287  return Uncertainty::getPhase(phaseIndex);
288  }
289 
290  static int getPhase(const string& phase)
291  {
292  return Uncertainty::getPhase(phase);
293  }
294 
295  vector<double>& getPathUncCrustError() {
296  return pathUncCrustError;
297  }
298 
299  const vector<double>& getPathUncCrustError() const {
300  return pathUncCrustError;
301  }
302 
303  vector<vector<double> >& getPathUncRandomError() {
304  return pathUncRandomError;
305  }
306 
307  const vector<vector<double> >& getPathUncRandomError() const {
308  return pathUncRandomError;
309  }
310 
311  vector<double>& getPathUncDistanceBins() {
312  return pathUncDistanceBins;
313  }
314 
315  const vector<double>& getPathUncDistanceBins() const {
316  return pathUncDistanceBins;
317  }
318 
319  vector<vector<double> >& getPathUncModelError() {
320  return pathUncModelError;
321  }
322 
323  const vector<vector<double> >& getPathUncModelError() const {
324  return pathUncModelError;
325  }
326 
327  vector<vector<double> >& getPathUncBias() {
328  return pathUncBias;
329  }
330 
331  const vector<vector<double> >& getPathUncBias() const {
332  return pathUncBias;
333  }
334 
335  private:
336 
342  void readFile(const string& filename);
343 
349  string fname;
350 
354  int phaseNum;
355 
362  string gridId;
363 
368  vector<double> pathUncCrustError;
369 
374  vector<double> pathUncDistanceBins;
375 
382  vector<vector<double> > pathUncRandomError;
383 
389  vector<vector<double> > pathUncModelError;
390 
396  vector<vector<double> > pathUncBias;
397 
398  };
399 
400 } // end slbm namespace
401 
402 #endif // UncertaintyPathDep_H
slbm::UncertaintyPathDep::getPathUncRandomError
const vector< vector< double > > & getPathUncRandomError() const
Definition: UncertaintyPathDep.h:307
slbm::UncertaintyPathDep::UncertaintyPathDep
UncertaintyPathDep(const string &phase)
Parameterized constructor that that defines an empty path path specific model error for the input pha...
slbm::UncertaintyPathDep::getPathUncDistanceBins
vector< double > & getPathUncDistanceBins()
Definition: UncertaintyPathDep.h:311
slbm::UncertaintyPathDep::getPhase
int getPhase() const
A public convenience accessor used to verify the error data for the correct model phase is loaded in ...
Definition: UncertaintyPathDep.h:226
slbm::UncertaintyPathDep::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::UncertaintyPathDep::UncertaintyPathDep
UncertaintyPathDep(int phase)
Parameterized constructor that defines an empty path path specific model error for the input phase.
slbm::UncertaintyPathDep::readFile
void readFile(ifstream &fin)
slbm::UncertaintyPathDep::getPathUncRandomError
vector< vector< double > > & getPathUncRandomError()
Definition: UncertaintyPathDep.h:303
slbm::UncertaintyPathDep::getPhaseStr
const string getPhaseStr() const
A public convenience accessor used to verify the error data for the correct model phase is loaded in ...
Definition: UncertaintyPathDep.h:235
slbm::UncertaintyPathDep::UncertaintyPathDep
UncertaintyPathDep(string modelPath, int phase)
Parameterized constructor that loads path dependent model error definition from a specified file.
slbm::UncertaintyPathDep::getUncertainty
static UncertaintyPathDep * getUncertainty(geotess::IFStreamAscii &input, const string &phase)
slbm::UncertaintyPathDep::readFile
void readFile(geotess::IFStreamBinary &fin)
Uncertainty.h
SLBM_EXP
#define SLBM_EXP
Definition: SLBMGlobals.h:181
SLBMGlobals.h
slbm::UncertaintyPathDep::getPathUncDistanceBins
const vector< double > & getPathUncDistanceBins() const
Definition: UncertaintyPathDep.h:315
slbm::UncertaintyPathDep::writeFile
void writeFile(geotess::IFStreamBinary &fout)
slbm::UncertaintyPathDep::operator!=
bool operator!=(const UncertaintyPathDep &other)
Definition: UncertaintyPathDep.h:147
slbm::UncertaintyPathDep::operator=
UncertaintyPathDep & operator=(const UncertaintyPathDep &u)
Assignment operator.
slbm::UncertaintyPathDep::operator==
bool operator==(const UncertaintyPathDep &other)
slbm::UncertaintyPathDep::toStringTable
string toStringTable()
slbm::UncertaintyPathDep::UncertaintyPathDep
UncertaintyPathDep(string modelPath, const string &phase)
slbm::UncertaintyPathDep::readFile
void readFile(geotess::IFStreamAscii &fin)
slbm::UncertaintyPathDep::~UncertaintyPathDep
~UncertaintyPathDep()
Destructor.
slbm::UncertaintyPathDep::getUncertainty
static UncertaintyPathDep * getUncertainty(const string &modelPath, int phase)
slbm::UncertaintyPathDep::getUncertainty
static UncertaintyPathDep * getUncertainty(geotess::IFStreamBinary &input, const string &phase)
slbm::UncertaintyPathDep::getUncertainty
static UncertaintyPathDep * getUncertainty(ifstream &input, int phase)
slbm::UncertaintyPathDep::getUncertainty
static UncertaintyPathDep * getUncertainty(ifstream &input, const string &phase)
slbm::UncertaintyPathDep::getPathUncCrustError
const vector< double > & getPathUncCrustError() const
Definition: UncertaintyPathDep.h:299
slbm::UncertaintyPathDep::toStringFile
string toStringFile()
slbm::UncertaintyPathDep::UncertaintyPathDep
UncertaintyPathDep()
Default constructor.
slbm::UncertaintyPathDep::isRandomErrorDefined
bool isRandomErrorDefined() const
Returns true if random error is defined.
Definition: UncertaintyPathDep.h:277
slbm::UncertaintyPathDep::getPhase
static string getPhase(const int &phaseIndex)
Definition: UncertaintyPathDep.h:285
slbm::UncertaintyPathDep::writeFile
void writeFile(geotess::IFStreamAscii &output)
slbm::UncertaintyPathDep::getLoadedFileName
const string & getLoadedFileName() const
Returns loaded file name or "not specified".
Definition: UncertaintyPathDep.h:242
slbm::UncertaintyPathDep::getPathUncModelError
const vector< vector< double > > & getPathUncModelError() const
Definition: UncertaintyPathDep.h:323
slbm::UncertaintyPathDep::getUncertainty
static UncertaintyPathDep * getUncertainty(geotess::IFStreamAscii &input, int phase)
slbm::UncertaintyPathDep::getUncertainty
static UncertaintyPathDep * getUncertainty(geotess::IFStreamBinary &input, int phase)
slbm::UncertaintyPathDep::getPathUncModelError
vector< vector< double > > & getPathUncModelError()
Definition: UncertaintyPathDep.h:319
slbm::UncertaintyPathDep
A UncertaintyPathDep object contains the raw data to calculate a path dependent modeling error in sec...
Definition: UncertaintyPathDep.h:78
slbm::UncertaintyPathDep::getPathUncCrustError
vector< double > & getPathUncCrustError()
Definition: UncertaintyPathDep.h:295
slbm::UncertaintyPathDep::getPhase
static int getPhase(const string &phase)
Definition: UncertaintyPathDep.h:290
slbm::UncertaintyPathDep::getPathUncBias
vector< vector< double > > & getPathUncBias()
Definition: UncertaintyPathDep.h:327
slbm
Definition: CrustalProfile.h:59
slbm::UncertaintyPathDep::getPathUncBias
const vector< vector< double > > & getPathUncBias() const
Definition: UncertaintyPathDep.h:331
slbm::UncertaintyPathDep::getGridId
const string & getGridId() const
Returns the grid id for which this path dependent uncertainty objects data are defined.
Definition: UncertaintyPathDep.h:251
slbm::UncertaintyPathDep::UncertaintyPathDep
UncertaintyPathDep(const UncertaintyPathDep &u)
Copy constructor.