Regina 7.3 Calculation Engine
Public Member Functions | Static Public Attributes | Protected Attributes | Friends | List of all members
regina::Component< 2 > Class Reference

Represents a connected component of a 2-manifold triangulation. More...

#include <triangulation/dim2.h>

Inheritance diagram for regina::Component< 2 >:
regina::detail::ComponentBase< 2 > regina::ShortOutput< ComponentBase< dim > > regina::MarkedElement regina::Output< ComponentBase< dim >, false >

Public Member Functions

template<int subdim>
size_t countFaces () const
 Returns the number of subdim-faces in this component. More...
 
template<int subdim>
auto faces () const
 Returns an object that allows iteration through and random access to all subdim-faces in this component. More...
 
template<int subdim>
Face< 2, subdim > * face (size_t index) const
 Returns the requested subdim-face in this component. More...
 
bool hasBoundaryEdges () const
 A dimension-specific alias for hasBoundaryFacets(). More...
 
size_t countBoundaryEdges () const
 A dimension-specific alias for countBoundaryFacets(). More...
 
bool isClosed () const
 Determines if this component is closed. More...
 
size_t index () const
 Returns the index of this component within the underlying triangulation. More...
 
size_t size () const
 Returns the number of top-dimensional simplices in this component. More...
 
auto simplices () const
 Returns an object that allows iteration through and random access to all top-dimensional simplices in this component. More...
 
Simplex< dim > * simplex (size_t index) const
 Returns the top-dimensional simplex at the given index in this component. More...
 
size_t countVertices () const
 A dimension-specific alias for countFaces<0>(). More...
 
size_t countEdges () const
 A dimension-specific alias for countFaces<1>(). More...
 
size_t countTriangles () const
 A dimension-specific alias for countFaces<2>(). More...
 
size_t countTetrahedra () const
 A dimension-specific alias for countFaces<3>(). More...
 
size_t countPentachora () const
 A dimension-specific alias for countFaces<4>(). More...
 
size_t countBoundaryComponents () const
 Returns the number of boundary components in this component. More...
 
auto vertices () const
 A dimension-specific alias for faces<0>(). More...
 
auto edges () const
 A dimension-specific alias for faces<1>(). More...
 
auto triangles () const
 A dimension-specific alias for faces<2>(), or an alias for simplices() in dimension dim = 2. More...
 
auto tetrahedra () const
 A dimension-specific alias for faces<3>(), or an alias for simplices() in dimension dim = 3. More...
 
auto pentachora () const
 A dimension-specific alias for faces<4>(), or an alias for simplices() in dimension dim = 4. More...
 
auto boundaryComponents () const
 Returns an object that allows iteration through and random access to all boundary components in this component. More...
 
Face< dim, 0 > * vertex (size_t index) const
 A dimension-specific alias for face<0>(). More...
 
Face< dim, 1 > * edge (size_t index) const
 A dimension-specific alias for face<1>(). More...
 
Face< dim, 2 > * triangle (size_t index) const
 A dimension-specific alias for face<2>(). More...
 
Face< dim, 3 > * tetrahedron (size_t index) const
 A dimension-specific alias for face<3>(). More...
 
Face< dim, 4 > * pentachoron (size_t index) const
 A dimension-specific alias for face<4>(). More...
 
BoundaryComponent< dim > * boundaryComponent (size_t index) const
 Returns the boundary component at the given index in this component. More...
 
bool isValid () const
 Determines if this component is valid. More...
 
bool isOrientable () const
 Determines if this component is orientable. More...
 
bool hasBoundaryFacets () const
 Determines if this component has any boundary facets. More...
 
size_t countBoundaryFacets () const
 Returns the number of boundary facets in this component. More...
 
void writeTextShort (std::ostream &out) const
 Writes a short text representation of this object to the given output stream. More...
 
void writeTextLong (std::ostream &out) const
 A default implementation for detailed output. More...
 
std::string str () const
 Returns a short text representation of this object. More...
 
std::string utf8 () const
 Returns a short text representation of this object using unicode characters. More...
 
std::string detail () const
 Returns a detailed text representation of this object. More...
 
size_t markedIndex () const
 Returns the index at which this object is stored in an MarkedVector. More...
 

Static Public Attributes

static constexpr int dimension
 A compile-time constant that gives the dimension of the component. More...
 

Protected Attributes

bool valid_
 Is this component valid? See Triangulation<dim>::isValid() for details on what this means. More...
 

Friends

class Triangulation< 2 >
 
class detail::TriangulationBase< 2 >
 

Detailed Description

Represents a connected component of a 2-manifold triangulation.

This is a specialisation of the generic Component class template; see the Component documentation for an overview of how this class works.

This 2-dimensional specialisation contains some extra functionality. In particular, each 2-dimensional component also stores details on lower-dimensional faces (i.e., vertices and edges).

Components do not support value semantics: they cannot be copied, swapped, or manually constructed. Their location in memory defines them, and they are often passed and compared by pointer. End users are never responsible for their memory management; this is all taken care of by the Triangulation to which they belong.

Member Function Documentation

◆ boundaryComponent()

BoundaryComponent< dim > * regina::detail::ComponentBase< dim >::boundaryComponent ( size_t  index) const
inlineinherited

Returns the boundary component at the given index in this component.

Note that the index of a boundary component within this component may not be the same as its index within the overall triangulation.

Parameters
indexspecifies which boundary component to return; this should be between 0 and countBoundaryComponents()-1 inclusive.
Returns
the requested boundary component.

◆ boundaryComponents()

auto regina::detail::ComponentBase< dim >::boundaryComponents
inlineinherited

Returns an object that allows iteration through and random access to all boundary components in this component.

The object that is returned is lightweight, and can be happily copied by value. The C++ type of the object is subject to change, so C++ users should use auto (just like this declaration does).

The returned object is guaranteed to be an instance of ListView, which means it offers basic container-like functions and supports range-based for loops. Note that the elements of the list will be pointers, so your code might look like:

for (BoundaryComponent<dim>* bc : comp.boundaryComponents()) { ... }

The object that is returned will remain valid only for as long as this component object exists. In particular, the object will become invalid any time that the triangulation changes (since all component objects will be destroyed and others rebuilt in their place). Therefore it is best to treat this object as temporary only, and to call boundaryComponents() again each time you need it.

Returns
access to the list of all boundary components.

◆ countBoundaryComponents()

size_t regina::detail::ComponentBase< dim >::countBoundaryComponents
inlineinherited

Returns the number of boundary components in this component.

Returns
the number of boundary components.

◆ countBoundaryEdges()

size_t regina::Component< 2 >::countBoundaryEdges ( ) const
inline

A dimension-specific alias for countBoundaryFacets().

See countBoundaryFacets() for further information.

◆ countBoundaryFacets()

size_t regina::detail::ComponentBase< dim >::countBoundaryFacets
inlineinherited

Returns the number of boundary facets in this component.

A boundary facet is a (dim-1)-dimensional facet of a top-dimensional simplex that is not joined to any adjacent simplex.

This routine runs in constant time (since the result is computed in advance, when the component is first created).

Returns
the total number of boundary facets.

◆ countEdges()

size_t regina::detail::ComponentBase< dim >::countEdges
inlineinherited

A dimension-specific alias for countFaces<1>().

This alias is available only when dim is one of Regina's standard dimensions.

See countFaces() for further information.

◆ countFaces()

template<int subdim>
size_t regina::Component< 2 >::countFaces ( ) const

Returns the number of subdim-faces in this component.

For convenience, this routine explicitly supports the case subdim = 2. This is not the case for the routines face() and faces(), which give access to individual faces (the reason relates to the fact that triangles are built manually, whereas lower-dimensional faces are deduced properties).

Python
Python does not support templates. Instead, Python users should call this function in the form countFaces(subdim); that is, the template parameter subdim becomes the first argument of the function.
Template Parameters
subdimthe face dimension; this must be between 0 and 2 inclusive.
Returns
the number of subdim-faces.

◆ countPentachora()

size_t regina::detail::ComponentBase< dim >::countPentachora
inlineinherited

A dimension-specific alias for countFaces<4>().

This alias is available only when dim is one of Regina's standard dimensions and dim ≥ 4.

See countFaces() for further information.

◆ countTetrahedra()

size_t regina::detail::ComponentBase< dim >::countTetrahedra
inlineinherited

A dimension-specific alias for countFaces<3>().

This alias is available only when dim is one of Regina's standard dimensions and dim ≥ 3.

See countFaces() for further information.

◆ countTriangles()

size_t regina::detail::ComponentBase< dim >::countTriangles
inlineinherited

A dimension-specific alias for countFaces<2>().

This alias is available only when dim is one of Regina's standard dimensions.

See countFaces() for further information.

◆ countVertices()

size_t regina::detail::ComponentBase< dim >::countVertices
inlineinherited

A dimension-specific alias for countFaces<0>().

This alias is available only when dim is one of Regina's standard dimensions.

See countFaces() for further information.

◆ detail()

std::string regina::Output< ComponentBase< dim > , supportsUtf8 >::detail ( ) const
inherited

Returns a detailed text representation of this object.

This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.

Returns
a detailed text representation of this object.

◆ edge()

Face< dim, 1 > * regina::detail::ComponentBase< dim >::edge ( size_t  index) const
inlineinherited

A dimension-specific alias for face<1>().

This alias is available only when dim is one of Regina's standard dimensions.

See face() for further information.

◆ edges()

auto regina::detail::ComponentBase< dim >::edges
inlineinherited

A dimension-specific alias for faces<1>().

This alias is available only when dim is one of Regina's standard dimensions.

See faces() for further information.

◆ face()

template<int subdim>
Face< 2, subdim > * regina::Component< 2 >::face ( size_t  index) const

Returns the requested subdim-face in this component.

Note that the index of a face in the component need not be the index of the same face in the overall triangulation.

Python
Python does not support templates. Instead, Python users should call this function in the form face(subdim, index); that is, the template parameter subdim becomes the first argument of the function.
Template Parameters
subdimthe face dimension; this must be either 0 or 1.
Parameters
indexthe index of the desired face, ranging from 0 to countFaces<subdim>()-1 inclusive.
Returns
the requested face.

◆ faces()

template<int subdim>
auto regina::Component< 2 >::faces ( ) const

Returns an object that allows iteration through and random access to all subdim-faces in this component.

The object that is returned is lightweight, and can be happily copied by value. The C++ type of the object is subject to change, so C++ users should use auto (just like this declaration does).

The returned object is guaranteed to be an instance of ListView, which means it offers basic container-like functions and supports range-based for loops. Note that the elements of the list will be pointers, so your code might look like:

for (Face<dim, subdim>* f : comp.faces<subdim>()) { ... }

The object that is returned will remain valid only for as long as this component object exists. In particular, the object will become invalid any time that the triangulation changes (since all component objects will be destroyed and others rebuilt in their place). Therefore it is best to treat this object as temporary only, and to call faces() again each time you need it.

Python
Python does not support templates. Instead, Python users should call this function in the form faces(subdim).
Template Parameters
subdimthe face dimension; this must be either 0 or 1.
Returns
access to the list of all subdim-faces.

◆ hasBoundaryEdges()

bool regina::Component< 2 >::hasBoundaryEdges ( ) const
inline

A dimension-specific alias for hasBoundaryFacets().

See hasBoundaryFacets() for further information.

◆ hasBoundaryFacets()

bool regina::detail::ComponentBase< dim >::hasBoundaryFacets
inlineinherited

Determines if this component has any boundary facets.

This routine returns true if and only if this component contains some top-dimensional simplex with at least one facet that is not glued to an adjacent simplex.

Returns
true if and only if this component has boundary facet(s).

◆ index()

size_t regina::detail::ComponentBase< dim >::index
inlineinherited

Returns the index of this component within the underlying triangulation.

Returns
the index of this component.

◆ isClosed()

bool regina::Component< 2 >::isClosed ( ) const
inline

Determines if this component is closed.

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

Returns
true if and only if this component is closed.

◆ isOrientable()

bool regina::detail::ComponentBase< dim >::isOrientable
inlineinherited

Determines if this component is orientable.

This routine runs in constant time (since orientability is determined in advance, when the component is first created).

Returns
true if and only if this component is orientable.

◆ isValid()

bool regina::detail::ComponentBase< dim >::isValid
inlineinherited

Determines if this component is valid.

This uses the same criteria as Triangulation<dim>::isValid(); see the Triangulation<dim>::isValid() documentation for details.

As with Triangulation<dim>, this tests for bad self-identifications in all dimensions, but only tests for bad links in Regina's standard dimensions.

Returns
true if and only if this component is valid.

◆ markedIndex()

size_t regina::MarkedElement::markedIndex ( ) const
inlineinherited

Returns the index at which this object is stored in an MarkedVector.

If this object does not belong to an MarkedVector, the return value is undefined.

Returns
the index at which this object is stored.

◆ pentachora()

auto regina::detail::ComponentBase< dim >::pentachora
inlineinherited

A dimension-specific alias for faces<4>(), or an alias for simplices() in dimension dim = 4.

This alias is available only when dim is one of Regina's standard dimensions and dim ≥ 4.

See faces() for further information.

◆ pentachoron()

Face< dim, 4 > * regina::detail::ComponentBase< dim >::pentachoron ( size_t  index) const
inlineinherited

A dimension-specific alias for face<4>().

This alias is available only when dim is one of Regina's standard dimensions and dim ≥ 4.

See face() for further information.

◆ simplex()

Simplex< dim > * regina::detail::ComponentBase< dim >::simplex ( size_t  index) const
inlineinherited

Returns the top-dimensional simplex at the given index in this component.

Note that the index within this component may not be the same as the index within the overall triangulation.

Parameters
indexspecifies which simplex to return; this value should be between 0 and size()-1 inclusive.
Returns
the indexth top-dimensional simplex.

◆ simplices()

auto regina::detail::ComponentBase< dim >::simplices
inlineinherited

Returns an object that allows iteration through and random access to all top-dimensional simplices in this component.

The object that is returned is lightweight, and can be happily copied by value. The C++ type of the object is subject to change, so C++ users should use auto (just like this declaration does).

The returned object is guaranteed to be an instance of ListView, which means it offers basic container-like functions and supports range-based for loops. Note that the elements of the list will be pointers, so your code might look like:

for (Simplex<dim>* s : comp.simplices()) { ... }

The object that is returned will remain valid only for as long as this component object exists. In particular, the object will become invalid any time that the triangulation changes (since all component objects will be destroyed and others rebuilt in their place). Therefore it is best to treat this object as temporary only, and to call simplices() again each time you need it.

Returns
access to the list of all top-dimensional simplices.

◆ size()

size_t regina::detail::ComponentBase< dim >::size
inlineinherited

Returns the number of top-dimensional simplices in this component.

Returns
The number of top-dimensional simplices.

◆ str()

std::string regina::Output< ComponentBase< dim > , supportsUtf8 >::str ( ) const
inherited

Returns a short text representation of this object.

This text should be human-readable, should use plain ASCII characters where possible, and should not contain any newlines.

Within these limits, this short text ouptut should be as information-rich as possible, since in most cases this forms the basis for the Python __str__() and __repr__() functions.

Python
The Python "stringification" function __str__() will use precisely this function, and for most classes the Python __repr__() function will incorporate this into its output.
Returns
a short text representation of this object.

◆ tetrahedra()

auto regina::detail::ComponentBase< dim >::tetrahedra
inlineinherited

A dimension-specific alias for faces<3>(), or an alias for simplices() in dimension dim = 3.

This alias is available only when dim is one of Regina's standard dimensions and dim ≥ 3.

See faces() for further information.

◆ tetrahedron()

Face< dim, 3 > * regina::detail::ComponentBase< dim >::tetrahedron ( size_t  index) const
inlineinherited

A dimension-specific alias for face<3>().

This alias is available only when dim is one of Regina's standard dimensions and dim ≥ 3.

See face() for further information.

◆ triangle()

Face< dim, 2 > * regina::detail::ComponentBase< dim >::triangle ( size_t  index) const
inlineinherited

A dimension-specific alias for face<2>().

This alias is available only when dim is one of Regina's standard dimensions.

See face() for further information.

◆ triangles()

auto regina::detail::ComponentBase< dim >::triangles
inlineinherited

A dimension-specific alias for faces<2>(), or an alias for simplices() in dimension dim = 2.

This alias is available only when dim is one of Regina's standard dimensions.

See faces() for further information.

◆ utf8()

std::string regina::Output< ComponentBase< dim > , supportsUtf8 >::utf8 ( ) const
inherited

Returns a short text representation of this object using unicode characters.

Like str(), this text should be human-readable, should not contain any newlines, and (within these constraints) should be as information-rich as is reasonable.

Unlike str(), this function may use unicode characters to make the output more pleasant to read. The string that is returned will be encoded in UTF-8.

Returns
a short text representation of this object.

◆ vertex()

Face< dim, 0 > * regina::detail::ComponentBase< dim >::vertex ( size_t  index) const
inlineinherited

A dimension-specific alias for face<0>().

This alias is available only when dim is one of Regina's standard dimensions.

See face() for further information.

◆ vertices()

auto regina::detail::ComponentBase< dim >::vertices
inlineinherited

A dimension-specific alias for faces<0>().

This alias is available only when dim is one of Regina's standard dimensions.

See faces() for further information.

◆ writeTextLong()

void regina::ShortOutput< ComponentBase< dim > , false >::writeTextLong ( std::ostream &  out) const
inlineinherited

A default implementation for detailed output.

This routine simply calls T::writeTextShort() and appends a final newline.

Python
Not present. Instead you can call detail() from the subclass T, which returns this output as a string.
Parameters
outthe output stream to which to write.

◆ writeTextShort()

void regina::detail::ComponentBase< dim >::writeTextShort ( std::ostream &  out) const
inherited

Writes a short text representation of this object to the given output stream.

Python
Not present. Use str() instead.
Parameters
outthe output stream to which to write.

Member Data Documentation

◆ dimension

constexpr int regina::detail::ComponentBase< dim >::dimension
staticconstexprinherited

A compile-time constant that gives the dimension of the component.

◆ valid_

bool regina::detail::ComponentBase< dim >::valid_
protectedinherited

Is this component valid? See Triangulation<dim>::isValid() for details on what this means.


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