AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType > Class Template Referencefinal

Models a Set whose elements are derived from a relation, one element per fromSet and toSet pair in the relation. More...

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

Inherits policies::BivariateSetInterface< policies::VirtualInterface, typename Relation::FromSetType, typename Relation::ToSetType >.

Public Types

using FirstSetType = SetType1
 
using SecondSetType = SetType2
 
using RelationType = Relation
 
using PositionType = typename RelationType::SetPosition
 
using ElementType = typename RelationType::SetElement
 
using RelationSubset = typename RelationType::RelationSubset
 
using SubsetType = std::conditional_t< std::is_same< void, BaseSubsetType >::value, RelationSubset, BaseSubsetType >
 
using IteratorType = BivariateSetIterator< RelationSet >
 
using ConcreteSet = RelationSet< Relation, SetType1, SetType2, policies::ConcreteInterface >
 
using VirtualSet = RelationSet< Relation, SetType1, SetType2, policies::VirtualInterface >
 
using OtherSet = std::conditional_t< std::is_same< InterfaceType, policies::VirtualInterface >::value, ConcreteSet, VirtualSet >
 

Public Member Functions

 RelationSet (const OtherSet &other)
 
 RelationSet ()=default
 
 RelationSet (RelationType *relation)
 Constructor taking in the relation this BivariateSet is based on. More...
 
PositionType findElementIndex (PositionType pos1, PositionType pos2) const
 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...
 
AXOM_HOST_DEVICE PositionType findElementFlatIndex (PositionType s1, PositionType s2) const
 Search for the FlatIndex of the element given its DenseIndex. More...
 
PositionType findElementFlatIndex (PositionType pos1) const
 Given the from-set index pos1, return the FlatIndex of the first existing to-set element in the relation pair, or INVALID_POS if this row contains no elements. More...
 
AXOM_HOST_DEVICE PositionType flatToSecondIndex (PositionType flatIndex) const
 Given the flat index, return the associated to-set index in the relation pair. More...
 
AXOM_HOST_DEVICE PositionType flatToFirstIndex (PositionType flatIndex) const
 Given the flat index, return the associated from-set index in the relation pair. More...
 
AXOM_HOST_DEVICE RangeSetType elementRangeSet (PositionType pos1) const
 
SubsetType getElements (PositionType s1) const
 A set of elements with the given first set index. More...
 
AXOM_HOST_DEVICE ElementType at (PositionType pos) const
 
RelationTypegetRelation () const
 Returns the relation pointer
More...
 
RelationTypegetRelation ()
 
PositionType totalSize () const
 Return the size of the relation
More...
 
PositionType size (PositionType pos) const
 Return the size of a row, which is the number of to-set elements associated with the given from-set index. More...
 
IteratorType begin () const
 Return an iterator to the first pair of set elements in the relation. More...
 
IteratorType end () const
 Return an iterator to one past the last pair of set elements in the relation. More...
 
bool isValid (bool verboseOutput=false) const
 
AXOM_HOST_DEVICE PositionType size () const
 

Detailed Description

template<typename Relation, typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
class axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >

Models a Set whose elements are derived from a relation, one element per fromSet and toSet pair in the relation.

RelationSet models a subset of the Cartesian product of two sets. Users should refer to the BivariateSet documentation for descriptions of the different indexing names (SparseIndex, DenseIndex, FlatIndex).

Template Parameters
RelationThe Relation type that this set uses.
See also
BivariateSet

Member Typedef Documentation

◆ FirstSetType

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::FirstSetType = SetType1

◆ SecondSetType

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::SecondSetType = SetType2

◆ RelationType

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::RelationType = Relation

◆ PositionType

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::PositionType = typename RelationType::SetPosition

◆ ElementType

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::ElementType = typename RelationType::SetElement

◆ RelationSubset

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::RelationSubset = typename RelationType::RelationSubset

◆ SubsetType

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::SubsetType = std::conditional_t<std::is_same<void, BaseSubsetType>::value, RelationSubset, BaseSubsetType>

◆ IteratorType

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::IteratorType = BivariateSetIterator<RelationSet>

◆ ConcreteSet

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::ConcreteSet = RelationSet<Relation, SetType1, SetType2, policies::ConcreteInterface>

◆ VirtualSet

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::VirtualSet = RelationSet<Relation, SetType1, SetType2, policies::VirtualInterface>

◆ OtherSet

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
using axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::OtherSet = std::conditional_t<std::is_same<InterfaceType, policies::VirtualInterface>::value, ConcreteSet, VirtualSet>

Constructor & Destructor Documentation

◆ RelationSet() [1/3]

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::RelationSet ( const OtherSet other)
inline

◆ RelationSet() [2/3]

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::RelationSet ( )
default

◆ RelationSet() [3/3]

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::RelationSet ( RelationType relation)
inline

Constructor taking in the relation this BivariateSet is based on.

Precondition
relation pointer must not be a null pointer

References SLIC_ASSERT.

Member Function Documentation

◆ findElementIndex()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::findElementIndex ( PositionType  pos1,
PositionType  pos2 
) const
inline

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.

Warning
This function can be slow, since a linear search is performed on the row each time.
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 Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
AXOM_HOST_DEVICE PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::findElementFlatIndex ( PositionType  s1,
PositionType  s2 
) const
inline

Search for the FlatIndex of the element given its DenseIndex.

Warning
This function can be slow, since a linear search is performed on the row each time.
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 Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::findElementFlatIndex ( PositionType  pos1) const
inline

Given the from-set index pos1, return the FlatIndex of the first existing to-set element in the relation pair, or INVALID_POS if this row contains no elements.

Parameters
pos1Index into the from-set.
pos2Index into the to-set.
Returns
The FlatIndex of the first existing to-set element.

◆ flatToSecondIndex()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
AXOM_HOST_DEVICE PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::flatToSecondIndex ( PositionType  flatIndex) const
inline

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.

References axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::size(), and SLIC_ASSERT.

◆ flatToFirstIndex()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
AXOM_HOST_DEVICE PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::flatToFirstIndex ( PositionType  flatIndex) const
inline

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.

References axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::size(), and SLIC_ASSERT.

◆ elementRangeSet()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
AXOM_HOST_DEVICE RangeSetType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::elementRangeSet ( PositionType  pos1) const
inline

◆ getElements()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
SubsetType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::getElements ( PositionType  s1) const
inline

A set of elements with the given first set index.

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

◆ at()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
AXOM_HOST_DEVICE ElementType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::at ( PositionType  pos) const
inline

◆ getRelation() [1/2]

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
RelationType* axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::getRelation ( ) const
inline

Returns the relation pointer

◆ getRelation() [2/2]

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
RelationType* axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::getRelation ( )
inline

◆ totalSize()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::totalSize ( ) const
inline

Return the size of the relation

References axom::slam::Relation< PosType, ElemType >::size().

◆ size() [1/2]

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::size ( PositionType  pos) const
inline

Return the size of a row, which is the number of to-set elements associated with the given from-set index.

Parameters
posThe from-set position.

References axom::slam::Relation< PosType, ElemType >::size().

◆ begin()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
IteratorType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::begin ( ) const
inline

Return an iterator to the first pair of set elements in the relation.

◆ end()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
IteratorType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::end ( ) const
inline

Return an iterator to one past the last pair of set elements in the relation.

References axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::totalSize().

◆ isValid()

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
bool axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::isValid ( bool  verboseOutput = false) const
inline

◆ size() [2/2]

template<typename Relation , typename SetType1 = typename Relation::FromSetType, typename SetType2 = typename Relation::ToSetType, typename InterfaceType = policies::VirtualInterface>
AXOM_HOST_DEVICE PositionType axom::slam::RelationSet< Relation, SetType1, SetType2, InterfaceType >::size ( ) const
inline

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