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

A relation class with constant cardinality that supports adding, removing and modifying set relations. More...

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

Inherits CardinalityPolicy.

Public Types

enum  { INVALID_INDEX = ~0 }
 
using SetPosition = PosType
 
using SetElement = ElemType
 
using RelationVec = std::vector< SetPosition >
 
using FromSetType = DynamicSet< PosType, ElemType >
 
using ToSetType = DynamicSet< PosType, ElemType >
 
using BeginsSizePolicy = typename CardinalityPolicy::RelationalOperatorSizeType
 
using STLIndirection = policies::STLVectorIndirection< SetPosition, SetElement >
 
using RelationSubset = OrderedSet< SetPosition, SetElement, BeginsSizePolicy, policies::RuntimeOffset< SetPosition >, policies::StrideOne< SetPosition >, STLIndirection >
 
using RelationIterator = typename RelationSubset::iterator
 
using RelationIteratorPair = typename RelationSubset::iterator_pair
 
using RelationConstIterator = typename RelationSubset::const_iterator
 
using RelationConstIteratorPair = typename RelationSubset::const_iterator_pair
 

Public Member Functions

 DynamicConstantRelation ()
 Default constructor with empty set for toSet and fromSet. More...
 
 DynamicConstantRelation (FromSetType *fromSet, ToSetType *toSet)
 Construct a DynamicConstantRelation from the given fromSet to toSet. More...
 
 ~DynamicConstantRelation ()
 
SetPosition size () const
 Returns the cardinality of the FromSet. More...
 
RelationVecdata ()
 Direct access to the relation data. More...
 
const RelationVecdata () const
 Direct const access to the relation data. More...
 
DynamicConstantRelation iterator interface
RelationIterator begin (SetPosition fromSetInd)
 Returns a begin iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet. More...
 
RelationConstIterator begin (SetPosition fromSetInd) const
 Returns a begin const iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet. More...
 
RelationIterator end (SetPosition fromSetInd)
 Returns an end iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet. More...
 
RelationConstIterator end (SetPosition fromSetInd) const
 Returns a end const iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet. More...
 
RelationIteratorPair range (SetPosition fromSetInd)
 Returns an iterator range to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet. More...
 
RelationConstIteratorPair range (SetPosition fromSetInd) const
 Returns a const iterator range to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet. More...
 
DynamicConstantRelation per-element relation access functions
RelationSubset const at (SetPosition fromSetIndex) const
 Returns the const set of entities in the ToSet related to the element with index fromSetIndex in the FromSet. More...
 
RelationSubset at (SetPosition fromSetIndex)
 
RelationSubset const operator[] (SetPosition fromSetIndex) const
 Returns the const set of entities in the ToSet related to the element with index fromSetIndex in the FromSet. More...
 
RelationSubset operator[] (SetPosition fromSetIndex)
 
SetPosition size (SetPosition fromSetIndex) const
 Returns the cardinality of the set of entities in the ToSet related to the element with index fromSetIndex in the FromSet. More...
 
DynamicConstantRelation validity check functions
SetPosition numberOfValidEntries () const
 Returns the number of valid entries in the FromSet. More...
 
bool isValidEntry (SetPosition idx) const
 return if an entry is valid or not. an entry is considered valid if it has at least one valid value More...
 
bool isValid (bool verboseOutput=false) const
 Predicate to check if the DynamicConstantRelation instance is valid. More...
 
DynamicConstantRelation functions that modify the relation
void insert (SetPosition fromSetIndex, SetPosition toSetIndex)
 Inserts a new entry into the relation at the first invalid index. More...
 
void modify (SetPosition fromSetIndex, SetPosition offset, SetPosition toSetIndex)
 Function to modify the value at offset offset of the FromSet index to the value toSetIndex. More...
 
void remove (SetPosition fromSetIndex)
 Mark all values in entry fromSetIndex as invalid. More...
 

Detailed Description

template<typename PosType, typename ElemType, typename CardinalityPolicy>
class axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >

A relation class with constant cardinality that supports adding, removing and modifying set relations.

A DynamicConstantRelation encodes the relation between two sets, A FromSet and a ToSet, where the cardinality of the relation from each element of the FromSet to the ToSet is fixed to a constant value. For example, each triangle in the triangle set of a triangle mesh has three incident vertices from set of vertices.

The relation from an element of the FromSet to an element of the ToSet is considered to be valid if its entry in the FromSet is valid and at least one of its relation entities in the ToSet is valid (i.e. not equal to INVALID_INDEX).

Note
The current implementation fixes the value of INVALID_INDEX. A future update will allow users to set the value of INVALID_INDEX to a more convenient value, when necessary.

Member Typedef Documentation

◆ SetPosition

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::SetPosition = PosType

◆ SetElement

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::SetElement = ElemType

◆ RelationVec

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::RelationVec = std::vector<SetPosition>

◆ FromSetType

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::FromSetType = DynamicSet<PosType, ElemType>

◆ ToSetType

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::ToSetType = DynamicSet<PosType, ElemType>

◆ BeginsSizePolicy

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::BeginsSizePolicy = typename CardinalityPolicy::RelationalOperatorSizeType

◆ STLIndirection

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::STLIndirection = policies::STLVectorIndirection<SetPosition, SetElement>

◆ RelationSubset

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::RelationSubset = OrderedSet<SetPosition, SetElement, BeginsSizePolicy, policies::RuntimeOffset<SetPosition>, policies::StrideOne<SetPosition>, STLIndirection>

◆ RelationIterator

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::RelationIterator = typename RelationSubset::iterator

◆ RelationIteratorPair

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::RelationIteratorPair = typename RelationSubset::iterator_pair

◆ RelationConstIterator

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::RelationConstIterator = typename RelationSubset::const_iterator

◆ RelationConstIteratorPair

template<typename PosType , typename ElemType , typename CardinalityPolicy >
using axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::RelationConstIteratorPair = typename RelationSubset::const_iterator_pair

Member Enumeration Documentation

◆ anonymous enum

template<typename PosType , typename ElemType , typename CardinalityPolicy >
anonymous enum
Enumerator
INVALID_INDEX 

value to mark indices of deleted elements

Constructor & Destructor Documentation

◆ DynamicConstantRelation() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::DynamicConstantRelation ( )
inline

Default constructor with empty set for toSet and fromSet.

◆ DynamicConstantRelation() [2/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::DynamicConstantRelation ( FromSetType fromSet,
ToSetType toSet 
)
inline

◆ ~DynamicConstantRelation()

template<typename PosType , typename ElemType , typename CardinalityPolicy >
axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::~DynamicConstantRelation ( )
inline

Member Function Documentation

◆ begin() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationIterator axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::begin ( SetPosition  fromSetInd)
inline

Returns a begin iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet.

Parameters
fromSetIndThe index of the element in the FromSet
Returns
A begin iterator to the set of related elements in ToSet

◆ begin() [2/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationConstIterator axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::begin ( SetPosition  fromSetInd) const
inline

Returns a begin const iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet.

Parameters
fromSetIndThe index of the element in the FromSet
Returns
A const begin iterator to the set of related elements in ToSet

◆ end() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationIterator axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::end ( SetPosition  fromSetInd)
inline

Returns an end iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet.

Parameters
fromSetIndThe index of the element in the FromSet
Returns
An end iterator to the set of related elements in ToSet

◆ end() [2/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationConstIterator axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::end ( SetPosition  fromSetInd) const
inline

Returns a end const iterator to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet.

Parameters
fromSetIndThe index of the element in the FromSet
Returns
A const end iterator to the set of related elements in ToSet

◆ range() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationIteratorPair axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::range ( SetPosition  fromSetInd)
inline

Returns an iterator range to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet.

Parameters
fromSetIndThe index of the element in the FromSet
Returns
An iterator range (begin/end pair) to the set of related elements in ToSet

◆ range() [2/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationConstIteratorPair axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::range ( SetPosition  fromSetInd) const
inline

Returns a const iterator range to the set of entities in the ToSet that are related to the element with index fromSetInd in the FromSet.

Parameters
fromSetIndThe index of the element in the FromSet
Returns
A const iterator range (begin/end pair) to the set of related elements in ToSet

◆ at() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationSubset const axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::at ( SetPosition  fromSetIndex) const
inline

Returns the const set of entities in the ToSet related to the element with index fromSetIndex in the FromSet.

Parameters
fromSetIndexThe index of an element in the FromSet

References axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::operator[]().

◆ at() [2/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationSubset axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::at ( SetPosition  fromSetIndex)
inline

◆ operator[]() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationSubset const axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::operator[] ( SetPosition  fromSetIndex) const
inline

◆ operator[]() [2/2]

◆ size() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
SetPosition axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::size ( SetPosition  fromSetIndex) const
inline

Returns the cardinality of the set of entities in the ToSet related to the element with index fromSetIndex in the FromSet.

Parameters
fromSetIndexThe index of an element in the FromSet

◆ size() [2/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
SetPosition axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::size ( ) const
inline

◆ numberOfValidEntries()

template<typename PosType , typename ElemType , typename CardinalityPolicy >
SetPosition axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::numberOfValidEntries ( ) const
inline

Returns the number of valid entries in the FromSet.

An element of the FromSet is considered valid with respect to a DynamicConstantRelation when it is valid in the FromSet and when its relation set is not marked as invalid.

See also
isValidEntry()

References axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::isValidEntry(), and axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::size().

◆ isValidEntry()

◆ isValid()

◆ insert()

template<typename PosType , typename ElemType , typename CardinalityPolicy >
void axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::insert ( SetPosition  fromSetIndex,
SetPosition  toSetIndex 
)
inline

Inserts a new entry into the relation at the first invalid index.

Parameters
fromSetIndexThe index of the element in the FromSet
toSetIndexThe index of the element in the ToSet to associate with fromSetIndex

References axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::INVALID_INDEX, and SLIC_WARNING.

◆ modify()

template<typename PosType , typename ElemType , typename CardinalityPolicy >
void axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::modify ( SetPosition  fromSetIndex,
SetPosition  offset,
SetPosition  toSetIndex 
)
inline

Function to modify the value at offset offset of the FromSet index to the value toSetIndex.

Note
This is a temporary function until operator[] allows us to modify values.

This should be replaced with operator[] which returns a non-const RelationSubset so users can more naturally update the relation. E.g. relation[fromSetIndex][offset] = toSetIndex;

◆ remove()

template<typename PosType , typename ElemType , typename CardinalityPolicy >
void axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::remove ( SetPosition  fromSetIndex)
inline

◆ data() [1/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
RelationVec& axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::data ( )
inline

Direct access to the relation data.

◆ data() [2/2]

template<typename PosType , typename ElemType , typename CardinalityPolicy >
const RelationVec& axom::slam::DynamicConstantRelation< PosType, ElemType, CardinalityPolicy >::data ( ) const
inline

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