Advanced Multi-Physics (AMP)
On-Line Documentation
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
AMP::Array< TYPE, FUN, Allocator > Class Template Referencefinal

#include <Array.h>

Inheritance diagram for AMP::Array< TYPE, FUN, Allocator >:
Inheritance graph
[legend]

Classes

class  Deleter
 

Public Types

typedef FUN function_table
 
using scalarAllocator_t = typename std::allocator_traits< Allocator >::template rebind_alloc< TYPE >
 
typedef TYPE value_type
 

Public Member Functions

void addSubset (const std::vector< Range< size_t > > &index, const Array &subset)
 
void addSubset (const std::vector< size_t > &index, const Array &subset)
 
 Array ()
 
 Array (Array &&rhs)
 
 Array (const Array &rhs)
 
 Array (const ArraySize &N, const TYPE *data=nullptr)
 
template<typename U = TYPE, typename = typename std::enable_if<std::is_same_v<U, TYPE>>::type>
 Array (const Range< U > &range)
 
 Array (size_t N)
 
 Array (size_t N1, size_t N2, size_t N3)
 
 Array (size_t N1, size_t N2, size_t N3, size_t N4)
 
 Array (size_t N1, size_t N2, size_t N3, size_t N4, size_t N5)
 
 Array (size_t N_rows, size_t N_columns)
 
 Array (std::initializer_list< std::initializer_list< TYPE > > data)
 
 Array (std::initializer_list< TYPE > data)
 
 Array (std::string range)
 
void axpby (const TYPE &alpha, const Array &x, const TYPE &beta)
 
ARRAY_INLINE TYPE * begin ()
 Get iterator to beginning of data.
 
ARRAY_INLINE const TYPE * begin () const
 Get iterator to beginning of data.
 
void cat (const Array &x, int dim=0)
 Concatenates a given array with the current array.
 
void clear ()
 Clear the data in the array.
 
template<class TYPE2 >
auto cloneTo () const
 
Array coarsen (const Array &filter) const
 Coarsen an array using the given filter.
 
Array coarsen (const ArraySize &ratio, std::function< TYPE(const Array &)> filter) const
 Coarsen an array using the given filter.
 
template<class TYPE2 , class FUN2 , class Allocator2 >
void copy (const Array< TYPE2, FUN2, Allocator2 > &array)
 
template<class TYPE2 >
void copy (const TYPE2 *data)
 
void copySubset (const std::vector< Range< size_t > > &index, const Array &subset)
 
void copySubset (const std::vector< size_t > &index, const Array &subset)
 
template<class TYPE2 >
void copyTo (TYPE2 *data) const
 
ARRAY_INLINE TYPE * data ()
 Return the pointer to the raw data.
 
ARRAY_INLINE const TYPE * data () const
 Return the pointer to the raw data.
 
ARRAY_INLINE bool empty () const
 Return true if the Array is empty.
 
ARRAY_INLINE TYPE * end ()
 Get iterator to beginning of data.
 
ARRAY_INLINE const TYPE * end () const
 Get iterator to beginning of data.
 
bool equals (const Array &rhs, const TYPE &tol=0.000001) const
 Determine if two Arrays are equal using an absolute tolerance.
 
ARRAY_INLINE void fill (const TYPE &y)
 
std::vector< size_t > find (const TYPE &value, std::function< bool(const TYPE &, const TYPE &)> compare) const
 Find all elements that match the operator.
 
int64_t findFirst (const TYPE &value, std::function< bool(const TYPE &, const TYPE &)> compare) const
 Find all elements that match the operator (if element is not found return -1)
 
int64_t findLast (const TYPE &value, std::function< bool(const TYPE &, const TYPE &)> compare) const
 Find all elements that match the operator (if element is not found return -1)
 
std::shared_ptr< TYPE > getPtr ()
 Return the pointer to the raw data.
 
std::shared_ptr< const TYPE > getPtr () const
 Return the pointer to the raw data.
 
TYPE interp (const double *x) const
 
TYPE interp (const std::vector< double > &x) const
 
ARRAY_INLINE bool isCopyable () const
 Is copyable?
 
ARRAY_INLINE bool isFixedSize () const
 Is fixed size?
 
ARRAY_INLINE size_t length () const
 Return the size of the Array.
 
TYPE max () const
 Return the largest value.
 
TYPE max (const std::vector< Range< size_t > > &index) const
 Return the largest value.
 
TYPE max (const std::vector< size_t > &index) const
 Return the largest value.
 
Array max (int dir) const
 Return the max of all elements in a given direction.
 
TYPE mean () const
 Return the mean of all elements.
 
TYPE mean (const std::vector< Range< size_t > > &index) const
 Return the mean of all elements.
 
TYPE mean (const std::vector< size_t > &index) const
 Return the mean of all elements.
 
TYPE min () const
 Return the smallest value.
 
TYPE min (const std::vector< Range< size_t > > &index) const
 Return the smallest value.
 
TYPE min (const std::vector< size_t > &index) const
 Return the smallest value.
 
Array min (int dir) const
 Return the min of all elements in a given direction.
 
bool NaNs () const
 Return true if NaNs are present.
 
ARRAY_INLINE int ndim () const
 Return the size of the Array.
 
ARRAY_INLINE operator bool () const
 Return true if the Array is not empty.
 
bool operator!= (const Array &rhs) const
 Check if two matrices are not equal.
 
ARRAY_INLINE TYPE & operator() (size_t i)
 
ARRAY_INLINE const TYPE & operator() (size_t i) const
 
ARRAY_INLINE TYPE & operator() (size_t i, size_t j)
 
ARRAY_INLINE const TYPE & operator() (size_t i, size_t j) const
 
ARRAY_INLINE TYPE & operator() (size_t i, size_t j, size_t k)
 
ARRAY_INLINE const TYPE & operator() (size_t i, size_t j, size_t k) const
 
ARRAY_INLINE TYPE & operator() (size_t i1, size_t i2, size_t i3, size_t i4)
 
ARRAY_INLINE const TYPE & operator() (size_t i1, size_t i2, size_t i3, size_t i4) const
 
ARRAY_INLINE TYPE & operator() (size_t i1, size_t i2, size_t i3, size_t i4, size_t i5)
 
ARRAY_INLINE const TYPE & operator() (size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) const
 
Arrayoperator+= (const Array &rhs)
 Add another array.
 
Arrayoperator+= (const TYPE &rhs)
 Add a scalar.
 
Arrayoperator-= (const Array &rhs)
 Subtract another array.
 
Arrayoperator-= (const TYPE &rhs)
 Subtract a scalar.
 
Arrayoperator= (Array &&rhs)
 
Arrayoperator= (const Array &rhs)
 
Arrayoperator= (const std::vector< TYPE > &rhs)
 
bool operator== (const Array &rhs) const
 Check if two matrices are equal.
 
ARRAY_INLINE TYPE & operator[] (size_t i)
 
ARRAY_INLINE const TYPE & operator[] (size_t i) const
 
size_t pack (std::byte *) const
 Pack the data to a buffer.
 
size_t packSize () const
 Return the number of bytes required to pack the data.
 
void pow (const Array &base, const TYPE &exp)
 
void print (std::ostream &os, const std::string &name="A", const std::string &prefix="") const
 Print an array.
 
ARRAY_INLINE TYPE * ptr (size_t i)
 
ARRAY_INLINE const TYPE * ptr (size_t i) const
 
void rand ()
 Initialize the array with random values (defined from the function table)
 
template<class TYPE2 >
auto reinterpretArray () const
 
Array repmat (const ArraySize &N) const
 Replicate an array a given number of times in each direction.
 
void reshape (const ArraySize &N)
 
void resize (const ArraySize &N)
 
void resize (size_t N)
 
void resize (size_t N1, size_t N2, size_t N3)
 
void resize (size_t N_row, size_t N_col)
 
void resizeDim (int dim, size_t N, const TYPE &value)
 
Array reverseDim () const
 Transpose an array.
 
void scale (const TYPE &y)
 
ARRAY_INLINE void setCopyable (bool flag)
 Set is copyable.
 
ARRAY_INLINE void setFixedSize (bool flag)
 Set is copyable.
 
ARRAY_INLINE void setNdim (int ndim)
 
ARRAY_INLINE const ArraySizesize () const
 Return the size of the Array.
 
ARRAY_INLINE size_t size (int d) const
 Return the size of the Array.
 
Array subset (const std::vector< Range< size_t > > &index) const
 
Array subset (const std::vector< size_t > &index) const
 
TYPE sum () const
 Return the sum of all elements.
 
TYPE sum (const std::vector< Range< size_t > > &index) const
 Return the sum of all elements.
 
TYPE sum (const std::vector< size_t > &index) const
 Return the sum of all elements.
 
Array sum (int dir) const
 Return the sum of all elements in a given direction.
 
void swap (Array &other)
 
size_t unpack (const std::byte *)
 Unpack the data from a buffer.
 
Array< TYPE, FUN, Allocator > view ()
 
void view2 (Array &src)
 
void view2 (const ArraySize &N, std::shared_ptr< TYPE > data)
 
void viewRaw (const ArraySize &N, TYPE *data, bool isCopyable=true, bool isFixedSize=true)
 
void viewRaw (int ndim, const size_t *dims, TYPE *data, bool isCopyable=true, bool isFixedSize=true)
 
 ~Array ()
 Destructor.
 

Static Public Member Functions

static Array cat (const std::initializer_list< Array > &x, int dim=0)
 Concatenates the arrays along the dimension dim.
 
static Array cat (const std::vector< Array > &x, int dim=0)
 Concatenates the arrays along the dimension dim.
 
static Array cat (size_t N_array, const Array *x, int dim)
 Concatenates the arrays along the dimension dim.
 
static std::unique_ptr< const ArrayconstView (const ArraySize &N, const std::shared_ptr< const TYPE > &data)
 
template<class TYPE2 >
static auto convert (std::shared_ptr< Array< TYPE, FUN, Allocator > > array)
 
template<class TYPE2 >
static auto convert (std::shared_ptr< const Array< TYPE, FUN, Allocator > > array)
 
static Array staticView (const ArraySize &N, TYPE *data)
 
static Array transform (std::function< TYPE(const TYPE &)> fun, const Array &x)
 
static Array transform (std::function< TYPE(const TYPE &, const TYPE &)> fun, const Array &x, const Array &y)
 
static std::unique_ptr< Arrayview (const ArraySize &N, std::shared_ptr< TYPE > data)
 

Private Member Functions

void allocate (const ArraySize &N)
 
void checkSubsetIndex (const std::vector< Range< size_t > > &range) const
 
std::vector< Range< size_t > > convert (const std::vector< size_t > &index) const
 

Static Private Member Functions

static void getSubsetArrays (const std::vector< Range< size_t > > &range, std::array< size_t, 5 > &first, std::array< size_t, 5 > &last, std::array< size_t, 5 > &inc, std::array< size_t, 5 > &N)
 

Private Attributes

scalarAllocator_t d_alloc
 
TYPE * d_data
 
bool d_isCopyable
 
bool d_isFixedSize
 
std::shared_ptr< TYPE > d_ptr
 
ArraySize d_size
 

Detailed Description

template<class TYPE, class FUN, class Allocator>
class AMP::Array< TYPE, FUN, Allocator >

Class Array is a multi-dimensional array class written by Mark Berrill

Definition at line 25 of file Array.h.

Member Typedef Documentation

◆ function_table

template<class TYPE , class FUN , class Allocator >
typedef FUN AMP::Array< TYPE, FUN, Allocator >::function_table

Definition at line 29 of file Array.h.

◆ scalarAllocator_t

template<class TYPE , class FUN , class Allocator >
using AMP::Array< TYPE, FUN, Allocator >::scalarAllocator_t = typename std::allocator_traits<Allocator>::template rebind_alloc<TYPE>

Definition at line 34 of file Array.h.

◆ value_type

template<class TYPE , class FUN , class Allocator >
typedef TYPE AMP::Array< TYPE, FUN, Allocator >::value_type

Definition at line 28 of file Array.h.

Constructor & Destructor Documentation

◆ Array() [1/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( )

Create a new empty Array

◆ Array() [2/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( const ArraySize N,
const TYPE *  data = nullptr 
)
explicit

Create an Array with the given size

Parameters
NSize of the array
dataOptional raw array to copy the src data

◆ Array() [3/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( size_t  N)
explicit

Create a new 1D Array with the given number of elements

Parameters
NNumber of elements in the array

◆ Array() [4/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( size_t  N_rows,
size_t  N_columns 
)
explicit

Create a new 2D Array with the given number of rows and columns

Parameters
N_rowsNumber of rows
N_columnsNumber of columns

◆ Array() [5/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( size_t  N1,
size_t  N2,
size_t  N3 
)
explicit

Create a new 3D Array with the given number of rows and columns

Parameters
N1Number of rows
N2Number of columns
N3Number of elements in the third dimension

◆ Array() [6/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( size_t  N1,
size_t  N2,
size_t  N3,
size_t  N4 
)
explicit

Create a new 4D Array with the given number of rows and columns

Parameters
N1Number of elements in the first dimension
N2Number of elements in the second dimension
N3Number of elements in the third dimension
N4Number of elements in the fourth dimension

◆ Array() [7/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( size_t  N1,
size_t  N2,
size_t  N3,
size_t  N4,
size_t  N5 
)
explicit

Create a new 4D Array with the given number of rows and columns

Parameters
N1Number of elements in the first dimension
N2Number of elements in the second dimension
N3Number of elements in the third dimension
N4Number of elements in the fourth dimension
N5Number of elements in the fifth dimension

◆ Array() [8/13]

template<class TYPE , class FUN , class Allocator >
template<typename U = TYPE, typename = typename std::enable_if<std::is_same_v<U, TYPE>>::type>
AMP::Array< TYPE, FUN, Allocator >::Array ( const Range< U > &  range)
explicit

Create a 1D Array with the range

Parameters
rangeRange of the data

◆ Array() [9/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( std::string  range)
explicit

Create a 1D Array using a string that mimic's MATLAB

Parameters
rangeRange of the data

◆ Array() [10/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( std::initializer_list< TYPE >  data)

Create a 1D Array with the given initializer list

Parameters
dataInput data

◆ Array() [11/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( std::initializer_list< std::initializer_list< TYPE > >  data)

Create a 2D Array with the given initializer lists

Parameters
dataInput data

◆ Array() [12/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( const Array< TYPE, FUN, Allocator > &  rhs)

Copy constructor

Parameters
rhsArray to copy

◆ Array() [13/13]

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::Array ( Array< TYPE, FUN, Allocator > &&  rhs)

Move constructor

Parameters
rhsArray to copy

◆ ~Array()

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::~Array ( )

Destructor.

Member Function Documentation

◆ addSubset() [1/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::addSubset ( const std::vector< Range< size_t > > &  index,
const Array< TYPE, FUN, Allocator > &  subset 
)

Add data from an array into a subset of this array

Parameters
indexIndex of the subset
subsetThe subset array to add from

◆ addSubset() [2/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::addSubset ( const std::vector< size_t > &  index,
const Array< TYPE, FUN, Allocator > &  subset 
)

Add data from an array into a subset of this array

Parameters
indexIndex of the subset (imin,imax,jmin,jmax,kmin,kmax,...)
subsetThe subset array to add from

◆ allocate()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::allocate ( const ArraySize N)
private

◆ axpby()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::axpby ( const TYPE &  alpha,
const Array< TYPE, FUN, Allocator > &  x,
const TYPE &  beta 
)

axpby operation: this = alpha*x + beta*this

Parameters
[in]alphaalpha
[in]xx
[in]betabeta

◆ begin() [1/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE * AMP::Array< TYPE, FUN, Allocator >::begin ( )
inline

Get iterator to beginning of data.

Definition at line 628 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data.

◆ begin() [2/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE * AMP::Array< TYPE, FUN, Allocator >::begin ( ) const
inline

Get iterator to beginning of data.

Definition at line 631 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data.

◆ cat() [1/4]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::cat ( const Array< TYPE, FUN, Allocator > &  x,
int  dim = 0 
)

Concatenates a given array with the current array.

◆ cat() [2/4]

template<class TYPE , class FUN , class Allocator >
static Array AMP::Array< TYPE, FUN, Allocator >::cat ( const std::initializer_list< Array< TYPE, FUN, Allocator > > &  x,
int  dim = 0 
)
static

Concatenates the arrays along the dimension dim.

◆ cat() [3/4]

template<class TYPE , class FUN , class Allocator >
static Array AMP::Array< TYPE, FUN, Allocator >::cat ( const std::vector< Array< TYPE, FUN, Allocator > > &  x,
int  dim = 0 
)
static

Concatenates the arrays along the dimension dim.

◆ cat() [4/4]

template<class TYPE , class FUN , class Allocator >
static Array AMP::Array< TYPE, FUN, Allocator >::cat ( size_t  N_array,
const Array< TYPE, FUN, Allocator > *  x,
int  dim 
)
static

Concatenates the arrays along the dimension dim.

◆ checkSubsetIndex()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::checkSubsetIndex ( const std::vector< Range< size_t > > &  range) const
inlineprivate

◆ clear()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::clear ( )

Clear the data in the array.

◆ cloneTo()

template<class TYPE , class FUN , class Allocator >
template<class TYPE2 >
auto AMP::Array< TYPE, FUN, Allocator >::cloneTo ( ) const
inline

Copy and convert data from this array to a new array

Definition at line 317 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::copyTo(), AMP::Array< TYPE, FUN, Allocator >::data(), and AMP::Array< TYPE, FUN, Allocator >::size().

◆ coarsen() [1/2]

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::coarsen ( const Array< TYPE, FUN, Allocator > &  filter) const

Coarsen an array using the given filter.

◆ coarsen() [2/2]

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::coarsen ( const ArraySize ratio,
std::function< TYPE(const Array< TYPE, FUN, Allocator > &)>  filter 
) const

Coarsen an array using the given filter.

◆ constView()

template<class TYPE , class FUN , class Allocator >
static std::unique_ptr< const Array > AMP::Array< TYPE, FUN, Allocator >::constView ( const ArraySize N,
const std::shared_ptr< const TYPE > &  data 
)
static

Create a multi-dimensional Array view to a raw block of data

Parameters
NNumber of elements in each dimension
dataPointer to the data

◆ convert() [1/3]

template<class TYPE , class FUN , class Allocator >
std::vector< Range< size_t > > AMP::Array< TYPE, FUN, Allocator >::convert ( const std::vector< size_t > &  index) const
inlineprivate

◆ convert() [2/3]

template<class TYPE , class FUN , class Allocator >
template<class TYPE2 >
static auto AMP::Array< TYPE, FUN, Allocator >::convert ( std::shared_ptr< Array< TYPE, FUN, Allocator > >  array)
inlinestatic

Convert an array of one type to another. This may or may not allocate new memory.

Parameters
arrayInput array

Definition at line 260 of file Array.h.

◆ convert() [3/3]

template<class TYPE , class FUN , class Allocator >
template<class TYPE2 >
static auto AMP::Array< TYPE, FUN, Allocator >::convert ( std::shared_ptr< const Array< TYPE, FUN, Allocator > >  array)
inlinestatic

Convert an array of one type to another. This may or may not allocate new memory.

Parameters
arrayInput array

Definition at line 276 of file Array.h.

◆ copy() [1/2]

template<class TYPE , class FUN , class Allocator >
template<class TYPE2 , class FUN2 , class Allocator2 >
void AMP::Array< TYPE, FUN, Allocator >::copy ( const Array< TYPE2, FUN2, Allocator2 > &  array)
inline

Copy and convert data from another array to this array

Parameters
arraySource array

Definition at line 292 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::copy(), AMP::Array< TYPE, FUN, Allocator >::data(), AMP::Array< TYPE, FUN, Allocator >::resize(), and AMP::Array< TYPE, FUN, Allocator >::size().

Referenced by AMP::Array< TYPE, FUN, Allocator >::copy().

◆ copy() [2/2]

template<class TYPE , class FUN , class Allocator >
template<class TYPE2 >
void AMP::Array< TYPE, FUN, Allocator >::copy ( const TYPE2 *  data)
inline

Copy and convert data from a raw vector to this array. Note: The current array must be allocated to the proper size first.

Parameters
dataSource data

Definition at line 935 of file Array.h.

◆ copySubset() [1/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::copySubset ( const std::vector< Range< size_t > > &  index,
const Array< TYPE, FUN, Allocator > &  subset 
)

Copy data from an array into a subset of this array

Parameters
indexIndex of the subset
subsetThe subset array to copy from

◆ copySubset() [2/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::copySubset ( const std::vector< size_t > &  index,
const Array< TYPE, FUN, Allocator > &  subset 
)

Copy data from an array into a subset of this array

Parameters
indexIndex of the subset (imin,imax,jmin,jmax,kmin,kmax,...)
subsetThe subset array to copy from

◆ copyTo()

template<class TYPE , class FUN , class Allocator >
template<class TYPE2 >
void AMP::Array< TYPE, FUN, Allocator >::copyTo ( TYPE2 *  data) const
inline

Copy and convert data from this array to a raw vector.

Parameters
dataSource data

Definition at line 946 of file Array.h.

Referenced by AMP::Array< TYPE, FUN, Allocator >::cloneTo().

◆ data() [1/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE * AMP::Array< TYPE, FUN, Allocator >::data ( )
inline

◆ data() [2/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE * AMP::Array< TYPE, FUN, Allocator >::data ( ) const
inline

Return the pointer to the raw data.

Definition at line 649 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data.

◆ empty()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE bool AMP::Array< TYPE, FUN, Allocator >::empty ( ) const
inline

Return true if the Array is empty.

Definition at line 393 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::length().

◆ end() [1/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE * AMP::Array< TYPE, FUN, Allocator >::end ( )
inline

Get iterator to beginning of data.

Definition at line 634 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::length().

◆ end() [2/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE * AMP::Array< TYPE, FUN, Allocator >::end ( ) const
inline

Get iterator to beginning of data.

Definition at line 637 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::length().

◆ equals()

template<class TYPE , class FUN , class Allocator >
AMP::Array< TYPE, FUN, Allocator >::equals ( const Array< TYPE, FUN, Allocator > &  rhs,
const TYPE &  tol = 0.000001 
) const

Determine if two Arrays are equal using an absolute tolerance.

Parameters
[in]rhsVector to compare to
[in]tolTolerance of comparison
Returns
True iff \(||\mathit{rhs} - x||_\infty < \mathit{tol}\)

◆ fill()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE void AMP::Array< TYPE, FUN, Allocator >::fill ( const TYPE &  y)
inline

Fill the array with the given value

Parameters
yValue to fill

Definition at line 351 of file Array.h.

Referenced by AMP::Materials::FunctionProperty< Args >::eval().

◆ find()

template<class TYPE , class FUN , class Allocator >
std::vector< size_t > AMP::Array< TYPE, FUN, Allocator >::find ( const TYPE &  value,
std::function< bool(const TYPE &, const TYPE &)>  compare 
) const

Find all elements that match the operator.

◆ findFirst()

template<class TYPE , class FUN , class Allocator >
int64_t AMP::Array< TYPE, FUN, Allocator >::findFirst ( const TYPE &  value,
std::function< bool(const TYPE &, const TYPE &)>  compare 
) const

Find all elements that match the operator (if element is not found return -1)

◆ findLast()

template<class TYPE , class FUN , class Allocator >
int64_t AMP::Array< TYPE, FUN, Allocator >::findLast ( const TYPE &  value,
std::function< bool(const TYPE &, const TYPE &)>  compare 
) const

Find all elements that match the operator (if element is not found return -1)

◆ getPtr() [1/2]

template<class TYPE , class FUN , class Allocator >
std::shared_ptr< TYPE > AMP::Array< TYPE, FUN, Allocator >::getPtr ( )
inline

Return the pointer to the raw data.

Definition at line 640 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_ptr.

◆ getPtr() [2/2]

template<class TYPE , class FUN , class Allocator >
std::shared_ptr< const TYPE > AMP::Array< TYPE, FUN, Allocator >::getPtr ( ) const
inline

Return the pointer to the raw data.

Definition at line 643 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_ptr.

◆ getSubsetArrays()

template<class TYPE , class FUN , class Allocator >
static void AMP::Array< TYPE, FUN, Allocator >::getSubsetArrays ( const std::vector< Range< size_t > > &  range,
std::array< size_t, 5 > &  first,
std::array< size_t, 5 > &  last,
std::array< size_t, 5 > &  inc,
std::array< size_t, 5 > &  N 
)
inlinestaticprivate

◆ interp() [1/2]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::interp ( const double *  x) const

Linear interpolation

Parameters
[in]xPosition as a decimal index

◆ interp() [2/2]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::interp ( const std::vector< double > &  x) const
inline

Linear interpolation

Parameters
[in]xPosition as a decimal index

Definition at line 794 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::interp().

Referenced by AMP::Array< TYPE, FUN, Allocator >::interp().

◆ isCopyable()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE bool AMP::Array< TYPE, FUN, Allocator >::isCopyable ( ) const
inline

◆ isFixedSize()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE bool AMP::Array< TYPE, FUN, Allocator >::isFixedSize ( ) const
inline

◆ length()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE size_t AMP::Array< TYPE, FUN, Allocator >::length ( ) const
inline

Return the size of the Array.

Definition at line 389 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::length().

Referenced by AMP::Materials::FunctionProperty< Args >::eval().

◆ max() [1/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::max ( ) const

Return the largest value.

◆ max() [2/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::max ( const std::vector< Range< size_t > > &  index) const

Return the largest value.

◆ max() [3/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::max ( const std::vector< size_t > &  index) const

Return the largest value.

◆ max() [4/4]

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::max ( int  dir) const

Return the max of all elements in a given direction.

◆ mean() [1/3]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::mean ( ) const

Return the mean of all elements.

◆ mean() [2/3]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::mean ( const std::vector< Range< size_t > > &  index) const

Return the mean of all elements.

◆ mean() [3/3]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::mean ( const std::vector< size_t > &  index) const

Return the mean of all elements.

◆ min() [1/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::min ( ) const

Return the smallest value.

◆ min() [2/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::min ( const std::vector< Range< size_t > > &  index) const

Return the smallest value.

◆ min() [3/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::min ( const std::vector< size_t > &  index) const

Return the smallest value.

◆ min() [4/4]

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::min ( int  dir) const

Return the min of all elements in a given direction.

◆ NaNs()

template<class TYPE , class FUN , class Allocator >
bool AMP::Array< TYPE, FUN, Allocator >::NaNs ( ) const

Return true if NaNs are present.

◆ ndim()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE int AMP::Array< TYPE, FUN, Allocator >::ndim ( ) const
inline

◆ operator bool()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE AMP::Array< TYPE, FUN, Allocator >::operator bool ( ) const
inline

Return true if the Array is not empty.

Definition at line 397 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::length().

◆ operator!=()

template<class TYPE , class FUN , class Allocator >
bool AMP::Array< TYPE, FUN, Allocator >::operator!= ( const Array< TYPE, FUN, Allocator > &  rhs) const

Check if two matrices are not equal.

◆ operator()() [1/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i)
inline

Access the desired element

Parameters
iThe row index

Definition at line 501 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [2/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i) const
inline

Access the desired element

Parameters
iThe row index

Definition at line 507 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [3/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i,
size_t  j 
)
inline

Access the desired element

Parameters
iThe row index
jThe column index

Definition at line 514 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [4/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i,
size_t  j 
) const
inline

Access the desired element

Parameters
iThe row index
jThe column index

Definition at line 521 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [5/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i,
size_t  j,
size_t  k 
)
inline

Access the desired element

Parameters
iThe row index
jThe column index
kThe third index

Definition at line 532 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [6/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i,
size_t  j,
size_t  k 
) const
inline

Access the desired element

Parameters
iThe row index
jThe column index
kThe third index

Definition at line 543 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [7/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4 
)
inline

Access the desired element

Parameters
i1The first index
i2The second index
i3The third index
i4The fourth index

Definition at line 555 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [8/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4 
) const
inline

Access the desired element

Parameters
i1The first index
i2The second index
i3The third index
i4The fourth index

Definition at line 567 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [9/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5 
)
inline

Access the desired element

Parameters
i1The first index
i2The second index
i3The third index
i4The fourth index
i5The fifth index

Definition at line 580 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator()() [10/10]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE & AMP::Array< TYPE, FUN, Allocator >::operator() ( size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5 
) const
inline

Access the desired element

Parameters
i1The first index
i2The second index
i3The third index
i4The fourth index
i5The fifth index

Definition at line 594 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::index().

◆ operator+=() [1/2]

template<class TYPE , class FUN , class Allocator >
Array & AMP::Array< TYPE, FUN, Allocator >::operator+= ( const Array< TYPE, FUN, Allocator > &  rhs)

Add another array.

◆ operator+=() [2/2]

template<class TYPE , class FUN , class Allocator >
Array & AMP::Array< TYPE, FUN, Allocator >::operator+= ( const TYPE &  rhs)

Add a scalar.

◆ operator-=() [1/2]

template<class TYPE , class FUN , class Allocator >
Array & AMP::Array< TYPE, FUN, Allocator >::operator-= ( const Array< TYPE, FUN, Allocator > &  rhs)

Subtract another array.

◆ operator-=() [2/2]

template<class TYPE , class FUN , class Allocator >
Array & AMP::Array< TYPE, FUN, Allocator >::operator-= ( const TYPE &  rhs)

Subtract a scalar.

◆ operator=() [1/3]

template<class TYPE , class FUN , class Allocator >
Array & AMP::Array< TYPE, FUN, Allocator >::operator= ( Array< TYPE, FUN, Allocator > &&  rhs)

Move assignment operator

Parameters
rhsArray to copy

◆ operator=() [2/3]

template<class TYPE , class FUN , class Allocator >
Array & AMP::Array< TYPE, FUN, Allocator >::operator= ( const Array< TYPE, FUN, Allocator > &  rhs)

Assignment operator

Parameters
rhsArray to copy

◆ operator=() [3/3]

template<class TYPE , class FUN , class Allocator >
Array & AMP::Array< TYPE, FUN, Allocator >::operator= ( const std::vector< TYPE > &  rhs)

Assignment operator

Parameters
rhsstd::vector to copy

◆ operator==()

template<class TYPE , class FUN , class Allocator >
bool AMP::Array< TYPE, FUN, Allocator >::operator== ( const Array< TYPE, FUN, Allocator > &  rhs) const

Check if two matrices are equal.

◆ operator[]() [1/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE & AMP::Array< TYPE, FUN, Allocator >::operator[] ( size_t  i)
inline

Access the desired element

Parameters
iThe element index

Definition at line 603 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data.

◆ operator[]() [2/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE & AMP::Array< TYPE, FUN, Allocator >::operator[] ( size_t  i) const
inline

Access the desired element

Parameters
iThe element index

Definition at line 609 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data.

◆ pack()

template<class TYPE , class FUN , class Allocator >
size_t AMP::Array< TYPE, FUN, Allocator >::pack ( std::byte *  ) const

Pack the data to a buffer.

◆ packSize()

template<class TYPE , class FUN , class Allocator >
size_t AMP::Array< TYPE, FUN, Allocator >::packSize ( ) const

Return the number of bytes required to pack the data.

◆ pow()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::pow ( const Array< TYPE, FUN, Allocator > &  base,
const TYPE &  exp 
)

Set the values of this array to pow(base, exp)

Parameters
baseBase array
expExponent value

◆ print()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::print ( std::ostream &  os,
const std::string &  name = "A",
const std::string &  prefix = "" 
) const

Print an array.

◆ ptr() [1/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE TYPE * AMP::Array< TYPE, FUN, Allocator >::ptr ( size_t  i)
inline

Access the desired element as a raw pointer

Parameters
iThe global index

Definition at line 616 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::length().

Referenced by AMP::Array< TYPE, FUN, Allocator >::reinterpretArray().

◆ ptr() [2/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const TYPE * AMP::Array< TYPE, FUN, Allocator >::ptr ( size_t  i) const
inline

Access the desired element as a raw pointer

Parameters
iThe global index

Definition at line 622 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_size, and AMP::ArraySize::length().

◆ rand()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::rand ( )

Initialize the array with random values (defined from the function table)

◆ reinterpretArray()

template<class TYPE , class FUN , class Allocator >
template<class TYPE2 >
auto AMP::Array< TYPE, FUN, Allocator >::reinterpretArray ( ) const
inline

◆ repmat()

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::repmat ( const ArraySize N) const

Replicate an array a given number of times in each direction.

◆ reshape()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::reshape ( const ArraySize N)

Reshape the Array (total size of array will not change)

Parameters
NNumber of elements in each dimension

◆ resize() [1/4]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::resize ( const ArraySize N)

Resize the Array

Parameters
NNumber of elements in each dimension

◆ resize() [2/4]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::resize ( size_t  N)

Resize the Array

Parameters
NNumber of elements

Referenced by AMP::Array< TYPE, FUN, Allocator >::copy().

◆ resize() [3/4]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::resize ( size_t  N1,
size_t  N2,
size_t  N3 
)

Resize the Array

Parameters
N1Number of rows
N2Number of columns
N3Number of elements in the third dimension

◆ resize() [4/4]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::resize ( size_t  N_row,
size_t  N_col 
)

Resize the Array

Parameters
N_rowNumber of rows
N_colNumber of columns

◆ resizeDim()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::resizeDim ( int  dim,
size_t  N,
const TYPE &  value 
)

Resize the given dimension of the array

Parameters
dimThe dimension to resize
NNumber of elements for the given dimension
valueValue to initialize new elements

◆ reverseDim()

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::reverseDim ( ) const

Transpose an array.

◆ scale()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::scale ( const TYPE &  y)

Scale the array by the given value

Parameters
yValue to scale by

◆ setCopyable()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE void AMP::Array< TYPE, FUN, Allocator >::setCopyable ( bool  flag)
inline

Set is copyable.

Definition at line 150 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_isCopyable.

◆ setFixedSize()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE void AMP::Array< TYPE, FUN, Allocator >::setFixedSize ( bool  flag)
inline

Set is copyable.

Definition at line 156 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_isFixedSize.

◆ setNdim()

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE void AMP::Array< TYPE, FUN, Allocator >::setNdim ( int  ndim)
inline

Reshape the Array so that the number of dimensions is the max of ndim and the largest dim>1.

Parameters
ndimDesired number of dimensions

Definition at line 450 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_size, AMP::Array< TYPE, FUN, Allocator >::ndim(), and AMP::ArraySize::setNdim().

◆ size() [1/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE const ArraySize & AMP::Array< TYPE, FUN, Allocator >::size ( ) const
inline

◆ size() [2/2]

template<class TYPE , class FUN , class Allocator >
ARRAY_INLINE size_t AMP::Array< TYPE, FUN, Allocator >::size ( int  d) const
inline

Return the size of the Array.

Definition at line 385 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_size.

◆ staticView()

template<class TYPE , class FUN , class Allocator >
static Array AMP::Array< TYPE, FUN, Allocator >::staticView ( const ArraySize N,
TYPE *  data 
)
inlinestatic

Create an array view of the given data (expert use only). Use view2( N, shared_ptr(data,[](TYPE*){}) ) instead. Note: this interface is not recommended as it does not protect from the src data being deleted while still being used by the Array. Additionally for maximum performance it does not set the internal shared_ptr so functions like getPtr and resize will not work correctly.

Parameters
NNumber of elements in each dimension
dataPointer to the data

Definition at line 248 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::data(), and AMP::Array< TYPE, FUN, Allocator >::viewRaw().

◆ subset() [1/2]

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::subset ( const std::vector< Range< size_t > > &  index) const

Subset the Array

Parameters
indexIndex to subset (ix:kx:jx,iy:ky:jy,...)

◆ subset() [2/2]

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::subset ( const std::vector< size_t > &  index) const

Subset the Array

Parameters
indexIndex to subset (imin,imax,jmin,jmax,kmin,kmax,...)

◆ sum() [1/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::sum ( ) const

Return the sum of all elements.

◆ sum() [2/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::sum ( const std::vector< Range< size_t > > &  index) const

Return the sum of all elements.

◆ sum() [3/4]

template<class TYPE , class FUN , class Allocator >
TYPE AMP::Array< TYPE, FUN, Allocator >::sum ( const std::vector< size_t > &  index) const

Return the sum of all elements.

◆ sum() [4/4]

template<class TYPE , class FUN , class Allocator >
Array AMP::Array< TYPE, FUN, Allocator >::sum ( int  dir) const

Return the sum of all elements in a given direction.

◆ swap()

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::swap ( Array< TYPE, FUN, Allocator > &  other)

swap the raw data pointers for the Arrays after checking for compatibility

◆ transform() [1/2]

template<class TYPE , class FUN , class Allocator >
static Array AMP::Array< TYPE, FUN, Allocator >::transform ( std::function< TYPE(const TYPE &)>  fun,
const Array< TYPE, FUN, Allocator > &  x 
)
static

Perform a element-wise operation y = f(x)

Parameters
[in]funThe function operation
[in]xThe input array

◆ transform() [2/2]

template<class TYPE , class FUN , class Allocator >
static Array AMP::Array< TYPE, FUN, Allocator >::transform ( std::function< TYPE(const TYPE &, const TYPE &)>  fun,
const Array< TYPE, FUN, Allocator > &  x,
const Array< TYPE, FUN, Allocator > &  y 
)
static

Perform a element-wise operation z = f(x,y)

Parameters
[in]funThe function operation
[in]xThe first array
[in]yThe second array

◆ unpack()

template<class TYPE , class FUN , class Allocator >
size_t AMP::Array< TYPE, FUN, Allocator >::unpack ( const std::byte *  )

Unpack the data from a buffer.

◆ view() [1/2]

template<class TYPE , class FUN , class Allocator >
Array< TYPE, FUN, Allocator > AMP::Array< TYPE, FUN, Allocator >::view ( )

Create an Array view to this array

◆ view() [2/2]

template<class TYPE , class FUN , class Allocator >
static std::unique_ptr< Array > AMP::Array< TYPE, FUN, Allocator >::view ( const ArraySize N,
std::shared_ptr< TYPE >  data 
)
static

Create a multi-dimensional Array view to a raw block of data

Parameters
NNumber of elements in each dimension
dataPointer to the data

◆ view2() [1/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::view2 ( Array< TYPE, FUN, Allocator > &  src)

Make this object a view of the src

Parameters
srcSource vector to take the view of

Referenced by AMP::Array< TYPE, FUN, Allocator >::reinterpretArray().

◆ view2() [2/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::view2 ( const ArraySize N,
std::shared_ptr< TYPE >  data 
)

Make this object a view of the data

Parameters
NNumber of elements in each dimension
dataPointer to the data

◆ viewRaw() [1/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::viewRaw ( const ArraySize N,
TYPE *  data,
bool  isCopyable = true,
bool  isFixedSize = true 
)
inline

Make this object a view of the raw data (expert use only). Use view2( N, shared_ptr(data,[](TYPE*){}) ) instead. Note: this interface is not recommended as it does not protect from the src data being deleted while still being used by the Array. Additionally for maximum performance it does not set the internal shared_ptr so functions like getPtr and resize will not work correctly.

Parameters
NNumber of elements in each dimension
dataPointer to the data
isCopyableOnce the view is created, can the array be copied
isFixedSizeOnce the view is created, is the array size fixed

Definition at line 229 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::d_data, AMP::Array< TYPE, FUN, Allocator >::d_isCopyable, AMP::Array< TYPE, FUN, Allocator >::d_isFixedSize, AMP::Array< TYPE, FUN, Allocator >::d_ptr, AMP::Array< TYPE, FUN, Allocator >::d_size, AMP::Array< TYPE, FUN, Allocator >::data(), AMP::Array< TYPE, FUN, Allocator >::isCopyable(), and AMP::Array< TYPE, FUN, Allocator >::isFixedSize().

◆ viewRaw() [2/2]

template<class TYPE , class FUN , class Allocator >
void AMP::Array< TYPE, FUN, Allocator >::viewRaw ( int  ndim,
const size_t *  dims,
TYPE *  data,
bool  isCopyable = true,
bool  isFixedSize = true 
)
inline

Make this object a view of the raw data (expert use only). Use view2( N, shared_ptr(data,[](TYPE*){}) ) instead. Note: this interface is not recommended as it does not protect from the src data being deleted while still being used by the Array. Additionally for maximum performance it does not set the internal shared_ptr so functions like getPtr and resize will not work correctly.

Parameters
ndimNumber of dimensions
dimsNumber of elements in each dimension
dataPointer to the data
isCopyableOnce the view is created, can the array be copied
isFixedSizeOnce the view is created, is the array size fixed

Definition at line 211 of file Array.h.

References AMP::Array< TYPE, FUN, Allocator >::data(), AMP::Array< TYPE, FUN, Allocator >::isCopyable(), AMP::Array< TYPE, FUN, Allocator >::isFixedSize(), AMP::Array< TYPE, FUN, Allocator >::ndim(), and AMP::Array< TYPE, FUN, Allocator >::viewRaw().

Referenced by AMP::operator*(), AMP::Array< TYPE, FUN, Allocator >::staticView(), and AMP::Array< TYPE, FUN, Allocator >::viewRaw().

Member Data Documentation

◆ d_alloc

template<class TYPE , class FUN , class Allocator >
scalarAllocator_t AMP::Array< TYPE, FUN, Allocator >::d_alloc
private

Definition at line 820 of file Array.h.

◆ d_data

template<class TYPE , class FUN , class Allocator >
TYPE* AMP::Array< TYPE, FUN, Allocator >::d_data
private

◆ d_isCopyable

template<class TYPE , class FUN , class Allocator >
bool AMP::Array< TYPE, FUN, Allocator >::d_isCopyable
private

◆ d_isFixedSize

template<class TYPE , class FUN , class Allocator >
bool AMP::Array< TYPE, FUN, Allocator >::d_isFixedSize
private

◆ d_ptr

template<class TYPE , class FUN , class Allocator >
std::shared_ptr<TYPE> AMP::Array< TYPE, FUN, Allocator >::d_ptr
private

◆ d_size

template<class TYPE , class FUN , class Allocator >
ArraySize AMP::Array< TYPE, FUN, Allocator >::d_size
private

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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page