Nektar++
|
1D Array of constant elements with garbage collection and bounds checking. More...
#include <SharedArray.hpp>
Public Types | |
typedef DataType * | ArrayType |
typedef const DataType & | const_reference |
typedef DataType & | reference |
typedef const DataType * | const_iterator |
typedef DataType * | iterator |
typedef DataType | element |
typedef unsigned int | size_type |
Public Member Functions | |
Array () | |
Creates an empty array. More... | |
Array (unsigned int dim1Size) | |
Creates an array of size dim1Size. More... | |
Array (unsigned int dim1Size, const DataType &initValue) | |
Creates a 1D array with each element initialized to an initial value. More... | |
Array (unsigned int dim1Size, const DataType *data) | |
Creates a 1D array a copies data into it. More... | |
Array (unsigned int dim1Size, const Array< OneD, const DataType > &rhs) | |
Creates a 1D array that references rhs. More... | |
Array (const Array< OneD, const DataType > &rhs) | |
Creates a reference to rhs. More... | |
~Array () | |
Array< OneD, const DataType > & | operator= (const Array< OneD, const DataType > &rhs) |
Creates a reference to rhs. More... | |
const_iterator | begin () const |
const_iterator | end () const |
const_reference | operator[] (unsigned int i) const |
const element * | get () const |
Returns a c-style pointer to the underlying array. More... | |
const element * | data () const |
Returns a c-style pointer to the underlying array. More... | |
size_type | num_dimensions () const |
Returns 1. More... | |
size_type | num_elements () const |
Returns the array's size. More... | |
size_type | capacity () const |
unsigned int | GetOffset () const |
Returns the array's offset. More... | |
bool | Overlaps (const Array< OneD, const DataType > &rhs) const |
Returns true is this array and rhs overlap. More... | |
Protected Attributes | |
unsigned int | m_size |
unsigned int | m_capacity |
DataType * | m_data |
unsigned int * | m_count |
unsigned int | m_offset |
Private Member Functions | |
void | CreateStorage (unsigned int size) |
Static Private Member Functions | |
template<typename T > | |
static Array< OneD, T > | CreateWithOffset (const Array< OneD, T > &rhs, unsigned int offset) |
Friends | |
template<typename T1 , typename T2 > | |
bool | operator== (const Array< OneD, T1 > &, const Array< OneD, T2 > &) |
bool | operator== (const Array< OneD, NekDouble > &, const Array< OneD, NekDouble > &) |
bool | IsEqual (const Array< OneD, const NekDouble > &, const Array< OneD, const NekDouble > &, NekDouble) |
template<typename T > | |
Array< OneD, T > | operator+ (const Array< OneD, T > &lhs, unsigned int offset) |
Creates an array with a specified offset. More... | |
template<typename T > | |
Array< OneD, T > | operator+ (unsigned int offset, const Array< OneD, T > &rhs) |
1D Array of constant elements with garbage collection and bounds checking.
Definition at line 60 of file SharedArray.hpp.
typedef DataType* Nektar::Array< OneD, const DataType >::ArrayType |
Definition at line 63 of file SharedArray.hpp.
typedef const DataType* Nektar::Array< OneD, const DataType >::const_iterator |
Definition at line 67 of file SharedArray.hpp.
typedef const DataType& Nektar::Array< OneD, const DataType >::const_reference |
Definition at line 64 of file SharedArray.hpp.
typedef DataType Nektar::Array< OneD, const DataType >::element |
Definition at line 70 of file SharedArray.hpp.
typedef DataType* Nektar::Array< OneD, const DataType >::iterator |
Definition at line 68 of file SharedArray.hpp.
typedef DataType& Nektar::Array< OneD, const DataType >::reference |
Definition at line 65 of file SharedArray.hpp.
typedef unsigned int Nektar::Array< OneD, const DataType >::size_type |
Definition at line 71 of file SharedArray.hpp.
|
inline |
Creates an empty array.
Definition at line 76 of file SharedArray.hpp.
References Nektar::CreateStorage().
|
inlineexplicit |
Creates an array of size dim1Size.
If DataType is a fundamental type (double, int, etc.), then the allocated array is uninitialized. If it is any other type, each element is initialized with DataType's default constructor.
Definition at line 91 of file SharedArray.hpp.
References Nektar::CreateStorage().
|
inline |
Creates a 1D array with each element initialized to an initial value.
dim1Size | The array's size. |
initValue | Each element's initial value. |
If DataType is a fundamental type (double, int, etc.), then the initial value is copied directly into each element. Otherwise, the DataType's copy constructor is used to initialize each element.
Definition at line 111 of file SharedArray.hpp.
References Nektar::CreateStorage().
|
inline |
Creates a 1D array a copies data into it.
dim1Size | the array's size. |
data | The data to copy. |
If DataType is a fundamental type (double, int, etc.), then data is copied directly into the underlying storage. Otherwise, the DataType's copy constructor is used to copy each element.
Definition at line 129 of file SharedArray.hpp.
References Nektar::CreateStorage().
|
inline |
Creates a 1D array that references rhs.
dim1Size | The size of the array. This is useful when you want this array to reference a subset of the elements in rhs. |
rhs | Array to reference. This constructor creates an array that references rhs. Any changes to rhs will be reflected in this array. The memory for the array will only be deallocated when both rhs and this array have gone out of scope. |
Definition at line 149 of file SharedArray.hpp.
References ASSERTL0, and num_elements().
|
inline |
Creates a reference to rhs.
Definition at line 161 of file SharedArray.hpp.
|
inline |
Definition at line 171 of file SharedArray.hpp.
References Nektar::MemoryManager< DataType >::RawDeallocate().
|
inline |
Definition at line 205 of file SharedArray.hpp.
Referenced by Nektar::NekVector< DataType >::NekVector().
|
inline |
Definition at line 228 of file SharedArray.hpp.
|
inlineprivate |
Definition at line 294 of file SharedArray.hpp.
References Nektar::MemoryManager< DataType >::RawAllocate().
|
inlinestaticprivate |
Definition at line 307 of file SharedArray.hpp.
|
inline |
|
inline |
Definition at line 206 of file SharedArray.hpp.
|
inline |
Returns a c-style pointer to the underlying array.
Definition at line 217 of file SharedArray.hpp.
Referenced by Overlaps().
|
inline |
|
inline |
|
inline |
Returns the array's size.
Definition at line 226 of file SharedArray.hpp.
Referenced by Array(), Nektar::StorageSmvBsr< T >::const_iterator::const_iterator(), Nektar::CopyArray(), Nektar::CopyArrayN(), Nektar::StorageSmvBsr< T >::const_iterator::forward(), Nektar::NekMatrix< DataType, StandardMatrixTag >::NekMatrix(), Nektar::NekVector< DataType >::NekVector(), Nektar::LibUtilities::NodalTriElec::NodalPointReorder2d(), Nektar::LibUtilities::NodalTriFekete::NodalPointReorder2d(), Overlaps(), and Nektar::NekMatrix< DataType, StandardMatrixTag >::PerformCopyConstruction().
|
inline |
Creates a reference to rhs.
Definition at line 187 of file SharedArray.hpp.
References m_capacity, m_count, m_data, m_offset, m_size, and Nektar::MemoryManager< DataType >::RawDeallocate().
|
inline |
Definition at line 208 of file SharedArray.hpp.
References ASSERTL1.
|
inline |
Returns true is this array and rhs overlap.
Definition at line 234 of file SharedArray.hpp.
References get(), and num_elements().
|
friend |
Definition at line 45 of file ArrayEqualityComparison.cpp.
|
friend |
Creates an array with a specified offset.
The return value will reference the same array as lhs, but with an offset.
For example, in the following:
result[0] == anArray[10];
|
friend |
|
friend |
Definition at line 715 of file SharedArray.hpp.
|
friend |
Definition at line 39 of file ArrayEqualityComparison.cpp.
|
protected |
Definition at line 269 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 273 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 272 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 274 of file SharedArray.hpp.
Referenced by Nektar::Array< OneD, DataType >::CreateWithOffset(), and operator=().
|
protected |
Definition at line 268 of file SharedArray.hpp.
Referenced by Nektar::Array< OneD, DataType >::CreateWithOffset(), and operator=().