Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
AMP::ArraySize Class Referencefinal

Simple class to store the array dimensions. More...

#include <ArraySize.h>

Public Member Functions

constexpr bool approxEqual (const ArraySize &rhs) const
 
constexpr ArraySize ()
 Empty constructor.
 
template<std::size_t NDIM>
constexpr ArraySize (const std::array< size_t, NDIM > &N)
 
 ArraySize (const std::vector< size_t > &N)
 
constexpr ArraySize (size_t N1)
 
constexpr ArraySize (size_t N1, size_t N2)
 
constexpr ArraySize (size_t N1, size_t N2, size_t N3)
 
constexpr ArraySize (size_t N1, size_t N2, size_t N3, size_t N4)
 
constexpr ArraySize (size_t N1, size_t N2, size_t N3, size_t N4, size_t N5)
 
constexpr ArraySize (size_t ndim, const size_t *dims)
 
template<class TYPE >
constexpr ArraySize (std::initializer_list< TYPE > N, int ndim=-1)
 
constexpr const size_t * begin () const
 Returns an iterator to the beginning.
 
constexpr const size_t * end () const
 Returns an iterator to the end.
 
constexpr std::array< size_t, 5 > ijk (size_t index) const
 Convert the index to ijk values.
 
constexpr void ijk (size_t index, size_t *x) const
 Convert the index to ijk values.
 
constexpr size_t index (const std::array< size_t, 5 > &i) const
 Get the index.
 
constexpr size_t index (size_t i) const
 Get the index.
 
constexpr size_t index (size_t i1, size_t i2) const
 Get the index.
 
constexpr size_t index (size_t i1, size_t i2, size_t i3) const
 Get the index.
 
constexpr size_t index (size_t i1, size_t i2, size_t i3, size_t i4) const
 Get the index.
 
constexpr size_t index (size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) const
 Get the index.
 
constexpr size_t index (std::initializer_list< size_t > i) const
 Get the index.
 
constexpr size_t length () const
 Return the total number of elements in the array.
 
constexpr uint8_t ndim () const
 Return the number of dimensions.
 
constexpr bool operator!= (const ArraySize &rhs) const
 Check if two matrices are not equal.
 
constexpr bool operator== (const ArraySize &rhs) const
 
constexpr size_t operator[] (size_t i) const
 
constexpr void resize (uint8_t dim, size_t N)
 Resize the dimension.
 
constexpr void setNdim (uint8_t ndim)
 
constexpr size_t size () const
 Return the number of dimensions.
 

Static Public Member Functions

static constexpr uint8_t maxDim ()
 Maximum supported dimension.
 

Private Attributes

size_t d_length
 
size_t d_N [5]
 
uint8_t d_ndim
 

Detailed Description

Simple class to store the array dimensions.

Definition at line 137 of file ArraySize.h.

Constructor & Destructor Documentation

◆ ArraySize() [1/10]

constexpr AMP::ArraySize::ArraySize ( )
inlineconstexpr

Empty constructor.

Definition at line 141 of file ArraySize.h.

◆ ArraySize() [2/10]

constexpr AMP::ArraySize::ArraySize ( size_t  N1)
inlineconstexpr

Create the vector size

Parameters
N1Number of elements in the first dimension

Definition at line 147 of file ArraySize.h.

◆ ArraySize() [3/10]

constexpr AMP::ArraySize::ArraySize ( size_t  N1,
size_t  N2 
)
inlineconstexpr

Create the vector size

Parameters
N1Number of elements in the first dimension
N2Number of elements in the second dimension

Definition at line 154 of file ArraySize.h.

◆ ArraySize() [4/10]

constexpr AMP::ArraySize::ArraySize ( size_t  N1,
size_t  N2,
size_t  N3 
)
inlineconstexpr

Create the vector size

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

Definition at line 165 of file ArraySize.h.

◆ ArraySize() [5/10]

constexpr AMP::ArraySize::ArraySize ( size_t  N1,
size_t  N2,
size_t  N3,
size_t  N4 
)
inlineconstexpr

Create the vector size

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

Definition at line 177 of file ArraySize.h.

◆ ArraySize() [6/10]

constexpr AMP::ArraySize::ArraySize ( size_t  N1,
size_t  N2,
size_t  N3,
size_t  N4,
size_t  N5 
)
inlineconstexpr

Create the vector size

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 dimeARRAY_INSISTnsion
N5Number of elements in the fifth dimension

Definition at line 190 of file ArraySize.h.

◆ ArraySize() [7/10]

template<class TYPE >
constexpr AMP::ArraySize::ArraySize ( std::initializer_list< TYPE >  N,
int  ndim = -1 
)
inlineconstexpr

Create from initializer list

Parameters
NSize of the array
ndimNumber of dimensions

Definition at line 201 of file ArraySize.h.

References ARRAY_INSIST, d_length, d_N, d_ndim, maxDim(), and ndim().

◆ ArraySize() [8/10]

constexpr AMP::ArraySize::ArraySize ( size_t  ndim,
const size_t *  dims 
)
inlineconstexpr

Create from raw pointer

Parameters
ndimNumber of dimensions
dimsDimensions

Definition at line 230 of file ArraySize.h.

References ARRAY_INSIST, d_length, d_N, d_ndim, maxDim(), and ndim().

◆ ArraySize() [9/10]

template<std::size_t NDIM>
constexpr AMP::ArraySize::ArraySize ( const std::array< size_t, NDIM > &  N)
inlineconstexpr

Create from std::array

Parameters
NSize of the array

Definition at line 248 of file ArraySize.h.

◆ ArraySize() [10/10]

AMP::ArraySize::ArraySize ( const std::vector< size_t > &  N)
inline

Create from std::vector

Parameters
NSize of the array

Definition at line 256 of file ArraySize.h.

Member Function Documentation

◆ approxEqual()

constexpr bool AMP::ArraySize::approxEqual ( const ArraySize rhs) const
inlineconstexpr

Definition at line 304 of file ArraySize.h.

References d_N, and length().

◆ begin()

constexpr const size_t * AMP::ArraySize::begin ( ) const
inlineconstexpr

Returns an iterator to the beginning.

Definition at line 291 of file ArraySize.h.

References d_N.

◆ end()

constexpr const size_t * AMP::ArraySize::end ( ) const
inlineconstexpr

Returns an iterator to the end.

Definition at line 294 of file ArraySize.h.

References d_N, and d_ndim.

◆ ijk() [1/2]

constexpr std::array< size_t, 5 > AMP::ArraySize::ijk ( size_t  index) const
inlineconstexpr

Convert the index to ijk values.

Definition at line 379 of file ArraySize.h.

References CHECK_ARRAY_LENGTH, d_length, d_N, and index().

◆ ijk() [2/2]

constexpr void AMP::ArraySize::ijk ( size_t  index,
size_t *  x 
) const
inlineconstexpr

Convert the index to ijk values.

Definition at line 394 of file ArraySize.h.

References CHECK_ARRAY_LENGTH, d_length, d_N, and index().

◆ index() [1/7]

constexpr size_t AMP::ArraySize::index ( const std::array< size_t, 5 > &  i) const
inlineconstexpr

Get the index.

Definition at line 355 of file ArraySize.h.

References d_N.

◆ index() [2/7]

constexpr size_t AMP::ArraySize::index ( size_t  i) const
inlineconstexpr

◆ index() [3/7]

constexpr size_t AMP::ArraySize::index ( size_t  i1,
size_t  i2 
) const
inlineconstexpr

Get the index.

Definition at line 323 of file ArraySize.h.

References CHECK_ARRAY_LENGTH, d_length, d_N, and index().

◆ index() [4/7]

constexpr size_t AMP::ArraySize::index ( size_t  i1,
size_t  i2,
size_t  i3 
) const
inlineconstexpr

Get the index.

Definition at line 331 of file ArraySize.h.

References CHECK_ARRAY_LENGTH, d_length, d_N, and index().

◆ index() [5/7]

constexpr size_t AMP::ArraySize::index ( size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4 
) const
inlineconstexpr

Get the index.

Definition at line 339 of file ArraySize.h.

References CHECK_ARRAY_LENGTH, d_length, d_N, and index().

◆ index() [6/7]

constexpr size_t AMP::ArraySize::index ( size_t  i1,
size_t  i2,
size_t  i3,
size_t  i4,
size_t  i5 
) const
inlineconstexpr

Get the index.

Definition at line 347 of file ArraySize.h.

References CHECK_ARRAY_LENGTH, d_length, d_N, and index().

◆ index() [7/7]

constexpr size_t AMP::ArraySize::index ( std::initializer_list< size_t >  i) const
inlineconstexpr

Get the index.

Definition at line 366 of file ArraySize.h.

References d_N.

◆ length()

constexpr size_t AMP::ArraySize::length ( ) const
inlineconstexpr

◆ maxDim()

static constexpr uint8_t AMP::ArraySize::maxDim ( )
inlinestaticconstexpr

Maximum supported dimension.

Definition at line 313 of file ArraySize.h.

Referenced by ArraySize(), ArraySize(), AMP::cat(), and AMP::squeeze().

◆ ndim()

constexpr uint8_t AMP::ArraySize::ndim ( ) const
inlineconstexpr

◆ operator!=()

constexpr bool AMP::ArraySize::operator!= ( const ArraySize rhs) const
inlineconstexpr

Check if two matrices are not equal.

Definition at line 310 of file ArraySize.h.

References operator==().

◆ operator==()

constexpr bool AMP::ArraySize::operator== ( const ArraySize rhs) const
inlineconstexpr

Definition at line 297 of file ArraySize.h.

References d_N, and d_ndim.

Referenced by operator!=().

◆ operator[]()

constexpr size_t AMP::ArraySize::operator[] ( size_t  i) const
inlineconstexpr

Access the ith dimension

Parameters
iIndex to access

Definition at line 262 of file ArraySize.h.

References d_N.

◆ resize()

constexpr void AMP::ArraySize::resize ( uint8_t  dim,
size_t  N 
)
inlineconstexpr

Resize the dimension.

Definition at line 274 of file ArraySize.h.

References ARRAY_INSIST, d_length, d_N, and d_ndim.

◆ setNdim()

constexpr void AMP::ArraySize::setNdim ( uint8_t  ndim)
inlineconstexpr

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 288 of file ArraySize.h.

References d_ndim, and ndim().

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

◆ size()

constexpr size_t AMP::ArraySize::size ( ) const
inlineconstexpr

Return the number of dimensions.

Definition at line 268 of file ArraySize.h.

References d_ndim.

Member Data Documentation

◆ d_length

size_t AMP::ArraySize::d_length
private

Definition at line 410 of file ArraySize.h.

Referenced by ArraySize(), ArraySize(), ijk(), ijk(), index(), index(), index(), index(), index(), length(), and resize().

◆ d_N

size_t AMP::ArraySize::d_N[5]
private

◆ d_ndim

uint8_t AMP::ArraySize::d_ndim
private

Definition at line 409 of file ArraySize.h.

Referenced by ArraySize(), ArraySize(), end(), ndim(), operator==(), resize(), setNdim(), and size().


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