btree_new_root_i8_sp2d Subroutine

private subroutine btree_new_root_i8_sp2d(tree, key, value)

Arguments

Type IntentOptional Attributes Name
type(btree_i8_sp2d), intent(inout) :: tree
integer(kind=keyt), intent(in) :: key
type(btree_data_sp2d), intent(in) :: value

Source Code

      SUBROUTINE btree_new_root_i8_sp2d (tree, key, value)
         TYPE(btree_i8_sp2d), INTENT(INOUT) :: tree
         INTEGER(KIND=keyt), INTENT(IN) :: key
         TYPE(btree_data_sp2d), INTENT(IN) :: value
         TYPE(btree_node_i8_sp2d), POINTER :: old_root, new_root
         !
         CALL btree_new_node_i8_sp2d (tree, new_root)
         new_root%filled = 1
         new_root%keys(1) = key
         new_root%values(1) = value
         IF (ASSOCIATED(tree%b%root)) THEN
            old_root => tree%b%root
            old_root%parent => new_root
            new_root%subtrees(1)%node => old_root
            old_root%parent => new_root
         END IF
         tree%b%root => new_root
      END SUBROUTINE btree_new_root_i8_sp2d