File: 2.10

package info (click to toggle)
polymake 4.14-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,888 kB
  • sloc: cpp: 168,933; perl: 43,407; javascript: 31,575; ansic: 3,007; java: 2,654; python: 632; sh: 268; xml: 117; makefile: 61
file content (143 lines) | stat: -rw-r--r-- 4,477 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
#  Copyright (c) 1997-2024
#  Ewgenij Gawrilow, Michael Joswig, and the polymake team
#  Technische Universität Berlin, Germany
#  https://polymake.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, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  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.
#-------------------------------------------------------------------------------

# == SUMMARY ==
# - In Polytope:
#   * replace AMBIENT_DIM by CONE_AMBIENT_DIM
#   * replace DIM by CONE_DIM or COMBINATORIAL_DIM, depending on presence of geometric information
# - In PointConfiguration:
#   * rename POLYTOPE_AMBIENT_DIM and POLYTOPE_DIM to AMBIENT_DIM and DIM resp.
# - In PolyhedralFan:
#   * adjust values of COMBINATORIAL_DIM and MAXIMAL_CONES_DIMS, rename the latter to MAXIMAL_CONES_COMBINATORIAL_DIMS
#   * rename AMBIENT_DIM and DIM to FAN_AMBIENT_DIM and FAN_DIM resp.
# - Move FACET_TRIANGULATIONS to BOUNDARY.FACET_TRIANGULATIONS in TRIANGULATION
# - In Polytope and PointConfiguration with WEIGHTS, either create a POLYTOPAL_SUBDIVISION or move weights into TRIANGULATION

upgrade 2.9.10 polytope::Polytope.AMBIENT_DIM | DIM {
   my ($obj, $prop) = @_;
   if (defined(my $dim = delete $obj->{AMBIENT_DIM})) {
      $obj->{CONE_AMBIENT_DIM} = $dim+1;
   }
   if (defined(my $dim = delete $obj->{DIM})) {
      my $new_prop_name = "COMBINATORIAL_DIM";
      for (qw(POINTS VERTICES INEQUALITIES FACETS EQUATIONS AFFINE_HULL LINEALITY_SPACE)) {
         if (defined($obj->{$_})) {
            $new_prop_name = "CONE_DIM";
            ++$dim;
            last;
         }
      }
      $obj->{$new_prop_name} = $dim;
   }
   true
}


upgrade 2.9.11 polytope::PointConfiguration.POLYTOPE_AMBIENT_DIM = rename AMBIENT_DIM;

upgrade 2.9.11 polytope::PointConfiguration.POLYTOPE_DIM = rename DIM;


upgrade 2.9.12 fan::PolyhedralFan.COMBINATORIAL_DIM {
   my ($obj, $prop) = @_;
   if (defined($obj->{$prop})) {
      $obj->{$prop} -= 1;
      true
   }
}

upgrade 2.9.12 fan::PolyhedralFan.MAXIMAL_CONES_DIMS {
   my ($obj, $prop) = @_;
   my $dims = delete $obj->{$prop};
   if (defined($dims)) {
      my $deduct = 1 + ($obj->{LINEALITY_DIM} // 0);
      $_ -= $deduct for @$dims;
   }
   $obj->{MAXIMAL_CONES_COMBINATORIAL_DIMS} = $dims;
   true
}


upgrade 2.9.13 polytope::Cone.TRIANGULATION.FACET_TRIANGULATIONS {
   my ($obj, $prop) = @_;
   $obj->{BOUNDARY}{$prop} = delete $obj->{$prop};
   true
}

upgrade 2.9.13 polytope::PointConfiguration.TRIANGULATION.FACET_TRIANGULATIONS {
   my ($obj, $prop) = @_;
   $obj->{BOUNDARY}{$prop} = delete $obj->{$prop};
   true
}


upgrade 2.9.14 fan::PolyhedralFan.DIM = rename FAN_DIM;

upgrade 2.9.14 fan::PolyhedralFan.AMBIENT_DIM = rename FAN_AMBIENT_DIM;

upgrade 2.9.14 topaz::SimplicialComplex.BALANCED = rename FOLDABLE;


upgrade 2.9.15 polytope::Polytope.POLYTOPAL_SUBDIVISION {
   my ($obj, $prop) = @_;
   create_subdivision($obj, delete $obj->{$prop});
}

upgrade 2.9.15 polytope::PointConfiguration.POLYTOPAL_SUBDIVISION {
   my ($obj, $prop) = @_;
   create_subdivision($obj, delete $obj->{$prop});
}

# upgrade rules are executed in the definition order,
# so that the next two rules will only be fired when there was no POLYTOPAL_SUBDIVISION

upgrade 2.9.15 polytope::Polytope.WEIGHTS = \&move_weights;

upgrade 2.9.15 polytope::PointConfiguration.WEIGHTS = \&move_weights;

sub create_subdivision {
   my ($obj, $cells) = @_;
   my %subdiv;
   if (defined($cells)) {
      $subdiv{MAXIMAL_CELLS} = $cells;
   }
   if (defined(my $splits = delete $obj->{SPLITS_IN_SUBDIVISION})) {
      $subdiv{REFINED_SPLITS} = $splits;
   }
   if (defined(my $weights = delete $obj->{WEIGHTS})) {
      $subdiv{WEIGHTS} = $weights;
   }
   delete $obj->{WEIGHTS_GENERIC};
   $obj->{POLYTOPAL_SUBDIVISION} = \%subdiv;
   push @{$obj->{_load}}, "fan";
   true
}

sub move_weights {
   my ($obj, $prop) = @_;
   if (delete $obj->{WEIGHTS_GENERIC}) {
      $obj->{TRIANGULATION}{$prop} = delete $obj->{$prop};
   } else {
      create_subdivision($obj);
   }
}


# Local Variables:
# mode: perl
# cperl-indent-level: 3
# indent-tabs-mode:nil
# End: