OpendTect-6_4  6.4
variogrammodels.h
Go to the documentation of this file.
1 #ifndef variogrammodels_h
2 #define variogrammodels_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A. Huck & H.Huck
9  Date: 27-09-2011
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include <math.h>
17 
18 
19 inline void getVariogramModel( const char* typestr, float nugget, float sill,
20  float range, int size, float* in, float* out )
21 {
22  const FixedString type( typestr );
23  if ( type=="exponential" )
24  {
25  for ( int idx=0; idx<size; idx++ )
26  out[idx] = (sill-nugget)*(1-exp(-3*in[idx]/range))+nugget;
27  }
28  else if ( type=="gaussian" )
29  {
30  for ( int idx=0; idx<size; idx++ )
31  {
32  out[idx] = (sill-nugget)*
33  (1-exp(-3*((in[idx]*in[idx])/(range*range))))+
34  nugget;
35  }
36  }
37  else if ( type=="spherical" )
38  {
39  for ( int idx=0; idx<size; idx++ )
40  {
41  if ( in[idx] < range )
42  {
43  out[idx] = (sill-nugget)*(((3*in[idx])/(2*range))-
44  ((in[idx]*in[idx]*in[idx])/(2*range*range*range)))
45  +nugget;
46  }
47  else
48  out[idx] = sill;
49  }
50  }
51 }
52 
53 
54 #endif
OD::String that holds an existing text string.
Definition: fixedstring.h:29
void getVariogramModel(const char *typestr, float nugget, float sill, float range, int size, float *in, float *out)
Definition: variogrammodels.h:19

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019