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

Namespaces

 detail
 
 experimental
 
 inlet
 
 klee
 
 lumberjack
 
 mint
 
 numerics
 
 primal
 
 quest
 
 sidre
 
 slam
 
 slic
 
 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...
 
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  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 caputure standard stack arrays in device lambdas. Furthermore we can't use std::array becuase it is not host-device decorated. More...
 

Typedefs

template<typename T >
using MCArray = Array< T, 2 >
 Helper alias for multi-component arrays. More...
 
using int8 = std::int8_t
 
using uint8 = std::uint8_t
 
using int16 = std::int16_t
 
using uint16 = std::uint16_t
 
using int32 = std::int32_t
 
using uint32 = std::uint32_t
 
using int64 = std::int64_t
 
using uint64 = std::uint64_t
 
using float32 = float
 
using float64 = double
 
using IndexType = int32
 
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  MemorySpace { MemorySpace::Dynamic }
 Memory spaces supported by Array-like types. 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...
 
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 T , int DIM, typename LArrayType , typename RArrayType >
bool operator== (const ArrayBase< T, DIM, LArrayType > &lhs, const ArrayBase< T, DIM, RArrayType > &rhs)
 Equality comparison operator for Array-likes. More...
 
template<typename T , int DIM, typename LArrayType , typename RArrayType >
bool operator!= (const ArrayBase< T, DIM, LArrayType > &lhs, const ArrayBase< T, DIM, RArrayType > &rhs)
 Inequality comparison operator for Arrays. More...
 
Memory Management Routines
void setDefaultAllocator (int allocatorID)
 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.

◆ int8

using axom::int8 = typedef std::int8_t

8-bit signed integer type

◆ uint8

using axom::uint8 = typedef std::uint8_t

8-bit unsigned integer type

◆ int16

using axom::int16 = typedef std::int16_t

16-bit signed integer type

◆ uint16

using axom::uint16 = typedef std::uint16_t

16-bit unsigned integer type

◆ int32

using axom::int32 = typedef std::int32_t

32-bit signed integer type

◆ uint32

using axom::uint32 = typedef std::uint32_t

32-bit unsigned integer type

◆ int64

using axom::int64 = typedef std::int64_t

64-bit signed integer type

◆ uint64

using axom::uint64 = typedef std::uint64_t

64-bit unsigned integer type

◆ float32

using axom::float32 = typedef float

◆ float64

using axom::float64 = typedef double

◆ IndexType

using axom::IndexType = typedef int32

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 

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 T , int DIM, typename LArrayType , typename RArrayType >
bool axom::operator== ( const ArrayBase< T, DIM, LArrayType > &  lhs,
const ArrayBase< T, 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::detail::getAllocatorID(), and axom::ArrayBase< T, DIM, ArrayType >::shape().

Referenced by axom::Path::parts().

◆ operator!=() [1/3]

template<typename T , int DIM, typename LArrayType , typename RArrayType >
bool axom::operator!= ( const ArrayBase< T, DIM, LArrayType > &  lhs,
const ArrayBase< T, 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

◆ setDefaultAllocator()

void axom::setDefaultAllocator ( int  allocatorID)
inline

Sets the default memory allocator to use.

Parameters
[in]allocatorIDID of the Umpire allocator to use.
Note
This function has no effect when Axom is not compiled with Umpire.

References AXOM_UNUSED_VAR.

Referenced by axom::quest::getMeshTriangle(), axom::sidre::Group::isRoot(), and axom::quest::IntersectionShaper::setExecPolicy().

◆ 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

References allocate(), copy(), deallocate(), and reallocate().

Referenced by axom::detail::getAllocatorID< MemorySpace::Dynamic >(), axom::quest::getMeshTriangle(), axom::sidre::Group::isRoot(), and axom::quest::IntersectionShaper::setExecPolicy().

◆ 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.

Referenced by getDefaultAllocatorID().

◆ deallocate()

◆ 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.

Referenced by getDefaultAllocatorID().

◆ 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.

References axom::detail::getAllocatorID().

Referenced by axom::Array< T, DIM >::Array(), axom::quest::InOutOctree< DIM >::generateIndex(), getDefaultAllocatorID(), axom::quest::getMeshTriangle(), axom::sidre::View::getNextValidAttrValueIndex(), axom::slam::DynamicVariableRelation< PosType, ElemType >::isValid(), axom::Array< T, DIM >::operator=(), and axom::quest::IntersectionShaper::setExecPolicy().

◆ 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

◆ 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
str string corresponding to the Axom version
Postcondition
str != ""

◆ 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 ];
} );

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