|
void | writeTextShort (std::ostream &out) const |
| Writes a human-readable representation of this facet pairing to the given output stream. More...
|
|
std::string | toTextRep () const |
| Returns a text-based representation of this facet pairing that can be used to reconstruct the facet pairing. More...
|
|
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. More...
|
|
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. More...
|
|
FacetSpec< dim > & | dest (const FacetSpec< dim > &source) |
| Returns the other facet to which the given simplex facet is paired. More...
|
|
FacetSpec< dim > & | dest (size_t simp, unsigned facet) |
| Returns the other facet to which the given simplex facet is paired. More...
|
|
FacetSpec< dim > & | operator[] (const FacetSpec< dim > &source) |
| Returns the other facet to which the given simplex facet is paired. More...
|
|
bool | noDest (const FacetSpec< dim > &source) const |
| Determines whether the matching for the given simplex facet has not yet been determined. More...
|
|
bool | noDest (size_t simp, unsigned facet) const |
| Determines whether the matching for the given simplex facet has not yet been determined. More...
|
|
bool | isCanonicalInternal (IsoList &list) const |
| Determines whether this facet pairing is in canonical (smallest lexicographical) form, given a small set of assumptions. More...
|
|
static FacetPairing< dim > | fromTextRep (const std::string &rep) |
| Reconstructs a facet pairing from a text-based representation. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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 that if this pairing is used to construct an actual triangulation, the individual gluing permutations will still need to be specified; they are not a part of this structure.
For dimension 3, this 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. |
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.
- The second argument to action must be a FacetPairing<dim>::IsoList (this will be passed by value using move semantics). This will be the list of all automorphisms of the facet pairing that was found.
- 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.
- 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, action cannot take any additional arguments beyond the facet pairing and its automorphisms (and therefore the additional args list is omitted here).
- 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 and automorphism arguments. |
Determines whether this facet pairing is in canonical form, i.e., is a lexicographically minimal representative of its isomorphism class.
Isomorphisms of facet pairings correspond to relabellings of simplices and relabellings of the (dim + 1) facets within each simplex.
Facet pairings are ordered by lexicographical comparison of dest(0,0)
, dest(0,1)
, ..., dest(size()-1,dim)
.
- Precondition
- This facet pairing is connected, i.e., it is possible to reach any simplex from any other simplex via a series of matched facet pairs.
- Returns
true
if and only if this facet pairing is in canonical form.
template<class T , bool supportsUtf8 = false>
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.
template<class T , bool supportsUtf8 = false>
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.
Writes the graph corresponding to this facet pairing in the Graphviz DOT language.
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 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 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.
- Python
- Not present; instead use the variant dot() that returns a string.
- Parameters
-
out | the output stream to which to write. |
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 . |
- See also
- http://www.graphviz.org/
Writes header information for a Graphviz DOT file that will describe the graphs for one or more facet pairings.
See the writeDot() 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 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 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 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.
- Python
- Not present; instead use the variant dotHeader() that returns a string.
- Parameters
-
out | the output stream to which to write. |
graphName | the name of the graph in the DOT file. If this is null or empty then a default graph name will be used. |
- See also
- http://www.graphviz.org/