dump_tree_table Subroutine

public subroutine dump_tree_table(tree)

Arguments

Type IntentOptional Attributes Name
class(tree_node_t), intent(in) :: tree(:)

Source Code

   subroutine dump_tree_table(tree)
      use, intrinsic :: iso_fortran_env, stderr => error_unit
      implicit none
      class(tree_node_t), intent(in) :: tree(:)
      type(segment_t), allocatable :: segments(:)

      integer :: i, k

      write(stderr, '(1x, a)') '  own index|  operation|     parent|       left|      right|   registered|  segments'
      do i = TREE_NODE_BASE, ubound(tree, dim=1)
         if (tree(i)%is_registered) then
            write(stderr, '(5i12, a, 10x, 1l, 3x)', advance='no') tree(i)%own_i, &
               tree(i)%op, tree(i)%parent_i, tree(i)%left_i, tree(i)%right_i, '   ', &
               tree(i)%is_registered

            call tree(i)%c%cube2seg(segments)
            do k = 1, ubound(segments, dim=1)
               if (k /= 1) write(stderr, '(a)', advance='no') ', '

               write(stderr, '(a)', advance='no') trim(segments(k)%print())
            end do
            write(stderr, *) ""
         end if
      end do
   end subroutine dump_tree_table