14 #ifndef QMCPLUSPLUS_POOLEDMEMORY_H 15 #define QMCPLUSPLUS_POOLEDMEMORY_H 33 #define DEFAULT_PAGE_SIZE 4096 34 template<
typename T_scalar,
typename Alloc = aligned_allocator<
char, DEFAULT_PAGE_SIZE>>
107 if ((
size_t(
myData.data())) & (QMC_SIMD_ALIGNMENT - 1))
108 throw std::runtime_error(
"Unaligned memory allocated in PooledMemory");
112 template<
typename T1>
113 inline void add(std::complex<T1>& x)
118 template<
typename T1>
124 template<
typename T1>
125 inline void add(T1* first, T1* last)
127 constexpr
int multiplier =
sizeof(T1);
128 Current += getAlignedSize<T>((last - first) * multiplier);
131 template<
typename T1>
132 inline void get(std::complex<T1>& x)
138 template<
typename T1>
139 inline void get(T1& x)
144 template<
typename T1>
145 inline void get(T1* first, T1* last)
148 const size_t nbytes = (last - first) *
sizeof(T1);
150 Current += getAlignedSize<T>(nbytes);
153 template<
typename T1>
156 constexpr
int multiplier =
sizeof(T1);
158 Current += getAlignedSize<T>(
n * multiplier);
164 template<
typename T1>
165 inline void put(std::complex<T1>& x)
171 template<
typename T1>
177 template<
typename T1>
178 inline void put(T1* first, T1* last)
181 const size_t nbytes = (last - first) *
sizeof(T1);
183 Current += getAlignedSize<T>(nbytes);
206 template<
typename T1>
213 template<
typename T1>
void put(T1 *first, T1 *last)
Vector< T, Alloc > myData
helper functions for EinsplineSetBuilder
const int scalar_multiplier
void forward(size_type n)
void add(T1 *first, T1 *last)
void allocate()
allocate the data
PooledMemory & operator=(const PooledMemory &in)
copy assign operator
T * data()
return the address of the first element
size_type byteSize() const
return the size of the data
PooledMemory()
default constructor
size_type current() const
Declaraton of Vector<T,Alloc> Manage memory through Alloc directly and allow referencing an existing ...
size_type size() const
return the size of the data
PooledMemory(const PooledMemory &in)
copy constructor
PooledMemory & operator>>(T1 &x)
PooledMemory & operator<<(T1 &x)
typename Vector< T, aligned_allocator< char, DEFAULT_PAGE_SIZE > >::size_type size_type
size_type current_scalar() const
void clear()
clear the data and set Current=0
typename Alloc::size_type size_type
void rewind(size_type cur=0, size_type cur_scalar=0)
set the cursors
T1 * lendReference(size_type n)
void put(std::complex< T1 > &x)
size_type scalar_offset() const
return the address offset of the first scalar element
void add(std::complex< T1 > &x)