AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom Namespace Reference

Namespaces

 ArrayOptions
 
 detail
 
 experimental
 
 inlet
 
 klee
 
 lumberjack
 
 mint
 
 multimat
 
 numerics
 
 primal
 
 quest
 
 runtime_policy
 
 sidre
 
 slam
 
 slic
 
 sol
 
 spin
 
 utilities
 

Classes

class  Array
 Provides a generic multidimensional array container. More...
 
class  ArrayBase
 
class  ArrayBase< T, 1, ArrayType >
 Array implementation specific to 1D Arrays. More...
 
class  ArrayIteratorBase
 An iterator type for Array-like types. Each increment operation advances the iterator to the next element in the Array-like. More...
 
class  ArrayView
 Provides a view over a generic array container. More...
 
class  FlatMap
 Provides a generic associative key-value container. More...
 
class  IteratorBase
 Base class for a random access iterator over positions in a set. More...
 
class  Path
 Path class for performing basic path operations with a user-selectable delimiter character. More...
 
class  StackArray
 Provides a wrapper for a compile time sized array, similar to std::array. This class is needed because NVCC doesn't capture standard stack arrays in device lambdas. Furthermore we can't use std::array because it is not host-device decorated. More...
 
struct  execution_space
 The execution_space is a traits class that binds the execution space to a corresponding RAJA execution policies and default memory allocator. More...
 
class  ArrayIndexer
 Indexing into a multidimensional structured array. More...
 

Typedefs

template<typename T >
using MCArray = Array< T, 2 >
 Helper alias for multi-component arrays. More...
 
using float32 = float
 
using float64 = double
 
using IndexType = std::int32_t
 
ArrayView to wrap a pointer and provide indexing semantics
template<typename T >
using MCArrayView = ArrayView< T, 2 >
 Helper alias for multi-component arrays. More...
 

Enumerations

enum class  MemorySpace { Dynamic }
 Memory spaces supported by Array-like types. More...
 
enum class  ArrayStrideOrder : int { ARBITRARY = 0 , ROW = 1 , COLUMN = 2 , BOTH = ROW | COLUMN }
 Indicator for stride ordering. More...
 

Functions

template<typename T , int DIM, typename ArrayType >
std::ostream & print (std::ostream &os, const ArrayBase< T, DIM, ArrayType > &array)
 Free functions implementing ArrayBase's operator(s) More...
 
bool operator== (const Path &lhs, const Path &rhs)
 Equality operator (equals) More...
 
bool operator!= (const Path &lhs, const Path &rhs)
 Equality operator (not equals) More...
 
template<typename T , int N>
AXOM_HOST_DEVICE bool operator== (const StackArray< T, N > &lhs, const StackArray< T, N > &rhs)
 Equality comparison operator for StackArray. More...
 
template<typename T , int N>
AXOM_HOST_DEVICE bool operator!= (const StackArray< T, N > &lhs, const StackArray< T, N > &rhs)
 Inequality comparison operator for StackArray. More...
 
template<typename T , int N>
AXOM_HOST_DEVICE bool operator< (const StackArray< T, N > &lhs, const StackArray< T, N > &rhs)
 Less than operator for StackArray. More...
 
std::string gitSHA ()
 Returns the Git SHA if Axom was built in Git repository, empty if not. More...
 
void about ()
 Prints info about how Axom was configured and built to stdout. More...
 
void about (std::ostream &oss)
 Prints info about how Axom was configured and built to a stream. More...
 
std::string getVersion ()
 Returns a string consisting of the Axom version. More...
 
template<typename ExecSpace >
void synchronize () noexcept
 Synchronizes all execution threads when using an ASYNC policy with the specified execution space. More...
 
template<>
void synchronize< SEQ_EXEC > () noexcept
 
Overloaded ArrayBase Operator(s)
template<typename T , int DIM, typename ArrayType >
std::ostream & operator<< (std::ostream &os, const ArrayBase< T, DIM, ArrayType > &arr)
 Overloaded output stream operator. Outputs the Array-like to the given output stream. More...
 
template<typename T1 , typename T2 , int DIM, typename LArrayType , typename RArrayType >
bool operator== (const ArrayBase< T1, DIM, LArrayType > &lhs, const ArrayBase< T2, DIM, RArrayType > &rhs)
 Equality comparison operator for Array-likes. More...
 
template<typename T1 , typename T2 , int DIM, typename LArrayType , typename RArrayType >
bool operator!= (const ArrayBase< T1, DIM, LArrayType > &lhs, const ArrayBase< T2, DIM, RArrayType > &rhs)
 Inequality comparison operator for Arrays. More...
 
Memory Management Routines
void setDefaultAllocator (int allocId)
 Sets the default memory allocator to use. More...
 
int getDefaultAllocatorID ()
 Returns the ID of the current default allocator. More...
 
template<typename T >
T * allocate (std::size_t n, int allocID=getDefaultAllocatorID()) noexcept
 Allocates a chunk of memory of type T. More...
 
template<typename T >
void deallocate (T *&p) noexcept
 Frees the chunk of memory pointed to by the supplied pointer, p. More...
 
template<typename T >
T * reallocate (T *p, std::size_t n, int allocID=getDefaultAllocatorID()) noexcept
 Reallocates the chunk of memory pointed to by the supplied pointer. More...
 
void copy (void *dst, const void *src, std::size_t numbytes) noexcept
 Copies memory from the source to the destination. More...
 
Generic Loop Traversal Functions
template<typename ExecSpace , typename KernelType >
void for_all (const IndexType &begin, const IndexType &end, KernelType &&kernel) noexcept
 Loops over a specified contiguous range, I:[begin,end-1]. More...
 
template<typename ExecSpace , typename KernelType >
void for_all (const IndexType &N, KernelType &&kernel) noexcept
 Loops over the contiguous range, I:[0,N-1], given by its length, N. More...
 

Variables

constexpr int INVALID_ALLOCATOR_ID = -1
 

Typedef Documentation

◆ MCArray

template<typename T >
using axom::MCArray = typedef Array<T, 2>

Helper alias for multi-component arrays.

◆ MCArrayView

template<typename T >
using axom::MCArrayView = typedef ArrayView<T, 2>

Helper alias for multi-component arrays.

◆ float32

using axom::float32 = typedef float

◆ float64

using axom::float64 = typedef double

◆ IndexType

using axom::IndexType = typedef std::int32_t

Enumeration Type Documentation

◆ MemorySpace

enum axom::MemorySpace
strong

Memory spaces supported by Array-like types.

This abstraction is not implemented using Umpire's MemoryResourceType enum in order to also include a "Dynamic" option as a default template parameter for Array-like types

Enumerator
Dynamic 

◆ ArrayStrideOrder

enum axom::ArrayStrideOrder : int
strong

Indicator for stride ordering.

Multidimensional array data can be in row-major order, column-major order, or some arbitrarily permuted order. Row and column major ordering are the same thing if the array is 1D.

Enumerator
ARBITRARY 
ROW 
COLUMN 
BOTH 

Function Documentation

◆ operator<<()

template<typename T , int DIM, typename ArrayType >
std::ostream & axom::operator<< ( std::ostream &  os,
const ArrayBase< T, DIM, ArrayType > &  arr 
)

Overloaded output stream operator. Outputs the Array-like to the given output stream.

Parameters
[in,out]osoutput stream object.
[in]arruser-supplied Array-like instance.
Returns
os the updated output stream object.

References print().

◆ operator==() [1/3]

template<typename T1 , typename T2 , int DIM, typename LArrayType , typename RArrayType >
bool axom::operator== ( const ArrayBase< T1, DIM, LArrayType > &  lhs,
const ArrayBase< T2, DIM, RArrayType > &  rhs 
)

Equality comparison operator for Array-likes.

Parameters
[in]lhsleft Array-like to compare
[in]rhsright Array-like to compare
Returns
true if the Arrays have the same allocator ID, are of equal shape, and have the same elements.

References axom::ArrayBase< T, DIM, ArrayType >::flatIndex(), axom::detail::getAllocatorID(), and axom::ArrayBase< T, DIM, ArrayType >::shape().

◆ operator!=() [1/3]

template<typename T1 , typename T2 , int DIM, typename LArrayType , typename RArrayType >
bool axom::operator!= ( const ArrayBase< T1, DIM, LArrayType > &  lhs,
const ArrayBase< T2, DIM, RArrayType > &  rhs 
)

Inequality comparison operator for Arrays.

Parameters
[in]lhsleft Array to compare
[in]rhsright Array to compare
Returns
true if the Arrays do not have the same allocator ID, are not of equal shape, or do not have the same elements.

◆ print()

template<typename T , int DIM, typename ArrayType >
std::ostream& axom::print ( std::ostream &  os,
const ArrayBase< T, DIM, ArrayType > &  array 
)
inline

Free functions implementing ArrayBase's operator(s)

References axom::detail::getAllocatorID(), and axom::utilities::processAbort().

◆ setDefaultAllocator()

void axom::setDefaultAllocator ( int  allocId)
inline

Sets the default memory allocator to use.

Parameters
[in]allocIdthe Umpire allocator id
Note
This function has no effect when Axom is not compiled with Umpire.

References AXOM_UNUSED_VAR.

◆ getDefaultAllocatorID()

int axom::getDefaultAllocatorID ( )
inline

Returns the ID of the current default allocator.

Returns
ID the ID of the current default allocator.
Postcondition
ID != INVALID_ALLOCATOR_ID

◆ allocate()

template<typename T >
T * axom::allocate ( std::size_t  n,
int  allocID = getDefaultAllocatorID() 
)
inlinenoexcept

Allocates a chunk of memory of type T.

Parameters
[in]nthe number of elements to allocate.
[in]allocIDthe Umpire allocator to use (optional)
Template Parameters
Tthe type of pointer returned.
Note
By default allocate() will use the current default allocator. The caller may explicitly specify a different allocator to use by supplying the second, optional argument, or change the default allocator by calling axom::setDefaultAllocator().
Returns
p pointer to the new allocation or a nullptr if allocation failed.

References AXOM_UNUSED_VAR.

◆ deallocate()

template<typename T >
void axom::deallocate ( T *&  p)
inlinenoexcept

Frees the chunk of memory pointed to by the supplied pointer, p.

Parameters
[in/out]p a pointer to memory allocated with allocate/reallocate or a nullptr.
Postcondition
p == nullptr

◆ reallocate()

template<typename T >
T * axom::reallocate ( T *  p,
std::size_t  n,
int  allocID = getDefaultAllocatorID() 
)
inlinenoexcept

Reallocates the chunk of memory pointed to by the supplied pointer.

Parameters
[in]ppointer to memory allocated with allocate/reallocate, or a nullptr.
[in]nthe number of elements to allocate.
[in]allocIDthe ID of the allocator to use if pointer is null (optional)
Template Parameters
Tthe type pointer p points to.
Returns
p pointer to the new allocation or a nullptr if allocation failed.
Note
When n == 0, this function returns a valid pointer (of size 0) in the current allocator's memory space. This follows the semantics of Umpire's reallocate function.
When p is a null pointer, allocID is used to allocate the data. Otherwise, it is unused.

References AXOM_UNUSED_VAR.

◆ copy()

void axom::copy ( void *  dst,
const void *  src,
std::size_t  numbytes 
)
inlinenoexcept

Copies memory from the source to the destination.

Parameters
[in/out]dst the destination to copy to.
[in]srcthe source to copy from.
[in]numbytesthe number of bytes to copy.
Note
When using Umpire if either src or dst is not registered with the ResourceManager then the default host allocation strategy is assumed for that pointer.

◆ operator==() [2/3]

bool axom::operator== ( const Path lhs,
const Path rhs 
)

Equality operator (equals)

Parameters
[in]lhsThe first Path to compare
[in]rhsThe second Path to compare Two paths are equal if they use the same delimiter and contain the same components

◆ operator!=() [2/3]

bool axom::operator!= ( const Path lhs,
const Path rhs 
)
inline

Equality operator (not equals)

Parameters
[in]lhsThe first Path to compare
[in]rhsThe second Path to compare Two paths are equal if they use the same delimiter and contain the same components

◆ operator==() [3/3]

template<typename T , int N>
AXOM_HOST_DEVICE bool axom::operator== ( const StackArray< T, N > &  lhs,
const StackArray< T, N > &  rhs 
)

Equality comparison operator for StackArray.

Parameters
[in]lhsleft StackArray to compare
[in]rhsright StackArray to compare
Returns
true if the StackArrays have the same element values

◆ operator!=() [3/3]

template<typename T , int N>
AXOM_HOST_DEVICE bool axom::operator!= ( const StackArray< T, N > &  lhs,
const StackArray< T, N > &  rhs 
)

Inequality comparison operator for StackArray.

Parameters
[in]lhsleft StackArray to compare
[in]rhsright StackArray to compare
Returns
true if the StackArrays have different element values

◆ operator<()

template<typename T , int N>
AXOM_HOST_DEVICE bool axom::operator< ( const StackArray< T, N > &  lhs,
const StackArray< T, N > &  rhs 
)

Less than operator for StackArray.

Parameters
[in]lhsleft StackArray to compare
[in]rhsright StackArray to compare
Returns
true if lhs is lexicographically less than rhs, false otherwise
Note
It is only valid to call this function when values of type T are comparable, e.g. when T has an operator<()

◆ gitSHA()

std::string axom::gitSHA ( )

Returns the Git SHA if Axom was built in Git repository, empty if not.

Note: This will not update unless you re-run CMake between commits.

◆ about() [1/2]

void axom::about ( )

Prints info about how Axom was configured and built to stdout.

◆ about() [2/2]

void axom::about ( std::ostream &  oss)

Prints info about how Axom was configured and built to a stream.

Parameters
[in,out]ossthe target stream where to append the Axom info

◆ getVersion()

std::string axom::getVersion ( )

Returns a string consisting of the Axom version.

Returns
string corresponding to the Axom version

◆ for_all() [1/2]

template<typename ExecSpace , typename KernelType >
void axom::for_all ( const IndexType begin,
const IndexType end,
KernelType &&  kernel 
)
inlinenoexcept

Loops over a specified contiguous range, I:[begin,end-1].

Parameters
[in]beginstart index of the iteration.
[in]endlength of the iteration space.
[in]kerneluser-supplied kernel, i.e., a lambda or functor.
Template Parameters
ExecSpacethe execution space where to run the supplied kernel
KernelTypethe type of the supplied kernel (detected by the compiler)
See also
axom::execution_space

Usage Example:

double* A = ...
double* B = ...
double* C = ...
// compute C[ idx ] for all entries in [100-499]
axom::for_all< axom::OMP_EXEC >( 100, 500, AXOM_LAMBDA( IndexType idx ) {
C[ idx ] = A[ idx ] + B[ idx ];
} );
#define AXOM_LAMBDA
Convenience macro used for lambda capture by value.
Definition: Macros.hpp:81
std::int32_t IndexType
Definition: Types.hpp:66

References AXOM_STATIC_ASSERT.

◆ for_all() [2/2]

template<typename ExecSpace , typename KernelType >
void axom::for_all ( const IndexType N,
KernelType &&  kernel 
)
inlinenoexcept

Loops over the contiguous range, I:[0,N-1], given by its length, N.

Parameters
[in]Nthe length of the contiguous range.
[in]kerneluser-supplied kernel, i.e., a lambda or functor.
Template Parameters
ExecSpacethe execution space where to run the supplied kernel
KernelTypethe type of the supplied kernel (detected by the compiler)
See also
axom::execution_space

Usage Example:

double* A = ...
double* B = ...
double* C = ...
axom::for_all< axom::OMP_EXEC >( 500, AXOM_LAMBDA( IndexType idx ) {
C[ idx ] = A[ idx ] + B[ idx ];
} );

References AXOM_STATIC_ASSERT.

◆ synchronize()

template<typename ExecSpace >
void axom::synchronize ( )
inlinenoexcept

Synchronizes all execution threads when using an ASYNC policy with the specified execution space.

Template Parameters
ExecSpacethe execution space

References AXOM_STATIC_ASSERT.

◆ synchronize< SEQ_EXEC >()

template<>
void axom::synchronize< SEQ_EXEC > ( )
inlinenoexcept

Variable Documentation

◆ INVALID_ALLOCATOR_ID

constexpr int axom::INVALID_ALLOCATOR_ID = -1
constexpr