You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simulacion-permeabilidad/fftma_module/gen/LIBFFTMA/cgrid.c

44 lines
1.1 KiB
C

#include <stdlib.h>
#include "geostat.h"
/*computes the size of the grid for FFTs*/
/*input: */
/*variogram: structure defining the variogram model*/
/*grid: structure defining the actual grid */
/*output: */
/*n: vector with the number of cells along the */
/* X, Y and Z axes for the underlying grid */
/* i = [0 1 2] */
void cgrid(struct vario_mod variogram, struct grid_mod grid, int n[3])
{
int i,N;
double D;
if (n == NULL || n[0] == 0 || n[1] == 0 || n[2] == 0) {
for (i = 0; i<3; i++) {
switch (i) {
case 0:
N = grid.NX;
D = grid.DX;
break;
case 1:
N = grid.NY;
D = grid.DY;
break;
case 2:
N = grid.NZ;
D = grid.DZ;
break;
}
n[i] = length(N,i,variogram.scf,variogram.ap,D,variogram.Nvario);
}
} else {
if ((n[0]<grid.NX) || (n[1]<grid.NY) || (n[2]<grid.NZ)) {
printf("Indicated dimensions are inappropriate in cgrid");
exit;
}
}
return;
}