35
/* To be included from nmaxadmissible.h. */
37
#ifndef __NMAXADMISSIBLE_TCC
39
#define __NMAXADMISSIBLE_TCC
42
#include "enumerate/nenumconstraint.h"
43
#include "enumerate/nmaxadmissible.h"
49
template <class BitmaskType, class RayIterator>
50
std::vector<BitmaskType>* NMaxAdmissible::enumerate(
51
RayIterator beginExtremalRays, RayIterator endExtremalRays,
52
const NEnumConstraintList* constraints) {
53
if (beginExtremalRays == endExtremalRays) {
54
// Input is empty, so output is empty.
55
return new std::vector<BitmaskType>();
58
unsigned dim = (*beginExtremalRays)->size();
62
// Rewrite the constraints as bitmasks.
63
std::vector<BitmaskType> constMasks;
65
NEnumConstraintList::const_iterator cit;
66
std::set<unsigned long>::const_iterator sit;
67
for (cit = constraints->begin(); cit != constraints->end(); ++cit) {
69
for (sit = cit->begin(); sit != cit->end(); ++sit)
71
constMasks.push_back(b);
75
// Create a set of bitmasks representing the admissible 1-faces of
76
// the cone, i.e., the set of admissible extremal rays.
77
std::vector<BitmaskType> rays;
78
for (RayIterator rit = beginExtremalRays; rit != endExtremalRays; ++rit) {
79
for (i = 0; i < dim; ++i)
80
b.set(i, (**rit)[i] != 0);
84
// Create a working set of admissible faces.
85
// We initialise this to the set of all admissible 1-faces, as above.
86
std::list<BitmaskType> faces(rays.begin(), rays.end());
88
// Create the final set of faces to return.
89
std::vector<BitmaskType>* maxFaces = new std::vector<BitmaskType>();
91
// Keep expanding the faces using additional extremal rays until we can
93
// The ith iteration of the following loop enumerates _all_ admissible
94
// faces of dimension i+1, and identifies all _maximal_ admissible
95
// faces of dimension i.
96
std::list<BitmaskType> nextDim;
97
typename std::vector<BitmaskType>::const_iterator r, c;
98
typename std::list<BitmaskType>::const_iterator f;
99
typename std::list<BitmaskType>::iterator n, next;
101
while (! faces.empty()) {
102
for (f = faces.begin(); f != faces.end(); ++f) {
103
// Expand this face by combining with other extremal rays.
105
for (r = rays.begin(); r != rays.end(); ++r) {
106
BitmaskType comb(*f);
109
// Ignore rays already in this face.
113
// Ignore rays that will break admissibility.
115
for (c = constMasks.begin(); c != constMasks.end(); ++c) {
118
if (! b.atMostOneBit()) {
126
// comb expands *f to a higher-dimensional superface.
129
// Strip out duplicates, and also strip out superfaces of
130
// too high a dimension (since we only want to step up one
131
// dimension at a time).
134
while (n != nextDim.end()) {
138
// comb has too high a dimension, or is a duplicate.
143
// *n has too high a dimension.
149
nextDim.push_back(comb);
152
maxFaces->push_back(*f);
154
std::swap(nextDim, faces);
162
} // namespace regina
35
/*! \file enumerate/nmaxadmissible.tcc
36
* \brief Deprecated header.
39
#warning This header is deprecated; please use nmaxadmissible-impl.h instead.
41
#include "enumerate/nmaxadmissible-impl.h"