From 4fd1d5ddc69b6fae21c6795e5650ce8f146ea475 Mon Sep 17 00:00:00 2001 From: chortas Date: Wed, 1 Dec 2021 20:16:51 -0300 Subject: [PATCH] Linter to c files --- fftma_module/gen/include/Py_py-api.h | 19 +- fftma_module/gen/include/condor.h | 94 ++++------ fftma_module/gen/include/genlib.h | 38 ++-- fftma_module/gen/include/geostat.h | 238 +++++++++--------------- fftma_module/gen/include/pressure.h | 7 +- fftma_module/gen/include/random.h | 2 +- fftma_module/gen/include/scanadt.h | 5 +- fftma_module/gen/include/simpio.h | 2 +- fftma_module/gen/include/stack.h | 4 +- fftma_module/gen/include/symtab.h | 12 +- fftma_module/gen/include/toolsFFTMA.h | 13 +- fftma_module/gen/include/toolsFFTPSIM.h | 9 +- fftma_module/gen/include/toolsIO.h | 7 +- fftma_module/gen/moduleFFTMA.c | 79 ++++---- 14 files changed, 214 insertions(+), 315 deletions(-) mode change 100755 => 100644 fftma_module/gen/include/condor.h mode change 100755 => 100644 fftma_module/gen/include/genlib.h mode change 100755 => 100644 fftma_module/gen/include/geostat.h mode change 100755 => 100644 fftma_module/gen/include/pressure.h mode change 100755 => 100644 fftma_module/gen/include/random.h mode change 100755 => 100644 fftma_module/gen/include/scanadt.h mode change 100755 => 100644 fftma_module/gen/include/simpio.h mode change 100755 => 100644 fftma_module/gen/include/stack.h mode change 100755 => 100644 fftma_module/gen/include/symtab.h mode change 100755 => 100644 fftma_module/gen/include/toolsFFTMA.h mode change 100755 => 100644 fftma_module/gen/include/toolsFFTPSIM.h mode change 100755 => 100644 fftma_module/gen/include/toolsIO.h mode change 100755 => 100644 fftma_module/gen/moduleFFTMA.c diff --git a/fftma_module/gen/include/Py_py-api.h b/fftma_module/gen/include/Py_py-api.h index b224b2e..d67020a 100644 --- a/fftma_module/gen/include/Py_py-api.h +++ b/fftma_module/gen/include/Py_py-api.h @@ -1,16 +1,15 @@ -#include -#include -#include -#include -#include -#include -#include #include "genlib.h" -#include "simpio.h" #include "geostat.h" #include "pressure.h" +#include "simpio.h" #include "toolsIO.h" - +#include +#include +#include +#include +#include +#include +#include int Py_getvalues(PyObject*, long*, struct grid_mod*, struct vario_mod*, struct statistic_mod*); -void Py_kgeneration(long,struct grid_mod,struct statistic_mod,struct vario_mod,struct realization_mod*,struct realization_mod*,struct realization_mod*, int [3]); +void Py_kgeneration(long, struct grid_mod, struct statistic_mod, struct vario_mod, struct realization_mod*, struct realization_mod*, struct realization_mod*, int[3]); diff --git a/fftma_module/gen/include/condor.h b/fftma_module/gen/include/condor.h old mode 100755 new mode 100644 index e787744..310a594 --- a/fftma_module/gen/include/condor.h +++ b/fftma_module/gen/include/condor.h @@ -3,8 +3,6 @@ #ifndef _CONDOR_H_ #define _CONDOR_H_ - - /*=======================================================*/ /*FUNCTIONS*/ /*---------*/ @@ -23,8 +21,7 @@ /*grid: structure defining the grid */ /*OUTPUT */ /*realout: structure defining the output realization */ -void condit(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct realization_mod *realout); - +void condit(int k, struct welldata_mod well, struct vario_mod variogram, struct grid_mod grid, struct realization_mod* realin, struct realization_mod* realout); /*d_kriging */ /*interpolation from ponctual data with simple dual */ @@ -38,8 +35,7 @@ void condit(int k,struct welldata_mod well,struct vario_mod variogram,struct gri /*grid: structure defining the grid */ /*OUTPUT */ /*realout: structure defining the output realization */ -void d_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realout); - +void d_kriging(int k, struct welldata_mod well, struct vario_mod variogram, struct grid_mod grid, struct realization_mod* realout); /*dual_condit */ /*conditioning of a Gaussian realization using */ @@ -54,8 +50,7 @@ void d_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct /*realin: structure defining the input realization */ /*OUTPUT */ /*realout: structure defining the output realization */ -void dual_condit(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct realization_mod *realout); - +void dual_condit(int k, struct welldata_mod well, struct vario_mod variogram, struct grid_mod grid, struct realization_mod* realin, struct realization_mod* realout); /*dual_condit_gen */ /*conditioning of a Gaussian realization using */ @@ -73,7 +68,7 @@ void dual_condit(int k,struct welldata_mod well,struct vario_mod variogram,struc /*OUTPUT */ /*realout: structure defining the output realization */ -void dual_condit_gen(int k,struct welldata_mod wellin,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct statistic_mod stat, struct realization_mod *realout); +void dual_condit_gen(int k, struct welldata_mod wellin, struct vario_mod variogram, struct grid_mod grid, struct realization_mod* realin, struct statistic_mod stat, struct realization_mod* realout); /*FAST FOURIER TRANSFORM MOVING AVERAGE METHOD */ /*PLUS GRADIENT CALCULATIONS - GRADIENTS ARE */ @@ -99,19 +94,17 @@ void dual_condit_gen(int k,struct welldata_mod wellin,struct vario_mod variogram /*------- */ /*realout: structure defining a realization - */ /*DYoverDRHO : structure with the output gradients */ -void FFTMA_gradient(struct vario_mod variogram,struct grid_mod grid,int n[3],struct realization_mod *realin,struct gradients_mod *DZoverDRHO,struct realization_mod *realout,struct gradients_mod *DYoverDRHO); - +void FFTMA_gradient(struct vario_mod variogram, struct grid_mod grid, int n[3], struct realization_mod* realin, struct gradients_mod* DZoverDRHO, struct realization_mod* realout, struct gradients_mod* DYoverDRHO); /* GENERATION OF A GAUSSIAN WHITE NOISE VECTOR */ /*input: */ /* seed: seed */ /* n: number of components in the vector */ -/*output: */ +/*output: */ /* realization: structure defining the realization*/ -void generate(long *seed, int n, struct realization_mod *realization); - -void ikrig(int option, struct statfacies_mod facies, int kk,struct welldata_mod data, struct variotable_mod variogram,struct grid_mod grid,float *krigout); +void generate(long* seed, int n, struct realization_mod* realization); +void ikrig(int option, struct statfacies_mod facies, int kk, struct welldata_mod data, struct variotable_mod variogram, struct grid_mod grid, float* krigout); /*kriging */ /*interpolation from ponctual data with simple */ @@ -125,8 +118,7 @@ void ikrig(int option, struct statfacies_mod facies, int kk,struct welldata_mod /*grid: structure defining the grid */ /*OUTPUT */ /*realout: structure defining the output realization */ -void kriging(int k,struct welldata_mod data,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realout); - +void kriging(int k, struct welldata_mod data, struct vario_mod variogram, struct grid_mod grid, struct realization_mod* realout); /*CHOLESKY SIMULATION TECHNIQUE - LUSIM */ /*appropriate for regular grids and small number */ @@ -137,10 +129,9 @@ void kriging(int k,struct welldata_mod data,struct vario_mod variogram,struct gr /* must be a Gaussian white noise */ /*output: */ /*realout: structure defining a realization - */ -void LUSIM(struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct realization_mod *realout); +void LUSIM(struct vario_mod variogram, struct grid_mod grid, struct realization_mod* realin, struct realization_mod* realout); - -void nor2any(struct cdf_mod *pcumulf,struct realization_mod *realin,struct realization_mod *realout); +void nor2any(struct cdf_mod* pcumulf, struct realization_mod* realin, struct realization_mod* realout); /*TURNS NORMAL NUMBERS INTO LOGNORMAL NUMBERS */ /*input: */ @@ -151,8 +142,7 @@ void nor2any(struct cdf_mod *pcumulf,struct realization_mod *realin,struct reali /*output: */ /*realout: structure defining a realization - */ /* lognormal numbers */ -void nor2log(struct realization_mod *realin, int typelog, struct realization_mod *realout); - +void nor2log(struct realization_mod* realin, int typelog, struct realization_mod* realout); /*TURNS NORMAL NUMBERS INTO UNIFORM NUMBERS */ /*input: */ @@ -161,8 +151,7 @@ void nor2log(struct realization_mod *realin, int typelog, struct realization_mod /*output: */ /*realout: structure defining a realization - */ /* uniform numbers */ -void nor2unif(struct realization_mod *realin,struct realization_mod *realout); - +void nor2unif(struct realization_mod* realin, struct realization_mod* realout); /*o_kriging */ /*interpolation from ponctual data with ordinary kriging */ @@ -175,8 +164,7 @@ void nor2unif(struct realization_mod *realin,struct realization_mod *realout); /*grid: structure defining the grid */ /*OUTPUT */ /*realout: structure defining the kriged realization */ -void o_kriging(int k,struct vario_mod variogram,struct welldata_mod data,struct grid_mod grid,struct realization_mod *realout); - +void o_kriging(int k, struct vario_mod variogram, struct welldata_mod data, struct grid_mod grid, struct realization_mod* realout); /*od_kriging */ /*interpolation from ponctual data with ordinary dual*/ @@ -190,8 +178,7 @@ void o_kriging(int k,struct vario_mod variogram,struct welldata_mod data,struct /*grid: structure defining the grid */ /*OUTPUT */ /*realout: structure defining the output realization */ -void od_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realout); - +void od_kriging(int k, struct welldata_mod well, struct vario_mod variogram, struct grid_mod grid, struct realization_mod* realout); /*PLURIGAUSSIAN METHOD */ /*Starting from two independent Gaussian realizations Y1*/ @@ -209,11 +196,10 @@ void od_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct /* whole reservoir model */ /*ineq: structure defining the mask for truncation */ /*Y1: first starting Gaussian realization */ -/*Y2: second starting realization - same length as Y1 */ +/*Y2: second starting realization - same length as Y1 */ /*OUTPUT: */ /*Y: output realization */ -void plurigau(struct statfacies_mod facies,struct inequalities_mod ineq,struct realization_mod *Y1, struct realization_mod *Y2, struct realization_mod *Y); - +void plurigau(struct statfacies_mod facies, struct inequalities_mod ineq, struct realization_mod* Y1, struct realization_mod* Y2, struct realization_mod* Y); /*tr_kriging */ /*kriging with an external drift */ @@ -229,8 +215,7 @@ void plurigau(struct statfacies_mod facies,struct inequalities_mod ineq,struct r /*y: secondary external variable */ /*OUTPUT: */ /*realout: kriged realization */ -void tr_kriging(int k, struct vario_mod variogram,struct welldata_mod data,struct grid_mod grid,struct realization_mod *Y,struct realization_mod *realout); - +void tr_kriging(int k, struct vario_mod variogram, struct welldata_mod data, struct grid_mod grid, struct realization_mod* Y, struct realization_mod* realout); /*truncat */ /*TRUNCATES A STANDARD GAUSSIAN REALIZATION */ @@ -246,8 +231,7 @@ void tr_kriging(int k, struct vario_mod variogram,struct welldata_mod data,struc /*realout: structure defining a realization - */ /*thresholds: Gaussian thresholds corresponding*/ /* to the facies volume fractions if*/ -void truncat(struct statfacies_mod facies,struct realization_mod *realin,struct realization_mod *realout, struct statfacies_mod *thresholds); - +void truncat(struct statfacies_mod facies, struct realization_mod* realin, struct realization_mod* realout, struct statfacies_mod* thresholds); /*TURNS UNIFORM NUMBERS INTO NORMAL NUMBERS*/ /*INPUT: */ @@ -256,8 +240,7 @@ void truncat(struct statfacies_mod facies,struct realization_mod *realin,struct /*OUTPUT: */ /*realout: structure defining a realization - */ /* must have zero mean and unit variance */ -void unif2nor(struct realization_mod *realin,struct realization_mod *realout); - +void unif2nor(struct realization_mod* realin, struct realization_mod* realout); /*Wany2nor */ /*converts any kind of continuous data to Gaussian data*/ @@ -269,8 +252,7 @@ void unif2nor(struct realization_mod *realin,struct realization_mod *realout); /*wellout: structure with the output well data */ /*pcumulf: structure describing the experimental */ /* cumulative distribution */ -void Wany2nor(int k, struct welldata_mod wellin, long *seed,struct welldata_mod *wellout, struct cdf_mod *pcumulf); - +void Wany2nor(int k, struct welldata_mod wellin, long* seed, struct welldata_mod* wellout, struct cdf_mod* pcumulf); /*Wfac2nor0 */ /*turns the facies well measurements into Gaussian data */ @@ -287,9 +269,8 @@ void Wany2nor(int k, struct welldata_mod wellin, long *seed,struct welldata_mod /*seed: seed */ /*output: */ /*wellout: structure defining well data - the kth vector*/ -/*of measures are converted to standard normal data */ -void Wfac2nor0(int k,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,struct welldata_mod *wellout); - +/*of measures are converted to standard normal data */ +void Wfac2nor0(int k, struct grid_mod grid, struct welldata_mod wellin, struct statfacies_mod facies, long* seed, struct welldata_mod* wellout); /*Wfac2nor1 */ /*turns the facies well measurements into Gaussian data */ @@ -308,8 +289,7 @@ void Wfac2nor0(int k,struct grid_mod grid,struct welldata_mod wellin,struct stat /*output: */ /*wellout: structure defining well data - the kth vector*/ /*of measures are converted to standard normal data */ -void Wfac2nor1(int k,struct vario_mod variogram,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,struct welldata_mod *wellout); - +void Wfac2nor1(int k, struct vario_mod variogram, struct grid_mod grid, struct welldata_mod wellin, struct statfacies_mod facies, long* seed, struct welldata_mod* wellout); /*Wfac2norPG0 */ /*turns the facies well measurements into Gaussian data */ @@ -332,8 +312,7 @@ void Wfac2nor1(int k,struct vario_mod variogram,struct grid_mod grid,struct well /*OUTPUT: */ /*wellout: structure defining well data - the kth vector*/ /*of measures are converted to standard normal data */ -void Wfac2norPG0(int k,struct inequalities_mod ineq,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,int idreal,struct welldata_mod *wellout); - +void Wfac2norPG0(int k, struct inequalities_mod ineq, struct grid_mod grid, struct welldata_mod wellin, struct statfacies_mod facies, long* seed, int idreal, struct welldata_mod* wellout); /*Wfac2norPG1 */ /*turns the facies well measurements into Gaussian data */ @@ -361,8 +340,7 @@ void Wfac2norPG0(int k,struct inequalities_mod ineq,struct grid_mod grid,struct /*realization 1 - the kth vector */ /*wellout2: structure with converted well data for */ /*realization 2 - the kth vector */ -void Wfac2norPG1(int k,struct inequalities_mod ineq,struct vario_mod variogram1,struct vario_mod variogram2,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,struct welldata_mod *wellout1,struct welldata_mod *wellout2); - +void Wfac2norPG1(int k, struct inequalities_mod ineq, struct vario_mod variogram1, struct vario_mod variogram2, struct grid_mod grid, struct welldata_mod wellin, struct statfacies_mod facies, long* seed, struct welldata_mod* wellout1, struct welldata_mod* wellout2); /*Wlog2nor */ /*turns the log well measurements into std Gaussian data*/ @@ -376,12 +354,11 @@ void Wfac2norPG1(int k,struct inequalities_mod ineq,struct vario_mod variogram1, /*stat: structure defining the statistics */ /*output: */ /*wellout: structure defining well data - the kth vector*/ -/*of measures are converted to standard normal data */ -void Wlog2nor(int k, struct welldata_mod wellin,struct grid_mod grid,struct statistic_mod stat,struct welldata_mod *wellout); - +/*of measures are converted to standard normal data */ +void Wlog2nor(int k, struct welldata_mod wellin, struct grid_mod grid, struct statistic_mod stat, struct welldata_mod* wellout); /*Wnor2nor */ -/*converts Well Normal numbers to the standard Gaussian */ +/*converts Well Normal numbers to the standard Gaussian */ /*input: */ /*k: type measurement, may be 1,2,3 ... or ntype */ /*wellin: structure defining well data */ @@ -389,20 +366,17 @@ void Wlog2nor(int k, struct welldata_mod wellin,struct grid_mod grid,struct stat /*stat: structure defining the statistics */ /*output: */ /*wellout: structure defining well data - the kth vector*/ -/*of measures are converted to standard normal data */ -void Wnor2nor(int k, struct welldata_mod wellin,struct grid_mod grid,struct statistic_mod stat,struct welldata_mod *wellout); - +/*of measures are converted to standard normal data */ +void Wnor2nor(int k, struct welldata_mod wellin, struct grid_mod grid, struct statistic_mod stat, struct welldata_mod* wellout); /*Wunif2nor */ -/*converts Well uniform numbers to the standard Gaussian*/ +/*converts Well uniform numbers to the standard Gaussian*/ /*input: */ /*k: type measurement, may be 1,2,3 ... or ntype */ /*wellin: structure defining well data */ /*output: */ /*wellout: structure defining well data - the kth vector*/ -/*of measures are converted to standard normal data */ -void Wunif2nor(int k, struct welldata_mod wellin,struct welldata_mod *wellout); - - +/*of measures are converted to standard normal data */ +void Wunif2nor(int k, struct welldata_mod wellin, struct welldata_mod* wellout); #endif // define _CONDOR_H_ diff --git a/fftma_module/gen/include/genlib.h b/fftma_module/gen/include/genlib.h old mode 100755 new mode 100644 index 4298ca7..c5ce749 --- a/fftma_module/gen/include/genlib.h +++ b/fftma_module/gen/include/genlib.h @@ -25,9 +25,9 @@ #ifndef _genlib_h #define _genlib_h +#include #include #include -#include /* Section 1 -- Define new "primitive" types */ @@ -45,20 +45,20 @@ */ #ifdef THINK_C - typedef int bool; +typedef int bool; +#else +#ifdef TRUE +#ifndef bool +#define bool int +#endif +#else +#ifdef bool +#define FALSE 0 +#define TRUE 1 #else -# ifdef TRUE -# ifndef bool -# define bool int -# endif -# else -# ifdef bool -# define FALSE 0 -# define TRUE 1 -# else // typedef enum {FALSE, TRUE} bool; -# endif -# endif +#endif +#endif #endif /* @@ -72,7 +72,7 @@ * Declaring it as a string emphasizes this atomicity. */ -typedef char *string; +typedef char* string; /* * Constant: UNDEFINED @@ -84,7 +84,7 @@ typedef char *string; * therefore inappropriate as a sentinel. */ -#define UNDEFINED ((void *) undefined_object) +#define UNDEFINED ((void*)undefined_object) extern char undefined_object[]; @@ -111,7 +111,7 @@ extern char undefined_object[]; * no memory is available, GetBlock generates an error. */ -void *GetBlock(size_t nbytes); +void* GetBlock(size_t nbytes); /* * Function: FreeBlock @@ -121,7 +121,7 @@ void *GetBlock(size_t nbytes); * have been allocated using GetBlock, New, or NewArray. */ -void FreeBlock(void *ptr); +void FreeBlock(void* ptr); /* * Macro: New @@ -135,7 +135,7 @@ void FreeBlock(void *ptr); * target type. */ -#define New(type) ((type) GetBlock(sizeof *((type) NULL))) +#define New(type) ((type)GetBlock(sizeof *((type)NULL))) /* * Macro: NewArray @@ -145,7 +145,7 @@ void FreeBlock(void *ptr); * values of the specified element type. */ -#define NewArray(n, type) ((type *) GetBlock((n) * sizeof(type))) +#define NewArray(n, type) ((type*)GetBlock((n) * sizeof(type))) /* Section 3 -- Basic error handling */ diff --git a/fftma_module/gen/include/geostat.h b/fftma_module/gen/include/geostat.h old mode 100755 new mode 100644 index df1b2c7..9b4b6a7 --- a/fftma_module/gen/include/geostat.h +++ b/fftma_module/gen/include/geostat.h @@ -1,8 +1,7 @@ -#include +#include #include +#include #include -#include - #ifndef _GEOSTAT_H #define _GEOSTAT_H @@ -27,7 +26,6 @@ /* cdf_mod */ /* realization_mod */ - /* List of functions: */ /* ------------------ */ @@ -36,7 +34,7 @@ /* cubic, cutspectr, deflimit, dual_kri */ /* exponential, fourt, funtrun1, G, gammf */ /* gammln, gammp, gasdev, gaussian, gcf, */ -/* gen_cov_matrix, Ginv, gradual, cgrid, */ +/* gen_cov_matrix, Ginv, gradual, cgrid, */ /* gser, invtrun1, krig_stat, length, */ /* LtimeZ, maxfactor, metrop, norm */ /* normal, nugget, power, ran2, scal_vect, */ @@ -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,20 +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*/ @@ -120,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 */ @@ -154,18 +141,16 @@ struct grid_mod { /* type 2 : */ /* 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 */ @@ -175,12 +160,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 */ @@ -203,14 +187,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 */ @@ -228,14 +211,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 */ @@ -246,12 +228,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 */ @@ -264,24 +245,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 */ @@ -302,9 +280,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; }; /*=====================================================*/ @@ -312,18 +290,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 */ @@ -331,8 +306,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*/ @@ -342,8 +316,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 */ @@ -352,7 +325,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 */ @@ -363,8 +336,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 */ @@ -383,12 +355,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 */ @@ -396,8 +367,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 */ @@ -406,8 +376,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 */ @@ -417,14 +386,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 */ @@ -435,44 +401,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))*/ +/*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 */ @@ -483,19 +441,17 @@ 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*/ -/*distribution function with a numerical approximation */ +/*distribution function with a numerical approximation */ /*from Statistical Computing,by W.J. Kennedy, Jr. and */ /*James E. Gentle, 1980, p. 95. */ /*input : */ /*p: cumulative probability value */ float Ginv(float p); - /*gradual combination of 1 realization + Nadded */ /*complementary realizations */ /*rho: gradual deformation parameters */ @@ -511,8 +467,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: */ @@ -525,10 +480,9 @@ void gradual(struct grad_mod grad,float *Zo,float *Z,float *Zfinal,int n,struct 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)) */ +/*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 */ @@ -539,18 +493,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 */ @@ -561,7 +513,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); @@ -571,40 +523,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 */ @@ -615,32 +559,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); - +/*shell */ +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 */ @@ -649,29 +587,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 diff --git a/fftma_module/gen/include/pressure.h b/fftma_module/gen/include/pressure.h old mode 100755 new mode 100644 index 826da7e..b6eb5e7 --- a/fftma_module/gen/include/pressure.h +++ b/fftma_module/gen/include/pressure.h @@ -1,7 +1,7 @@ -#include -#include #include "genlib.h" #include "geostat.h" +#include +#include #ifndef _PRESSURE_H #define _PRESSURE_H @@ -14,8 +14,7 @@ /* y: macroscopic gradient value in x direction */ /* z: macroscopic gradient value in x direction */ struct pressure_mod { - double x,y,z; + double x, y, z; }; - #endif // define _PRESSURE_H diff --git a/fftma_module/gen/include/random.h b/fftma_module/gen/include/random.h old mode 100755 new mode 100644 index 881af5f..167f890 --- a/fftma_module/gen/include/random.h +++ b/fftma_module/gen/include/random.h @@ -23,7 +23,7 @@ */ #ifndef RAND_MAX -# define RAND_MAX ((int) ((unsigned) ~0 >> 1)) +#define RAND_MAX ((int)((unsigned)~0 >> 1)) #endif /* diff --git a/fftma_module/gen/include/scanadt.h b/fftma_module/gen/include/scanadt.h old mode 100755 new mode 100644 index 1da09c3..eaa59b5 --- a/fftma_module/gen/include/scanadt.h +++ b/fftma_module/gen/include/scanadt.h @@ -60,7 +60,7 @@ * internal representation are hidden from the client. */ -typedef struct scannerCDT *scannerADT; +typedef struct scannerCDT* scannerADT; /* * Function: NewScanner @@ -151,7 +151,8 @@ void SaveToken(scannerADT scanner, string token); * of this option. */ -typedef enum { PreserveSpaces, IgnoreSpaces } spaceOptionT; +typedef enum { PreserveSpaces, + IgnoreSpaces } spaceOptionT; void SetScannerSpaceOption(scannerADT scanner, spaceOptionT option); spaceOptionT GetScannerSpaceOption(scannerADT scanner); diff --git a/fftma_module/gen/include/simpio.h b/fftma_module/gen/include/simpio.h old mode 100755 new mode 100644 index ca1efc9..133f2a4 --- a/fftma_module/gen/include/simpio.h +++ b/fftma_module/gen/include/simpio.h @@ -70,6 +70,6 @@ string GetLine(void); * is at the end-of-file position. */ -string ReadLine(FILE *infile); +string ReadLine(FILE* infile); #endif diff --git a/fftma_module/gen/include/stack.h b/fftma_module/gen/include/stack.h old mode 100755 new mode 100644 index 2f765d1..e281990 --- a/fftma_module/gen/include/stack.h +++ b/fftma_module/gen/include/stack.h @@ -22,7 +22,7 @@ * be changed by editing this definition line. */ -typedef void *stackElementT; +typedef void* stackElementT; /* * Type: stackADT @@ -34,7 +34,7 @@ typedef void *stackElementT; * the underlying fields. */ -typedef struct stackCDT *stackADT; +typedef struct stackCDT* stackADT; /* * Function: NewStack diff --git a/fftma_module/gen/include/symtab.h b/fftma_module/gen/include/symtab.h old mode 100755 new mode 100644 index c83c307..c03b93b --- a/fftma_module/gen/include/symtab.h +++ b/fftma_module/gen/include/symtab.h @@ -15,7 +15,7 @@ * This type is the ADT used to represent a symbol table. */ -typedef struct symtabCDT *symtabADT; +typedef struct symtabCDT* symtabADT; /* * Type: symtabFnT @@ -24,8 +24,8 @@ typedef struct symtabCDT *symtabADT; * map over the entries in a symbol table. */ -typedef void (*symtabFnT)(string key, void *value, - void *clientData); +typedef void (*symtabFnT)(string key, void* value, + void* clientData); /* Exported entries */ @@ -55,7 +55,7 @@ void FreeSymbolTable(symtabADT table); * Each call to Enter supersedes any previous definition for key. */ -void Enter(symtabADT table, string key, void *value); +void Enter(symtabADT table, string key, void* value); /* * Function: Lookup @@ -65,7 +65,7 @@ void Enter(symtabADT table, string key, void *value); * table, or UNDEFINED, if no such value exists. */ -void *Lookup(symtabADT table, string key); +void* Lookup(symtabADT table, string key); /* * Function: MapSymbolTable @@ -80,6 +80,6 @@ void *Lookup(symtabADT table, string key); */ void MapSymbolTable(symtabFnT fn, symtabADT table, - void *clientData); + void* clientData); #endif diff --git a/fftma_module/gen/include/toolsFFTMA.h b/fftma_module/gen/include/toolsFFTMA.h old mode 100755 new mode 100644 index 58f5d8f..3e6fbce --- a/fftma_module/gen/include/toolsFFTMA.h +++ b/fftma_module/gen/include/toolsFFTMA.h @@ -1,7 +1,7 @@ -#include -#include #include "genlib.h" #include "geostat.h" +#include +#include #ifndef _TOOLSFFTMA_H #define _TOOLSFFTMA_H @@ -13,7 +13,6 @@ /* ------------------ */ /* kgeneration, FFTMA2, prebuild_gwn, build_real, , clean_real */ - /*FAST FOURIER TRANSFORM Pressure Simulation */ /*Turns a Gaussian white noise vector into a */ /*spatially correlated vector */ @@ -37,7 +36,7 @@ /*realout4: structure defining a yvelocity field */ /*realout5: structure defining a zvelocity field */ -void FFTMA2(struct vario_mod variogram,struct grid_mod grid,int n[3],struct realization_mod *realin,struct realization_mod *realout); +void FFTMA2(struct vario_mod variogram, struct grid_mod grid, int n[3], struct realization_mod* realin, struct realization_mod* realout); /* prebuild_gwn */ /* Produce a first construction in real space of the Gaussian white noise */ @@ -52,7 +51,7 @@ void FFTMA2(struct vario_mod variogram,struct grid_mod grid,int n[3],struct real /* must be a Gaussian white noise */ /*realization: structure defining a realization*/ -void prebuild_gwn(struct grid_mod grid,int n[3],struct realization_mod *realin,double *realization,int solver); +void prebuild_gwn(struct grid_mod grid, int n[3], struct realization_mod* realin, double* realization, int solver); /* build_real */ /* build a realization in the spectral domain */ @@ -66,8 +65,8 @@ void prebuild_gwn(struct grid_mod grid,int n[3],struct realization_mod *realin,d /*realization: vector defining the real part */ /*ireal: vector defining the i-part */ -void build_real(int n[3],int NTOT,double *covar,double *realization,double *ireal); +void build_real(int n[3], int NTOT, double* covar, double* realization, double* ireal); -void clean_real(struct realization_mod *realin,int n[3],struct grid_mod grid,double *vectorresult,struct realization_mod *realout); +void clean_real(struct realization_mod* realin, int n[3], struct grid_mod grid, double* vectorresult, struct realization_mod* realout); #endif // define _TOOLSFFTMA_H diff --git a/fftma_module/gen/include/toolsFFTPSIM.h b/fftma_module/gen/include/toolsFFTPSIM.h old mode 100755 new mode 100644 index 801a290..e15aeca --- a/fftma_module/gen/include/toolsFFTPSIM.h +++ b/fftma_module/gen/include/toolsFFTPSIM.h @@ -1,7 +1,6 @@ -#include #include "geostat.h" #include "pressure.h" - +#include #ifndef _TOOLSFFTPSIM_H #define _TOOLSFFTPSIM_H @@ -15,9 +14,9 @@ /*Functions */ /*----------*/ -void FFTPSim(struct vario_mod variogram,struct statistic_mod stat,struct grid_mod grid,int n[3],struct realization_mod *realin,struct pressure_mod gradient,struct realization_mod *realout,struct realization_mod *realout2,struct realization_mod *realout3,struct realization_mod *realout4,struct realization_mod *realout5); +void FFTPSim(struct vario_mod variogram, struct statistic_mod stat, struct grid_mod grid, int n[3], struct realization_mod* realin, struct pressure_mod gradient, struct realization_mod* realout, struct realization_mod* realout2, struct realization_mod* realout3, struct realization_mod* realout4, struct realization_mod* realout5); -void normAxes(double *vec, double *normed); -void waveVectorCompute1D(int n,double *vec); +void normAxes(double* vec, double* normed); +void waveVectorCompute1D(int n, double* vec); #endif // define _TOOLSFFTPSIM_H diff --git a/fftma_module/gen/include/toolsIO.h b/fftma_module/gen/include/toolsIO.h old mode 100755 new mode 100644 index 0a92d52..cd594ec --- a/fftma_module/gen/include/toolsIO.h +++ b/fftma_module/gen/include/toolsIO.h @@ -1,8 +1,8 @@ -#include -#include #include "genlib.h" #include "geostat.h" #include "pressure.h" +#include +#include #ifndef _TOOLSIO_H #define _TOOLSIO_H @@ -14,11 +14,10 @@ /* ------------------ */ /* testmemory */ - /*FUNCTIONS*/ /*----------*/ /* Allocation test */ -void testmemory(double *realint); +void testmemory(double* realint); #endif // define _TOOLSIO_H diff --git a/fftma_module/gen/moduleFFTMA.c b/fftma_module/gen/moduleFFTMA.c old mode 100755 new mode 100644 index 440f8e7..b5fa6b1 --- a/fftma_module/gen/moduleFFTMA.c +++ b/fftma_module/gen/moduleFFTMA.c @@ -1,20 +1,20 @@ -#include -#include -#include -#include -#include -#include -#include -#include #include "Py_py-api.h" -#include "genlib.h" -#include "simpio.h" #include "condor.h" +#include "genlib.h" #include "geostat.h" -#include "toolsIO.h" -#include "toolsFFTMA.h" #include "pressure.h" +#include "simpio.h" +#include "toolsFFTMA.h" #include "toolsFFTPSIM.h" +#include "toolsIO.h" +#include +#include +#include +#include +#include +#include +#include +#include #define NDIMENSIONS 3 /* Z is the GWN with 0-mean and 1-variance */ @@ -23,43 +23,38 @@ static PyObject* genFunc(PyObject* self, PyObject* args) { - int n[3]; - struct realization_mod Z,Y,Y1; - struct grid_mod grid; - struct vario_mod variogram; - long seed; - struct statistic_mod stat; - PyObject* out_array; - npy_intp out_dims[NPY_MAXDIMS]; - - if(!Py_getvalues(args, &seed, &grid, &variogram, &stat)) return NULL; - Py_kgeneration(seed,grid,stat,variogram,&Z,&Y,&Y1,n); - - out_dims[0]=grid.NZ; - out_dims[1]=grid.NY; - out_dims[2]=grid.NX; - + int n[3]; + struct realization_mod Z, Y, Y1; + struct grid_mod grid; + struct vario_mod variogram; + long seed; + struct statistic_mod stat; + PyObject* out_array; + npy_intp out_dims[NPY_MAXDIMS]; + if (!Py_getvalues(args, &seed, &grid, &variogram, &stat)) + return NULL; + Py_kgeneration(seed, grid, stat, variogram, &Z, &Y, &Y1, n); - out_array = PyArray_SimpleNewFromData(NDIMENSIONS,out_dims,NPY_DOUBLE,Y.vector); - if (out_array == NULL) - return NULL; + out_dims[0] = grid.NZ; + out_dims[1] = grid.NY; + out_dims[2] = grid.NX; - PyArray_ENABLEFLAGS(out_array, NPY_ARRAY_OWNDATA); + out_array = PyArray_SimpleNewFromData(NDIMENSIONS, out_dims, NPY_DOUBLE, Y.vector); + if (out_array == NULL) + return NULL; - return out_array; + PyArray_ENABLEFLAGS(out_array, NPY_ARRAY_OWNDATA); + return out_array; } - -static PyMethodDef FFTMAMethods[]= -{ - {"gen", genFunc, METH_VARARGS, "Generates a permeability 3D field."}, - {NULL, NULL, 0, NULL} +static PyMethodDef FFTMAMethods[] = { + { "gen", genFunc, METH_VARARGS, "Generates a permeability 3D field." }, + { NULL, NULL, 0, NULL } }; -static struct PyModuleDef cFFTMADef = -{ +static struct PyModuleDef cFFTMADef = { PyModuleDef_HEAD_INIT, "FFTMA", "", -1, @@ -69,6 +64,6 @@ static struct PyModuleDef cFFTMADef = PyMODINIT_FUNC PyInit_FFTMA(void) { - import_array(); - return PyModule_Create(&cFFTMADef); + import_array(); + return PyModule_Create(&cFFTMADef); }