Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

variogram.h

Go to the documentation of this file.
00001 
00006 #ifndef VARIOGRAM_HEADER_FILE_
00007 #define VARIOGRAM_HEADER_FILE_
00008 
00009 #include <vector>
00010 
00016 class CVariogram
00017 {
00018 //
00019 // member enumeration
00020 public:
00024         enum VariogramModel
00025         {
00027                 VARIO_NONE,
00029                 VARIO_SPH,
00031                 VARIO_STB,
00033                 VARIO_NUM
00034         };
00035 
00036 //
00037 // member classes
00038 public:
00043         struct VarioItm
00044         {
00046                 double distance;
00048                 double dissimilarity;
00049         };
00050 
00051 //
00052 // variables
00053 private:
00055         int m_model;
00057         size_t m_samples;
00059         double *m_pDistance;
00061         double *m_pVariogram;
00062 
00063         //
00064         // papameters of theoretical variogram
00065         //
00067         double m_nugget;
00069         double m_sill;
00071         double m_range;
00073         double m_power;
00074 
00075 //
00076 // constructor / destructor
00077 //
00078 public:
00079         // default constructor
00080         CVariogram(void);
00081         // destructor
00082         virtual ~CVariogram(void);
00083 
00084 //
00085 // attributes
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         // get number of samples whose distance is less than given value
00178         size_t countLessDist(double cap) const;
00179 
00180 //
00181 // data reader
00182 public:
00183         // get sample data (distance & dissimilarity)
00184         bool getSample(size_t smpl, double &dist, double &vario) const;
00185         // get theoretical dissimilarity
00186         double getModelData(double dist) const;
00187         // get covariance corresponding to theoretical dissimilarity
00188         double getModelCovariance(double dist) const;
00189 
00190 //
00191 // data writer
00192 public:
00193         // set sample data (distance & dissimilarity)
00194         bool setSample(const std::vector<CVariogram::VarioItm> &vecSample);
00195         // set parameters of theoretical variogram (nugget, sill, range, power, and so on)
00196         bool setModel(int model, double nugget, double sill, double range, double power, double step, double maxdist);
00197 
00198 //
00199 // manipulator
00200 protected:
00201         // sort container for dissimilarity by distance
00202         bool sortByDistance(void);
00203 public:
00204         // estimate theoretical variogram by non-linear least square fitting
00205         int estimateModel(int model, double &nugget, double &sill, double &range, double power, double maxdist =1.0e6);
00206 
00207 //
00208 // memory manager
00209 private:
00210         // memory allocation
00211         bool allocate(size_t smpl);
00212         // memory destruction
00213         void destroy(void);
00214 };
00215 
00216 #endif  //VARIOGRAM_HEADER_FILE_

Generated on Thu Aug 11 13:01:33 2005 for Kriging sample by  doxygen 1.4.3