function tetra_node2 = tet_mesh_q2l_compute ( tetra_num1, tetra_node1, ...
  tetra_num2 )

%*****************************************************************************80
%
%% tet_mesh_q2l_compute() linearizes a quadratic tet mesh.
%
%  Discussion:
%
%    A quadratic tet mesh is assumed to consist of 10-node
%    tetrahedrons.
%
%    This routine rearranges the information so as to define a 4-node
%    tet mesh.
%
%    The same nodes are used, but there are seven times as many
%    tetrahedrons.
%
%    The node ordering for the quadratic tetrahedron is somewhat
%    arbitrary.  In the current scheme, the vertices are listed
%    first, followed by the 6 midside nodes.  Each midside node
%    may be identified by the two vertices that bracket it.  Thus,
%    the node ordering may be suggested by:
%
%      1  2  3  4 (1+2) (2+3) (1+3) (2+4) (3+4) (1+4)
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 December 2006
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer TETRA_NUM1, the number of tetrahedrons in the quadratic
%    tet mesh.
%
%    integer TETRA_NODE1(10,TETRA_NUM1), the quadratic tet mesh.
%
%    integer TETRA_NUM2, the number of tetrahedrons in the linear
%    tet mesh.  TETRA_NUM2 = 7 * TETRA_NUM1.
%
%  Output:
%
%    integer TETRA_NODE2(4,TETRA_NUM2), the linear tet mesh.
%
  tetra2 = 0;

  for tetra1 = 1 : tetra_num1

    n1 = tetra_node1(1,tetra1);
    n2 = tetra_node1(2,tetra1);
    n3 = tetra_node1(3,tetra1);
    n4 = tetra_node1(4,tetra1);
    n5 = tetra_node1(5,tetra1);
    n6 = tetra_node1(6,tetra1);
    n7 = tetra_node1(7,tetra1);
    n8 = tetra_node1(8,tetra1);
    n9 = tetra_node1(9,tetra1);
    nx = tetra_node1(10,tetra1);

    tetra2 = tetra2 + 1;
    tetra_node2(1:4,tetra2 ) = [ n5, n2, n6, n8 ]';
    tetra2 = tetra2 + 1;
    tetra_node2(1:4,tetra2 ) = [ n7, n6, n3, n9 ]';
    tetra2 = tetra2 + 1;
    tetra_node2(1:4,tetra2 ) = [ nx, n8, n9, n4 ]';
    tetra2 = tetra2 + 1;
    tetra_node2(1:4,tetra2 ) = [ n5, n6, n1, n8 ]';
    tetra2 = tetra2 + 1;
    tetra_node2(1:4,tetra2)  = [ n7, n1, n6, n9 ]';
    tetra2 = tetra2 + 1;
    tetra_node2(1:4,tetra2 ) = [ nx, n9, n8, n1 ]';
    tetra2 = tetra2 + 1;
    tetra_node2(1:4,tetra2 ) = [ n6, n1, n8, n9 ]';

  end

  return
end
