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

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.5.0/src/axom/slam/ProductSet.hpp>

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

Public Types

using BivariateSetType = BivariateSet< PosType, ElemType >
 
using PositionType = typename BivariateSetType::PositionType
 
using ElementType = typename BivariateSetType::ElementType
 
using SetType = typename BivariateSetType::SetType
 
using OrderedSetType = typename BivariateSetType::OrderedSetType
 
using RangeSetType = RangeSet< PosType, ElemType >
 

Public Member Functions

 ProductSet ()
 Default constructor. More...
 
 ProductSet (SetType *set1, SetType *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
 
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 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 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
 

Private Types

using SizePolicyType = policies::RuntimeSize< PosType >
 
using OffsetPolicyType = policies::RuntimeOffset< PosType >
 
using StridePolicyType = policies::StrideOne< PosType >
 
using IndirectionPolicyType = policies::NoIndirection< PosType, ElemType >
 
using SubsettingPolicyType = policies::NoSubset
 
using ModularIntType = ModularInt< policies::RuntimeSize< PosType > >
 
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 = ElemType
 
using ConstIndirectionResult = const ElemType
 
using IndirectionBufferType = struct { }
 
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< PosType, ElemType > ::ConstIndirectionResult operator[] (PositionType pos) const
 Given a position in the Set, return a position in the larger index space. More...
 
policies::NoIndirection< PosType, ElemType > ::IndirectionResult operator[] (PositionType pos)
 
ElementType at (PositionType pos) const
 Random access to the entities of the set. More...
 
PosType & size ()
 
bool empty () const
 Checks if there are any elements in the set – equivalent to: set.size() == 0. More...
 
bool isValid (PosType, PosType, PosType, 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...
 
PosType operator() () const
 
PosType & operator() ()
 
PosType operator() () const
 
PosType & operator() ()
 
const PosType operator() () const
 
IndirectionResult operator() (PosType pos) const
 
PosType offset () const
 
PosType & offset ()
 
const PosType stride () const
 
void setStride (PosType AXOM_DEBUG_PARAM(val))
 
IndirectionResult indirection (PosType pos) const
 
IndirectionBufferTypedata ()
 
bool hasIndirection () const
 
const ParentSetTypeparentSet () const
 

Private Attributes

PosType m_sz
 

Static Private Attributes

static const NullSet s_nullSet
 
OrderedSet_Size_Policies

A few default policies for the size of an OrderedSet

static const PosType DEFAULT_VALUE
 
OrderedSet_Offset_Policies

A few default policies for the offset of an OrderedSet

static const PosType DEFAULT_VALUE
 
OrderedSet_Stride_Policies

A few default policies for the stride of an OrderedSet

static const PosType DEFAULT_VALUE
 

Detailed Description

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

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

◆ BivariateSetType

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

◆ PositionType

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

◆ ElementType

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

◆ SetType

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
using axom::slam::ProductSet< PosType, ElemType >::SetType = typename BivariateSetType::SetType

◆ OrderedSetType

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
using axom::slam::ProductSet< PosType, ElemType >::OrderedSetType = typename BivariateSetType::OrderedSetType

◆ RangeSetType

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
using axom::slam::ProductSet< PosType, ElemType >::RangeSetType = RangeSet<PosType, ElemType>

Constructor & Destructor Documentation

◆ ProductSet() [1/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
axom::slam::ProductSet< PosType, ElemType >::ProductSet ( )
inline

Default constructor.

◆ ProductSet() [2/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
axom::slam::ProductSet< PosType, ElemType >::ProductSet ( SetType set1,
SetType set2 
)
inline

Member Function Documentation

◆ findElementIndex() [1/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
PositionType axom::slam::ProductSet< PosType, ElemType >::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

References axom::slam::ProductSet< PosType, ElemType >::isValidIndex().

◆ findElementFlatIndex() [1/4]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
PositionType axom::slam::ProductSet< PosType, ElemType >::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::ProductSet< PosType, ElemType >::isValidIndex(), and axom::slam::BivariateSet< PosType, ElemType >::secondSetSize().

Referenced by axom::slam::ProductSet< PosType, ElemType >::findElementFlatIndex().

◆ findElementFlatIndex() [2/4]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
PositionType axom::slam::ProductSet< PosType, ElemType >::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< PosType, ElemType >::findElementFlatIndex().

◆ getElements() [1/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
const OrderedSetType axom::slam::ProductSet< PosType, ElemType >::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< PosType, ElemType >::firstSetSize(), and SLIC_ASSERT.

◆ at() [1/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
ElementType axom::slam::ProductSet< PosType, ElemType >::at ( PositionType  pos) const
inlineoverride

◆ size() [1/3]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
PositionType axom::slam::ProductSet< PosType, ElemType >::size ( ) const
inlineoverridevirtual

◆ size() [2/3]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
PositionType axom::slam::ProductSet< PosType, ElemType >::size ( PositionType  ) const
inlineoverride

◆ isValidIndex()

◆ isValid()

◆ findElementIndex() [2/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual PositionType axom::slam::BivariateSet< PosType, ElemType >::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()

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

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

◆ findElementFlatIndex() [4/4]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual PositionType axom::slam::BivariateSet< PosType, ElemType >::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()

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

◆ size() [3/3]

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

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
inlineinherited

◆ secondSetSize()

◆ getFirstSet()

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

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
inlinevirtualinherited

Returns pointer to the second set.

◆ at() [2/2]

◆ getElements() [2/2]

template<typename PosType = slam::DefaultPositionType, typename ElemType = slam::DefaultElementType>
virtual const OrderedSetType axom::slam::BivariateSet< PosType, ElemType >::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()

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

◆ 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)
staticinherited

◆ s_nullSet

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

◆ m_set1

◆ m_set2


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