Regina 7.3 Calculation Engine
Public Types | Public Member Functions | Protected Attributes | List of all members
regina::DiscSetTetData< T > Class Template Reference

Stores data of type T for every normal disc inside a single tetrahedron. More...

#include <surface/disc.h>

Inheritance diagram for regina::DiscSetTetData< T >:
regina::DiscSetTet

Public Types

using Data = T
 The type of data being stored alongside each normal disc. More...
 

Public Member Functions

 DiscSetTetData (const NormalSurface &surface, size_t tetIndex)
 Creates a new disc set corresponding to the discs of the given normal surface that lie within the given tetrahedron. More...
 
 DiscSetTetData (const NormalSurface &surface, size_t tetIndex, const T &initValue)
 Creates a new disc set corresponding to the discs of the given normal surface that lie within the given tetrahedron. More...
 
 DiscSetTetData (unsigned long tri0, unsigned long tri1, unsigned long tri2, unsigned long tri3, unsigned long quad0, unsigned long quad1, unsigned long quad2, unsigned long oct0=0, unsigned long oct1=0, unsigned long oct2=0)
 Creates a new disc set where the number of discs of each type is explicitly given. More...
 
 DiscSetTetData (const DiscSetTetData &src)
 Creates a new copy of the given set of normal discs. More...
 
 DiscSetTetData (DiscSetTetData &&src) noexcept
 Moves the contents of the given disc set into this new disc set. More...
 
 ~DiscSetTetData ()
 Destroys this disc set and deallocates all data arrays. More...
 
DiscSetTetDataoperator= (const DiscSetTetData &src)
 Sets this to be a copy of the given set of normal discs. More...
 
DiscSetTetDataoperator= (DiscSetTetData &&src) noexcept
 Moves the contents of the given disc set into this disc set. More...
 
bool operator== (const DiscSetTetData &other) const
 Determines whether this and the given set have the same number of discs of each type, and contain the same data for corresponding discs. More...
 
bool operator!= (const DiscSetTetData &other) const
 Determines whether this and the given set either do not have the same number of discs of each type, or do not contain the same data for corresponding discs. More...
 
void swap (DiscSetTetData &other) noexcept
 Swaps the contents of this and the given disc set. More...
 
T & data (int discType, unsigned long discNumber)
 Retrieves a reference to the data corresponding to the given normal disc. More...
 
bool operator== (const DiscSetTet &other) const
 Determines whether this and the given set have the same number of discs of each type. More...
 
bool operator!= (const DiscSetTet &other) const
 Determines whether this and the given set do not have the same number of discs of each type. More...
 
unsigned long nDiscs (int type) const
 Determines the number of discs of the given type inside this tetrahedron. More...
 
unsigned long arcFromDisc (int arcFace, int arcVertex, int discType, unsigned long discNumber) const
 Determines which normal arc of a given type on a given face of this tetrahedron corresponds to the given normal disc. More...
 
std::pair< int, unsigned long > discFromArc (int arcFace, int arcVertex, unsigned long arcNumber) const
 Determines which normal disc in this tetrahedron meets the given normal arc on the given face. More...
 

Protected Attributes

T * data_ [10]
 Stores the data corresponding to each normal disc. More...
 
unsigned long discs_ [10]
 The number of discs of each type. More...
 

Detailed Description

template<class T>
class regina::DiscSetTetData< T >

Stores data of type T for every normal disc inside a single tetrahedron.

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.

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.
Type T has a default constructor and an assignment operator. That is, if a and b are of type T, then a can be declared with no parameters and can then receive the value of b using a=b.
Python
Not present.

Member Typedef Documentation

◆ Data

template<class T >
using regina::DiscSetTetData< T >::Data = T

The type of data being stored alongside each normal disc.

Constructor & Destructor Documentation

◆ DiscSetTetData() [1/5]

template<class T >
regina::DiscSetTetData< T >::DiscSetTetData ( const NormalSurface surface,
size_t  tetIndex 
)
inline

Creates a new disc set corresponding to the discs of the given normal surface that lie within the given tetrahedron.

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

Parameters
surfacethe normal surface whose discs we shall use.
tetIndexthe index in the triangulation of the tetrahedron that our discs must lie in; this must be between 0 and tri.size()-1 inclusive, where tri is the triangulation containing the given normal surface.

◆ DiscSetTetData() [2/5]

template<class T >
regina::DiscSetTetData< T >::DiscSetTetData ( const NormalSurface surface,
size_t  tetIndex,
const T &  initValue 
)
inline

Creates a new disc set corresponding to the discs of the given normal surface that lie within the given tetrahedron.

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

Parameters
surfacethe normal surface whose discs we shall use.
tetIndexthe index in the triangulation of the tetrahedron that our discs must lie in; this must be between 0 and tri.size()-1 inclusive, where tri is the triangulation containing the given normal surface.
initValuethe value with which to initialise the data corresponding to each disc.

◆ DiscSetTetData() [3/5]

template<class T >
regina::DiscSetTetData< T >::DiscSetTetData ( unsigned long  tri0,
unsigned long  tri1,
unsigned long  tri2,
unsigned long  tri3,
unsigned long  quad0,
unsigned long  quad1,
unsigned long  quad2,
unsigned long  oct0 = 0,
unsigned long  oct1 = 0,
unsigned long  oct2 = 0 
)
inline

Creates a new disc set where the number of discs of each type is explicitly given.

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

Parameters
tri0the number of triangular discs surrounding vertex 0.
tri1the number of triangular discs surrounding vertex 1.
tri2the number of triangular discs surrounding vertex 2.
tri3the number of triangular discs surrounding vertex 3.
quad0the number of quadrilateral discs of type 0.
quad1the number of quadrilateral discs of type 1.
quad2the number of quadrilateral discs of type 2.
oct0the number of octahedral discs of type 0.
oct1the number of octahedral discs of type 1.
oct2the number of octahedral discs of type 2.

◆ DiscSetTetData() [4/5]

template<class T >
regina::DiscSetTetData< T >::DiscSetTetData ( const DiscSetTetData< T > &  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.

◆ DiscSetTetData() [5/5]

template<class T >
regina::DiscSetTetData< T >::DiscSetTetData ( DiscSetTetData< T > &&  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.

◆ ~DiscSetTetData()

template<class T >
regina::DiscSetTetData< T >::~DiscSetTetData ( )
inline

Destroys this disc set and deallocates all data arrays.

Note that no assumption is made about type T, so if data elements are pointers to dynamically allocated objects, these will not be destroyed.

Member Function Documentation

◆ arcFromDisc()

unsigned long regina::DiscSetTet::arcFromDisc ( int  arcFace,
int  arcVertex,
int  discType,
unsigned long  discNumber 
) const
inherited

Determines which normal arc of a given type on a given face of this tetrahedron corresponds to the given normal disc.

Precondition
The given normal disc actually meets a normal arc of the given type on the given face.
Parameters
arcFacethe face of this tetrahedron containing the normal arc (between 0 and 3 inclusive).
arcVertexthe vertex of this tetrahedron about which the normal arc runs (between 0 and 3 inclusive); arcFace and arcVertex should not be the same.
discTypethe disc type of the given normal disc; this should be between 0 and 9 inclusive, as described in the DiscSpec class notes.
discNumberindicates which normal disc of the given disc type is referred to (between 0 and nDiscs(discType)-1 inclusive).
Returns
the number of the normal arc of the given type that belongs to the given normal disc. Arcs of a given type (where arcFace and arcVertex together define the arc type) are numbered starting at 0 from the tetrahedron vertex outwards.

◆ data()

template<class T >
T & regina::DiscSetTetData< T >::data ( int  discType,
unsigned long  discNumber 
)
inline

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

Parameters
discTypethe disc type of the given normal disc; this should be between 0 and 9 inclusive, as described in the DiscSpec class notes.
discNumberindicates which normal disc of the given disc type is referred to; this should be between 0 and nDiscs(discType)-1 inclusive.
Returns
a reference to the data corresponding to the given normal disc.

◆ discFromArc()

std::pair< int, unsigned long > regina::DiscSetTet::discFromArc ( int  arcFace,
int  arcVertex,
unsigned long  arcNumber 
) const
inherited

Determines which normal disc in this tetrahedron meets the given normal arc on the given face.

Precondition
The given normal arc actually exists in the normal surface with which this DiscSetTet object was created.
Parameters
arcFacethe face of this tetrahedron containing the normal arc (between 0 and 3 inclusive).
arcVertexthe vertex of this tetrahedron about which the normal arc runs (between 0 and 3 inclusive); arcFace and arcVertex should not be the same.
arcNumberindicates which normal arc of the given type is referred to. Arcs of a given type (where arcFace and arcVertex together define the arc type) are numbered starting at 0 from the tetrahedron vertex outwards.
Returns
a pair (discType, discNumber), where discType gives the disc type of the normal disc that meets the given normal arc (between 0 and 9 inclusive), and discNumber indicates which normal disc of the returned disc type (discType) meets the given normal arc (between 0 and nDiscs(discType)-1 inclusive).

◆ nDiscs()

unsigned long regina::DiscSetTet::nDiscs ( int  type) const
inlineinherited

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

Parameters
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 this tetrahedron.

◆ operator!=() [1/2]

bool regina::DiscSetTet::operator!= ( const DiscSetTet other) const
inlineinherited

Determines whether this and the given set do not have the same number of discs of each type.

This routine does not consider whether the two underlying tetrahedra are the same; it merely compares the ten disc counts in each set.

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

◆ operator!=() [2/2]

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

Determines whether this and the given set either do not have the same number of discs of each type, or do not contain the same data for corresponding discs.

This routine does not consider whether the two underlying tetrahedra are the same; it merely compares the disc counts and associated data within each set.

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 T >
DiscSetTetData & regina::DiscSetTetData< T >::operator= ( const DiscSetTetData< T > &  src)
inline

Sets this to be a 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.
Returns
a reference to this disc set.

◆ operator=() [2/2]

template<class T >
DiscSetTetData & regina::DiscSetTetData< T >::operator= ( DiscSetTetData< T > &&  src)
inlinenoexcept

Moves the contents of the given disc set into this 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.
Returns
a reference to this disc set.

◆ operator==() [1/2]

bool regina::DiscSetTet::operator== ( const DiscSetTet other) const
inlineinherited

Determines whether this and the given set have the same number of discs of each type.

This routine does not consider whether the two underlying tetrahedra are the same; it merely compares the ten disc counts in each set.

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

◆ operator==() [2/2]

template<class T >
bool regina::DiscSetTetData< T >::operator== ( const DiscSetTetData< T > &  other) const
inline

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

This routine does not consider whether the two underlying tetrahedra are the same; it merely compares the disc counts and associated data within each set.

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 T >
void regina::DiscSetTetData< T >::swap ( DiscSetTetData< T > &  other)
inlinenoexcept

Swaps the contents of this and the given disc set.

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

Member Data Documentation

◆ data_

template<class T >
T* regina::DiscSetTetData< T >::data_[10]
protected

Stores the data corresponding to each normal disc.

◆ discs_

unsigned long regina::DiscSetTet::discs_[10]
protectedinherited

The number of discs of each type.


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