beach_zero_mode_update Function

public function beach_zero_mode_update(handle, nsrc, charge_ptr, e_bottom, z_gauge, phi_gauge) result(status) bind(C, name='beach_zero_mode_update'))

Arguments

Type IntentOptional Attributes Name
type(c_ptr), value :: handle
integer(kind=c_int), value :: nsrc
type(c_ptr), value :: charge_ptr
real(kind=c_double), value :: e_bottom
real(kind=c_double), value :: z_gauge
real(kind=c_double), value :: phi_gauge

Return Value integer(kind=c_int)


Calls

proc~~beach_zero_mode_update~~CallsGraph proc~beach_zero_mode_update beach_zero_mode_update proc~refresh_periodic_zero_mode_state refresh_periodic_zero_mode_state proc~beach_zero_mode_update->proc~refresh_periodic_zero_mode_state

Source Code

  integer(c_int) function beach_zero_mode_update( &
    handle, nsrc, charge_ptr, e_bottom, z_gauge, phi_gauge &
    ) bind(C, name='beach_zero_mode_update') result(status)
    type(c_ptr), value :: handle
    integer(c_int), value :: nsrc
    type(c_ptr), value :: charge_ptr
    real(c_double), value :: e_bottom, z_gauge, phi_gauge
    type(periodic_zero_mode_handle), pointer :: zero
    real(c_double), pointer :: charge(:)

    status = get_zero_mode(handle, zero)
    if (status /= beach_zero_mode_ok) return
    if (.not. zero%built) then
      status = beach_zero_mode_not_ready
      return
    end if
    if (.not. count_is_addressable(nsrc, 1_i64, 0_i64) .or. &
        int(nsrc, i64) /= int(zero%plan%nelem, i64) .or. .not. c_associated(charge_ptr) .or. &
        .not. ieee_is_finite(e_bottom) .or. .not. ieee_is_finite(z_gauge) .or. &
        .not. ieee_is_finite(phi_gauge)) then
      status = beach_zero_mode_invalid_argument
      return
    end if

    call c_f_pointer(charge_ptr, charge, [int(nsrc)])
    if (any(.not. ieee_is_finite(charge))) then
      status = beach_zero_mode_invalid_argument
      return
    end if

    call refresh_periodic_zero_mode_state( &
      zero%plan, real(charge, dp), real(e_bottom, dp), real(z_gauge, dp), real(phi_gauge, dp), zero%state &
      )
    zero%charged = .true.
    status = beach_zero_mode_ok
  end function beach_zero_mode_update