OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
13namespace openfpm
14{
15
23 {
24 public:
25
34 static size_t grow(size_t original, size_t requested)
35 {
36 return requested;
37 }
38 };
39
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
68
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_ */
Grow policy define how the vector should grow every time we exceed the size.
static size_t grow(size_t original, size_t requested)
It say how much the vector must grow.
Grow policy define how the vector should grow every time we exceed the size.
static size_t grow(size_t original, size_t requested)
It say how much the vector must grow.
Grow policy define how the vector should grow every time we exceed the size.
static size_t grow(size_t original, size_t requested)
It say how much the vector must grow.
convert a type into constant type
grow_policy_double vector_grow_policy_default
default grow policy