#  Copyright (c) 1997-2021
#  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.
#-------------------------------------------------------------------------------

label libnormaliz

# The libnormaliz convex hull computation is currently disabled to avoid 
# overloading the scheduler with too many convex hull codes.
# It can still be used directly via normaliz_compute.
#
# To enable the rules just remove the comment from the INCLUDE statement.

INCLUDE convexhull.rules

object Cone<Rational> {

   rule libnormaliz.integer_points: DEGREE_ONE_GENERATORS : RAYS | INPUT_RAYS {
      my @list = normaliz_compute($this,degree_one_generators=>1);
      $this->DEGREE_ONE_GENERATORS = $list[0];
   }
   precondition : defined(MONOID_GRADING);
   precondition : POINTED;
   weight 5.29;
   
   rule libnormaliz.integer_points: DEGREE_ONE_GENERATORS : FACETS | INEQUALITIES , LINEAR_SPAN | EQUATIONS {
      my @list = normaliz_compute($this,from_facets=>1,dual_algorithm=>1,degree_one_generators=>1);
      $this->DEGREE_ONE_GENERATORS = $list[0];
   }
   precondition : defined(MONOID_GRADING);
   precondition : POINTED;
   weight 5.34;
   
   rule libnormaliz.hilbert,libnormaliz.integer_points: HILBERT_BASIS_GENERATORS : RAYS | INPUT_RAYS, LINEALITY_SPACE | INPUT_LINEALITY {
      my @list = normaliz_compute($this,hilbert_basis=>1);
      $this->HILBERT_BASIS_GENERATORS = [$list[0], $list[1]];
   }
   weight 5.59;
   
   rule libnormaliz.hilbert,libnormaliz.integer_points: HILBERT_BASIS_GENERATORS : FACETS | INEQUALITIES , LINEAR_SPAN | EQUATIONS {
      my @list = normaliz_compute($this,from_facets=>1,dual_algorithm=>1,hilbert_basis=>1);
      $this->HILBERT_BASIS_GENERATORS = [$list[0], $list[1]];
   }
   weight 5.64;

   rule libnormaliz.ehrhartpoly: H_STAR_VECTOR, HILBERT_SERIES : RAYS | INPUT_RAYS {
      my @list = normaliz_compute($this,h_star_vector=>1,hilbert_series=>1);
      $this->H_STAR_VECTOR = $list[0];
      $this->HILBERT_SERIES = $list[1];
   }
   precondition : defined(MONOID_GRADING);
   precondition : POINTED;
   weight 5.39;
   
   rule libnormaliz.ehrhartpoly: H_STAR_VECTOR, HILBERT_SERIES : FACETS | INEQUALITIES , LINEAR_SPAN | EQUATIONS {
      my @list = normaliz_compute($this,from_facets=>1,dual_algorithm=>1,h_star_vector=>1,hilbert_series=>1);
      $this->H_STAR_VECTOR = $list[0];
      $this->HILBERT_SERIES = $list[1];
   }
   precondition : defined(MONOID_GRADING);
   precondition : POINTED;
   weight 5.44;

}

object Polytope<Rational> {

   rule libnormaliz.ehrhartquasipoly: EHRHART_QUASI_POLYNOMIAL : RAYS | INPUT_RAYS {
      my @list = normaliz_compute($this,ehrhart_quasi_polynomial=>1);
      $this->EHRHART_QUASI_POLYNOMIAL = $list[0];
   }
   precondition : defined(MONOID_GRADING);
   precondition : POINTED;
   weight 5.39;

}
