OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
memory_traits_lin< T > Struct Template Reference

Transform the boost::fusion::vector into memory specification (memory_traits) More...

Detailed Description

template<typename T>
struct memory_traits_lin< T >

Transform the boost::fusion::vector into memory specification (memory_traits)

Transform the boost::fusion::vector into memory specification (memory_traits). In this implementation we create a buffer of base type with memory_c

We basically create a buffer for each property

Parameters
Tbase type (T::type must define a boost::fusion::vector )

Definition at line 242 of file memory_conf.hpp.

#include <memory_conf.hpp>

Public Types

typedef memory_traits_lin_type< T, openfpm::vect_isel< T >::value==OPENFPM_NATIVE >::type type
 for each element in the vector interleave memory_c
 
typedef int yes_is_tlin
 
typedef boost::mpl::int_< AOS_layout > type_value
 

Static Public Member Functions

template<unsigned int p, typename data_type , typename g1_type , typename key_type , typename std::enable_if<!std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto get (data_type &data_, const g1_type &g1, const key_type &v1) -> decltype(boost::fusion::at_c< p >(data_.mem_r.operator[](g1.LinId(v1)))) &
 Return a reference to the selected element SFINAE is used to hande CSR graphs, where boost::fusion::at_c.
 
template<unsigned int p, typename data_type , typename g1_type , typename key_type , typename std::enable_if< std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ void get (data_type &data_, const g1_type &g1, const key_type &v1)
 Return a reference to the selected element. SFINAE is used to hande CSR graphs, where boost::fusion::at_c.
 
template<unsigned int p, typename data_type , typename g1_type , typename std::enable_if<!std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto get_lin (data_type &data_, const g1_type &g1, const size_t lin_id) -> decltype(boost::fusion::at_c< p >(data_.mem_r.operator[](lin_id))) &
 Return a reference to the selected element SFINAE is used to hande CSR graphs, where boost::fusion::at_c.
 
template<unsigned int p, typename data_type , typename g1_type , typename std::enable_if< std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto get_lin (data_type &data_, const g1_type &g1, const size_t lin_id)
 Return a reference to the selected element SFINAE is used to hande CSR graphs, where boost::fusion::at_c.
 
template<unsigned int p, typename data_type , typename g1_type , typename key_type , typename std::enable_if<!std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto get_c (const data_type &data_, const g1_type &g1, const key_type &v1) -> decltype(boost::fusion::at_c< p >(data_.mem_r.operator[](g1.LinId(v1)))) &
 Return a reference to the selected element.
 
template<unsigned int p, typename data_type , typename g1_type >
__host__ static __device__ auto get_lin_c (const data_type &data_, const g1_type &g1, const size_t lin_id) -> decltype(boost::fusion::at_c< p >(data_.mem_r.operator[](lin_id))) &
 Return a reference to the selected element.
 
template<typename S , typename data_type , unsigned int ... prp>
static void hostToDevice (data_type &data_, size_t start, size_t stop)
 Copy the memory from host to device.
 
template<typename data_type , unsigned int ... prp>
static void deviceToHost (data_type &data_, size_t start, size_t stop)
 Synchronize the memory buffer in the device with the memory in the host.
 

Member Typedef Documentation

◆ type

template<typename T >
typedef memory_traits_lin_type<T,openfpm::vect_isel<T>::value==OPENFPM_NATIVE>::type memory_traits_lin< T >::type

for each element in the vector interleave memory_c

Definition at line 245 of file memory_conf.hpp.

◆ type_value

template<typename T >
typedef boost::mpl::int_<AOS_layout> memory_traits_lin< T >::type_value

Definition at line 249 of file memory_conf.hpp.

◆ yes_is_tlin

template<typename T >
typedef int memory_traits_lin< T >::yes_is_tlin

Definition at line 247 of file memory_conf.hpp.

Member Function Documentation

◆ deviceToHost()

template<typename T >
template<typename data_type , unsigned int ... prp>
static void memory_traits_lin< T >::deviceToHost ( data_type &  data_,
size_t  start,
size_t  stop 
)
inlinestatic

Synchronize the memory buffer in the device with the memory in the host.

Parameters
startstarting element to transfer
stopstop element to transfer
Template Parameters
propertiesto transfer (ignored all properties are trasfert)

Definition at line 362 of file memory_conf.hpp.

◆ get() [1/2]

template<typename T >
template<unsigned int p, typename data_type , typename g1_type , typename key_type , typename std::enable_if< std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ void memory_traits_lin< T >::get ( data_type &  data_,
const g1_type &  g1,
const key_type &  v1 
)
inlinestatic

Return a reference to the selected element. SFINAE is used to hande CSR graphs, where boost::fusion::at_c.

(boost::fusion::vector<>) breaks in boost 1.8* onwards

Parameters
dataobject from where to take the element
g1grid information
v1element id
Returns
a reference to the object selected

Definition at line 278 of file memory_conf.hpp.

◆ get() [2/2]

template<typename T >
template<unsigned int p, typename data_type , typename g1_type , typename key_type , typename std::enable_if<!std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto memory_traits_lin< T >::get ( data_type &  data_,
const g1_type &  g1,
const key_type &  v1 
) -> decltype(boost::fusion::at_c<p>(data_.mem_r.operator[](g1.LinId(v1)))) &
inlinestatic

Return a reference to the selected element SFINAE is used to hande CSR graphs, where boost::fusion::at_c.

(boost::fusion::vector<>) breaks in boost 1.8* onwards

Parameters
dataobject from where to take the element
g1grid information
v1element id
Returns
a reference to the object selected

Definition at line 262 of file memory_conf.hpp.

◆ get_c()

template<typename T >
template<unsigned int p, typename data_type , typename g1_type , typename key_type , typename std::enable_if<!std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto memory_traits_lin< T >::get_c ( const data_type &  data_,
const g1_type &  g1,
const key_type &  v1 
) -> decltype(boost::fusion::at_c<p>(data_.mem_r.operator[](g1.LinId(v1)))) &
inlinestatic

Return a reference to the selected element.

Parameters
dataobject from where to take the element
g1grid information
v1element id
Returns
a reference to the object selected

Definition at line 319 of file memory_conf.hpp.

◆ get_lin() [1/2]

template<typename T >
template<unsigned int p, typename data_type , typename g1_type , typename std::enable_if< std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto memory_traits_lin< T >::get_lin ( data_type &  data_,
const g1_type &  g1,
const size_t  lin_id 
)
inlinestatic

Return a reference to the selected element SFINAE is used to hande CSR graphs, where boost::fusion::at_c.

(boost::fusion::vector<>) breaks in boost 1.8* onwards

Parameters
dataobject from where to take the element
g1grid information
v1element id
Returns
a reference to the object selected

Definition at line 307 of file memory_conf.hpp.

◆ get_lin() [2/2]

template<typename T >
template<unsigned int p, typename data_type , typename g1_type , typename std::enable_if<!std::is_same< data_type, memory_c< boost::fusion::vector<>, 1, memory > >::value, int >::type = 0>
__host__ static __device__ auto memory_traits_lin< T >::get_lin ( data_type &  data_,
const g1_type &  g1,
const size_t  lin_id 
) -> decltype(boost::fusion::at_c<p>(data_.mem_r.operator[](lin_id))) &
inlinestatic

Return a reference to the selected element SFINAE is used to hande CSR graphs, where boost::fusion::at_c.

(boost::fusion::vector<>) breaks in boost 1.8* onwards

Parameters
dataobject from where to take the element
g1grid information
v1element id
Returns
a reference to the object selected

Definition at line 291 of file memory_conf.hpp.

◆ get_lin_c()

template<typename T >
template<unsigned int p, typename data_type , typename g1_type >
__host__ static __device__ auto memory_traits_lin< T >::get_lin_c ( const data_type &  data_,
const g1_type &  g1,
const size_t  lin_id 
) -> decltype(boost::fusion::at_c<p>(data_.mem_r.operator[](lin_id))) &
inlinestatic

Return a reference to the selected element.

Parameters
dataobject from where to take the element
g1grid information
v1element id
Returns
a reference to the object selected

Definition at line 334 of file memory_conf.hpp.

◆ hostToDevice()

template<typename T >
template<typename S , typename data_type , unsigned int ... prp>
static void memory_traits_lin< T >::hostToDevice ( data_type &  data_,
size_t  start,
size_t  stop 
)
inlinestatic

Copy the memory from host to device.

Template Parameters
(allproperties are copied to prp is useless in this case)
Parameters
startstart point
stopstop point

Definition at line 348 of file memory_conf.hpp.


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