OpenFPM_data
0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
All
Data Structures
Namespaces
Functions
Variables
Typedefs
Friends
map_vector_grow_p.hpp
1
/*
2
* Packer_cls.hpp
3
*
4
* Created on: Jul 15, 2015
5
* Author: i-bird
6
*/
7
8
#ifndef MAP_VECTOR_GROW_POLICY_HPP_
9
#define MAP_VECTOR_GROW_POLICY_HPP_
10
11
#define PAGE_ALLOC 1
12
13
namespace
openfpm
14
{
15
22
class
grow_policy_identity
23
{
24
public
:
25
34
static
size_t
grow
(
size_t
original,
size_t
requested)
35
{
36
return
requested;
37
}
38
};
39
46
class
grow_policy_double
47
{
48
public
:
49
58
static
size_t
grow
(
size_t
original,
size_t
requested)
59
{
60
size_t
grow
= (original == 0)?1:original;
61
while
(grow < requested) {grow *= 2;}
62
return
grow
;
63
}
64
};
65
67
typedef
grow_policy_double
vector_grow_policy_default
;
68
75
class
grow_policy_page
76
{
77
public
:
78
87
static
size_t
grow
(
size_t
original,
size_t
requested)
88
{
89
return
(requested / PAGE_ALLOC) * PAGE_ALLOC + PAGE_ALLOC;
90
}
91
};
92
}
93
94
#endif
/* MAP_VECTOR_GROW_POLICY_HPP_ */
openfpm::grow_policy_double
Grow policy define how the vector should grow every time we exceed the size.
Definition:
map_vector_grow_p.hpp:46
openfpm::grow_policy_double::grow
static size_t grow(size_t original, size_t requested)
It say how much the vector must grow.
Definition:
map_vector_grow_p.hpp:58
openfpm::vector_grow_policy_default
grow_policy_double vector_grow_policy_default
default grow policy
Definition:
map_vector_grow_p.hpp:67
openfpm::grow_policy_page
Grow policy define how the vector should grow every time we exceed the size.
Definition:
map_vector_grow_p.hpp:75
openfpm::grow_policy_identity
Grow policy define how the vector should grow every time we exceed the size.
Definition:
map_vector_grow_p.hpp:22
openfpm::grow_policy_identity::grow
static size_t grow(size_t original, size_t requested)
It say how much the vector must grow.
Definition:
map_vector_grow_p.hpp:34
openfpm::grow_policy_page::grow
static size_t grow(size_t original, size_t requested)
It say how much the vector must grow.
Definition:
map_vector_grow_p.hpp:87
src
Vector
map_vector_grow_p.hpp
Generated by
1.8.6