1#ifndef HEFFTE_STOCK_ALLOCATOR_H
2#define HEFFTE_STOCK_ALLOCATOR_H
8#include "heffte_stock_complex.h"
24 typedef const F* const_pointer;
26 typedef const F& const_reference;
27 typedef size_t size_type;
28 typedef std::ptrdiff_t difference_type;
37 inline pointer
address(reference r) {
return &r; }
39 inline const_pointer
address(const_reference r)
const {
return &r; }
42 pointer
allocate(size_type n,
void const* =
nullptr) {
43 #ifdef Heffte_ENABLE_AVX
44 return reinterpret_cast<pointer
>(aligned_alloc(
alignof(F), n*
sizeof(F)));
46 return reinterpret_cast<pointer
>(malloc(n*
sizeof(F)));
57 inline void destroy(pointer p) { p->~value_type(); }
60 inline size_type
max_size() const noexcept {
return size_type(-1) /
sizeof(F); }
69template<
typename F,
int L>
70using complex_allocator = complex_allocator_t<Complex<F, L>>;
73template<
typename F,
int L>
74using complex_vector = std::vector<Complex<F,L>, complex_allocator<F,L>>;
Allocator to use with heffte::stock::Complex types Class to properly allocate heffte::stock::Complex<...
Definition heffte_stock_allocator.h:19
pointer allocate(size_type n, void const *=nullptr)
Define allocation for complex type.
Definition heffte_stock_allocator.h:42
void construct(pointer p, const_reference value)
Copy into pointer.
Definition heffte_stock_allocator.h:55
bool operator!=(const complex_allocator_t &rhs)
Define != operator.
Definition heffte_stock_allocator.h:65
void deallocate(pointer p, size_type)
Define deallocation for complex type.
Definition heffte_stock_allocator.h:50
size_type max_size() const noexcept
Define maximum size of an array of this.
Definition heffte_stock_allocator.h:60
void destroy(pointer p)
Destroy a pointer to this type.
Definition heffte_stock_allocator.h:57
bool operator==(const complex_allocator_t &)
Define == operator.
Definition heffte_stock_allocator.h:63
F value_type
Mandatory aliases.
Definition heffte_stock_allocator.h:22
const_pointer address(const_reference r) const
Get address from a const reference.
Definition heffte_stock_allocator.h:39
pointer address(reference r)
Get address from a reference.
Definition heffte_stock_allocator.h:37
Namespace containing all HeFFTe methods and classes.
Definition heffte_backend_cuda.h:38
Defining rebind for the allocator.
Definition heffte_stock_allocator.h:32