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
|
/**************************************************************************
* *
* 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/>. *
* *
**************************************************************************/
/*! \file triangulation/generic/simplex.h
* \brief Internal header for top-dimensional simplices of triangulations of
* arbitrary dimension.
*
* This file is automatically included from triangulation/generic.h;
* there is no need for end users to include this header explicitly.
*/
#ifndef __REGINA_SIMPLEX_H
#ifndef __DOXYGEN
#define __REGINA_SIMPLEX_H
#endif
#include "triangulation/detail/simplex.h"
namespace regina {
/**
* Represents a top-dimensional simplex in a <i>dim</i>-manifold triangulation.
*
* For example, for 3-manifolds this class represents a tetrahedron, and for
* 2-manifolds this class represents a triangle.
*
* Although this is a specialisation of the Face class template, this
* class is typically referred to using the alias Simplex<dim>.
* For Regina's \ref stddim "standard dimensions", you can also use the
* aliases Triangle<2>, Tetrahedron<3> and Pentachoron<4>.
*
* Top-dimensional simplices cannot exist in isolation (without a
* triangulation object), and they cannot be created or destroyed directly.
* Instead, you create and destroy them via the underlying triangulation,
* by calling routines such as Triangulation<dim>::newSimplex() or
* Triangulation<dim>::removeSimplex().
*
* Amongst other things, this class is used to view and change the gluings
* between top-dimensional simplices. For this we number the facets and
* vertices of each simplex 0,...,\a dim, so that facet \a i is opposite
* vertex \a i.
*
* Each simplex may have an optional description. This is typically a
* human-readable piece of text. Descriptions are not required, and do
* not need to be unique.
*
* For Regina's \ref stddim "standard dimensions", this template is specialised
* and offers significant extra functionality. In order to use these
* specialised classes, you will need to include the corresponding
* triangulation headers (e.g., triangulation/dim2.h for \a dim = 2, or
* triangulation/dim3.h for \a dim = 3).
*
* Simplices do not support value semantics: they cannot be copied, swapped,
* or manually constructed. Their location in memory defines them, and
* they are often passed and compared by pointer. End users are never
* responsible for their memory management; this is all taken care of by
* the Triangulation to which they belong.
*
* \python Python does not support templates. Instead
* this class can be used by appending the dimension as a suffix
* (e.g., Simplex2 and Simplex3 for dimensions 2 and 3).
*
* \tparam dim the dimension of the underlying triangulation.
* This must be between 2 and 15 inclusive.
*
* \headerfile triangulation/generic.h
*
* \ingroup generic
*/
template <int dim>
class Face<dim, dim> : public detail::SimplexBase<dim> {
static_assert(! standardDim(dim),
"The generic implementation of Simplex<dim> "
"should not be used for Regina's standard dimensions.");
protected:
/**
* Creates a new simplex with no description and no facets joined
* to anything.
*
* \param tri the triangulation to which the new simplex belongs.
*/
Face(Triangulation<dim>* tri);
/**
* Creates a new simplex whose description and locks are cloned
* from the given simplex, and with no faces joined to anything.
*
* \param clone the simplex whose details should be cloned.
* \param tri the triangulation to which the new tetrahedron belongs.
*/
Face(const Face& clone, Triangulation<dim>* tri);
/**
* Creates a new simplex with the given description, no locks, and
* no facets joined to anything.
*
* \param desc the description to give the new simplex.
* \param tri the triangulation to which the new simplex belongs.
*/
Face(const std::string& desc, Triangulation<dim>* tri);
friend class Triangulation<dim>;
friend class detail::TriangulationBase<dim>;
};
#ifdef __APIDOCS
// This type alias is already defined in trianguation/forward.h.
/**
* Refers to a top-dimensional simplex in a <i>dim</i>-dimensional
* triangulation.
*
* This is the preferred way to refer to a top-dimensional simplex (as
* opposed to the more clumsy notation Face<dim, dim>).
*
* \tparam dim the dimension of the underlying triangulation.
* This must be between 2 and 15 inclusive.
*
* \ingroup generic
*/
template <int dim>
using Simplex = Face<dim, dim>;
#endif
// Inline functions for Simplex
template <int dim>
inline Face<dim, dim>::Face(Triangulation<dim>* tri) :
detail::SimplexBase<dim>(tri) {
}
template <int dim>
inline Face<dim, dim>::Face(const Face& clone, Triangulation<dim>* tri) :
detail::SimplexBase<dim>(clone, tri) {
}
template <int dim>
inline Face<dim, dim>::Face(const std::string& desc,
Triangulation<dim>* tri) :
detail::SimplexBase<dim>(desc, tri) {
}
} // namespace regina
#endif
|