AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
A simple statically sized array of data with component-wise operators. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.9.1/src/axom/primal/geometry/NumericArray.hpp>
Public Member Functions | |
AXOM_SUPPRESS_HD_WARN AXOM_HOST_DEVICE | NumericArray (T val=T(), int sz=SIZE) |
Fill the first sz coordinates with val and zeros the rest. More... | |
AXOM_SUPPRESS_HD_WARN AXOM_HOST_DEVICE | NumericArray (const T *vals, int sz=SIZE) |
Creates a numeric array from the first sz values of the input array. More... | |
NumericArray (std::initializer_list< T > values) | |
Creates a numeric array from an initializer list. More... | |
AXOM_HOST_DEVICE const T & | operator[] (int i) const |
Access operator for individual components. More... | |
AXOM_HOST_DEVICE T & | operator[] (int i) |
AXOM_HOST_DEVICE const T * | data () const |
Returns a pointer to the underlying data. More... | |
AXOM_HOST_DEVICE T * | data () |
AXOM_HOST_DEVICE void | to_array (T *arr) const |
Copy the coordinate data to the provided array. More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of a numeric array instance. More... | |
AXOM_HOST_DEVICE NumericArray & | operator+= (const NumericArray &arr) |
Component-wise addition assignment operator. More... | |
AXOM_HOST_DEVICE NumericArray & | operator-= (const NumericArray &arr) |
Component-wise subtraction assignment operator. More... | |
AXOM_HOST_DEVICE NumericArray & | operator*= (double scalar) |
Scalar multiplication on the NumericArray instance. More... | |
AXOM_HOST_DEVICE NumericArray & | operator/= (double scalar) |
Scalar division on the NumericArray instance. More... | |
AXOM_HOST_DEVICE NumericArray & | operator*= (const NumericArray &arr) |
Component-wise multiplication assignment operator. More... | |
NumericArray & | operator/= (const NumericArray &arr) |
Component-wise division assignment operator. More... | |
NumericArray & | clampUpper (const T &upperVal) |
Ensures that the highest value of the coordinates is at most upperVal. More... | |
NumericArray & | clampLower (const T &lowerVal) |
Ensures that the lowest value of the coordinates is at least lowerVal. More... | |
NumericArray & | clamp (const T &lowerVal, const T &upperVal) |
Ensures that each coordinate's value is in range [lowerVal,upperVal]. More... | |
T | max () const |
Find the max component. More... | |
T | min () const |
Find the min component. More... | |
int | argMax () const |
Find the index of the max component. More... | |
int | argMin () const |
Find the index of the min component. More... | |
T | sum () const |
Computes the sum of the components. More... | |
Static Public Member Functions | |
static int | size () |
Returns the dimension of this numeric array instance. More... | |
Protected Attributes | |
T | m_components [SIZE] |
A simple statically sized array of data with component-wise operators.
T | the numeric type of the elements in the array, e.g., float, double. |
SIZE | the size of the array |
|
explicit |
Fill the first sz coordinates with val and zeros the rest.
[in] | val | The value to set the coordinates to. Defaults to zero. |
[in] | sz | The number of components to set to val. The rest will be set to zero. Defaults is SIZE. If sz is greater than SIZE, we set all coordinates to val |
References axom::utilities::clampVal(), and SLIC_ASSERT.
|
explicit |
Creates a numeric array from the first sz values of the input array.
[in] | vals | An array containing at least sz values |
[in] | sz | number of coordinates. Defaults to SIZE. |
References axom::utilities::clampVal(), and SLIC_ASSERT.
|
inline |
Creates a numeric array from an initializer list.
[in] | values | an initializer list containing the values of the array. If the size is not the same as the size of this array, this behaves the same way as the constructor which takes a pointer and size. |
|
inlinestatic |
Returns the dimension of this numeric array instance.
|
inline |
Access operator for individual components.
[in] | i | the component index to access |
|
inline |
|
inline |
Returns a pointer to the underlying data.
|
inline |
AXOM_HOST_DEVICE void axom::primal::NumericArray< T, SIZE >::to_array | ( | T * | arr | ) | const |
Copy the coordinate data to the provided array.
[in] | arr | The array to which we are copying. |
References SLIC_ASSERT.
std::ostream & axom::primal::NumericArray< T, SIZE >::print | ( | std::ostream & | os | ) | const |
Simple formatted print of a numeric array instance.
os | The output stream to write to |
|
inline |
Component-wise addition assignment operator.
[in] | arr | the array to add. Adds the numeric array arr to this instance (component-wise). |
|
inline |
Component-wise subtraction assignment operator.
[in] | arr | the array to subtract. Subtracts the numeric array arr from this instance (component-wise). |
|
inline |
Scalar multiplication on the NumericArray instance.
[in] | scalar | the scalar value with which to multiply. Each element of the numeric array is multiplied by scalar |
|
inline |
Scalar division on the NumericArray instance.
[in] | scalar | the scalar value with which to divide . |
References SLIC_ASSERT.
|
inline |
Component-wise multiplication assignment operator.
[in] | arr | the array to multiply (component-wise). Multiplies the numeric array arr with this instance (component-wise). |
|
inline |
Component-wise division assignment operator.
[in] | arr | the array to divide (component-wise). Divides the numeric array arr with this instance (component-wise). |
References SLIC_ASSERT.
|
inline |
Ensures that the highest value of the coordinates is at most upperVal.
[in] | upperVal | The highest possible value |
References axom::utilities::min().
|
inline |
Ensures that the lowest value of the coordinates is at least lowerVal.
[in] | lowerVal | The lowest possible value |
References axom::utilities::max().
|
inline |
Ensures that each coordinate's value is in range [lowerVal,upperVal].
[in] | lowerVal | The lowest possible value |
[in] | upperVal | The highest possible value |
References axom::utilities::clampVal(), and SLIC_ASSERT.
|
inline |
Find the max component.
|
inline |
Find the min component.
|
inline |
Find the index of the max component.
|
inline |
Find the index of the min component.
|
inline |
Computes the sum of the components.
|
protected |