Regina Calculation Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
regina::Dim2Triangulation Class Reference

Stores the triangulation of a 2-manifold along with its various cellular structures and other information. More...

#include <dim2/dim2triangulation.h>

Inheritance diagram for regina::Dim2Triangulation:
regina::NPacket regina::NGenericTriangulation< 2 > regina::ShareableObject regina::DimTraits< dim > regina::boost::noncopyable

Public Types

typedef std::vector
< Dim2Triangle * >
::const_iterator 
TriangleIterator
 Used to iterate through triangles. More...
 
typedef std::vector< Dim2Edge * >
::const_iterator 
EdgeIterator
 Used to iterate through edges. More...
 
typedef std::vector
< Dim2Vertex * >
::const_iterator 
VertexIterator
 Used to iterate through vertices. More...
 
typedef std::vector
< Dim2Component * >
::const_iterator 
ComponentIterator
 Used to iterate through components. More...
 
typedef std::vector
< Dim2BoundaryComponent * >
::const_iterator 
BoundaryComponentIterator
 Used to iterate through boundary components. More...
 
- Public Types inherited from regina::NPacket
typedef ChangeEventSpan ChangeEventBlock
 A deprecated typedef for ChangeEventSpan. More...
 
- Public Types inherited from regina::DimTraits< dim >
typedef void Triangulation
 The main data type for a dim-manifold triangulation. More...
 
typedef void Simplex
 The data type for a top-dimensional simplex in a dim-manifold triangulation. More...
 
typedef void Isomorphism
 The data type for an isomorphism between two dim-manifold triangulations. More...
 
typedef void FacetPairing
 The data type that represents a pairing of facets of top-dimensional simplices in a dim-manifold triangulation. More...
 
typedef void Perm
 The permutation type used to describe gluings between top-dimensional simplices in a dim-manifold triangulation. More...
 

Public Member Functions

template<>
unsigned long getNumberOfFaces () const
 
template<>
unsigned long getNumberOfFaces () const
 
template<>
unsigned long getNumberOfFaces () const
 
Constructors and Destructors
 Dim2Triangulation ()
 Default constructor. More...
 
 Dim2Triangulation (const Dim2Triangulation &cloneMe)
 Copy constructor. More...
 
 Dim2Triangulation (const std::string &description)
 "Magic" constructor that tries to find some way to interpret the given string as a triangulation. More...
 
virtual ~Dim2Triangulation ()
 Destroys this triangulation. More...
 
Packet Administration
virtual void writeTextShort (std::ostream &out) const
 Writes this object in short text format to the given output stream. More...
 
virtual void writeTextLong (std::ostream &out) const
 Writes this object in long text format to the given output stream. More...
 
virtual bool dependsOnParent () const
 Determines if this packet depends upon its parent. More...
 
Triangles
unsigned long getNumberOfTriangles () const
 Returns the number of triangular faces in the triangulation. More...
 
unsigned long getNumberOfSimplices () const
 A dimension-agnostic alias for getNumberOfTriangles(). More...
 
const std::vector
< Dim2Triangle * > & 
getTriangles () const
 Returns all triangular faces in the triangulation. More...
 
const std::vector
< Dim2Triangle * > & 
getSimplices () const
 A dimension-agnostic alias for getTriangles(). More...
 
Dim2TrianglegetTriangle (unsigned long index)
 Returns the triangle with the given index number in the triangulation. More...
 
Dim2TrianglegetSimplex (unsigned long index)
 A dimension-agnostic alias for getTriangle(). More...
 
const Dim2TrianglegetTriangle (unsigned long index) const
 Returns the triangle with the given index number in the triangulation. More...
 
const Dim2TrianglegetSimplex (unsigned long index) const
 A dimension-agnostic alias for getTriangle(). More...
 
long triangleIndex (const Dim2Triangle *tri) const
 Returns the index of the given triangle in the triangulation. More...
 
long simplexIndex (const Dim2Triangle *tri) const
 A dimension-agnostic alias for triangleIndex(). More...
 
Dim2TrianglenewTriangle ()
 Creates a new triangle and adds it to this triangulation. More...
 
Dim2TrianglenewSimplex ()
 A dimension-agnostic alias for newTriangle(). More...
 
Dim2TrianglenewTriangle (const std::string &desc)
 Creates a new triangle with the given description and adds it to this triangulation. More...
 
Dim2TrianglenewSimplex (const std::string &desc)
 A dimension-agnostic alias for newTriangle(). More...
 
void removeTriangle (Dim2Triangle *tri)
 Removes the given triangle from the triangulation. More...
 
void removeSimplex (Dim2Triangle *tri)
 A dimension-agnostic alias for removeTriangle(). More...
 
void removeTriangleAt (unsigned long index)
 Removes the triangle with the given index number from the triangulation. More...
 
void removeSimplexAt (unsigned long index)
 A dimension-agnostic alias for removeTriangleAt(). More...
 
void removeAllTriangles ()
 Removes all triangles from the triangulation. More...
 
void removeAllSimplices ()
 A dimension-agnostic alias for removeAllTriangles(). More...
 
void swapContents (Dim2Triangulation &other)
 Swaps the contents of this and the given triangulation. More...
 
void moveContentsTo (Dim2Triangulation &dest)
 Moves the contents of this triangulation into the given destination triangulation, without destroying any pre-existing contents. More...
 
Skeletal Queries
unsigned long getNumberOfBoundaryComponents () const
 Returns the number of boundary components in this triangulation. More...
 
unsigned long getNumberOfComponents () const
 Returns the number of components in this triangulation. More...
 
unsigned long getNumberOfVertices () const
 Returns the number of vertices in this triangulation. More...
 
unsigned long getNumberOfEdges () const
 Returns the number of edges in this triangulation. More...
 
template<int dim>
unsigned long getNumberOfFaces () const
 Returns the number of faces of the given dimension in this triangulation. More...
 
const std::vector
< Dim2Component * > & 
getComponents () const
 Returns all components of this triangulation. More...
 
const std::vector
< Dim2BoundaryComponent * > & 
getBoundaryComponents () const
 Returns all boundary components of this triangulation. More...
 
const std::vector< Dim2Vertex * > & getVertices () const
 Returns all vertices of this triangulation. More...
 
const std::vector< Dim2Edge * > & getEdges () const
 Returns all edges of this triangulation. More...
 
Dim2ComponentgetComponent (unsigned long index) const
 Returns the requested triangulation component. More...
 
Dim2BoundaryComponentgetBoundaryComponent (unsigned long index) const
 Returns the requested triangulation boundary component. More...
 
Dim2VertexgetVertex (unsigned long index) const
 Returns the requested triangulation vertex. More...
 
Dim2EdgegetEdge (unsigned long index) const
 Returns the requested triangulation edge. More...
 
long componentIndex (const Dim2Component *component) const
 Returns the index of the given component in the triangulation. More...
 
long boundaryComponentIndex (const Dim2BoundaryComponent *bc) const
 Returns the index of the given boundary component in the triangulation. More...
 
long vertexIndex (const Dim2Vertex *vertex) const
 Returns the index of the given vertex in the triangulation. More...
 
long edgeIndex (const Dim2Edge *edge) const
 Returns the index of the given edge in the triangulation. More...
 
Isomorphism Testing
std::auto_ptr< Dim2IsomorphismisIsomorphicTo (const Dim2Triangulation &other) const
 Determines if this triangulation is combinatorially isomorphic to the given triangulation. More...
 
std::auto_ptr< Dim2IsomorphismisContainedIn (const Dim2Triangulation &other) const
 Determines if an isomorphic copy of this triangulation is contained within the given triangulation, possibly as a subcomplex of some larger component (or components). More...
 
unsigned long findAllSubcomplexesIn (const Dim2Triangulation &other, std::list< Dim2Isomorphism * > &results) const
 Finds all ways in which an isomorphic copy of this triangulation is contained within the given triangulation, possibly as a subcomplex of some larger component (or components). More...
 
bool makeCanonical ()
 Relabel the triangles and their vertices so that this triangulation is in canonical form. More...
 
Basic Properties
bool isValid () const
 Always returns true. More...
 
long getEulerChar () const
 Returns the Euler characteristic of this triangulation. More...
 
bool isClosed () const
 Determines if this triangulation is closed. More...
 
bool isOrientable () const
 Determines if this triangulation is orientable. More...
 
bool isConnected () const
 Determines if this triangulation is connected. More...
 
bool isIdeal () const
 Always returns false. More...
 
bool isMinimal () const
 Determines whether this is a minimal triangulation of the underlying 2-manifold; that is, it uses the fewest possible triangles. More...
 
Building Triangulations
void insertTriangulation (const Dim2Triangulation &source)
 Inserts a copy of the given triangulation into this triangulation. More...
 
void insertConstruction (unsigned long nTriangles, const int adjacencies[][3], const int gluings[][3][3])
 Inserts into this triangulation a set of triangles and their gluings as described by the given integer arrays. More...
 
Exporting Triangulations
std::string isoSig (Dim2Isomorphism **relabelling=0) const
 Constructs the isomorphism signature for this triangulation. More...
 
std::string dumpConstruction () const
 Returns C++ code that can be used with insertConstruction() to reconstruct this triangulation. More...
 
- Public Member Functions inherited from regina::NPacket
 NPacket (NPacket *parent=0)
 Constructor that inserts the new packet into the overall tree structure. More...
 
virtual ~NPacket ()
 Destructor that also orphans this packet and destroys all of its descendants. More...
 
virtual PacketType getPacketType () const =0
 Returns the unique integer ID representing this type of packet. More...
 
virtual std::string getPacketTypeName () const =0
 Returns an English name for this type of packet. More...
 
const std::string & getPacketLabel () const
 Returns the label associated with this individual packet. More...
 
std::string getHumanLabel () const
 Returns the label associated with this individual packet, adjusted if necessary for human-readable output. More...
 
void setPacketLabel (const std::string &newLabel)
 Sets the label associated with this individual packet. More...
 
std::string getFullName () const
 Returns a descriptive text string for the packet. More...
 
std::string makeUniqueLabel (const std::string &base) const
 Returns a new label that cannot be found anywhere in the entire tree structure. More...
 
bool makeUniqueLabels (NPacket *reference)
 Ensures that all packet labels in both this and the given packet tree combined are distinct. More...
 
bool hasTag (const std::string &tag) const
 Determines whether this packet has the given associated tag. More...
 
bool hasTags () const
 Determines whether this packet has any associated tags at all. More...
 
bool addTag (const std::string &tag)
 Associates the given tag with this packet. More...
 
bool removeTag (const std::string &tag)
 Removes the association of the given tag with this packet. More...
 
void removeAllTags ()
 Removes all associated tags from this packet. More...
 
const std::set< std::string > & getTags () const
 Returns the set of all tags associated with this packet. More...
 
bool listen (NPacketListener *listener)
 Registers the given packet listener to listen for events on this packet. More...
 
bool isListening (NPacketListener *listener)
 Determines whether the given packet listener is currently listening for events on this packet. More...
 
bool unlisten (NPacketListener *listener)
 Unregisters the given packet listener so that it no longer listens for events on this packet. More...
 
NPacketgetTreeParent () const
 Determines the parent packet in the tree structure. More...
 
NPacketgetFirstTreeChild () const
 Determines the first child of this packet in the tree structure. More...
 
NPacketgetLastTreeChild () const
 Determines the last child of this packet in the tree structure. More...
 
NPacketgetNextTreeSibling () const
 Determines the next sibling of this packet in the tree structure. More...
 
NPacketgetPrevTreeSibling () const
 Determines the previous sibling of this packet in the tree structure. More...
 
NPacketgetTreeMatriarch () const
 Determines the matriarch (the root) of the tree to which this packet belongs. More...
 
unsigned levelsDownTo (const NPacket *descendant) const
 Counts the number of levels between this packet and its given descendant in the tree structure. More...
 
unsigned levelsUpTo (const NPacket *ancestor) const
 Counts the number of levels between this packet and its given ancestor in the tree structure. More...
 
bool isGrandparentOf (const NPacket *descendant) const
 Determines if this packet is equal to or an ancestor of the given packet in the tree structure. More...
 
unsigned long getNumberOfChildren () const
 Returns the number of immediate children of this packet. More...
 
unsigned long getNumberOfDescendants () const
 Returns the total number of descendants of this packet. More...
 
unsigned long getTotalTreeSize () const
 Determines the total number of packets in the tree or subtree for which this packet is matriarch. More...
 
void insertChildFirst (NPacket *child)
 Inserts the given packet as the first child of this packet. More...
 
void insertChildLast (NPacket *child)
 Inserts the given packet as the last child of this packet. More...
 
void insertChildAfter (NPacket *newChild, NPacket *prevChild)
 Inserts the given packet as a child of this packet at the given location in this packet's child list. More...
 
void makeOrphan ()
 Cuts this packet away from its parent in the tree structure and instead makes it matriarch of its own tree. More...
 
void reparent (NPacket *newParent, bool first=false)
 Cuts this packet away from its parent in the tree structure, and inserts it as a child of the given packet instead. More...
 
void swapWithNextSibling ()
 Swaps this packet with its next sibling in the sequence of children beneath their common parent packet. More...
 
void moveUp (unsigned steps=1)
 Moves this packet the given number of steps towards the beginning of its sibling list. More...
 
void moveDown (unsigned steps=1)
 Moves this packet the given number of steps towards the end of its sibling list. More...
 
void moveToFirst ()
 Moves this packet to be the first in its sibling list. More...
 
void moveToLast ()
 Moves this packet to be the last in its sibling list. More...
 
void sortChildren ()
 Sorts the immediate children of this packet according to their packet labels. More...
 
NPacketnextTreePacket ()
 Finds the next packet after this in a complete depth-first iteration of the entire tree structure to which this packet belongs. More...
 
const NPacketnextTreePacket () const
 Finds the next packet after this in a complete depth-first iteration of the entire tree structure to which this packet belongs. More...
 
NPacketfirstTreePacket (const std::string &type)
 Finds the first packet of the requested type in a complete depth-first iteration of the tree structure. More...
 
const NPacketfirstTreePacket (const std::string &type) const
 Finds the first packet of the requested type in a complete depth-first iteration of the tree structure. More...
 
NPacketnextTreePacket (const std::string &type)
 Finds the next packet after this of the requested type in a complete depth-first iteration of the entire tree structure. More...
 
const NPacketnextTreePacket (const std::string &type) const
 Finds the next packet after this of the requested type in a complete depth-first iteration of the entire tree structure. More...
 
NPacketfindPacketLabel (const std::string &label)
 Finds the packet with the requested label in the tree or subtree for which this packet is matriarch. More...
 
const NPacketfindPacketLabel (const std::string &label) const
 Finds the packet with the requested label in the tree or subtree for which this packet is matriarch. More...
 
bool isPacketEditable () const
 Determines whether this packet can be altered without invalidating or otherwise upsetting any of its immediate children. More...
 
NPacketclone (bool cloneDescendants=false, bool end=true) const
 Clones this packet (and possibly its descendants), assigns to it a suitable unused label and inserts the clone into the tree as a sibling of this packet. More...
 
void writeXMLFile (std::ostream &out) const
 Writes a complete XML file containing the subtree with this packet as matriarch. More...
 
std::string internalID () const
 Returns a unique string ID that identifies this packet. More...
 
- Public Member Functions inherited from regina::ShareableObject
 ShareableObject ()
 Default constructor that does nothing. More...
 
virtual ~ShareableObject ()
 Default destructor that does nothing. More...
 
std::string str () const
 Returns the output from writeTextShort() as a string. More...
 
std::string toString () const
 A deprecated alias for str(), which returns the output from writeTextShort() as a string. More...
 
std::string detail () const
 Returns the output from writeTextLong() as a string. More...
 
std::string toStringLong () const
 A deprecated alias for detail(), which returns the output from writeTextLong() as a string. More...
 

Static Public Member Functions

static NXMLPacketReadergetXMLReader (NPacket *parent, NXMLTreeResolver &resolver)
 
Importing Triangulations
static Dim2TriangulationfromIsoSig (const std::string &signature)
 Recovers a full triangulation from an isomorphism signature. More...
 
- Static Public Member Functions inherited from regina::NPacket
static NXMLPacketReadergetXMLReader (NPacket *parent, NXMLTreeResolver &resolver)
 Returns a newly created XML element reader that will read the contents of a single XML packet element. More...
 

Protected Member Functions

virtual NPacketinternalClonePacket (NPacket *parent) const
 Makes a newly allocated copy of this packet. More...
 
virtual void writeXMLPacketData (std::ostream &out) const
 Writes a chunk of XML containing the data for this packet only. More...
 
void cloneFrom (const Dim2Triangulation &from)
 Turns this triangulation into a clone of the given triangulation. More...
 
- Protected Member Functions inherited from regina::NPacket
void writeXMLPacketTree (std::ostream &out) const
 Writes a chunk of XML containing the subtree with this packet as matriarch. More...
 
- Protected Member Functions inherited from regina::boost::noncopyable
 noncopyable ()
 A constructor which does nothing. More...
 
 ~noncopyable ()
 A destructor which does nothing. More...
 

Friends

class regina::Dim2Triangle
 
class regina::NXMLDim2TriangulationReader
 

Additional Inherited Members

- Static Protected Member Functions inherited from regina::NGenericTriangulation< 2 >
static std::string isoSig (const typename DimTraits< dim >::Triangulation &tri, typename DimTraits< dim >::Isomorphism **relabelling=0)
 Constructs the isomorphism signature for the given triangulation. More...
 
static DimTraits< dim >
::Triangulation
fromIsoSig (const std::string &sig)
 Recovers a full triangulation from an isomorphism signature. More...
 
static size_t isoSigComponentSize (const std::string &sig)
 Deduces the number of top-dimensional simplices in a connected triangulation from its isomorphism signature. More...
 

Detailed Description

Stores the triangulation of a 2-manifold along with its various cellular structures and other information.

A 2-manifold triangulation is built from triangular faces.

When the triangulation is deleted, the corresponding triangles, the cellular structure and all other properties will be deallocated.

Elements of the 1- and 0-skeletons (edges and vertices respectively) are always temporary, as are components and boundary components. Whenever a change occurs with the triangulation, these objects will all be deleted and a new skeletal structure will be calculated. The same is true of various other triangulation properties.

Member Typedef Documentation

Used to iterate through boundary components.

typedef std::vector<Dim2Component*>::const_iterator regina::Dim2Triangulation::ComponentIterator

Used to iterate through components.

typedef std::vector<Dim2Edge*>::const_iterator regina::Dim2Triangulation::EdgeIterator

Used to iterate through edges.

typedef std::vector<Dim2Triangle*>::const_iterator regina::Dim2Triangulation::TriangleIterator

Used to iterate through triangles.

typedef std::vector<Dim2Vertex*>::const_iterator regina::Dim2Triangulation::VertexIterator

Used to iterate through vertices.

Constructor & Destructor Documentation

regina::Dim2Triangulation::Dim2Triangulation ( )
inline

Default constructor.

Creates an empty triangulation.

regina::Dim2Triangulation::Dim2Triangulation ( const Dim2Triangulation cloneMe)
inline

Copy constructor.

Creates a new triangulation identical to the given triangulation. The packet tree structure and packet label are not copied.

Parameters
cloneMethe triangulation to clone.
regina::Dim2Triangulation::Dim2Triangulation ( const std::string &  description)

"Magic" constructor that tries to find some way to interpret the given string as a triangulation.

At present, Regina understands the following types of strings (and attempts to parse them in the following order):

This list may grow in future versions of Regina.

Regina will also set the packet label accordingly.

If Regina cannot interpret the given string, this will be left as the empty triangulation.

Parameters
descriptiona string that describes a 2-manifold triangulation.
regina::Dim2Triangulation::~Dim2Triangulation ( )
inlinevirtual

Destroys this triangulation.

The constituent triangles, the cellular structure and all other properties will also be deallocated.

Member Function Documentation

long regina::Dim2Triangulation::boundaryComponentIndex ( const Dim2BoundaryComponent bc) const
inline

Returns the index of the given boundary component in the triangulation.

Precondition
The given boundary component belongs to this triangulation.
Warning
Passing a null pointer to this routine will probably crash your program.
Parameters
bcspecifies which boundary component to find in the triangulation.
Returns
the index of the specified boundary component, where 0 is the first boundary component, 1 is the second and so on.
void regina::Dim2Triangulation::cloneFrom ( const Dim2Triangulation from)
protected

Turns this triangulation into a clone of the given triangulation.

The tree structure and label of this triangulation are not touched.

Parameters
fromthe triangulation from which this triangulation will be cloned.
long regina::Dim2Triangulation::componentIndex ( const Dim2Component component) const
inline

Returns the index of the given component in the triangulation.

Precondition
The given component belongs to this triangulation.
Warning
Passing a null pointer to this routine will probably crash your program.
Parameters
componentspecifies which component to find in the triangulation.
Returns
the index of the specified component, where 0 is the first component, 1 is the second and so on.
bool regina::Dim2Triangulation::dependsOnParent ( ) const
inlinevirtual

Determines if this packet depends upon its parent.

This is true if the parent cannot be altered without invalidating or otherwise upsetting this packet.

Returns
true if and only if this packet depends on its parent.

Implements regina::NPacket.

std::string regina::Dim2Triangulation::dumpConstruction ( ) const

Returns C++ code that can be used with insertConstruction() to reconstruct this triangulation.

The code produced will consist of the following:

  • the declaration and initialisation of two integer arrays, describing the triangle gluings in this trianguation;
  • two additional lines that declare a new Dim2Triangulation and call insertConstruction() to rebuild this triangulation.

The main purpose of this routine is to generate the two integer arrays, which can be tedious and error-prone to code up by hand.

Note that the number of lines of code produced grows linearly with the number of triangles. If this triangulation is very large, the returned string will be very large as well.

Returns
the C++ code that was generated.
long regina::Dim2Triangulation::edgeIndex ( const Dim2Edge edge) const
inline

Returns the index of the given edge in the triangulation.

Precondition
The given edge belongs to this triangulation.
Warning
Passing a null pointer to this routine will probably crash your program.
Parameters
edgespecifies which edge to find in the triangulation.
Returns
the index of the specified edge, where 0 is the first edge, 1 is the second and so on.
unsigned long regina::Dim2Triangulation::findAllSubcomplexesIn ( const Dim2Triangulation other,
std::list< Dim2Isomorphism * > &  results 
) const

Finds all ways in which an isomorphic copy of this triangulation is contained within the given triangulation, possibly as a subcomplex of some larger component (or components).

This routine behaves identically to isContainedIn(), except that instead of returning just one isomorphism (which may be boundary incomplete and need not be onto), all such isomorphisms are returned.

See the isContainedIn() notes for additional information.

The isomorphisms that are found will be inserted into the given list. These isomorphisms will be newly created, and the caller of this routine is responsible for destroying them. The given list will not be emptied before the new isomorphisms are inserted.

Python:
Not present.
Parameters
otherthe triangulation in which to search for isomorphic copies of this triangulation.
resultsthe list in which any isomorphisms found will be stored.
Returns
the number of isomorphisms that were found.
Dim2Triangulation * regina::Dim2Triangulation::fromIsoSig ( const std::string &  signature)
inlinestatic

Recovers a full triangulation from an isomorphism signature.

See isoSig() for more information on isomorphism signatures.

The triangulation that is returned will be newly created.

Calling isoSig() followed by fromIsoSig() is not guaranteed to produce an identical triangulation to the original, but it is guaranteed to produce a combinatorially isomorphic triangulation.

Parameters
signaturethe isomorphism signature of the triangulation to construct. Note that, unlike dehydration strings for 3-manifold triangulations, case is important for isomorphism signatures.
Returns
a newly allocated triangulation if the reconstruction was successful, or null if the given string was not a valid isomorphism signature.
Dim2BoundaryComponent * regina::Dim2Triangulation::getBoundaryComponent ( unsigned long  index) const
inline

Returns the requested triangulation boundary component.

Bear in mind that each time the triangulation changes, the boundary components will be deleted and replaced with new ones. Thus this object should be considered temporary only.

Parameters
indexthe index of the desired boundary component, ranging from 0 to getNumberOfBoundaryComponents()-1 inclusive.
Returns
the requested boundary component.
const std::vector< Dim2BoundaryComponent * > & regina::Dim2Triangulation::getBoundaryComponents ( ) const
inline

Returns all boundary components of this triangulation.

Bear in mind that each time the triangulation changes, the boundary components will be deleted and replaced with new ones. Thus the objects contained in this list should be considered temporary only.

This reference to the list however will remain valid and up-to-date for as long as the triangulation exists.

Python:
This routine returns a python list.
Returns
the list of all boundary components.
Dim2Component * regina::Dim2Triangulation::getComponent ( unsigned long  index) const
inline

Returns the requested triangulation component.

Bear in mind that each time the triangulation changes, the components will be deleted and replaced with new ones. Thus this object should be considered temporary only.

Parameters
indexthe index of the desired component, ranging from 0 to getNumberOfComponents()-1 inclusive.
Returns
the requested component.
const std::vector< Dim2Component * > & regina::Dim2Triangulation::getComponents ( ) const
inline

Returns all components of this triangulation.

Bear in mind that each time the triangulation changes, the components will be deleted and replaced with new ones. Thus the objects contained in this list should be considered temporary only.

This reference to the list however will remain valid and up-to-date for as long as the triangulation exists.

Python:
This routine returns a python list.
Returns
the list of all components.
Dim2Edge * regina::Dim2Triangulation::getEdge ( unsigned long  index) const
inline

Returns the requested triangulation edge.

Bear in mind that each time the triangulation changes, the edges will be deleted and replaced with new ones. Thus this object should be considered temporary only.

Parameters
indexthe index of the desired edge, ranging from 0 to getNumberOfEdges()-1 inclusive.
Returns
the requested edge.
const std::vector< Dim2Edge * > & regina::Dim2Triangulation::getEdges ( ) const
inline

Returns all edges of this triangulation.

Bear in mind that each time the triangulation changes, the edges will be deleted and replaced with new ones. Thus the objects contained in this list should be considered temporary only.

This reference to the list however will remain valid and up-to-date for as long as the triangulation exists.

Python:
This routine returns a python list.
Returns
the list of all edges.
long regina::Dim2Triangulation::getEulerChar ( ) const
inline

Returns the Euler characteristic of this triangulation.

This will be evaluated as V-E+F.

Returns
the Euler characteristic of this triangulation.
unsigned long regina::Dim2Triangulation::getNumberOfBoundaryComponents ( ) const
inline

Returns the number of boundary components in this triangulation.

Returns
the number of boundary components.
unsigned long regina::Dim2Triangulation::getNumberOfComponents ( ) const
inline

Returns the number of components in this triangulation.

Returns
the number of components.
unsigned long regina::Dim2Triangulation::getNumberOfEdges ( ) const
inline

Returns the number of edges in this triangulation.

Returns
the number of edges.
template<int dim>
unsigned long regina::Dim2Triangulation::getNumberOfFaces ( ) const

Returns the number of faces of the given dimension in this triangulation.

This template function is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Precondition
the template argument dim is between 0 and 2 inclusive.
Python:
Not present.
Returns
the number of faces of the given dimension.
unsigned long regina::Dim2Triangulation::getNumberOfSimplices ( ) const
inline

A dimension-agnostic alias for getNumberOfTriangles().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See getNumberOfTriangles() for further information.

unsigned long regina::Dim2Triangulation::getNumberOfTriangles ( ) const
inline

Returns the number of triangular faces in the triangulation.

Returns
the number of triangles.
unsigned long regina::Dim2Triangulation::getNumberOfVertices ( ) const
inline

Returns the number of vertices in this triangulation.

Returns
the number of vertices.
Dim2Triangle * regina::Dim2Triangulation::getSimplex ( unsigned long  index)
inline

A dimension-agnostic alias for getTriangle().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See getTriangle() for further information.

const Dim2Triangle * regina::Dim2Triangulation::getSimplex ( unsigned long  index) const
inline

A dimension-agnostic alias for getTriangle().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See getTriangle() for further information.

const std::vector< Dim2Triangle * > & regina::Dim2Triangulation::getSimplices ( ) const
inline

A dimension-agnostic alias for getTriangles().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See getTriangles() for further information.

Dim2Triangle * regina::Dim2Triangulation::getTriangle ( unsigned long  index)
inline

Returns the triangle with the given index number in the triangulation.

Note that triangle indexing may change when a triangle is added or removed from the triangulation.

Parameters
indexspecifies which triangle to return; this value should be between 0 and getNumberOfTriangles()-1 inclusive.
Returns
the indexth triangle in the triangulation.
const Dim2Triangle * regina::Dim2Triangulation::getTriangle ( unsigned long  index) const
inline

Returns the triangle with the given index number in the triangulation.

Note that triangle indexing may change when a triangle is added or removed from the triangulation.

Parameters
indexspecifies which triangle to return; this value should be between 0 and getNumberOfTriangles()-1 inclusive.
Returns
the indexth triangle in the triangulation.
const std::vector< Dim2Triangle * > & regina::Dim2Triangulation::getTriangles ( ) const
inline

Returns all triangular faces in the triangulation.

The reference returned will remain valid for as long as the triangulation exists, always reflecting the triangles currently in the triangulation.

Python:
This routine returns a python list.
Returns
the list of all triangles.
Dim2Vertex * regina::Dim2Triangulation::getVertex ( unsigned long  index) const
inline

Returns the requested triangulation vertex.

Bear in mind that each time the triangulation changes, the vertices will be deleted and replaced with new ones. Thus this object should be considered temporary only.

Parameters
indexthe index of the desired vertex, ranging from 0 to getNumberOfVertices()-1 inclusive.
Returns
the requested vertex.
const std::vector< Dim2Vertex * > & regina::Dim2Triangulation::getVertices ( ) const
inline

Returns all vertices of this triangulation.

Bear in mind that each time the triangulation changes, the vertices will be deleted and replaced with new ones. Thus the objects contained in this list should be considered temporary only.

This reference to the list however will remain valid and up-to-date for as long as the triangulation exists.

Python:
This routine returns a python list.
Returns
the list of all vertices.
void regina::Dim2Triangulation::insertConstruction ( unsigned long  nTriangles,
const int  adjacencies[][3],
const int  gluings[][3][3] 
)

Inserts into this triangulation a set of triangles and their gluings as described by the given integer arrays.

This routine is provided to make it easy to hard-code a medium-sized triangulation in a C++ source file. All of the pertinent data can be hard-coded into a pair of integer arrays at the beginning of the source file, avoiding an otherwise tedious sequence of many joinTo() calls.

An additional nTriangles triangles will be inserted into this triangulation. The relationships between these triangles should be stored in the two arrays as follows. Note that the new triangles are numbered from 0 to (nTriangles - 1), and individual triangle edges are numbered from 0 to 2.

The adjacencies array describes which triangle edges are joined to which others. Specifically, adjacencies[f][e] should contain the number of the triangle joined to edge e of triangle f. If this edge is to be left as a boundary edge, adjacencies[f][e] should be -1.

The gluings array describes the particular gluing permutations used when joining these triangle edges together. Specifically, gluings[f][e][0..2] should describe the permutation used to join edge e of triangle f to its adjacent triangle. These three integers should be 0, 1 and 2 in some order, so that gluings[f][e][i] contains the image of i under this permutation. If edge e of triangle f is to be left as a boundary edge, gluings[f][e][0..2] may contain anything (and will be duly ignored).

It is the responsibility of the caller of this routine to ensure that the given arrays are correct and consistent. No error checking will be performed by this routine.

Note that, for an existing triangulation, dumpConstruction() will output a pair of C++ arrays that can be copied into a source file and used to reconstruct the triangulation via this routine.

Python:
Not present.
Parameters
nTrianglesthe number of additional triangles to insert.
adjacenciesdescribes which of the new triangle edges are to be identified. This array must have initial dimension at least nTriangles.
gluingsdescribes the specific gluing permutations by which these new triangle edges should be identified. This array must also have initial dimension at least nTriangles.
void regina::Dim2Triangulation::insertTriangulation ( const Dim2Triangulation source)

Inserts a copy of the given triangulation into this triangulation.

The new triangles will be inserted into this triangulation in the order in which they appear in the given triangulation, and the numbering of their vertices (0-2) will not change. They will be given the same descriptions as appear in the given triangulation.

Parameters
sourcethe triangulation whose copy will be inserted.
NPacket * regina::Dim2Triangulation::internalClonePacket ( NPacket parent) const
inlineprotectedvirtual

Makes a newly allocated copy of this packet.

This routine should not insert the new packet into the tree structure, clone the packet's associated tags or give the packet a label. It should also not clone any descendants of this packet.

You may assume that the new packet will eventually be inserted into the tree beneath either the same parent as this packet or a clone of that parent.

Parameters
parentthe parent beneath which the new packet will eventually be inserted.
Returns
the newly allocated packet.

Implements regina::NPacket.

bool regina::Dim2Triangulation::isClosed ( ) const
inline

Determines if this triangulation is closed.

This is the case if and only if it has no boundary components.

Returns
true if and only if this triangulation is closed.
bool regina::Dim2Triangulation::isConnected ( ) const
inline

Determines if this triangulation is connected.

Returns
true if and only if this triangulation is connected.
std::auto_ptr<Dim2Isomorphism> regina::Dim2Triangulation::isContainedIn ( const Dim2Triangulation other) const

Determines if an isomorphic copy of this triangulation is contained within the given triangulation, possibly as a subcomplex of some larger component (or components).

Specifically, this routine determines if there is a boundary incomplete combinatorial isomorphism from this triangulation to other. Boundary incomplete isomorphisms are described in detail in the Dim2Isomorphism class notes.

In particular, note that boundary edges of this triangulation need not correspond to boundary edges of other, and that other can contain more triangles than this triangulation.

If a boundary incomplete isomorphism is found, the details of this isomorphism are returned. The isomorphism is newly constructed, and so to assist with memory management is returned as a std::auto_ptr. Thus, to test whether an isomorphism exists without having to explicitly deal with the isomorphism itself, you can call if (isContainedIn(other).get()) and the newly created isomorphism (if it exists) will be automatically destroyed.

If more than one such isomorphism exists, only one will be returned. For a routine that returns all such isomorphisms, see findAllSubcomplexesIn().

Parameters
otherthe triangulation in which to search for an isomorphic copy of this triangulation.
Returns
details of the isomorphism if such a copy is found, or a null pointer otherwise.
bool regina::Dim2Triangulation::isIdeal ( ) const
inline

Always returns false.

This routine determines if this triangulation is ideal (has a non-trivial vertex link); however, every vertex link in a 2-manifold triangulation is either the interval or the circle, and so ideal triangulations cannot exist. Therefore this routine always returns false.

This no-op routine is provided for consistency with higher dimensional triangulations, and to assist with writing dimension-agnostic code.

Returns
false.
std::auto_ptr<Dim2Isomorphism> regina::Dim2Triangulation::isIsomorphicTo ( const Dim2Triangulation other) const

Determines if this triangulation is combinatorially isomorphic to the given triangulation.

Specifically, this routine determines if there is a one-to-one and onto boundary complete combinatorial isomorphism from this triangulation to other. Boundary complete isomorphisms are described in detail in the Dim2Isomorphism class notes.

In particular, note that this triangulation and other must contain the same number of triangles for such an isomorphism to exist.

If a boundary complete isomorphism is found, the details of this isomorphism are returned. The isomorphism is newly constructed, and so to assist with memory management is returned as a std::auto_ptr. Thus, to test whether an isomorphism exists without having to explicitly deal with the isomorphism itself, you can call if (isIsomorphicTo(other).get()) and the newly created isomorphism (if it exists) will be automatically destroyed.

Parameters
otherthe triangulation to compare with this one.
Returns
details of the isomorphism if the two triangulations are combinatorially isomorphic, or a null pointer otherwise.
bool regina::Dim2Triangulation::isMinimal ( ) const

Determines whether this is a minimal triangulation of the underlying 2-manifold; that is, it uses the fewest possible triangles.

Testing for minimality is simple in two dimensions (unlike higher dimensions, where it becomes extremely difficult). With the exception of the sphere, disc and projective plane (which require a minimum of 2, 1 and 2 triangles respectively), a closed triangulation is minimal if and only if it has one vertex, and a bounded triangulation is minimal if and only if it has one vertex per boundary component and no internal vertices.

The proof is based on a simple Euler characteristic calculation, whereby the number of triangles T is T = 2Vi + Vb - 2C, where Vi and Vb are the number of internal and boundary vertices respectively, and where C is the Euler characteristic of the underlying manifold.

Returns
true if and only if this is a minimal triangulation.
bool regina::Dim2Triangulation::isOrientable ( ) const
inline

Determines if this triangulation is orientable.

Returns
true if and only if this triangulation is orientable.
std::string regina::Dim2Triangulation::isoSig ( Dim2Isomorphism **  relabelling = 0) const
inline

Constructs the isomorphism signature for this triangulation.

An isomorphism signature is a compact text representation of a triangulation. Unlike dehydrations for 3-manifold triangulations, an isomorphism signature uniquely determines a triangulation up to combinatorial isomorphism. That is, two 2-manifold triangulations are combinatorially isomorphic if and only if their isomorphism signatures are the same.

The isomorphism signature is constructed entirely of printable characters, and has length proportional to n log n, where n is the number of triangles.

Isomorphism signatures are more general than dehydrations: they can be used with any triangulation (including closed, bounded and/or disconnected triangulations, as well as triangulations with large numbers of triangles).

The time required to construct the isomorphism signature of a triangulation is O(n^2 log^2 n).

The routine fromIsoSig() can be used to recover a triangulation from an isomorphism signature. The triangulation recovered might not be identical to the original, but it will be combinatorially isomorphic.

If relabelling is non-null (i.e., it points to some Dim2Isomorphism pointer p), then it will be modified to point to a new Dim2Isomorphism that describes the precise relationship between this triangulation and the reconstruction from fromIsoSig(). Specifically, the triangulation that is reconstructed from fromIsoSig() will be combinatorially identical to relabelling.apply(this).

Python:
The isomorphism argument is not present. Instead there are two routines: fromIsoSig(), which returns a string only, and fromIsoSigDetail(), which returns a pair (signature, relabelling).
Precondition
If relabelling is non-null, then this triangulation must be non-empty and connected. The facility to return a relabelling for disconnected triangulations may be added to Regina in a later release.
Parameters
relabellingif non-null, this will be modified to point to a new isomorphism describing the relationship between this triangulation and that reconstructed from fromIsoSig(), as described above.
Returns
the isomorphism signature of this triangulation.
bool regina::Dim2Triangulation::isValid ( ) const
inline

Always returns true.

This routine determines if this triangulation is valid; however, there is nothing that can go wrong with vertex links in 2-manifold triangulations, and so this routine always returns true.

This no-op routine is provided for consistency with higher dimensional triangulations, and to assist with writing dimension-agnostic code.

Returns
true.
bool regina::Dim2Triangulation::makeCanonical ( )

Relabel the triangles and their vertices so that this triangulation is in canonical form.

This is essentially the lexicographically smallest labelling when the edge gluings are written out in order.

Two triangulations are isomorphic if and only if their canonical forms are identical.

The lexicographic ordering assumes that the edge gluings are written in order of triangle index and then edge number. Each gluing is written as the destination triangle index followed by the gluing permutation (which in turn is written as the images of 0,1,2 in order).

Precondition
This routine currently works only when the triangulation is connected. It may be extended to work with disconnected triangulations in later versions of Regina.
Returns
true if the triangulation was changed, or false if the triangulation was in canonical form to begin with.
void regina::Dim2Triangulation::moveContentsTo ( Dim2Triangulation dest)

Moves the contents of this triangulation into the given destination triangulation, without destroying any pre-existing contents.

That is, all triangles that currently belong to dest will remain there, and all triangles that belong to this triangulation will be moved across as additional triangles in dest.

All Dim2Triangle pointers or references will remain valid. After this operation, this triangulation will be empty.

Parameters
destthe triangulation to which triangles should be moved.
Dim2Triangle * regina::Dim2Triangulation::newSimplex ( )
inline

A dimension-agnostic alias for newTriangle().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See newTriangle() for further information.

Dim2Triangle * regina::Dim2Triangulation::newSimplex ( const std::string &  desc)
inline

A dimension-agnostic alias for newTriangle().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See newTriangle() for further information.

Dim2Triangle * regina::Dim2Triangulation::newTriangle ( )
inline

Creates a new triangle and adds it to this triangulation.

The new triangle will have an empty description. All three edges of the new triangle will be boundary edges.

The new triangle will become the last triangle in this triangulation.

Returns
the new triangle.
Dim2Triangle * regina::Dim2Triangulation::newTriangle ( const std::string &  desc)
inline

Creates a new triangle with the given description and adds it to this triangulation.

All three edges of the new triangle will be boundary edges.

Parameters
descthe description to assign to the new triangle.
Returns
the new triangle.
void regina::Dim2Triangulation::removeAllSimplices ( )
inline

A dimension-agnostic alias for removeAllTriangles().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See removeAllTriangles() for further information.

void regina::Dim2Triangulation::removeAllTriangles ( )
inline

Removes all triangles from the triangulation.

All triangles will be deallocated.

void regina::Dim2Triangulation::removeSimplex ( Dim2Triangle tri)
inline

A dimension-agnostic alias for removeTriangle().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See removeTriangle() for further information.

void regina::Dim2Triangulation::removeSimplexAt ( unsigned long  index)
inline

A dimension-agnostic alias for removeTriangleAt().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See removeTriangleAt() for further information.

void regina::Dim2Triangulation::removeTriangle ( Dim2Triangle tri)
inline

Removes the given triangle from the triangulation.

All triangles glued to this triangle will be unglued. The triangle will be deallocated.

Precondition
The given triangle exists in the triangulation.
Parameters
trithe triangle to remove.
void regina::Dim2Triangulation::removeTriangleAt ( unsigned long  index)
inline

Removes the triangle with the given index number from the triangulation.

Note that triangle indexing may change when a triangle is added or removed from the triangulation.

All triangles glued to this triangle will be unglued. The triangle will be deallocated.

Parameters
indexspecifies which triangle to remove; this should be between 0 and getNumberOfTriangles()-1 inclusive.
long regina::Dim2Triangulation::simplexIndex ( const Dim2Triangle tri) const
inline

A dimension-agnostic alias for triangleIndex().

This is to assist with writing dimension-agnostic code that can be reused to work in different dimensions.

Here "simplex" refers to a top-dimensional simplex (which for 2-manifold triangulations means a triangle).

See triangleIndex() for further information.

void regina::Dim2Triangulation::swapContents ( Dim2Triangulation other)

Swaps the contents of this and the given triangulation.

That is, all triangles that belong to this triangulation will be moved to other, and all triangles that belong to other will be moved to this triangulation.

All Dim2Triangle pointers or references will remain valid.

Parameters
otherthe triangulation whose contents should be swapped with this.
long regina::Dim2Triangulation::triangleIndex ( const Dim2Triangle tri) const
inline

Returns the index of the given triangle in the triangulation.

Note that triangle indexing may change when a triangle is added or removed from the triangulation.

Precondition
The given triangle is contained in this triangulation.
Warning
Passing a null pointer to this routine will probably crash your program. If you are passing the result of some other routine that might return null (such as Dim2Triangle::adjacentTriangle), it might be worth explicitly testing for null beforehand.
Parameters
trispecifies which triangle to find in the triangulation.
Returns
the index of the specified triangle, where 0 is the first triangle, 1 is the second and so on.
long regina::Dim2Triangulation::vertexIndex ( const Dim2Vertex vertex) const
inline

Returns the index of the given vertex in the triangulation.

Precondition
The given vertex belongs to this triangulation.
Warning
Passing a null pointer to this routine will probably crash your program.
Parameters
vertexspecifies which vertex to find in the triangulation.
Returns
the index of the specified vertex, where 0 is the first vertex, 1 is the second and so on.
virtual void regina::Dim2Triangulation::writeTextLong ( std::ostream &  out) const
virtual

Writes this object in long text format to the given output stream.

The output should provide the user with all the information they could want. The output should be human-readable, should not contain extremely long lines (so users can read the output in a terminal), and should end with a final newline.

The default implementation of this routine merely calls writeTextShort() and adds a newline.

Python:
The parameter out does not exist; standard output will be used.
Parameters
outthe output stream to which to write.

Reimplemented from regina::ShareableObject.

void regina::Dim2Triangulation::writeTextShort ( std::ostream &  out) const
inlinevirtual

Writes this object in short text format to the given output stream.

The output should be human-readable, should fit on a single line, and should not end with a newline.

Python:
The parameter out does not exist; standard output will be used.
Parameters
outthe output stream to which to write.

Implements regina::ShareableObject.

virtual void regina::Dim2Triangulation::writeXMLPacketData ( std::ostream &  out) const
protectedvirtual

Writes a chunk of XML containing the data for this packet only.

You may assume that the packet opening tag (including the packet type and label) has already been written, and that all child packets followed by the corresponding packet closing tag will be written immediately after this routine is called. This routine need only write the internal data stored in this specific packet.

Parameters
outthe output stream to which the XML should be written.

Implements regina::NPacket.


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

Copyright © 1999-2013, 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@debian.org).