12#ifndef PM_NONPERIODIC_H
13#define PM_NONPERIODIC_H
15#include "gadgetconfig.h"
17#include "../data/allvars.h"
18#include "../data/dtypes.h"
19#include "../data/intposconvert.h"
20#include "../data/mymalloc.h"
21#include "../data/simparticles.h"
22#include "../domain/domain.h"
23#include "../logs/timer.h"
24#include "../mpi_utils/mpi_utils.h"
25#include "../pm/pm_mpi_fft.h"
26#include "../system/system.h"
27#include "../time_integration/timestep.h"
34#if defined(PMGRID) && (!defined(PERIODIC) || defined(PLACEHIGHRESREGION))
37#if defined(LONG_X_BITS) || defined(LONG_Y_BITS) || defined(LONG_Z_BITS)
38#error "LONG_X/Y/Z_BITS not supported for the non-periodic FFT gravity code"
41#if defined(GRAVITY_TALLBOX)
42#error "GRAVITY_TALLBOX not supported for the non-periodic FFT gravity code"
46 typedef long long large_array_offset;
49 typedef int large_array_offset;
52#ifdef NUMPART_PER_TASK_LARGE
53 typedef long long large_numpart_type;
56 typedef int large_numpart_type;
80 fft_real *rhogrid, *forcegrid, *workspace;
87 fft_complex *fft_of_rhogrid;
90 fft_complex *fft_of_kernel[2];
96 void pm_init_regionsize(
void);
97 int pmforce_nonperiodic(
int grnr);
98 void pm_setup_nonperiodic_kernel(
void);
99 void pmforce_nonperiodic_zoom_optimized_prepare_density(
int grnr);
102#ifdef PM_ZOOM_OPTIMIZED
104 void pmforce_nonperiodic_zoom_optimized_readout_forces_or_potential(
int grnr,
int dim);
112 struct part_slab_data
114 large_array_offset globalindex;
115 large_numpart_type partindex;
117 large_array_offset localindex;
120 part_slab_data *part;
122 size_t *localfield_sendcount, *localfield_first, *localfield_offset, *localfield_recvcount;
123 large_array_offset *localfield_globalindex, *import_globalindex;
124 fft_real *localfield_data, *import_data;
125 large_numpart_type num_on_grid;
129 struct pm_nonperiodic_sortindex_comparator
132 const part_slab_data *data;
135 pm_nonperiodic_sortindex_comparator(
const part_slab_data *data_) : data(data_) {}
137 bool operator()(
const large_numpart_type &a,
const large_numpart_type &b)
const
139 return data[a].globalindex < data[b].globalindex;
153 partbuf *partin, *partout;
155 size_t nimport, nexport;
157 size_t *Sndpm_count, *Sndpm_offset;
158 size_t *Rcvpm_count, *Rcvpm_offset;
160 void pmforce_nonperiodic_uniform_optimized_prepare_density(
int grnr);
161 void pmforce_nonperiodic_uniform_optimized_readout_forces_or_potential(
int grnr,
int dim);
pm_nonperiodic(MPI_Comm comm)