213
214
This means, for instance, that you create a new triangulation by just
214
215
calling <literal>NTriangulation()</literal>, and you can read a data file
215
by calling <literal>readFileMagic(filename)</literal>.
216
by calling <literal>open(filename)</literal>.
216
217
For command-line sessions, if you wish to avoid the heavy-handed
217
218
“<literal>from regina import *</literal>”, you can pass
218
219
the option <option>--noautoimport</option> (in which case you will need to
219
220
use fully qualified names such as
220
221
<literal>regina.NTriangulation()</literal> and
221
<literal>regina.readFileMagic(filename)</literal>).
222
<literal>regina.open(filename)</literal>).
431
432
Simply type <userinput>import snappy</userinput> from within any of
432
®ina;'s &python; environments. You can use
434
<function>NTriangulation.snapPea()</function> and
435
<function>NTriangulation()</function>
436
to get information out of and into
437
®ina; as strings, and you can hook these up to &snappy;'s functions
438
<function>Manifold()</function> and
439
<function>Manifold._to_string()</function> at the other end.
440
See the example below.
433
®ina;'s &python; environments. To send information back and forth
434
between ®ina; and &snappy;:
437
®ina;'s triangulation classes
438
<classname>NTriangulation</classname> and
439
<classname>NSnapPeaTriangulation</classname> both have a
440
<function>snapPea()</function> function, which gives a string that
441
you can pass to &snappy;'s <classname>Manifold</classname> constructor.
444
&snappy;'s <classname>Manifold</classname> class has a
445
<function>_to_string()</function> function, which gives a string
446
that you can pass to ®ina;'s
447
<classname>NTriangulation</classname> or
448
<classname>NSnapPeaTriangulation</classname> constructor.
453
Regarding fillings and peripheral curves:
454
®ina; does not store fillings or peripheral curves for its own native
455
<link linkend="packet-triangulation">triangulation packets</link>,
456
as represented by the <classname>NTriangulation</classname> class.
457
However, it does store fillings and peripheral curves for its hybrid
458
<link linkend="packet-snappea">&snappea; triangulation packets</link>,
459
as represented by the <classname>NSnapPeaTriangulation</classname> class.
460
The trade-off is that the native <classname>NTriangulation</classname>
461
class offers ®ina;'s full fine-grained control over the triangulation,
462
whereas the hybrid <classname>NSnapPeaTriangulation</classname> class
463
has a more limited (largely read-only) interface.
466
When sending data from ®ina; to &snappy;,
467
if your triangulation is of the class
468
<classname>NTriangulation</classname>,
469
then <function>NTriangulation.snapPea()</function> will
470
create a &snappy; manifold in which all fillings and peripheral
471
curves are marked as unknown.
472
If your triangulation is of the class
473
<classname>NSnapPeaTriangulation</classname>,
474
and if you already have fillings and peripheral curves stored on
475
each cusp, then <function>NSnapPeaTriangulation.snapPea()</function> will
476
create a &snappy; manifold that preserves these.
479
Conversely, when sending data from &snappy; to ®ina;, you
480
can choose to instantiate a triangulation using either the
481
<classname>NTriangulation</classname> class or the
482
<classname>NSnapPeaTriangulation</classname> class.
483
If you use the <classname>NTriangulation</classname> class then all
484
fillings and peripheral curves will be lost.
485
If you use the <classname>NSnapPeaTriangulation</classname> class then
486
fillings and peripheral curves will be preserved (but your interface
487
will be more restricted).
492
Regarding the interface:
493
the <classname>NSnapPeaTriangulation</classname> class
494
inherits from <classname>NTriangulation</classname>, and so you can
495
use it anywhere that a read-only triangulation is expected (in particular,
496
you can use it for enumerating vertex normal surfaces or angle structures).
497
However, because <classname>NSnapPeaTriangulation</classname> must
498
maintain two synchronised copies of the triangulation (®ina;'s and
499
&snappea;'s), it is essentially read-only: any attempt to modify the
500
triangulation using ®ina;'s native routines (e.g.,
501
<function>twoThreeMove()</function> or
502
<function>barycentricSubdivision()</function>) will cause the
503
&snappea; triangulation to delete itself and become a
504
“null triangulation” instead.
443
507
At present, &snappy; (version 2.0.3) is not compatible with