function order = rule_order ( p )

%*****************************************************************************80
%
%% rule_order() returns the order of a quadrilateral 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:
%
%    29 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 <= 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,  4,  4,  8,  8, 12, 12, 20, 20, 28, ...
      28, 37, 37, 48, 48, 60, 60, 72, 72, 85, ...
      85 ];

  order = order_vec(p+1);

  return
end

