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 size_t | size_type |
Public Member Functions | |
Array () | |
Creates an empty array. More... | |
Array (size_type dim1Size) | |
Creates an array of size dim1Size. More... | |
Array (size_type dim1Size, const DataType &initValue) | |
Creates a 1D array with each element initialized to an initial value. More... | |
Array (size_type dim1Size, const DataType *data) | |
Creates a 1D array a copies data into it. More... | |
Array (size_type 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[] (size_type 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 | size () const |
Returns the array's size. More... | |
size_type | num_elements () const |
Returns the array's size. Deprecated. More... | |
size_type | capacity () const |
Returns the array's capacity. More... | |
size_type | GetOffset () const |
Returns the array's offset. More... | |
size_type | GetCount () const |
Returns the array's reference counter. More... | |
bool | Overlaps (const Array< OneD, const DataType > &rhs) const |
Returns true is this array and rhs overlap. More... | |
Protected Attributes | |
size_type | m_size |
size_type | m_capacity |
DataType * | m_data |
size_type * | m_count |
size_type | m_offset |
Private Member Functions | |
void | CreateStorage (size_type size) |
Static Private Member Functions | |
template<typename T > | |
static Array< OneD, T > | CreateWithOffset (const Array< OneD, T > &rhs, size_type offset) |
Friends | |
template<typename T > | |
Array< OneD, T > | operator+ (const Array< OneD, T > &lhs, typename Array< OneD, T >::size_type offset) |
Creates an array with a specified offset. More... | |
template<typename T > | |
Array< OneD, T > | operator+ (typename Array< OneD, T >::size_type offset, const Array< OneD, T > &rhs) |
1D Array of constant elements with garbage collection and bounds checking.
Definition at line 55 of file SharedArray.hpp.
typedef DataType* Nektar::Array< OneD, const DataType >::ArrayType |
Definition at line 65 of file SharedArray.hpp.
typedef const DataType* Nektar::Array< OneD, const DataType >::const_iterator |
Definition at line 70 of file SharedArray.hpp.
typedef const DataType& Nektar::Array< OneD, const DataType >::const_reference |
Definition at line 67 of file SharedArray.hpp.
typedef DataType Nektar::Array< OneD, const DataType >::element |
Definition at line 73 of file SharedArray.hpp.
typedef DataType* Nektar::Array< OneD, const DataType >::iterator |
Definition at line 71 of file SharedArray.hpp.
typedef DataType& Nektar::Array< OneD, const DataType >::reference |
Definition at line 68 of file SharedArray.hpp.
typedef size_t Nektar::Array< OneD, const DataType >::size_type |
Definition at line 74 of file SharedArray.hpp.
|
inline |
Creates an empty array.
Definition at line 78 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 94 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 115 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 135 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 157 of file SharedArray.hpp.
|
inline |
Creates a reference to rhs.
Definition at line 192 of file SharedArray.hpp.
|
inline |
Definition at line 209 of file SharedArray.hpp.
References Nektar::MemoryManager< DataType >::RawDeallocate().
|
inline |
Definition at line 292 of file SharedArray.hpp.
|
inline |
Returns the array's capacity.
Definition at line 345 of file SharedArray.hpp.
|
inlineprivate |
Definition at line 424 of file SharedArray.hpp.
References Nektar::MemoryManager< DataType >::RawAllocate().
|
inlinestaticprivate |
Definition at line 442 of file SharedArray.hpp.
|
inline |
Returns a c-style pointer to the underlying array.
Definition at line 317 of file SharedArray.hpp.
|
inline |
Definition at line 296 of file SharedArray.hpp.
|
inline |
Returns a c-style pointer to the underlying array.
Definition at line 311 of file SharedArray.hpp.
Referenced by Overlaps().
|
inline |
Returns the array's reference counter.
Definition at line 357 of file SharedArray.hpp.
|
inline |
Returns the array's offset.
Definition at line 351 of file SharedArray.hpp.
|
inline |
|
inline |
Returns the array's size. Deprecated.
Definition at line 336 of file SharedArray.hpp.
References WARNINGL1.
|
inline |
Creates a reference to rhs.
Definition at line 246 of file SharedArray.hpp.
References m_capacity, m_count, m_data, m_offset, m_size, and Nektar::MemoryManager< DataType >::RawDeallocate().
|
inline |
Definition at line 301 of file SharedArray.hpp.
References ASSERTL1.
|
inline |
Returns true is this array and rhs overlap.
Definition at line 363 of file SharedArray.hpp.
|
inline |
Returns the array's size.
Definition at line 329 of file SharedArray.hpp.
Referenced by Nektar::SolverUtils::Advection::AddTraceJacToMat(), Array(), Nektar::StorageSmvBsr< T >::const_iterator::const_iterator(), Nektar::CopyArray(), Nektar::CopyArrayN(), Nektar::FullMatrixFuncs::EigenSolve(), Nektar::StorageSmvBsr< T >::const_iterator::forward(), Nektar::CFSImplicit::MultiplyElmtInvMassPlusSource(), Nektar::LibUtilities::NodalTriElec::NodalPointReorder2d(), Nektar::LibUtilities::NodalTriFekete::NodalPointReorder2d(), Nektar::NekVector< NekDouble >::operator/=(), Overlaps(), and Nektar::NekMatrix< DataType, StandardMatrixTag >::PerformCopyConstruction().
|
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 |
|
protected |
Definition at line 413 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 419 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 414 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 421 of file SharedArray.hpp.
Referenced by Nektar::Array< OneD, DataType >::CreateWithOffset(), and operator=().
|
protected |
Definition at line 412 of file SharedArray.hpp.
Referenced by Nektar::Array< OneD, DataType >::CreateWithOffset(), and operator=().