AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::slam::Map< T, S, IndPol, StrPol, IfacePol > Class Template Reference

A Map class that associates a constant number of values to every element in a set. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/slam/Map.hpp>

Inheritance diagram for axom::slam::Map< T, S, IndPol, StrPol, IfacePol >:

Classes

class  MapBuilder
 Helper class for constructing a Map. More...
 
class  MapIterator
 An iterator type for a map. Each increment operation advances the iterator to the next set element. To access the jth component values of the iterator's current element, use iter(j). More...
 

Public Types

using DataType = T
 
using SetType = S
 
using IndirectionPolicy = IndPol
 
using StridePolicyType = StrPol
 
using OrderedMap = typename IndirectionPolicy::IndirectionBufferType
 
using SetPosition = typename SetType::PositionType
 
using SetElement = typename SetType::ElementType
 
using ValueType = typename IndirectionPolicy::IndirectionResult
 
using ConstValueType = typename IndirectionPolicy::ConstIndirectionResult
 
using const_iterator = MapIterator
 
using const_iterator_pair = std::pair< const_iterator, const_iterator >
 
using iterator = const_iterator
 
using iterator_pair = const_iterator_pair
 
using ConcreteMap = Map< T, S, IndPol, StrPol, policies::ConcreteInterface >
 
using VirtualMap = Map< T, S, IndPol, StrPol, policies::VirtualInterface >
 

Public Member Functions

 Map (const SetType *theSet=policies::EmptySetTraits< SetType >::emptySet(), DataType defaultValue=DataType(), SetPosition stride=StridePolicyType::DEFAULT_VALUE, int allocatorID=axom::getDefaultAllocatorID())
 Constructor for Map using a Set pointer. More...
 
template<typename USet , typename TSet = SetType, typename Enable = typename std::enable_if< !std::is_abstract<TSet>::value && std::is_base_of<TSet, USet>::value>::type>
 Map (const USet &theSet, DataType defaultValue=DataType(), SetPosition stride=StridePolicyType::DEFAULT_VALUE, int allocatorID=axom::getDefaultAllocatorID())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename USet , typename TSet = SetType, typename Enable = typename std::enable_if< !std::is_abstract<TSet>::value && std::is_base_of<TSet, USet>::value>::type>
 Map (const USet &theSet, OrderedMap data, SetPosition stride=StridePolicyType::DEFAULT_VALUE)
 Constructor for Map using a Set passed by-value and data passed in by-value. More...
 
 Map (const MapBuilder &builder)
 Constructor for Map using a MapBuilder. More...
 
const SetTypeset () const
 Returns a pointer to the map's underlying set. More...
 
void print () const
 print information on the map, including every element inside Map More...
 
bool isValid (bool verboseOutput=false) const
 returns true if the map is valid, false otherwise.
More...
 
MapIterator begin ()
 
MapIterator end ()
 
const_iterator_pair range () const
 
OrderedMapdata ()
 Returns a reference to the underlying map data. More...
 
const OrderedMapdata () const
 
AXOM_HOST_DEVICE const typename S::PositionType stride () const
 
const typename S::PositionType operator() () const
 
AXOM_HOST_DEVICE void setStride (typename S::PositionType AXOM_DEBUG_PARAM(val))
 
Map individual access functions
AXOM_HOST_DEVICE ConstValueType operator[] (SetPosition setIndex) const
 Access the value in the map using a flat index in the range of 0 to size()*numComp() More...
 
AXOM_HOST_DEVICE ValueType operator[] (SetPosition setIndex)
 
AXOM_HOST_DEVICE ConstValueType operator() (SetPosition setIdx, SetPosition comp=0) const
 Access the value associated with the given position in the set and the component index. More...
 
AXOM_HOST_DEVICE ValueType operator() (SetPosition setIdx, SetPosition comp=0)
 
Map cardinality functions
AXOM_HOST_DEVICE SetPosition size () const
 Return the set size. Same as set()->size(). More...
 
SetPosition numComp () const
 
Map modifying functions for all entries
void clear ()
 replace all elements in the Map with the default DataType More...
 
void fill (DataType val=DataType())
 
void copy (const Map &other)
 Element-wise copy of data from another map. More...
 

Static Public Attributes

static const NullSet< SetPosition, SetElements_nullSet
 
static const bool IS_COMPILE_TIME
 
OrderedSet_Stride_Policies

A few default policies for the stride of an OrderedSet

static const typename S::PositionType DEFAULT_VALUE
 

Detailed Description

template<typename T, typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
class axom::slam::Map< T, S, IndPol, StrPol, IfacePol >

A Map class that associates a constant number of values to every element in a set.

Template Parameters
TThe data type of each value
SThe map's set type
IndPolThe map's indirection policy
StrPolA policy class that determines how many values to associate with each element. There is a fixed stride between the data associated with each element of the set.

The map class associates a fixed number of values, also referred to as components, with each element in its underlying Set instance. Depending on the StridePolicy, this can be fixed at compile time or at runtime.
Access to the jth component of the ith element, can be obtained via the parenthesis operator ( map(i,j) ), or via the square bracket operator (i.e. map[k], where k = i * stride() + j ).

Member Typedef Documentation

◆ DataType

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::DataType = T

◆ SetType

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::SetType = S

◆ IndirectionPolicy

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::IndirectionPolicy = IndPol

◆ StridePolicyType

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::StridePolicyType = StrPol

◆ OrderedMap

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::OrderedMap = typename IndirectionPolicy::IndirectionBufferType

◆ SetPosition

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::SetPosition = typename SetType::PositionType

◆ SetElement

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::SetElement = typename SetType::ElementType

◆ ValueType

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::ValueType = typename IndirectionPolicy::IndirectionResult

◆ ConstValueType

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::ConstValueType = typename IndirectionPolicy::ConstIndirectionResult

◆ const_iterator

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::const_iterator = MapIterator

◆ const_iterator_pair

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::const_iterator_pair = std::pair<const_iterator, const_iterator>

◆ iterator

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::iterator = const_iterator

◆ iterator_pair

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::iterator_pair = const_iterator_pair

◆ ConcreteMap

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::ConcreteMap = Map<T, S, IndPol, StrPol, policies::ConcreteInterface>

◆ VirtualMap

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
using axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::VirtualMap = Map<T, S, IndPol, StrPol, policies::VirtualInterface>

Constructor & Destructor Documentation

◆ Map() [1/4]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::Map ( const SetType theSet = policies::EmptySetTraits<SetType>::emptySet(),
DataType  defaultValue = DataType(),
SetPosition  stride = StridePolicyType::DEFAULT_VALUE,
int  allocatorID = axom::getDefaultAllocatorID() 
)
inline

Constructor for Map using a Set pointer.

Parameters
theSet(Optional) A pointer to the map's set
defaultValue(Optional) If given, every entry in the map will be initialized using defaultValue
stride(Optional) The stride. The number of DataType that each element in the set will be mapped to. When using a RuntimeStridePolicy, the default is 1.
Note
When using a compile time StridePolicy, stride must be equal to stride(), when provided.

References axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::numComp(), and axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::size().

◆ Map() [2/4]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
template<typename USet , typename TSet = SetType, typename Enable = typename std::enable_if< !std::is_abstract<TSet>::value && std::is_base_of<TSet, USet>::value>::type>
axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::Map ( const USet &  theSet,
DataType  defaultValue = DataType(),
SetPosition  stride = StridePolicyType::DEFAULT_VALUE,
int  allocatorID = axom::getDefaultAllocatorID() 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::numComp(), and axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::size().

◆ Map() [3/4]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
template<typename USet , typename TSet = SetType, typename Enable = typename std::enable_if< !std::is_abstract<TSet>::value && std::is_base_of<TSet, USet>::value>::type>
axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::Map ( const USet &  theSet,
OrderedMap< T, S, IndPol, StrPol, IfacePol >  data,
SetPosition  stride = StridePolicyType::DEFAULT_VALUE 
)
inline

Constructor for Map using a Set passed by-value and data passed in by-value.

Parameters
theSetA reference to the map's set
dataPointer to the externally-owned data
stride(Optional) The stride. The number of DataType that each element in the set will be mapped to. When using a RuntimeStridePolicy, the default is 1.
Note
When using a compile time StridePolicy, stride must be equal to stride(), when provided.

◆ Map() [4/4]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::Map ( const MapBuilder builder)
inline

Constructor for Map using a MapBuilder.

Member Function Documentation

◆ set()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
const SetType* axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::set ( ) const
inline

Returns a pointer to the map's underlying set.

◆ operator[]() [1/2]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
AXOM_HOST_DEVICE ConstValueType axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::operator[] ( SetPosition  setIndex) const
inline

Access the value in the map using a flat index in the range of 0 to size()*numComp()

Returns
The value for the jth component of the ith element, where setIndex = i * numComp() + j.
Precondition
0 <= setIndex < size() * numComp()

◆ operator[]() [2/2]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
AXOM_HOST_DEVICE ValueType axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::operator[] ( SetPosition  setIndex)
inline

◆ operator()() [1/3]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
AXOM_HOST_DEVICE ConstValueType axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::operator() ( SetPosition  setIdx,
SetPosition  comp = 0 
) const
inline

Access the value associated with the given position in the set and the component index.

Precondition
0 <= setIdx < size()
0 <= comp < numComp()

◆ operator()() [2/3]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
AXOM_HOST_DEVICE ValueType axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::operator() ( SetPosition  setIdx,
SetPosition  comp = 0 
)
inline

◆ size()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
AXOM_HOST_DEVICE SetPosition axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::size ( ) const
inline

Return the set size. Same as set()->size().

The total storage size for the map's values is size() * numComp()

References axom::slam::policies::EmptySetTraits< SetType, P, E >::isEmpty().

◆ numComp()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
SetPosition axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::numComp ( ) const
inline

◆ clear()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
void axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::clear ( )
inline

replace all elements in the Map with the default DataType

References axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::fill().

◆ fill()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
void axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::fill ( DataType  val = DataType())
inline

Set each entry in the map to the given value

◆ copy()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
void axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::copy ( const Map< T, S, IndPol, StrPol, IfacePol > &  other)
inline

◆ print()

template<typename T , typename S , typename IndPol , typename StrPol , typename IfacePol >
void axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::print

print information on the map, including every element inside Map

◆ isValid()

template<typename T , typename S , typename IndPol , typename StrPol , typename IfacePol >
bool axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::isValid ( bool  verboseOutput = false) const

returns true if the map is valid, false otherwise.

◆ begin()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
MapIterator axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::begin ( )
inline

◆ end()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
MapIterator axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::end ( )
inline

◆ range()

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
const_iterator_pair axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::range ( ) const
inline

◆ data() [1/2]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
OrderedMap& axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::data ( )
inline

Returns a reference to the underlying map data.

◆ data() [2/2]

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
const OrderedMap& axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::data ( ) const
inline

◆ stride()

AXOM_HOST_DEVICE const typename S::PositionType axom::slam::policies::StrideOne< typename S::PositionType >::stride ( ) const
inlineinherited

◆ operator()() [3/3]

const typename S::PositionType axom::slam::policies::StrideOne< typename S::PositionType >::operator() ( ) const
inlineinherited

◆ setStride()

AXOM_HOST_DEVICE void axom::slam::policies::StrideOne< typename S::PositionType >::setStride ( typename S::PositionType  AXOM_DEBUG_PARAMval)
inlineinherited

Member Data Documentation

◆ s_nullSet

template<typename T , typename S = Set<>, typename IndPol = policies::STLVectorIndirection<typename S::PositionType, T>, typename StrPol = policies::StrideOne<typename S::PositionType>, typename IfacePol = policies::VirtualInterface>
const NullSet<SetPosition, SetElement> axom::slam::Map< T, S, IndPol, StrPol, IfacePol >::s_nullSet
static

◆ DEFAULT_VALUE

const typename S::PositionType axom::slam::policies::StrideOne< typename S::PositionType >::DEFAULT_VALUE
staticinherited

◆ IS_COMPILE_TIME

const bool axom::slam::policies::StrideOne< typename S::PositionType >::IS_COMPILE_TIME
staticinherited

The documentation for this class was generated from the following file: