00001 #ifndef _C3DMODEL_H_ 00002 #define _C3DMODEL_H_ 00003 00004 #include <boost/multi_array.hpp> 00005 #include <string> 00006 00007 namespace gplib 00008 { 00009 /** \addtogroup mttools MT data analysis, processing and inversion */ 00010 /* @{ */ 00011 00012 //! The class 3DMTModel manages 3D models for magnetotelluric model calculations, at this point this is only for file management and plotting purposes 00013 /*! This class provides basic storage, read/write and plotting capabilities for 00014 * three dimensional MT models in Mackie's native or WinGLink format. There 00015 * is no corresponding forward code in this library at this point. 00016 */ 00017 class ThreeDMTModel 00018 { 00019 public: 00020 typedef boost::multi_array<int, 3> t3DModelData; 00021 typedef std::vector<double> t3DModelDim; 00022 typedef std::vector<double> t3DModelRes; 00023 private: 00024 int LookupIndex(const double resistivity); 00025 double LookupResistivity(const int index); 00026 protected: 00027 t3DModelData Model; 00028 t3DModelRes Resistivities; 00029 t3DModelDim xsize; 00030 t3DModelDim ysize; 00031 t3DModelDim zsize; 00032 int airlayers; 00033 public: 00034 //! Get the cell sizes in x-direction (North) in m 00035 const t3DModelDim &GetXSizes() 00036 { 00037 return xsize; 00038 } 00039 //! Get the cell sizes in y-direction (East) in m 00040 const t3DModelDim &GetYSizes() 00041 { 00042 return ysize; 00043 } 00044 //! Get the cell sizes in z-direction (down) in m 00045 const t3DModelDim &GetZSizes() 00046 { 00047 return zsize; 00048 } 00049 //! Return the table of resistivity values that correspond to the index values in GetModel 00050 const t3DModelRes &GetResistivities() 00051 { 00052 return Resistivities; 00053 } 00054 //! Return a three dimensional multi-array with the indices of the resistivity values in each model cell, z varies fastest, then y then x 00055 const t3DModelData &GetModel() 00056 { 00057 return Model; 00058 } 00059 //! Return the number of air layers in the model 00060 int GetAirlayers() 00061 { 00062 return airlayers; 00063 } 00064 //! Set the number of air layers in the model 00065 void SetAirlayers(const int n) 00066 { 00067 airlayers = n; 00068 } 00069 //! Read an ascii file in the format written by WinGLink 00070 void ReadWinGLink(std::string filename); 00071 //! Read an ascii file in the format use by Mackie's old code 00072 void ReadMackie(std::string filename); 00073 //! Write an ascii file in the format written by WinGLink 00074 void WriteWinGLink(std::string filename); 00075 //! Write an ascii file in the format use by Mackie's old code 00076 void WriteMackie(std::string filename); 00077 //! Write an ascii file in .vtk format for plotting 00078 void WriteVTK(std::string filename); 00079 //! Write the model in netcdf format 00080 void WriteNetCDF(std::string filename); 00081 ThreeDMTModel(); 00082 virtual ~ThreeDMTModel(); 00083 }; 00084 /* @} */ 00085 } 00086 #endif //_C3DMODEL_H_
1.5.8