GPLIB++
ThreeDMTModel.h
Go to the documentation of this file.
1 #ifndef _C3DMODEL_H_
2 #define _C3DMODEL_H_
3 
4 #include <boost/multi_array.hpp>
5 #include <string>
6 
7 namespace gplib
8  {
9  /** \addtogroup mttools MT data analysis, processing and inversion */
10  /* @{ */
11 
12  //! The class 3DMTModel manages 3D models for magnetotelluric model calculations, at this point this is only for file management and plotting purposes
13  /*! This class provides basic storage, read/write and plotting capabilities for
14  * three dimensional MT models in Mackie's native or WinGLink format. There
15  * is no corresponding forward code in this library at this point.
16  */
18  {
19  public:
20  typedef boost::multi_array<int, 3> t3DModelData;
21  typedef std::vector<double> t3DModelDim;
22  typedef std::vector<double> t3DModelRes;
23  private:
24  int LookupIndex(const double resistivity);
25  double LookupResistivity(const int index);
26  protected:
32  int airlayers;
33  public:
34  //! Get the cell sizes in x-direction (North) in m
36  {
37  return xsize;
38  }
39  //! Get the cell sizes in y-direction (East) in m
41  {
42  return ysize;
43  }
44  //! Get the cell sizes in z-direction (down) in m
46  {
47  return zsize;
48  }
49  //! Return the table of resistivity values that correspond to the index values in GetModel
51  {
52  return Resistivities;
53  }
54  //! Return a three dimensional multi-array with the indices of the resistivity values in each model cell, z varies fastest, then y then x
56  {
57  return Model;
58  }
59  //! Return the number of air layers in the model
61  {
62  return airlayers;
63  }
64  //! Set the number of air layers in the model
65  void SetAirlayers(const int n)
66  {
67  airlayers = n;
68  }
69  //! Read an ascii file in the format written by WinGLink
70  void ReadWinGLink(std::string filename);
71  //! Read an ascii file in the format use by Mackie's old code
72  void ReadMackie(std::string filename);
73  //! Write an ascii file in the format written by WinGLink
74  void WriteWinGLink(std::string filename);
75  //! Write an ascii file in the format use by Mackie's old code
76  void WriteMackie(std::string filename);
77  //! Write an ascii file in .vtk format for plotting
78  void WriteVTK(std::string filename);
79  //! Write the model in netcdf format
80  void WriteNetCDF(std::string filename);
81  ThreeDMTModel();
82  virtual ~ThreeDMTModel();
83  };
84  /* @} */
85  }
86 #endif //_C3DMODEL_H_
t3DModelRes Resistivities
Definition: ThreeDMTModel.h:28
const t3DModelDim & GetZSizes()
Get the cell sizes in z-direction (down) in m.
Definition: ThreeDMTModel.h:45
void SetAirlayers(const int n)
Set the number of air layers in the model.
Definition: ThreeDMTModel.h:65
void ReadMackie(std::string filename)
Read an ascii file in the format use by Mackie's old code.
void WriteNetCDF(std::string filename)
Write the model in netcdf format.
t3DModelData Model
Definition: ThreeDMTModel.h:27
std::vector< double > t3DModelRes
Definition: ThreeDMTModel.h:22
std::vector< double > t3DModelDim
Definition: ThreeDMTModel.h:21
const t3DModelDim & GetXSizes()
Get the cell sizes in x-direction (North) in m.
Definition: ThreeDMTModel.h:35
boost::multi_array< int, 3 > t3DModelData
Definition: ThreeDMTModel.h:20
void WriteMackie(std::string filename)
Write an ascii file in the format use by Mackie's old code.
The class 3DMTModel manages 3D models for magnetotelluric model calculations, at this point this is o...
Definition: ThreeDMTModel.h:17
const t3DModelDim & GetYSizes()
Get the cell sizes in y-direction (East) in m.
Definition: ThreeDMTModel.h:40
void ReadWinGLink(std::string filename)
Read an ascii file in the format written by WinGLink.
void WriteVTK(std::string filename)
Write an ascii file in .vtk format for plotting.
int GetAirlayers()
Return the number of air layers in the model.
Definition: ThreeDMTModel.h:60
const t3DModelData & GetModel()
Return a three dimensional multi-array with the indices of the resistivity values in each model cell...
Definition: ThreeDMTModel.h:55
void WriteWinGLink(std::string filename)
Write an ascii file in the format written by WinGLink.
const t3DModelRes & GetResistivities()
Return the table of resistivity values that correspond to the index values in GetModel.
Definition: ThreeDMTModel.h:50