Regina 7.3 Calculation Engine
Public Member Functions | List of all members
regina::DiscSetSurfaceDataImpl< TetData > Class Template Reference

Stores a piece of data alongside every normal disc within a particular normal surface. More...

#include <surface/disc.h>

Public Member Functions

 DiscSetSurfaceDataImpl (const NormalSurface &surface)
 Creates a new disc set corresponding to the discs of the given normal surface. More...
 
 DiscSetSurfaceDataImpl (const NormalSurface &surface, const typename TetData::Data &initValue)
 Creates a new disc set corresponding to the discs of the given normal surface. More...
 
 DiscSetSurfaceDataImpl (const DiscSetSurfaceDataImpl &src)
 Creates a new copy of the given set of normal discs. More...
 
 DiscSetSurfaceDataImpl (DiscSetSurfaceDataImpl &&src) noexcept
 Moves the contents of the given disc set into this new disc set. More...
 
 ~DiscSetSurfaceDataImpl ()
 Destroys this set of discs and deallocates all associated memory. More...
 
DiscSetSurfaceDataImploperator= (const DiscSetSurfaceDataImpl &src)
 Sets this to be a copy of the given disc set. More...
 
DiscSetSurfaceDataImploperator= (DiscSetSurfaceDataImpl &&src) noexcept
 Moves the contents of the given disc set into this disc set. More...
 
void swap (DiscSetSurfaceDataImpl &other) noexcept
 Swaps the contents of this and the given disc set. More...
 
bool operator== (const DiscSetSurfaceDataImpl &other) const
 Determines whether this and the given set have the same number of discs of each type in each tetrahedron, and contain the same data for corresponding discs. More...
 
bool operator!= (const DiscSetSurfaceDataImpl &other) const
 Determines whether this and the given set have different numbers of discs of some type in some tetrahedron, or contain different data for some pair of corresponding discs. More...
 
size_t nTets () const
 Returns the number of tetrahedra in the underlying triangulation. More...
 
unsigned long nDiscs (size_t tetIndex, int type) const
 Determines the number of discs of the given type inside the given tetrahedron. More...
 
TetData & tetDiscs (size_t tetIndex) const
 Returns the specific set of discs living inside the given tetrahedron. More...
 
TetData::Data & data (const DiscSpec &disc)
 Retrieves a reference to the data corresponding to the given normal disc. More...
 
std::optional< std::pair< DiscSpec, Perm< 4 > > > adjacentDisc (const DiscSpec &disc, Perm< 4 > arc) const
 Determines which normal disc is adjacent to the given normal disc along the given directed normal arc in the surface described by this disc set. More...
 
DiscSpecIterator< TetData > begin () const
 Returns a C++ iterator at the beginning of the range of all normal discs in the underlying normal surface. More...
 
DiscSpecIterator< TetData > end () const
 Returns a C++ iterator at the end of the range of all normal discs in the underlying normal surface. More...
 
auto __iter__ () const
 Returns a Python iterator over all normal discs in the underlying normal surface. More...
 

Detailed Description

template<class TetData>
class regina::DiscSetSurfaceDataImpl< TetData >

Stores a piece of data alongside every normal disc within a particular normal surface.

End users should not refer to this class directly; instead use one of the type aliases DiscSetSurfaceData<T> or DiscSetSurface.

This class implements C++ move semantics and adheres to the C++ Swappable requirement. It is designed to avoid deep copies wherever possible, even when passing or returning objects by value.

Template Parameters
TetDataThis must be either (1) DiscSetTet, in which case there will be no additional data stored for each normal disc; or (2) a class of the form DiscSetTetData<T>, in which case there will be data of type T stored alongside each normal disc.
Warning
This class converts the number of normal discs of a given type from LargeInteger to unsigned long. See the precondition below.
Precondition
The number of normal discs of a particular type in a particular tetrahedron can be represented by a long integer.
This class should only be used with embedded normal surfaces.
Python
The only instance of this class that is available through python is DiscSetSurface (i.e., the "vanilla" case where TetData is the type DiscSetTet).

Constructor & Destructor Documentation

◆ DiscSetSurfaceDataImpl() [1/4]

template<class TetData >
regina::DiscSetSurfaceDataImpl< TetData >::DiscSetSurfaceDataImpl ( const NormalSurface surface)
inline

Creates a new disc set corresponding to the discs of the given normal surface.

The data for each disc will be initialised using its default constructor.

This disc set will be usable even if it outlives the given surface and/or its underlying triangulation. This is because it takes a snapshot of the necessary information as it appears right now (using Regina's snapshotting machinery, which only takes a deep copy when absolutely necessary).

Parameters
surfacethe normal surface whose discs we shall use.

◆ DiscSetSurfaceDataImpl() [2/4]

template<class TetData >
regina::DiscSetSurfaceDataImpl< TetData >::DiscSetSurfaceDataImpl ( const NormalSurface surface,
const typename TetData::Data &  initValue 
)
inline

Creates a new disc set corresponding to the discs of the given normal surface.

The data for each disc will be initialised to the given value.

This disc set will be usable even if it outlives the given surface and/or its underlying triangulation. This is because it takes a snapshot of the necessary information as it appears right now (using Regina's snapshotting machinery, which only takes a deep copy when absolutely necessary).

Precondition
The template argument TetData is a class of the form DiscSetTetData<T>, not DiscSetTet.
Python
Not present. In Python, the template argument TetData is always DiscSetTet, which does not store any additional data alongside each normal disc.
Parameters
surfacethe normal surface whose discs we shall use.
initValuethe value with which to initialise the data corresponding to each disc.

◆ DiscSetSurfaceDataImpl() [3/4]

template<class TetData >
regina::DiscSetSurfaceDataImpl< TetData >::DiscSetSurfaceDataImpl ( const DiscSetSurfaceDataImpl< TetData > &  src)
inline

Creates a new copy of the given set of normal discs.

The data for each disc will be copied using the copy assignment operator for type T.

Parameters
srcthe disc set to copy.

◆ DiscSetSurfaceDataImpl() [4/4]

template<class TetData >
regina::DiscSetSurfaceDataImpl< TetData >::DiscSetSurfaceDataImpl ( DiscSetSurfaceDataImpl< TetData > &&  src)
inlinenoexcept

Moves the contents of the given disc set into this new disc set.

This is a fast (constant time) operation.

The disc set that was passed (src) will no longer be usable.

Parameters
srcthe disc set to move from.

◆ ~DiscSetSurfaceDataImpl()

template<class TetData >
regina::DiscSetSurfaceDataImpl< TetData >::~DiscSetSurfaceDataImpl ( )
inline

Destroys this set of discs and deallocates all associated memory.

Member Function Documentation

◆ __iter__()

template<class TetData >
auto regina::DiscSetSurfaceDataImpl< TetData >::__iter__ ( ) const

Returns a Python iterator over all normal discs in the underlying normal surface.

In Python, an object of this class can be treated as an iterable object:

for disc in surfaceData:
...
C++
Not present. For C++ users, this class provides the usual begin() and end() functions instead. In particular, you can iterate over all normal discs in the underlying normal surface in the usual way using a range-based for loop.
Returns
an iterator over all normal discs.

◆ adjacentDisc()

template<class TetData >
std::optional< std::pair< DiscSpec, Perm< 4 > > > regina::DiscSetSurfaceDataImpl< TetData >::adjacentDisc ( const DiscSpec disc,
Perm< 4 >  arc 
) const
inline

Determines which normal disc is adjacent to the given normal disc along the given directed normal arc in the surface described by this disc set.

A directed normal arc will be specified by a permutation p, where the arc runs around vertex p[0] parallel to the directed edge from vertex p[1] to p[2].

Parameters
discthe given normal disc; this must be a disc in this disc set.
arcthe given normal arc; this must actually be an arc on the boundary of the given normal disc (although it may run in either direction).
Returns
a pair (adj, perm), where adj is the normal disc adjacent to the given disc along the given arc, and perm represents the same directed normal arc that was passed but expressed in terms of the vertices of the adjacent tetrahedron. This will be no value if there is no adjacent disc.

◆ begin()

template<class TetData >
DiscSpecIterator< TetData > regina::DiscSetSurfaceDataImpl< TetData >::begin ( ) const
inline

Returns a C++ iterator at the beginning of the range of all normal discs in the underlying normal surface.

These begin() and end() routines allow you to iterate through all normal discs using a range-based for loop:

for (const DiscSpec& s : surfaceData) { ... }
Python
Not present. For Python users, this class implements the Python iterable interface. You can iterate over all normal discs in the underlying surface in the same way that you would iterate over any native Python container.
Returns
an iterator at the beginning of the range of all normal discs.

◆ data()

template<class TetData >
TetData::Data & regina::DiscSetSurfaceDataImpl< TetData >::data ( const DiscSpec disc)
inline

Retrieves a reference to the data corresponding to the given normal disc.

Precondition
The template argument TetData is a class of the form DiscSetTetData<T>, not DiscSetTet.
Python
Not present. In Python, the template argument TetData is always DiscSetTet, which does not store any additional data alongside each normal disc.
Parameters
discthe disc whose data we require; this must refer to a disc within this disc set.
Returns
a reference to the data corresponding to the given normal disc.

◆ end()

template<class TetData >
DiscSpecIterator< TetData > regina::DiscSetSurfaceDataImpl< TetData >::end ( ) const
inline

Returns a C++ iterator at the end of the range of all normal discs in the underlying normal surface.

These begin() and end() routines allow you to iterate through all normal discs using a range-based for loop. See the begin() documentation for further details.

Python
Not present. For Python users, this class implements the Python iterable interface. You can iterate over all normal discs in the underlying surface in the same way that you would iterate over any native Python container.
Returns
an iterator at the end of the range of all normal discs.

◆ nDiscs()

template<class TetData >
unsigned long regina::DiscSetSurfaceDataImpl< TetData >::nDiscs ( size_t  tetIndex,
int  type 
) const
inline

Determines the number of discs of the given type inside the given tetrahedron.

Parameters
tetIndexthe index in the triangulation of the tetrahedron to examine.
typethe disc type to examine; this should be between 0 and 9 inclusive. Disc types are outlined in the DiscSpec class notes.
Returns
the number of discs of the given type inside the given tetrahedron.

◆ nTets()

template<class TetData >
size_t regina::DiscSetSurfaceDataImpl< TetData >::nTets ( ) const
inline

Returns the number of tetrahedra in the underlying triangulation.

Returns
the number of tetrahedra.

◆ operator!=()

template<class TetData >
bool regina::DiscSetSurfaceDataImpl< TetData >::operator!= ( const DiscSetSurfaceDataImpl< TetData > &  other) const
inline

Determines whether this and the given set have different numbers of discs of some type in some tetrahedron, or contain different data for some pair of corresponding discs.

This routine does not consider whether the two underlying triangulations are the same; it merely compares the disc counts and associated data within each set. If the two disc sets come from triangulations with different sizes, and/or surfaces with different disc counts in one or more tetarhedra, then this comparison will return true.

The associated data (of type T) will be compared using the equality operator (==).

Returns
true if and only if both sets are not the same, as described above.

◆ operator=() [1/2]

template<class TetData >
DiscSetSurfaceDataImpl & regina::DiscSetSurfaceDataImpl< TetData >::operator= ( const DiscSetSurfaceDataImpl< TetData > &  src)
inline

Sets this to be a copy of the given disc set.

The data for each disc will be copied using the copy assignment operator for type T.

Parameters
srcthe disc set to copy.
Returns
a reference to this disc set.

◆ operator=() [2/2]

template<class TetData >
DiscSetSurfaceDataImpl & regina::DiscSetSurfaceDataImpl< TetData >::operator= ( DiscSetSurfaceDataImpl< TetData > &&  src)
inlinenoexcept

Moves the contents of the given disc set into this disc set.

The running time of this operation is linear in the number of tetrahedra from the original triangulation (since the underlying data for those tetrahedra will be destroyed immediately).

The disc set that was passed (src) will no longer be usable.

Parameters
srcthe disc set to move from.
Returns
a reference to this disc set.

◆ operator==()

template<class TetData >
bool regina::DiscSetSurfaceDataImpl< TetData >::operator== ( const DiscSetSurfaceDataImpl< TetData > &  other) const
inline

Determines whether this and the given set have the same number of discs of each type in each tetrahedron, and contain the same data for corresponding discs.

This routine does not consider whether the two underlying triangulations are the same; it merely compares the disc counts and associated data within each set. If the two disc sets come from triangulations with different sizes, and/or surfaces with different disc counts in one or more tetarhedra, then this comparison will return false.

The associated data (of type T) will be compared using the equality operator (==).

Returns
true if and only if both sets are the same, as described above.

◆ swap()

template<class TetData >
void regina::DiscSetSurfaceDataImpl< TetData >::swap ( DiscSetSurfaceDataImpl< TetData > &  other)
inlinenoexcept

Swaps the contents of this and the given disc set.

Parameters
otherthe disc set whose contents should be swapped with this.

◆ tetDiscs()

template<class TetData >
TetData & regina::DiscSetSurfaceDataImpl< TetData >::tetDiscs ( size_t  tetIndex) const
inline

Returns the specific set of discs living inside the given tetrahedron.

Parameters
tetIndexthe index in the triangulation of the given tetrahedron.
Returns
the set of discs inside the given tetrahedron.

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

Copyright © 1999-2023, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).