|  |  |  | @ -1,8 +1,7 @@ | 
		
	
		
			
				|  |  |  |  | #include <stdio.h> | 
		
	
		
			
				|  |  |  |  | #include <stdarg.h> | 
		
	
		
			
				|  |  |  |  | #include <stddef.h> | 
		
	
		
			
				|  |  |  |  | #include <stdio.h> | 
		
	
		
			
				|  |  |  |  | #include <string.h> | 
		
	
		
			
				|  |  |  |  | #include <stdarg.h> | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | #ifndef _GEOSTAT_H | 
		
	
		
			
				|  |  |  |  | #define _GEOSTAT_H | 
		
	
	
		
			
				
					|  |  |  | @ -27,7 +26,6 @@ | 
		
	
		
			
				|  |  |  |  | /* cdf_mod */ | 
		
	
		
			
				|  |  |  |  | /* realization_mod */ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* List of functions: */ | 
		
	
		
			
				|  |  |  |  | /* ------------------ */ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -44,9 +42,6 @@ | 
		
	
		
			
				|  |  |  |  | /* test_fract, trun1, trungasdev,vec_vec,       */ | 
		
	
		
			
				|  |  |  |  | /* vf2gthres,polint    */ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*STRUCTURES*/ | 
		
	
		
			
				|  |  |  |  | /*----------*/ | 
		
	
		
			
				|  |  |  |  | /*variogram                                            */ | 
		
	
	
		
			
				
					|  |  |  | @ -67,16 +62,14 @@ | 
		
	
		
			
				|  |  |  |  | /*scf: correlation lengths per variogram model         */ | 
		
	
		
			
				|  |  |  |  | /*var: normalized variance per variogram model(sum = 1)*/ | 
		
	
		
			
				|  |  |  |  | struct vario_mod { | 
		
	
		
			
				|  |  |  |  |   int Nvario; | 
		
	
		
			
				|  |  |  |  |   int *vario; | 
		
	
		
			
				|  |  |  |  |   double *alpha; | 
		
	
		
			
				|  |  |  |  |   double *ap; | 
		
	
		
			
				|  |  |  |  |   double *scf; | 
		
	
		
			
				|  |  |  |  |   double *var; | 
		
	
		
			
				|  |  |  |  |     int Nvario; | 
		
	
		
			
				|  |  |  |  |     int* vario; | 
		
	
		
			
				|  |  |  |  |     double* alpha; | 
		
	
		
			
				|  |  |  |  |     double* ap; | 
		
	
		
			
				|  |  |  |  |     double* scf; | 
		
	
		
			
				|  |  |  |  |     double* var; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*variogram table                                      */ | 
		
	
		
			
				|  |  |  |  | /*Nvario: number of combined variogram models          */ | 
		
	
		
			
				|  |  |  |  | /*vario: model of variogram per variogram model        */ | 
		
	
	
		
			
				
					|  |  |  | @ -95,18 +88,15 @@ struct vario_mod { | 
		
	
		
			
				|  |  |  |  | /*scf: correlation lengths per variogram model         */ | 
		
	
		
			
				|  |  |  |  | /*var: normalized variance per variogram model(sum = 1)*/ | 
		
	
		
			
				|  |  |  |  | struct variotable_mod { | 
		
	
		
			
				|  |  |  |  |   int number_of_variograms; | 
		
	
		
			
				|  |  |  |  |   int *Nvario; | 
		
	
		
			
				|  |  |  |  |   int *vario; | 
		
	
		
			
				|  |  |  |  |   float *alpha; | 
		
	
		
			
				|  |  |  |  |   float *ap; | 
		
	
		
			
				|  |  |  |  |   float *scf; | 
		
	
		
			
				|  |  |  |  |   float *var; | 
		
	
		
			
				|  |  |  |  |     int number_of_variograms; | 
		
	
		
			
				|  |  |  |  |     int* Nvario; | 
		
	
		
			
				|  |  |  |  |     int* vario; | 
		
	
		
			
				|  |  |  |  |     float* alpha; | 
		
	
		
			
				|  |  |  |  |     float* ap; | 
		
	
		
			
				|  |  |  |  |     float* scf; | 
		
	
		
			
				|  |  |  |  |     float* var; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*grid                                     */ | 
		
	
		
			
				|  |  |  |  | /*NX: number of gridblocks along the X axis*/ | 
		
	
		
			
				|  |  |  |  | /*NY: number of gridblocks along the Y axis*/ | 
		
	
	
		
			
				
					|  |  |  | @ -118,12 +108,11 @@ struct variotable_mod { | 
		
	
		
			
				|  |  |  |  | /*Yo: Y-cell number of the origin cell     */ | 
		
	
		
			
				|  |  |  |  | /*Zo: Z-cell number of the origin cell     */ | 
		
	
		
			
				|  |  |  |  | struct grid_mod { | 
		
	
		
			
				|  |  |  |  |   int NX, NY, NZ; | 
		
	
		
			
				|  |  |  |  |   double DX,DY,DZ; | 
		
	
		
			
				|  |  |  |  |   double Xo,Yo,Zo; | 
		
	
		
			
				|  |  |  |  |     int NX, NY, NZ; | 
		
	
		
			
				|  |  |  |  |     double DX, DY, DZ; | 
		
	
		
			
				|  |  |  |  |     double Xo, Yo, Zo; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*well data                                               */ | 
		
	
		
			
				|  |  |  |  | /*nwell: number of wells                                  */ | 
		
	
		
			
				|  |  |  |  | /*n: number of measurement points per well                */ | 
		
	
	
		
			
				
					|  |  |  | @ -153,18 +142,16 @@ struct grid_mod { | 
		
	
		
			
				|  |  |  |  | /*   i=[sum(n[k])... sum(n[k])+n[0]-1 ... 2*(sum(n[k])-1)]*/ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | struct welldata_mod { | 
		
	
		
			
				|  |  |  |  |   int nwell; | 
		
	
		
			
				|  |  |  |  |   int *n; | 
		
	
		
			
				|  |  |  |  |   int ntype; | 
		
	
		
			
				|  |  |  |  |   int *code; | 
		
	
		
			
				|  |  |  |  |   float *x; | 
		
	
		
			
				|  |  |  |  |   float *y; | 
		
	
		
			
				|  |  |  |  |   float *z; | 
		
	
		
			
				|  |  |  |  |   float *measure; | 
		
	
		
			
				|  |  |  |  |     int nwell; | 
		
	
		
			
				|  |  |  |  |     int* n; | 
		
	
		
			
				|  |  |  |  |     int ntype; | 
		
	
		
			
				|  |  |  |  |     int* code; | 
		
	
		
			
				|  |  |  |  |     float* x; | 
		
	
		
			
				|  |  |  |  |     float* y; | 
		
	
		
			
				|  |  |  |  |     float* z; | 
		
	
		
			
				|  |  |  |  |     float* measure; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*volume fractions for facies                     */ | 
		
	
		
			
				|  |  |  |  | /*ncat: number of facies                          */ | 
		
	
		
			
				|  |  |  |  | /*nblock: number of gridblocks with different     */ | 
		
	
	
		
			
				
					|  |  |  | @ -174,12 +161,11 @@ struct welldata_mod { | 
		
	
		
			
				|  |  |  |  | /*vf: volume fractions for the first ncat-1 facies*/ | 
		
	
		
			
				|  |  |  |  | /*    i = [0...ncat-2]*nblock                     */ | 
		
	
		
			
				|  |  |  |  | struct statfacies_mod { | 
		
	
		
			
				|  |  |  |  |   int ncat; | 
		
	
		
			
				|  |  |  |  |   int nblock; | 
		
	
		
			
				|  |  |  |  |   float *vf; | 
		
	
		
			
				|  |  |  |  |     int ncat; | 
		
	
		
			
				|  |  |  |  |     int nblock; | 
		
	
		
			
				|  |  |  |  |     float* vf; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*inequalities for truncated plurigaussian realizations*/ | 
		
	
		
			
				|  |  |  |  | /*only two basic realizations Y1 and Y2 are considered */ | 
		
	
		
			
				|  |  |  |  | /*Y1 and Y2 are independent                            */ | 
		
	
	
		
			
				
					|  |  |  | @ -202,14 +188,13 @@ struct statfacies_mod { | 
		
	
		
			
				|  |  |  |  | /*             the values in address_sY2 are integers  */ | 
		
	
		
			
				|  |  |  |  | /*             ranging from 0 to n+1 with n = nsY1+nsY2*/ | 
		
	
		
			
				|  |  |  |  | struct inequalities_mod { | 
		
	
		
			
				|  |  |  |  |   int nsY1; | 
		
	
		
			
				|  |  |  |  |   int nsY2; | 
		
	
		
			
				|  |  |  |  |   float *thresholds; | 
		
	
		
			
				|  |  |  |  |   int *address_sY1; | 
		
	
		
			
				|  |  |  |  |   int *address_sY2; | 
		
	
		
			
				|  |  |  |  |     int nsY1; | 
		
	
		
			
				|  |  |  |  |     int nsY2; | 
		
	
		
			
				|  |  |  |  |     float* thresholds; | 
		
	
		
			
				|  |  |  |  |     int* address_sY1; | 
		
	
		
			
				|  |  |  |  |     int* address_sY2; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*statistical data                                       */ | 
		
	
		
			
				|  |  |  |  | /*type --> 0 : normal                                    */ | 
		
	
		
			
				|  |  |  |  | /*     --> 1 : natural log                               */ | 
		
	
	
		
			
				
					|  |  |  | @ -227,14 +212,13 @@ struct inequalities_mod { | 
		
	
		
			
				|  |  |  |  | /*variance: variance of the variable i = [0...nblock_var]*/ | 
		
	
		
			
				|  |  |  |  | /* DHF CHANGE: FOR TYPE 1 AND TYPE 2, VAR IS LOG VAR   ! */ | 
		
	
		
			
				|  |  |  |  | struct statistic_mod { | 
		
	
		
			
				|  |  |  |  |   int type; | 
		
	
		
			
				|  |  |  |  |   int nblock_mean; | 
		
	
		
			
				|  |  |  |  |   double *mean; | 
		
	
		
			
				|  |  |  |  |   int nblock_var; | 
		
	
		
			
				|  |  |  |  |   double *variance; | 
		
	
		
			
				|  |  |  |  |     int type; | 
		
	
		
			
				|  |  |  |  |     int nblock_mean; | 
		
	
		
			
				|  |  |  |  |     double* mean; | 
		
	
		
			
				|  |  |  |  |     int nblock_var; | 
		
	
		
			
				|  |  |  |  |     double* variance; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*gradual deformation parameters                      */ | 
		
	
		
			
				|  |  |  |  | /*Nadded: number of complementary realizations        */ | 
		
	
		
			
				|  |  |  |  | /*NZONES: number of subregions                        */ | 
		
	
	
		
			
				
					|  |  |  | @ -245,12 +229,11 @@ struct statistic_mod { | 
		
	
		
			
				|  |  |  |  | /*cellfin[NZONES*(0...2)] upper cell bound for        */ | 
		
	
		
			
				|  |  |  |  | /*for subregions along axes X,Y,Z                     */ | 
		
	
		
			
				|  |  |  |  | struct grad_mod { | 
		
	
		
			
				|  |  |  |  |   int Nadded, NZONES; | 
		
	
		
			
				|  |  |  |  |   float *rho; | 
		
	
		
			
				|  |  |  |  |   int *cellini, *cellfin; | 
		
	
		
			
				|  |  |  |  |     int Nadded, NZONES; | 
		
	
		
			
				|  |  |  |  |     float* rho; | 
		
	
		
			
				|  |  |  |  |     int *cellini, *cellfin; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*gradient structures                                   */ | 
		
	
		
			
				|  |  |  |  | /*Nparam : number of parameters for which gradients are */ | 
		
	
		
			
				|  |  |  |  | /*         required                                     */ | 
		
	
	
		
			
				
					|  |  |  | @ -263,24 +246,21 @@ struct grad_mod { | 
		
	
		
			
				|  |  |  |  | /*       Ncells....2*Ncells-1 for the second parameter  */ | 
		
	
		
			
				|  |  |  |  | /*       and so on                                      */ | 
		
	
		
			
				|  |  |  |  | struct gradients_mod { | 
		
	
		
			
				|  |  |  |  |   int Nparam,Ncells; | 
		
	
		
			
				|  |  |  |  |   float *grad; | 
		
	
		
			
				|  |  |  |  |     int Nparam, Ncells; | 
		
	
		
			
				|  |  |  |  |     float* grad; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*description of discretized cumulative distributions */ | 
		
	
		
			
				|  |  |  |  | /*n: number of points                                 */ | 
		
	
		
			
				|  |  |  |  | /*x: values along the x axis i = [0...n-1]            */ | 
		
	
		
			
				|  |  |  |  | /*fx: corresponding values for the cumulative         */ | 
		
	
		
			
				|  |  |  |  | /*    distribution i = [0...n-1]                      */ | 
		
	
		
			
				|  |  |  |  | struct cdf_mod { | 
		
	
		
			
				|  |  |  |  |   int n; | 
		
	
		
			
				|  |  |  |  |   float *x; | 
		
	
		
			
				|  |  |  |  |   float *fx; | 
		
	
		
			
				|  |  |  |  |     int n; | 
		
	
		
			
				|  |  |  |  |     float* x; | 
		
	
		
			
				|  |  |  |  |     float* fx; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*realization                                         */ | 
		
	
		
			
				|  |  |  |  | /*n: number of components                             */ | 
		
	
		
			
				|  |  |  |  | /*code: status of the realization                     */ | 
		
	
	
		
			
				
					|  |  |  | @ -301,9 +281,9 @@ struct cdf_mod { | 
		
	
		
			
				|  |  |  |  | /*      --> 14: conditional any type                  */ | 
		
	
		
			
				|  |  |  |  | /*vector: realization vector i = [0...n-1]            */ | 
		
	
		
			
				|  |  |  |  | struct realization_mod { | 
		
	
		
			
				|  |  |  |  |   int n; | 
		
	
		
			
				|  |  |  |  |   int code; | 
		
	
		
			
				|  |  |  |  |   double *vector; | 
		
	
		
			
				|  |  |  |  |     int n; | 
		
	
		
			
				|  |  |  |  |     int code; | 
		
	
		
			
				|  |  |  |  |     double* vector; | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*=====================================================*/ | 
		
	
	
		
			
				
					|  |  |  | @ -311,18 +291,15 @@ struct realization_mod { | 
		
	
		
			
				|  |  |  |  | /*FUNCTIONS*/ | 
		
	
		
			
				|  |  |  |  | /*---------*/ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*normalization of the anostropy axes                  */ | 
		
	
		
			
				|  |  |  |  | /*ap: anisotropy axes                                  */ | 
		
	
		
			
				|  |  |  |  | /*scf: correlation lengths                             */ | 
		
	
		
			
				|  |  |  |  | /* The returned normalized axes are in ap              */ | 
		
	
		
			
				|  |  |  |  | void axes(double *ap, double *scf, int N); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void axes(double* ap, double* scf, int N); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*cardsin covariance value for lag h*/ | 
		
	
		
			
				|  |  |  |  | double cardsin(double h); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*Cholesky decomposition of matrix C                    */ | 
		
	
		
			
				|  |  |  |  | /* C     : symetric positive-definite matrix recorded   */ | 
		
	
		
			
				|  |  |  |  | /*         (per raws) as a vector with only components  */ | 
		
	
	
		
			
				
					|  |  |  | @ -330,8 +307,7 @@ double cardsin(double h); | 
		
	
		
			
				|  |  |  |  | /* n     : dimension of matrix Cij                      */ | 
		
	
		
			
				|  |  |  |  | /*                                                      */ | 
		
	
		
			
				|  |  |  |  | /* C is turned into the lower triangular cholesky matrix*/ | 
		
	
		
			
				|  |  |  |  | void choldc(double *C, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void choldc(double* C, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*computes the coordinates of a given cell    */ | 
		
	
		
			
				|  |  |  |  | /*as numbers of cells along the X,Y and Z axes*/ | 
		
	
	
		
			
				
					|  |  |  | @ -341,8 +317,7 @@ void choldc(double *C, int n); | 
		
	
		
			
				|  |  |  |  | /*grid: structure defining the grid           */ | 
		
	
		
			
				|  |  |  |  | /*output:                                     */ | 
		
	
		
			
				|  |  |  |  | /*i: vector with the coordinates              */ | 
		
	
		
			
				|  |  |  |  | void coordinates(int maille, int i[3],struct grid_mod grid); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void coordinates(int maille, int i[3], struct grid_mod grid); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*builds the sampled covariance function */ | 
		
	
		
			
				|  |  |  |  | /*dimensions are even                    */ | 
		
	
	
		
			
				
					|  |  |  | @ -351,7 +326,7 @@ void coordinates(int maille, int i[3],struct grid_mod grid); | 
		
	
		
			
				|  |  |  |  | /*variogram: structure defined above     */ | 
		
	
		
			
				|  |  |  |  | /*grid: structure defined above          */ | 
		
	
		
			
				|  |  |  |  | /*n: number of gridblocks along X,Y and Z*/ | 
		
	
		
			
				|  |  |  |  | void covariance(double *covar,struct vario_mod variogram, struct grid_mod grid, int n[3]); | 
		
	
		
			
				|  |  |  |  | void covariance(double* covar, struct vario_mod variogram, struct grid_mod grid, int n[3]); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*computation of the covariance matrix for the well data*/ | 
		
	
		
			
				|  |  |  |  | /*well coordinates are given as a number of cells       */ | 
		
	
	
		
			
				
					|  |  |  | @ -362,8 +337,7 @@ void covariance(double *covar,struct vario_mod variogram, struct grid_mod grid, | 
		
	
		
			
				|  |  |  |  | /*variogram: structure defined above                    */ | 
		
	
		
			
				|  |  |  |  | /*well: structure defined above                         */ | 
		
	
		
			
				|  |  |  |  | /*grid: structure defined above                         */ | 
		
	
		
			
				|  |  |  |  | void cov_matrix(double *C, struct vario_mod variogram, struct welldata_mod well, struct grid_mod grid); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void cov_matrix(double* C, struct vario_mod variogram, struct welldata_mod well, struct grid_mod grid); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*calculation of the covariance value for a distance h */ | 
		
	
		
			
				|  |  |  |  | /*defined by i,j,k                                     */ | 
		
	
	
		
			
				
					|  |  |  | @ -382,12 +356,11 @@ void cov_matrix(double *C, struct vario_mod variogram, struct welldata_mod well, | 
		
	
		
			
				|  |  |  |  | /*dj: distance along the Y axis                        */ | 
		
	
		
			
				|  |  |  |  | /*dk: distance along the Z axis                        */ | 
		
	
		
			
				|  |  |  |  | /* The returned value is the computed covariance value */ | 
		
	
		
			
				|  |  |  |  | double cov_value(struct vario_mod variogram,double di,double dj,double dk); | 
		
	
		
			
				|  |  |  |  | double cov_value(struct vario_mod variogram, double di, double dj, double dk); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*cubic covariance value for lag h*/ | 
		
	
		
			
				|  |  |  |  | double cubic(double h); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*truncation of the power spectrum to remove     */ | 
		
	
		
			
				|  |  |  |  | /*high frequencies - isotropic case              */ | 
		
	
		
			
				|  |  |  |  | /*covar: power spectrum                          */ | 
		
	
	
		
			
				
					|  |  |  | @ -395,8 +368,7 @@ double cubic(double h); | 
		
	
		
			
				|  |  |  |  | /*ky: number of cells to save along the y-axis   */ | 
		
	
		
			
				|  |  |  |  | /*kz: number of cells to save along the z-axis   */ | 
		
	
		
			
				|  |  |  |  | /*n[3]: number of cells along the X, Y and Z axes*/ | 
		
	
		
			
				|  |  |  |  | void cutspectr(float *covar, int kx, int ky, int kz, int n[3]); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void cutspectr(float* covar, int kx, int ky, int kz, int n[3]); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*defines the threshold interval for a facies x*/ | 
		
	
		
			
				|  |  |  |  | /*lim_inf: lower bound                         */ | 
		
	
	
		
			
				
					|  |  |  | @ -405,8 +377,7 @@ void cutspectr(float *covar, int kx, int ky, int kz, int n[3]); | 
		
	
		
			
				|  |  |  |  | /*thresholds: Gaussian threshold vector        */ | 
		
	
		
			
				|  |  |  |  | /*facies: structure defined above              */ | 
		
	
		
			
				|  |  |  |  | /*nblock: gridcell number of point x           */ | 
		
	
		
			
				|  |  |  |  | void deflimit(double *plim_inf, double *plim_sup, float x, float *thresholds, struct statfacies_mod facies,int nblock); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void deflimit(double* plim_inf, double* plim_sup, float x, float* thresholds, struct statfacies_mod facies, int nblock); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*kriges the realization considering weights           */ | 
		
	
		
			
				|  |  |  |  | /*realin: input realization                            */ | 
		
	
	
		
			
				
					|  |  |  | @ -416,14 +387,11 @@ void deflimit(double *plim_inf, double *plim_sup, float x, float *thresholds, st | 
		
	
		
			
				|  |  |  |  | /*grid: structure defined above                        */ | 
		
	
		
			
				|  |  |  |  | /*D: weight vector of length Ndata, Di, i = 0...Ndata-1*/ | 
		
	
		
			
				|  |  |  |  | /*The kriged realization is stored in realout          */ | 
		
	
		
			
				|  |  |  |  | void dual_kri(struct realization_mod *realin, struct vario_mod variogram,struct welldata_mod well, struct grid_mod grid, double *D,struct realization_mod *realout); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void dual_kri(struct realization_mod* realin, struct vario_mod variogram, struct welldata_mod well, struct grid_mod grid, double* D, struct realization_mod* realout); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*exponential covariance value for lag h*/ | 
		
	
		
			
				|  |  |  |  | double exponential(double h); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*Fast Fourier Transform - Cooley-Tukey algorithm     */ | 
		
	
		
			
				|  |  |  |  | /*datar: real part vector - to be transformed         */ | 
		
	
		
			
				|  |  |  |  | /*datai: imaginary part vector - to be transformed    */ | 
		
	
	
		
			
				
					|  |  |  | @ -434,44 +402,36 @@ double exponential(double h); | 
		
	
		
			
				|  |  |  |  | /*workr: utility real part vector for storage         */ | 
		
	
		
			
				|  |  |  |  | /*worki: utility imaginary part vector for storage    */ | 
		
	
		
			
				|  |  |  |  | /*The transformed data are returned in datar and datai*/ | 
		
	
		
			
				|  |  |  |  | void fourt(double *datar,double *datai, int nn[3], int ndim, int ifrwd, int icplx,double *workr,double *worki); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void fourt(double* datar, double* datai, int nn[3], int ndim, int ifrwd, int icplx, double* workr, double* worki); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*calculates F(x) = (1/a)*exp(-x*x/2)*/ | 
		
	
		
			
				|  |  |  |  | double funtrun1(double x); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*cumulative standard normal value*/ | 
		
	
		
			
				|  |  |  |  | float G(float x); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*gamma covariance value for lag h and exponent alpha*/ | 
		
	
		
			
				|  |  |  |  | double gammf(double h, double alpha); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*returns the value ln(G(x))*/ | 
		
	
		
			
				|  |  |  |  | float gammln(float xx); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*incomplete gamma fnction*/ | 
		
	
		
			
				|  |  |  |  | float gammp(float a, float x); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*returns a normally distributed deviate with 0 mean*/ | 
		
	
		
			
				|  |  |  |  | /*and unit variance, using ran1(idum) as the source */ | 
		
	
		
			
				|  |  |  |  | /*of uniform deviates                               */ | 
		
	
		
			
				|  |  |  |  | /*idum: seed                                        */ | 
		
	
		
			
				|  |  |  |  | double gasdev(long *idum, long *idum2, long *iy, long *iv, int *iset); | 
		
	
		
			
				|  |  |  |  | double gasdev(long* idum, long* idum2, long* iy, long* iv, int* iset); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*gaussian covariance value for lag h*/ | 
		
	
		
			
				|  |  |  |  | double gaussian(double h); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*incomplete gamma function evaluated by its continued */ | 
		
	
		
			
				|  |  |  |  | /*fraction represented as gammcf, also returns ln(G(a))*/ | 
		
	
		
			
				|  |  |  |  | /*as gln                                               */ | 
		
	
		
			
				|  |  |  |  | void gcf(float *gammcf, float a, float x, float *gln); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void gcf(float* gammcf, float a, float x, float* gln); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*computation of the covariance matrix for the well data*/ | 
		
	
		
			
				|  |  |  |  | /*well coordinates have no specific unit                */ | 
		
	
	
		
			
				
					|  |  |  | @ -482,8 +442,7 @@ void gcf(float *gammcf, float a, float x, float *gln); | 
		
	
		
			
				|  |  |  |  | /*and k = j+i(i+1)/2                                    */ | 
		
	
		
			
				|  |  |  |  | /*variogram: structure defined above                    */ | 
		
	
		
			
				|  |  |  |  | /*well: structure defined above                         */ | 
		
	
		
			
				|  |  |  |  | void gen_cov_matrix(double *C, struct vario_mod variogram, struct welldata_mod well, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void gen_cov_matrix(double* C, struct vario_mod variogram, struct welldata_mod well, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*Ginv                                                  */ | 
		
	
		
			
				|  |  |  |  | /*Computes the inverse of the standard normal cumulative*/ | 
		
	
	
		
			
				
					|  |  |  | @ -494,7 +453,6 @@ void gen_cov_matrix(double *C, struct vario_mod variogram, struct welldata_mod w | 
		
	
		
			
				|  |  |  |  | /*p: cumulative probability value                       */ | 
		
	
		
			
				|  |  |  |  | float Ginv(float p); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*gradual combination of 1 realization + Nadded  */ | 
		
	
		
			
				|  |  |  |  | /*complementary realizations                     */ | 
		
	
		
			
				|  |  |  |  | /*rho: gradual deformation parameters            */ | 
		
	
	
		
			
				
					|  |  |  | @ -510,8 +468,7 @@ float Ginv(float p); | 
		
	
		
			
				|  |  |  |  | /*n: number of components per realization        */ | 
		
	
		
			
				|  |  |  |  | /*NZONES: number of subregions                   */ | 
		
	
		
			
				|  |  |  |  | /*grid: grid definition                          */ | 
		
	
		
			
				|  |  |  |  | void gradual(struct grad_mod grad,float *Zo,float *Z,float *Zfinal,int n,struct grid_mod grid); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void gradual(struct grad_mod grad, float* Zo, float* Z, float* Zfinal, int n, struct grid_mod grid); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*computes the size of the underlying grid for FFTs*/ | 
		
	
		
			
				|  |  |  |  | /*input:                                           */ | 
		
	
	
		
			
				
					|  |  |  | @ -526,8 +483,7 @@ void cgrid(struct vario_mod variogram, struct grid_mod grid, int n[3]); | 
		
	
		
			
				|  |  |  |  | /*incomplete gamma function evaluated by its series*/ | 
		
	
		
			
				|  |  |  |  | /*representation as gamser, also returns ln(G(a))  */ | 
		
	
		
			
				|  |  |  |  | /*as gln                                           */ | 
		
	
		
			
				|  |  |  |  | void gser(float *gamser, float a, float x, float *gln); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void gser(float* gamser, float a, float x, float* gln); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*calculates x so that x = invF(u)               */ | 
		
	
		
			
				|  |  |  |  | /*F is the cumulative density function for the   */ | 
		
	
	
		
			
				
					|  |  |  | @ -538,18 +494,16 @@ void gser(float *gamser, float a, float x, float *gln); | 
		
	
		
			
				|  |  |  |  | /*C: normalizing constant                        */ | 
		
	
		
			
				|  |  |  |  | double invtrun1(double u, double lim_inf, double lim_sup, double C); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*computes the kriging mean and variance*/ | 
		
	
		
			
				|  |  |  |  | /*for the vector bi, i = [0...n-1]      */ | 
		
	
		
			
				|  |  |  |  | void krig_stat(float *b, int n, struct vario_mod variogram, struct welldata_mod well, float *mean, float *var); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void krig_stat(float* b, int n, struct vario_mod variogram, struct welldata_mod well, float* mean, float* var); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* computes the number of gridblocks for one dimension*/ | 
		
	
		
			
				|  |  |  |  | /*N: initial number of gridblocks                     */ | 
		
	
		
			
				|  |  |  |  | /*i: considered direction                             */ | 
		
	
		
			
				|  |  |  |  | /*scf: correlation length                             */ | 
		
	
		
			
				|  |  |  |  | /*ap: normalized anisotropy axes                      */ | 
		
	
		
			
				|  |  |  |  | int length(int N, int i, double *scf, double *ap, double D, int Nvari); | 
		
	
		
			
				|  |  |  |  | int length(int N, int i, double* scf, double* ap, double D, int Nvari); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*calculates L.Z/
 | 
		
	
		
			
				|  |  |  |  | /* L     : lower triangular matrix recorded            */ | 
		
	
	
		
			
				
					|  |  |  | @ -560,7 +514,7 @@ int length(int N, int i, double *scf, double *ap, double D, int Nvari); | 
		
	
		
			
				|  |  |  |  | /* n     : dimension of matrix Lij                     */ | 
		
	
		
			
				|  |  |  |  | /*                                                     */ | 
		
	
		
			
				|  |  |  |  | /* The solution vector is returned in b                */ | 
		
	
		
			
				|  |  |  |  | void LtimeZ(double *L, float *Z, float *b, int n); | 
		
	
		
			
				|  |  |  |  | void LtimeZ(double* L, float* Z, float* b, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*determines the greatest prime factor of an integer*/ | 
		
	
		
			
				|  |  |  |  | int maxfactor(int n); | 
		
	
	
		
			
				
					|  |  |  | @ -570,40 +524,32 @@ int maxfactor(int n); | 
		
	
		
			
				|  |  |  |  | /*defined by the probability ratio "ratio".            */ | 
		
	
		
			
				|  |  |  |  | /*If ratio >= 1, metrop = 1(true), while if ratio < 1, */ | 
		
	
		
			
				|  |  |  |  | /*metrop is only true with probability "ratio"         */ | 
		
	
		
			
				|  |  |  |  | int metrop(double ratio,long *idum,long *idum2, long *iy, long *iv); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | int metrop(double ratio, long* idum, long* idum2, long* iy, long* iv); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*2-norm of vector b                 */ | 
		
	
		
			
				|  |  |  |  | /* b : vector                        */ | 
		
	
		
			
				|  |  |  |  | /* n : length of b, bi, i = [0...n-1]*/ | 
		
	
		
			
				|  |  |  |  | /*returns the norm of b              */ | 
		
	
		
			
				|  |  |  |  | double norm(double *b,int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | double norm(double* b, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*value of g(x) where g is the normal function*/ | 
		
	
		
			
				|  |  |  |  | double normal(double x); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*nugget covariance value for lag h*/ | 
		
	
		
			
				|  |  |  |  | double nugget(double h); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*power covariance value for lag h and exponent alpha*/ | 
		
	
		
			
				|  |  |  |  | double power(double h,double alpha); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | double power(double h, double alpha); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*generates uniform deviates between 0 and 1*/ | 
		
	
		
			
				|  |  |  |  | /*idum: seed                                */ | 
		
	
		
			
				|  |  |  |  | double ran2(long *idum, long *idum2, long *iy, long *iv); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | double ran2(long* idum, long* idum2, long* iy, long* iv); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*calculates bt.b                */ | 
		
	
		
			
				|  |  |  |  | /* b : vector, bi, i = [0...n-1] */ | 
		
	
		
			
				|  |  |  |  | /* n : length of b               */ | 
		
	
		
			
				|  |  |  |  | /*returns the scalar product of b*/ | 
		
	
		
			
				|  |  |  |  | double scal_vec(double *b,int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | double scal_vec(double* b, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*solves the set of n linear equations Cx = D           */ | 
		
	
		
			
				|  |  |  |  | /* C     : symmetric positive-definite matrix recorded  */ | 
		
	
	
		
			
				
					|  |  |  | @ -614,32 +560,26 @@ double scal_vec(double *b,int n); | 
		
	
		
			
				|  |  |  |  | /*                                                      */ | 
		
	
		
			
				|  |  |  |  | /* The solution vector is returned in D                 */ | 
		
	
		
			
				|  |  |  |  | /* CONJUGATE GRADIENT method                            */ | 
		
	
		
			
				|  |  |  |  | void solve3(double *C, double *D, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void solve3(double* C, double* D, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*sorts an array [0...n-1] into ascending order using */ | 
		
	
		
			
				|  |  |  |  | /*shell                                               */ | 
		
	
		
			
				|  |  |  |  | void sort(float n, float *arr); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void sort(float n, float* arr); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*spherical covariance value for lag h*/ | 
		
	
		
			
				|  |  |  |  | double spherical(double h); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*stable covariance value for lag h and exponent alpha*/ | 
		
	
		
			
				|  |  |  |  | double stable(double h, double alpha); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*conversion of log mean and variance to nor*/ | 
		
	
		
			
				|  |  |  |  | void statlog2nor(struct statistic_mod *pstat); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void statlog2nor(struct statistic_mod* pstat); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*tries factor                               */ | 
		
	
		
			
				|  |  |  |  | /*pnum: number to be decomposed              */ | 
		
	
		
			
				|  |  |  |  | /*fact: suggested factor                     */ | 
		
	
		
			
				|  |  |  |  | /*pmaxfac: memory to keep the greatest factor*/ | 
		
	
		
			
				|  |  |  |  | int test_fact(int *pnum, int fact, int *pmaxfac); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | int test_fact(int* pnum, int fact, int* pmaxfac); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*calculates the integrale of an approximate function*/ | 
		
	
		
			
				|  |  |  |  | /*for the Gaussian function over an interval defined */ | 
		
	
	
		
			
				
					|  |  |  | @ -648,29 +588,25 @@ int test_fact(int *pnum, int fact, int *pmaxfac); | 
		
	
		
			
				|  |  |  |  | /*lim_sup: upper bound of the considered interval    */ | 
		
	
		
			
				|  |  |  |  | double trun1(double lim_inf, double lim_sup); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*draws a truncated gaussian variable between lim_inf*/ | 
		
	
		
			
				|  |  |  |  | /*and lim_sup                                        */ | 
		
	
		
			
				|  |  |  |  | /*idum: seed                                         */ | 
		
	
		
			
				|  |  |  |  | double trungasdev(long *idum,double lim_inf,double lim_sup,long *idum2, long *iy, long iv[NTAB]); | 
		
	
		
			
				|  |  |  |  | double trungasdev(long* idum, double lim_inf, double lim_sup, long* idum2, long* iy, long iv[NTAB]); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /* tb1.b2                                    */ | 
		
	
		
			
				|  |  |  |  | /* b1 : vector                               */ | 
		
	
		
			
				|  |  |  |  | /* b2 : vector                               */ | 
		
	
		
			
				|  |  |  |  | /* n : length of b1 and b2, bi, i = [0...n-1]*/ | 
		
	
		
			
				|  |  |  |  | /*returns the norm the product tb1.b2        */ | 
		
	
		
			
				|  |  |  |  | double vec_vec(double *b1, double *b2,int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | double vec_vec(double* b1, double* b2, int n); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /*turns the volume fractions into Gaussian thresholds  */ | 
		
	
		
			
				|  |  |  |  | /*facies: structure defined above                      */ | 
		
	
		
			
				|  |  |  |  | /*thresholds: output threshold vector fot i = [0...n-1]*/ | 
		
	
		
			
				|  |  |  |  | /*where n is the number of facies-1                    */ | 
		
	
		
			
				|  |  |  |  | /*USES normal*/ | 
		
	
		
			
				|  |  |  |  | void vf2gthres(struct statfacies_mod facies,float *thresholds); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void polint(float xa[],float ya[],int n,float x, float *y,float *dy); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void vf2gthres(struct statfacies_mod facies, float* thresholds); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void polint(float xa[], float ya[], int n, float x, float* y, float* dy); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | #endif | 
		
	
	
		
			
				
					|  |  |  | 
 |