1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
/**************************************************************************
* *
* Regina - A Normal Surface Theory Calculator *
* Computational Engine *
* *
* Copyright (c) 1999-2011, Ben Burton *
* For further details contact Ben Burton (bab@debian.org). *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public *
* License along with this program; if not, write to the Free *
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
**************************************************************************/
/* end stub */
#include "manifold/ngraphpair.h"
#include "manifold/nsfs.h"
#include "subcomplex/nblockedsfspair.h"
#include "subcomplex/nlayering.h"
#include "subcomplex/nsatblockstarter.h"
#include "subcomplex/nsatregion.h"
namespace regina {
/**
* A subclass of NSatBlockStarterSearcher that, upon finding a starter
* block, attempts to flesh this out to a pair of saturated regions
* joined along their single torus boundaries, as desribed by the
* NBlockedSFSPair class.
*/
struct NBlockedSFSPairSearcher : public NSatBlockStarterSearcher {
NSatRegion* region[2];
/**< The two bounded saturated regions that are joined together,
if the entire NBlockedSFSPair structure has been successfully
found; otherwise, two null pointers if we are still searching. */
NMatrix2 matchingReln;
/**< The matrix describing how the region boundaries are joined
together. This matrix expresses the fibre/base curves on the
second region boundary in terms of the fibre/base curves on
the first, as described by NGraphPair::matchingReln(). */
/**
* Creates a new searcher whose \a region pointers are both null.
*/
NBlockedSFSPairSearcher() {
region[0] = region[1] = 0;
}
protected:
bool useStarterBlock(NSatBlock* starter);
};
NBlockedSFSPair::~NBlockedSFSPair() {
if (region_[0])
delete region_[0];
if (region_[1])
delete region_[1];
}
NManifold* NBlockedSFSPair::getManifold() const {
NSFSpace* sfs0 = region_[0]->createSFS(1, false);
if (! sfs0)
return 0;
NSFSpace* sfs1 = region_[1]->createSFS(1, false);
if (! sfs1) {
delete sfs0;
return 0;
}
// Reduce the Seifert fibred space representations and finish up.
sfs0->reduce(false);
sfs1->reduce(false);
if (*sfs1 < *sfs0)
return new NGraphPair(sfs1, sfs0, matchingReln_.inverse());
else
return new NGraphPair(sfs0, sfs1, matchingReln_);
}
std::ostream& NBlockedSFSPair::writeName(std::ostream& out) const {
out << "Blocked SFS Pair [";
region_[0]->writeBlockAbbrs(out, false);
out << " | ";
region_[1]->writeBlockAbbrs(out, false);
return out << ']';
}
std::ostream& NBlockedSFSPair::writeTeXName(std::ostream& out) const {
out << "\\mathrm{BSFS\\_Pair}\\left[";
region_[0]->writeBlockAbbrs(out, true);
out << "\\,|\\,";
region_[1]->writeBlockAbbrs(out, true);
return out << "\\right]";
}
void NBlockedSFSPair::writeTextLong(std::ostream& out) const {
out << "Blocked SFS pair, matching relation " << matchingReln_ << "\n";
region_[0]->writeDetail(out, "First region");
region_[1]->writeDetail(out, "Second region");
}
NBlockedSFSPair* NBlockedSFSPair::isBlockedSFSPair(NTriangulation* tri) {
// Basic property checks.
if (! tri->isClosed())
return 0;
if (tri->getNumberOfComponents() > 1)
return 0;
// Watch out for twisted block boundaries that are incompatible with
// neighbouring blocks! Also watch for the boundary between blocks
// being an annulus on one side and a Klein bottle on the other (or
// two incompatible Klein bottles for that matter).
//
// These will result in edges joined to themselves in reverse.
if (! tri->isValid())
return 0;
// Hunt for a starting block.
NBlockedSFSPairSearcher searcher;
searcher.findStarterBlocks(tri);
// Any luck?
if (searcher.region[0]) {
// The full expansion worked, and the triangulation is known
// to be closed and connected.
// This means we've got one!
return new NBlockedSFSPair(searcher.region[0], searcher.region[1],
searcher.matchingReln);
}
// Nope.
return 0;
}
bool NBlockedSFSPairSearcher::useStarterBlock(NSatBlock* starter) {
// The region pointers should be null, but just in case...
if (region[0] || region[1]) {
delete starter;
return false;
}
// Flesh out the triangulation as far as we can. We're aiming for
// just one boundary annulus remaining.
// Note that the starter block will now be owned by region[0].
region[0] = new NSatRegion(starter);
region[0]->expand(usedTets);
if (region[0]->numberOfBoundaryAnnuli() != 1) {
delete region[0];
region[0] = 0;
return true;
}
// Insist on this boundary being untwisted.
NSatBlock* bdryBlock;
unsigned bdryAnnulus;
bool bdryVert, bdryHoriz;
region[0]->boundaryAnnulus(0, bdryBlock, bdryAnnulus,
bdryVert, bdryHoriz);
bool firstRegionReflected =
((bdryVert && ! bdryHoriz) || (bdryHoriz && ! bdryVert));
NSatBlock* tmpBlock;
unsigned tmpAnnulus;
bool tmpVert, tmpHoriz;
bdryBlock->nextBoundaryAnnulus(bdryAnnulus, tmpBlock, tmpAnnulus,
tmpVert, tmpHoriz);
if (tmpVert) {
delete region[0];
region[0] = 0;
return true;
}
NSatAnnulus bdry = bdryBlock->annulus(bdryAnnulus);
// We have a boundary annulus for the first region.
// Hunt for a layering.
NLayering layering(bdry.tet[0], bdry.roles[0], bdry.tet[1], bdry.roles[1]);
layering.extend();
// Relation from fibre/orbifold to layering first face markings 01/02:
NMatrix2 curves0ToLayering = layering.boundaryReln() *
NMatrix2(-1, 0, 0, firstRegionReflected ? -1 : 1);
// We make the shell of an other-side boundary annulus; we will fill
// in the precise vertex role permutations later on.
NSatAnnulus otherSide(layering.getNewBoundaryTet(0), NPerm4(),
layering.getNewBoundaryTet(1), NPerm4());
if (otherSide.meetsBoundary()) {
delete region[0];
region[0] = 0;
return true;
}
// Mapping from (layering first face markings 01/02) to
// (other side annulus first face markings 01/02). Like the other
// side vertex roles, this mapping will be filled in later.
NMatrix2 layeringToAnnulus1;
// Try the three possible orientations for fibres on the other side.
NSatBlock* otherStarter;
for (int plugPos = 0; plugPos < 3; plugPos++) {
// Construct the boundary annulus for the second region.
// Refresh the tetrahedra as well as the vertex roles, since
// it may have switched sides since our last run through the loop.
otherSide.tet[0] = layering.getNewBoundaryTet(0);
otherSide.tet[1] = layering.getNewBoundaryTet(1);
if (plugPos == 0) {
otherSide.roles[0] = layering.getNewBoundaryRoles(0);
otherSide.roles[1] = layering.getNewBoundaryRoles(1);
layeringToAnnulus1 = NMatrix2(1, 0, 0, 1);
} else if (plugPos == 1) {
otherSide.roles[0] = layering.getNewBoundaryRoles(0) *
NPerm4(1, 2, 0, 3);
otherSide.roles[1] = layering.getNewBoundaryRoles(1) *
NPerm4(1, 2, 0, 3);
layeringToAnnulus1 = NMatrix2(-1, 1, -1, 0);
} else {
otherSide.roles[0] = layering.getNewBoundaryRoles(0) *
NPerm4(2, 0, 1, 3);
otherSide.roles[1] = layering.getNewBoundaryRoles(1) *
NPerm4(2, 0, 1, 3);
layeringToAnnulus1 = NMatrix2(0, -1, 1, -1);
}
// Clear out the used tetrahedron list. Everything before the new
// layering boundary is self-contained, so we won't run into it
// again on the other side. We'll just re-insert the layering
// boundary tetrahedra.
usedTets.clear();
usedTets.insert(layering.getNewBoundaryTet(0));
usedTets.insert(layering.getNewBoundaryTet(1));
// See if we can flesh the other side out to an entire region.
otherSide.switchSides();
if ((otherStarter = NSatBlock::isBlock(otherSide, usedTets))) {
region[1] = new NSatRegion(otherStarter);
region[1]->expand(usedTets);
if (region[1]->numberOfBoundaryAnnuli() == 1) {
// This is it! Stop searching.
// Do a final conversion from annulus first face markings
// 01/02 and exit.
matchingReln = NMatrix2(-1, 0, 0, 1) * layeringToAnnulus1 *
curves0ToLayering;
return false;
}
// Nup, this one didn't work.
delete region[1];
region[1] = 0;
}
}
// Sigh, nothing works.
delete region[0];
region[0] = 0;
return true;
}
} // namespace regina
|