00001
00006 #ifndef VARIOGRAM_HEADER_FILE_
00007 #define VARIOGRAM_HEADER_FILE_
00008
00009 #include <vector>
00010
00016 class CVariogram
00017 {
00018
00019
00020 public:
00024 enum VariogramModel
00025 {
00027 VARIO_NONE,
00029 VARIO_SPH,
00031 VARIO_STB,
00033 VARIO_NUM
00034 };
00035
00036
00037
00038 public:
00043 struct VarioItm
00044 {
00046 double distance;
00048 double dissimilarity;
00049 };
00050
00051
00052
00053 private:
00055 int m_model;
00057 size_t m_samples;
00059 double *m_pDistance;
00061 double *m_pVariogram;
00062
00063
00064
00065
00067 double m_nugget;
00069 double m_sill;
00071 double m_range;
00073 double m_power;
00074
00075
00076
00077
00078 public:
00079
00080 CVariogram(void);
00081
00082 virtual ~CVariogram(void);
00083
00084
00085
00086 public:
00092 bool isActive(void) const
00093 {
00094 return m_pDistance != NULL && m_pVariogram;
00095 }
00101 bool isEstimated(void) const
00102 {
00103 return m_model != VARIO_NONE;
00104 }
00110 size_t samples(void) const
00111 {
00112 return m_samples;
00113 }
00119 double maxDistance(void) const
00120 {
00121 return m_pDistance[m_samples - 1];
00122 }
00128 double minDistance(void) const
00129 {
00130 return m_pDistance[0];
00131 }
00137 double nugget(void) const
00138 {
00139 return m_nugget;
00140 }
00146 double sill(void) const
00147 {
00148 return m_sill;
00149 }
00155 double range(void) const
00156 {
00157 return m_range;
00158 }
00164 double power(void) const
00165 {
00166 return m_power;
00167 }
00173 int modelType(void) const
00174 {
00175 return m_model;
00176 }
00177
00178 size_t countLessDist(double cap) const;
00179
00180
00181
00182 public:
00183
00184 bool getSample(size_t smpl, double &dist, double &vario) const;
00185
00186 double getModelData(double dist) const;
00187
00188 double getModelCovariance(double dist) const;
00189
00190
00191
00192 public:
00193
00194 bool setSample(const std::vector<CVariogram::VarioItm> &vecSample);
00195
00196 bool setModel(int model, double nugget, double sill, double range, double power, double step, double maxdist);
00197
00198
00199
00200 protected:
00201
00202 bool sortByDistance(void);
00203 public:
00204
00205 int estimateModel(int model, double &nugget, double &sill, double &range, double power, double maxdist =1.0e6);
00206
00207
00208
00209 private:
00210
00211 bool allocate(size_t smpl);
00212
00213 void destroy(void);
00214 };
00215
00216 #endif //VARIOGRAM_HEADER_FILE_