AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::slam::SubMap< SuperMapType, SubsetType > Class Template Reference

The SubMap class provides an API to easily traverse a subset of a Map. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.7.0/src/axom/slam/SubMap.hpp>

Inheritance diagram for axom::slam::SubMap< SuperMapType, SubsetType >:

Classes

class  SubMapIterator
 An iterator for SubMap, based on MapIterator. More...
 

Public Types

using DataType = typename SuperMapType::DataType
 
using SetPosition = typename SubsetType::PositionType
 
using SetElement = typename SubsetType::ElementType
 
using StridePolicyType = typename SuperMapType::StridePolicyType
 
using IndirectionPolicyType = typename SuperMapType::IndirectionPolicy
 
using MapType = Map< DataType, SubsetType, IndirectionPolicyType, StridePolicyType >
 
using SubsetBuilder = typename SubsetType::SetBuilder
 
using const_iterator = SubMapIterator
 
using const_iterator_pair = std::pair< const_iterator, const_iterator >
 
using iterator = const_iterator
 
using iterator_pair = const_iterator_pair
 

Public Member Functions

 SubMap ()
 
 SubMap (SuperMapType *supermap, SubsetType subset_idxset, bool indicesHaveIndirection=true)
 Constructor for SubMap given the ElementFlatIndex into the SuperMap. More...
 
 SubMap (const SubMap &otherMap)
 
SubMapoperator= (const SubMap &otherMap)
 
bool isValid (bool VerboseOutput=false) const override
 Checks whether the Map is valid. More...
 
SubMapIterator begin ()
 
SubMapIterator end ()
 
SubMap individual access functions
const DataTypeoperator[] (IndexType idx) const
 Access the value in the SubMap given the ComponentFlatIndex. More...
 
DataTypeoperator[] (IndexType idx)
 
const DataTypeoperator() (IndexType idx, IndexType comp=0) const
 Access the value associated with the given position in the subset and the component index. More...
 
DataTypeoperator() (IndexType idx, IndexType comp=0)
 
const DataTypevalue (IndexType idx, IndexType comp=0) const
 Access the value associated with the given position in the subset and the component index. More...
 
DataTypevalue (IndexType idx, IndexType comp=0)
 
IndexType index (IndexType idx) const
 Return the set element in the SuperMap at the given subset index. More...
 
SubMap cardinality functions
IndexType size () const override
 returns the size of the SubMap More...
 
IndexType numComp () const
 returns the number of components (aka. stride) of the SubMap More...
 

Protected Attributes

SuperMapType * m_superMap
 
SubsetType m_subsetIdx
 
bool m_indicesHaveIndirection
 

Detailed Description

template<typename SuperMapType, typename SubsetType>
class axom::slam::SubMap< SuperMapType, SubsetType >

The SubMap class provides an API to easily traverse a subset of a Map.

A SubMap is defined by a subset of the indices into a Map, which we refer to as its SuperMap (of type SuperMapType). The indices are expressed as ElementFlatIndex.
Please see BivariateMap for an explanation of the various indexing schemes.

SubMap is used by BivariateMap to return a set of values mapped to each item in its first set.

Template Parameters
SuperMapTypethe type of SuperMap
SetTypedefines the indices int the super map. SetType cannot be abstract.
Warning
SubMap constructor can take a const Map pointer or a non-const Map pointer. A non-const value access function in SubMap will fail if the Submap is constructed using a const Map pointer.
See also
Map, BivariateMap

Member Typedef Documentation

◆ DataType

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::DataType = typename SuperMapType::DataType

◆ SetPosition

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::SetPosition = typename SubsetType::PositionType

◆ SetElement

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::SetElement = typename SubsetType::ElementType

◆ StridePolicyType

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::StridePolicyType = typename SuperMapType::StridePolicyType

◆ IndirectionPolicyType

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::IndirectionPolicyType = typename SuperMapType::IndirectionPolicy

◆ MapType

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::MapType = Map<DataType, SubsetType, IndirectionPolicyType, StridePolicyType>

◆ SubsetBuilder

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::SubsetBuilder = typename SubsetType::SetBuilder

◆ const_iterator

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::const_iterator = SubMapIterator

◆ const_iterator_pair

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::const_iterator_pair = std::pair<const_iterator, const_iterator>

◆ iterator

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::iterator = const_iterator

◆ iterator_pair

template<typename SuperMapType, typename SubsetType>
using axom::slam::SubMap< SuperMapType, SubsetType >::iterator_pair = const_iterator_pair

Constructor & Destructor Documentation

◆ SubMap() [1/3]

template<typename SuperMapType, typename SubsetType>
axom::slam::SubMap< SuperMapType, SubsetType >::SubMap ( )
inline

Default Constructor

◆ SubMap() [2/3]

template<typename SuperMapType, typename SubsetType>
axom::slam::SubMap< SuperMapType, SubsetType >::SubMap ( SuperMapType *  supermap,
SubsetType  subset_idxset,
bool  indicesHaveIndirection = true 
)
inline

Constructor for SubMap given the ElementFlatIndex into the SuperMap.

Parameters
supermapThe map that this SubMap is a subset of.
subset_idxseta Set of ElementFlatIndex into the SuperMap

◆ SubMap() [3/3]

template<typename SuperMapType, typename SubsetType>
axom::slam::SubMap< SuperMapType, SubsetType >::SubMap ( const SubMap< SuperMapType, SubsetType > &  otherMap)
inline

Copy Constructor

Member Function Documentation

◆ operator=()

template<typename SuperMapType, typename SubsetType>
SubMap& axom::slam::SubMap< SuperMapType, SubsetType >::operator= ( const SubMap< SuperMapType, SubsetType > &  otherMap)
inline

Assignment Operator

◆ operator[]() [1/2]

template<typename SuperMapType, typename SubsetType>
const DataType& axom::slam::SubMap< SuperMapType, SubsetType >::operator[] ( IndexType  idx) const
inline

Access the value in the SubMap given the ComponentFlatIndex.

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

◆ operator[]() [2/2]

template<typename SuperMapType, typename SubsetType>
DataType& axom::slam::SubMap< SuperMapType, SubsetType >::operator[] ( IndexType  idx)
inline

◆ operator()() [1/2]

template<typename SuperMapType, typename SubsetType>
const DataType& axom::slam::SubMap< SuperMapType, SubsetType >::operator() ( IndexType  idx,
IndexType  comp = 0 
) const
inline

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

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

◆ operator()() [2/2]

template<typename SuperMapType, typename SubsetType>
DataType& axom::slam::SubMap< SuperMapType, SubsetType >::operator() ( IndexType  idx,
IndexType  comp = 0 
)
inline

◆ value() [1/2]

template<typename SuperMapType, typename SubsetType>
const DataType& axom::slam::SubMap< SuperMapType, SubsetType >::value ( IndexType  idx,
IndexType  comp = 0 
) const
inline

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

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

◆ value() [2/2]

template<typename SuperMapType, typename SubsetType>
DataType& axom::slam::SubMap< SuperMapType, SubsetType >::value ( IndexType  idx,
IndexType  comp = 0 
)
inline

◆ index()

template<typename SuperMapType, typename SubsetType>
IndexType axom::slam::SubMap< SuperMapType, SubsetType >::index ( IndexType  idx) const
inline

Return the set element in the SuperMap at the given subset index.

◆ size()

template<typename SuperMapType, typename SubsetType>
IndexType axom::slam::SubMap< SuperMapType, SubsetType >::size ( ) const
inlineoverridevirtual

returns the size of the SubMap

Implements axom::slam::MapBase< SubsetType::PositionType >.

◆ numComp()

template<typename SuperMapType, typename SubsetType>
IndexType axom::slam::SubMap< SuperMapType, SubsetType >::numComp ( ) const
inline

returns the number of components (aka. stride) of the SubMap

◆ isValid()

template<typename SuperMapType , typename SetType >
bool axom::slam::SubMap< SuperMapType, SetType >::isValid ( bool  verboseOutput = false) const
overridevirtual

Checks whether the Map is valid.

Returns
True if valid, false otherwise.

Implements axom::slam::MapBase< SubsetType::PositionType >.

◆ begin()

template<typename SuperMapType, typename SubsetType>
SubMapIterator axom::slam::SubMap< SuperMapType, SubsetType >::begin ( )
inline

◆ end()

template<typename SuperMapType, typename SubsetType>
SubMapIterator axom::slam::SubMap< SuperMapType, SubsetType >::end ( )
inline

Member Data Documentation

◆ m_superMap

template<typename SuperMapType, typename SubsetType>
SuperMapType* axom::slam::SubMap< SuperMapType, SubsetType >::m_superMap
protected

◆ m_subsetIdx

template<typename SuperMapType, typename SubsetType>
SubsetType axom::slam::SubMap< SuperMapType, SubsetType >::m_subsetIdx
protected

◆ m_indicesHaveIndirection

template<typename SuperMapType, typename SubsetType>
bool axom::slam::SubMap< SuperMapType, SubsetType >::m_indicesHaveIndirection
protected

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