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
|
/**************************************************************************
* *
* Regina - A Normal Surface Theory Calculator *
* Computational Engine *
* *
* Copyright (c) 1999-2025, 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. *
* *
* As an exception, when this program is distributed through (i) the *
* App Store by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or *
* (iii) Google Play by Google Inc., then that store may impose any *
* digital rights management, device limits and/or redistribution *
* restrictions that are required by its terms of service. *
* *
* 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, see <https://www.gnu.org/licenses/>. *
* *
**************************************************************************/
#include "algebra/abeliangroup.h"
#include "manifold/sfs.h"
#include "maths/matrix.h"
#include "subcomplex/layeredchainpair.h"
#include "triangulation/dim3.h"
namespace regina {
std::unique_ptr<LayeredChainPair> LayeredChainPair::recognise(
const Component<3>* comp) {
// Basic property check.
if ((! comp->isClosed()) || (! comp->isOrientable()))
return nullptr;
size_t nTet = comp->size();
if (nTet < 2)
return nullptr;
if (comp->countVertices() != 1)
return nullptr;
// We have at least two tetrahedra and precisely 1 vertex.
// The component is closed and orientable (and connected, since it's
// a component).
// Start with tetrahedron 0. This must belong to *some* chain.
Tetrahedron<3>* base = comp->tetrahedron(0);
// Note that we only need check permutations in S3 since we can
// arbitrarily assign the role of one vertex in the tetrahedron.
for (auto p3: Perm<3>::S3) {
LayeredChain first(base, Perm<4>::extend(p3));
first.extendMaximal();
Tetrahedron<3>* firstTop = first.top();
Tetrahedron<3>* firstBottom = first.bottom();
Perm<4> firstTopRoles = first.topVertexRoles();
Perm<4> firstBottomRoles = first.bottomVertexRoles();
// Check to see if the first chain fills the entire component.
if (first.index() == nTet) {
// The only success here will be if we have a chain pair of
// indices (n-1) and 1, which is in fact a layered loop.
LayeredChain longChain(firstBottom, firstBottomRoles);
if (longChain.extendBelow())
if (longChain.bottom() == firstTop &&
longChain.bottomVertexRoles() ==
firstTopRoles * Perm<4>(3, 2, 1, 0)) {
// We've got a layered loop!
if (nTet == 2) {
// The new chain is already too long.
longChain = LayeredChain(firstBottom, firstBottomRoles);
}
// Extend longChain to (n-1) tetrahedra.
while (longChain.index() + 1 < nTet)
longChain.extendBelow();
return std::unique_ptr<LayeredChainPair>(
new LayeredChainPair(
LayeredChain(
firstBottom->adjacentTetrahedron(
firstBottomRoles[0]),
firstBottom->adjacentGluing(
firstBottomRoles[0]) * firstBottomRoles *
Perm<4>(0, 2, 1, 3)),
longChain));
}
continue;
}
// At this point we must have run into the second chain.
Tetrahedron<3>* secondBottom = firstTop->adjacentTetrahedron(
firstTopRoles[3]);
if (secondBottom == firstTop || secondBottom == firstBottom ||
! secondBottom) {
continue;
}
LayeredChain second(secondBottom,
firstTop->adjacentGluing(firstTopRoles[3]) *
firstTopRoles * Perm<4>(1, 3, 0, 2));
while (second.extendAbove())
;
if (second.index() + first.index() != nTet)
continue;
Tetrahedron<3>* secondTop = second.top();
Perm<4> secondTopRoles = second.topVertexRoles();
Perm<4> secondBottomRoles = second.bottomVertexRoles();
// At this point we have two chains that together have the
// correct number of tetrahedra. All we need do is check the
// remaining three between-chain gluings.
if (secondTop == firstTop->adjacentTetrahedron(firstTopRoles[0]) &&
secondBottom == firstBottom->adjacentTetrahedron(
firstBottomRoles[2]) &&
secondTop == firstBottom->adjacentTetrahedron(
firstBottomRoles[1]) &&
secondTopRoles == firstTop->adjacentGluing(
firstTopRoles[0]) * firstTopRoles * Perm<4>(0, 2, 1, 3) &&
secondBottomRoles == firstBottom->adjacentGluing(
firstBottomRoles[2]) * firstBottomRoles *
Perm<4>(3, 1, 2, 0) &&
secondTopRoles == firstBottom->adjacentGluing(
firstBottomRoles[1]) * firstBottomRoles *
Perm<4>(2, 0, 3, 1)) {
// We found one!
if (first.index() > second.index())
return std::unique_ptr<LayeredChainPair>(
new LayeredChainPair(second, first));
else
return std::unique_ptr<LayeredChainPair>(
new LayeredChainPair(first, second));
}
}
// Nothing was found. Sigh.
return nullptr;
}
std::unique_ptr<Manifold> LayeredChainPair::manifold() const {
std::unique_ptr<SFSpace> ans(new SFSpace());
ans->insertFibre(2, -1);
ans->insertFibre(chain_[0].index() + 1, 1);
ans->insertFibre(chain_[1].index() + 1, 1);
ans->reduce();
return ans;
}
AbelianGroup LayeredChainPair::homology() const {
// The first homology group can be obtained from the matrix:
//
// [ 1 -1 1 ]
// [ n_1 1 1 ]
// [ 1 n_2 -1 ]
//
// This is established simply by examining the edges on the boundary
// of each layered chain.
MatrixInt mat(3, 3);
mat.fill(1);
mat.entry(0, 1) = mat.entry(2, 2) = -1;
mat.entry(1, 0) = chain_[0].index();
mat.entry(2, 1) = chain_[1].index();
return AbelianGroup(std::move(mat));
}
} // namespace regina
|