function order = rule_order ( p )

%*****************************************************************************80
%
%% rule_order() returns the order of a 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:
%
%    23 April 2023
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Jan Jaskowiec, Natarajan Sukumar,
%    High order symmetric cubature rules for tetrahedra and pyramids,
%    International Journal of Numerical Methods in Engineering,
%    Volume 122, Number 1, pages 148-171, 24 August 2020.
%
%  Input:
%
%    integer p: the precision, 0 <= p <= 20.
%
%  Output:
%
%    integer order: the order of the rule.
%
  if ( p < 0 ) 
    error ( 'rule_order(): Input "p" < 0.\n' );
  end

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

  order_vec = [ ...
      1, ...
      1,   4,   8,  14,  14, ...
     24,  35,  46,  59,  81, ...
    110, 168, 172, 204, 264, ...
    304, 364, 436, 487, 552 ];

  order = order_vec(p+1);

  return
end

