diff --git a/fftma_module/gen/build/lib.linux-x86_64-3.6/FFTMA.cpython-36m-x86_64-linux-gnu.so b/fftma_module/gen/build/lib.linux-x86_64-3.6/FFTMA.cpython-36m-x86_64-linux-gnu.so index f704188..00aa14f 100755 Binary files a/fftma_module/gen/build/lib.linux-x86_64-3.6/FFTMA.cpython-36m-x86_64-linux-gnu.so and b/fftma_module/gen/build/lib.linux-x86_64-3.6/FFTMA.cpython-36m-x86_64-linux-gnu.so differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_getvalues.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_getvalues.o index cf5242e..e6718bd 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_getvalues.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_getvalues.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_kgeneration.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_kgeneration.o index dbbdb17..d558d7d 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_kgeneration.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/Py_kgeneration.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/pgeneration2.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/pgeneration2.o index 187c875..373f4ef 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/pgeneration2.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/pgeneration2.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/ran2.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/ran2.o index 9fa2f30..6bb62f4 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/ran2.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/ran2.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata.o index 5375fc3..208e045 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata3.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata3.o index a5a990f..b0a6b38 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata3.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readdata3.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readfile_bin.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readfile_bin.o index f77b0b3..dadedd8 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readfile_bin.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/readfile_bin.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/scanadt.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/scanadt.o index 3785251..58e2a14 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/scanadt.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/scanadt.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/simpio.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/simpio.o index a883a75..e66a211 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/simpio.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/simpio.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/spherical.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/spherical.o index 21f2b50..37b87dc 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/spherical.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/spherical.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/total_velocity.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/total_velocity.o index ed3c988..1a89472 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/total_velocity.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/total_velocity.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/waveVectorCompute3D.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/waveVectorCompute3D.o index 95babab..0d4b50c 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/waveVectorCompute3D.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/waveVectorCompute3D.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile.o index b542b46..5973e58 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile.o differ diff --git a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile_bin.o b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile_bin.o index f5074b2..20d7baa 100644 Binary files a/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile_bin.o and b/fftma_module/gen/build/temp.linux-x86_64-3.6/lib_src/writefile_bin.o differ diff --git a/fftma_module/gen/include/toolsFFTPSIM.h b/fftma_module/gen/include/toolsFFTPSIM.h index 12ef949..1c77c88 100755 --- a/fftma_module/gen/include/toolsFFTPSIM.h +++ b/fftma_module/gen/include/toolsFFTPSIM.h @@ -10,40 +10,20 @@ /* List of functions: */ /* ------------------ */ -/* pgeneration, FFTPSim, FFTPressure, build_pressure, build_velocity,total_velocity, clean_real2 */ +/* FFTPSim, FFTPressure, build_pressure, build_velocity, clean_real2 */ /*Functions */ /*----------*/ -void pgeneration(int n[3],struct grid_mod grid,struct statistic_mod stat,struct vario_mod variogram,string filename[8],struct pressure_mod pression,struct realization_mod *Y,struct realization_mod *P,struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver); - -void pgeneration2(int n[3],struct grid_mod grid,struct statistic_mod stat, - struct vario_mod variogram,string filename[8],struct pressure_mod pression, - struct realization_mod *Y,struct realization_mod *P, - struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver, int format_file); - 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 FFTPressure(int n[3],struct grid_mod grid,struct realization_mod *realin,struct statistic_mod stat,struct pressure_mod gradient,struct realization_mod *realout,struct realization_mod *realout2,struct realization_mod *realout3,struct realization_mod *realout4, int solver); - void build_pressure(int n[3],struct grid_mod grid,struct pressure_mod gradient,double *realization,double *ireal,double *pressure,double *ipressure); void build_velocity(int n[3],struct grid_mod grid,struct statistic_mod stat,struct pressure_mod gradient,double *realization,double *ireal,double *xvelocity,double *ixvelocity,int direction); -/* total_velocity */ -/* Build total velocity in one direction */ -/* grid: structure defining the grid */ -/* mean: permeability mean */ -/* dgradient: macroscopic pressure gradient in wanted direction */ -/* realout: structure defining a X velocity realization */ - -void total_velocity(struct grid_mod grid,double mean,int direction,struct pressure_mod gradient,struct realization_mod *realout); - void normAxes(double *vec, double *normed); void waveVectorCompute1D(int n,double *vec); -void waveVectorCompute3D(int nX,int nY, int nZ, /*float dX, float dY, float dZ,*/ double nDir[3], double *waveVect); - void mat_vec(double *C, double *x, double *b, int n); diff --git a/fftma_module/gen/include/toolsIO.h b/fftma_module/gen/include/toolsIO.h index e6a6eb9..f271f0c 100755 --- a/fftma_module/gen/include/toolsIO.h +++ b/fftma_module/gen/include/toolsIO.h @@ -12,7 +12,7 @@ /* List of functions: */ /* ------------------ */ -/* writefile,writefile_bin,readfile_bin,inputdata,inputfiledata,readdata,debuginput */ +/* readfile_bin,inputdata,inputfiledata,debuginput */ /* testmemory, testopenfile */ @@ -35,14 +35,6 @@ void inputdata(long *seed,struct grid_mod *grid,string filename[7],struct vario_ void inputfiledata(string inputfile,long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression); -/* void readdata(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,struct realization_mod *Kfield, char *argv[]); */ - -void readdata(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]); - -void readdata2(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, int *format_file, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]); - -void readdata3(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, int *format_file,int *Psolver, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]); - /* readfile_bin */ /* */ /* read in the file "filename" the vector values of a */ @@ -52,27 +44,6 @@ void readdata3(long *seed,struct grid_mod *grid,string filename[8],struct vario_ void readfile_bin(string filename, struct realization_mod *realin); - -/* Writefile */ -/* */ -/* write in the file "filename" the vector values of a */ -/* realization_mod variable */ -/* filename: explicit */ -/* realin: structure defining a realization */ - -void writefile( string filename, struct realization_mod *realin); - -/* Writefile_bin */ -/* */ -/* write in the file "filename" the vector values of a */ -/* realization_mod variable */ -/* filename: explicit */ -/* realin: structure defining a realization */ - -void writefile_bin( string filename, struct realization_mod *realin); - - - /* DebugInput */ /* */ /* Display the input data */ diff --git a/fftma_module/gen/lib_src/Py_getvalues.c b/fftma_module/gen/lib_src/Py_getvalues.c index cef5b17..7e2ac19 100755 --- a/fftma_module/gen/lib_src/Py_getvalues.c +++ b/fftma_module/gen/lib_src/Py_getvalues.c @@ -48,6 +48,8 @@ int Py_getvalues(PyObject* args, long* seed,struct grid_mod* grid,struct vario_m PyObject* vgr; //char* gwnfilename; + printf("Py_getvalues\n"); + stat->nblock_mean=1; stat->nblock_var=1; diff --git a/fftma_module/gen/lib_src/Py_kgeneration.c b/fftma_module/gen/lib_src/Py_kgeneration.c index 9c5bf2f..fc20f7b 100755 --- a/fftma_module/gen/lib_src/Py_kgeneration.c +++ b/fftma_module/gen/lib_src/Py_kgeneration.c @@ -35,11 +35,6 @@ void Py_kgeneration(long seed,struct grid_mod grid,struct statistic_mod stat,st generate(&seed,N,Z); - /*save the Gaussian white noise file*/ - // if (*gwnwrite == 0) - // { - // writefile(filename[0],Z); - // } diff --git a/fftma_module/gen/lib_src/pgeneration.c b/fftma_module/gen/lib_src/pgeneration.c deleted file mode 100755 index a2e4c5e..0000000 --- a/fftma_module/gen/lib_src/pgeneration.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include -#include -#include "genlib.h" -#include "simpio.h" -#include "geostat.h" -#include "pressure.h" -#include "toolsIO.h" - -void pgeneration(int n[3],struct grid_mod grid,struct statistic_mod stat,struct vario_mod variogram,string filename[7],struct pressure_mod pression,struct realization_mod *Y,struct realization_mod *P,struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver) - { - int i,ntot; - struct realization_mod GP; - - //FFTPressure(n,grid,Y,stat,pression,P,VX,VY,VZ,solver); - /*save the delta-pressure realization*/ - writefile(filename[2],P); - - //total_pressure(grid,pression,P); - - total_velocity(grid,stat.mean[0],1,pression,VX); - total_velocity(grid,stat.mean[0],2,pression,VY); - total_velocity(grid,stat.mean[0],3,pression,VZ); - - /*save the total pressure realization*/ - writefile(filename[3],P); - /*save the x-velocity realization*/ - writefile(filename[4],VX); - /*save the y-velocity realization*/ - writefile(filename[5],VY); - /*save the z-velocity realization*/ - writefile(filename[6],VZ); - - ntot=grid.NX*grid.NY*grid.NZ; - GP.vector = (double *) malloc(ntot * sizeof(double)); - testmemory(GP.vector); - GP.n= ntot-1; - for (i = 0; i < ntot-1; i++) - { - GP.vector[i]=(*P).vector[i]-(*P).vector[i-1]; - } - /*save the pressure gradient realization*/ - writefile(filename[7],&GP); - - return; - } diff --git a/fftma_module/gen/lib_src/pgeneration2.c b/fftma_module/gen/lib_src/pgeneration2.c deleted file mode 100755 index 8dd04f5..0000000 --- a/fftma_module/gen/lib_src/pgeneration2.c +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include -#include -#include -#include -#include "genlib.h" -#include "simpio.h" -#include "geostat.h" -#include "pressure.h" -#include "toolsIO.h" - -void pgeneration2(int n[3],struct grid_mod grid,struct statistic_mod stat,struct vario_mod variogram,string filename[7],struct pressure_mod pression,struct realization_mod *Y,struct realization_mod *P,struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver, int format_file) - { - int i,ntot; - struct realization_mod GP; - - //FFTPressure(n,grid,Y,stat,pression,P,VX,VY,VZ,solver); - - /*save the delta-pressure realization*/ - switch (format_file) - { - case 0: - writefile(filename[2],P); - break; - case 1: - writefile_bin(filename[2],P); - break; - } - - //total_pressure(grid,pression,P); - total_velocity(grid,stat.mean[0],1,pression,VX); - total_velocity(grid,stat.mean[0],2,pression,VY); - total_velocity(grid,stat.mean[0],3,pression,VZ); - - /*save the total pressure realization*/ - switch (format_file) - { - case 0: - writefile(filename[3],P); - break; - case 1: - writefile_bin(filename[3],P); - break; - } - - /*save the x-velocity realization*/ - switch (format_file) - { - case 0: - writefile(filename[4],VX); - break; - case 1: - writefile_bin(filename[4],VX); - break; - } - - /*save the y-velocity realization*/ - switch (format_file) - { - case 0: - writefile(filename[5],VY); - break; - case 1: - writefile_bin(filename[5],VY); - break; - } - /*save the z-velocity realization*/ - switch (format_file) - { - case 0: - writefile(filename[6],VZ); - break; - case 1: - writefile_bin(filename[6],VZ); - break; - } - - ntot=grid.NX*grid.NY*grid.NZ; - GP.vector = (double *) malloc(ntot * sizeof(double)); - testmemory(GP.vector); - GP.n= ntot-1; - for (i = 0; i < ntot-1; i++) - { - GP.vector[i]=(*P).vector[i]-(*P).vector[i-1]; - } - - /*save the pressure gradient realization*/ - switch (format_file) - { - case 0: - writefile(filename[7],&GP); - break; - case 1: - writefile_bin(filename[7],&GP); - break; - } - - return; - } diff --git a/fftma_module/gen/lib_src/ran2.c b/fftma_module/gen/lib_src/ran2.c index 8075f4f..7ec077d 100755 --- a/fftma_module/gen/lib_src/ran2.c +++ b/fftma_module/gen/lib_src/ran2.c @@ -18,6 +18,7 @@ double ran2(long *idum, long *idum2, long *iy, long iv[NTAB]) { + //printf("ran2\n"); int j; long k; double temp; diff --git a/fftma_module/gen/lib_src/readdata.c b/fftma_module/gen/lib_src/readdata.c deleted file mode 100755 index deb2b58..0000000 --- a/fftma_module/gen/lib_src/readdata.c +++ /dev/null @@ -1,204 +0,0 @@ -#include -#include -#include -#include -#include -#include "genlib.h" -#include "simpio.h" -#include "geostat.h" -#include "pressure.h" -#include "toolsIO.h" - - -void readdata(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]) -{ - FILE *fp; - int i,j,n; - char *file1,*file2,*file3,*file4,*file5; - char *prog=argv[0]; - double tmp; - - file1=argv[1]; - file2=argv[2]; - - /* Ouverture du fichier de donn�es principal */ - - if ((fp=fopen(file1,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file1); - exit(1); - } - else - { - *Ksolver = atoi(ReadLine(fp)); - *genere = atoi(ReadLine(fp)); - *gwnwrite = atoi(ReadLine(fp)); - if (*gwnwrite==0) - { - filename[0] = ReadLine(fp); - } - (*grid).NX = atoi(ReadLine(fp)); - (*grid).NY = atoi(ReadLine(fp)); - (*grid).NZ = atoi(ReadLine(fp)); - (*grid).DX = atof(ReadLine(fp)); - (*grid).DY = atof(ReadLine(fp)); - (*grid).DZ = atof(ReadLine(fp)); - - fclose(fp); - } - n=(*grid).NX*(*grid).NY*(*grid).NZ; - -/* Ouverture du fichier de donn�es sur le champ de perm�abilit� */ - - if ((fp=fopen(file2,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file2); - exit(1); - } - else - { - *seed=atoi(ReadLine(fp)); - (*variogram).Nvario = atoi(ReadLine(fp)); - (*variogram).vario = (int *) malloc((*variogram).Nvario * sizeof(int)); - (*variogram).alpha = (double *) malloc((*variogram).Nvario * sizeof(double)); - (*variogram).ap = (double *) malloc(9*(*variogram).Nvario * sizeof(double)); - (*variogram).scf = (double *) malloc(3*(*variogram).Nvario * sizeof(double)); - (*variogram).var = (double *) malloc((*variogram).Nvario * sizeof(double)); - for (i= 0; i < (*variogram).Nvario; i++) { - (*variogram).var[i] = atof(ReadLine(fp)); - (*variogram).vario[i] = atoi(ReadLine(fp)); - (*variogram).alpha[i] = atof(ReadLine(fp)); - for (j = 0; j < 3; j++) - (*variogram).scf[i*3+j]= atof(ReadLine(fp)); - for (j = 0; j < 6; j++) - (*variogram).ap[i*9+j] = atof(ReadLine(fp)); - } - /*statistical data*/ - (*stat).nblock_mean = 1; - (*stat).nblock_var = 1; - (*stat).mean = (double *)malloc((*stat).nblock_mean * sizeof(double)); - if ((*stat).mean == NULL) - Error("No memory available"); - (*stat).variance = (double *)malloc((*stat).nblock_var * sizeof(double)); - if ((*stat).variance == NULL) - Error("No memory available"); - - (*stat).mean[0] = atof(ReadLine(fp)); - (*stat).variance[0] = atof(ReadLine(fp)); - (*stat).type = atoi(ReadLine(fp)); - - filename[1] = ReadLine(fp); - fclose(fp); - } - - switch (*Ksolver) - { - case 0: - /* Ouverture du fichier contenant le gaussian white noise */ - if (*genere == 1) - { - file3=argv[3]; - if ((fp=fopen(file3,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file3); - exit(1); - } - else - { - /* Ouverture du champ de permeabilite K */ - (*gwnoise).vector = (double *) malloc(n * sizeof(double)); - for (i=0;i -#include -#include -#include -#include -#include "genlib.h" -#include "simpio.h" -#include "geostat.h" -#include "pressure.h" -#include "toolsIO.h" - - -void readdata2(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, int *format_file, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]) -{ - FILE *fp; - int i,j,n; - char *file1,*file2,*file3,*file4,*file5; - char *prog=argv[0]; - double tmp; - - file1=argv[1]; - file2=argv[2]; - - /* Ouverture du fichier de donn�es principal */ - - if ((fp=fopen(file1,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file1); - exit(1); - } - else - { - *Ksolver = atoi(ReadLine(fp)); - *genere = atoi(ReadLine(fp)); - *gwnwrite = atoi(ReadLine(fp)); - if (*gwnwrite==0) - { - filename[0] = ReadLine(fp); - } - *format_file=atoi(ReadLine(fp)); - (*grid).NX = atoi(ReadLine(fp)); - (*grid).NY = atoi(ReadLine(fp)); - (*grid).NZ = atoi(ReadLine(fp)); - (*grid).DX = atof(ReadLine(fp)); - (*grid).DY = atof(ReadLine(fp)); - (*grid).DZ = atof(ReadLine(fp)); - - fclose(fp); - } - n=(*grid).NX*(*grid).NY*(*grid).NZ; - -/* Ouverture du fichier de donn�es sur le champ de perm�abilit� */ - - if ((fp=fopen(file2,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file2); - exit(1); - } - else - { - *seed=atoi(ReadLine(fp)); - (*variogram).Nvario = atoi(ReadLine(fp)); - (*variogram).vario = (int *) malloc((*variogram).Nvario * sizeof(int)); - (*variogram).alpha = (double *) malloc((*variogram).Nvario * sizeof(double)); - (*variogram).ap = (double *) malloc(9*(*variogram).Nvario * sizeof(double)); - (*variogram).scf = (double *) malloc(3*(*variogram).Nvario * sizeof(double)); - (*variogram).var = (double *) malloc((*variogram).Nvario * sizeof(double)); - for (i= 0; i < (*variogram).Nvario; i++) { - (*variogram).var[i] = atof(ReadLine(fp)); - (*variogram).vario[i] = atoi(ReadLine(fp)); - (*variogram).alpha[i] = atof(ReadLine(fp)); - for (j = 0; j < 3; j++) - (*variogram).scf[i*3+j]= atof(ReadLine(fp)); - for (j = 0; j < 6; j++) - (*variogram).ap[i*9+j] = atof(ReadLine(fp)); - } - /*statistical data*/ - (*stat).nblock_mean = 1; - (*stat).nblock_var = 1; - (*stat).mean = (double *)malloc((*stat).nblock_mean * sizeof(double)); - if ((*stat).mean == NULL) - Error("No memory available"); - (*stat).variance = (double *)malloc((*stat).nblock_var * sizeof(double)); - if ((*stat).variance == NULL) - Error("No memory available"); - - (*stat).mean[0] = atof(ReadLine(fp)); - (*stat).variance[0] = atof(ReadLine(fp)); - (*stat).type = atoi(ReadLine(fp)); - - filename[1] = ReadLine(fp); - fclose(fp); - } - - switch (*Ksolver) - { - case 0: - /* Ouverture du fichier contenant le gaussian white noise */ - if (*genere == 1) - { - file3=argv[3]; - if ((fp=fopen(file3,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file3); - exit(1); - } - else - { - /* Ouverture du champ de permeabilite K */ - (*gwnoise).vector = (double *) malloc(n * sizeof(double)); - for (i=0;i -#include -#include -#include -#include -#include "genlib.h" -#include "simpio.h" -#include "geostat.h" -#include "pressure.h" -#include "toolsIO.h" - - -void readdata3(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, int *format_file,int *Psolver, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]) -{ - FILE *fp; - int i,j,n; - char *file1,*file2,*file3,*file4,*file5; - char *prog=argv[0]; - double tmp; - - file1=argv[1]; - file2=argv[2]; - - /* Ouverture du fichier de donn�es principal */ - - if ((fp=fopen(file1,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file1); - exit(1); - } - else - { - *Ksolver = atoi(ReadLine(fp)); - *genere = atoi(ReadLine(fp)); - *gwnwrite = atoi(ReadLine(fp)); - if (*gwnwrite==0) - { - filename[0] = ReadLine(fp); - } - *format_file=atoi(ReadLine(fp)); - *Psolver=atoi(ReadLine(fp)); - (*grid).NX = atoi(ReadLine(fp)); - (*grid).NY = atoi(ReadLine(fp)); - (*grid).NZ = atoi(ReadLine(fp)); - (*grid).DX = atof(ReadLine(fp)); - (*grid).DY = atof(ReadLine(fp)); - (*grid).DZ = atof(ReadLine(fp)); - - fclose(fp); - } - n=(*grid).NX*(*grid).NY*(*grid).NZ; - -/* Ouverture du fichier de donn�es sur le champ de perm�abilit� */ - - if ((fp=fopen(file2,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file2); - exit(1); - } - else - { - *seed=atoi(ReadLine(fp)); - (*variogram).Nvario = atoi(ReadLine(fp)); - (*variogram).vario = (int *) malloc((*variogram).Nvario * sizeof(int)); - (*variogram).alpha = (double *) malloc((*variogram).Nvario * sizeof(double)); - (*variogram).ap = (double *) malloc(9*(*variogram).Nvario * sizeof(double)); - (*variogram).scf = (double *) malloc(3*(*variogram).Nvario * sizeof(double)); - (*variogram).var = (double *) malloc((*variogram).Nvario * sizeof(double)); - for (i= 0; i < (*variogram).Nvario; i++) { - (*variogram).var[i] = atof(ReadLine(fp)); - (*variogram).vario[i] = atoi(ReadLine(fp)); - (*variogram).alpha[i] = atof(ReadLine(fp)); - for (j = 0; j < 3; j++) - (*variogram).scf[i*3+j]= atof(ReadLine(fp)); - for (j = 0; j < 6; j++) - (*variogram).ap[i*9+j] = atof(ReadLine(fp)); - } - /*statistical data*/ - (*stat).nblock_mean = 1; - (*stat).nblock_var = 1; - (*stat).mean = (double *)malloc((*stat).nblock_mean * sizeof(double)); - if ((*stat).mean == NULL) - Error("No memory available"); - (*stat).variance = (double *)malloc((*stat).nblock_var * sizeof(double)); - if ((*stat).variance == NULL) - Error("No memory available"); - - (*stat).mean[0] = atof(ReadLine(fp)); - (*stat).variance[0] = atof(ReadLine(fp)); - (*stat).type = atoi(ReadLine(fp)); - - filename[1] = ReadLine(fp); - fclose(fp); - } - - switch (*Ksolver) - { - case 0: - /* Ouverture du fichier contenant le gaussian white noise */ - if (*genere == 1) - { - file3=argv[3]; - if ((fp=fopen(file3,"r")) == NULL) - { - fprintf(stderr,"%s :impossible d'ouvrir %s\n",prog, file3); - exit(1); - } - else - { - /* Ouverture du champ de permeabilite K */ - (*gwnoise).vector = (double *) malloc(n * sizeof(double)); - for (i=0;i= 1.) { z = 0.; } else { diff --git a/fftma_module/gen/lib_src/toolsFFTPSIM.h b/fftma_module/gen/lib_src/toolsFFTPSIM.h index 8579fe2..1c77c88 100755 --- a/fftma_module/gen/lib_src/toolsFFTPSIM.h +++ b/fftma_module/gen/lib_src/toolsFFTPSIM.h @@ -10,37 +10,20 @@ /* List of functions: */ /* ------------------ */ -/* pgeneration, FFTPSim, FFTPressure, build_pressure, build_velocity,total_velocity, clean_real2 */ +/* FFTPSim, FFTPressure, build_pressure, build_velocity, clean_real2 */ /*Functions */ /*----------*/ -void pgeneration(int n[3],struct grid_mod grid,struct statistic_mod stat,struct vario_mod variogram,string filename[8],struct pressure_mod pression,struct realization_mod *Y,struct realization_mod *P,struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver); - -void pgeneration2(int n[3],struct grid_mod grid,struct statistic_mod stat,struct vario_mod variogram,string filename[8],struct pressure_mod pression,struct realization_mod *Y,struct realization_mod *P,struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver, int format_file); - 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 FFTPressure(int n[3],struct grid_mod grid,struct realization_mod *realin,struct statistic_mod stat,struct pressure_mod gradient,struct realization_mod *realout,struct realization_mod *realout2,struct realization_mod *realout3,struct realization_mod *realout4, int solver); - void build_pressure(int n[3],struct grid_mod grid,struct pressure_mod gradient,double *realization,double *ireal,double *pressure,double *ipressure); void build_velocity(int n[3],struct grid_mod grid,struct statistic_mod stat,struct pressure_mod gradient,double *realization,double *ireal,double *xvelocity,double *ixvelocity,int direction); -/* total_velocity */ -/* Build total velocity in one direction */ -/* grid: structure defining the grid */ -/* mean: permeability mean */ -/* dgradient: macroscopic pressure gradient in wanted direction */ -/* realout: structure defining a X velocity realization */ - -void total_velocity(struct grid_mod grid,double mean,int direction,struct pressure_mod gradient,struct realization_mod *realout); - void normAxes(double *vec, double *normed); void waveVectorCompute1D(int n,double *vec); -void waveVectorCompute3D(int nX,int nY, int nZ, /*float dX, float dY, float dZ,*/ double nDir[3], double *waveVect); - void mat_vec(double *C, double *x, double *b, int n); diff --git a/fftma_module/gen/lib_src/toolsIO.h b/fftma_module/gen/lib_src/toolsIO.h index e6a6eb9..e2ae0db 100755 --- a/fftma_module/gen/lib_src/toolsIO.h +++ b/fftma_module/gen/lib_src/toolsIO.h @@ -12,7 +12,7 @@ /* List of functions: */ /* ------------------ */ -/* writefile,writefile_bin,readfile_bin,inputdata,inputfiledata,readdata,debuginput */ +/* readfile_bin,inputdata,inputfiledata,readdata,debuginput */ /* testmemory, testopenfile */ @@ -52,27 +52,6 @@ void readdata3(long *seed,struct grid_mod *grid,string filename[8],struct vario_ void readfile_bin(string filename, struct realization_mod *realin); - -/* Writefile */ -/* */ -/* write in the file "filename" the vector values of a */ -/* realization_mod variable */ -/* filename: explicit */ -/* realin: structure defining a realization */ - -void writefile( string filename, struct realization_mod *realin); - -/* Writefile_bin */ -/* */ -/* write in the file "filename" the vector values of a */ -/* realization_mod variable */ -/* filename: explicit */ -/* realin: structure defining a realization */ - -void writefile_bin( string filename, struct realization_mod *realin); - - - /* DebugInput */ /* */ /* Display the input data */ diff --git a/fftma_module/gen/lib_src/total_velocity.c b/fftma_module/gen/lib_src/total_velocity.c deleted file mode 100755 index 63344c1..0000000 --- a/fftma_module/gen/lib_src/total_velocity.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include -#include -#include "geostat.h" -#include "pressure.h" - - - -/* total_velocity */ -/* Build total velocity */ -/* grid: structure defining the grid */ -/* mean: permeability mean */ -/* dgradient: macroscopic pressure gradient in wanted direction */ -/* realout: structure defining a X velocity realization */ - -void total_velocity(struct grid_mod grid,double mean,int direction,struct pressure_mod gradient,struct realization_mod *realout) -{ - int i,j,k,maille0,maille1; - double temp,grad; - switch(direction) - { - case 1: - grad = gradient.x/(grid.NX*grid.DX); - break; - case 2: - grad = gradient.y/(grid.NY*grid.DY);/* *grid.NY*grid.DY; */ - break; - case 3: - grad = gradient.z/(grid.NZ*grid.DZ); /* *grid.NZ*grid.DZ; */ - break; - default : - printf("build_velocity.c: wrong velocity direction!!! direction: %d\n",direction); - break; - } - - /* x velocity reconstruction */ - for ( k = 0; k < grid.NZ; k++) { - for (j = 0; j < grid.NY; j++) { - for (i = 0; i < grid.NX; i++) { - maille1 = i+(j+k*grid.NY)*grid.NX; - temp=mean*grad+(*realout).vector[maille1]; -/* temp=mean*grad; */ - (*realout).vector[maille1]=temp; - } - } - } - - return; -} diff --git a/fftma_module/gen/lib_src/waveVectorCompute3D.c b/fftma_module/gen/lib_src/waveVectorCompute3D.c deleted file mode 100755 index 58e8342..0000000 --- a/fftma_module/gen/lib_src/waveVectorCompute3D.c +++ /dev/null @@ -1,156 +0,0 @@ -//#include -//#include -#include -#include -#include -#include -#include -#include - -//using namespace std; - -/*Private functions */ -void waveVectorCompute1D(int n,double *vec); - -void waveVectorCompute3D(int nX,int nY, int nZ, /*double dX, double dY, double dZ,*/ double nDir[3], double *waveVect) { - - int nTot; - double *vecX,*vecY,*vecZ; - double *waveVect3DX, *waveVect3DY, *waveVect3DZ; - - int i, j, k, maille; - - nTot = nX*nY*nZ; -// printf("nX = %d, nY = %d, nZ = %d, nTot = %d\n",nX,nY,nZ,nTot); -// printf("Entering waveVectorCompute3D\n"); - -/*Memory allocation */ - waveVect3DX = (double *)malloc(nTot * sizeof(double)); - if (waveVect3DX == NULL) { - printf("waveVectCompute.cpp : No memory available for waveVect3DX\n"); - return; - } - waveVect3DY = (double *)malloc(nTot * sizeof(double)); - if (waveVect3DY == NULL) { - printf("waveVectCompute.cpp : No memory available for waveVect3DY\n"); - return; - } - waveVect3DZ = (double *)malloc(nTot * sizeof(double)); - if (waveVect3DZ == NULL) { - printf("waveVectCompute.cpp : No memory available for waveVect3DZ\n"); - return; - } - - vecX = (double *)malloc(nX * sizeof(double)); - if (vecX == NULL) { - printf("waveVectCompute.cpp : No memory available for vecX\n"); - return; - } - - vecY = (double *)malloc(nY * sizeof(double)); - if (vecY == NULL) { - printf("waveVectCompute.cpp : No memory available for vecY\n"); - return; - } - - vecZ = (double *)malloc(nZ * sizeof(double)); - if (vecZ == NULL) { - printf("waveVectCompute.cpp : No memory available for vecZ\n"); - return; - } - -// printf("memory allocation done.\n"); - - waveVectorCompute1D(nX,vecX); - waveVectorCompute1D(nY,vecY); - waveVectorCompute1D(nZ,vecZ); -// printf("waveVectorCompute1D: done!\n"); - - for(k = 0; k < nZ; k++) { -// printf("k=%d\n",k); - for(j = 0; j < nY; j++) { -// printf("j=%d: ",j); - for(i = 0; i < nX; i++) { - maille = i + (j + (k)*nY)*nX; -// waveVect3DX[maille] = vecX[i]/(nX*dX); -// waveVect3DY[maille] = vecY[j]/(nY*dY); -// waveVect3DZ[maille] = vecZ[k]/(nZ*dZ); - waveVect3DX[maille] = vecX[i]; - waveVect3DY[maille] = vecY[j]; - waveVect3DZ[maille] = vecZ[k]; -// printf("i=%d: %f ",i,vecZ[k]); - } -// printf("\n"); - } - } -// printf("waveVector3DX, Y and Z rearanged\n"); - free(vecX); - free(vecY); - free(vecZ); - if (waveVect == NULL) { - printf("allocate memory for waveVect\n"); - waveVect = (double *) malloc((nTot+1)*sizeof(double)); - if (waveVect == NULL) { - printf("waveVectCompute.cpp : No memory available for waveVect\n"); - return; - } - printf("after allocate memory for waveVect\n"); - } - - for (i=1;i<=nTot;i++) { - waveVect[i] = nDir[0]*waveVect3DX[i-1] + nDir[1]*waveVect3DY[i-1] + nDir[2]*waveVect3DZ[i-1]; -// printf("waveVect[%d] = %f\n",i,waveVect[i]); - } -// printf("waveVector rearanged\n"); - - free(waveVect3DX); - free(waveVect3DY); - free(waveVect3DZ); - -} - -void waveVectorCompute1D(int n,double *vec){ - - int midPoint,k; - - if(ceil(n/2) - floor(n/2) < 1.) { -// printf("coucou\n"); -/*n is even */ - midPoint = (int) floor(n/2); - vec[midPoint] = (double) midPoint; - } else { -/*n is odd */ - midPoint = (int) floor(n/2)-1; - vec[midPoint] = (double) midPoint+1; - } - for (k=1;k -#include -#include -#include -#include -#include -#include "genlib.h" -#include "geostat.h" - -/*writefile */ -/* write in the file "filename" the vector values of a */ -/* realization_mod variable */ -/* filename: explicit */ -/* realin: structure defining a realization */ - -void writefile(string filename, struct realization_mod *realin) -{ - FILE *fp; - int i; - /* string filename;*/ - /*struct realization_mod *realin;*/ - - - /*save the permeability realization*/ - fp = fopen(filename, "w"); -/* printf("writefile.c : (*realin).vector[0] %f\n",(*realin).vector[0]); */ -/* (*realin).vector[0]=1.1; */ - for (i=0;i<(*realin).n;i++) - fprintf(fp,"%15.10f\n",(*realin).vector[i]); - fclose(fp); - return; -} diff --git a/fftma_module/gen/lib_src/writefile_bin.c b/fftma_module/gen/lib_src/writefile_bin.c deleted file mode 100755 index 8df2da8..0000000 --- a/fftma_module/gen/lib_src/writefile_bin.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "genlib.h" -#include "geostat.h" - -/*writefile */ -/* write in the file "filename" the vector values of a */ -/* realization_mod variable */ -/* filename: explicit */ -/* realin: structure defining a realization */ - -void writefile_bin(string filename, struct realization_mod *realin) -{ - FILE *fp; - int i; - double *prout; - - /*save the permeability realization*/ - fp = fopen(filename, "w"); - - for (i=0;i<(*realin).n;i++) - { - prout=(*realin).vector; - fwrite(&prout[i],sizeof(double),1,fp); - } - - fclose(fp); - return; -} diff --git a/fftma_module/gen/setup.py b/fftma_module/gen/setup.py index 1c5c6b9..fad607e 100644 --- a/fftma_module/gen/setup.py +++ b/fftma_module/gen/setup.py @@ -39,23 +39,15 @@ module_FFTMA = Extension( "./lib_src/prebuild_gwn.c", "./lib_src/build_real.c", "./lib_src/clean_real.c", - "./lib_src/pgeneration.c", - "./lib_src/pgeneration2.c", "./lib_src/build_pressure.c", "./lib_src/build_velocity.c", - "./lib_src/total_velocity.c", - "./lib_src/waveVectorCompute3D.c", "./lib_src/mat_vec.c", "./lib_src/inputdata.c", "./lib_src/inputfiledata.c", "./lib_src/debuginput.c", - "./lib_src/readdata.c", "./lib_src/readfile_bin.c", - "./lib_src/writefile.c", - "./lib_src/writefile_bin.c", "./lib_src/testmemory.c", "./lib_src/testopenfile.c", - "./lib_src/readdata3.c", "./lib_src/genlib.c", ], )