6#include "util/cuda_launch.hpp"
7#include "util/object_util.hpp"
8#include "Grid/util.hpp"
9#include "Vector/vect_isel.hpp"
10#include "Vector/util.hpp"
11#include "Vector/map_vector_grow_p.hpp"
12#include "memory/ExtPreAlloc.hpp"
13#include "util/util_debug.hpp"
14#include "util/Pack_stat.hpp"
15#include <boost/fusion/include/mpl.hpp>
16#include <boost/fusion/sequence/intrinsic/at_c.hpp>
17#include <boost/fusion/include/at_c.hpp>
18#include <boost/fusion/include/for_each.hpp>
19#include <boost/fusion/container/vector.hpp>
20#include <boost/fusion/include/vector.hpp>
21#include <boost/fusion/container/vector/vector_fwd.hpp>
22#include <boost/fusion/include/vector_fwd.hpp>
23#include <boost/type_traits.hpp>
24#include <boost/fusion/include/for_each.hpp>
25#include <boost/mpl/range_c.hpp>
26#include <boost/mpl/for_each.hpp>
27#include "memory_ly/memory_conf.hpp"
28#include "util/copy_compare/meta_copy.hpp"
29#include "util/for_each_ref.hpp"
33#include "memory/CudaMemory.cuh"
37#include "memory_ly/Encap.hpp"
38#include "memory_ly/memory_array.hpp"
39#include "memory_ly/memory_c.hpp"
42#include "memory/HeapMemory.hpp"
43#include "memory/PtrMemory.hpp"
44#include "grid_common.hpp"
45#include "util/se_util.hpp"
46#include "iterators/grid_key_dx_iterator.hpp"
47#include "iterators/grid_key_dx_iterator_sub.hpp"
48#include "iterators/grid_key_dx_iterator_sp.hpp"
49#include "iterators/grid_key_dx_iterator_sub_bc.hpp"
50#include "Packer_Unpacker/Packer_util.hpp"
51#include "Packer_Unpacker/has_pack_agg.hpp"
52#include "cuda/cuda_grid_gpu_funcs.cuh"
53#include "grid_base_implementation.hpp"
54#include "util/for_each_ref.hpp"
55#include "Geometry/grid_smb.hpp"
56#include "Geometry/grid_zmb.hpp"
66template<
typename SGr
idGpu>
69 typedef typename SGridGpu::device_grid_type::container type;
75template<unsigned int dim, typename T, typename S=HeapMemory, typename layout = typename memory_traits_lin<T>::type,
typename linearizer =
grid_sm<dim,void> >
111template<
unsigned int dim,
typename T,
typename S,
typename linearizer>
114 typedef typename apply_transform<memory_traits_lin,T>::type T_;
180 template<
typename pointers_type,
181 typename headers_type,
182 typename result_type,
183 unsigned int ... prp >
184 static void unpack_headers(pointers_type & pointers, headers_type & headers, result_type & result,
int n_slot)
187 template<
unsigned int ... prp,
typename S2,
typename header_type,
typename ite_type,
typename context_type>
190 header_type & headers,
193 context_type &context,
194 rem_copy_opt opt = rem_copy_opt::NONE_OPT)
206 printf(
"Error grid_base operator= is not defined in device code\n");
260 return this->data_.mem->getDevicePointer();
268 template <
typename stencil = no_stencil>
302 for (
size_t i = 0 ; i < dim ; i++)
335 template<
unsigned int p>
336 void setBackgroundValue(
const typename boost::mpl::at<
typename T::type,boost::mpl::int_<p>>::type & val)
379template<
typename T_type,
unsigned int ... prp>
404 boost::fusion::at_c<boost::mpl::at<v_prp,boost::mpl::int_<T::value>>::type::value>(
dst).switchToDevicePtr();
419template<
typename T_type,
template<
typename>
class layout_base ,
typename Memory>
440 typedef decltype(boost::fusion::at_c<T::value>(
dst).mem_r) mem_r_type;
442 typedef typename boost::mpl::at<typename T_type::type,T>::type type_prp;
455 ::template destruct<Memory,mem_r_type>(
static_cast<Memory *
>(boost::fusion::at_c<T::value>(
dst).mem),
456 boost::fusion::at_c<T::value>(
dst).mem_r);
474template<
unsigned int dim>
501template<
unsigned int dim,
typename T,
typename S,
typename linearizer>
504 typedef typename apply_transform<memory_traits_inte,T>::type T_;
571 template<
unsigned int id>
void fill(
unsigned char c)
573 boost::fusion::at_c<id>(this->data_).mem->fill(c);
585 return boost::fusion::at_c<id>(this->data_).mem->getDevicePointer();
593 template <
typename stencil = no_stencil>
627 for (
size_t i = 0 ; i < dim ; i++)
683 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(dth);
This class allocate, and destroy CPU memory.
grid_base(grid_base &&g) THROW
create a grid from another grid
grid_base(const grid_base &g) THROW
create a grid from another grid
grid_base() THROW
Default constructor.
void fill(unsigned char c)
Fill the memory with a byte.
grid_base< dim, T, S, typename memory_traits_inte< T >::type, linearizer > & operator=(const grid_base_impl< dim, T, S, memory_traits_inte, linearizer > &base)
assign operator
static grid_key_dx_iterator_sub< dim, stencil > type_of_subiterator()
This is a meta-function return which type of sub iterator a grid produce.
grid_base(const size_t(&sz)[dim]) THROW
Constructor allocate memory and give them a representation.
memory_traits_inte< T >::type layout
grid layout
grid_base_impl< dim, T, S, memory_traits_inte, linearizer >::container container
Object container for T, it is the return type of get_o it return a object type trough.
grid_base(const size_t &sz) THROW
create a grid of size sz on each direction
grid_base< dim, T, S, typename memory_traits_inte< T >::type, linearizer > & operator=(grid_base_impl< dim, T, S, memory_traits_inte, linearizer > &&base)
assign operator
void convert_key(grid_key_dx< dim > &key_out, const grid_key_dx< dim > &key_in) const
In this case it just copy the key_in in key_out.
static constexpr bool isCompressed()
Return if in this representation data are stored is a compressed way.
static void unpack_headers()
Stub does not do anything.
T & getBackgroundValue()
Get the background value.
void * getDeviceBuffer()
It return the properties arrays.
grid_base_impl< dim, T, S, memory_traits_inte, linearizer >::linearizer_type linearizer_type
linearizer type Z-morton Hilbert curve , normal striding
static grid_key_dx_iterator< dim > type_of_iterator()
This is a meta-function return which type of iterator a grid produce.
T & getBackgroundValueAggr()
Get the background value.
static grid_key_dx_iterator_sub< dim, stencil > type_of_subiterator()
This is a meta-function return which type of sub iterator a grid produce.
grid_base_impl< dim, T, S, memory_traits_lin >::container container
Object container for T, it is the return type of get_o it return a object type trough.
grid_base(const grid_base< dim, T, S, typename memory_traits_lin< T >::type > &g) THROW
create a grid from another grid
static void unpack_headers(pointers_type &pointers, headers_type &headers, result_type &result, int n_slot)
Stub does not do anything.
T & getBackgroundValue()
Get the background value.
memory_traits_lin< T >::type layout
type of layout of the structure
grid_base_impl< dim, T, S, memory_traits_lin >::linearizer_type linearizer_type
linearizer type Z-morton Hilbert curve , normal striding
grid_key_dx_iterator_sub< dim > sub_grid_iterator_type
sub-grid iterator type
grid_base< dim, T, S, typename memory_traits_lin< T >::type > & operator=(grid_base< dim, T, S, typename memory_traits_lin< T >::type > &&g)
It copy a grid.
grid_key_dx< dim > base_key
type that identify one point in the grid
static bool noPointers()
This structure has pointers.
void grow_policy
grid_base has no grow policy
void convert_key(grid_key_dx< dim > &key_out, const grid_key_dx< dim > &key_in) const
In this case it just copy the key_in in key_out.
grid_base() THROW
Default constructor.
grid_base(const size_t &sz) THROW
create a grid of size sz on each direction
static grid_key_dx_iterator< dim > type_of_iterator()
This is a meta-function return which type of iterator a grid produce.
grid_base< dim, T, S, typename memory_traits_lin< T >::type > & operator=(const grid_base_impl< dim, T, S, memory_traits_lin > &base)
assign operator
void setBackgroundValue(const typename boost::mpl::at< typename T::type, boost::mpl::int_< p > >::type &val)
Set the background value.
static constexpr bool isCompressed()
Return if in this representation data are stored is a compressed way.
grid_base(const size_t(&sz)[dim]) THROW
Constructor allocate memory.
grid_base< dim, T, S, typename memory_traits_lin< T >::type > & operator=(grid_base_impl< dim, T, S, memory_traits_lin > &&base)
assign operator
void * getDeviceBuffer()
It return the properties arrays.
T & getBackgroundValueAggr()
Get the background value.
__host__ grid_base< dim, T, S > & operator=(const grid_base< dim, T, S > &g)
It copy a grid.
Implementation of a N-dimensional grid.
grid_base_impl< dim, T, S, layout_base > & operator=(const grid_base_impl< dim, T, S, layout_base > &g)
It copy a grid.
Declaration grid_key_dx_iterator_sub.
grid_key_dx is the key to access any element in the grid
__device__ __host__ void set_d(index_type i, index_type id)
Set the i index.
__device__ __host__ index_type get(index_type i) const
Get the i index.
get the type of the SetBlock
this class is a functor for "for_each" algorithm
memory_traits_inte< T_type >::type & dst
object to destruct
void operator()(T &t) const
It call the copy function for each property.
deconstruct_impl(typename memory_traits_inte< T_type >::type &dst)
constructor
dim3_ grids
number of grid for the kernel execution
dim3_ threads
number of treads in each block
unsigned int z
size in z dimension
unsigned int x
size in x dimension
unsigned int y
size in y dimension
Check this is a gpu or cpu type cell-list.
Transform the boost::fusion::vector into memory specification (memory_traits)
inter_memc< typenameT::type >::type type
for each element in the vector interleave memory_c
Transform the boost::fusion::vector into memory specification (memory_traits)
this class is a functor for "for_each" algorithm
switch_copy_host_to_device(typename memory_traits_inte< T_type >::type &dst)
constructor
to_boost_vmpl< prp... >::type v_prp
Convert the packed properties into an MPL vector.
void operator()(T &t) const
It call the copy function for each property.
memory_traits_inte< T_type >::type & dst
encapsulated destination object