AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::slam::BivariateSet< PosType, ElemType > Class Template Referenceabstract

Abstract class that models a set whose elements are indexed by two indices. Each element in a BivariateSet is equivalent to an ordered pair containing a row and column index, similar to indexing in a matrix. More...

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

Inheritance diagram for axom::slam::BivariateSet< PosType, ElemType >:

Public Types

using PositionType = PosType
 
using ElementType = ElemType
 
using SetType = Set< PositionType, ElementType >
 
using OrderedSetType = OrderedSet< PositionType, ElementType, policies::RuntimeSize< PositionType >, policies::RuntimeOffset< PositionType >, policies::StrideOne< PositionType >, policies::STLVectorIndirection< PositionType, ElementType > >
 

Public Member Functions

 BivariateSet (const SetType *set1=&s_nullSet, const SetType *set2=&s_nullSet)
 Constructor taking pointers to the two sets that defines the range of the indices of the BivariateSet. More...
 
virtual PositionType findElementIndex (PositionType pos1, PositionType pos2) const =0
 Searches for the SparseIndex of the element given its DenseIndex. If the element (i,j) is the kth non-zero in the row, then findElementIndex(i,j) returns k. If element (i,j) does not exist (such as the case of a zero in a sparse matrix), then INVALID_POS is returned. More...
 
virtual PositionType findElementFlatIndex (PositionType pos1, PositionType pos2) const =0
 Search for the FlatIndex of the element given its DenseIndex. More...
 
virtual PositionType findElementFlatIndex (PositionType pos1) const =0
 Searches for the first existing element given the row index (first set position). More...
 
virtual PositionType size () const =0
 Size of the BivariateSet, which is the number of non-zero entries in the BivariateSet. More...
 
virtual PositionType size (PositionType pos1) const =0
 Number of elements of the BivariateSet whose first index is pos. More...
 
PositionType firstSetSize () const
 Size of the first set. More...
 
PositionType secondSetSize () const
 Size of the second set. More...
 
virtual const SetTypegetFirstSet () const
 Returns pointer to the first set. More...
 
virtual const SetTypegetSecondSet () const
 Returns pointer to the second set. More...
 
virtual ElementType at (PositionType pos) const =0
 Returns the element at the given FlatIndex pos. More...
 
virtual const OrderedSetType getElements (PositionType s1) const =0
 A set of elements with the given first set index. More...
 
virtual bool isValid (bool verboseOutput=false) const
 
virtual void verifyPosition (PositionType s1, PositionType s2) const =0
 

Static Public Attributes

static const PositionType INVALID_POS = PositionType(-1)
 
static const NullSet< PosType, ElemType > s_nullSet
 

Protected Attributes

const SetTypem_set1
 
const SetTypem_set2
 

Detailed Description

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
class axom::slam::BivariateSet< PosType, ElemType >

Abstract class that models a set whose elements are indexed by two indices. Each element in a BivariateSet is equivalent to an ordered pair containing a row and column index, similar to indexing in a matrix.

BivariateSet models a subset of the Cartesian product of its two sets. Elements of a BivariateSet can be represented as an ordered pair of indices into the two sets.

For BivariateSets that do not model the entire Cartesian product, indices can be relative to the element positions in the original sets (in which case, we refer to them as a "DenseIndex"), or relative to the number of encoded indices, in which case we refer to them as a "SparseIndex". If we consider all the elements of a BivariateSet, we refer to this index space as the "FlatIndex".
For example, a 2 x 4 sparse matrix below:

0 1 2 3
0 a b
1 c d

Access the elements using DenseIndex (i,j) would be...
(i = 0, j = 0) = a
(i = 0, j = 2) = b
(i = 1, j = 1) = c
(i = 1, j = 3) = d
Using SparseIndex (i,k)...
(i = 0, k = 0) = a
(i = 0, k = 1) = b
(i = 1, k = 0) = c
(i = 1, k = 1) = d
Using FlatIndex [idx]...
[idx = 0] = a
[idx = 1] = b
[idx = 2] = c
[idx = 3] = d

Member Typedef Documentation

◆ PositionType

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
using axom::slam::BivariateSet< PosType, ElemType >::PositionType = PosType

◆ ElementType

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
using axom::slam::BivariateSet< PosType, ElemType >::ElementType = ElemType

◆ SetType

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
using axom::slam::BivariateSet< PosType, ElemType >::SetType = Set<PositionType, ElementType>

◆ OrderedSetType

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
using axom::slam::BivariateSet< PosType, ElemType >::OrderedSetType = OrderedSet<PositionType, ElementType, policies::RuntimeSize<PositionType>, policies::RuntimeOffset<PositionType>, policies::StrideOne<PositionType>, policies::STLVectorIndirection<PositionType, ElementType> >

Constructor & Destructor Documentation

◆ BivariateSet()

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
axom::slam::BivariateSet< PosType, ElemType >::BivariateSet ( const SetType set1 = &s_nullSet,
const SetType set2 = &s_nullSet 
)
inline

Constructor taking pointers to the two sets that defines the range of the indices of the BivariateSet.

Parameters
set1Pointer to the first Set.
set2Pointer to the second Set.

Member Function Documentation

◆ findElementIndex()

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual PositionType axom::slam::BivariateSet< PosType, ElemType >::findElementIndex ( PositionType  pos1,
PositionType  pos2 
) const
pure virtual

Searches for the SparseIndex of the element given its DenseIndex. If the element (i,j) is the kth non-zero in the row, then findElementIndex(i,j) returns k. If element (i,j) does not exist (such as the case of a zero in a sparse matrix), then INVALID_POS is returned.

Parameters
pos1The first set position.
pos2The second set position.
Returns
The DenseIndex of the given element, or INVALID_POS if such element is missing from the set.
Precondition
0 <= pos1 <= set1.size() && 0 <= pos2 <= size2.size()

Implemented in axom::slam::NullBivariateSet< PosType, ElemType >, and axom::slam::NullBivariateSet< SetPosition, SetElement >.

Referenced by axom::slam::BivariateSet< RelationType::SetPosition, RelationType::SetElement >::BivariateSet(), and axom::slam::BivariateMap< SetType, DataType, StridePolicy >::index().

◆ findElementFlatIndex() [1/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual PositionType axom::slam::BivariateSet< PosType, ElemType >::findElementFlatIndex ( PositionType  pos1,
PositionType  pos2 
) const
pure virtual

◆ findElementFlatIndex() [2/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual PositionType axom::slam::BivariateSet< PosType, ElemType >::findElementFlatIndex ( PositionType  pos1) const
pure virtual

Searches for the first existing element given the row index (first set position).

Parameters
pos1The first set position.
Returns
The found element's FlatIndex.
Precondition
0 <= pos1 <= set1.size()

Implemented in axom::slam::NullBivariateSet< PosType, ElemType >, and axom::slam::NullBivariateSet< SetPosition, SetElement >.

◆ size() [1/2]

◆ size() [2/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual PositionType axom::slam::BivariateSet< PosType, ElemType >::size ( PositionType  pos1) const
pure virtual

Number of elements of the BivariateSet whose first index is pos.

Precondition
0 <= pos1 <= set1.size()

Implemented in axom::slam::NullBivariateSet< PosType, ElemType >, and axom::slam::NullBivariateSet< SetPosition, SetElement >.

◆ firstSetSize()

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
PositionType axom::slam::BivariateSet< PosType, ElemType >::firstSetSize ( ) const
inline

◆ secondSetSize()

◆ getFirstSet()

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual const SetType* axom::slam::BivariateSet< PosType, ElemType >::getFirstSet ( ) const
inlinevirtual

Returns pointer to the first set.

◆ getSecondSet()

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual const SetType* axom::slam::BivariateSet< PosType, ElemType >::getSecondSet ( ) const
inlinevirtual

Returns pointer to the second set.

◆ at()

◆ getElements()

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual const OrderedSetType axom::slam::BivariateSet< PosType, ElemType >::getElements ( PositionType  s1) const
pure virtual

A set of elements with the given first set index.

Parameters
s1The first set index.
Returns
An OrderedSet containing the elements
Precondition
0 <= pos1 <= set1.size()

Implemented in axom::slam::NullBivariateSet< PosType, ElemType >, and axom::slam::NullBivariateSet< SetPosition, SetElement >.

Referenced by axom::slam::BivariateSet< RelationType::SetPosition, RelationType::SetElement >::getSecondSet(), and axom::slam::BivariateMap< SetType, DataType, StridePolicy >::indexSet().

◆ isValid()

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual bool axom::slam::BivariateSet< PosType, ElemType >::isValid ( bool  verboseOutput = false) const
inlinevirtual

◆ verifyPosition()

Member Data Documentation

◆ INVALID_POS

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
const PositionType axom::slam::BivariateSet< PosType, ElemType >::INVALID_POS = PositionType(-1)
static

◆ s_nullSet

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
const NullSet< PosType, ElemType > axom::slam::BivariateSet< PosType, ElemType >::s_nullSet
static

◆ m_set1

◆ m_set2


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