Ice Sheet System Model
4.18
Code documentation
Main Page
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Related Functions
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Variables
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
k
m
n
o
p
r
s
t
u
v
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
src
c
classes
kriging
SphericalVariogram.cpp
Go to the documentation of this file.
1
5
#ifdef HAVE_CONFIG_H
6
#include <config.h>
7
#else
8
#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
9
#endif
10
11
#include "../classes.h"
12
#include "../../shared/shared.h"
13
14
/*SphericalVariogram constructors and destructor*/
15
SphericalVariogram::SphericalVariogram
(){
/*{{{*/
16
this->
nugget
= 0.2;
17
this->
sill
= 1;
18
this->
range
=
SQRT3
;
19
return
;
20
}
21
/*}}}*/
22
SphericalVariogram::SphericalVariogram
(
Options
* options){
/*{{{*/
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
}
37
/*}}}*/
38
SphericalVariogram::~SphericalVariogram
(){
/*{{{*/
39
return
;
40
}
41
/*}}}*/
42
43
/*Object virtual functions definitions:*/
44
Object
*
SphericalVariogram::copy
(
void
){
/*{{{*/
45
return
new
SphericalVariogram
(*
this
);
46
}
47
/*}}}*/
48
void
SphericalVariogram::Echo
(
void
){
/*{{{*/
49
_printf_
(
"SphericalVariogram\n"
);
50
_printf_
(
" nugget: "
<< this->
nugget
<<
"\n"
);
51
_printf_
(
" sill : "
<< this->
sill
<<
"\n"
);
52
_printf_
(
" range : "
<< this->
range
<<
"\n"
);
53
}
54
/*}}}*/
55
56
/*Variogram function*/
57
double
SphericalVariogram::Covariance
(
double
deltax,
double
deltay){
/*{{{*/
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,cova;
64
65
/*Calculate length square*/
66
h=sqrt(deltax*deltax + deltay*deltay);
67
68
/*return covariance*/
69
if
(h<=
range
)
70
cova = (
sill
-
nugget
)*(1 - (3*h)/(2*
range
) + pow(h,3)/(2*pow(
range
,3)) );
71
else
72
cova = 0.;
73
74
return
cova;
75
}
76
/*}}}*/
77
double
SphericalVariogram::SemiVariogram
(
double
deltax,
double
deltay){
/*{{{*/
78
/*http://en.wikipedia.org/wiki/Variogram*/
79
double
h,gamma;
80
81
/*Calculate length square*/
82
h=sqrt(deltax*deltax + deltay*deltay);
83
84
/*return semi-variogram*/
85
if
(h<=
range
)
86
gamma = (
sill
-
nugget
)*( (3*h)/(2*
range
) - pow(h,3)/(2*pow(
range
,3)) ) +
nugget
;
87
else
88
gamma =
sill
;
89
90
return
gamma;
91
}
92
/*}}}*/
Options
Definition:
Options.h:9
SphericalVariogram::copy
Object * copy()
Definition:
SphericalVariogram.cpp:44
SphericalVariogram::nugget
double nugget
Definition:
SphericalVariogram.h:14
_printf_
#define _printf_(StreamArgs)
Definition:
Print.h:22
SphericalVariogram::~SphericalVariogram
~SphericalVariogram()
Definition:
SphericalVariogram.cpp:38
SphericalVariogram::Covariance
double Covariance(double deltax, double deltay)
Definition:
SphericalVariogram.cpp:57
SphericalVariogram::Echo
void Echo()
Definition:
SphericalVariogram.cpp:48
Object
Definition:
Object.h:13
SphericalVariogram::SphericalVariogram
SphericalVariogram()
Definition:
SphericalVariogram.cpp:15
Options::Get
void Get(OptionType *pvalue, const char *name)
Definition:
Options.h:21
SphericalVariogram::range
double range
Definition:
SphericalVariogram.h:16
Options::GetOption
Option * GetOption(const char *name)
Definition:
Options.cpp:67
_error_
#define _error_(StreamArgs)
Definition:
exceptions.h:49
SphericalVariogram::SemiVariogram
double SemiVariogram(double deltax, double deltay)
Definition:
SphericalVariogram.cpp:77
SQRT3
#define SQRT3
Definition:
constants.h:10
SphericalVariogram::sill
double sill
Definition:
SphericalVariogram.h:15
Generated on Thu Jul 2 2020 08:09:18 for Ice Sheet System Model by
1.8.19