MTStation.h
Go to the documentation of this file.00001 #ifndef CMTSTATION_H
00002 #define CMTSTATION_H
00003
00004 #include "MTTensor.h"
00005 #include "MagneticTF.h"
00006 #include "types.h"
00007 #include <string>
00008 #include <boost/function.hpp>
00009
00010 namespace gplib
00011 {
00012
00013
00014
00015
00016 class MTStation
00017 {
00018 public:
00019 enum tmtdataformat
00020 {
00021 unknown, mtt, j, edi, pek
00022 };
00023 private:
00024
00025 double latitude;
00026
00027 double longitude;
00028
00029 double elevation;
00030
00031 std::string name;
00032
00033 double azimuth;
00034
00035 std::vector<MTTensor> MTData;
00036
00037 std::vector<MagneticTF> TFData;
00038 void DoRotate(const int i, const double angle);
00039
00040 void InitialSetup();
00041
00042 tmtdataformat dataformat;
00043
00044 void WriteMtt(const std::string filename);
00045
00046 void ReadEdi(const std::string filename);
00047
00048 void ReadJ(const std::string filename);
00049
00050 void ReadMtt(const std::string filename);
00051
00052 void ReadPek1D(const std::string filename);
00053
00054 void WriteJBlock(
00055 boost::function<std::complex<double>(const MTTensor*)> Comp,
00056 boost::function<double(const MTTensor*)> Err, std::ofstream &outfile,
00057 const double convfactor);
00058 protected:
00059
00060 void Update();
00061
00062
00063 void Assign(const int nfreq);
00064 public:
00065
00066 void AssignAll(const int nfreq);
00067
00068
00069 void Rotate(const double rotangle);
00070
00071 void Rotate(void);
00072
00073 trealdata GetFrequencies() const;
00074
00075 void SetFrequencies(const trealdata &freqs);
00076
00077 double GetLatitude() const
00078 {
00079 return latitude;
00080 }
00081 void SetLatitude(double lat)
00082 {
00083 latitude = lat;
00084 }
00085 double GetLongitude() const
00086 {
00087 return longitude;
00088 }
00089 void SetLongitude(double lon)
00090 {
00091 longitude = lon;
00092 }
00093 double GetElevation() const
00094 {
00095 return elevation;
00096 }
00097 std::string GetName()
00098 {
00099 return name;
00100 }
00101 double GetAzimuth() const
00102 {
00103 return azimuth;
00104 }
00105 ;
00106
00107 const MTTensor &at(const unsigned int i) const
00108 {
00109 return MTData.at(i);
00110 }
00111
00112 const std::vector<MTTensor> &GetMTData() const
00113 {
00114 return MTData;
00115 }
00116
00117 std::vector<MTTensor> &SetMTData()
00118 {
00119 return MTData;
00120 }
00121
00122 virtual MTStation *clone() const
00123 {
00124 return new MTStation(*this);
00125 }
00126 MTStation& operator=(const MTStation& source);
00127 MTStation();
00128 MTStation(const MTStation &old);
00129 MTStation(const int size);
00130 MTStation(const std::string filename);
00131 virtual ~MTStation();
00132
00133 virtual void GetData(const std::string filename);
00134 virtual void GetData()
00135 {
00136 }
00137
00138 virtual void WriteData(const std::string filename);
00139 friend class C1DMTSynthData;
00140
00141 void WriteAsMtt(const std::string filename);
00142
00143 void WriteAsEdi(const std::string filename);
00144
00145 void WriteAsJ(const std::string filename);
00146
00147 void WriteBack();
00148 };
00149
00150 }
00151 #endif // CMTSTATION_H