OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid > Class Template Reference

This class is an helper for the communication of grid_dist_id. More...

Detailed Description

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
class grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >

This class is an helper for the communication of grid_dist_id.

Template Parameters
dimDimensionality of the grid
StType of space where the grid is living
Tobject the grid is storing
DecompositionClass that decompose the grid for example CartDecomposition
MemoryIs the allocator
device_gridof base structure is going to store the data
See Also
grid_dist_id

Definition at line 177 of file grid_dist_id_comm.hpp.

#include <grid_dist_id_comm.hpp>

+ Inheritance diagram for grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >:

Public Member Functions

void grids_reconstruct (openfpm::vector< openfpm::vector< aggregate< device_grid, SpaceBox< dim, long int >>>> &m_oGrid_recv, openfpm::vector< device_grid > &loc_grid, openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, CellDecomposer_sm< dim, St, shift< dim, St >> &cd_sm)
 Reconstruct the local grids. More...
 
void labelIntersectionGridsProcessor (Decomposition &dec, CellDecomposer_sm< dim, St, shift< dim, St >> &cd_sm, openfpm::vector< device_grid > &loc_grid_old, openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext_old, openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext_global, openfpm::vector< openfpm::vector< aggregate< device_grid, SpaceBox< dim, long int >>>> &lbl_b, openfpm::vector< size_t > &prc_sz)
 Label intersection grids for mappings. More...
 
void map_ (Decomposition &dec, CellDecomposer_sm< dim, St, shift< dim, St >> &cd_sm, openfpm::vector< device_grid > &loc_grid, openfpm::vector< device_grid > &loc_grid_old, openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext_old, openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext_global)
 Moves all the grids that does not belong to the local processor to the respective processor. More...
 
template<int... prp>
void ghost_get_ (const openfpm::vector< ip_box_grid< dim >> &ig_box, const openfpm::vector< ep_box_grid< dim >> &eg_box, const openfpm::vector< i_lbox_grid< dim >> &loc_ig_box, const openfpm::vector< e_lbox_grid< dim >> &loc_eg_box, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, openfpm::vector< device_grid > &loc_grid, std::unordered_map< size_t, size_t > &g_id_to_external_ghost_box)
 It fill the ghost part of the grids. More...
 
template<template< typename, typename > class op, int... prp>
void ghost_put_ (const openfpm::vector< ip_box_grid< dim >> &ig_box, const openfpm::vector< ep_box_grid< dim >> &eg_box, const openfpm::vector< i_lbox_grid< dim >> &loc_ig_box, const openfpm::vector< e_lbox_grid< dim >> &loc_eg_box, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, openfpm::vector< device_grid > &loc_grid, openfpm::vector< std::unordered_map< size_t, size_t >> &g_id_to_internal_ghost_box)
 It merge the information in the ghost with the real information. More...
 
 grid_dist_id_comm ()
 Constructor. More...
 

Private Member Functions

template<int... prp>
void ghost_get_local (const openfpm::vector< i_lbox_grid< dim >> &loc_ig_box, const openfpm::vector< e_lbox_grid< dim >> &loc_eg_box, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, openfpm::vector< device_grid > &loc_grid, std::unordered_map< size_t, size_t > &g_id_to_external_ghost_box)
 Sync the local ghost part. More...
 
template<template< typename, typename > class op, int... prp>
void ghost_put_local (const openfpm::vector< i_lbox_grid< dim >> &loc_ig_box, const openfpm::vector< e_lbox_grid< dim >> &loc_eg_box, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, openfpm::vector< device_grid > &loc_grid, openfpm::vector< std::unordered_map< size_t, size_t >> &g_id_to_external_ghost_box)
 Sync the local ghost part. More...
 
template<int... prp>
void send_and_receive_ghost (ExtPreAlloc< Memory > **prAlloc_prp, ExtPreAlloc< Memory > **prRecv_prp, const openfpm::vector< ip_box_grid< dim >> &ig_box, const openfpm::vector< ep_box_grid< dim >> &eg_box, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, openfpm::vector< device_grid > &loc_grid, size_t &req)
 this function create send and receive asynchronously to receive ghosts part More...
 
template<int... prp>
void process_received (ExtPreAlloc< Memory > *prRecv_prp, const openfpm::vector< ep_box_grid< dim >> &eg_box, openfpm::vector< device_grid > &loc_grid, std::unordered_map< size_t, size_t > &g_id_to_external_ghost_box)
 Process the received data. More...
 

Private Attributes

Vclusterv_cl
 VCluster.
 
openfpm::vector< size_t > p_map_req
 Maps the processor id with the communication request into map procedure.
 
openfpm::vector< size_t > prc_recv_map
 Stores the list of processors that communicate with us (local processor)
 
openfpm::vector< size_t > recv_sz_map
 Stores the size of the elements added for each processor that communicate with us (local processor)
 
openfpm::vector
< openfpm::vector< aggregate
< device_grid, SpaceBox< dim,
long int > > > > 
m_oGrid
 
Memory g_send_prp_mem
 Memory for the ghost sending buffer.
 
Memory g_recv_prp_mem
 Memory for the ghost sending buffer.
 

Constructor & Destructor Documentation

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::grid_dist_id_comm ( )
inline

Constructor.

Definition at line 1036 of file grid_dist_id_comm.hpp.

Member Function Documentation

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
template<int... prp>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::ghost_get_ ( const openfpm::vector< ip_box_grid< dim >> &  ig_box,
const openfpm::vector< ep_box_grid< dim >> &  eg_box,
const openfpm::vector< i_lbox_grid< dim >> &  loc_ig_box,
const openfpm::vector< e_lbox_grid< dim >> &  loc_eg_box,
const openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
openfpm::vector< device_grid > &  loc_grid,
std::unordered_map< size_t, size_t > &  g_id_to_external_ghost_box 
)
inline

It fill the ghost part of the grids.

Parameters
ig_boxinternal ghost box
eg_boxexternal ghost box
loc_ig_boxlocal internal ghost box
loc_eg_boxlocal external ghost box
gdb_extlocal grids information
loc_gridset of local grid
g_id_to_external_ghost_boxindex to external ghost box

Definition at line 817 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
template<int... prp>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::ghost_get_local ( const openfpm::vector< i_lbox_grid< dim >> &  loc_ig_box,
const openfpm::vector< e_lbox_grid< dim >> &  loc_eg_box,
const openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
openfpm::vector< device_grid > &  loc_grid,
std::unordered_map< size_t, size_t > &  g_id_to_external_ghost_box 
)
inlineprivate

Sync the local ghost part.

Template Parameters
prp...properties to sync
Parameters
loc_ig_boxlocal internel ghost boxes
loc_eg_boxlocal external ghost boxes
gdb_extinformation about the local grids
loc_gridlocal grids
g_id_to_external_ghost_boxfrom global index to external ghost box

For all the sub-domains

For all the internal ghost boxes of each sub-domain

Definition at line 215 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
template<template< typename, typename > class op, int... prp>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::ghost_put_ ( const openfpm::vector< ip_box_grid< dim >> &  ig_box,
const openfpm::vector< ep_box_grid< dim >> &  eg_box,
const openfpm::vector< i_lbox_grid< dim >> &  loc_ig_box,
const openfpm::vector< e_lbox_grid< dim >> &  loc_eg_box,
const openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
openfpm::vector< device_grid > &  loc_grid,
openfpm::vector< std::unordered_map< size_t, size_t >> &  g_id_to_internal_ghost_box 
)
inline

It merge the information in the ghost with the real information.

Template Parameters
opmerge operation
Parameters
ig_boxinternal ghost box
eg_boxexternal ghost box
loc_ig_boxlocal internal ghost box
loc_eg_boxlocal external ghost box
gdb_extlocal grids information
loc_gridset of local grid
g_id_to_internal_ghost_boxindex to internal ghost box

Receive the information from each processors

Resize the receiving buffer

Definition at line 860 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
template<template< typename, typename > class op, int... prp>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::ghost_put_local ( const openfpm::vector< i_lbox_grid< dim >> &  loc_ig_box,
const openfpm::vector< e_lbox_grid< dim >> &  loc_eg_box,
const openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
openfpm::vector< device_grid > &  loc_grid,
openfpm::vector< std::unordered_map< size_t, size_t >> &  g_id_to_external_ghost_box 
)
inlineprivate

Sync the local ghost part.

Template Parameters
prp...properties to sync
Parameters
loc_ig_boxlocal internel ghost boxes
loc_eg_boxlocal external ghost boxes
gdb_extinformation about the local grids
loc_gridlocal grids
g_id_to_external_ghost_boxglobal-if to external ghost box

For all the sub-domains

For all the external ghost boxes of each sub-domain

Definition at line 298 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::grids_reconstruct ( openfpm::vector< openfpm::vector< aggregate< device_grid, SpaceBox< dim, long int >>>> &  m_oGrid_recv,
openfpm::vector< device_grid > &  loc_grid,
openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
CellDecomposer_sm< dim, St, shift< dim, St >> &  cd_sm 
)
inline

Reconstruct the local grids.

Parameters
m_oGrid_recvVector of labeled grids to combine into a local grid
loc_gridlocal grids
gdb_extinformation of the local grids
cd_smCell-decomposer

Definition at line 552 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::labelIntersectionGridsProcessor ( Decomposition dec,
CellDecomposer_sm< dim, St, shift< dim, St >> &  cd_sm,
openfpm::vector< device_grid > &  loc_grid_old,
openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext_old,
openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext_global,
openfpm::vector< openfpm::vector< aggregate< device_grid, SpaceBox< dim, long int >>>> &  lbl_b,
openfpm::vector< size_t > &  prc_sz 
)
inline

Label intersection grids for mappings.

Parameters
decDecomposition
loc_grid_oldold local grids
cd_smCell-decomposer
gdb_extinformation of the local grids
gdb_ext_oldinformation of the old local grids
gdb_ext_globalinformation of the grids globaly
lbl_blabel for each grid
prc_szFor each processor the number of grids to send to

Definition at line 631 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::map_ ( Decomposition dec,
CellDecomposer_sm< dim, St, shift< dim, St >> &  cd_sm,
openfpm::vector< device_grid > &  loc_grid,
openfpm::vector< device_grid > &  loc_grid_old,
openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext_old,
openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext_global 
)
inline

Moves all the grids that does not belong to the local processor to the respective processor.

This function in general is called if the decomposition change

Parameters
decDecomposition
cd_smcell-decomposer
loc_gridset of local grids
loc_grid_oldset of old local grids
gdb_extinformation of the local grids
gdb_ext_oldinformation of the old local grids
gdb_ext_globalit contain the decomposition at global level

Definition at line 756 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
template<int... prp>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::process_received ( ExtPreAlloc< Memory > *  prRecv_prp,
const openfpm::vector< ep_box_grid< dim >> &  eg_box,
openfpm::vector< device_grid > &  loc_grid,
std::unordered_map< size_t, size_t > &  g_id_to_external_ghost_box 
)
inlineprivate

Process the received data.

Parameters
eg_boxexternal ghost box

Definition at line 493 of file grid_dist_id_comm.hpp.

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
template<int... prp>
void grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::send_and_receive_ghost ( ExtPreAlloc< Memory > **  prAlloc_prp,
ExtPreAlloc< Memory > **  prRecv_prp,
const openfpm::vector< ip_box_grid< dim >> &  ig_box,
const openfpm::vector< ep_box_grid< dim >> &  eg_box,
const openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext,
openfpm::vector< device_grid > &  loc_grid,
size_t &  req 
)
inlineprivate

this function create send and receive asynchronously to receive ghosts part

Parameters
ig_boxinternal ghost box
eg_boxexternal ghost box

Receive the information from each processors

Resize the receiving buffer

Definition at line 368 of file grid_dist_id_comm.hpp.

Field Documentation

template<unsigned int dim, typename St, typename T, typename Decomposition = CartDecomposition<dim,St>, typename Memory = HeapMemory, typename device_grid = grid_cpu<dim,T>>
openfpm::vector<openfpm::vector<aggregate<device_grid,SpaceBox<dim,long int> > > > grid_dist_id_comm< dim, St, T, Decomposition, Memory, device_grid >::m_oGrid
private

For each near processor, outgoing intersection grid

Warning
m_oGrid is assumed to be an ordered list first id is grid second id is the processor id

Definition at line 195 of file grid_dist_id_comm.hpp.


The documentation for this class was generated from the following file: