AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
A Map for BivariateSet. It associates a constant number of values to every element in a BivariateSet (as determined by StridePolicy). More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/slam/BivariateMap.hpp>
Classes | |
class | BivariateMapIterator |
An iterator type for a BivariateMap, iterating via its ElementFlatIndex. More... | |
Public Types | |
using | SetPosition = typename SetType::PositionType |
using | SetElement = typename SetType::ElementType |
using | MapType = slam::Map< SetType, DataType, StridePolicy > |
using | BivariateSetType = BivariateSet< SetPosition, SetElement > |
using | OrderedSetType = typename BivariateSetType::OrderedSetType |
using | BivariateMapType = BivariateMap< SetType, DataType, StridePolicy > |
using | SubMapType = SubMap< SetType, DataType, BivariateMapType, StridePolicy > |
using | SubMapIterator = typename SubMapType::SubMapIterator |
Public Member Functions | |
BivariateMap (const BivariateSetType *bSet=&s_nullBiSet, DataType defaultValue=DataType(), SetPosition stride=StridePolicy::DEFAULT_VALUE) | |
Constructor for a BivariateMap. More... | |
BivariateMapIterator | begin () |
BivariateMapIterator | end () |
SubMapIterator | begin (int i) |
SubMapIterator | end (int i) |
const BivariateSetType * | set () const |
const MapType * | getMap () const |
MapType * | getMap () |
virtual bool | isValid (bool verboseOutput=false) const override |
Checks whether the Map is valid. More... | |
void | copy (DataType *data_arr) |
Given a DataType array of size totalSize()*numComp() , copy the data into the BivariateMap storage. More... | |
BivariateMap index access functions | |
SetPosition | index (SetPosition s1, SetPosition s2) const |
Returns the SparseIndex of the element given the DenseIndex. More... | |
OrderedSetType | indexSet (SetPosition s1) const |
Return a set of DenseIndex associated to the given first set index. More... | |
SetPosition | flatIndex (SetPosition s1, SetPosition s2) const |
Search for the FlatIndex of an element given its DenseIndex in the BivariateSet. More... | |
BivariateMap cardinality functions | |
SetPosition | size () const override |
Returns the BivariateSet size. More... | |
SetPosition | totalSize () const |
Returns the BivariateSet size. More... | |
SetPosition | firstSetSize () const |
SetPosition | secondSetSize () const |
SetPosition | size (SetPosition s) const |
Returns the number of the BivariateSet ordered pairs with the given first set index. More... | |
SetPosition | numComp () const |
Return the number of components of the map. More... | |
BivariateMap value access functions | |
const DataType & | operator[] (SetPosition setIndex) const |
Access the value in the map using a FlatIndex in the range of 0 to size()*numComp() More... | |
DataType & | operator[] (SetPosition setIndex) |
const SubMapType | operator() (SetPosition firstIdx) const |
Returns a SubMap containing the subset of the BivariateMap given the first set index. More... | |
SubMapType | operator() (SetPosition firstIdx) |
const DataType & | operator() (SetPosition s1, SetPosition s2, SetPosition comp=0) const |
Access the value associated with the given SparseIndex into the BivariateSet and the component index. More... | |
DataType & | operator() (SetPosition s1, SetPosition s2, SetPosition comp=0) |
const DataType * | findValue (SetPosition s1, SetPosition s2, SetPosition comp=0) const |
Access the value associated with the given DenseIndex into the BivariateSet and the component index. More... | |
DataType * | findValue (SetPosition s1, SetPosition s2, SetPosition comp=0) |
A Map for BivariateSet. It associates a constant number of values to every element in a BivariateSet (as determined by StridePolicy).
Like BivariateSet, every value in BivariateMap is indexed by two indices. BivariateMap's operator(i)
returns a SubMap of all entries whose first index is i
in the BivariateSet.
The different indexing systems (DenseIndex, SparseIndex, FlatIndex) are explained in BivariateSet. Because BivariateMap can have more than one component, FlatIndex is further divided into ComponentFlatIndex, where each component in each element is indexed separately, and ElementFlatIndex, an index that disregards the individual components. Hence, to access each component, one would need to provide a component index as well.
Example: For a 2 x 2 sparse matrix with 3 components below:
Access the elements using ElementFlatIndex (e)
would be...
(e = 0) = abc
(e = 1) = def
To access each component, provide a component index (c) (e = 0, c = 0) = a
(e = 0, c = 1) = b
(e = 0, c = 2) = c
(e = 1, c = 0) = d
(e = 1, c = 1) = e
(e = 1, c = 2) = f
To access using ComponentFlatIndex (idx)
...
(idx = 0) = a
(idx = 1) = b
(idx = 2) = c
(idx = 3) = d
(idx = 4) = e
(idx = 5) = f
DataType | the data type of each value |
StridePolicy | A policy class for configuring the number of components associate with each element. There is a fixed stride between the data associated with each element of the set. |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::SetPosition = typename SetType::PositionType |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::SetElement = typename SetType::ElementType |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::MapType = slam::Map<SetType, DataType, StridePolicy> |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::BivariateSetType = BivariateSet<SetPosition, SetElement> |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::OrderedSetType = typename BivariateSetType::OrderedSetType |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::BivariateMapType = BivariateMap<SetType, DataType, StridePolicy> |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::SubMapType = SubMap<SetType, DataType, BivariateMapType, StridePolicy> |
using axom::slam::BivariateMap< SetType, DataType, StridePolicy >::SubMapIterator = typename SubMapType::SubMapIterator |
|
inline |
Constructor for a BivariateMap.
bSet | (Optional) Pointer to the BivariateSet. |
defaultValue | (Optional) The default value used to initialize the entries of the map. |
stride | (Optional) The stride, or number of component, of the map. |
|
inline |
|
inline |
References axom::slam::BivariateSet< PosType, ElemType >::findElementFlatIndex(), axom::slam::BivariateMap< SetType, DataType, StridePolicy >::firstSetSize(), axom::slam::BivariateSet< PosType, ElemType >::size(), axom::slam::BivariateMap< SetType, DataType, StridePolicy >::size(), and SLIC_ASSERT_MSG.
|
inline |
Returns a SubMap containing the subset of the BivariateMap given the first set index.
|
inline |
|
inline |
Access the value associated with the given SparseIndex into the BivariateSet and the component index.
0 <= s1 < firstSetSize()
0 <= s2 < size(s1)
0 <= comp < numComp()
References axom::slam::BivariateSet< PosType, ElemType >::findElementFlatIndex().
|
inline |
|
inline |
Access the value associated with the given DenseIndex into the BivariateSet and the component index.
0 <= s1 < firstSetSize()
0 <= s2 < secondSetSize()
0 <= comp < numComp()
References axom::slam::BivariateSet< PosType, ElemType >::findElementFlatIndex(), and axom::slam::BivariateSet< SetPosition, SetElement >::INVALID_POS.
Referenced by axom::slam::BivariateMap< SetType, DataType, StridePolicy >::findValue().
|
inline |
|
inline |
Returns the SparseIndex of the element given the DenseIndex.
References axom::slam::BivariateSet< PosType, ElemType >::findElementIndex().
|
inline |
Return a set of DenseIndex associated to the given first set index.
s1 | the first set index |
References axom::slam::BivariateSet< PosType, ElemType >::getElements().
|
inline |
Search for the FlatIndex of an element given its DenseIndex in the BivariateSet.
References axom::slam::BivariateSet< PosType, ElemType >::findElementFlatIndex().
|
inline |
BivariateMap iterator functions
References axom::slam::BivariateMap< SetType, DataType, StridePolicy >::BivariateMapIterator::BivariateMapIterator().
|
inline |
|
inline |
Iterator via Submap
References axom::slam::BivariateMap< SetType, DataType, StridePolicy >::begin().
Referenced by axom::slam::BivariateMap< SetType, DataType, StridePolicy >::begin().
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Checks whether the Map is valid.
Implements axom::slam::MapBase< SetType::PositionType >.
References axom::slam::BivariateMap< SetType, DataType, StridePolicy >::isValid().
Referenced by axom::slam::BivariateMap< SetType, DataType, StridePolicy >::isValid().
|
inlineoverridevirtual |
Returns the BivariateSet size.
Implements axom::slam::MapBase< SetType::PositionType >.
Referenced by axom::slam::BivariateMap< SetType, DataType, StridePolicy >::BivariateMapIterator::advance(), axom::slam::BivariateMap< SetType, DataType, StridePolicy >::copy(), and axom::slam::BivariateMap< SetType, DataType, StridePolicy >::operator[]().
|
inline |
Returns the BivariateSet size.
Referenced by axom::slam::BivariateMap< SetType, DataType, StridePolicy >::BivariateMapIterator::advance(), axom::slam::BivariateMap< SetType, DataType, StridePolicy >::end(), and axom::slam::BivariateMap< SetType, DataType, StridePolicy >::BivariateMapIterator::numComp().
|
inline |
|
inline |
|
inline |
Returns the number of the BivariateSet ordered pairs with the given first set index.
|
inline |
Return the number of components of the map.
Referenced by axom::slam::BivariateMap< SetType, DataType, StridePolicy >::BivariateMapIterator::numComp().
|
inline |
Given a DataType array of size totalSize()*numComp()
, copy the data into the BivariateMap storage.
data_arr | The array of DataType that contains the data to be copied. |
References AXOM_DEBUG_PARAM, axom::slam::BivariateMap< SetType, DataType, StridePolicy >::size(), and SLIC_ASSERT_MSG.