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. | |
Array (unsigned int dim1Size) | |
Creates an array of size dim1Size. | |
Array (unsigned int dim1Size, const DataType &initValue) | |
Creates a 1D array with each element initialized to an initial value. | |
Array (unsigned int dim1Size, const DataType *data) | |
Creates a 1D array a copies data into it. | |
Array (unsigned int dim1Size, const Array< OneD, const DataType > &rhs) | |
Creates a 1D array that references rhs. | |
Array (const Array< OneD, const DataType > &rhs) | |
Creates a reference to rhs. | |
~Array () | |
Array< OneD, const DataType > & | operator= (const Array< OneD, const DataType > &rhs) |
Creates a reference to rhs. | |
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. | |
const element * | data () const |
Returns a c-style pointer to the underlying array. | |
size_type | num_dimensions () const |
Returns 1. | |
size_type | num_elements () const |
Returns the array's size. | |
size_type | capacity () const |
unsigned int | GetOffset () const |
Returns the array's offset. | |
bool | Overlaps (const Array< OneD, const DataType > &rhs) const |
Returns true is this array and rhs overlap. |
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. | |
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 59 of file SharedArray.hpp.
Definition at line 62 of file SharedArray.hpp.
typedef const DataType* Nektar::Array< OneD, const DataType >::const_iterator |
Definition at line 66 of file SharedArray.hpp.
typedef const DataType& Nektar::Array< OneD, const DataType >::const_reference |
Definition at line 63 of file SharedArray.hpp.
Definition at line 69 of file SharedArray.hpp.
Definition at line 67 of file SharedArray.hpp.
Definition at line 64 of file SharedArray.hpp.
Definition at line 70 of file SharedArray.hpp.
|
inline |
Creates an empty array.
Reimplemented in Nektar::Array< OneD, DataType >.
Definition at line 75 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.
Reimplemented in Nektar::Array< OneD, DataType >.
Definition at line 90 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.
Reimplemented in Nektar::Array< OneD, DataType >.
Definition at line 110 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.
Reimplemented in Nektar::Array< OneD, DataType >.
Definition at line 128 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. |
Reimplemented in Nektar::Array< OneD, DataType >.
Definition at line 148 of file SharedArray.hpp.
References ASSERTL0, and num_elements().
|
inline |
Creates a reference to rhs.
Reimplemented in Nektar::Array< OneD, DataType >.
Definition at line 160 of file SharedArray.hpp.
Definition at line 170 of file SharedArray.hpp.
|
inline |
Definition at line 204 of file SharedArray.hpp.
Referenced by Nektar::NekVector< DataType >::NekVector().
|
inline |
Definition at line 227 of file SharedArray.hpp.
|
inlineprivate |
Definition at line 293 of file SharedArray.hpp.
|
inlinestaticprivate |
Definition at line 306 of file SharedArray.hpp.
Referenced by Nektar::operator+().
|
inline |
Returns a c-style pointer to the underlying array.
Definition at line 219 of file SharedArray.hpp.
|
inline |
Definition at line 205 of file SharedArray.hpp.
|
inline |
Returns a c-style pointer to the underlying array.
Definition at line 216 of file SharedArray.hpp.
Referenced by Overlaps().
|
inline |
|
inline |
Returns the array's size.
Definition at line 225 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(), Overlaps(), and Nektar::NekMatrix< DataType, StandardMatrixTag >::PerformCopyConstruction().
|
inline |
Creates a reference to rhs.
Definition at line 186 of file SharedArray.hpp.
References m_capacity, m_count, m_data, m_offset, and m_size.
|
inline |
Definition at line 207 of file SharedArray.hpp.
References ASSERTL1.
|
inline |
Returns true is this array and rhs overlap.
Definition at line 233 of file SharedArray.hpp.
References get(), and num_elements().
|
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 39 of file ArrayEqualityComparison.cpp.
|
protected |
Definition at line 268 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 272 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 271 of file SharedArray.hpp.
Referenced by operator=().
|
protected |
Definition at line 273 of file SharedArray.hpp.
Referenced by Nektar::Array< OneD, DataType >::CreateWithOffset(), and operator=().
|
protected |
Definition at line 267 of file SharedArray.hpp.
Referenced by Nektar::Array< OneD, DataType >::CreateWithOffset(), and operator=().