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:
%
%    Freddie Witherden, Peter Vincent,
%    On the identification of symmetric quadrature rules for finite element methods,
%    Computers and Mathematics with Applications,
%    Volume 69, pages 1232-1241, 2015.
%
%  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,   3,   6,   6,   7, ...
     12,  15,  16,  19,  25, ...
     28,  33,  37,  42,  49, ...
     55,  60,  67,  73,  79 ];

  order = order_vec(p+1);

  return
end

