00001
00006 #ifndef GEOSTATISTICS_CLASS_HEADER_FILE_
00007 #define GEOSTATISTICS_CLASS_HEADER_FILE_
00008
00009 #include "variogram.h"
00010
00011 #include <vector>
00012 #include <list>
00013 #include <utility>
00014 #include <gsl/gsl_vector.h>
00015 #include <gsl/gsl_matrix.h>
00016
00022 class CGeostat
00023 {
00024
00025
00026
00027 private:
00029 std::vector<gsl_vector *> m_coords;
00031 gsl_vector *m_pData;
00033 gsl_vector *m_pTrend;
00035 std::vector< std::pair<double, double> > m_domain;
00037 CVariogram* m_pVarioCloud;
00039 CVariogram* m_pVariogram;
00041 gsl_matrix* m_pOKSys;
00042
00043
00044
00045 public:
00046
00047 CGeostat(void);
00048
00049 virtual ~CGeostat(void);
00050
00051 bool initialize(size_t smpl, size_t dim);
00052
00053
00054
00055 public:
00061 bool isActive(void) const
00062 {
00063 return m_pData != NULL;
00064 }
00070 size_t samples(void) const
00071 {
00072 return m_pData->size;
00073 }
00074
00080 size_t dimension(void) const
00081 {
00082 return m_domain.size();
00083 }
00089 double maxDist(void) const;
00090
00091 bool isDomain(const gsl_vector *c) const;
00092
00093
00094
00095
00096 public:
00097
00098 bool getCoordinate(gsl_vector *c, size_t s) const;
00099
00100 double getData(size_t s) const;
00101
00102 bool getModelParameters(double &sill, double &range, double &nugget, double &power) const;
00103
00104 bool getWeightVector(gsl_vector *w, const gsl_vector *c) const;
00105
00106 bool getPredictData(double &pred, double &var, const gsl_vector *c) const;
00107
00108 bool getPredictData(double &pred, const gsl_vector *coord, const gsl_vector *w) const;
00109
00110 bool getDomain(gsl_vector *lower, gsl_vector *upper) const;
00111
00112 double getTrend(const gsl_vector *c) const;
00113
00114 double getResidual(size_t s) const;
00115
00116
00117
00118 public:
00119
00120 bool setDomain(const gsl_vector *lower, const gsl_vector *upper);
00121
00122 bool setCoordinate(size_t s, const gsl_vector *c);
00123
00124 bool setData(size_t s, double d);
00125
00126
00127
00128 public:
00129
00130 bool estimate(int model, double power, double step);
00131
00132 bool removeRedundantSample(size_t s);
00133
00134
00135
00136 public:
00137
00138 double evalModelValidity(int model, double power, double step);
00139
00140 bool getPredictionErrorExcluded(double &pred, double &var, size_t smpl) const;
00141
00142 double selectEliminatee(size_t &candidate) const;
00143
00144
00145
00146 protected:
00147
00148 bool approximateTrendSurface(void);
00149
00150 std::vector<CVariogram::VarioItm> computeVariogramCloud(void) const;
00151
00152 std::vector<CVariogram::VarioItm> computeExperimentalVariogram(const std::vector<CVariogram::VarioItm> &vcloud, double step) const;
00153
00154 bool precomputeKrigingSystem(void);
00155
00156
00157
00158 private:
00159
00160 bool allocate(size_t smpl, size_t dim);
00161
00162 void destroy(void);
00163 };
00164
00165 #endif //GEOSTATISTICS_CLASS_HEADER_FILE_