Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Data Fields
ExponentialVariogram Class Reference

#include <ExponentialVariogram.h>

Inheritance diagram for ExponentialVariogram:
Variogram Object

Public Member Functions

 ExponentialVariogram ()
 
 ExponentialVariogram (Options *options)
 
 ~ExponentialVariogram ()
 
Objectcopy ()
 
void DeepEcho ()
 
void Echo ()
 
int Id ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum ()
 
double Covariance (double deltax, double deltay)
 
double SemiVariogram (double deltax, double deltay)
 
- Public Member Functions inherited from Variogram
virtual ~Variogram ()
 
- Public Member Functions inherited from Object
virtual ~Object ()
 

Data Fields

double nugget
 
double sill
 
double range
 

Detailed Description

Definition at line 11 of file ExponentialVariogram.h.

Constructor & Destructor Documentation

◆ ExponentialVariogram() [1/2]

ExponentialVariogram::ExponentialVariogram ( )

Definition at line 15 of file ExponentialVariogram.cpp.

15  {/*{{{*/
16  this->nugget = 0.2;
17  this->sill = 1;
18  this->range = SQRT3;
19  return;
20 }

◆ ExponentialVariogram() [2/2]

ExponentialVariogram::ExponentialVariogram ( Options options)

Definition at line 22 of file ExponentialVariogram.cpp.

22  {/*{{{*/
23 
24  /*Defaults*/
25  this->nugget = 0.2;
26  this->sill = 1;
27  this->range = SQRT3;
28 
29  /*Overwrite from options*/
30  if(options->GetOption("nugget")) options->Get(&this->nugget,"nugget");
31  if(options->GetOption("sill")) options->Get(&this->sill,"sill");
32  if(options->GetOption("range")) options->Get(&this->range,"range");
33 
34  /*Checks*/
35  if(nugget==sill) _error_("nugget and sill cannot be equal (constant semivariogram not allowed)");
36 }

◆ ~ExponentialVariogram()

ExponentialVariogram::~ExponentialVariogram ( )

Definition at line 38 of file ExponentialVariogram.cpp.

38  {/*{{{*/
39  return;
40 }

Member Function Documentation

◆ copy()

Object * ExponentialVariogram::copy ( void  )
virtual

Implements Object.

Definition at line 44 of file ExponentialVariogram.cpp.

44  {/*{{{*/
45  return new ExponentialVariogram(*this);
46 }

◆ DeepEcho()

void ExponentialVariogram::DeepEcho ( void  )
inlinevirtual

Implements Object.

Definition at line 25 of file ExponentialVariogram.h.

25 {_error_("Not implemented yet");};

◆ Echo()

void ExponentialVariogram::Echo ( void  )
virtual

Implements Object.

Definition at line 48 of file ExponentialVariogram.cpp.

48  {/*{{{*/
49  _printf_("ExponentialVariogram\n");
50  _printf_(" nugget: " << this->nugget << "\n");
51  _printf_(" sill : " << this->sill << "\n");
52  _printf_(" range : " << this->range << "\n");
53 }

◆ Id()

int ExponentialVariogram::Id ( void  )
inlinevirtual

Implements Object.

Definition at line 27 of file ExponentialVariogram.h.

27 {_error_("Not implemented yet");};

◆ Marshall()

void ExponentialVariogram::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
inlinevirtual

Implements Object.

Definition at line 28 of file ExponentialVariogram.h.

28 { _error_("not implemented yet!"); };

◆ ObjectEnum()

int ExponentialVariogram::ObjectEnum ( void  )
inlinevirtual

Implements Object.

Definition at line 29 of file ExponentialVariogram.h.

29 {_error_("Not implemented yet");};

◆ Covariance()

double ExponentialVariogram::Covariance ( double  deltax,
double  deltay 
)
virtual

Implements Variogram.

Definition at line 57 of file ExponentialVariogram.cpp.

57  {/*{{{*/
58  /*The covariance can be deduced from the variogram from the following
59  * relationship:
60  * 2 gamma = C(x,x) + C(y,y) -2 C(x,y)
61  * so
62  * C(h) = sill - gamma */
63  double h,a,cova;
64 
65  /*Calculate length*/
66  h=sqrt(deltax*deltax + deltay*deltay);
67 
68  /*If h is too small, return sill*/
69  if(h<0.0000001) return sill;
70 
71  /*compute covariance*/
72  a = 1./3.;
73  cova = (sill-nugget)*exp(-h/(a*range));
74  return cova;
75 }

◆ SemiVariogram()

double ExponentialVariogram::SemiVariogram ( double  deltax,
double  deltay 
)
virtual

Implements Variogram.

Definition at line 77 of file ExponentialVariogram.cpp.

77  {/*{{{*/
78  /*http://en.wikipedia.org/wiki/Variogram*/
79  double h,a,gamma;
80 
81  /*Calculate length*/
82  h=sqrt(deltax*deltax + deltay*deltay);
83 
84  /*return semi-variogram*/
85  a = 1./3.;
86  gamma = (sill-nugget)*(1-exp(-h/(a*range))) + nugget;
87  return gamma;
88 }

Field Documentation

◆ nugget

double ExponentialVariogram::nugget

Definition at line 14 of file ExponentialVariogram.h.

◆ sill

double ExponentialVariogram::sill

Definition at line 15 of file ExponentialVariogram.h.

◆ range

double ExponentialVariogram::range

Definition at line 16 of file ExponentialVariogram.h.


The documentation for this class was generated from the following files:
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
ExponentialVariogram::ExponentialVariogram
ExponentialVariogram()
Definition: ExponentialVariogram.cpp:15
Options::Get
void Get(OptionType *pvalue, const char *name)
Definition: Options.h:21
ExponentialVariogram::sill
double sill
Definition: ExponentialVariogram.h:15
Options::GetOption
Option * GetOption(const char *name)
Definition: Options.cpp:67
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
SQRT3
#define SQRT3
Definition: constants.h:10
ExponentialVariogram::range
double range
Definition: ExponentialVariogram.h:16
ExponentialVariogram::nugget
double nugget
Definition: ExponentialVariogram.h:14