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

Models a set whose element is the Cartesian product of two sets. The number of elements in this set is the product of the sizes of the two input sets. More...

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

Inheritance diagram for axom::slam::ProductSet< SetType1, SetType2 >:

Public Types

using RangeSetType = RangeSet< typename SetType1::PositionType, typename SetType1::ElementType >
 
using FirstSetType = SetType1
 
using SecondSetType = SetType2
 
using BivariateSetType = BivariateSet< FirstSetType, SecondSetType >
 
using PositionType = typename BivariateSetType::PositionType
 
using ElementType = typename BivariateSetType::ElementType
 
using OrderedSetType = typename BivariateSetType::OrderedSetType
 
using ProductSetType = ProductSet< SetType1, SetType2 >
 
using NullSetType = NullSet< PositionType, ElementType >
 

Public Member Functions

 ProductSet ()
 Default constructor. More...
 
 ProductSet (const FirstSetType *set1, const SecondSetType *set2)
 Constructor taking in pointers of two Sets. More...
 
PositionType findElementIndex (PositionType pos1, PositionType pos2) const override
 Return the element SparseIndex. Since ProductSet is the full Cartesian product of the two sets, the SparseIndex is the same as its DenseIndex, which is the same as the pos2 parameter. More...
 
PositionType findElementFlatIndex (PositionType pos1, PositionType pos2) const override
 Returns an element's FlatIndex given its DenseIndex. Since ProductSet is the full Cartesian product of the two sets, an element's FlatIndex is equal to pos1*secondSetSize()+pos2. More...
 
PositionType findElementFlatIndex (PositionType pos1) const override
 Returns the FlatIndex of the first element in the specified row. This is equal to pos1*secondSetSize(). More...
 
const OrderedSetType getElements (PositionType AXOM_DEBUG_PARAM(pos1)) const override
 Return all elements from the second set associated with position pos1 in the first set. More...
 
ElementType at (PositionType pos) const override
 
PositionType size () const override
 Size of the BivariateSet, which is the number of non-zero entries in the BivariateSet. More...
 
PositionType size (PositionType) const override
 
RangeSetType elementRangeSet (PositionType pos1) const override
 
bool isValidIndex (PositionType s1, PositionType s2) const
 
bool isValid (bool verboseOutput=false) const override
 
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 PositionType INVALID_POS
 
static const NullSetType s_nullSet
 

Protected Attributes

const FirstSetTypem_set1
 
const SecondSetTypem_set2
 

Private Types

using SizePolicyType = policies::RuntimeSize< SetType1::PositionType >
 
using OffsetPolicyType = policies::RuntimeOffset< SetType1::PositionType >
 
using StridePolicyType = policies::StrideOne< SetType1::PositionType >
 
using IndirectionPolicyType = policies::NoIndirection< SetType1::PositionType, SetType1::ElementType >
 
using SubsettingPolicyType = policies::NoSubset
 
using ModularIntType = ModularInt< policies::RuntimeSize< SetType1::PositionType > >
 
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 = SetType1::ElementType
 
using ConstIndirectionResult = const SetType1::ElementType
 
using IndirectionBufferType = struct { }
 
using IndirectionPtrType = IndirectionBufferType *
 
using ParentSetType = const Set<>
 

Private Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator_pair range ()
 
const_iterator_pair range () const
 
policies::NoIndirection< SetType1::PositionType, SetType1::ElementType > ::ConstIndirectionResult operator[] (PositionType pos) const
 Given a position in the Set, return a position in the larger index space. More...
 
policies::NoIndirection< SetType1::PositionType, SetType1::ElementType > ::IndirectionResult operator[] (PositionType pos)
 
ElementType at (PositionType pos) const
 Random access to the entities of the set. More...
 
SetType1::PositionType & size ()
 
bool empty () const
 Checks if there are any elements in the set – equivalent to: set.size() == 0. More...
 
bool isValid (SetType1::PositionType, SetType1::PositionType, SetType1::PositionType, 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...
 
SetType1::PositionType operator() () const
 
SetType1::PositionType & operator() ()
 
SetType1::PositionType operator() () const
 
SetType1::PositionType & operator() ()
 
const SetType1::PositionType operator() () const
 
IndirectionResult operator() (SetType1::PositionType pos) const
 
SetType1::PositionType offset () const
 
SetType1::PositionType & offset ()
 
const SetType1::PositionType stride () const
 
void setStride (SetType1::PositionType AXOM_DEBUG_PARAM(val))
 
IndirectionResult indirection (SetType1::PositionType pos) const
 
IndirectionBufferTypedata ()
 
bool hasIndirection () const
 
const ParentSetTypeparentSet () const
 

Private Attributes

SetType1::PositionType m_sz
 

Static Private Attributes

static const bool IS_COMPILE_TIME
 
static AXOM_EXPORT const NullSet s_nullSet
 
OrderedSet_Size_Policies

A few default policies for the size of an OrderedSet

static const SetType1::PositionType DEFAULT_VALUE
 
OrderedSet_Offset_Policies

A few default policies for the offset of an OrderedSet

static const SetType1::PositionType DEFAULT_VALUE
 
OrderedSet_Stride_Policies

A few default policies for the stride of an OrderedSet

static const SetType1::PositionType DEFAULT_VALUE
 

Detailed Description

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

Models a set whose element is the Cartesian product of two sets. The number of elements in this set is the product of the sizes of the two input sets.

Users should refer to the BivariateSet documentation for descriptions of the different indexing names (SparseIndex, DenseIndex, FlatIndex).

See also
BivariateSet

Member Typedef Documentation

◆ RangeSetType

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::ProductSet< SetType1, SetType2 >::RangeSetType = RangeSet<typename SetType1::PositionType, typename SetType1::ElementType>

◆ FirstSetType

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::ProductSet< SetType1, SetType2 >::FirstSetType = SetType1

◆ SecondSetType

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

◆ BivariateSetType

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::ProductSet< SetType1, SetType2 >::BivariateSetType = BivariateSet<FirstSetType, SecondSetType>

◆ PositionType

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::ProductSet< SetType1, SetType2 >::PositionType = typename BivariateSetType::PositionType

◆ ElementType

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::ProductSet< SetType1, SetType2 >::ElementType = typename BivariateSetType::ElementType

◆ OrderedSetType

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

◆ ProductSetType

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
using axom::slam::ProductSet< SetType1, SetType2 >::ProductSetType = ProductSet<SetType1, SetType2>

◆ NullSetType

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

Constructor & Destructor Documentation

◆ ProductSet() [1/2]

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
axom::slam::ProductSet< SetType1, SetType2 >::ProductSet ( )
inline

Default constructor.

◆ ProductSet() [2/2]

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
axom::slam::ProductSet< SetType1, SetType2 >::ProductSet ( const FirstSetType set1,
const SecondSetType set2 
)
inline

Constructor taking in pointers of two Sets.

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

References axom::slam::BivariateSet< SetType1, SetType2 >::secondSetSize().

Member Function Documentation

◆ findElementIndex() [1/2]

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

Return the element SparseIndex. Since ProductSet is the full Cartesian product of the two sets, the SparseIndex is the same as its DenseIndex, which is the same as the pos2 parameter.

Parameters
pos1The first set position.
pos2The second set position.
Returns
The element's SparseIndex, which is the same as pos2

◆ findElementFlatIndex() [1/4]

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

Returns an element's FlatIndex given its DenseIndex. Since ProductSet is the full Cartesian product of the two sets, an element's FlatIndex is equal to pos1*secondSetSize()+pos2.

Parameters
pos1The first set position.
pos2The second set position.
Returns
The element's FlatIndex.

References axom::slam::BivariateSet< SetType1, SetType2 >::secondSetSize().

◆ findElementFlatIndex() [2/4]

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

Returns the FlatIndex of the first element in the specified row. This is equal to pos1*secondSetSize().

Parameters
pos1The first set position that specifies the row.

References axom::slam::ProductSet< SetType1, SetType2 >::findElementFlatIndex().

◆ getElements() [1/2]

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
const OrderedSetType axom::slam::ProductSet< SetType1, SetType2 >::getElements ( PositionType   AXOM_DEBUG_PARAMpos1) const
inlineoverride

Return all elements from the second set associated with position pos1 in the first set.

Parameters
pos1The first set position that specifies the row.
Returns
An OrderedSet of the elements in the row.

References axom::slam::BivariateSet< SetType1, SetType2 >::firstSetSize(), and SLIC_ASSERT.

◆ at() [1/2]

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

◆ size() [1/3]

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

◆ size() [2/3]

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

◆ elementRangeSet() [1/2]

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
RangeSetType axom::slam::ProductSet< SetType1, SetType2 >::elementRangeSet ( PositionType  pos1) const
inlineoverride

◆ isValidIndex()

template<typename SetType1 = slam::Set<>, typename SetType2 = slam::Set<>>
bool axom::slam::ProductSet< SetType1, SetType2 >::isValidIndex ( PositionType  s1,
PositionType  s2 
) const
inline

◆ isValid()

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

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

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

◆ INVALID_POS

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

◆ s_nullSet

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: