ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
fft::anonymous_namespace{fft.cpp} Namespace Reference

Functions

int calc_local_mesh (const int *n_pos, const int *n_grid, const int *mesh, const double *mesh_off, int *loc_mesh, int *start)
 Calculate the local fft mesh.
 
int calc_send_block (const int *pos1, const int *grid1, const int *pos2, const int *grid2, const int *mesh, const double *mesh_off, int *block)
 Calculate a send (or recv.) block for grid communication during a decomposition change.
 
template<typename FloatType >
void pack_block_permute1 (FloatType const *const in, FloatType *const out, const int *start, const int *size, const int *dim, int element)
 Pack a block with dimensions size[0] * size[1] * size[2] starting at start of an input 3D-grid with dimension dim into an output 3D-grid with dimensions size[2] * size[0] * size[1] with a simultaneous one-fold permutation of the indices.
 
template<typename FloatType >
void pack_block_permute2 (FloatType const *const in, FloatType *const out, const int *start, const int *size, const int *dim, int element)
 Pack a block with dimensions size[0] * size[1] * size[2] starting at start of an input 3D-grid with dimension dim into an output 3D-grid with dimensions size[2] * size[0] * size[1] with a simultaneous two-fold permutation of the indices.
 

Function Documentation

◆ calc_local_mesh()

int fft::anonymous_namespace{fft.cpp}::calc_local_mesh ( const int *  n_pos,
const int *  n_grid,
const int *  mesh,
const double *  mesh_off,
int *  loc_mesh,
int *  start 
)

Calculate the local fft mesh.

Calculate the local mesh (loc_mesh) of a node at position (n_pos) in a node grid (n_grid) for a global mesh of size (mesh) and a mesh offset (mesh_off (in mesh units)) and store also the first point (start) of the local mesh.

Parameters
[in]n_posPosition of the node in n_grid.
[in]n_gridnode grid.
[in]meshglobal mesh dimensions.
[in]mesh_offglobal mesh offset.
[out]loc_meshlocal mesh dimension.
[out]startfirst point of local mesh in global mesh.
Returns
Number of mesh points in local mesh.

Definition at line 222 of file fft.cpp.

References calc_local_mesh().

Referenced by calc_local_mesh(), and calc_send_block().

◆ calc_send_block()

int fft::anonymous_namespace{fft.cpp}::calc_send_block ( const int *  pos1,
const int *  grid1,
const int *  pos2,
const int *  grid2,
const int *  mesh,
const double *  mesh_off,
int *  block 
)

Calculate a send (or recv.) block for grid communication during a decomposition change.

Calculate the send block specification (block = lower left corner and upper right corner) which a node at position (pos1) in the actual node grid (grid1) has to send to another node at position (pos2) in the desired node grid (grid2). The global mesh, subject to communication, is specified via its size (mesh) and its mesh offset (mesh_off (in mesh units)).

For the calculation of a receive block you have to change the arguments in the following way:

  • pos1: position of receiving node in the desired node grid.
  • grid1: desired node grid.
  • pos2: position of the node you intend to receive the data from in the actual node grid.
  • grid2: actual node grid.
Parameters
[in]pos1Position of send node in grid1.
[in]grid1node grid 1.
[in]pos2Position of recv node in grid2.
[in]grid2node grid 2.
[in]meshglobal mesh dimensions.
[in]mesh_offglobal mesh offset.
[out]blocksend block specification.
Returns
Size of the send block.

Definition at line 266 of file fft.cpp.

References block(), calc_local_mesh(), and calc_send_block().

Referenced by calc_send_block().

◆ pack_block_permute1()

template<typename FloatType >
void fft::anonymous_namespace{fft.cpp}::pack_block_permute1 ( FloatType const *const  in,
FloatType *const  out,
const int *  start,
const int *  size,
const int *  dim,
int  element 
)

Pack a block with dimensions size[0] * size[1] * size[2] starting at start of an input 3D-grid with dimension dim into an output 3D-grid with dimensions size[2] * size[0] * size[1] with a simultaneous one-fold permutation of the indices.

The permutation is defined as: slow_in -> fast_out, mid_in ->slow_out, fast_in -> mid_out.

An element (i0_in, i1_in, i2_in) is then (i0_out = i1_in-start[1], i1_out = i2_in-start[2], i2_out = i0_in-start[0]) and for the linear indices we have:

  • li_in = i2_in + size[2] * (i1_in + (size[1]*i0_in))
  • li_out = i2_out + size[0] * (i1_out + (size[2]*i0_out))

For index definition see fft_pack_block.

Parameters
[in]ininput 3D-grid.
[out]outoutput 3D-grid (block).
[in]startstart index of the block in the in-grid.
[in]sizesize of the block (=dimension of the out-grid).
[in]dimsize of the in-grid.
[in]elementsize of a grid element (e.g. 1 for Real, 2 for Complex).

Definition at line 308 of file fft.cpp.

References pack_block_permute1().

Referenced by pack_block_permute1().

◆ pack_block_permute2()

template<typename FloatType >
void fft::anonymous_namespace{fft.cpp}::pack_block_permute2 ( FloatType const *const  in,
FloatType *const  out,
const int *  start,
const int *  size,
const int *  dim,
int  element 
)

Pack a block with dimensions size[0] * size[1] * size[2] starting at start of an input 3D-grid with dimension dim into an output 3D-grid with dimensions size[2] * size[0] * size[1] with a simultaneous two-fold permutation of the indices.

The permutation is defined as: slow_in -> mid_out, mid_in ->fast_out, fast_in -> slow_out.

An element (i0_in, i1_in, i2_in) is then (i0_out = i2_in-start[2], i1_out = i0_in-start[0], i2_out = i1_in-start[1]) and for the linear indices we have:

  • li_in = i2_in + size[2] * (i1_in + (size[1]*i0_in))
  • li_out = i2_out + size[0] * (i1_out + (size[2]*i0_out))

For index definition see fft_pack_block.

Parameters
[in]ininput 3D-grid.
[out]outoutput 3D-grid (block).
[in]startstart index of the block in the in-grid.
[in]sizesize of the block (=dimension of the out-grid).
[in]dimsize of the in-grid.
[in]elementsize of a grid element (e.g. 1 for Real, 2 for Complex).

Definition at line 357 of file fft.cpp.

References pack_block_permute2().

Referenced by pack_block_permute2().