OpenFPM  5.2.0
Project that contain the implementation of distributed structures
grid_base_impl< dim, T, S, layout_base, ord_type > Class Template Reference

Implementation of a N-dimensional grid. More...

#include <grid_base_implementation.hpp>

Public Types

typedef layout layout_type
 memory layout
 
typedef grid_key_dx< dim > access_key
 Access key.
 
typedef T::type T_type
 boost::vector that describe the data type
 
typedef layout_base< T > layout_base_
 base layout type
 
typedef ord_type linearizer_type
 
typedef T background_type
 
typedef int yes_i_am_grid
 it define that this data-structure is a grid
 
typedef memory_traits_lin< typename T::type >::type memory_lin
 Definition of the layout.
 
typedef encapc< dim, T, layoutcontainer
 Object container for T, it is the return type of get_o it return a object type trough.
 
typedef T value_type
 The object type the grid is storing.
 

Public Member Functions

 grid_base_impl () THROW
 Default constructor.
 
 grid_base_impl (const grid_base_impl &g) THROW
 create a grid from another grid More...
 
 grid_base_impl (const size_t &sz) THROW
 create a grid of size sz on each direction More...
 
 grid_base_impl (const size_t(&sz)[dim]) THROW
 Constructor. More...
 
 ~grid_base_impl () THROW
 Destructor.
 
grid_base_impl< dim, T, S, layout_base > & operator= (const grid_base_impl< dim, T, S, layout_base > &g)
 It copy a grid. More...
 
grid_base_impl< dim, T, S, layout_base > & operator= (grid_base_impl< dim, T, S, layout_base > &&g)
 It copy a grid. More...
 
bool operator== (const grid_base_impl< dim, T, S, layout_base > &g)
 Compare two grids. More...
 
grid_base_impl< dim, T, S, layout_base > duplicate () const THROW
 create a duplicated version of the grid More...
 
int size (int i) const
 Get the size if the grid in the direction i.
 
const ord_type & getGrid () const
 Return the internal grid information. More...
 
void setMemory ()
 Create the object that provide memory. More...
 
template<unsigned int p>
auto getMemory () -> decltype(boost::fusion::at_c< p >(data_).getMemory())
 Return the memory object. More...
 
template<unsigned int p = 0>
void setMemory (S &m)
 Set the object that provide memory from outside. More...
 
void setMemoryArray (S *m)
 Set the object that provide memory from outside. More...
 
template<unsigned int p = 0>
void * getPointer ()
 Return a plain pointer to the internal data. More...
 
template<unsigned int p = 0>
const void * getPointer () const
 Return a plain pointer to the internal data. More...
 
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get<p>(data_,g1,grid_key_dx<dim>()))>
r_type insert (const grid_key_dx< dim > &v1)
 In this case insert is equivalent to get. More...
 
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type get_usafe (const grid_key_dx< dim > &v1)
 Get the reference of the selected element. More...
 
int getBlockEdgeSize ()
 No blocks here, it return 1. More...
 
void setGPUInsertBuffer (unsigned int nb, unsigned int nt)
 No blocks here, it does nothing. More...
 
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_c<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type get_unsafe (const grid_key_dx< dim > &v1) const
 Get the const reference of the selected element. More...
 
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type get (const grid_key_dx< dim > &v1)
 Get the reference of the selected element. More...
 
__device__ __host__ unsigned char getFlag (const grid_key_dx< dim > &v1) const
 Get the point flag (in this case just return 0) More...
 
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_c<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type get (const grid_key_dx< dim > &v1) const
 Get the const reference of the selected element. More...
 
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_lin<p>(data_,g1,0))>
__device__ __host__ r_type get (const size_t lin_id)
 Get the reference of the selected element. More...
 
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_lin<p>(data_,g1,0))>
__device__ __host__ const r_type get (size_t lin_id) const
 Get the const reference of the selected element. More...
 
encapc< dim, T, layoutget_o (const grid_key_dx< dim > &v1)
 Get the of the selected element as a boost::fusion::vector. More...
 
const encapc< dim, T, layoutget_o (const grid_key_dx< dim > &v1) const
 Get the of the selected element as a boost::fusion::vector. More...
 
encapc< dim, T, layoutinsert_o (const grid_key_dx< dim > &v1)
 Get the of the selected element as a boost::fusion::vector. More...
 
encapc< dim, T, layoutget_o (size_t v1)
 Get the of the selected element as a boost::fusion::vector. More...
 
const encapc< dim, T, layoutget_o (size_t v1) const
 Get the of the selected element as a boost::fusion::vector. More...
 
template<int prp>
void fill (unsigned char fl)
 Fill the memory with the selected byte. More...
 
void remove (Box< dim, long int > &section_to_delete)
 Remove all the points in this region. More...
 
void copyRemoveReset ()
 Reset the queue to remove and copy section of grids. More...
 
bool isSkipLabellingPossible ()
 This function check if keep geometry is possible for this grid. More...
 
void copy_to (const grid_base_impl< dim, T, S, layout_base > &grid_src, const Box< dim, long int > &box_src, const Box< dim, long int > &box_dst)
 copy an external grid into a specific place into this grid More...
 
template<unsigned int ... prp>
void copy_to_prp (const grid_base_impl< dim, T, S, layout_base > &grid_src, const Box< dim, size_t > &box_src, const Box< dim, size_t > &box_dst)
 copy an external grid into a specific place into this grid More...
 
void clear ()
 It does nothing.
 
template<template< typename, typename > class op, unsigned int ... prp>
void copy_to_op (const grid_base_impl< dim, T, S, layout_base > &gs, const Box< dim, size_t > &bx_src, const Box< dim, size_t > &bx_dst)
 copy an external grid into a specific place into this grid More...
 
void resize (const size_t(&sz)[dim], size_t opt=DATA_ON_HOST|DATA_ON_DEVICE, unsigned int blockSize=1)
 Resize the grid. More...
 
void resize_no_device (const size_t(&sz)[dim])
 Resize the space. More...
 
void remove (size_t key)
 Remove one element valid only on 1D. More...
 
void swap_nomode (grid_base_impl< dim, T, S, layout_base > &grid)
 It swap the objects A become B and B become A using A.swap(B);. More...
 
void swap (grid_base_impl< dim, T, S, layout_base, ord_type > &grid)
 It swap the objects A become B and B become A using A.swap(B);. More...
 
void swap (grid_base_impl< dim, T, S, layout_base > &&grid)
 It move the allocated object from one grid to another. More...
 
template<unsigned int ... prp>
__device__ __host__ void set (const grid_key_dx< dim > &key1, const grid_base_impl &g, const grid_key_dx< dim > &key2)
 set only some properties More...
 
template<typename Memory >
void set (grid_key_dx< dim > dx, const encapc< 1, T, Memory > &obj)
 set an element of the grid More...
 
void set (grid_key_dx< dim > dx, const T &obj)
 set an element of the grid More...
 
void set (const grid_key_dx< dim > &key1, const grid_base_impl< dim, T, S, layout_base > &g, const grid_key_dx< dim > &key2)
 Set an element of the grid from another element of another grid. More...
 
void set (const size_t key1, const grid_base_impl< dim, T, S, layout_base > &g, const size_t key2)
 Set an element of the grid from another element of another grid. More...
 
template<typename Mem >
void set (const grid_key_dx< dim > &key1, const grid_base_impl< dim, T, Mem, layout_base > &g, const grid_key_dx< dim > &key2)
 Set an element of the grid from another element of another grid. More...
 
template<typename Mem , template< typename > class layout_base2>
void set_general (const grid_key_dx< dim > &key1, const grid_base_impl< dim, T, Mem, layout_base2 > &g, const grid_key_dx< dim > &key2)
 Set an element of the grid from another element of another grid. More...
 
size_t size () const
 return the size of the grid More...
 
grid_key_dx_iterator_sub< dim > getSubIterator (const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop) const
 Return a sub-grid iterator. More...
 
grid_key_dx_iterator_sub< dim > getSubIterator (size_t m)
 Return a sub-grid iterator. More...
 
grid_key_dx_iterator< dim > getIterator () const
 Return a grid iterator. More...
 
template<unsigned int ... prp>
void deviceToHost ()
 Synchronize the memory buffer in the device with the memory in the host.
 
template<unsigned int ... prp>
void deviceToHost (size_t start, size_t stop)
 Synchronize the memory buffer in the device with the memory in the host.
 
template<unsigned int ... prp>
void hostToDeviceNUMA (size_t start, size_t stop)
 Synchronize the memory buffer in the device with the memory in the host (respecting the NUMA domains)
 
template<unsigned int ... prp>
void hostToDeviceNUMA ()
 Synchronize the memory buffer in the device with the memory in the host (respecting the NUMA domains)
 
template<unsigned int ... prp>
void hostToDevice (size_t start, size_t stop)
 Synchronize the memory buffer in the device with the memory in the host.
 
template<unsigned int ... prp>
void hostToDevice ()
 Copy the memory from host to device.
 
grid_gpu_ker< dim, T_, layout_base, linearizer_type > toKernel ()
 Convert the grid into a data-structure compatible for computing into GPU. More...
 
const grid_gpu_ker< dim, T_, layout_base, linearizer_type > toKernel () const
 Convert the grid into a data-structure compatible for computing into GPU. More...
 
template<unsigned int Np>
grid_key_dx_iterator< dim, stencil_offset_compute< dim, Np > > getIteratorStencil (const grid_key_dx< dim >(&stencil_pnt)[Np]) const
 Return a grid iterator. More...
 
grid_key_dx_iterator_sub< dim > getIterator (const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop, bool to_init=false) const
 Return a grid iterator over all points included between start and stop point. More...
 
layoutget_internal_data_ ()
 return the internal data_ More...
 
const layoutget_internal_data_ () const
 return the internal data_ More...
 
void removeAddUnpackReset ()
 In this case it does nothing. More...
 
template<unsigned int ... prp, typename context_type >
void removeAddUnpackFinalize (const context_type &gpuContext, int opt)
 In this case it does nothing. More...
 
template<unsigned int ... prp, typename context_type >
void removeCopyToFinalize (const context_type &gpuContext, int opt)
 In this case it does nothing. More...
 
void resetFlush ()
 It does nothing.
 

Static Public Member Functions

static bool is_unpack_header_supported ()
 Indicate that unpacking the header is supported. More...
 

Static Public Attributes

static constexpr unsigned int dims = dim
 expose the dimansionality as a static const
 

Protected Attributes

layout data_
 Memory layout specification + memory chunk pointer.
 
ord_type g1
 This is a structure that store all information related to the grid and how indexes are linearized.
 

Private Types

typedef layout_base< T >::type layout
 memory layout
 
typedef apply_transform< layout_base, T >::type T_
 

Private Member Functions

void resize_impl_device (const size_t(&sz)[dim], grid_base_impl< dim, T, S, layout_base, ord_type > &grid_new, unsigned int blockSize=1)
 
void resize_impl_host (const size_t(&sz)[dim], grid_base_impl< dim, T, S, layout_base, ord_type > &grid_new)
 
void resize_impl_memset (grid_base_impl< dim, T, S, layout_base, ord_type > &grid_new)
 

Private Attributes

bool is_mem_init = false
 Is the memory initialized.
 
bool isExternal
 The memory allocator is not internally created.
 

Detailed Description

template<unsigned int dim, typename T, typename S, template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
class grid_base_impl< dim, T, S, layout_base, ord_type >

Implementation of a N-dimensional grid.

Template Parameters
dimdimansionality of the grid
Ttype store by the grid
SMemory pool from where to take the memory
layout_baselayout memory meta-function (the meta-function used to construct layout_)

Definition at line 378 of file grid_base_implementation.hpp.

Constructor & Destructor Documentation

◆ grid_base_impl() [1/3]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_base_impl< dim, T, S, layout_base, ord_type >::grid_base_impl ( const grid_base_impl< dim, T, S, layout_base, ord_type > &  g)
inline

create a grid from another grid

Parameters
gthe grid to copy

Definition at line 658 of file grid_base_implementation.hpp.

◆ grid_base_impl() [2/3]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_base_impl< dim, T, S, layout_base, ord_type >::grid_base_impl ( const size_t &  sz)
inline

create a grid of size sz on each direction

Parameters
szsize of the grid on each dimensions

Definition at line 669 of file grid_base_implementation.hpp.

◆ grid_base_impl() [3/3]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_base_impl< dim, T, S, layout_base, ord_type >::grid_base_impl ( const size_t(&)  sz[dim])
inline

Constructor.

It construct a grid of specified size

Parameters
szarray that indicate the size of the grid in each dimension

Definition at line 682 of file grid_base_implementation.hpp.

Member Function Documentation

◆ copy_to()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::copy_to ( const grid_base_impl< dim, T, S, layout_base > &  grid_src,
const Box< dim, long int > &  box_src,
const Box< dim, long int > &  box_dst 
)
inline

copy an external grid into a specific place into this grid

It copy the area indicated by the box_src from grid_src into this grid at the place box_dst. The volume of box_src and box_dst

box_dst and box_src are adjusted if box_dst overflow the destination grid

Parameters
grid_srcsource grid
box_srcsource box
box_dstdestination box

Definition at line 1269 of file grid_base_implementation.hpp.

◆ copy_to_op()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<template< typename, typename > class op, unsigned int ... prp>
void grid_base_impl< dim, T, S, layout_base, ord_type >::copy_to_op ( const grid_base_impl< dim, T, S, layout_base > &  gs,
const Box< dim, size_t > &  bx_src,
const Box< dim, size_t > &  bx_dst 
)
inline

copy an external grid into a specific place into this grid

It copy the area indicated by the box_src from grid_src into this grid at the place box_dst. The volume of box_src and box_dst

Parameters
grid_srcsource grid
box_srcsource box
box_dstdestination box

Definition at line 1371 of file grid_base_implementation.hpp.

◆ copy_to_prp()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int ... prp>
void grid_base_impl< dim, T, S, layout_base, ord_type >::copy_to_prp ( const grid_base_impl< dim, T, S, layout_base > &  grid_src,
const Box< dim, size_t > &  box_src,
const Box< dim, size_t > &  box_dst 
)
inline

copy an external grid into a specific place into this grid

It copy the area indicated by the box_src from grid_src into this grid at the place box_dst. The volume of box_src and box_dst

Parameters
grid_srcsource grid
box_srcsource box
box_dstdestination box

Definition at line 1332 of file grid_base_implementation.hpp.

◆ copyRemoveReset()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::copyRemoveReset ( )
inline

Reset the queue to remove and copy section of grids.

Note
for this particular implementation it does nothing

Definition at line 1243 of file grid_base_implementation.hpp.

◆ duplicate()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_base_impl<dim,T,S,layout_base> grid_base_impl< dim, T, S, layout_base, ord_type >::duplicate ( ) const
inline

create a duplicated version of the grid

Returns
a duplicated version of the grid

Create a completely new grid with sz

Set the allocator and allocate the memory

1-D copy (This case is simple we use raw memory copy because is the fastest option)

N-D copy

create a source grid iterator

Definition at line 768 of file grid_base_implementation.hpp.

◆ fill()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<int prp>
void grid_base_impl< dim, T, S, layout_base, ord_type >::fill ( unsigned char  fl)
inline

Fill the memory with the selected byte.

Warning
It is a low level memory operation it ignore any type and semantic safety
Parameters
flbyte pattern to fill

Definition at line 1218 of file grid_base_implementation.hpp.

◆ get() [1/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type grid_base_impl< dim, T, S, layout_base, ord_type >::get ( const grid_key_dx< dim > &  v1)
inline

Get the reference of the selected element.

Parameters
v1grid_key that identify the element in the grid
Returns
the reference of the element

Definition at line 1033 of file grid_base_implementation.hpp.

◆ get() [2/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_c<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type grid_base_impl< dim, T, S, layout_base, ord_type >::get ( const grid_key_dx< dim > &  v1) const
inline

Get the const reference of the selected element.

Parameters
v1grid_key that identify the element in the grid
Returns
the const reference of the element

Definition at line 1062 of file grid_base_implementation.hpp.

◆ get() [3/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_lin<p>(data_,g1,0))>
__device__ __host__ r_type grid_base_impl< dim, T, S, layout_base, ord_type >::get ( const size_t  lin_id)
inline

Get the reference of the selected element.

Parameters
lin_idlinearized element that identify the element in the grid
Returns
the reference of the element

Definition at line 1079 of file grid_base_implementation.hpp.

◆ get() [4/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_lin<p>(data_,g1,0))>
__device__ __host__ const r_type grid_base_impl< dim, T, S, layout_base, ord_type >::get ( size_t  lin_id) const
inline

Get the const reference of the selected element.

Parameters
lin_idlinearized element that identify the element in the grid
Returns
the const reference of the element

Definition at line 1096 of file grid_base_implementation.hpp.

◆ get_internal_data_() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
layout& grid_base_impl< dim, T, S, layout_base, ord_type >::get_internal_data_ ( )
inline

return the internal data_

return the internal data_

Definition at line 1951 of file grid_base_implementation.hpp.

◆ get_internal_data_() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
const layout& grid_base_impl< dim, T, S, layout_base, ord_type >::get_internal_data_ ( ) const
inline

return the internal data_

return the internal data_

Definition at line 1961 of file grid_base_implementation.hpp.

◆ get_o() [1/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
encapc<dim,T,layout> grid_base_impl< dim, T, S, layout_base, ord_type >::get_o ( const grid_key_dx< dim > &  v1)
inline

Get the of the selected element as a boost::fusion::vector.

Get the selected element as a boost::fusion::vector

Parameters
v1grid_key that identify the element in the grid
See also
encap_c
Returns
an encap_c that is the representation of the object (careful is not the object)

Definition at line 1117 of file grid_base_implementation.hpp.

◆ get_o() [2/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
const encapc<dim,T,layout> grid_base_impl< dim, T, S, layout_base, ord_type >::get_o ( const grid_key_dx< dim > &  v1) const
inline

Get the of the selected element as a boost::fusion::vector.

Get the selected element as a boost::fusion::vector

Parameters
v1grid_key that identify the element in the grid
See also
encap_c
Returns
an encap_c that is the representation of the object (careful is not the object)

Definition at line 1137 of file grid_base_implementation.hpp.

◆ get_o() [3/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
encapc<dim,T,layout> grid_base_impl< dim, T, S, layout_base, ord_type >::get_o ( size_t  v1)
inline

Get the of the selected element as a boost::fusion::vector.

Get the selected element as a boost::fusion::vector

Parameters
v1linearized id that identify the element in the grid
See also
encap_c
Returns
an encap_c that is the representation of the object (careful is not the object)

Definition at line 1180 of file grid_base_implementation.hpp.

◆ get_o() [4/4]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
const encapc<dim,T,layout> grid_base_impl< dim, T, S, layout_base, ord_type >::get_o ( size_t  v1) const
inline

Get the of the selected element as a boost::fusion::vector.

Get the selected element as a boost::fusion::vector

Parameters
v1linearized id that identify the element in the grid
See also
encap_c
Returns
an encap_c that is the representation of the object (careful is not the object)

Definition at line 1200 of file grid_base_implementation.hpp.

◆ get_unsafe()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get_c<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type grid_base_impl< dim, T, S, layout_base, ord_type >::get_unsafe ( const grid_key_dx< dim > &  v1) const
inline

Get the const reference of the selected element.

Parameters
v1grid_key that identify the element in the grid
Returns
the const reference of the element

Definition at line 1017 of file grid_base_implementation.hpp.

◆ get_usafe()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get<p>(data_,g1,grid_key_dx<dim>()))>
__device__ __host__ r_type grid_base_impl< dim, T, S, layout_base, ord_type >::get_usafe ( const grid_key_dx< dim > &  v1)
inline

Get the reference of the selected element.

Parameters
v1grid_key that identify the element in the grid
Returns
the reference of the element

Definition at line 983 of file grid_base_implementation.hpp.

◆ getBlockEdgeSize()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
int grid_base_impl< dim, T, S, layout_base, ord_type >::getBlockEdgeSize ( )
inline

No blocks here, it return 1.

Returns
1

Definition at line 995 of file grid_base_implementation.hpp.

◆ getFlag()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
__device__ __host__ unsigned char grid_base_impl< dim, T, S, layout_base, ord_type >::getFlag ( const grid_key_dx< dim > &  v1) const
inline

Get the point flag (in this case just return 0)

Parameters
v1grid_key that identify the element in the grid
Returns
zero

Definition at line 1049 of file grid_base_implementation.hpp.

◆ getGrid()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
const ord_type& grid_base_impl< dim, T, S, layout_base, ord_type >::getGrid ( ) const
inline

Return the internal grid information.

Return the internal grid information

Returns
the internal grid

Definition at line 834 of file grid_base_implementation.hpp.

◆ getIterator() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_key_dx_iterator<dim> grid_base_impl< dim, T, S, layout_base, ord_type >::getIterator ( ) const
inline

Return a grid iterator.

Return a grid iterator, to iterate through the grid

Returns
a grid iterator

Definition at line 1759 of file grid_base_implementation.hpp.

◆ getIterator() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_key_dx_iterator_sub<dim> grid_base_impl< dim, T, S, layout_base, ord_type >::getIterator ( const grid_key_dx< dim > &  start,
const grid_key_dx< dim > &  stop,
bool  to_init = false 
) const
inline

Return a grid iterator over all points included between start and stop point.

Return a grid iterator over all the point with the exception of the ghost part

Parameters
startpoint
stoppoint
to_initunused bool
Returns
a sub-grid iterator

Definition at line 1933 of file grid_base_implementation.hpp.

◆ getIteratorStencil()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int Np>
grid_key_dx_iterator<dim,stencil_offset_compute<dim,Np> > grid_base_impl< dim, T, S, layout_base, ord_type >::getIteratorStencil ( const grid_key_dx< dim >(&)  stencil_pnt[Np]) const
inline

Return a grid iterator.

Return a grid iterator, to iterate through the grid with stencil calculation

Returns
a grid iterator with stencil calculation

Definition at line 1916 of file grid_base_implementation.hpp.

◆ getMemory()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p>
auto grid_base_impl< dim, T, S, layout_base, ord_type >::getMemory ( ) -> decltype(boost::fusion::at_c<p>(data_).getMemory())
inline

Return the memory object.

Return the memory object

Template Parameters
parray to retrieve

Definition at line 867 of file grid_base_implementation.hpp.

◆ getPointer() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p = 0>
void* grid_base_impl< dim, T, S, layout_base, ord_type >::getPointer ( )
inline

Return a plain pointer to the internal data.

Return a plain pointer to the internal data

Returns
plain data pointer

Definition at line 938 of file grid_base_implementation.hpp.

◆ getPointer() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p = 0>
const void* grid_base_impl< dim, T, S, layout_base, ord_type >::getPointer ( ) const
inline

Return a plain pointer to the internal data.

Return a plain pointer to the internal data

Returns
plain data pointer

Definition at line 951 of file grid_base_implementation.hpp.

◆ getSubIterator() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_key_dx_iterator_sub<dim> grid_base_impl< dim, T, S, layout_base, ord_type >::getSubIterator ( const grid_key_dx< dim > &  start,
const grid_key_dx< dim > &  stop 
) const
inline

Return a sub-grid iterator.

Return a sub-grid iterator, to iterate through the grid

Parameters
startstart point
stopstop point
Returns
a sub-grid iterator

Definition at line 1733 of file grid_base_implementation.hpp.

◆ getSubIterator() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_key_dx_iterator_sub<dim> grid_base_impl< dim, T, S, layout_base, ord_type >::getSubIterator ( size_t  m)
inline

Return a sub-grid iterator.

Return a sub-grid iterator, to iterate through the grid

Parameters
mMargin
Returns
a sub-grid iterator

Definition at line 1747 of file grid_base_implementation.hpp.

◆ insert()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p, typename r_type = decltype(layout_base<T>::template get<p>(data_,g1,grid_key_dx<dim>()))>
r_type grid_base_impl< dim, T, S, layout_base, ord_type >::insert ( const grid_key_dx< dim > &  v1)
inline

In this case insert is equivalent to get.

Parameters
v1grid_key that identify the element in the grid
Returns
the reference of the element

Definition at line 965 of file grid_base_implementation.hpp.

◆ insert_o()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
encapc<dim,T,layout> grid_base_impl< dim, T, S, layout_base, ord_type >::insert_o ( const grid_key_dx< dim > &  v1)
inline

Get the of the selected element as a boost::fusion::vector.

Get the selected element as a boost::fusion::vector

Parameters
v1grid_key that identify the element in the grid
See also
encap_c
Returns
an encap_c that is the representation of the object (careful is not the object)

Definition at line 1160 of file grid_base_implementation.hpp.

◆ is_unpack_header_supported()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
static bool grid_base_impl< dim, T, S, layout_base, ord_type >::is_unpack_header_supported ( )
inlinestatic

Indicate that unpacking the header is supported.

Returns
false

Definition at line 1393 of file grid_base_implementation.hpp.

◆ isSkipLabellingPossible()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
bool grid_base_impl< dim, T, S, layout_base, ord_type >::isSkipLabellingPossible ( )
inline

This function check if keep geometry is possible for this grid.

Returns
false it does not exist this feature on this type of grids

Definition at line 1252 of file grid_base_implementation.hpp.

◆ operator=() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_base_impl<dim,T,S,layout_base>& grid_base_impl< dim, T, S, layout_base, ord_type >::operator= ( const grid_base_impl< dim, T, S, layout_base > &  g)
inline

It copy a grid.

Parameters
ggrid to copy
Returns
itself

Definition at line 701 of file grid_base_implementation.hpp.

◆ operator=() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_base_impl<dim,T,S,layout_base>& grid_base_impl< dim, T, S, layout_base, ord_type >::operator= ( grid_base_impl< dim, T, S, layout_base > &&  g)
inline

It copy a grid.

Parameters
ggrid to copy
Returns
itself

Definition at line 722 of file grid_base_implementation.hpp.

◆ operator==()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
bool grid_base_impl< dim, T, S, layout_base, ord_type >::operator== ( const grid_base_impl< dim, T, S, layout_base > &  g)
inline

Compare two grids.

Parameters
ggrid to check
Returns
true if they match

Definition at line 742 of file grid_base_implementation.hpp.

◆ remove() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::remove ( Box< dim, long int > &  section_to_delete)
inline

Remove all the points in this region.

For this case this function does nothing

Parameters
box_srcbox to kill the points

Definition at line 1235 of file grid_base_implementation.hpp.

◆ remove() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::remove ( size_t  key)
inline

Remove one element valid only on 1D.

Parameters
keyelement to remove

Definition at line 1461 of file grid_base_implementation.hpp.

◆ removeAddUnpackFinalize()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int ... prp, typename context_type >
void grid_base_impl< dim, T, S, layout_base, ord_type >::removeAddUnpackFinalize ( const context_type &  gpuContext,
int  opt 
)
inline

In this case it does nothing.

Note
this function exist to respect the interface to work as distributed
Parameters
gpuContextgpu context

Definition at line 1982 of file grid_base_implementation.hpp.

◆ removeAddUnpackReset()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::removeAddUnpackReset ( )
inline

In this case it does nothing.

Note
this function exist to respect the interface to work as distributed

Definition at line 1971 of file grid_base_implementation.hpp.

◆ removeCopyToFinalize()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int ... prp, typename context_type >
void grid_base_impl< dim, T, S, layout_base, ord_type >::removeCopyToFinalize ( const context_type &  gpuContext,
int  opt 
)
inline

In this case it does nothing.

Note
this function exist to respect the interface to work as distributed
Parameters
gpuContextgpu context

Definition at line 1993 of file grid_base_implementation.hpp.

◆ resize()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::resize ( const size_t(&)  sz[dim],
size_t  opt = DATA_ON_HOST | DATA_ON_DEVICE,
unsigned int  blockSize = 1 
)
inline

Resize the grid.

Resize the grid to the old information is retained on the new grid, if the new grid is bigger. if is smaller the data are cropped

Parameters
szreference to an array of dimension dim
optoptions for resize. In case we know that the data are only on device memory we can use DATA_ONLY_DEVICE, In case we know that the data are only on host memory we can use DATA_ONLY_HOST
blockSizeThe default is equal to 1. In case of accelerator buffer resize indicate the size of the block of threads ( this is used in case of a vector of blocks where the block object override to operator= to distribute threads on each block element )

Create a completely new grid with sz

N-D copy

Definition at line 1410 of file grid_base_implementation.hpp.

◆ resize_impl_host()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::resize_impl_host ( const size_t(&)  sz[dim],
grid_base_impl< dim, T, S, layout_base, ord_type > &  grid_new 
)
inlineprivate

create a source grid iterator

Definition at line 586 of file grid_base_implementation.hpp.

◆ resize_impl_memset()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::resize_impl_memset ( grid_base_impl< dim, T, S, layout_base, ord_type > &  grid_new)
inlineprivate

Set the allocator and allocate the memory

Definition at line 610 of file grid_base_implementation.hpp.

◆ resize_no_device()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::resize_no_device ( const size_t(&)  sz[dim])
inline

Resize the space.

Resize the space to a new grid, the element are retained on the new grid, if the new grid is bigger the new element are now initialized, if is smaller the data are cropped

Parameters
szreference to an array of dimension dim
optoptions for resize. In case we know that the data are only on device memory we can use DATA_ONLY_DEVICE, In case we know that the data are only on host memory we can use DATA_ONLY_HOST

Create a completely new grid with sz

Definition at line 1444 of file grid_base_implementation.hpp.

◆ set() [1/6]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int ... prp>
__device__ __host__ void grid_base_impl< dim, T, S, layout_base, ord_type >::set ( const grid_key_dx< dim > &  key1,
const grid_base_impl< dim, T, S, layout_base, ord_type > &  g,
const grid_key_dx< dim > &  key2 
)
inline

set only some properties

Parameters
key1destination point
gsource
key2source point

Definition at line 1579 of file grid_base_implementation.hpp.

◆ set() [2/6]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<typename Mem >
void grid_base_impl< dim, T, S, layout_base, ord_type >::set ( const grid_key_dx< dim > &  key1,
const grid_base_impl< dim, T, Mem, layout_base > &  g,
const grid_key_dx< dim > &  key2 
)
inline

Set an element of the grid from another element of another grid.

Parameters
key1element of the grid to set
gsource grid
key2element of the source grid to copy

Definition at line 1681 of file grid_base_implementation.hpp.

◆ set() [3/6]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::set ( const grid_key_dx< dim > &  key1,
const grid_base_impl< dim, T, S, layout_base > &  g,
const grid_key_dx< dim > &  key2 
)
inline

Set an element of the grid from another element of another grid.

Parameters
key1element of the grid to set
gsource grid
key2element of the source grid to copy

Definition at line 1639 of file grid_base_implementation.hpp.

◆ set() [4/6]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::set ( const size_t  key1,
const grid_base_impl< dim, T, S, layout_base > &  g,
const size_t  key2 
)
inline

Set an element of the grid from another element of another grid.

Parameters
key1element of the grid to set
gsource grid
key2element of the source grid to copy

Definition at line 1660 of file grid_base_implementation.hpp.

◆ set() [5/6]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<typename Memory >
void grid_base_impl< dim, T, S, layout_base, ord_type >::set ( grid_key_dx< dim >  dx,
const encapc< 1, T, Memory > &  obj 
)
inline

set an element of the grid

set an element of the grid

Parameters
dxis the grid key or the position to set
objvalue to set

Definition at line 1597 of file grid_base_implementation.hpp.

◆ set() [6/6]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::set ( grid_key_dx< dim >  dx,
const T &  obj 
)
inline

set an element of the grid

set an element of the grid

Parameters
dxis the grid key or the position to set
objvalue to set

Definition at line 1620 of file grid_base_implementation.hpp.

◆ set_general()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<typename Mem , template< typename > class layout_base2>
void grid_base_impl< dim, T, S, layout_base, ord_type >::set_general ( const grid_key_dx< dim > &  key1,
const grid_base_impl< dim, T, Mem, layout_base2 > &  g,
const grid_key_dx< dim > &  key2 
)
inline

Set an element of the grid from another element of another grid.

Parameters
key1element of the grid to set
gsource grid
key2element of the source grid to copy

Definition at line 1700 of file grid_base_implementation.hpp.

◆ setGPUInsertBuffer()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::setGPUInsertBuffer ( unsigned int  nb,
unsigned int  nt 
)
inline

No blocks here, it does nothing.

Parameters
nbunused
ntunused

Definition at line 1006 of file grid_base_implementation.hpp.

◆ setMemory() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::setMemory ( )
inline

Create the object that provide memory.

Create the object that provide memory

Template Parameters
Smemory type to allocate

Definition at line 847 of file grid_base_implementation.hpp.

◆ setMemory() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
template<unsigned int p = 0>
void grid_base_impl< dim, T, S, layout_base, ord_type >::setMemory ( S &  m)
inline

Set the object that provide memory from outside.

An external allocator is useful with allocator like PreAllocHeapMem to have contiguous in memory vectors. Or to force the system to retain memory

Template Parameters
Smemory type
Parameters
mexternal memory allocator

Is external

Definition at line 883 of file grid_base_implementation.hpp.

◆ setMemoryArray()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::setMemoryArray ( S *  m)
inline

Set the object that provide memory from outside.

An external allocator is useful with allocator like PreAllocHeapMem to have contiguous in memory vectors. Or to force the system to retain memory

Template Parameters
Smemory type
Parameters
mexternal memory allocator

Is external

Definition at line 912 of file grid_base_implementation.hpp.

◆ size()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
size_t grid_base_impl< dim, T, S, layout_base, ord_type >::size ( ) const
inline

return the size of the grid

Returns
Return the size of the grid

Definition at line 1718 of file grid_base_implementation.hpp.

◆ swap() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::swap ( grid_base_impl< dim, T, S, layout_base > &&  grid)
inline

It move the allocated object from one grid to another.

It move the allocated object from one grid to another, after this call the argument grid is no longer valid

Parameters
gridto move/copy

Definition at line 1567 of file grid_base_implementation.hpp.

◆ swap() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::swap ( grid_base_impl< dim, T, S, layout_base, ord_type > &  grid)
inline

It swap the objects A become B and B become A using A.swap(B);.

Parameters
gridto swap with

Definition at line 1533 of file grid_base_implementation.hpp.

◆ swap_nomode()

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
void grid_base_impl< dim, T, S, layout_base, ord_type >::swap_nomode ( grid_base_impl< dim, T, S, layout_base > &  grid)
inline

It swap the objects A become B and B become A using A.swap(B);.

This is a different from the standard swap and require long explanation.

This object (grid) by default when it constructs and after we call setMemory() it create an internal memory object and use it allocate memory internally. (Mode 1)

If instead we use setMemory(external_mem) this object does not create an internal memory object but use the passed object to allocate memory. (Mode 2)

External memory can be used to do memory retaining/re-use and/or garbage collection and making the data structures act like a representation of external memory

Using the structure in this way has consequences, because in Mode2 the memory (and so its life-span) is disentangled by its structure.

The problem comes when we swap object in which one the structure is in Mode2

Let's suppose object A is in Mode1 and object B is is Mode2. The normal swap, fully swap the objects

A.swap(B) A become B (in mode 2) and B become A (in mode 1)

swap nomode require that A and B have the same size.

A.swap_nomode(B) In this case the mode is not swapped A become B (in mode 1) and B become A (in mode 2). So the mode is not swapped and remain the original

Parameters
gridobject B

Definition at line 1508 of file grid_base_implementation.hpp.

◆ toKernel() [1/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
grid_gpu_ker<dim,T_,layout_base,linearizer_type> grid_base_impl< dim, T, S, layout_base, ord_type >::toKernel ( )
inline

Convert the grid into a data-structure compatible for computing into GPU.

The object created can be considered like a reference of the original

Definition at line 1890 of file grid_base_implementation.hpp.

◆ toKernel() [2/2]

template<unsigned int dim, typename T , typename S , template< typename > class layout_base, typename ord_type = grid_sm<dim,void>>
const grid_gpu_ker<dim,T_,layout_base,linearizer_type> grid_base_impl< dim, T, S, layout_base, ord_type >::toKernel ( ) const
inline

Convert the grid into a data-structure compatible for computing into GPU.

The object created can be considered like a reference of the original

Definition at line 1900 of file grid_base_implementation.hpp.


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