|
| FacetPairing (const FacetPairing &src)=default |
| Creates a new copy of the given facet pairing.
|
|
| FacetPairing (FacetPairing &&src) noexcept=default |
| Moves the given facet pairing into this facet pairing.
|
|
| FacetPairing (const Triangulation< dim > &tri) |
| Creates the dual graph of the given triangulation.
|
|
| FacetPairing (std::istream &in) |
| Reads a new facet pairing from the given input stream.
|
|
FacetPairing & | operator= (const FacetPairing &src)=default |
| Copies the given facet pairing into this facet pairing.
|
|
FacetPairing & | operator= (FacetPairing &&src) noexcept=default |
| Moves the given facet pairing into this facet pairing.
|
|
void | writeTextLong (std::ostream &out) const |
| A default implementation for detailed output.
|
|
std::string | str () const |
| Returns a short text representation of this object.
|
|
std::string | utf8 () const |
| Returns a short text representation of this object using unicode characters.
|
|
std::string | detail () const |
| Returns a detailed text representation of this object.
|
|
std::string | tightEncoding () const |
| Returns the tight encoding of this object.
|
|
|
void | swap (FacetPairingBase &other) noexcept |
| Swaps the contents of this and the given facet pairing.
|
|
|
size_t | size () const |
| Returns the number of simplices whose facets are described by this facet pairing.
|
|
const FacetSpec< dim > & | dest (const FacetSpec< dim > &source) const |
| Returns the other facet to which the given simplex facet is paired.
|
|
const FacetSpec< dim > & | dest (size_t simp, int facet) const |
| Returns the other facet to which the given simplex facet is paired.
|
|
const FacetSpec< dim > & | operator[] (const FacetSpec< dim > &source) const |
| Returns the other facet to which the given simplex facet is paired.
|
|
bool | isUnmatched (const FacetSpec< dim > &source) const |
| Determines whether the given simplex facet has been left deliberately unmatched.
|
|
bool | isUnmatched (size_t simp, int facet) const |
| Determines whether the given simplex facet has been left deliberately unmatched.
|
|
bool | isClosed () const |
| Determines whether this facet pairing is closed.
|
|
bool | operator== (const FacetPairing< dim > &other) const |
| Determines if this and the given facet pairing are identical.
|
|
bool | operator!= (const FacetPairing< dim > &other) const |
| Determines if this and the given facet pairing are not identical.
|
|
|
bool | isConnected () const |
| Determines whether this facet pairing is connected.
|
|
std::optional< Cut > | divideConnected (size_t minSide) const |
| Returns a cut that divides this facet pairing into two connected pieces, both of size at least minSide.
|
|
|
bool | isCanonical () const |
| Determines whether this facet pairing is in canonical form.
|
|
std::pair< FacetPairing< dim >, Isomorphism< dim > > | canonical () const |
| Returns the canonical form of this facet pairing, along with one isomorphism that transforms this pairing into canonial form.
|
|
std::pair< FacetPairing< dim >, IsoList > | canonicalAll () const |
| Returns the canonical form of this facet pairing, along with the list of all isomorphisms that transform this pairing into canonial form.
|
|
IsoList | findAutomorphisms () const |
| Returns the set of all combinatorial automorphisms of this facet pairing, assuming the pairing is already in canonical form.
|
|
|
void | writeTextShort (std::ostream &out) const |
| Writes a human-readable representation of this facet pairing to the given output stream.
|
|
std::string | textRep () const |
| Returns a text-based representation that can be used to reconstruct this facet pairing.
|
|
std::string | toTextRep () const |
| Deprecated routine that returns a text-based representation that can be used to reconstruct this facet pairing.
|
|
void | tightEncode (std::ostream &out) const |
| Writes the tight encoding of this facet pairing to the given output stream.
|
|
void | writeDot (std::ostream &out, const char *prefix=nullptr, bool subgraph=false, bool labels=false) const |
| Writes the graph corresponding to this facet pairing in the Graphviz DOT language.
|
|
std::string | dot (const char *prefix=nullptr, bool subgraph=false, bool labels=false) const |
| Returns a Graphviz DOT representation of the graph that describes this facet pairing.
|
|
FacetSpec< dim > & | dest (const FacetSpec< dim > &source) |
| Returns the other facet to which the given simplex facet is paired.
|
|
FacetSpec< dim > & | dest (size_t simp, int facet) |
| Returns the other facet to which the given simplex facet is paired.
|
|
FacetSpec< dim > & | operator[] (const FacetSpec< dim > &source) |
| Returns the other facet to which the given simplex facet is paired.
|
|
bool | noDest (const FacetSpec< dim > &source) const |
| Determines whether the matching for the given simplex facet has not yet been determined.
|
|
bool | noDest (size_t simp, int facet) const |
| Determines whether the matching for the given simplex facet has not yet been determined.
|
|
bool | isCanonicalInternal (IsoList *list=nullptr) const |
| Determines whether this facet pairing is in canonical (smallest lexicographical) form, given a small set of assumptions.
|
|
static FacetPairing< dim > | fromTextRep (const std::string &rep) |
| Reconstructs a facet pairing from a text-based representation.
|
|
static FacetPairing< dim > | tightDecode (std::istream &input) |
| Reconstructs a facet pairing from its given tight encoding.
|
|
static void | writeDotHeader (std::ostream &out, const char *graphName=nullptr) |
| Writes header information for a Graphviz DOT file that will describe the graphs for one or more facet pairings.
|
|
static std::string | dotHeader (const char *graphName=nullptr) |
| Returns header information for a Graphviz DOT file that will describe the graphs for one or more facet pairings.
|
|
template<typename Action , typename... Args> |
static void | findAllPairings (size_t nSimplices, BoolSet boundary, int nBdryFacets, Action &&action, Args &&... args) |
| Generates all possible facet pairings satisfying the given constraints.
|
|
template<int dim>
class regina::FacetPairing< dim >
Represents the dual graph of a dim-manifold triangulation; that is, the pairwise matching of facets of dim-dimensional simplices.
Given a fixed number of dim-dimensional simplices, each facet of each simplex is either paired with some other simplex facet (which is in turn paired with it) or remains unmatched. A simplex facet cannot be paired with itself.
Such a matching models part of the structure of a dim-manifold triangulation, in which each simplex facet is either glued to some other simplex facet (which is in turn glued to it) or is an unglued boundary facet. Note however that a facet pairing does not contain enough information to fully reconstruct a triangulation, since the permutations used for each individual gluing are not stored.
Facet pairings are labelled, in that the simplices are explicitly numbered 0,1,..., and the facets of each simplex are explicitly numbered 0,...,dim (just like in a triangulation). Facet pairings do also come with code to help identify and work with relabellings, via isomorphisms, automorphisms, and canonical representations. In this context:
- An isomorphism of a facet pairing means a relabelling of the simplices and a relabelling of the (dim + 1) facets within each simplex; this can be represented by the same class Isomorphism<dim> that is used for isomorphisms of triangulations.
- An automorphism of a facet pairing is an isomorphism that, when applied, results in an identical facet pairing (i.e., where exactly the same pairs of labelled simplex facets are matched together).
- A facet pairing is in canonical form if it is a lexicographically minimal representative of its isomorphism class. Here we order facet pairings by lexicographical comparison of the sequence
dest(0,0)
, dest(0,1)
, ..., dest(size()-1, dim)
(which in turn uses the ordering defined by FacetSpec<dim>, where each simplex facet is ordered first by simplex number and then by facet number, and where the boundary is ordered last).
For dimension 3, this FacetPairing class template is specialised and offers more functionality. In order to use this specialised class, you will need to include the corresponding header triangulation/facetpairing3.h.
This class implements C++ move semantics and adheres to the C++ Swappable requirement. It is designed to avoid deep copies wherever possible, even when passing or returning objects by value.
- Python
- Python does not support templates. Instead this class can be used by appending the dimension as a suffix (e.g., FacetPairing2 and FacetPairing3 for dimensions 2 and 3).
- Template Parameters
-
dim | the dimension of the underlying triangulation. This must be between 2 and 15 inclusive. |
Returns a Graphviz DOT representation of the graph that describes this facet pairing.
Every vertex of this graph represents a simplex, and every edge represents a pair of simplex facets that are joined together. Note that for a closed triangulation this graph will be entirely (dim + 1)-valent; for triangulations with boundary facets, some graph vertices will have degree dim or less.
The graph can either be written as a complete DOT graph, or as a clustered subgraph within some larger DOT graph (according to whether the argument subgraph is passed as false
or true
).
If a complete DOT graph is being written, the output may be used as a standalone DOT file ready for use with Graphviz.
If a subgraph is being written, the output will contain a single subgraph
section that should be inserted into some larger DOT file. Note that the output generated by dotHeader() or writeDotHeader(), followed by one or more subgraphs and then a closing curly brace will suffice. The subgraph name will begin with the string pairing_
.
The argument prefix will be prepended to the name of each graph vertex, and will also be used in the name of the graph or subgraph. Using unique prefixes becomes important if you are calling dot() or writeDot() several times to generate several subgraphs for use in a single DOT file. If the prefix argument is null or empty then a default prefix will be used.
Note that this routine generates undirected graphs, not directed graphs. The final DOT file should be used with either the neato or fdp programs shipped with Graphviz.
If you are simply writing this string to an output stream then you should call writeDot() instead, which is more efficient.
- Parameters
-
prefix | a string to prepend to the name of each graph vertex, and to include in the graph or subgraph name; see above for details. |
subgraph | false if a complete standalone DOT graph should be output, or true if a clustered subgraph should be output for use in some larger DOT file. |
labels | indicates whether graph vertices will be labelled with the corresponding simplex numbers. This feature is currently experimental, and the default is false . |
- Returns
- the output of writeDot(), as outlined above.
Returns header information for a Graphviz DOT file that will describe the graphs for one or more facet pairings.
See the dot() documentation for further information on such graphs.
The output will be in the Graphviz DOT language, and will include appropriate display settings for graphs, edges and nodes. The opening brace for a graph
section of the DOT file is included.
This routine may be used with dot() or writeDot() to generate a single DOT file containing the graphs for several different facet pairings. A complete DOT file can be produced by calling this routine, then calling dot() or writeDot() in subgraph mode for each facet pairing, then outputting a final closing curly brace.
Note that if you require a DOT file containing the graph for only a single facet pairing, this routine is unnecessary; you may simply call dot() or writeDot() in full graph mode instead.
This routine is suitable for generating undirected graphs, not directed graphs. The final DOT file should be used with either the neato or fdp programs shipped with Graphviz.
If you are simply writing this string to an output stream then you should call writeDotHeader() instead, which is more efficient.
- Parameters
-
graphName | the name of the graph to write in the DOT header. If this is null or empty then a default graph name will be used. |
- Returns
- the DOT header information, as outlined above.
- See also
- http://www.graphviz.org/
template<int dim>
template<typename Action , typename... Args>
Generates all possible facet pairings satisfying the given constraints.
Only connected facet pairings (pairings in which each simplex can be reached from each other via a series of individual matched facets) will be produced.
Each facet pairing will be produced precisely once up to isomorphism. Facet pairings are considered isomorphic if they are related by a relabelling of the simplices and/or a renumbering of the (dim + 1) facets of each simplex. Each facet pairing that is generated will be a lexicographically minimal representative of its isomorphism class, i.e., will be in canonical form as described by isCanonical().
For each facet pairing that is generated, this routine will call action (which must be a function or some other callable object).
- The first argument to action must be a const reference to a FacetPairing<dim>. This will be the facet pairing that was found. If action wishes to keep the facet pairing, it should take a deep copy (not a reference), since the facet pairing may be changed and reused after action returns.
- If action takes a FacetPairing<dim>::IsoList as its second argument (which may be as a reference, and may have const/volatile qualifiers), then this will be the list of all automorphisms of the facet pairing that was found. This list will be passed by value using move semantics. If action does not take a second argument, or if the second argument is of a different type, then the list of automorphisms will not be passed.
- If there are any additional arguments supplied in the list args, then these will be passed as subsequent arguments to action.
- action must return
void
.
Because this class cannot represent an empty facet pairing, if the argument nSimplices is zero then no facet pairings will be generated at all.
- Warning
- If you are allowing a large number of boundary facets, then the automorphisms groups could be enormous. In this case it is highly recommended that your action does not take the list of all automorphisms as its second argument, since this will avoid the enormous memory cost of storing and passing such a list.
- Todo
Optimise (long-term): When generating facet pairings, do some checking to eliminate cases in which simplex (k > 0) can be swapped with simplex 0 to produce a smaller representation of the same pairing.
Feature: Allow cancellation of facet pairing generation.
- Python
- This function is available, and action may be a pure Python function. However, its form is more restricted: action must take both a facet pairing and its automorphisms (i.e., the automorphisms argument is not optional); moreover, it cannot take any additional arguments beyond these. As a consequence, the additional args list is omitted also.
- Parameters
-
nSimplices | the number of simplices whose facets should be (potentially) matched. |
boundary | determines whether any facets may be left unmatched. This set should contain true if pairings with at least one unmatched facet are to be generated, and should contain false if pairings with no unmatched facets are to be generated. |
nBdryFacets | specifies the precise number of facets that should be left unmatched. If this parameter is negative, it is ignored and no additional restriction is imposed. If parameter boundary does not contain true , this parameter is likewise ignored. If parameter boundary does contain true and this parameter is non-negative, only pairings with precisely this many unmatched facets will be generated. In particular, if this parameter is positive then pairings with no unmatched facets will not be produced irrespective of whether false is contained in parameter boundary. Note that, in order to produce any pairings at all, this parameter must be of the same parity as nSimplices * (dim+1) , and can be at most (dim-1) * nSimplices + 2 . |
action | a function (or other callable object) to call for each facet pairing that is found. |
args | any additional arguments that should be passed to action, following the initial facet pairing argument and the optional automorphism argument. |