RSTT  3.2.0
Regional Seismic Travel Time
All Classes Namespaces Files Functions Variables Typedefs Friends Macros
GeoTessModelSLBM.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 GEOTESSMODELSLBM_H_
39 #define GEOTESSMODELSLBM_H_
40 
41 // **** _SYSTEM INCLUDES_ ******************************************************
42 
43 #include <iostream>
44 #include <string>
45 #include <fstream>
46 #include <vector>
47 #include <map>
48 
49 // use standard library objects
50 
51 // **** _LOCAL INCLUDES_ *******************************************************
52 
53 #include "SLBMGlobals.h"
54 #include "CPPGlobals.h"
55 #include "CPPUtils.h"
56 #include "GeoTessUtils.h"
57 #include "GeoTessException.h"
58 #include "GeoTessModel.h"
59 #include "UncertaintyPDU.h"
60 #include "UncertaintyPIU.h"
61 #include "SLBMException.h"
62 
63 using namespace geotess;
64 using namespace std;
65 
66 // **** _BEGIN GEOTESS NAMESPACE_ **********************************************
67 
68 namespace slbm
69 {
70 
71 // **** _FORWARD REFERENCES_ ***************************************************
72 
73 
74 // **** _CLASS DEFINITION_ *****************************************************
75 
83 class SLBM_EXP_IMP GeoTessModelSLBM : public GeoTessModel
84 {
85 private:
86 
90  double averageMantleVelocity[2];
91 
97  vector<vector<UncertaintyPIU*> > piu;
98 
102  vector<UncertaintyPDU*> pdu;
103 
107  int fileFormatVer;
108 
109  void init();
110 
111  void checkMiddleCrustLayers();
112 
113 protected:
114 
131  virtual void loadModelAscii(IFStreamAscii& input, const string& inputDirectory,
132  const string& relGridFilePath);
133 
149  virtual void loadModelBinary(IFStreamBinary& input, const string& inputDirectory,
150  const string& relGridFilePath);
151 
161  virtual void writeModelAscii(IFStreamAscii& output, const string& gridFileName);
162 
172  virtual void writeModelBinary(IFStreamBinary& output, const string& gridFileName);
173 
174 public:
175 
180 
188  GeoTessModelSLBM(const string& modelInputFile);
189 
211  GeoTessModelSLBM(const string& modelInputFile, const string& relativeGridPath);
212 
242  GeoTessModelSLBM(const string& gridFileName, GeoTessMetaData* metaData);
243 
278  GeoTessModelSLBM(GeoTessGrid* grid, GeoTessMetaData* metaData);
279 
280  virtual bool operator == (const GeoTessModelSLBM& other) const;
281 
282  virtual bool operator != (const GeoTessModelSLBM& other) const { return !(*this == other); } ;
283 
287  virtual ~GeoTessModelSLBM();
288 
293  virtual string class_name() { return "GeoTessModelSLBM"; }
294 
298  inline bool isPathDepUncModel() { return (pdu.size() > 0) ? true : false; }
299 
303  inline int getFileFormatVersion() { return fileFormatVer; }
304 
309  double getAverageMantleVelocity(const int &index) const
310  {
311  return averageMantleVelocity[index];
312  }
313 
318  void setAverageMantleVelocity(const int &index, const double &velocity)
319  {
320  averageMantleVelocity[index]=velocity;
321  }
322 
328  const vector<vector<UncertaintyPIU*> >& getPIU() const { return piu; }
329 
333  vector<UncertaintyPDU*>& getPDU()
334  {
335  if (isPathDepUncModel())
336  {
337  return pdu;
338  }
339  else
340  {
341  ostringstream os;
342  os << endl << "ERROR in GeoTessModelSLBM::getPDU()." << endl <<
343  "File " << getMetaData().getInputModelFile() << endl <<
344  "This model does not contain any PDU information." << endl
345  << "Version " << SlbmVersion << " File " << __FILE__ << " line " << __LINE__ << endl << endl;
346  throw SLBMException(os.str(), 105);
347  }
348  }
349 
350 
351  int getBufferSize() { return 0; }
352 
353  string toString();
354 
355 };
356 // end class GeoTessModelSLBM
357 
358 }// end namespace geotess
359 
360 #endif // GEOTESSMODELSLBM_H_
#define SLBM_EXP_IMP
Definition: SLBMGlobals.h:180
const vector< vector< UncertaintyPIU * > > & getPIU() const
GeoTessModelSLBM(const string &gridFileName, GeoTessMetaData *metaData)
GeoTessModelSLBM(const string &modelInputFile)
double getAverageMantleVelocity(const int &index) const
vector< UncertaintyPDU * > & getPDU()
virtual string class_name()
GeoTessModelSLBM(const string &modelInputFile, const string &relativeGridPath)
virtual void writeModelAscii(IFStreamAscii &output, const string &gridFileName)
virtual void writeModelBinary(IFStreamBinary &output, const string &gridFileName)
GeoTessModelSLBM(GeoTessGrid *grid, GeoTessMetaData *metaData)
virtual void loadModelBinary(IFStreamBinary &input, const string &inputDirectory, const string &relGridFilePath)
virtual void loadModelAscii(IFStreamAscii &input, const string &inputDirectory, const string &relGridFilePath)
void setAverageMantleVelocity(const int &index, const double &velocity)
An Exception class for Grid and related objects.
Definition: SLBMException.h:55