testing/icgen/random_verschillende_resoluties_N-GenIC/gadget3_64/pm_nonperiodic.c
void pm_init_nonperiodic_allocate(void)
{
  double bytes_tot = 0;
  size_t bytes;

  if(!(rhogrid = (fftw_real *) mymalloc(bytes = maxfftsize * sizeof(d_fftw_real))))
    {
      printf("failed to allocate memory for `FFT-rhogrid' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;

  fft_of_rhogrid = (fftw_complex *) rhogrid;

  if(!(forcegrid = (fftw_real *) mymalloc(bytes = maxfftsize * sizeof(d_fftw_real))))
    {
      printf("failed to allocate memory for `FFT-forcegrid' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;

  if(!(part = (struct part_slab_data *) mymalloc(bytes = 8 * NumPart * sizeof(struct part_slab_data))))
    {
      printf("failed to allocate memory for `part' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;

  if(!(part_sortindex = (int *) mymalloc(bytes = 8 * NumPart * sizeof(int))))
    {
      printf("failed to allocate memory for `part_sortindex' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;


  if(ThisTask == 0)
    printf("Using %g MByte for non-periodic FFT computation. (presently allocated %g MB)\n",
	   bytes_tot / (1024.0 * 1024.0), AllocatedBytes / (1024.0 * 1024.0));

  workspace = forcegrid;

  d_rhogrid = (d_fftw_real *) rhogrid;
  d_forcegrid = (d_fftw_real *) forcegrid;
  d_workspace = (d_fftw_real *) workspace;
}
/*! This function allocates the workspace needed for the non-periodic FFT
 *  algorithm. Three fields are used, one for the density/potential fields,
 *  one to hold the force field obtained by finite differencing, and finally
 *  an additional workspace which is used both in the parallel FFT itself, and
 *  as a buffer for the communication algorithm.
 */
This function allocates the workspace needed for the non-periodic FFT
algorithm. Three fields are used, one for the density/potential fields,
one to hold the force field obtained by finite differencing, and finally
an additional workspace which is used both in the parallel FFT itself, and
as a buffer for the communication algorithm.
This function allocates the workspace needed for the non - periodic FFT algorithm . Three fields are used one for the density / potential fields one to hold the force field obtained by finite differencing and finally an additional workspace which is used both in the parallel FFT itself and as a buffer for the communication algorithm .
void pm_init_nonperiodic_allocate(void)
{
  double bytes_tot = 0;
  size_t bytes;
  if(!(rhogrid = (fftw_real *) mymalloc(bytes = maxfftsize * sizeof(d_fftw_real))))
    {
      printf("failed to allocate memory for `FFT-rhogrid' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;
  fft_of_rhogrid = (fftw_complex *) rhogrid;
  if(!(forcegrid = (fftw_real *) mymalloc(bytes = maxfftsize * sizeof(d_fftw_real))))
    {
      printf("failed to allocate memory for `FFT-forcegrid' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;
  if(!(part = (struct part_slab_data *) mymalloc(bytes = 8 * NumPart * sizeof(struct part_slab_data))))
    {
      printf("failed to allocate memory for `part' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;
  if(!(part_sortindex = (int *) mymalloc(bytes = 8 * NumPart * sizeof(int))))
    {
      printf("failed to allocate memory for `part_sortindex' (%g MB).\n", bytes / (1024.0 * 1024.0));
      endrun(1);
    }
  bytes_tot += bytes;
  if(ThisTask == 0)
    printf("Using %g MByte for non-periodic FFT computation. (presently allocated %g MB)\n",
	   bytes_tot / (1024.0 * 1024.0), AllocatedBytes / (1024.0 * 1024.0));
  workspace = forcegrid;
  d_rhogrid = (d_fftw_real *) rhogrid;
  d_forcegrid = (d_fftw_real *) forcegrid;
  d_workspace = (d_fftw_real *) workspace;
}
void pm_init_nonperiodic_allocate ( void ) { double bytes_tot = 0 ; size_t bytes ; if ( ! ( rhogrid = ( fftw_real * ) mymalloc ( bytes = maxfftsize * sizeof ( d_fftw_real ) ) ) ) { printf ( " \n " , bytes / ( 1024.0 * 1024.0 ) ) ; endrun ( 1 ) ; } bytes_tot += bytes ; fft_of_rhogrid = ( fftw_complex * ) rhogrid ; if ( ! ( forcegrid = ( fftw_real * ) mymalloc ( bytes = maxfftsize * sizeof ( d_fftw_real ) ) ) ) { printf ( " \n " , bytes / ( 1024.0 * 1024.0 ) ) ; endrun ( 1 ) ; } bytes_tot += bytes ; if ( ! ( part = ( struct part_slab_data * ) mymalloc ( bytes = 8 * NumPart * sizeof ( struct part_slab_data ) ) ) ) { printf ( " \n " , bytes / ( 1024.0 * 1024.0 ) ) ; endrun ( 1 ) ; } bytes_tot += bytes ; if ( ! ( part_sortindex = ( int * ) mymalloc ( bytes = 8 * NumPart * sizeof ( int ) ) ) ) { printf ( " \n " , bytes / ( 1024.0 * 1024.0 ) ) ; endrun ( 1 ) ; } bytes_tot += bytes ; if ( ThisTask == 0 ) printf ( " \n " , bytes_tot / ( 1024.0 * 1024.0 ) , AllocatedBytes / ( 1024.0 * 1024.0 ) ) ; workspace = forcegrid ; d_rhogrid = ( d_fftw_real * ) rhogrid ; d_forcegrid = ( d_fftw_real * ) forcegrid ; d_workspace = ( d_fftw_real * ) workspace ; }
This function allocates the workspace needed for the non-periodic FFT
  algorithm.
This function allocates the workspace needed for the non - periodic FFT algorithm .