Exemplo n.º 1
0
void Transformer::init() {
	//printf("num_threads = %d\n", omp_get_max_threads());
    printf("nthreads = %d\n", nfft_get_num_threads());
    /* init */
    fftw_init_threads();
    fftw_plan_with_nthreads(omp_get_max_threads());
    /* precomputation (for fast polynomial transform) */
    nfsft_precompute(N, 1000.0, 0U, 0U);

    /* Initialize transform plan using the guru interface. All input and output
     * arrays are allocated by nfsft_init_guru(). Computations are performed with
     * respect to L^2-normalized spherical harmonics Y_k^n. The array of spherical
     * Fourier coefficients is preserved during transformations. The NFFT uses a
     * cut-off parameter m = 6. See the NFFT 3 manual for details.
     */
    nfsft_init(&plan, N, M);
    //nfsft_init_guru(&plan, N, M, NFSFT_MALLOC_X | NFSFT_MALLOC_F |
    //    NFSFT_MALLOC_F_HAT | NFSFT_NORMALIZED | NFSFT_PRESERVE_F_HAT,
    //    PRE_PHI_HUT | PRE_PSI | FFTW_INIT | FFT_OUT_OF_PLACE, 6);
}
Exemplo n.º 2
0
mfield_sht_workspace *
mfield_sht_alloc(const size_t N, const size_t M)
{
  mfield_sht_workspace *w;

  w = calloc(1, sizeof(mfield_sht_workspace));
  if (!w)
    {
      fprintf(stderr, "mfield_sht_alloc: calloc failed: %s\n",
              strerror(errno));
      return 0;
    }

  /* precomputation step - inits global data */
  nfsft_precompute(N, 1000, 0U, 0U);

  nfsft_init(&(w->plan), N, M);

  w->N = N;
  w->M = M;

  return w;
}