Regina 7.3 Calculation Engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
regina::FacetSpec< dim > Struct Template Reference

A lightweight class used to refer to a particular facet of a particular top-dimensional simplex in a dim-dimensional triangulation. More...

#include <triangulation/facetspec.h>

Inheritance diagram for regina::FacetSpec< dim >:
regina::TightEncodable< FacetSpec< dim > >

Public Member Functions

 FacetSpec ()=default
 Creates a new specifier with no initialisation. More...
 
 FacetSpec (ssize_t newSimp, int newFacet)
 Creates a new specifier referring to the given facet of the given simplex. More...
 
 FacetSpec (const FacetSpec< dim > &cloneMe)=default
 Creates a new specifier referring to the same simplex facet as the given specifier. More...
 
bool isBoundary (size_t nSimplices) const
 Determines if this specifier represents the overall boundary. More...
 
bool isBeforeStart () const
 Determines if this specifier represents a before-the-start value. More...
 
bool isPastEnd (size_t nSimplices, bool boundaryAlso) const
 Determines if this specifier represents a past-the-end value. More...
 
void setFirst ()
 Sets this specifier to the first facet of the first simplex. More...
 
void setBoundary (size_t nSimplices)
 Sets this specifier to the overall boundary. More...
 
void setBeforeStart ()
 Sets this specifier to before-the-start. More...
 
void setPastEnd (size_t nSimplices)
 Sets this specifier to past-the-end. More...
 
FacetSpecoperator= (const FacetSpec< dim > &other)=default
 Sets this specifier to the value of the given specifier. More...
 
FacetSpecoperator++ ()
 Increments this specifier. More...
 
FacetSpec operator++ (int)
 Increments this specifier. More...
 
FacetSpecoperator-- ()
 Decrements this specifier. More...
 
FacetSpec operator-- (int)
 Decrements this specifier. More...
 
bool operator== (const FacetSpec< dim > &other) const
 Determines if this and the given specifier are identical. More...
 
bool operator!= (const FacetSpec< dim > &other) const
 Determines if this and the given specifier are not identical. More...
 
bool operator< (const FacetSpec< dim > &other) const
 Determines if this is less than the given specifier. More...
 
bool operator<= (const FacetSpec< dim > &other) const
 Determines if this is less than or equal to the given specifier. More...
 
void tightEncode (std::ostream &out) const
 Writes the tight encoding of this specifier to the given output stream. More...
 
std::string tightEncoding () const
 Returns the tight encoding of this object. More...
 

Static Public Member Functions

static FacetSpec< dim > tightDecode (std::istream &input)
 Reconstructs a specifier from its given tight encoding. More...
 
static FacetSpec< dim > tightDecoding (const std::string &enc)
 Reconstructs an object of type T from its given tight encoding. More...
 

Public Attributes

ssize_t simp
 The simplex referred to. More...
 
int facet
 The facet of the simplex referred to. More...
 

Detailed Description

template<int dim>
struct regina::FacetSpec< dim >

A lightweight class used to refer to a particular facet of a particular top-dimensional simplex in a dim-dimensional triangulation.

Only the simplex index and the facet number are stored.

Facilities are provided for iterating through simplex facets. With this in mind, it is also possible to represent the overall boundary, a past-the-end value and a before-the-start value.

When iterating through the simplex facets, the facets will be ordered first by simplex index and then by facet number. The overall boundary appears after all other simplex facets.

If there are n simplices, the simplices will be numbered from 0 to n-1 inclusive. The boundary will be represented as simplex n, facet 0. The past-the-end value will be represented as simplex n, facet 1, and the before-the-start value will be represented as simplex -1, facet dim.

These objects are small enough to pass by value and swap with std::swap(), with no need for any specialised move operations or swap functions.

Python
Python does not support templates. Instead this class can be used by appending the dimension as a suffix (e.g., FacetSpec2 and FacetSpec3 for dimensions 2 and 3).
Template Parameters
dimthe dimension of the underlying triangulation. This must be between 2 and 15 inclusive.

Constructor & Destructor Documentation

◆ FacetSpec() [1/3]

template<int dim>
regina::FacetSpec< dim >::FacetSpec ( )
default

Creates a new specifier with no initialisation.

This specifier must be initialised before it is used.

◆ FacetSpec() [2/3]

template<int dim>
regina::FacetSpec< dim >::FacetSpec ( ssize_t  newSimp,
int  newFacet 
)
inline

Creates a new specifier referring to the given facet of the given simplex.

Parameters
newSimpthe given simplex; see the class notes for allowable values of this parameter.
newFacetthe given facet; this should be between 0 and dim inclusive.

◆ FacetSpec() [3/3]

template<int dim>
regina::FacetSpec< dim >::FacetSpec ( const FacetSpec< dim > &  cloneMe)
default

Creates a new specifier referring to the same simplex facet as the given specifier.

Parameters
cloneMethe specifier to clone.

Member Function Documentation

◆ isBeforeStart()

template<int dim>
bool regina::FacetSpec< dim >::isBeforeStart
inline

Determines if this specifier represents a before-the-start value.

Returns
true if and only if this specifier is before-the-start.

◆ isBoundary()

template<int dim>
bool regina::FacetSpec< dim >::isBoundary ( size_t  nSimplices) const
inline

Determines if this specifier represents the overall boundary.

Parameters
nSimplicesthe number of simplices under consideration. Note that the boundary is represented in this specifier as simplex nSimplices, facet 0.
Returns
true if and only if this specifier represents the overall boundary.

◆ isPastEnd()

template<int dim>
bool regina::FacetSpec< dim >::isPastEnd ( size_t  nSimplices,
bool  boundaryAlso 
) const
inline

Determines if this specifier represents a past-the-end value.

You can optionally declare the overall boundary to be past-the-end as well as the already predefined past-the-end value.

Parameters
nSimplicesthe number of simplices under consideration. Note that past-the-end is represented in this specifier as simplex nSimplices, facet 1.
boundaryAlsotrue if the overall boundary should be considered past-the-end in addition to the predefined past-the-end value.
Returns
true if and only if this specifier is past-the-end.

◆ operator!=()

template<int dim>
bool regina::FacetSpec< dim >::operator!= ( const FacetSpec< dim > &  other) const
inline

Determines if this and the given specifier are not identical.

Parameters
otherthe specifier to compare with this.
Returns
true if and only if this and the given specifier are not equal.

◆ operator++() [1/2]

template<int dim>
FacetSpec< dim > & regina::FacetSpec< dim >::operator++
inline

Increments this specifier.

It will be changed to point to the next simplex facet.

Facets are ordered first by simplex index and then by facet number. The overall boundary appears after all other facets.

Precondition
This specifier is not past-the-end.
Python
Not present. The postincrement operator is present in Python as the member function inc().
Returns
A reference to this specifier.

◆ operator++() [2/2]

template<int dim>
FacetSpec< dim > regina::FacetSpec< dim >::operator++ ( int  )
inline

Increments this specifier.

It will be changed to point to the next simplex facet.

Facets are ordered first by simplex index and then by facet number. The overall boundary appears after all other facets.

Precondition
This specifier is not past-the-end.
Python
This routine is named inc() since python does not support the increment operator.
Returns
A copy of this specifier before it was incremented.

◆ operator--() [1/2]

template<int dim>
FacetSpec< dim > & regina::FacetSpec< dim >::operator--
inline

Decrements this specifier.

It will be changed to point to the previous simplex facet.

Facets are ordered first by simplex index and then by facet number. The overall boundary appears after all other facets.

Precondition
This specifier is not before-the-start.
Python
Not present. The postdecrement operator is present in Python as the member function dec().
Returns
A reference to this specifier.

◆ operator--() [2/2]

template<int dim>
FacetSpec< dim > regina::FacetSpec< dim >::operator-- ( int  )
inline

Decrements this specifier.

It will be changed to point to the previous simplex facet.

Facets are ordered first by simplex index and then by facet number. The overall boundary appears after all other facets.

Precondition
This specifier is not before-the-start.
Python
This routine is named dec() since python does not support the decrement operator.
Returns
A copy of this specifier before it was decremented.

◆ operator<()

template<int dim>
bool regina::FacetSpec< dim >::operator< ( const FacetSpec< dim > &  other) const
inline

Determines if this is less than the given specifier.

Parameters
otherthe specifier to compare with this.
Returns
true if and only if this is less than the given specifier.

◆ operator<=()

template<int dim>
bool regina::FacetSpec< dim >::operator<= ( const FacetSpec< dim > &  other) const
inline

Determines if this is less than or equal to the given specifier.

Parameters
otherthe specifier to compare with this.
Returns
true if and only if this is less than or equal to the given specifier.

◆ operator=()

template<int dim>
FacetSpec & regina::FacetSpec< dim >::operator= ( const FacetSpec< dim > &  other)
default

Sets this specifier to the value of the given specifier.

Parameters
otherthe given specifier.
Returns
a reference to this specifier.

◆ operator==()

template<int dim>
bool regina::FacetSpec< dim >::operator== ( const FacetSpec< dim > &  other) const
inline

Determines if this and the given specifier are identical.

Parameters
otherthe specifier to compare with this.
Returns
true if and only if this and the given specifier are equal.

◆ setBeforeStart()

template<int dim>
void regina::FacetSpec< dim >::setBeforeStart
inline

Sets this specifier to before-the-start.

◆ setBoundary()

template<int dim>
void regina::FacetSpec< dim >::setBoundary ( size_t  nSimplices)
inline

Sets this specifier to the overall boundary.

Parameters
nSimplicesthe number of simplices under consideration. Note that the boundary is represented in this specifier as simplex nSimplices, facet 0.

◆ setFirst()

template<int dim>
void regina::FacetSpec< dim >::setFirst
inline

Sets this specifier to the first facet of the first simplex.

◆ setPastEnd()

template<int dim>
void regina::FacetSpec< dim >::setPastEnd ( size_t  nSimplices)
inline

Sets this specifier to past-the-end.

Parameters
nSimplicesthe number of simplices under consideration. Note that past-the-end is represented in this specifier as simplex nSimplices, facet 1.

◆ tightDecode()

template<int dim>
FacetSpec< dim > regina::FacetSpec< dim >::tightDecode ( std::istream &  input)
inlinestatic

Reconstructs a specifier from its given tight encoding.

See the page on tight encodings for details.

The tight encoding will be read from the given input stream. If the input stream contains leading whitespace then it will be treated as an invalid encoding (i.e., this routine will throw an exception). The input routine may contain further data: if this routine is successful then the input stream will be left positioned immediately after the encoding, without skipping any trailing whitespace.

Before-the-start, past-the-end and boundary specifiers can all be safely reconstructed.

Exceptions
InvalidInputThe given input stream does not begin with a tight encoding of a dim-dimensional facet specifier.
Python
Not present. Use tightDecoding() instead, which takes a string as its argument.
Parameters
inputan input stream that begins with the tight encoding for a dim-dimensional facet specifier.
Returns
the specifier represented by the given tight encoding.

◆ tightDecoding()

static FacetSpec< dim > regina::TightEncodable< FacetSpec< dim > >::tightDecoding ( const std::string &  enc)
inlinestaticinherited

Reconstructs an object of type T from its given tight encoding.

See the page on tight encodings for details.

The tight encoding should be given as a string. If this string contains leading whitespace or any trailing characters at all (including trailing whitespace), then it will be treated as an invalid encoding (i.e., this routine will throw an exception).

Exceptions
InvalidArgumentThe given string is not a tight encoding of an object of type T.
Parameters
encthe tight encoding for an object of type T.
Returns
the object represented by the given tight encoding.

◆ tightEncode()

template<int dim>
void regina::FacetSpec< dim >::tightEncode ( std::ostream &  out) const
inline

Writes the tight encoding of this specifier to the given output stream.

See the page on tight encodings for details.

Before-the-start, past-the-end and boundary specifiers can all be safely encoded.

Python
Not present. Use tightEncoding() instead, which returns a string.
Parameters
outthe output stream to which the encoded string will be written.

◆ tightEncoding()

std::string regina::TightEncodable< FacetSpec< dim > >::tightEncoding ( ) const
inlineinherited

Returns the tight encoding of this object.

See the page on tight encodings for details.

Exceptions
FailedPreconditionThis may be thrown for some classes T if the object is in an invalid state. If this is possible, then a more detailed explanation of "invalid" can be found in the class documentation for T, under the member function T::tightEncode(). See FacetPairing::tightEncode() for an example of this.
Returns
the resulting encoded string.

Member Data Documentation

◆ facet

template<int dim>
int regina::FacetSpec< dim >::facet

The facet of the simplex referred to.

The facet number is between 0 and dim inclusive.

◆ simp

template<int dim>
ssize_t regina::FacetSpec< dim >::simp

The simplex referred to.

Simplex numbering begins at 0.


The documentation for this struct was generated from the following files:

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