AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::slam::BivariateSet< Set1, Set2 > 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/latest/src/axom/slam/BivariateSet.hpp>

Inheritance diagram for axom::slam::BivariateSet< Set1, Set2 >:

Public Types

using FirstSetType = Set1
 
using SecondSetType = Set2
 
using PositionType = typename FirstSetType::PositionType
 
using ElementType = typename FirstSetType::ElementType
 
using NullSetType = NullSet< PositionType, ElementType >
 
using SubsetType = OrderedSet< PositionType, ElementType, policies::RuntimeSize< PositionType >, policies::RuntimeOffset< PositionType >, policies::StrideOne< PositionType >, policies::ArrayViewIndirection< PositionType, ElementType > >
 
using RangeSetType = RangeSet< PositionType, ElementType >
 

Public Member Functions

 BivariateSet (const Set1 *set1=policies::EmptySetTraits< Set1 >::emptySet(), const Set2 *set2=policies::EmptySetTraits< Set2 >::emptySet())
 Constructor taking pointers to the two sets that defines the range of the indices of the BivariateSet. More...
 
virtual ~BivariateSet ()=default
 Default virtual destructor. More...
 
virtual PositionType findElementIndex (PositionType pos1, PositionType pos2) const =0
 Searches for the SparseIndex of the element given its DenseIndex. \detail 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 AXOM_HOST_DEVICE 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 AXOM_HOST_DEVICE PositionType flatToFirstIndex (PositionType flatIndex) const =0
 Given the flat index, return the associated from-set index in the relation pair. More...
 
virtual AXOM_HOST_DEVICE PositionType flatToSecondIndex (PositionType flatIndex) const =0
 Given the flat index, return the associated to-set index in the relation pair. More...
 
virtual AXOM_HOST_DEVICE RangeSetType elementRangeSet (PositionType pos1) const =0
 Finds the range of indices of valid elements in the second set, given the index of an element in the first set. More...
 
virtual AXOM_HOST_DEVICE 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...
 
AXOM_HOST_DEVICE PositionType firstSetSize () const
 Size of the first set.
More...
 
AXOM_HOST_DEVICE PositionType secondSetSize () const
 Size of the second set.
More...
 
const FirstSetTypegetFirstSet () const
 Returns pointer to the first set.
More...
 
const SecondSetTypegetSecondSet () 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 SubsetType getElements (PositionType s1) const =0
 A set of elements with the given first set index. More...
 
virtual bool isValid (bool verboseOutput=false) const
 

Static Public Attributes

static const PositionType INVALID_POS = PositionType(-1)
 
static const NullSetType s_nullSet
 

Protected Attributes

const FirstSetTypem_set1
 
const SecondSetTypem_set2
 

Detailed Description

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
class axom::slam::BivariateSet< Set1, Set2 >

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.

\detail 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

◆ FirstSetType

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
using axom::slam::BivariateSet< Set1, Set2 >::FirstSetType = Set1

◆ SecondSetType

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
using axom::slam::BivariateSet< Set1, Set2 >::SecondSetType = Set2

◆ PositionType

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
using axom::slam::BivariateSet< Set1, Set2 >::PositionType = typename FirstSetType::PositionType

◆ ElementType

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
using axom::slam::BivariateSet< Set1, Set2 >::ElementType = typename FirstSetType::ElementType

◆ NullSetType

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
using axom::slam::BivariateSet< Set1, Set2 >::NullSetType = NullSet<PositionType, ElementType>

◆ SubsetType

◆ RangeSetType

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
using axom::slam::BivariateSet< Set1, Set2 >::RangeSetType = RangeSet<PositionType, ElementType>

Constructor & Destructor Documentation

◆ BivariateSet()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
axom::slam::BivariateSet< Set1, Set2 >::BivariateSet ( const Set1 *  set1 = policies::EmptySetTraits<Set1>::emptySet(),
const Set2 *  set2 = policies::EmptySetTraits<Set2>::emptySet() 
)
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.

◆ ~BivariateSet()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual axom::slam::BivariateSet< Set1, Set2 >::~BivariateSet ( )
virtualdefault

Default virtual destructor.

Note
BivariateSet does not own the two underlying sets

Member Function Documentation

◆ findElementIndex()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual PositionType axom::slam::BivariateSet< Set1, Set2 >::findElementIndex ( PositionType  pos1,
PositionType  pos2 
) const
pure virtual

Searches for the SparseIndex of the element given its DenseIndex. \detail 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()

◆ findElementFlatIndex() [1/2]

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual AXOM_HOST_DEVICE PositionType axom::slam::BivariateSet< Set1, Set2 >::findElementFlatIndex ( PositionType  pos1,
PositionType  pos2 
) const
pure virtual

Search for the FlatIndex of the element given its DenseIndex.

Parameters
pos1The first set position.
pos2The second set position.
Returns
The element's FlatIndex
Precondition
0 <= pos1 <= set1.size() && 0 <= pos2 <= size2.size()

◆ findElementFlatIndex() [2/2]

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual PositionType axom::slam::BivariateSet< Set1, Set2 >::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()

◆ flatToFirstIndex()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual AXOM_HOST_DEVICE PositionType axom::slam::BivariateSet< Set1, Set2 >::flatToFirstIndex ( PositionType  flatIndex) const
pure virtual

Given the flat index, return the associated from-set index in the relation pair.

Parameters
flatIndexThe FlatIndex of the from-set/to-set pair.
Returns
pos1 The from-set index.

◆ flatToSecondIndex()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual AXOM_HOST_DEVICE PositionType axom::slam::BivariateSet< Set1, Set2 >::flatToSecondIndex ( PositionType  flatIndex) const
pure virtual

Given the flat index, return the associated to-set index in the relation pair.

Parameters
flatIndexThe FlatIndex of the from-set/to-set pair.
Returns
pos2 The to-set index.

◆ elementRangeSet()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual AXOM_HOST_DEVICE RangeSetType axom::slam::BivariateSet< Set1, Set2 >::elementRangeSet ( PositionType  pos1) const
pure virtual

Finds the range of indices of valid elements in the second set, given the index of an element in the first set.

Parameters
Positionof the element in the first set
Returns
A range set of the positions in the second set

◆ size() [1/2]

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual AXOM_HOST_DEVICE PositionType axom::slam::BivariateSet< Set1, Set2 >::size ( ) const
pure virtual

Size of the BivariateSet, which is the number of non-zero entries in the BivariateSet.

Implemented in axom::slam::NullBivariateSet< SetType1, SetType2 >.

◆ size() [2/2]

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual PositionType axom::slam::BivariateSet< Set1, Set2 >::size ( PositionType  pos1) const
pure virtual

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

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

◆ firstSetSize()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
AXOM_HOST_DEVICE PositionType axom::slam::BivariateSet< Set1, Set2 >::firstSetSize ( ) const
inline

Size of the first set.

References axom::slam::BivariateSet< Set1, Set2 >::m_set1.

◆ secondSetSize()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
AXOM_HOST_DEVICE PositionType axom::slam::BivariateSet< Set1, Set2 >::secondSetSize ( ) const
inline

Size of the second set.

References axom::slam::BivariateSet< Set1, Set2 >::m_set2.

◆ getFirstSet()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
const FirstSetType* axom::slam::BivariateSet< Set1, Set2 >::getFirstSet ( ) const
inline

Returns pointer to the first set.

References axom::slam::BivariateSet< Set1, Set2 >::m_set1.

◆ getSecondSet()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
const SecondSetType* axom::slam::BivariateSet< Set1, Set2 >::getSecondSet ( ) const
inline

Returns pointer to the second set.

References axom::slam::BivariateSet< Set1, Set2 >::m_set2.

◆ at()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual ElementType axom::slam::BivariateSet< Set1, Set2 >::at ( PositionType  pos) const
pure virtual

Returns the element at the given FlatIndex pos.

◆ getElements()

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
virtual SubsetType axom::slam::BivariateSet< Set1, Set2 >::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()

◆ isValid()

template<typename Set1 , typename Set2 >
bool axom::slam::BivariateSet< Set1, Set2 >::isValid ( bool  verboseOutput = false) const
virtual

References SLIC_INFO.

Member Data Documentation

◆ INVALID_POS

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
const PositionType axom::slam::BivariateSet< Set1, Set2 >::INVALID_POS = PositionType(-1)
static

◆ s_nullSet

template<typename Set1 , typename Set2 >
const BivariateSet< Set1, Set2 >::NullSetType axom::slam::BivariateSet< Set1, Set2 >::s_nullSet
static

◆ m_set1

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
const FirstSetType* axom::slam::BivariateSet< Set1, Set2 >::m_set1
protected

◆ m_set2

template<typename Set1 = slam::Set<>, typename Set2 = slam::Set<>>
const SecondSetType* axom::slam::BivariateSet< Set1, Set2 >::m_set2
protected

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