function order = rule_order ( p )

%*****************************************************************************80
%
%% rule_order() returns the order of a hexahedron quadrature rule of given precision.
%
%  Discussion:
%
%    The "order" of a quadrature rule is the number of points involved.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 May 2023
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Jan Jaskowiec, Natarajan Sukumar,
%    High order symmetric cubature rules for tetrahedra and pyramids,
%    International Journal for Numerical Methods in Engineering,
%    Volume 122, Number 1, pages 148-171, 24 August 2020.
%
%  Input:
%
%    integer p: the precision, 0 <= p <= 21.
%
%  Output:
%
%    integer order: the order of the rule.
%
  if ( p < 0 ) 
    error ( 'rule_order(): Input p < 0.\n' );
  end

  if ( 21 < p )
    error ( 'rule_order(): Input 21 < p.\n' );
  end

  order_vec = [ ...
        1,  ...
        1,   6,   6,  14,  14,  34,  34,  58,  58,  90, ...
       90, 154, 154, 256, 256, 346, 346, 454, 454, 580, ...
      580 ];

  order = order_vec(p+1);

  return
end

