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

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/v0.7.0/src/axom/slam/RelationSet.hpp>

Inheritance diagram for axom::slam::RelationSet< Relation, SetType1, SetType2 >:

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 OrderedSetType = typename BivariateSetType::OrderedSetType
 
using SizePolicyType = policies::RuntimeSize< Relation::SetPosition >
 
using OffsetPolicyType = policies::ZeroOffset< Relation::SetPosition >
 
using StridePolicyType = policies::StrideOne< Relation::SetPosition >
 
using IndirectionPolicyType = policies::NoIndirection< Relation::SetPosition, Relation::SetElement >
 
using SubsettingPolicyType = policies::NoSubset
 
using ModularIntType = ModularInt< policies::RuntimeSize< Relation::SetPosition > >
 
using PositionSet = OrderedSet< PositionType >
 
using const_iterator = OrderedSetIterator< ElementType, true >
 
using const_iterator_pair = std::pair< const_iterator, const_iterator >
 
using iterator = OrderedSetIterator< ElementType, false >
 
using iterator_pair = std::pair< iterator, iterator >
 
using IndirectionResult = Relation::SetElement
 
using ConstIndirectionResult = const Relation::SetElement
 
using IndirectionBufferType = struct { }
 
using IndirectionPtrType = IndirectionBufferType *
 
using ParentSetType = const Set<>
 
using NullSetType = NullSet< PositionType, ElementType >
 

Public Member Functions

 RelationSet ()=default
 
 RelationSet (RelationType *relation)
 Constructor taking in the relation this BivariateSet is based on. More...
 
PositionType findElementIndex (PositionType pos1, PositionType pos2) const override
 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...
 
PositionType findElementFlatIndex (PositionType s1, PositionType s2) const override
 Search for the FlatIndex of the element given its DenseIndex. More...
 
PositionType findElementFlatIndex (PositionType pos1) const override
 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...
 
RangeSetType elementRangeSet (PositionType pos1) const override
 
const OrderedSetType getElements (PositionType s1) const override
 A set of elements with the given first set index. More...
 
ElementType at (PositionType pos) const override
 
RelationTypegetRelation () const
 Returns the relation pointer. More...
 
RelationTypegetRelation ()
 
PositionType totalSize () const
 Return the size of the relation. More...
 
PositionType size (PositionType pos) const override
 Return the size of a row, which is the number of to-set elements associated with the given from-set index. More...
 
bool isValid (bool verboseOutput=false) const override
 
PositionType size () const override
 Size of the BivariateSet, which is the number of non-zero entries in the BivariateSet. More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator_pair range ()
 
const_iterator_pair range () const
 
policies::NoIndirection< Relation::SetPosition, Relation::SetElement > ::ConstIndirectionResult operator[] (PositionType pos) const
 Given a position in the Set, return a position in the larger index space. More...
 
policies::NoIndirection< Relation::SetPosition, Relation::SetElement > ::IndirectionResult operator[] (PositionType pos)
 
ElementType at (PositionType pos) const
 Random access to the entities of the set. More...
 
Relation::SetPositionsize ()
 
bool empty () const
 Checks if there are any elements in the set – equivalent to: set.size() == 0. More...
 
bool isValid (Relation::SetPosition, Relation::SetPosition, Relation::SetPosition, bool) const
 
template<typename OrderedSetIt >
bool isValid (OrderedSetIt, OrderedSetIt, bool) const
 
bool isSubset () const
 Determines if the Set is a Subset of another set. More...
 
bool isValidIndex (PositionType pos) const
 checks whether the given position (index) is valid. More...
 
PositionSet positions () const
 returns a PositionSet over the set's positions More...
 
Relation::SetPosition operator() () const
 
Relation::SetPositionoperator() ()
 
Relation::SetPosition operator() () const
 
const Relation::SetPosition operator() () const
 
IndirectionResult operator() (Relation::SetPosition pos) const
 
Relation::SetPosition offset () const
 
const Relation::SetPosition stride () const
 
void setStride (Relation::SetPosition AXOM_DEBUG_PARAM(val))
 
IndirectionResult indirection (Relation::SetPosition pos) const
 
IndirectionBufferTypedata ()
 
bool hasIndirection () const
 
const ParentSetTypeparentSet () const
 
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 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 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...
 
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 const OrderedSetType getElements (PositionType s1) const=0
 A set of elements with the given first set index. More...
 
virtual void verifyPosition (PositionType s1, PositionType s2) const=0
 

Static Public Attributes

static const bool IS_COMPILE_TIME
 
static AXOM_EXPORT const NullSet s_nullSet
 
static const PositionType INVALID_POS
 
static const NullSetType s_nullSet
 
OrderedSet_Size_Policies

A few default policies for the size of an OrderedSet

static const Relation::SetPosition DEFAULT_VALUE
 
OrderedSet_Offset_Policies

A few default policies for the offset of an OrderedSet

static const Relation::SetPosition DEFAULT_VALUE
 
OrderedSet_Stride_Policies

A few default policies for the stride of an OrderedSet

static const Relation::SetPosition DEFAULT_VALUE
 

Protected Attributes

Relation::SetPosition m_sz
 
const FirstSetTypem_set1
 
const SecondSetTypem_set2
 

Detailed Description

template<typename Relation, typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
class axom::slam::RelationSet< Relation, SetType1, SetType2 >

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 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::RelationSet< Relation, SetType1, SetType2 >::FirstSetType = SetType1

◆ SecondSetType

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::RelationSet< Relation, SetType1, SetType2 >::SecondSetType = SetType2

◆ RelationType

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::RelationSet< Relation, SetType1, SetType2 >::RelationType = Relation

◆ PositionType

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::RelationSet< Relation, SetType1, SetType2 >::PositionType = typename RelationType::SetPosition

◆ ElementType

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::RelationSet< Relation, SetType1, SetType2 >::ElementType = typename RelationType::SetElement

◆ RelationSubset

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::RelationSet< Relation, SetType1, SetType2 >::RelationSubset = typename RelationType::RelationSubset

◆ OrderedSetType

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::RelationSet< Relation, SetType1, SetType2 >::OrderedSetType = typename BivariateSetType::OrderedSetType

◆ SizePolicyType

◆ OffsetPolicyType

◆ StridePolicyType

◆ IndirectionPolicyType

◆ SubsettingPolicyType

◆ ModularIntType

◆ PositionSet

◆ const_iterator

◆ const_iterator_pair

◆ iterator

◆ iterator_pair

◆ IndirectionResult

◆ ConstIndirectionResult

◆ IndirectionBufferType

◆ IndirectionPtrType

◆ ParentSetType

◆ NullSetType

using axom::slam::BivariateSet< SetType1 , SetType2 >::NullSetType = NullSet<PositionType, ElementType>
inherited

Constructor & Destructor Documentation

◆ RelationSet() [1/2]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
axom::slam::RelationSet< Relation, SetType1, SetType2 >::RelationSet ( )
default

◆ RelationSet() [2/2]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
axom::slam::RelationSet< Relation, SetType1, SetType2 >::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() [1/2]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2 >::findElementIndex ( PositionType  pos1,
PositionType  pos2 
) const
inlineoverride

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.

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()

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

◆ findElementFlatIndex() [1/4]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2 >::findElementFlatIndex ( PositionType  s1,
PositionType  s2 
) const
inlineoverride

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()

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

◆ findElementFlatIndex() [2/4]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2 >::findElementFlatIndex ( PositionType  pos1) const
inlineoverride

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.

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

◆ elementRangeSet() [1/2]

◆ getElements() [1/2]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
const OrderedSetType axom::slam::RelationSet< Relation, SetType1, SetType2 >::getElements ( PositionType  s1) const
inlineoverride

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() [1/3]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
ElementType axom::slam::RelationSet< Relation, SetType1, SetType2 >::at ( PositionType  pos) const
inlineoverride

◆ getRelation() [1/2]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
RelationType* axom::slam::RelationSet< Relation, SetType1, SetType2 >::getRelation ( ) const
inline

Returns the relation pointer.

◆ getRelation() [2/2]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
RelationType* axom::slam::RelationSet< Relation, SetType1, SetType2 >::getRelation ( )
inline

◆ totalSize()

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2 >::totalSize ( ) const
inline

Return the size of the relation.

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

◆ size() [1/4]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2 >::size ( PositionType  pos) const
inlineoverride

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().

◆ isValid() [1/3]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
bool axom::slam::RelationSet< Relation, SetType1, SetType2 >::isValid ( bool  verboseOutput = false) const
inlineoverridevirtual

◆ size() [2/4]

template<typename Relation , typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
PositionType axom::slam::RelationSet< Relation, SetType1, SetType2 >::size ( ) const
inlineoverridevirtual

◆ begin() [1/2]

◆ begin() [2/2]

◆ end() [1/2]

◆ end() [2/2]

◆ range() [1/2]

◆ range() [2/2]

◆ operator[]() [1/2]

◆ operator[]() [2/2]

◆ at() [2/3]

Random access to the entities of the set.

Parameters
Theindex of the desired element
Returns
The value of the element at the given position
Precondition
The position must be less than the number of elements in the set ( size() )
Note
Concrete realizations of Set also support subscript operator – operator[].
How are we planning to handle indexes that are out or range (accidentally)? Are we planning to handle indexes that are intentionally out of range (e.g. to indicate a problem, or a missing element etc..)?

Implements axom::slam::Set< Relation::SetPosition, Relation::SetElement >.

References axom::slam::OrderedSet< PosType, ElemType, SizePolicy, OffsetPolicy, StridePolicy, IndirectionPolicy, SubsettingPolicy >::operator[]().

◆ size() [3/4]

◆ empty()

◆ isValid() [2/3]

◆ isValid() [3/3]

template<typename OrderedSetIt >
bool axom::slam::policies::NoSubset::isValid ( OrderedSetIt  ,
OrderedSetIt  ,
bool   
) const
inlineinherited

◆ isSubset()

◆ isValidIndex()

◆ positions()

◆ operator()() [1/5]

◆ operator()() [2/5]

◆ operator()() [3/5]

◆ operator()() [4/5]

const Relation::SetPosition axom::slam::policies::StrideOne< Relation::SetPosition >::operator() ( ) const
inlineinherited

◆ operator()() [5/5]

◆ offset()

◆ stride()

◆ setStride()

void axom::slam::policies::StrideOne< Relation::SetPosition >::setStride ( Relation::SetPosition  AXOM_DEBUG_PARAMval)
inlineinherited

◆ indirection()

◆ data()

◆ hasIndirection()

bool axom::slam::policies::NoIndirection< Relation::SetPosition , Relation::SetElement >::hasIndirection ( ) const
inlineinherited

◆ parentSet()

const ParentSetType* axom::slam::policies::NoSubset::parentSet ( ) const
inlineinherited

◆ findElementIndex() [2/2]

virtual PositionType axom::slam::BivariateSet< SetType1 , SetType2 >::findElementIndex ( PositionType  pos1,
PositionType  pos2 
) const
pure virtualinherited

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()

◆ findElementFlatIndex() [3/4]

virtual PositionType axom::slam::BivariateSet< SetType1 , SetType2 >::findElementFlatIndex ( PositionType  pos1,
PositionType  pos2 
) const
pure virtualinherited

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() [4/4]

virtual PositionType axom::slam::BivariateSet< SetType1 , SetType2 >::findElementFlatIndex ( PositionType  pos1) const
pure virtualinherited

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()

◆ elementRangeSet() [2/2]

virtual RangeSetType axom::slam::BivariateSet< SetType1 , SetType2 >::elementRangeSet ( PositionType  pos1) const
pure virtualinherited

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() [4/4]

virtual PositionType axom::slam::BivariateSet< SetType1 , SetType2 >::size ( PositionType  pos1) const
pure virtualinherited

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

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

◆ firstSetSize()

PositionType axom::slam::BivariateSet< SetType1 , SetType2 >::firstSetSize ( ) const
inlineinherited

Size of the first set.

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

◆ secondSetSize()

PositionType axom::slam::BivariateSet< SetType1 , SetType2 >::secondSetSize ( ) const
inlineinherited

Size of the second set.

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

◆ getFirstSet()

const FirstSetType* axom::slam::BivariateSet< SetType1 , SetType2 >::getFirstSet ( ) const
inlineinherited

Returns pointer to the first set.

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

◆ getSecondSet()

◆ at() [3/3]

virtual ElementType axom::slam::BivariateSet< SetType1 , SetType2 >::at ( PositionType  pos) const
pure virtualinherited

Returns the element at the given FlatIndex pos.

◆ getElements() [2/2]

virtual const OrderedSetType axom::slam::BivariateSet< SetType1 , SetType2 >::getElements ( PositionType  s1) const
pure virtualinherited

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()

◆ verifyPosition()

virtual void axom::slam::BivariateSet< SetType1 , SetType2 >::verifyPosition ( PositionType  s1,
PositionType  s2 
) const
pure virtualinherited

Member Data Documentation

◆ DEFAULT_VALUE [1/3]

◆ DEFAULT_VALUE [2/3]

◆ DEFAULT_VALUE [3/3]

◆ m_sz

◆ IS_COMPILE_TIME

const bool axom::slam::policies::StrideOne< Relation::SetPosition >::IS_COMPILE_TIME
staticinherited

◆ s_nullSet [1/2]

AXOM_EXPORT const NullSet axom::slam::policies::NoSubset::s_nullSet
staticinherited

◆ INVALID_POS

const PositionType axom::slam::BivariateSet< SetType1 , SetType2 >::INVALID_POS
staticinherited

◆ s_nullSet [2/2]

const BivariateSet< SetType1 , SetType2 >::NullSetType axom::slam::BivariateSet< SetType1 , SetType2 >::s_nullSet
staticinherited

◆ m_set1

const FirstSetType* axom::slam::BivariateSet< SetType1 , SetType2 >::m_set1
protectedinherited

◆ m_set2

const SecondSetType* axom::slam::BivariateSet< SetType1 , SetType2 >::m_set2
protectedinherited

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