![]() |
Reference documentation for deal.II version 8.1.0
|
#include <vectorization.h>
Public Types | |
typedef T | value_type |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef value_type * | iterator |
typedef const value_type * | const_iterator |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef std::size_t | size_type |
Public Member Functions | |
AlignedVector () | |
AlignedVector (const size_type size) | |
~AlignedVector () | |
AlignedVector (const AlignedVector< T > &vec) | |
AlignedVector & | operator= (const AlignedVector< T > &vec) |
void | resize_fast (const size_type size) |
void | resize (const size_type size_in, const T &init=T()) |
void | reserve (const size_type size_alloc) |
void | clear () |
void | push_back (const T in_data) |
reference | back () |
const_reference | back () const |
template<typename ForwardIterator > | |
void | insert_back (ForwardIterator begin, ForwardIterator end) |
void | swap (AlignedVector< T > &vec) |
size_type | size () const |
size_type | capacity () const |
reference | operator[] (const size_type index) |
const_reference | operator[] (const size_type index) const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
size_type | memory_consumption () const |
Private Attributes | |
T * | _data |
T * | _end_data |
T * | _end_allocated |
This is a replacement class for std::vector to be used in combination with VectorizedArray and derived data types. It allocates memory aligned to addresses of a vectorized data type (for SSE, this is necessary in order to avoid segfaults, and for AVX it considerably increases performance). This could also be achieved by proving std::vector with a user-defined allocator. On the other hand, writing an own small vector class lets us insert assertions more easily, and cut some unnecessary functionality. Note that this vector is a bit more memory-consuming than std::vector because of alignment, so it is recommended to only use this vector on long vectors.
author
Katharina Kormann, Martin Kronbichler, 2011
Definition at line 1563 of file vectorization.h.
typedef T AlignedVector< T >::value_type |
Declare standard types used in all containers. These types parallel those in the C++
standard libraries vector<...>
class.
Definition at line 1572 of file vectorization.h.
|
inline |
Empty constructor. Sets the vector size to zero.
Definition at line 1585 of file vectorization.h.
|
inline |
Sets the vector size to the given size and initializes all elements with T().
Definition at line 1596 of file vectorization.h.
|
inline |
Destructor.
Definition at line 1609 of file vectorization.h.
|
inline |
Copy constructor.
Definition at line 1617 of file vectorization.h.
|
inline |
Assignment to the input vector vec
.
Definition at line 1632 of file vectorization.h.
|
inline |
Change the size of the vector. It keeps old elements previously available but does not initialize the newly allocated memory, leaving it in an undefined state.
Definition at line 1646 of file vectorization.h.
|
inline |
Change the size of the vector. It keeps old elements previously available, and initializes each element with the specified data. If the new vector size is shorter than the old one, the memory is not released unless the new size is zero.
Definition at line 1660 of file vectorization.h.
|
inline |
Reserve memory space for size
elements. If the argument size
is set to zero, all previously allocated memory is released.
In order to avoid too frequent reallocation (which involves copy of the data), this function doubles the amount of memory occupied when the given size is larger than the previously allocated size.
Definition at line 1691 of file vectorization.h.
|
inline |
Releases all previously allocated memory and leaves the vector in a state equivalent to the state after the default constructor has been called.
Definition at line 1748 of file vectorization.h.
|
inline |
Inserts an element at the end of the vector, increasing the vector size by one. Note that the allocated size will double whenever the previous space is not enough to hold the new element.
Definition at line 1774 of file vectorization.h.
|
inline |
Returns the last element of the vector (read and write access).
Definition at line 1788 of file vectorization.h.
|
inline |
Returns the last element of the vector (read-only access).
Definition at line 1799 of file vectorization.h.
|
inline |
Inserts several elements at the end of the vector given by a range of elements.
Definition at line 1811 of file vectorization.h.
|
inline |
Swaps the given vector with the calling vector.
Definition at line 1828 of file vectorization.h.
|
inline |
Returns the size of the vector.
Definition at line 1838 of file vectorization.h.
|
inline |
Returns the capacity of the vector, i.e., the size this vector can hold without reallocation. Note that capacity() >= size().
Definition at line 1849 of file vectorization.h.
|
inline |
Read-write access to entry index
in the vector.
Definition at line 1859 of file vectorization.h.
|
inline |
Read-only access to entry index
in the vector.
Definition at line 1869 of file vectorization.h.
|
inline |
Returns a read and write pointer to the beginning of the data array.
Definition at line 1879 of file vectorization.h.
|
inline |
Returns a read and write pointer to the end of the data array.
Definition at line 1888 of file vectorization.h.
|
inline |
Returns a read-only pointer to the beginning of the data array.
Definition at line 1897 of file vectorization.h.
|
inline |
Returns a read-only pointer to the end of the data array.
Definition at line 1906 of file vectorization.h.
|
inline |
Returns the memory consumption of the allocated memory in this class. If the underlying type T
allocates memory by itself, this memory is not counted.
Definition at line 1917 of file vectorization.h.
|
private |
Pointer to actual class data.
Definition at line 1929 of file vectorization.h.
|
private |
Pointer to the end of valid data fields.
Definition at line 1934 of file vectorization.h.
|
private |
Pointer to the end of the allocated memory.
Definition at line 1939 of file vectorization.h.