File: facenumbering.cpp

package info (click to toggle)
regina-normal 5.1-6
  • links: PTS
  • area: main
  • in suites: buster
  • size: 54,488 kB
  • sloc: cpp: 142,029; ansic: 19,218; xml: 9,844; objc: 7,729; perl: 1,190; python: 623; sh: 614; makefile: 34
file content (198 lines) | stat: -rw-r--r-- 7,249 bytes parent folder | download | duplicates (2)
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

/**************************************************************************
 *                                                                        *
 *  Regina - A Normal Surface Theory Calculator                           *
 *  Computational Engine                                                  *
 *                                                                        *
 *  Copyright (c) 1999-2016, 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, write to the Free            *
 *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,       *
 *  MA 02110-1301, USA.                                                   *
 *                                                                        *
 **************************************************************************/

#include "triangulation/facenumbering.h"

namespace {
    const int choose0[1]   = { 1 };
    const int choose1[2]   = { 1,1 };
    const int choose2[3]   = { 1,2,1 };
    const int choose3[4]   = { 1,3,3,1 };
    const int choose4[5]   = { 1,4,6,4,1 };
    const int choose5[6]   = { 1,5,10,10,5,1 };
    const int choose6[7]   = { 1,6,15,20,15,6,1 };
    const int choose7[8]   = { 1,7,21,35,35,21,7,1 };
    const int choose8[9]   = { 1,8,28,56,70,56,28,8,1 };
    const int choose9[10]  = { 1,9,36,84,126,126,84,36,9,1 };
    const int choose10[11] = { 1,10,45,120,210,252,210,120,45,10,1 };
    const int choose11[12] = { 1,11,55,165,330,462,462,330,165,55,11,1 };
    const int choose12[13] = { 1,12,66,220,495,792,924,792,495,220,66,12,1 };
    const int choose13[14] = { 1,13,78,286,715,1287,1716,1716,1287,715,286,78,13,1 };
    const int choose14[15] = { 1,14,91,364,1001,2002,3003,3432,3003,2002,1001,364,91,14,1 };
    const int choose15[16] = { 1,15,105,455,1365,3003,5005,6435,6435,5005,3003,1365,455,105,15,1 };
    const int choose16[17] = { 1,16,120,560,1820,4368,8008,11440,12870,11440,8008,4368,1820,560,120,16,1 };
}

namespace regina { namespace detail {

    const int* const binomSmall_[17] = {
        choose0, choose1, choose2, choose3, choose4, choose5, choose6, choose7,
        choose8, choose9, choose10, choose11, choose12, choose13, choose14,
        choose15, choose16
    };

    const Perm<3> FaceNumberingImpl<2, 1, false>::ordering_[3] = {
        Perm<3>(1,2,0),
        Perm<3>(0,2,1),
        Perm<3>(0,1,2),
    };

    const Perm<4> FaceNumberingImpl<3, 1, true>::ordering_[6] = {
        Perm<4>(0, 1, 2, 3),
        Perm<4>(0, 2, 3, 1),
        Perm<4>(0, 3, 1, 2),
        Perm<4>(1, 2, 0, 3),
        Perm<4>(1, 3, 2, 0),
        Perm<4>(2, 3, 0, 1)
    };

    const int FaceNumberingImpl<3, 1, true>::edgeNumber[4][4] = {
        { -1, 0, 1, 2 },
        {  0,-1, 3, 4 },
        {  1, 3,-1, 5 },
        {  2, 4, 5,-1 }
    };

    const int FaceNumberingImpl<3, 1, true>::edgeVertex[6][2] = {
        { 0, 1 },
        { 0, 2 },
        { 0, 3 },
        { 1, 2 },
        { 1, 3 },
        { 2, 3 }
    };

    const Perm<4> FaceNumberingImpl<3, 2, false>::ordering_[4] = {
        Perm<4>(1, 2, 3, 0),
        Perm<4>(0, 2, 3, 1),
        Perm<4>(0, 1, 3, 2),
        Perm<4>(0, 1, 2, 3)
    };

    const Perm<5> FaceNumberingImpl<4, 1, true>::ordering_[10] = {
        Perm<5>(0, 1, 2, 3, 4),
        Perm<5>(0, 2, 1, 4, 3),
        Perm<5>(0, 3, 1, 2, 4),
        Perm<5>(0, 4, 1, 3, 2),
        Perm<5>(1, 2, 0, 3, 4),
        Perm<5>(1, 3, 0, 4, 2),
        Perm<5>(1, 4, 0, 2, 3),
        Perm<5>(2, 3, 0, 1, 4),
        Perm<5>(2, 4, 0, 3, 1),
        Perm<5>(3, 4, 0, 1, 2)
    };

    const int FaceNumberingImpl<4, 1, true>::edgeNumber[5][5] = {
        { -1, 0, 1, 2, 3 },
        { 0, -1, 4, 5, 6 },
        { 1, 4, -1, 7, 8 },
        { 2, 5, 7, -1, 9 },
        { 3, 6, 8, 9, -1 }};

    const int FaceNumberingImpl<4, 1, true>::edgeVertex[10][2] = {
        { 0, 1 },
        { 0, 2 },
        { 0, 3 },
        { 0, 4 },
        { 1, 2 },
        { 1, 3 },
        { 1, 4 },
        { 2, 3 },
        { 2, 4 },
        { 3, 4 }};

    const Perm<5> FaceNumberingImpl<4, 2, false>::ordering_[10] = {
        Perm<5>(2, 3, 4, 0, 1),
        Perm<5>(1, 3, 4, 2, 0),
        Perm<5>(1, 2, 4, 0, 3),
        Perm<5>(1, 2, 3, 4, 0),
        Perm<5>(0, 3, 4, 1, 2),
        Perm<5>(0, 2, 4, 3, 1),
        Perm<5>(0, 2, 3, 1, 4),
        Perm<5>(0, 1, 4, 2, 3),
        Perm<5>(0, 1, 3, 4, 2),
        Perm<5>(0, 1, 2, 3, 4)
    };

    const int FaceNumberingImpl<4, 2, false>::triangleNumber[5][5][5] = {
        { { -1,-1,-1,-1,-1 },
          { -1,-1, 9, 8, 7 },
          { -1, 9,-1, 6, 5 },
          { -1, 8, 6,-1, 4 },
          { -1, 7, 5, 4,-1 } },

        { { -1,-1, 9, 8, 7 },
          { -1,-1,-1,-1,-1 },
          {  9,-1,-1, 3, 2 },
          {  8,-1, 3,-1, 1 },
          {  7,-1, 2, 1,-1 } },

        { { -1, 9,-1, 6, 5 },
          {  9,-1,-1, 3, 2 },
          { -1,-1,-1,-1,-1 },
          {  6, 3,-1,-1, 0 },
          {  5, 2,-1, 0,-1 } },

        { { -1, 8, 6,-1, 4 },
          {  8,-1, 3,-1, 1 },
          {  6, 3,-1,-1, 0 },
          { -1,-1,-1,-1,-1 },
          {  4, 1, 0,-1,-1 } },

        { { -1, 7, 5, 4,-1 },
          {  7,-1, 2, 1,-1 },
          {  5, 2,-1, 0,-1 },
          {  4, 1, 0,-1,-1 },
          { -1,-1,-1,-1,-1 } } };

    const int FaceNumberingImpl<4, 2, false>::triangleVertex[10][3] = {
        { 2, 3, 4 },
        { 1, 3, 4 },
        { 1, 2, 4 },
        { 1, 2, 3 },
        { 0, 3, 4 },
        { 0, 2, 4 },
        { 0, 2, 3 },
        { 0, 1, 4 },
        { 0, 1, 3 },
        { 0, 1, 2 } };

    const Perm<5> FaceNumberingImpl<4, 3, false>::ordering_[5] = {
        Perm<5>(1,2,3,4,0),
        Perm<5>(0,2,3,4,1),
        Perm<5>(0,1,3,4,2),
        Perm<5>(0,1,2,4,3),
        Perm<5>(0,1,2,3,4)
    };

} } // namespace regina::detail