no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | user_guide:tutorials:latest:tarballs [2023/11/06 10:57] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Saving and Restoring an Array of Polytopes ====== | ||
+ | |||
+ | If you want to deal with a whole family of polytopes at the same time, it will sometimes be convenient to save and restore them to a single file. polymake has a simple mechanism for this, storing your array of polytopes into a single tarball. | ||
+ | |||
+ | The necessary functions for this are contained in the script " | ||
+ | |||
+ | <code perl> | ||
+ | > script(" | ||
+ | </ | ||
+ | It provides the two functions '' | ||
+ | |||
+ | ===== Storing ===== | ||
+ | |||
+ | Here is a simple example, where we create an array @a containing a cube and a simplex and save this to a file. | ||
+ | |||
+ | <code perl> | ||
+ | > @a = (); | ||
+ | > $a[0] = cube(3); | ||
+ | > $a[1] = simplex(3); | ||
+ | > pack_tarball(" | ||
+ | </ | ||
+ | This creates a file '' | ||
+ | |||
+ | < | ||
+ | [nightingale]: | ||
+ | -rw------- xxx/yyy 1468 2009-07-01 17:20 1.poly | ||
+ | -rw------- xxx/ | ||
+ | [nightingale]: | ||
+ | </ | ||
+ | If you want to get more descriptive names for your polymake files then you have to set a name for each polytope first. | ||
+ | |||
+ | <code perl> | ||
+ | > $a[0]-> | ||
+ | > $a[1]-> | ||
+ | > pack_tarball(" | ||
+ | </ | ||
+ | sets the names of the files in the tarball to '' | ||
+ | |||
+ | < | ||
+ | [nightingale]: | ||
+ | -rw------- xxx/ | ||
+ | -rw------- xxx/ | ||
+ | [nightingale]: | ||
+ | </ | ||
+ | ===== Restoring the array ===== | ||
+ | |||
+ | You can restore your saved array by using the function '' | ||
+ | |||
+ | <code perl> | ||
+ | > @a=unpack_tarball(" | ||
+ | > print $a[0]-> | ||
+ | my_cube | ||
+ | |||
+ | </ | ||
+ | If you just want a specific polytope from your tarball, then you can supply its name in the command: | ||
+ | |||
+ | <code perl> | ||
+ | > @a=unpack_tarball(" | ||
+ | > print $a[0]-> | ||
+ | my_simplex | ||
+ | |||
+ | </ | ||
+ | You may supply more than one filename. However, wildcards are not supported. Note that changes in the files are not automatically stored in the archive, you have to call '' | ||
+ | |||
+ | ===== Packing archives outside polymake ===== | ||
+ | |||
+ | You can of course apply '' | ||
+ | |||