4
4
* Regina - A Normal Surface Theory Calculator *
5
5
* Computational Engine *
7
* Copyright (c) 1999-2009, Ben Burton *
7
* Copyright (c) 1999-2011, Ben Burton *
8
8
* For further details contact Ben Burton (bab@debian.org). *
10
10
* This program is free software; you can redistribute it and/or *
83
84
* \todo \feature Composition of isomorphisms.
85
class NIsomorphism : public ShareableObject {
86
class REGINA_API NIsomorphism : public ShareableObject {
87
88
unsigned nTetrahedra;
88
89
/**< The number of tetrahedra in the source triangulation. */
90
91
/**< The tetrahedron of the destination triangulation that
91
92
each tetrahedron of the source triangulation maps to. */
93
94
/**< The permutation applied to the four faces of each
94
95
source tetrahedron. */
165
166
* @return a read-write reference to the permutation applied to the
166
167
* four faces of the source tetrahedron.
168
NPerm& facePerm(unsigned sourceTet);
169
NPerm4& facePerm(unsigned sourceTet);
170
171
* Determines the permutation that is applied to the four faces
171
172
* of the given source tetrahedron under this isomorphism.
179
180
* @return the permutation applied to the four faces of the
180
181
* source tetrahedron.
182
NPerm facePerm(unsigned sourceTet) const;
183
NPerm4 facePerm(unsigned sourceTet) const;
184
185
* Determines the image of the given source tetrahedron face
185
186
* under this isomorphism. Note that a value only is returned; this
206
207
bool isIdentity() const;
209
* Applies this isomorphism to the given triangulation.
210
* Applies this isomorphism to the given triangulation and
211
* returns the result as a new triangulation.
211
213
* The given triangulation (call this T) is not modified in any way.
212
214
* A new triangulation (call this S) is returned, so that this
245
247
NTriangulation* apply(const NTriangulation* original) const;
250
* Applies this isomorphism to the given triangulation,
251
* modifying the given triangulation directly.
253
* This is similar to apply(), except that instead of creating a
254
* new triangulation, the tetrahedra and vertices of the given
255
* triangulation are modified directly.
257
* See apply() for further details on how this operation is performed.
259
* As with apply(), there are several preconditions to this routine.
260
* This routine does a small amount of sanity checking (and returns
261
* without changes if an error is detected), but it certainly does
262
* not check the entire set of preconditions. It is up to the
263
* caller of this routine to verify that all of the following
264
* preconditions are met.
266
* \pre The number of tetrahedra in the given triangulation is
267
* precisely the number returned by getSourceTetrahedra() for
269
* \pre This is a valid isomorphism (i.e., it has been properly
270
* initialised, so that all tetrahedron images are non-negative
271
* and distinct, and all face permutations are real permutations
273
* \pre Each tetrahedron image for this isomorphism lies
274
* between 0 and <tt>getSourceTetrahedra()-1</tt> inclusive
275
* (i.e., this isomorphism does not represent a mapping from a
276
* smaller triangulation into a larger triangulation).
278
* @param tri the triangulation to which this isomorphism
281
void applyInPlace(NTriangulation* tri) const;
247
283
void writeTextShort(std::ostream& out) const;
248
284
void writeTextLong(std::ostream& out) const;
310
346
mTetImage(sourceTetrahedra > 0 ?
311
347
new int[sourceTetrahedra] : 0),
312
348
mFacePerm(sourceTetrahedra > 0 ?
313
new NPerm[sourceTetrahedra] : 0) {
349
new NPerm4[sourceTetrahedra] : 0) {
315
351
inline NIsomorphism::~NIsomorphism() {
316
352
delete[] mTetImage;
328
364
return mTetImage[sourceTet];
331
inline NPerm& NIsomorphism::facePerm(unsigned sourceTet) {
367
inline NPerm4& NIsomorphism::facePerm(unsigned sourceTet) {
332
368
return mFacePerm[sourceTet];
334
inline NPerm NIsomorphism::facePerm(unsigned sourceTet) const {
370
inline NPerm4 NIsomorphism::facePerm(unsigned sourceTet) const {
335
371
return mFacePerm[sourceTet];