Specialization of memory_c for multi_array. More...
Specialization of memory_c for multi_array.
Specialization of memory_c for multi_array
It is mainly used by memory_conf to create the correct layout
T | is suppose to be a boost::mpl::vector specifing at position 0 the type and at position 1 to N the dimensions size of the multi_array |
D | object that allocate memory |
Definition at line 336 of file memory_c.hpp.
#include <memory_c.hpp>
Data Structures | |
struct | ascending |
In combination with generate_array is used to produce array at compile-time. More... | |
Public Types | |
typedef boost::multi_array< base, size_p::value > | type |
Public Member Functions | |
void | setMemory (memory &mem) |
This function set the object that allocate memory. | |
memory & | getMemory () |
This function get the object that allocate memory. | |
void | switchToDevicePtr () |
Switch the pointer to device pointer. | |
bool | bind_ref (const memory_c< multi_array< T >, MEMORY_C_STANDARD, D > &ref) |
This function bind the memory_c to this memory_c as reference. | |
bool | allocate (const size_t sz, bool skip_initialization=false) |
This function allocate memory and associate the representation to mem_r. | |
memory_c (bool manage_memory=true) | |
constructor | |
~memory_c () | |
destructor | |
void | disable_manage_memory () |
Disable the management of memory (it is used for toKernel views) | |
void | set_mem (memory &mem) |
set the device memory interface, the object that allocate memory | |
void | swap (memory_c &mem_obj) |
swap the memory | |
template<typename Mem_type > | |
__host__ void | swap_nomode (memory_c &mem_obj) |
swap the memory | |
Data Fields | |
D * | mem |
Reference to an object to allocate memory. | |
openfpm::multi_array_ref_openfpm< base, boost::mpl::size< T >::value, Tv > | mem_r |
object that represent the memory as a multi-dimensional array of objects T | |
Private Types | |
typedef boost::mpl::push_front< typenameboost::mpl::pop_front< T >::type, boost::mpl::int_<-1 > >::type | Tv |
Remove the first element. | |
template<int S> | |
using | int_ = boost::mpl::int_< S > |
define boost::mpl::int_ without boost::mpl | |
typedef boost::mpl::size< T > | size_p |
define the template vector size it give a number at compile time | |
template<typename S , unsigned int n> | |
using | at = boost::mpl::at< S, boost::mpl::int_< n > > |
Define "at" meta function without boost::mpl. | |
typedef at< T, 0 >::type | base |
typedef openfpm::multi_array_ref_openfpm< base, size_p::value, Tv >::size_type | size_type |
define size_type | |
Private Attributes | |
bool | manage_memory = true |
|
private |
Define "at" meta function without boost::mpl.
Definition at line 367 of file memory_c.hpp.
|
private |
Definition at line 369 of file memory_c.hpp.
|
private |
define boost::mpl::int_ without boost::mpl
Definition at line 361 of file memory_c.hpp.
|
private |
define the template vector size it give a number at compile time
Definition at line 364 of file memory_c.hpp.
|
private |
define size_type
Definition at line 372 of file memory_c.hpp.
|
private |
Remove the first element.
Definition at line 358 of file memory_c.hpp.
typedef boost::multi_array<base,size_p::value> memory_c< multi_array< T >, MEMORY_C_STANDARD, D >::type |
define the type of the multi_array vector minus one of the original size basically we remove the index 0 of the multi_array
Definition at line 462 of file memory_c.hpp.
|
inline |
constructor
Definition at line 471 of file memory_c.hpp.
|
inline |
destructor
Definition at line 477 of file memory_c.hpp.
|
inline |
This function allocate memory and associate the representation to mem_r.
This function allocate memory and associate the representation of that chunk of memory to mem_r
We create a chunk of memory
we create the representation for the memory buffer
Definition at line 443 of file memory_c.hpp.
|
inline |
This function bind the memory_c to this memory_c as reference.
Bind ad reference it mean this this object does not create new memory but use the one from ref as a reference.
we create the representation for the memory buffer
Definition at line 425 of file memory_c.hpp.
|
inline |
Disable the management of memory (it is used for toKernel views)
Definition at line 494 of file memory_c.hpp.
|
inline |
This function get the object that allocate memory.
Definition at line 404 of file memory_c.hpp.
|
inline |
set the device memory interface, the object that allocate memory
Definition at line 500 of file memory_c.hpp.
|
inline |
This function set the object that allocate memory.
mem | the memory object |
Definition at line 382 of file memory_c.hpp.
|
inline |
|
inline |
swap the memory
While the previous one swap the mem the swap_nomode call the swap member of the mem object
swap the memory between objects
Definition at line 532 of file memory_c.hpp.
|
inline |
Switch the pointer to device pointer.
Definition at line 412 of file memory_c.hpp.
|
private |
indicate this object manage the memory. Call to functions like toKernels create views of the main data-structure. Views use memory_c create different ways to access the same sata. We have mainly have two options. Either views manage memory, either they do not. When a view manage the memory if the main-data structure get destroyed the view is still valid, the memory retained and the last view destroy the memory. When a view does not manage the memory, if the main-data structure get destroyed the view become invalid.
Definition at line 343 of file memory_c.hpp.
D* memory_c< multi_array< T >, MEMORY_C_STANDARD, D >::mem |
Reference to an object to allocate memory.
Definition at line 465 of file memory_c.hpp.
openfpm::multi_array_ref_openfpm<base,boost::mpl::size<T>::value,Tv> memory_c< multi_array< T >, MEMORY_C_STANDARD, D >::mem_r |
object that represent the memory as a multi-dimensional array of objects T
Definition at line 468 of file memory_c.hpp.