Linter to c files

milestone_5_without_improvements
chortas 3 years ago
parent 83d7d29273
commit 4fd1d5ddc6

@ -1,16 +1,15 @@
#include <Python.h>
#include <numpy/arrayobject.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "genlib.h" #include "genlib.h"
#include "simpio.h"
#include "geostat.h" #include "geostat.h"
#include "pressure.h" #include "pressure.h"
#include "simpio.h"
#include "toolsIO.h" #include "toolsIO.h"
#include <Python.h>
#include <numpy/arrayobject.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int Py_getvalues(PyObject*, long*, struct grid_mod*, struct vario_mod*, struct statistic_mod*); 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]);

@ -3,8 +3,6 @@
#ifndef _CONDOR_H_ #ifndef _CONDOR_H_
#define _CONDOR_H_ #define _CONDOR_H_
/*=======================================================*/ /*=======================================================*/
/*FUNCTIONS*/ /*FUNCTIONS*/
/*---------*/ /*---------*/
@ -25,7 +23,6 @@
/*realout: structure defining the output realization */ /*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 */ /*d_kriging */
/*interpolation from ponctual data with simple dual */ /*interpolation from ponctual data with simple dual */
/*kriging. d_kriging is used to interpolate standard */ /*kriging. d_kriging is used to interpolate standard */
@ -40,7 +37,6 @@ void condit(int k,struct welldata_mod well,struct vario_mod variogram,struct gri
/*realout: structure defining the output realization */ /*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 */ /*dual_condit */
/*conditioning of a Gaussian realization using */ /*conditioning of a Gaussian realization using */
/*the dual kriging approach */ /*the dual kriging approach */
@ -56,7 +52,6 @@ void d_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct
/*realout: structure defining the output realization */ /*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 */ /*dual_condit_gen */
/*conditioning of a Gaussian realization using */ /*conditioning of a Gaussian realization using */
/*the dual kriging approach */ /*the dual kriging approach */
@ -101,7 +96,6 @@ void dual_condit_gen(int k,struct welldata_mod wellin,struct vario_mod variogram
/*DYoverDRHO : structure with the output gradients */ /*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 */ /* GENERATION OF A GAUSSIAN WHITE NOISE VECTOR */
/*input: */ /*input: */
/* seed: seed */ /* seed: seed */
@ -112,7 +106,6 @@ 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 ikrig(int option, struct statfacies_mod facies, int kk, struct welldata_mod data, struct variotable_mod variogram, struct grid_mod grid, float* krigout);
/*kriging */ /*kriging */
/*interpolation from ponctual data with simple */ /*interpolation from ponctual data with simple */
/*kriging. kriging is used to interpolate standard */ /*kriging. kriging is used to interpolate standard */
@ -127,7 +120,6 @@ void ikrig(int option, struct statfacies_mod facies, int kk,struct welldata_mod
/*realout: structure defining the output realization */ /*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 */ /*CHOLESKY SIMULATION TECHNIQUE - LUSIM */
/*appropriate for regular grids and small number */ /*appropriate for regular grids and small number */
/*of points */ /*of points */
@ -139,7 +131,6 @@ void kriging(int k,struct welldata_mod data,struct vario_mod variogram,struct gr
/*realout: structure defining a realization - */ /*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 */ /*TURNS NORMAL NUMBERS INTO LOGNORMAL NUMBERS */
@ -153,7 +144,6 @@ void nor2any(struct cdf_mod *pcumulf,struct realization_mod *realin,struct reali
/* lognormal numbers */ /* 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 */ /*TURNS NORMAL NUMBERS INTO UNIFORM NUMBERS */
/*input: */ /*input: */
/*realin: structure defining a realization - */ /*realin: structure defining a realization - */
@ -163,7 +153,6 @@ void nor2log(struct realization_mod *realin, int typelog, struct realization_mod
/* uniform numbers */ /* uniform numbers */
void nor2unif(struct realization_mod* realin, struct realization_mod* realout); void nor2unif(struct realization_mod* realin, struct realization_mod* realout);
/*o_kriging */ /*o_kriging */
/*interpolation from ponctual data with ordinary kriging */ /*interpolation from ponctual data with ordinary kriging */
/*o_kriging is used to interpolate standard Gaussian data*/ /*o_kriging is used to interpolate standard Gaussian data*/
@ -177,7 +166,6 @@ void nor2unif(struct realization_mod *realin,struct realization_mod *realout);
/*realout: structure defining the kriged realization */ /*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 */ /*od_kriging */
/*interpolation from ponctual data with ordinary dual*/ /*interpolation from ponctual data with ordinary dual*/
/*kriging. od_kriging is used to interpolate */ /*kriging. od_kriging is used to interpolate */
@ -192,7 +180,6 @@ void o_kriging(int k,struct vario_mod variogram,struct welldata_mod data,struct
/*realout: structure defining the output realization */ /*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 */ /*PLURIGAUSSIAN METHOD */
/*Starting from two independent Gaussian realizations Y1*/ /*Starting from two independent Gaussian realizations Y1*/
/*and Y2 with zero mean and unit variance, but possibly */ /*and Y2 with zero mean and unit variance, but possibly */
@ -214,7 +201,6 @@ void od_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct
/*Y: output realization */ /*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 */ /*tr_kriging */
/*kriging with an external drift */ /*kriging with an external drift */
/*The trend is limited to a 2-term function */ /*The trend is limited to a 2-term function */
@ -231,7 +217,6 @@ void plurigau(struct statfacies_mod facies,struct inequalities_mod ineq,struct r
/*realout: kriged realization */ /*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 */ /*truncat */
/*TRUNCATES A STANDARD GAUSSIAN REALIZATION */ /*TRUNCATES A STANDARD GAUSSIAN REALIZATION */
/*WITH THE TRUNCATED GAUSSIAN METHOD */ /*WITH THE TRUNCATED GAUSSIAN METHOD */
@ -248,7 +233,6 @@ void tr_kriging(int k, struct vario_mod variogram,struct welldata_mod data,struc
/* to the facies volume fractions if*/ /* 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*/ /*TURNS UNIFORM NUMBERS INTO NORMAL NUMBERS*/
/*INPUT: */ /*INPUT: */
/*realin: structure defining a realization - */ /*realin: structure defining a realization - */
@ -258,7 +242,6 @@ void truncat(struct statfacies_mod facies,struct realization_mod *realin,struct
/* must have zero mean and unit variance */ /* 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 */ /*Wany2nor */
/*converts any kind of continuous data to Gaussian data*/ /*converts any kind of continuous data to Gaussian data*/
/*INPUT: */ /*INPUT: */
@ -271,7 +254,6 @@ void unif2nor(struct realization_mod *realin,struct realization_mod *realout);
/* cumulative distribution */ /* 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 */ /*Wfac2nor0 */
/*turns the facies well measurements into Gaussian data */ /*turns the facies well measurements into Gaussian data */
/*intervals only are respected - spatial variability is */ /*intervals only are respected - spatial variability is */
@ -290,7 +272,6 @@ void Wany2nor(int k, struct welldata_mod wellin, long *seed,struct welldata_mod
/*of measures are converted to standard normal data */ /*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); void Wfac2nor0(int k, struct grid_mod grid, struct welldata_mod wellin, struct statfacies_mod facies, long* seed, struct welldata_mod* wellout);
/*Wfac2nor1 */ /*Wfac2nor1 */
/*turns the facies well measurements into Gaussian data */ /*turns the facies well measurements into Gaussian data */
/*Proceeds in 2 steps */ /*Proceeds in 2 steps */
@ -310,7 +291,6 @@ void Wfac2nor0(int k,struct grid_mod grid,struct welldata_mod wellin,struct stat
/*of measures are converted to standard normal data */ /*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 */ /*Wfac2norPG0 */
/*turns the facies well measurements into Gaussian data */ /*turns the facies well measurements into Gaussian data */
/*intervals only are respected - spatial variability is */ /*intervals only are respected - spatial variability is */
@ -334,7 +314,6 @@ void Wfac2nor1(int k,struct vario_mod variogram,struct grid_mod grid,struct well
/*of measures are converted to standard normal data */ /*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 */ /*Wfac2norPG1 */
/*turns the facies well measurements into Gaussian data */ /*turns the facies well measurements into Gaussian data */
/*Proceeds in 2 steps */ /*Proceeds in 2 steps */
@ -363,7 +342,6 @@ void Wfac2norPG0(int k,struct inequalities_mod ineq,struct grid_mod grid,struct
/*realization 2 - the kth vector */ /*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 */ /*Wlog2nor */
/*turns the log well measurements into std Gaussian data*/ /*turns the log well measurements into std Gaussian data*/
/*This step is required before performing kriging */ /*This step is required before performing kriging */
@ -379,7 +357,6 @@ void Wfac2norPG1(int k,struct inequalities_mod ineq,struct vario_mod variogram1,
/*of measures are converted to standard normal data */ /*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); void Wlog2nor(int k, struct welldata_mod wellin, struct grid_mod grid, struct statistic_mod stat, struct welldata_mod* wellout);
/*Wnor2nor */ /*Wnor2nor */
/*converts Well Normal numbers to the standard Gaussian */ /*converts Well Normal numbers to the standard Gaussian */
/*input: */ /*input: */
@ -392,7 +369,6 @@ void Wlog2nor(int k, struct welldata_mod wellin,struct grid_mod grid,struct stat
/*of measures are converted to standard normal data */ /*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); void Wnor2nor(int k, struct welldata_mod wellin, struct grid_mod grid, struct statistic_mod stat, struct welldata_mod* wellout);
/*Wunif2nor */ /*Wunif2nor */
/*converts Well uniform numbers to the standard Gaussian*/ /*converts Well uniform numbers to the standard Gaussian*/
/*input: */ /*input: */
@ -403,6 +379,4 @@ void Wnor2nor(int k, struct welldata_mod wellin,struct grid_mod grid,struct stat
/*of measures are converted to standard normal data */ /*of measures are converted to standard normal data */
void Wunif2nor(int k, struct welldata_mod wellin, struct welldata_mod* wellout); void Wunif2nor(int k, struct welldata_mod wellin, struct welldata_mod* wellout);
#endif // define _CONDOR_H_ #endif // define _CONDOR_H_

@ -25,9 +25,9 @@
#ifndef _genlib_h #ifndef _genlib_h
#define _genlib_h #define _genlib_h
#include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h>
/* Section 1 -- Define new "primitive" types */ /* Section 1 -- Define new "primitive" types */

@ -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 */
@ -75,8 +70,6 @@ struct vario_mod {
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 */
@ -104,11 +97,6 @@ struct variotable_mod {
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*/
@ -125,7 +113,6 @@ struct grid_mod {
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 */
@ -164,8 +151,6 @@ struct welldata_mod {
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 */
@ -180,7 +165,6 @@ struct statfacies_mod {
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 */
@ -210,7 +194,6 @@ struct inequalities_mod {
int* address_sY2; int* address_sY2;
}; };
/*statistical data */ /*statistical data */
/*type --> 0 : normal */ /*type --> 0 : normal */
/* --> 1 : natural log */ /* --> 1 : natural log */
@ -235,7 +218,6 @@ struct statistic_mod {
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 */
@ -251,7 +233,6 @@ struct grad_mod {
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 */
@ -268,8 +249,6 @@ struct gradients_mod {
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] */
@ -281,7 +260,6 @@ struct cdf_mod {
float* fx; float* fx;
}; };
/*realization */ /*realization */
/*n: number of components */ /*n: number of components */
/*code: status of the realization */ /*code: status of the realization */
@ -312,18 +290,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 */
@ -333,7 +308,6 @@ double cardsin(double h);
/* 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*/
/*maille = i[0]+1+i[1]*NX+i[2]*NX*NY */ /*maille = i[0]+1+i[1]*NX+i[2]*NX*NY */
@ -344,7 +318,6 @@ void choldc(double *C, int n);
/*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 */
/*covar: covariance array, vector of size*/ /*covar: covariance array, vector of size*/
@ -365,7 +338,6 @@ void covariance(double *covar,struct vario_mod variogram, struct grid_mod grid,
/*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 */
/*available variogram model: */ /*available variogram model: */
@ -388,7 +360,6 @@ 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 */
@ -398,7 +369,6 @@ double cubic(double h);
/*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 */
/*lim_sup: upper bound */ /*lim_sup: upper bound */
@ -408,7 +378,6 @@ void cutspectr(float *covar, int kx, int ky, int kz, int n[3]);
/*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 */
/*variogram: structure defining the variogram */ /*variogram: structure defining the variogram */
@ -419,12 +388,9 @@ void deflimit(double *plim_inf, double *plim_sup, float x, float *thresholds, st
/*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 */
@ -437,27 +403,21 @@ double exponential(double h);
/*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 */
@ -467,13 +427,11 @@ 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 */
/*The dimension of C is given by n */ /*The dimension of C is given by n */
@ -485,7 +443,6 @@ void gcf(float *gammcf, float a, float x, float *gln);
/*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*/
/*distribution function with a numerical approximation */ /*distribution function with a numerical approximation */
@ -495,7 +452,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 */
@ -513,7 +469,6 @@ float Ginv(float p);
/*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: */
/*variogram: structure defining the variogram model*/ /*variogram: structure defining the variogram model*/
@ -529,7 +484,6 @@ void cgrid(struct vario_mod variogram, struct grid_mod grid, int n[3]);
/*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 */
/*function approximating the Gaussian function */ /*function approximating the Gaussian function */
@ -539,12 +493,10 @@ 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 */
@ -573,39 +525,31 @@ int maxfactor(int n);
/*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 */
/* (per raws) as a vector with only components */ /* (per raws) as a vector with only components */
@ -617,31 +561,25 @@ double scal_vec(double *b,int n);
/* 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 */
/*by lim_inf and lim_sup */ /*by lim_inf and lim_sup */
@ -649,7 +587,6 @@ 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 */
@ -662,7 +599,6 @@ double trungasdev(long *idum,double lim_inf,double lim_sup,long *idum2, long *iy
/*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]*/
@ -672,6 +608,4 @@ 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

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include "genlib.h" #include "genlib.h"
#include "geostat.h" #include "geostat.h"
#include <stdlib.h>
#include <string.h>
#ifndef _PRESSURE_H #ifndef _PRESSURE_H
#define _PRESSURE_H #define _PRESSURE_H
@ -17,5 +17,4 @@ struct pressure_mod {
double x, y, z; double x, y, z;
}; };
#endif // define _PRESSURE_H #endif // define _PRESSURE_H

@ -151,7 +151,8 @@ void SaveToken(scannerADT scanner, string token);
* of this option. * of this option.
*/ */
typedef enum { PreserveSpaces, IgnoreSpaces } spaceOptionT; typedef enum { PreserveSpaces,
IgnoreSpaces } spaceOptionT;
void SetScannerSpaceOption(scannerADT scanner, spaceOptionT option); void SetScannerSpaceOption(scannerADT scanner, spaceOptionT option);
spaceOptionT GetScannerSpaceOption(scannerADT scanner); spaceOptionT GetScannerSpaceOption(scannerADT scanner);

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include "genlib.h" #include "genlib.h"
#include "geostat.h" #include "geostat.h"
#include <stdlib.h>
#include <string.h>
#ifndef _TOOLSFFTMA_H #ifndef _TOOLSFFTMA_H
#define _TOOLSFFTMA_H #define _TOOLSFFTMA_H
@ -13,7 +13,6 @@
/* ------------------ */ /* ------------------ */
/* kgeneration, FFTMA2, prebuild_gwn, build_real, , clean_real */ /* kgeneration, FFTMA2, prebuild_gwn, build_real, , clean_real */
/*FAST FOURIER TRANSFORM Pressure Simulation */ /*FAST FOURIER TRANSFORM Pressure Simulation */
/*Turns a Gaussian white noise vector into a */ /*Turns a Gaussian white noise vector into a */
/*spatially correlated vector */ /*spatially correlated vector */

@ -1,7 +1,6 @@
#include <string.h>
#include "geostat.h" #include "geostat.h"
#include "pressure.h" #include "pressure.h"
#include <string.h>
#ifndef _TOOLSFFTPSIM_H #ifndef _TOOLSFFTPSIM_H
#define _TOOLSFFTPSIM_H #define _TOOLSFFTPSIM_H

@ -1,8 +1,8 @@
#include <stdlib.h>
#include <string.h>
#include "genlib.h" #include "genlib.h"
#include "geostat.h" #include "geostat.h"
#include "pressure.h" #include "pressure.h"
#include <stdlib.h>
#include <string.h>
#ifndef _TOOLSIO_H #ifndef _TOOLSIO_H
#define _TOOLSIO_H #define _TOOLSIO_H
@ -14,7 +14,6 @@
/* ------------------ */ /* ------------------ */
/* testmemory */ /* testmemory */
/*FUNCTIONS*/ /*FUNCTIONS*/
/*----------*/ /*----------*/

@ -1,20 +1,20 @@
#include <Python.h>
#include <numpy/arrayobject.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
#include "Py_py-api.h" #include "Py_py-api.h"
#include "genlib.h"
#include "simpio.h"
#include "condor.h" #include "condor.h"
#include "genlib.h"
#include "geostat.h" #include "geostat.h"
#include "toolsIO.h"
#include "toolsFFTMA.h"
#include "pressure.h" #include "pressure.h"
#include "simpio.h"
#include "toolsFFTMA.h"
#include "toolsFFTPSIM.h" #include "toolsFFTPSIM.h"
#include "toolsIO.h"
#include <Python.h>
#include <math.h>
#include <numpy/arrayobject.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NDIMENSIONS 3 #define NDIMENSIONS 3
/* Z is the GWN with 0-mean and 1-variance */ /* Z is the GWN with 0-mean and 1-variance */
@ -32,15 +32,14 @@ static PyObject* genFunc(PyObject* self, PyObject* args)
PyObject* out_array; PyObject* out_array;
npy_intp out_dims[NPY_MAXDIMS]; npy_intp out_dims[NPY_MAXDIMS];
if(!Py_getvalues(args, &seed, &grid, &variogram, &stat)) return NULL; if (!Py_getvalues(args, &seed, &grid, &variogram, &stat))
return NULL;
Py_kgeneration(seed, grid, stat, variogram, &Z, &Y, &Y1, n); Py_kgeneration(seed, grid, stat, variogram, &Z, &Y, &Y1, n);
out_dims[0] = grid.NZ; out_dims[0] = grid.NZ;
out_dims[1] = grid.NY; out_dims[1] = grid.NY;
out_dims[2] = grid.NX; out_dims[2] = grid.NX;
out_array = PyArray_SimpleNewFromData(NDIMENSIONS, out_dims, NPY_DOUBLE, Y.vector); out_array = PyArray_SimpleNewFromData(NDIMENSIONS, out_dims, NPY_DOUBLE, Y.vector);
if (out_array == NULL) if (out_array == NULL)
return NULL; return NULL;
@ -48,18 +47,14 @@ static PyObject* genFunc(PyObject* self, PyObject* args)
PyArray_ENABLEFLAGS(out_array, NPY_ARRAY_OWNDATA); PyArray_ENABLEFLAGS(out_array, NPY_ARRAY_OWNDATA);
return out_array; return out_array;
} }
static PyMethodDef FFTMAMethods[] = {
static PyMethodDef FFTMAMethods[]=
{
{ "gen", genFunc, METH_VARARGS, "Generates a permeability 3D field." }, { "gen", genFunc, METH_VARARGS, "Generates a permeability 3D field." },
{ NULL, NULL, 0, NULL } { NULL, NULL, 0, NULL }
}; };
static struct PyModuleDef cFFTMADef = static struct PyModuleDef cFFTMADef = {
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"FFTMA", "", "FFTMA", "",
-1, -1,

Loading…
Cancel
Save