[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
      type octree_node
      type(point), dimension(:), pointer :: points
      type(octree_node), dimension(:), pointer :: children
      real :: x_min, x_max, y_min, y_max, z_min, z_max
      integer :: num_points
      end type octree_node
      Contains
      recursive subroutine build_octree(node, points, x_min, x_max, &
          y_min, y_max, z_min, z_max)
      type(octree_node), pointer :: node
      type(point), dimension(:), pointer :: points
      real, intent(in) :: x_min, x_max, y_min, y_max, z_min, z_max
      integer :: i, j, k, num_points, num_children
      real :: x_mid, y_mid, z_mid
      do k = 0, 1
        do j = 0, 1
          do i = 0, 1
            num_children = num_children + 1
            allocate(node%children(num_children))
            call build_octree(node%children(num_children), points,&                     !这里报错,error #7121: A ptr dummy may only be argument associated with a ptr, and this array element or section does not inherit the POINTER attr from its parent array.   [CHILDREN]
              x_min + i*(x_mid - x_min), x_min + (i+1)*(x_mid - x_min),&
              y_min + j*(y_mid - y_min), y_min + (j+1)*(y_mid - y_min),&
              z_min + k*(z_mid - z_min), z_min + (k+1)*(z_mid - z_min))
          end do
        end do
      end do
      end subroutine build_octree