zero_fixed_grads_inner Subroutine

recursive subroutine zero_fixed_grads_inner(this, visit_id)

Arguments

Type IntentOptional Attributes Name
type(array_type), intent(inout) :: this
integer, intent(in) :: visit_id

Source Code

  recursive subroutine zero_fixed_grads_inner(this, visit_id)
    implicit none
    type(array_type), intent(inout) :: this
    integer, intent(in) :: visit_id

    if(this%visit_tag .eq. visit_id) return
    this%visit_tag = visit_id

    if(associated(this%left_operand))then
       call zero_fixed_grads_inner(this%left_operand, visit_id)
    end if
    if(associated(this%right_operand))then
       call zero_fixed_grads_inner(this%right_operand, visit_id)
    end if
    if(this%fix_pointer.and.associated(this%grad))then
       if(allocated(this%grad%val)) this%grad%val = 0.0_real32
    end if
  end subroutine zero_fixed_grads_inner