|
AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
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>

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 > |
| using | IteratorType = BivariateSetIterator< BivariateSet > |
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... | |
| std::optional< PositionType > | findElementIndexOptional (PositionType pos1, PositionType pos2) const |
| Finds the SparseIndex of the element given its DenseIndex. More... | |
| virtual AXOM_HOST_DEVICE PositionType | findElementFlatIndex (PositionType pos1, PositionType pos2) const =0 |
| Search for the FlatIndex of the element given its DenseIndex. More... | |
| AXOM_HOST_DEVICE std::optional< PositionType > | findElementFlatIndexOptional (PositionType pos1, PositionType pos2) const |
| Finds 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... | |
| std::optional< PositionType > | findElementFlatIndexOptional (PositionType pos1) const |
| Finds the FlatIndex of the first existing element in a row. 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 |
| 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_SUPPRESS_HD_WARN AXOM_HOST_DEVICE PositionType | secondSetSize () const |
| Size of the second set. More... | |
| const FirstSetType * | getFirstSet () const |
| Returns pointer to the first set. More... | |
| const SecondSetType * | getSecondSet () const |
| Returns pointer to the second set. More... | |
| virtual AXOM_HOST_DEVICE 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... | |
| 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... | |
| virtual bool | isValid (bool verboseOutput=false) const |
Static Public Attributes | |
| static constexpr PositionType | INVALID_POS = PositionType(-1) |
| static const NullSetType | s_nullSet |
Protected Attributes | |
| const FirstSetType * | m_set1 |
| const SecondSetType * | m_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:
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
| using axom::slam::BivariateSet< Set1, Set2 >::FirstSetType = Set1 |
| using axom::slam::BivariateSet< Set1, Set2 >::SecondSetType = Set2 |
| using axom::slam::BivariateSet< Set1, Set2 >::PositionType = typename FirstSetType::PositionType |
| using axom::slam::BivariateSet< Set1, Set2 >::ElementType = typename FirstSetType::ElementType |
| using axom::slam::BivariateSet< Set1, Set2 >::NullSetType = NullSet<PositionType, ElementType> |
| using axom::slam::BivariateSet< Set1, Set2 >::RangeSetType = RangeSet<PositionType, ElementType> |
| using axom::slam::BivariateSet< Set1, Set2 >::IteratorType = BivariateSetIterator<BivariateSet> |
|
inline |
Constructor taking pointers to the two sets that defines the range of the indices of the BivariateSet.
|
virtualdefault |
Default virtual destructor.
|
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.
| pos1 | The first set position. |
| pos2 | The second set position. |
|
inline |
Finds the SparseIndex of the element given its DenseIndex.
std::optional containing the SparseIndex if the element exists, or an empty std::optional if the element does not exist.findElementIndex(...) that avoids sentinel checks against INVALID_POS. References axom::slam::BivariateSet< Set1, Set2 >::findElementIndex(), and axom::slam::BivariateSet< Set1, Set2 >::INVALID_POS.
|
pure virtual |
Search for the FlatIndex of the element given its DenseIndex.
| pos1 | The first set position. |
| pos2 | The second set position. |
|
inline |
Finds the FlatIndex of the element given its DenseIndex.
std::optional containing the FlatIndex if the element exists, or an empty std::optional if the element does not exist.findElementFlatIndex(...) that avoids sentinel checks against INVALID_POS. References axom::slam::BivariateSet< Set1, Set2 >::findElementFlatIndex(), and axom::slam::BivariateSet< Set1, Set2 >::INVALID_POS.
|
pure virtual |
Searches for the first existing element given the row index (first set position).
| pos1 | The first set position. |
|
inline |
Finds the FlatIndex of the first existing element in a row.
std::optional containing the FlatIndex if the row contains any elements, or an empty std::optional if the row is empty.findElementFlatIndex(pos1) that avoids sentinel checks against INVALID_POS. References axom::slam::BivariateSet< Set1, Set2 >::findElementFlatIndex(), and axom::slam::BivariateSet< Set1, Set2 >::INVALID_POS.
|
pure virtual |
Given the flat index, return the associated from-set index in the relation pair.
| flatIndex | The FlatIndex of the from-set/to-set pair. |
|
pure virtual |
Given the flat index, return the associated to-set index in the relation pair.
| flatIndex | The FlatIndex of the from-set/to-set pair. |
|
pure virtual |
Finds the range of indices of valid elements in the second set, given the index of an element in the first set.
| Position | of the element in the first set |
|
pure virtual |
The number of non-zero entries in the BivariateSet.
Implemented in axom::slam::NullBivariateSet< SetType1, SetType2 >.
|
pure virtual |
Number of elements of the BivariateSet whose first index is pos.
|
inline |
Size of the first set.
References axom::slam::BivariateSet< Set1, Set2 >::m_set1.
|
inline |
Size of the second set.
References axom::slam::BivariateSet< Set1, Set2 >::m_set2.
|
inline |
Returns pointer to the first set.
References axom::slam::BivariateSet< Set1, Set2 >::m_set1.
|
inline |
Returns pointer to the second set.
References axom::slam::BivariateSet< Set1, Set2 >::m_set2.
|
pure virtual |
Returns the element at the given FlatIndex pos.
|
pure virtual |
A set of elements with the given first set index.
| s1 | The first set index. |
|
inline |
Return an iterator to the first pair of set elements in the relation.
|
inline |
Return an iterator to one past the last pair of set elements in the relation.
References axom::slam::BivariateSet< Set1, Set2 >::size().
|
virtual |
References SLIC_INFO.
|
staticconstexpr |
|
static |
|
protected |
|
protected |