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.3.3/src/axom/primal/geometry/NumericArray.hpp>
Public Types | |
enum | { NBYTES = SIZE*sizeof(T) } |
Public Member Functions | |
NumericArray (T val=T(), int sz=SIZE) | |
Fill the first sz coordinates with val and zeros the rest. More... | |
NumericArray (const T *vals, int sz=SIZE) | |
Creates a numeric array from the first sz values of the input array. More... | |
NumericArray (const NumericArray &other) | |
Copy constructor. More... | |
~NumericArray () | |
Destructor. More... | |
NumericArray & | operator= (const NumericArray &rhs) |
Assignment operator. More... | |
const T & | operator[] (int i) const |
Access operator for individual components. More... | |
T & | operator[] (int i) |
const T * | data () const |
Returns a pointer to the underlying data. More... | |
T * | data () |
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... | |
NumericArray< T, SIZE > & | operator+= (const NumericArray< T, SIZE > &arr) |
Component-wise addition assignment operator. More... | |
NumericArray< T, SIZE > & | operator-= (const NumericArray< T, SIZE > &arr) |
Component-wise subtraction assignment operator. More... | |
NumericArray< T, SIZE > & | operator*= (double scalar) |
Scalar multiplication on the NumericArray instance. More... | |
NumericArray< T, SIZE > & | operator/= (double scalar) |
Scalar division on the NumericArray instance. More... | |
NumericArray< T, SIZE > & | operator*= (const NumericArray< T, SIZE > &arr) |
Component-wise multiplication assignment operator. More... | |
NumericArray< T, SIZE > & | operator/= (const NumericArray< T, SIZE > &arr) |
Component-wise division assignment operator. More... | |
NumericArray< T, SIZE > & | clampUpper (const T &upperVal) |
Ensures that the highest value of the coordinates is at most upperVal. More... | |
NumericArray< T, SIZE > & | clampLower (const T &lowerVal) |
Ensures that the lowest value of the coordinates is at least lowerVal. More... | |
NumericArray< T, SIZE > & | 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... | |
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 |
axom::primal::NumericArray< T, SIZE >::NumericArray | ( | const T * | vals, |
int | sz = SIZE |
||
) |
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. |
|
inline |
Copy constructor.
[in] | other | The numeric array to copy |
|
inline |
Destructor.
|
inlinestatic |
Returns the dimension of this numeric array instance.
|
inline |
Assignment operator.
[in] | rhs | a numeric array instance on the right hand side. |
|
inline |
Access operator for individual components.
[in] | i | the component index to access |
|
inline |
|
inline |
Returns a pointer to the underlying data.
Referenced by axom::primal::Point< IndexType, NDIMS >::data(), and axom::primal::Vector< SpaceCoordType, NDIMS >::data().
|
inline |
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. |
Referenced by axom::primal::Point< IndexType, NDIMS >::to_array().
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 . |
|
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). |
|
inline |
Ensures that the highest value of the coordinates is at most upperVal.
[in] | upperVal | The highest possible value |
|
inline |
Ensures that the lowest value of the coordinates is at least lowerVal.
[in] | lowerVal | The lowest possible value |
|
inline |
Ensures that each coordinate's value is in range [lowerVal,upperVal].
[in] | lowerVal | The lowest possible value |
[in] | upperVal | The highest possible value |
|
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.
|
protected |
Referenced by axom::primal::NumericArray< IndexType, NDIMS >::operator=().