[Fortran] 纯文本查看 复制代码
type facept
integer(4) :: dep !深度
integer(4) :: fac !当前占据点
real(8), dimension(3) :: cx
logical :: leaf,ocp !leaf:是否为叶子(无分支);ocp:是否被占据
type(facept), pointer :: NT0,NT1,NT2,NT3,NT4,NT5,NT6,NT7,NT8
end type facept
[Fortran] 纯文本查看 复制代码
recursive subroutine release
use octree
implicit none
if(.not. pp%leaf) then
pp=>pp%NT1
call release
deallocate(pp%NT1)
pp=>pp%NT2
call release
deallocate(pp%NT2)
pp=>pp%NT3
call release
deallocate(pp%NT3)
pp=>pp%NT4
call release
deallocate(pp%NT4)
pp=>pp%NT5
call release
deallocate(pp%NT5)
pp=>pp%NT6
call release
deallocate(pp%NT6)
pp=>pp%NT7
call release
deallocate(pp%NT7)
pp=>pp%NT8
call release
deallocate(pp%NT8)
end if
pp=>pp%NT0
end subroutine
[Fortran] 纯文本查看 复制代码
recursive subroutine release(tp)
use octree
implicit none
type(facept), pointer :: tp
if(.not. tp%leaf) then
call release(tp%NT1)
call release(tp%NT2)
call release(tp%NT3)
call release(tp%NT4)
call release(tp%NT5)
call release(tp%NT6)
call release(tp%NT7)
call release(tp%NT8)
else
deallocate(tp)
end if
end subroutine
[Fortran] 纯文本查看 复制代码
recursive subroutine release(tp)
use octree
implicit none
type(facept), pointer :: tp !,ap
if(.not. tp%leaf) then
call release(tp%NT1)
deallocate(tp%NT1)
call release(tp%NT2)
deallocate(tp%NT2)
call release(tp%NT3)
deallocate(tp%NT3)
call release(tp%NT4)
deallocate(tp%NT4)
call release(tp%NT5)
deallocate(tp%NT5)
call release(tp%NT6)
deallocate(tp%NT6)
call release(tp%NT7)
deallocate(tp%NT7)
call release(tp%NT8)
deallocate(tp%NT8)
end if
end subroutine