Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:tarballs [2014/01/03 15:45] – external edit 127.0.0.1 | user_guide:tutorials:tarballs [2019/02/11 16:45] (current) – restored. oroehrig | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Saving and Restoring an Array of Polytopes ====== | + | {{page>.:latest:@FILEID@}} |
- | + | ||
- | 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> | + | |
- | polytope > script(" | + | |
- | + | ||
- | polytope > | + | |
- | </ | + | |
- | 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. | + | |
- | < | + | |
- | polytope > @a = (); | + | |
- | polytope > $a[0] = cube(3); | + | |
- | polytope > $a[1] = simplex(3); | + | |
- | polytope > 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. | + | |
- | + | ||
- | < | + | |
- | polytope > $a[0]-> | + | |
- | polytope > $a[1]-> | + | |
- | polytope > 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 '' | + | |
- | + | ||
- | < | + | |
- | polytope > @a=unpack_tarball(" | + | |
- | polytope > print $a[0]-> | + | |
- | my_cube | + | |
- | polytope > | + | |
- | </ | + | |
- | + | ||
- | If you just want a specific polytope from your tarball, then you can supply its name in the command: | + | |
- | < | + | |
- | polytope > @a=unpack_tarball(" | + | |
- | polytope > print $a[0]-> | + | |
- | my_simplex | + | |
- | polytope > | + | |
- | </ | + | |
- | + | ||
- | 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 '' | + | |