1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
double A = (2 * EIGEN_PI)/Lx;
double B = (2 * EIGEN_PI)/ Ly;
Eigen::Tensor<double, 3> uFun((nz+1),nx,ny);
uFun.setZero();
for(int i = 0; i< nx; i++){
for(int j = 0; j< ny; j++){
for(int k = 0; k< nz+1; k++){
uFun(k,i,j) = pow(eZZ(k,i,j),2.0) * sin(A * eXX(k,i,j)) * sin(B * eYY(k,i,j));
}
}
}
double *Mytest;
Mytest = (double*) fftw_malloc(nx*ny*nz*sizeof(double));
memset(Mytest, 42, nx * ny * nz * sizeof(double));
memcpy(Mytest,uFun.data(),uFun.size() * sizeof(double));
fftw_complex *dummyO;
dummyO = (fftw_complex*) fftw_malloc((((nx)*(nz+1)))* sizeof(fftw_complex));
memset(dummyO, 42, (((nx)*(nz+1)))* sizeof(fftw_complex));
int constexpr n[]{ ny, nx };
fftw_execute(fftw_plan_many_dft_r2c(2, n, nz, Mytest, n, 1, ny*nx, dummyO, n, 1, ny*nx, FFTW_ESTIMATE));
| |