Regina - Moving from 4.x to 5.x

This page relates only to C++ and Python programmers.

Regina is undergoing major changes to its C++ and Python interfaces. These changes are happening in two stages:

  1. Over many years, Regina's classes and routines have been simplified and improved in many ways, and much of its old code has become unnecessary. Nevertheless, the old classes and routines were kept around until Regina 5.0 so that old scripts would still work. All of this old code was removed in Regina 5.1.
  2. A second (much simpler) round of changes is now underway, mostly to simplify class names and C++ header locations. These changes were implemented in Regina 5.1, though the old class names and headers will be kept around for backward compatibility until Regina 6.0.

How do I fix my code?

First-round changes (Regina 4.x to 5.x)

There are some general rules that cover many of the changes:

Beyond these general rules, many other routines and classes will be (or already have been) removed. These are listed in the table below, along with suggested replacements that you can use instead. Any changes in the behaviour of these routines or classes are noted in the comments column.

Deprecated code Replacement Comments
Namespaces
stdhash To improve portability, all references to the non-standard STL classes hash_set and hash_map will be removed from Regina.
Headers
census/dim2edgepairing.h dim2/dim2edgepairing.h  
census/nfacepairing.h triangulation/nfacepairing.h  
census/ngenericfacetpairing.h and -impl.h generic/facetpairing.h and -impl.h  
foreign/csvsurfacelist.h surfaces/nnormalsurfacelist.h  
generic/dimtraits.h With the new templated triangulation code, dimtraits now serves no purpose.
generic/nfacetspec.h generic/facetspec.h  
maths/nlargeinteger.h maths/ninteger.h  
surfaces/flavourregistry.h surfaces/coordregistry.h  
triangulation/dimtraits.h, triangulation/nfacetspec.h, triangulation/ngenericisomorphism.h —, generic/facetspec.h, generic/ngenericisomorphism.h The header dimtraits.h is now empty.
triangulation/nperm.h maths/nperm4.h This header provided the class NPerm, which has likewise been renamed to NPerm4.
utilities/hashmap.h, utilities/hashset.h, utilities/hashutils.h See the comments above for the stdhash namespace.
utilities/nmatrix2.h maths/nmatrix2.h The header has simply been moved. The classes that it provides remain the same.
utilities/nmpi.h maths/ninteger.h  
utilities/nrational.h maths/nrational.h The header has simply been moved. The classes that it provides remain the same.
Typedefs
AcceptTriangulation, Dim2Census::AcceptTriangulation, NCensus::AcceptTriangulation See the comments below for Dim2Census::formCensus() and NCensus::formCensus().
NFacePairingIsoList NFacePairing::IsoList  
NTriangulation::FaceIterator NTriangulation::TriangleIterator  
UseFacePairing NFacePairing::Use  
Constants
NCensus::PURGE_... NGluingPermSearcher::PURGE_...  
NFileInfo::TYPE_BINARY See the comments below for the NFile class.
NNormalSurfaceList::STANDARD, NNormalSurfaceList::QUAD, etc. NS_STANDARD, NS_QUAD, etc. These are now members of a global enum type, defined in surfaces/normalcoords.h.
NNormalSurfaceVector::coordType NNormalSurfaceVector::coordsID Applies to every subclass of NNormalSurfaceVector. This is now a constant of type NormalCoords.
NPacket::packetType NPacket::typeID Applies to every subclass of NPacket. This is now a constant of type PacketType.
NS_FACE_ARCS NS_TRIANGLE_ARCS  
NSurfaceFilter::filterID, NSurfaceFilter::filterType NSurfaceFilter::filterTypeID This change also applies to every subclass of NSurfaceFilter.
NVertex::NON_STANDARD_BDRY NVertex::INVALID  
Classes
HashPointer, HashString See the comments above for the stdhash namespace.
NDoubleDescription::LexComp NPosOrder  
NDoubleDescriptor NDoubleDescription  
NewFunction1 NewFunction The second template argument to NewFunction1 is no longer required—NewFunction will automatically infer it.
NewNormalSurfaceVector NewFunction<NNormalSurfaceVector>  
NFace NTriangle  
NFaceEmbedding NTriangleEmbedding  
NFacetSpec FacetSpec  
NFastRay NRay The class NRay and NFastRay have been merged; see the API docs for details.
NFastVector NVector The class NVector and NFastVector have been merged; see the API docs for details.
NFile The NFile class exists purely to support the old binary file format that was phased out back in 2002. Regina 5.0 will drop support for this old binary file format entirely.
NFilePropertyReader See the comments above for the NFile class.
NIndexedArray NMarkedVector does a similar job (and is smaller and faster), though it requires changes to the data types in your array.
NIsomorphismDirect NIsomorphism NIsomorphism now contains all the functionality of the old NIsomorphismDirect class.
NIsomorphismIndexed Instead, use NIsomorphism in conjunction with the NPerm4::S4 array.
NMutex std::mutex and related classes  
NPacket::ChangeEventBlock NPacket::ChangeEventSpan  
NPerm NPerm4  
NPermItS4 Instead, just loop through the elements of NPerm4::S4 directly.
NPrismSetSurface Removed from Python, but just deprecated in C++. This class never had any function.
NProgress, NProgressFinished, NProgressManager, NProgressMessage, NProgressNumber, NProgressStateNumeric NProgressTracker NProgressTracker offers a unified and more streamlined interface for progress tracking.
NRandomAccessResource, NLocalFileResource See the comments above for the NFile class.
NSurfaceSet Just use NNormalSurfaceList and/or NSurfaceSubset directly.
NThread std::thread and related classes  
NTriBool Please change your code to use native bool instead.
NVectorDense NVector The new NVector uses dense storage, just like the old NVectorDense.
NVectorMatrix NVector Only dense storage is offered now, as in the old class NVectorDense.
NVectorUnit NVector Only dense storage is offered now, as in the old class NVectorDense.
Member Routines
...::readFromFile(NFile&, ...) See the comments above for the NFile class.
...::writeToFile(NFile&) See the comments above for the NFile class.
Dim2Census::formCensus(), Dim2Census::formPartialCensus() You should now call Dim2EdgePairing::findAllPairings() and Dim2GluingPermSearcher::findAllPerms() directly.
Dim2Component::getNumberOfSimplices() Dim2Component::size()  
Dim2Isomorphism::getSourceSimplices() Dim2Isomorphism::size()  
Dim2Triangle::joinTo() Dim2Triangle::join()  
Dim2Triangulation::getNumberOfSimplices() Dim2Triangulation::size()  
Dim2Triangulation::vertexIndex(), Dim2Triangulation::edgeIndex(), etc. Dim2Vertex::index(), Dim2Edge::index(), etc.  
NAngleStructureList::allowsStrict() NAngleStructureList::spansStrict()  
NAngleStructureList::allowsTaut() NAngleStructureList::spansTaut()  
NAngleStructureList::getNumberOfStructures() NAngleStructureList::size()  
NAngleStructureVector::clone() NAngleStructureVector copy constructor  
NBoundaryComponent::getEulerCharacteristic() NBoundaryComponent::eulerChar()  
NBoundaryComponent::getFace(), NBoundaryComponent::getNumberOfFaces() NBoundaryComponent::triangle(), NBoundaryComponent::countTriangles()  
NCensus::formCensus(), NCensus::formPartialCensus() You should now call NFacePairing::findAllPairings() and NGluingPermSearcher::findAllPerms() directly.
NCensus::formCensus(..., NProgressManager*) — (see above) The final NProgressManager argument has been removed.
NCensus::mightBeMinimal() NTriangulation::simplifyToLocalMinimal(false)  
NComponent::getFace(), NComponent::getNumberOfFaces(), NComponent::hasBoundaryFaces() NComponent::triangle(), NComponent::countTriangles(), NComponent::hasBoundaryTriangles()  
NComponent::getNumberOfSimplices() NComponent::size()  
NDoubleDescription::enumerateExtremalRays() Same function but different arguments The base argument is gone, and a new template argument has taken its place. See the API docs for details.
NExampleTriangulation::lens8_3(), NExampleTriangulation::lst3_4_7() NExampleTriangulation::lens(8,3), NExampleTriangulation::lst(3,4)  
NExampleTriangulation::figureEightKnotComplement(), NExampleTriangulation::seifertWeber(), NExampleTriangulation::trefoilKnotComplement(), NExampleTriangulation::whiteheadLinkComplement() NExampleTriangulation::figureEight(), NExampleTriangulation::weberSeifert(), NExampleTriangulation::trefoil(), NExampleTriangulation::whiteheadLink()  
NFaceEmbedding::getFace() NTriangleEmbedding::triangle()  
NFacePairing::getNumberOfTetrahedra() NFacePairing::size()  
NGroupPresentation::toStringCompact() NGroupPresentation::compact()  
NHilbertCD::enumerateHilbertBasis(..., NProgressMessage*) NHilbertCD::enumerateHilbertBasis(...) The final progress tracking argument has been removed.
NHomMarkedAbelianGroup::...   Several routines have been deprecated, and several others added in their place. See the API docs for details.
NIsomorphism::getSourceSimplices() NIsomorphism::size()  
NLayeredLoop::getIndex() NLayeredLoop::length()  
NLayeredSolidTorus::getNumberOfTetrahedra() NLayeredSolidTorus::size()  
NManifold::getHomologyH1() NManifold::homology() Applies to all subclasses of NManifold. homology() also has an alias homologyH1().
NMarkedAbelianGroup::...   Several routines have been deprecated, and several others added in their place. See the API docs for details.
NNormalSurface::boundarySlopes() NNormalSurface::boundaryIntersections() This change is to clarify that the routine returns algebraic intersection numbers, not (m,l) pairs.
NNormalSurface::findNonTrivialSphere() NTriangulation::hasNonTrivialSphereOrDisc()  
NNormalSurface::findVtxOctAlmostNormalSphere() NTriangulation::hasOctagonalAlmostNormalSphere()  
NNormalSurface::getEulerCharacteristic() NNormalSurface::eulerChar()  
NNormalSurface::getFaceArcs(), NNormalSurface::arcs()  
NNormalSurface::getTriangleCoord(), NNormalSurface::getQuadCoord(), NNormalSurface::getOctCoord(), NNormalSurface::getTriangleArcs(), etc. NNormalSurface::triangles(), NNormalSurface::quads(), NNormalSurface::octs(), NNormalSurface::arcs(), etc.  
NNormalSurfaceList::enumerate(), NNormalSurfaceList::enumerateStandardDirect(), NNormalSurfaceList::enumerateStandardANDirect(), NNormalSurfaceList::enumerateFundPrimal(), NNormalSurfaceList::enumerateFundDual(), NNormalSurfaceList::enumerateFundCD(), NNormalSurfaceList::enumerateFundFullCone() NNormalSurfaceList::enumerate(NTriangulation*, NormalCoords, NormalList, NormalAlg, NProgressTracker*) All of the old enumeration routines have been amalgamated into a single “universal” enumeration routine. The arguments let you specify which surfaces you wish to enumerate and/or which algorithm you wish to use.
NNormalSurfaceList::flavour(), NNormalSurfaceList::getFlavour() NNormalSurfaceList::coords()  
NNormalSurfaceList::getShareableObject() Since this class no longer inherits from NSurfaceSet, this function is no longer necessary.
NNormalSurfaceList::getNumberOfSurfaces() NNormalSurfaceList::size()  
NNormalSurfaceSubset::getFlavour() NNormalSurfaceSubset::coords()  
NNormalSurfaceSubset::getNumberOfSurfaces() NNormalSurfaceSubset::size()  
NNormalSurfaceVector::getFaceArcs() NNormalSurfaceVector::arcs()  
NNormalSurfaceVector::getTriangleCoord(), NNormalSurfaceVector::getQuadCoord(), NNormalSurfaceVector::getOctCoord(), NNormalSurfaceVector::getTriangleArcs(), etc. NNormalSurfaceVector::triangles(), NNormalSurfaceVector::quads(), NNormalSurfaceVector::octs(), NNormalSurfaceVector::arcs(), etc.  
NPacket::getPacketLabel(), NPacket::setPacketLabel(), NPacket::getPacketType(), NPacket::getPacketTypeName() NPacket::label(), NPacket::setLabel(), NPacket::type(), NPacket::typeName()  
NPacket::getTreeParent(), NPacket::getFirstTreeChild(), NPacket::getLastTreeChild(), NPacket::getNextTreeSibling(), NPacket::getPrevTreeSibling(), NPacket::getMatriarch() NPacket::parent(), NPacket::firstChild(), NPacket::lastChild(), NPacket::nextSibling(), NPacket::prevSibling(), NPacket::root()  
NPacket::getXMLReader() NPacket::xmlReader() Applies to every subclass of NPacket.
NPacket::readPacket() See the comments above for the NFile class.
NPacket::writePacket() See the comments above for the NFile class.
NPerm<n>::setPerm() Instead, just use the assignment operator, as in p = NPerm4(1,2).
NPerm<n>::toString() NPerm<n>::str()  
NPillowTwoSphere::getFace(), NPillowTwoSphere::getFaceMapping() NPillowTwoSphere::triangle(), NPillowTwoSphere::triangleMapping()  
NScript::getLine(), NScript::getNumberOfLines(), NScript::addFirst(), NScript::addLast(), NScript::insertAtPosition(), NScript::replaceAtPosition(), NScript::removeLineAt(), NScript::removeAllLines() NScript::text(), NScript::setText(), NScript::append() The NScript access methods now work with the text as a whole, not one line at a time.
NSatRegion::createSFS(long, bool) NSatRegion::createSFS(bool) The first argument (the number of boundary components) is now automatically deduced.
NSnapPeaTriangulation::NSnapPeaTriangulation(const NTriangulation&, bool) NSnapPeaTriangulation::NSnapPeaTriangulation(const NTriangulation&) The second argument (whether to allow closed trianglations) is ignored, since closed triangulations are now supported always.
NSnapPeaTriangulation::saveAsSnapPea() NSnapPeaTriangulation::saveSnapPea()  
NSnapPeaTriangulation::dump() std::cout << NSnapPeaTriangulation::snapPea()  
NSnapPeaTriangulation::toRegina(), NSnapPeaTriangulation::verifyTriangulation() These are no longer needed, since NSnapPeaTriangulation is now a hybrid packet that combines SnapPea and Regina functionality, and that inherits directly from NTriangulation.
NSpiralSolidTorus::getNumberOfTetrahedra() NSpiralSolidTorus::size()  
NStandardTriangulation::getHomologyH1() NStandardTriangulation::homology() Applies to all subclasses of NStandardTriangulation. homology() also has an alias homologyH1().
NSurfaceFilter::getFilterID(), NSurfaceFilter::getFilterName() NSurfaceFilter::filterType(), NSurfaceFilter::filterTypeName()  
NSurfaceFilter::readFilter() See the comments above for the NFile class.
NSurfaceFilter::writeFilter() See the comments above for the NFile class.
NSurfaceFilter::writeProperties() See the comments above for the NFile class.
NSurfaceFilterProperties::addEC(), NSurfaceFilterProperties::removeEC(), NSurfaceFilterProperties::removeAllECs() NSurfaceFilterProperties::addEulerChar(), NSurfaceFilterProperties::removeEulerChar(), NSurfaceFilterProperties::removeAllEulerChars()  
NSurfaceFilterProperties::getEC(), NSurfaceFilterProperties::getECs(), NSurfaceFilterProperties::getNumberOfECs() NSurfaceFilterProperties::eulerChar(), NSurfaceFilterProperties::eulerChars(), NSurfaceFilterProperties::countEulerChars()  
NSurfaceSet::getShareableObject() Since this class no longer inherits from NSurfaceSet, this function is no longer necessary.
NTetrahedron constructors NTriangulation::newTetrahedron() Tetrahedra must always belong to a triangulation. You should no longer create tetrahedra independently.
NTetrahedron::getAdjacentTetrahedron(), NTetrahedron::getAdjacentTetrahedronGluing(), NTetrahedron::getAdjacentFace() NTetrahedron::adjacentTetrahedron(), NTetrahedron::adjacentGluing(), NTetrahedron::adjacentFace()  
NTetrahedron::getFace(), NTetrahedron::getFaceMapping() NTetrahedron::triangle(), NTetrahedron::triangleMapping()  
NTetrahedron::joinTo() NTetrahedron::join()  
NTriangulation::addTetrahedron() NTriangulation::newTetrahedron() Tetrahedra must always belong to a triangulation. You should no longer create tetrahedra independently.
NTriangulation::faceIndex(), NTriangulation::getFace(), NTriangulation::getFaceIndex(), NTriangulation::getFaces(), NTriangulation::getNumberOfFaces(), NTriangulation::hasBoundaryFaces() NTriangle::index(), NTriangulation::triangle(), NTriangle::index(), NTriangulation::triangles(), NTriangulation::countTriangles(), NTriangulation::hasBoundaryTriangles()  
NTriangulation::getEulerCharacteristic() NTriangulation::eulerCharTri() or NTriangulation::eulerCharManifold() Note that the two replacement routines give different results for ideal triangulations. The old getEulerCharacteristic() was equivalent to the new eulerCharTri().
NTriangulation::getHomologyH1(), NTriangulation::getHomologyH1Rel(), NTriangulation::getHomologyH1Bdry() NTriangulation::homology(), NTriangulation::homologyRel(), NTriangulation::homologyBdry() homology() also has the alias homologyH1().
NTriangulation::getNumberOfSimplices() NTriangulation::size()  
NTriangulation::getVertexIndex(), NTriangulation::getEdgeIndex(), etc. NVertex::index(), NEdge::index, etc.  
NTriangulation::gluingsHaveChanged() This is now handled automatically.
NTriangulation::vertexIndex(), NTriangulation::edgeIndex(), etc. NVertex::index(), NEdge::index(), etc.  
NVertex::getLinkEulerCharacteristic() NVertex::linkEulerChar()  
Global Routines
edgeDescription(), edgeOrdering() NPerm4::trunc2(), NEdge::ordering()  
faceDescription(), faceOrdering() NPerm4::trunc3(), NTriangle::ordering()  
factorise() NPrimes::primeDecomp(), NPrimes::primePowerDecomp()  
forFlavour() forCoords()  
perm3to4(), perm4to5(), perm3to5() NPerm<n>::extend()  
perm4to3(), perm5to3(), perm5to4() NPerm<n>::contract()  
primesUpTo() NPrimes::prime()  
readFileMagic() open() The new open() routine is declared in packet/npacket.h, not file/nxmlfile.h.
readFromFile() See the comments above for the NFile class.
readPDF() NPDF::NPDF()  
readSnapPea() NSnapPeaTriangulation::NSnapPeaTriangulation() The new NSnapPeaTriangulation constructor also preserves SnapPea-specific data (such as fillings and peripheral curves), which the old routine does not.
readXMLFile() open() The new open() routine is declared in packet/npacket.h, not file/nxmlfile.h.
writeCSVStandard(), writeCSVEdgeWeight() NNormalSurfaceList::saveCSVStandard(), NNormalSurfaceList::saveCSVEdgeWeight()  
writePDF() NPDF::savePDF()  
writeRecogniser(), writeRecognizer() NTriangulation::saveRecogniser(), NTriangulation::saveRecognizer()  
writeSnapPea() NTriangulation::saveSnapPea() (for file output), NTriangulation::snapPea() (for stream output)  
writeToFile() See the comments above for the NFile class.
writeXMLFile() NPacket::save()  
Global Arrays
edgeNumber[], edgeStart[], edgeEnd[] NEdge::edgeNumber[], NEdge::edgeVertex[]  
allPermsS2[] NPerm4::S2[]  
allPermsS3[], orderedPermsS3[] NPerm4::S3[], NPerm4::orderedS3[]
 
allPermsS4[], allPermsS4Inv[], orderedPermsS4[] NPerm4::S4[], NPerm4::invS4[], NPerm4::orderedS4[]  
NPerm4::invS3[], allPermsS3Inv[] NPerm3::invS3[]  
NPerm4::invS2[], allPermsS2Inv[] This array is unnecessary, since inverses in S2 are trivial.
vertexSplit[][], vertexSplitDefn[][], vertexSplitMeeting[][][], vertexSplitPartner[][], vertexSplitString[] quadSeparating[][], quadDefn[][], quadMeeting[][][], quadPartner[][], quadString[]  
Macros
REGISTER_FILTER, REGISTER_FLAVOUR, REGISTER_PACKET forFilter(), forCoords(), forPacket() The messy REGISTER_... macros have been replaced with a more robust template-based mechanism.

Back to main page ... Back to main page ...