#include #include #include #include "condor.h" #include "geostat.h" /* Private functions */ void normAxes(double *vec, double *normed); void derivReal(struct realization_mod *Z, struct realization_mod *dZ, double *dir, struct grid_mod *grid, struct vario_mod vario) { int n[3],i,j,k,maille,extMaille; int NTOT,ntot,NMAX,nmax,NDIM; // int NXYZ,nxyz; double nDir[3]; double *table,*workr,*worki,*realization,*waveVect; int Ngrid; double tmp; double *ExtendedWaveVect; /* Test the input real*/ /* if ((*Z).code != 1) { */ /* printf("Realization should be Standard Normal\n"); */ /* return; */ /* } */ printf("grid.Nx = %d\n",(*grid).NX); printf("grid.Ny = %d\n",(*grid).NY); printf("grid.Nz = %d\n",(*grid).NZ); printf("vario.Nvario = %d\n",vario.Nvario); for(i=0; i NMAX) NMAX = n[i]; if (n[i] == 1) NDIM = NDIM-1; } nmax = NMAX+1; printf("NTOT = %d, ntot = %d, NMAX = %d\n",NTOT,ntot,NMAX); /* wave vector computation */ normAxes(dir,nDir); printf("Derivation direction (normed) %f %f %f\n",nDir[0],nDir[1],nDir[2]); waveVect = (double *) malloc(Ngrid*sizeof(double)); if (waveVect == NULL) { printf("waveVectCompute.cpp : No memory available for waveVect\n"); return; } waveVectorCompute3D((*grid).NX,(*grid).NY,(*grid).NZ,nDir,waveVect); /* memory allocation */ table = (double *) malloc(ntot * sizeof(double)); if (table == NULL) { printf("derivReal.cpp: No memory availble for table\n"); return; } realization = (double *) malloc(ntot * sizeof(double)); if (realization == NULL) { printf("derivReal.cpp: No memory availble for realization\n"); return; } ExtendedWaveVect = (double *) malloc(ntot * sizeof(double)); if (ExtendedWaveVect == NULL) { printf("derivReal.cpp: No memory availble for realization\n"); return; } workr = (double *) malloc(nmax * sizeof(double)); if (workr == NULL) { printf("derivReal.cpp: No memory available for workr\n"); return; } worki = (double *) malloc(nmax * sizeof(double)); if (worki == NULL) { printf("derivReal.cpp: No memory available for worki\n"); return; } extMaille =0; /* organization of the extended realization */ for (k=1;k<=n[2];k++) { for (j=1;j<=n[1];j++) { for (i=1;i<=n[0];i++) { extMaille = i + ((j-1) + (((k-1) * n[1]) * n[0])); if (i <= (*grid).NX && j <= (*grid).NY && k <= (*grid).NZ) { maille = i-1 + ((j-1) + ((k-1) * (*grid).NY) * (*grid).NX); realization[extMaille] = (*Z).vector[maille]; ExtendedWaveVect[extMaille] = waveVect[maille]; } else { realization[extMaille] = 0.0; ExtendedWaveVect[extMaille] = 0.0; } } } } /* forward fourier transform of the realization */ fourt(realization,table,n,NDIM,1,0,workr,worki); FILE *wave; wave = fopen("/home/irsrvshare1/R03/UPS_FLEX/waveVector.eas","w"); for (i=1;i