Regina 7.3 Calculation Engine
Public Member Functions | Static Public Member Functions | List of all members
regina::NormalEncoding Class Reference

Indicates precisely how a normal surface is encoded by an integer vector. More...

#include <surface/normalcoords.h>

Public Member Functions

constexpr NormalEncoding (NormalCoords coords)
 Returns an encoding that precisely describes the given normal or almost normal coordinate system. More...
 
constexpr NormalEncoding (const NormalEncoding &)=default
 Creates a new copy of the given encoding. More...
 
NormalEncodingoperator= (const NormalEncoding &)=default
 Sets this to be a copy of the given encoding. More...
 
constexpr bool operator== (const NormalEncoding &other) const
 Determines whether this and the given encoding are identical. More...
 
constexpr bool operator!= (const NormalEncoding &other) const
 Determines whether this and the given encoding are different. More...
 
constexpr bool valid () const
 Returns whether this describes a vector encoding of normal or almost normal surfaces. More...
 
constexpr int block () const
 Returns the number of coordinates stored for each tetrahedron. More...
 
constexpr bool storesTriangles () const
 Returns whether this encoding explicitly stores triangle coordinates. More...
 
constexpr bool storesOctagons () const
 Returns whether this encoding explicitly stores octagon coordinates. More...
 
constexpr bool storesAngles () const
 Identifies whether this is the special angle structure encoding. More...
 
constexpr bool couldBeVertexLink () const
 Returns whether it is possible for a surface using this encoding to include one or more vertex linking components. More...
 
constexpr bool couldBeNonCompact () const
 Returns whether it is possible for a surface using this encoding to be non-compact. More...
 
constexpr NormalEncoding withTriangles () const
 Returns an extension of this encoding that explicitly stores triangle coordinates. More...
 
constexpr NormalEncoding withoutTriangles () const
 Returns a restricted version of this encoding that does not store triangle coordinates. More...
 
constexpr NormalEncoding withOctagons () const
 Returns an extension of this encoding that explicitly stores octagon coordinates. More...
 
constexpr NormalEncoding withoutOctagons () const
 Returns a restricted version of this encoding that does not store octagon coordinates. More...
 
constexpr NormalEncoding operator+ (NormalEncoding rhs) const
 Returns an encoding that could hold the sum of surfaces that use this and the given encoding. More...
 
constexpr int intValue () const
 Exports this encoding as an integer. More...
 

Static Public Member Functions

static constexpr NormalEncoding empty ()
 Returns an encoding that is suitable for representing the empty surface, whose normal coordinates are all zero. More...
 
static constexpr NormalEncoding fromIntValue (int value)
 Reconstructs an encoding from an integer value. More...
 

Detailed Description

Indicates precisely how a normal surface is encoded by an integer vector.

Normal surfaces do not always store their internal vectors in the same coordinate system that was used to enumerate the surfaces, and indeed an isolated surface does not know how it was originally created.

Therefore each normal surface keeps a small amount of data, represented by this class, so that it knows how to interpret its internal integer vector. This data also remembers properties of the enumeration process that can be used for optimisations (e.g., the knowledge that, even if the vector stores triangle coordinates, the surface cannot contain any vertex linking components).

For convenience, there is also a special encoding that identifies an angle structure vector; this can be created via NormalEncoding(NS_ANGLE), and can be recognised via storesAngles(). However, like NS_ANGLE itself, this special angle structure encoding does not represent a normal surface, cannot be combined with other encodings, and must not be used with any of Regina's routines unless the documentation explicitly allows it. Specifically, any code that accepts a NormalEncoding argument may silently assume that the encoding is not the special angle structure encoding, unless the documentation explicitly says otherwise.

Encodings have the important property that any rational multiple of a normal surface s can always be stored using the same encoding as is used for s. (In particular, taking a rational multiple will not invalidate any of the property flags in the encoding.)

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.

Constructor & Destructor Documentation

◆ NormalEncoding() [1/2]

constexpr regina::NormalEncoding::NormalEncoding ( NormalCoords  coords)
inlineconstexpr

Returns an encoding that precisely describes the given normal or almost normal coordinate system.

This is the encoding that you would use with a "pen and paper" enumeration of surfaces in the given coordinate system, with no further conversion, optimisation, or post-processing.

Note that, when Regina enumerates surfaces in the given coordinate system, it might choose to post-process the resulting vectors to use a different encoding. For example, when enumerating surfaces in quad or quad-oct coordinates, Regina computes and stores triangle coordinates also, and so for its own internal choice of encoding, storesTriangles() will return true. In contrast, if you simply create a NormalEncoding(NS_QUAD), then the resulting encoding will have storesTriangles() return false.

If coords is not one of the coordinate systems that Regina can use to enumerate or reconstruct surfaces (or NS_ANGLE, as discussed below), then the resulting encoding will be invalid, and valid() will return false. (Here "reconstruct" refers to the special case of NS_AN_LEGACY, which is used only when reading surfaces from very old data files).

As a special case, you may pass NS_ANGLE to this constructor; however, the resulting encoding does not represent a normal surface and must not be used anywhere in Regina unless the documentation explicitly allows it. See the class notes for further details.

Parameters
coordsone of Regina's normal or almost normal coordinate systems.

◆ NormalEncoding() [2/2]

constexpr regina::NormalEncoding::NormalEncoding ( const NormalEncoding )
constexprdefault

Creates a new copy of the given encoding.

Member Function Documentation

◆ block()

constexpr int regina::NormalEncoding::block ( ) const
inlineconstexpr

Returns the number of coordinates stored for each tetrahedron.

Returns
The number of coordinates per tetrahedron.

◆ couldBeNonCompact()

constexpr bool regina::NormalEncoding::couldBeNonCompact ( ) const
inlineconstexpr

Returns whether it is possible for a surface using this encoding to be non-compact.

Here "non-compact" refers to a surface with infinitely many discs, such as a spun-normal surface. See NormalSurface::isCompact() for details.

This is typically information that is inherited from whoever enumerated or created the normal surface that uses this encoding.

If this returns true, it does not mean that the surface does actually contain infinitely many discs; it simply means that the user will need to test this themselves. If this returns false, however, it is guaranteed that the surface is compact, with no further testing required.

For the special angle structure encoding (described in the class notes), this routine will return false.

Returns
true if it is possible that the surface might be non-compact.

◆ couldBeVertexLink()

constexpr bool regina::NormalEncoding::couldBeVertexLink ( ) const
inlineconstexpr

Returns whether it is possible for a surface using this encoding to include one or more vertex linking components.

This is typically information that is inherited from whoever enumerated or created the normal surface that uses this encoding.

If this returns true, it does not mean that the surface does actually contain vertex linking components; it simply means that the user will need to test this themselves. If this returns false, however, it is guaranteed that the surface does not contain any vertex linking components, with no further testing required.

For the special angle structure encoding (described in the class notes), this routine will return false.

Returns
true if it is possible that the surface might contain one or more vertex linking components.

◆ empty()

static constexpr NormalEncoding regina::NormalEncoding::empty ( )
inlinestaticconstexpr

Returns an encoding that is suitable for representing the empty surface, whose normal coordinates are all zero.

Returns
a suitable encoding for the empty surface.

◆ fromIntValue()

static constexpr NormalEncoding regina::NormalEncoding::fromIntValue ( int  value)
inlinestaticconstexpr

Reconstructs an encoding from an integer value.

This is a partner routine to intValue(): for any encoding enc, the encoding fromIntValue(enc.intValue()) is always equal to enc.

The main purpose of intValue() and fromIntValue() is to support reading and writing surfaces to/from Regina's XML file format.

Parameters
valuean integer that represents an encoding, typically obtained by calling intValue().
Returns
the corresponding encoding.

◆ intValue()

constexpr int regina::NormalEncoding::intValue ( ) const
inlineconstexpr

Exports this encoding as an integer.

The exact value of the integer is meant to be opaque, in the sense that it can only be used with fromIntValue(). End users are not meant to pull it apart and analyse it (this is what the other query routines in this class are for).

The main purpose of intValue() and fromIntValue() is to support reading and writing surfaces to/from Regina's XML file format.

It is guaranteed that 0 will never be the integer value of a (correctly constructed) encoding.

Returns
an integer that represents this encoding.

◆ operator!=()

constexpr bool regina::NormalEncoding::operator!= ( const NormalEncoding other) const
inlineconstexpr

Determines whether this and the given encoding are different.

Parameters
otherthe encoding to compare with this.
Returns
true if and only if both encodings are different.

◆ operator+()

constexpr NormalEncoding regina::NormalEncoding::operator+ ( NormalEncoding  rhs) const
inlineconstexpr

Returns an encoding that could hold the sum of surfaces that use this and the given encoding.

More precisely, the encoding that is returned is the "simplest" possible encoding that is capable of holding the sum of two surfaces that use this and the given encoding respectively.

Precondition
Neither this encoding nor rhs is the special angle structure encoding (see the class notes for details).
Parameters
rhsthe encoding to combine with this.
Returns
the "sum" of this and the given encoding, as defined above.

◆ operator=()

NormalEncoding & regina::NormalEncoding::operator= ( const NormalEncoding )
default

Sets this to be a copy of the given encoding.

Returns
a reference to this encoding.

◆ operator==()

constexpr bool regina::NormalEncoding::operator== ( const NormalEncoding other) const
inlineconstexpr

Determines whether this and the given encoding are identical.

Parameters
otherthe encoding to compare with this.
Returns
true if and only if both encodings are identical.

◆ storesAngles()

constexpr bool regina::NormalEncoding::storesAngles ( ) const
inlineconstexpr

Identifies whether this is the special angle structure encoding.

This routine is used to recognise the "special case" encoding NormalEncoding(NS_ANGLE). Such an encoding does not represent a normal surface, and cannot be used anywhere in Regina unless explicitly allowed in the documentation. See the class notes for further details.

◆ storesOctagons()

constexpr bool regina::NormalEncoding::storesOctagons ( ) const
inlineconstexpr

Returns whether this encoding explicitly stores octagon coordinates.

For the special angle structure encoding (described in the class notes), this routine will return false.

Returns
true if octagon coordinates are stored.

◆ storesTriangles()

constexpr bool regina::NormalEncoding::storesTriangles ( ) const
inlineconstexpr

Returns whether this encoding explicitly stores triangle coordinates.

For the special angle structure encoding (described in the class notes), this routine will return false.

Returns
true if triangle coordinates are stored.

◆ valid()

constexpr bool regina::NormalEncoding::valid ( ) const
inlineconstexpr

Returns whether this describes a vector encoding of normal or almost normal surfaces.

The only case where this would be false is if you create an encoding using either (1) a coordinate system that Regina does not use for enumeration or reconstruction; or (2) another invalid encoding.

For the special angle structure encoding (described in the class notes), this routine will return true.

Returns
true if and only if this is a valid encoding.

◆ withOctagons()

constexpr NormalEncoding regina::NormalEncoding::withOctagons ( ) const
inlineconstexpr

Returns an extension of this encoding that explicitly stores octagon coordinates.

All other properties of the encoding will be copied across without changes (including "theoretical" properties such as whether the surface could have vertex linking components, or whether it could be spun-normal).

If this encoding already stores octagon coordinates, then the result will be identical to this.

Precondition
This is not the special angle structure encoding (see the class notes for details).
Returns
an extension of this encoding that stores octagon coordinates.

◆ withoutOctagons()

constexpr NormalEncoding regina::NormalEncoding::withoutOctagons ( ) const
inlineconstexpr

Returns a restricted version of this encoding that does not store octagon coordinates.

All other properties of the encoding will be copied across without changes (including "theoretical" properties such as whether the surface could have vertex linking components, or whether it could be spun-normal).

If this encoding already does not store octagon coordinates, then the result will be identical to this.

Precondition
This is not the special angle structure encoding (see the class notes for details).
Returns
a restriction of this encoding that does not store octagon coordinates.

◆ withoutTriangles()

constexpr NormalEncoding regina::NormalEncoding::withoutTriangles ( ) const
inlineconstexpr

Returns a restricted version of this encoding that does not store triangle coordinates.

Most other properties of the encoding will be copied across without changes (including "theoretical" properties such as whether the surface could be spun-normal). However, since triangle coordinates will be excluded, the "could contain vertex linking components" property will be explicitly set to false.

If this encoding already does not store triangle coordinates, then the result will be identical to this.

Precondition
This is not the special angle structure encoding (see the class notes for details).
Returns
a restriction of this encoding that does not store triangle coordinates.

◆ withTriangles()

constexpr NormalEncoding regina::NormalEncoding::withTriangles ( ) const
inlineconstexpr

Returns an extension of this encoding that explicitly stores triangle coordinates.

All other properties of the encoding will be copied across without changes (including "theoretical" properties such as whether the surface could have vertex linking components, or whether it could be spun-normal).

If this encoding already stores triangle coordinates, then the result will be identical to this.

Precondition
This is not the special angle structure encoding (see the class notes for details).
Returns
an extension of this encoding that stores triangle coordinates.

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