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