File: nsfs.cpp

package info (click to toggle)
regina-normal 4.3.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 16,396 kB
  • ctags: 7,338
  • sloc: cpp: 55,359; sh: 17,392; ansic: 12,913; perl: 3,294; makefile: 918; python: 114
file content (117 lines) | stat: -rw-r--r-- 5,412 bytes parent folder | download
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

/**************************************************************************
 *                                                                        *
 *  Regina - A Normal Surface Theory Calculator                           *
 *  Python Interface                                                      *
 *                                                                        *
 *  Copyright (c) 1999-2006, 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 "algebra/nabeliangroup.h"
#include "manifold/nlensspace.h"
#include "manifold/nsfs.h"
#include <boost/python.hpp>

using namespace boost::python;
using regina::NSFSFibre;
using regina::NSFSpace;

namespace {
    unsigned long (NSFSpace::*punctures_void)() const = &NSFSpace::punctures;
    unsigned long (NSFSpace::*punctures_bool)(bool) const =
        &NSFSpace::punctures;
    unsigned long (NSFSpace::*reflectors_void)() const = &NSFSpace::reflectors;
    unsigned long (NSFSpace::*reflectors_bool)(bool) const =
        &NSFSpace::reflectors;
    void (NSFSpace::*insertFibre_fibre)(const NSFSFibre&) =
        &NSFSpace::insertFibre;
    void (NSFSpace::*insertFibre_longs)(long, long) = &NSFSpace::insertFibre;

    BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(OL_addHandle, addHandle, 0, 1);
    BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(OL_addCrosscap, addCrosscap, 0, 1);
    BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(OL_addPuncture, addPuncture, 0, 2);
    BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(OL_addReflector, addReflector, 0, 2);
    BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(OL_reduce, reduce, 0, 1);
}

void addNSFSpace() {
    class_<NSFSFibre>("NSFSFibre")
        .def(init<long, long>())
        .def(init<const NSFSFibre&>())
        .def_readwrite("alpha", &NSFSFibre::alpha)
        .def_readwrite("beta", &NSFSFibre::beta)
        .def(self == self)
        .def(self < self)
        .def(self_ns::str(self))
    ;

    scope s = class_<NSFSpace, bases<regina::NManifold>,
            std::auto_ptr<NSFSpace> >("NSFSpace")
        .def(init<NSFSpace::classType, unsigned long,
            optional<unsigned long, unsigned long,
            unsigned long, unsigned long> >())
        .def(init<const NSFSpace&>())
        .def("baseClass", &NSFSpace::baseClass)
        .def("baseGenus", &NSFSpace::baseGenus)
        .def("baseOrientable", &NSFSpace::baseOrientable)
        .def("fibreReversing", &NSFSpace::fibreReversing)
        .def("fibreNegating", &NSFSpace::fibreNegating)
        .def("punctures", punctures_void)
        .def("punctures", punctures_bool)
        .def("reflectors", reflectors_void)
        .def("reflectors", reflectors_bool)
        .def("fibreCount", &NSFSpace::fibreCount)
        .def("fibre", &NSFSpace::fibre)
        .def("obstruction", &NSFSpace::obstruction)
        .def("addHandle", &NSFSpace::addHandle, OL_addHandle())
        .def("addCrosscap", &NSFSpace::addCrosscap, OL_addCrosscap())
        .def("addPuncture", &NSFSpace::addPuncture, OL_addPuncture())
        .def("addReflector", &NSFSpace::addReflector, OL_addReflector())
        .def("insertFibre", insertFibre_fibre)
        .def("insertFibre", insertFibre_longs)
        .def("reflect", &NSFSpace::reflect)
        .def("complementAllFibres", &NSFSpace::complementAllFibres)
        .def("reduce", &NSFSpace::reduce, OL_reduce())
        .def("isLensSpace", &NSFSpace::isLensSpace,
            return_value_policy<manage_new_object>())
        .def(self == self)
        .def(self < self)
    ;

    enum_<NSFSpace::classType>("classType")
        .value("o1", NSFSpace::o1)
        .value("o2", NSFSpace::o2)
        .value("n1", NSFSpace::n1)
        .value("n2", NSFSpace::n2)
        .value("n3", NSFSpace::n3)
        .value("n4", NSFSpace::n4)
        .value("bo1", NSFSpace::bo1)
        .value("bo2", NSFSpace::bo2)
        .value("bn1", NSFSpace::bn1)
        .value("bn2", NSFSpace::bn2)
        .value("bn3", NSFSpace::bn3)
        ;

    implicitly_convertible<std::auto_ptr<NSFSpace>,
        std::auto_ptr<regina::NManifold> >();
}