unit Function

public pure function unit(r) result(u)

Unit vector

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(:) :: r

Return Value real(kind=wp), dimension(size(r))


Called by

proc~~unit~~CalledByGraph proc~unit unit proc~axis_angle_rotation axis_angle_rotation proc~axis_angle_rotation->proc~unit proc~axis_angle_rotation_to_rotation_matrix axis_angle_rotation_to_rotation_matrix proc~axis_angle_rotation_to_rotation_matrix->proc~unit proc~bplane bplane proc~bplane->proc~unit proc~ucross ucross proc~bplane->proc~ucross proc~calculate_bplane_data calculate_bplane_data proc~calculate_bplane_data->proc~unit proc~cartesian_to_equinoctial cartesian_to_equinoctial proc~cartesian_to_equinoctial->proc~unit proc~from_ijk_to_lvlh_mat from_ijk_to_lvlh_mat proc~from_ijk_to_lvlh_mat->proc~unit proc~from_ijk_to_rsw_mat from_ijk_to_rsw_mat proc~from_ijk_to_rsw_mat->proc~unit proc~from_ijk_to_vuw_mat from_ijk_to_vuw_mat proc~from_ijk_to_vuw_mat->proc~unit proc~get_c_cdot_two_body_rotating two_body_rotating_frame%get_c_cdot_two_body_rotating proc~get_c_cdot_two_body_rotating->proc~unit proc~solve_lambert_gooding solve_lambert_gooding proc~solve_lambert_gooding->proc~unit proc~solve_lambert_izzo solve_lambert_izzo proc~solve_lambert_izzo->proc~unit proc~solve_lambert_izzo->proc~ucross proc~ucross->proc~unit interface~from_ijk_to_lvlh from_ijk_to_lvlh interface~from_ijk_to_lvlh->proc~from_ijk_to_lvlh_mat interface~from_ijk_to_rsw from_ijk_to_rsw interface~from_ijk_to_rsw->proc~from_ijk_to_rsw_mat interface~from_ijk_to_vuw from_ijk_to_vuw interface~from_ijk_to_vuw->proc~from_ijk_to_vuw_mat proc~bplane_test bplane_test proc~bplane_test->proc~bplane proc~bplane_test->proc~calculate_bplane_data proc~get_c_cdot_two_body_rotating_pulsating two_body_rotating_pulsating_frame%get_c_cdot_two_body_rotating_pulsating proc~get_c_cdot_two_body_rotating_pulsating->proc~get_c_cdot_two_body_rotating proc~lambert_test lambert_test proc~lambert_test->proc~solve_lambert_gooding proc~lambert_test->proc~solve_lambert_izzo proc~modified_equinoctial_test modified_equinoctial_test proc~modified_equinoctial_test->proc~cartesian_to_equinoctial proc~vector_test vector_test proc~vector_test->proc~axis_angle_rotation proc~vector_test->proc~axis_angle_rotation_to_rotation_matrix proc~from_lvlh_to_ijk_mat from_lvlh_to_ijk_mat proc~from_lvlh_to_ijk_mat->interface~from_ijk_to_lvlh proc~from_rsw_to_ijk_mat from_rsw_to_ijk_mat proc~from_rsw_to_ijk_mat->interface~from_ijk_to_rsw proc~from_vuw_to_ijk_mat from_vuw_to_ijk_mat proc~from_vuw_to_ijk_mat->interface~from_ijk_to_vuw proc~relative_motion_test relative_motion_test proc~relative_motion_test->interface~from_ijk_to_lvlh proc~relative_motion_test->interface~from_ijk_to_rsw interface~from_lvlh_to_ijk from_lvlh_to_ijk interface~from_lvlh_to_ijk->proc~from_lvlh_to_ijk_mat interface~from_rsw_to_ijk from_rsw_to_ijk interface~from_rsw_to_ijk->proc~from_rsw_to_ijk_mat interface~from_vuw_to_ijk from_vuw_to_ijk interface~from_vuw_to_ijk->proc~from_vuw_to_ijk_mat

Source Code

    pure function unit(r) result(u)

    implicit none

    real(wp),dimension(:),intent(in) :: r
    real(wp),dimension(size(r))      :: u

    real(wp) :: rmag

    rmag = norm2(r)

    if (rmag==zero) then
        u = zero
    else
        u = r / rmag
    end if

    end function unit