ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
AlignedArray< T, alignment > Class Template Reference

An aligned array. More...

#include <AlignedArray.h>

Inheritance diagram for AlignedArray< T, alignment >:
AlignedArrayTriplet< T >

Public Member Functions

 AlignedArray ()
 Construct an empty array.
 
 AlignedArray (size_t n)
 Construct an array of n elements.
 
 AlignedArray (const AlignedArray &a)
 Construct a copy of another AlignedArray.
 
AlignedArrayoperator= (const AlignedArray &a)
 Assign a copy of another AlignedArray.
 
virtual ~AlignedArray ()
 Free the array.
 
virtual void prefetch (int, int) const
 
virtual void increaseStorage (size_t oldNumElements, size_t additionalElements)
 
void appendValue (T v, size_t oldNumElements)
 
virtual size_t resize_zero_shrink (size_t exact_size, bool zero_rest_of_CL=false, bool allow_shrink=false)
 
virtual void resize (size_t n)
 Reallocate the array. All content may be lost. More...
 
virtual void zero (size_t start_idx=0)
 
size_t get_size () const
 Return current size in terms of elements.
 
 operator T* ()
 Implicit conversion into pointer to T.
 
 operator const T * () const
 
size_t get_dynamic_memory () const
 Return amount of allocated storage + .
 

Static Public Member Functions

static size_t _round_up (size_t n)
 

Protected Attributes

std::vector< T, AlignedAllocator< T, alignment > > _vec
 

Detailed Description

template<class T, size_t alignment = CACHE_LINE_SIZE>
class AlignedArray< T, alignment >

An aligned array.

Has pointer to T semantics. Internal size is rounded up to fill up full cache-lines.

Template Parameters
TThe type of the array elements.
alignmentThe alignment restriction. Must be a power of 2, should not be 8.
Author
Johannes Heckl, Nikola Tchipev, Micha Mueller

Member Function Documentation

◆ resize()

template<class T , size_t alignment = CACHE_LINE_SIZE>
virtual void AlignedArray< T, alignment >::resize ( size_t  n)
inlinevirtual

Reallocate the array. All content may be lost.

Reimplemented in AlignedArrayTriplet< T >.


The documentation for this class was generated from the following file: