Implementation of a N-dimensional grid. More...
Implementation of a N-dimensional grid.
dim | dimansionality of the grid |
T | type store by the grid |
S | Memory pool from where to take the memory |
layout_ | memory layout |
layout_base | layout memory meta-function (the meta-function used to construct layout_) |
Definition at line 26 of file grid_base_implementation.hpp.
#include <grid_base_implementation.hpp>
Data Structures | |
struct | pack_simple_cond |
struct | pack_simple_cond< true, prp...> |
struct | unpack_simple_cond |
struct | unpack_simple_cond< true, prp...> |
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 int | yes_i_am_grid |
it define that it is a grid | |
typedef memory_traits_lin < typename T::type >::type | memory_lin |
Definition of the layout. | |
typedef encapc< dim, T, layout > | container |
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 | |
template<int... prp> | |
void | packRequest (size_t &req) const |
Insert an allocation request into the vector. More... | |
template<int... prp> | |
void | pack (ExtPreAlloc< S > &mem, Pack_stat &sts) const |
pack a grid selecting the properties to pack More... | |
template<int... prp> | |
void | unpack (ExtPreAlloc< S > &mem, Unpack_stat &ps) |
unpack a grid More... | |
template<int... prp> | |
void | pack (ExtPreAlloc< S > &mem, grid_key_dx_iterator_sub< dims > &sub_it, Pack_stat &sts) |
Pack the object into the memory given an iterator. More... | |
template<int... prp> | |
void | packRequest (grid_key_dx_iterator_sub< dims > &sub, size_t &req) |
Insert an allocation request. More... | |
template<unsigned int... prp> | |
void | unpack (ExtPreAlloc< S > &mem, grid_key_dx_iterator_sub< dims > &sub_it, Unpack_stat &ps) |
unpack the sub-grid object More... | |
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, layout_base > & | operator= (const grid_base_impl< dim, T, S, layout, layout_base > &g) |
It copy a grid. More... | |
grid_base_impl< dim, T, S, layout, layout_base > & | operator= (grid_base_impl< dim, T, S, layout, layout_base > &&g) |
It copy a grid. More... | |
bool | operator== (const grid_base_impl< dim, T, S, layout, layout_base > &g) |
Compare two grids. More... | |
grid_base_impl< dim, T, S, layout, layout_base > | duplicate () const THROW |
create a duplicated version of the grid More... | |
const grid_sm< dim, T > & | getGrid () const |
Return the internal grid information. More... | |
void | setMemory () |
Create the object that provide memory. More... | |
void | setMemory (S &m) |
Get the object that provide memory. More... | |
void * | getPointer () |
Return a plain pointer to the internal data. More... | |
const void * | getPointer () const |
Return a plain pointer to the internal data. More... | |
template<unsigned int p, typename r_type = decltype(mem_get<p,layout_base<T>,layout,grid_sm<dim,T>,grid_key_dx<dim>>::get(data_,g1,grid_key_dx<dim>()))> | |
r_type | get (const grid_key_dx< dim > &v1) |
Get the reference of the selected element. More... | |
template<unsigned int p, typename r_type = decltype(mem_get<p,layout_base<T>,layout,grid_sm<dim,T>,grid_key_dx<dim>>::get(data_,g1,grid_key_dx<dim>()))> | |
const 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(mem_get<p,layout_base<T>,layout,grid_sm<dim,T>,grid_key_dx<dim>>::get_lin(data_,g1,0))> | |
r_type | get (const size_t lin_id) |
Get the reference of the selected element. More... | |
template<unsigned int p, typename r_type = decltype(mem_get<p,layout_base<T>,layout,grid_sm<dim,T>,grid_key_dx<dim>>::get_lin(data_,g1,0))> | |
const r_type | get (size_t lin_id) const |
Get the const reference of the selected element. More... | |
encapc< dim, T, layout > | get_o (const grid_key_dx< dim > &v1) |
Get the of the selected element as a boost::fusion::vector. More... | |
const encapc< dim, T, layout > | get_o (const grid_key_dx< dim > &v1) const |
Get the of the selected element as a boost::fusion::vector. More... | |
encapc< dim, T, layout > | get_o (size_t v1) |
Get the of the selected element as a boost::fusion::vector. More... | |
const encapc< dim, T, layout > | get_o (size_t v1) const |
Get the of the selected element as a boost::fusion::vector. More... | |
void | fill (unsigned char fl) |
Fill the memory with the selected byte. More... | |
void | resize (const size_t(&sz)[dim]) |
Resize the space. More... | |
void | remove (size_t key) |
Remove one element valid only on 1D. More... | |
void | swap (grid_base_impl< dim, T, S, layout, layout_base > &grid) |
It move the allocated object from one grid to another. More... | |
void | swap (grid_base_impl< dim, T, S, layout, layout_base > &&grid) |
It move the allocated object from one grid to another. 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, 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, 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, layout_base > &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 (grid_key_dx< dim > &start, 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 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) const |
Return a grid iterator over all points included between start and stop point. More... | |
long int | who () |
It return the id of structure in the allocation list. More... | |
Static Public Member Functions | |
static bool | pack () |
static bool | packRequest () |
static bool | packMem () |
template<int... prp> | |
static size_t | packMem (size_t n, size_t e) |
Calculate the memory size required to pack n elements. 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. | |
grid_sm< dim, T > | g1 |
This is a structure that store all information related to the grid and how indexes are linearized. | |
Private Types | |
typedef layout_ | layout |
memory layout | |
Private Attributes | |
bool | is_mem_init = false |
Is the memory initialized. | |
bool | isExternal |
The memory allocator is not internally created. | |
|
inline |
create a grid from another grid
g | the grid to copy |
Definition at line 190 of file grid_base_implementation.hpp.
|
inline |
create a grid of size sz on each direction
sz | size of the grid on each dimensions |
Definition at line 201 of file grid_base_implementation.hpp.
|
inline |
Constructor.
It construct a grid of specified size
sz | array that indicate the size of the grid in each dimension |
Definition at line 217 of file grid_base_implementation.hpp.
|
inline |
create 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 305 of file grid_base_implementation.hpp.
|
inline |
Fill the memory with the selected byte.
fl | byte pattern to fill |
Definition at line 621 of file grid_base_implementation.hpp.
|
inline |
Get the reference of the selected element.
v1 | grid_key that identify the element in the grid |
Definition at line 450 of file grid_base_implementation.hpp.
|
inline |
Get the const reference of the selected element.
v1 | grid_key that identify the element in the grid |
Definition at line 470 of file grid_base_implementation.hpp.
|
inline |
Get the reference of the selected element.
lin_id | linearized element that identify the element in the grid |
Definition at line 490 of file grid_base_implementation.hpp.
|
inline |
Get the const reference of the selected element.
lin_id | linearized element that identify the element in the grid |
Definition at line 509 of file grid_base_implementation.hpp.
|
inline |
Get the of the selected element as a boost::fusion::vector.
Get the selected element as a boost::fusion::vector
v1 | grid_key that identify the element in the grid |
Definition at line 533 of file grid_base_implementation.hpp.
|
inline |
Get the of the selected element as a boost::fusion::vector.
Get the selected element as a boost::fusion::vector
v1 | grid_key that identify the element in the grid |
Definition at line 556 of file grid_base_implementation.hpp.
|
inline |
Get the of the selected element as a boost::fusion::vector.
Get the selected element as a boost::fusion::vector
v1 | linearized id that identify the element in the grid |
Definition at line 579 of file grid_base_implementation.hpp.
|
inline |
Get the of the selected element as a boost::fusion::vector.
Get the selected element as a boost::fusion::vector
v1 | linearized id that identify the element in the grid |
Definition at line 602 of file grid_base_implementation.hpp.
|
inline |
Return the internal grid information.
Return the internal grid information
Definition at line 351 of file grid_base_implementation.hpp.
|
inline |
Return a grid iterator.
Return a grid iterator, to iterate through the grid
Definition at line 946 of file grid_base_implementation.hpp.
|
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
start | point |
stop | point |
Definition at line 982 of file grid_base_implementation.hpp.
|
inline |
Return a grid iterator.
Return a grid iterator, to iterate through the grid with stencil calculation
Definition at line 963 of file grid_base_implementation.hpp.
|
inline |
Return a plain pointer to the internal data.
Return a plain pointer to the internal data
Definition at line 413 of file grid_base_implementation.hpp.
|
inline |
Return a plain pointer to the internal data.
Return a plain pointer to the internal data
Definition at line 432 of file grid_base_implementation.hpp.
|
inline |
Return a sub-grid iterator.
Return a sub-grid iterator, to iterate through the grid
start | start point |
stop | stop point |
Definition at line 914 of file grid_base_implementation.hpp.
|
inline |
Return a sub-grid iterator.
Return a sub-grid iterator, to iterate through the grid
m | Margin |
Definition at line 931 of file grid_base_implementation.hpp.
|
inline |
It copy a grid.
g | grid to copy |
Definition at line 242 of file grid_base_implementation.hpp.
|
inline |
It copy a grid.
g | grid to copy |
Definition at line 260 of file grid_base_implementation.hpp.
|
inline |
Compare two grids.
g | grid to check |
Definition at line 279 of file grid_base_implementation.hpp.
|
inlinestatic |
This file contains the implemetation of packer and unpacker for grid Created on: July 8, 2016 Author: Yaroslav Zaluzhnyi
Definition at line 10 of file grid_base_implementation.hpp.
|
inline |
pack a grid selecting the properties to pack
mem | preallocated memory where to pack the grid |
sts | pack-stat info |
Definition at line 269 of file grid_base_implementation.hpp.
|
inline |
Pack the object into the memory given an iterator.
prp | properties to pack |
mem | preallocated memory where to pack the objects |
sub_it | sub grid iterator ( or the elements in the grid to pack ) |
sts | pack statistic |
Definition at line 351 of file grid_base_implementation.hpp.
|
inlinestatic |
Calculate the memory size required to pack n elements.
Calculate the total size required to store n-elements in a vector
n | number of elements |
e | unused |
Definition at line 460 of file grid_base_implementation.hpp.
|
inline |
Insert an allocation request into the vector.
prp | list of properties |
v | vector of allocation sequence |
Definition at line 233 of file grid_base_implementation.hpp.
|
inline |
Insert an allocation request.
prp | set of properties to pack |
sub | sub-grid iterator |
vector | of requests |
Definition at line 396 of file grid_base_implementation.hpp.
|
inline |
Remove one element valid only on 1D.
key | element to remove |
Definition at line 705 of file grid_base_implementation.hpp.
|
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
sz | reference to an array of dimension dim |
Create a completely new grid with sz
Set the allocator and allocate the memory
N-D copy
create a source grid iterator
Definition at line 638 of file grid_base_implementation.hpp.
|
inline |
set an element of the grid
set an element of the grid
dx | is the grid key or the position to set |
obj | value to set |
Definition at line 781 of file grid_base_implementation.hpp.
|
inline |
set an element of the grid
set an element of the grid
dx | is the grid key or the position to set |
obj | value to set |
Definition at line 807 of file grid_base_implementation.hpp.
|
inline |
Set an element of the grid from another element of another grid.
key1 | element of the grid to set |
g | source grid |
key2 | element of the source grid to copy |
Definition at line 829 of file grid_base_implementation.hpp.
|
inline |
Set an element of the grid from another element of another grid.
key1 | element of the grid to set |
g | source grid |
key2 | element of the source grid to copy |
Definition at line 853 of file grid_base_implementation.hpp.
|
inline |
Set an element of the grid from another element of another grid.
key1 | element of the grid to set |
g | source grid |
key2 | element of the source grid to copy |
Definition at line 877 of file grid_base_implementation.hpp.
|
inline |
Create the object that provide memory.
Create the object that provide memory
S | memory type to allocate |
Definition at line 367 of file grid_base_implementation.hpp.
|
inline |
Get the object that provide memory.
An external allocator is useful with allocator like PreAllocHeapMem to have contiguous in memory vectors. Or to force the system to retain memory
S | memory type |
m | external memory allocator |
Is external
Create and set the memory allocator
Allocate the memory and create the reppresentation
Definition at line 388 of file grid_base_implementation.hpp.
|
inline |
return the size of the grid
Definition at line 896 of file grid_base_implementation.hpp.
|
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
grid | to move/copy |
Definition at line 733 of file grid_base_implementation.hpp.
|
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
grid | to move/copy |
Definition at line 764 of file grid_base_implementation.hpp.
|
inline |
unpack a grid
mem | preallocated memory from where to unpack the grid |
ps | unpack-stat info |
Definition at line 304 of file grid_base_implementation.hpp.
|
inline |
unpack the sub-grid object
prp | properties to unpack |
mem | preallocated memory from where to unpack the object |
sub | sub-grid iterator |
obj | object where to unpack |
Definition at line 417 of file grid_base_implementation.hpp.
|
inline |
It return the id of structure in the allocation list.
Definition at line 1000 of file grid_base_implementation.hpp.