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 vector_module::unit proc~axis_angle_rotation vector_module::axis_angle_rotation proc~axis_angle_rotation->proc~unit proc~axis_angle_rotation_to_rotation_matrix vector_module::axis_angle_rotation_to_rotation_matrix proc~axis_angle_rotation_to_rotation_matrix->proc~unit proc~bplane bplane_module::bplane proc~bplane->proc~unit proc~ucross vector_module::ucross proc~bplane->proc~ucross proc~calculate_bplane_data bplane_module::calculate_bplane_data proc~calculate_bplane_data->proc~unit proc~cartesian_to_equinoctial modified_equinoctial_module::cartesian_to_equinoctial proc~cartesian_to_equinoctial->proc~unit proc~from_ijk_to_lvlh_mat relative_motion_module::from_ijk_to_lvlh_mat proc~from_ijk_to_lvlh_mat->proc~unit proc~from_ijk_to_rsw_mat relative_motion_module::from_ijk_to_rsw_mat proc~from_ijk_to_rsw_mat->proc~unit proc~get_c_cdot_two_body_rotating transformation_module::two_body_rotating_frame%get_c_cdot_two_body_rotating proc~get_c_cdot_two_body_rotating->proc~unit proc~solve_lambert_gooding lambert_module::solve_lambert_gooding proc~solve_lambert_gooding->proc~unit proc~solve_lambert_izzo lambert_module::solve_lambert_izzo proc~solve_lambert_izzo->proc~unit proc~solve_lambert_izzo->proc~ucross proc~ucross->proc~unit interface~from_ijk_to_lvlh relative_motion_module::from_ijk_to_lvlh interface~from_ijk_to_lvlh->proc~from_ijk_to_lvlh_mat proc~from_ijk_to_lvlh_rv relative_motion_module::from_ijk_to_lvlh_rv interface~from_ijk_to_lvlh->proc~from_ijk_to_lvlh_rv interface~from_ijk_to_rsw relative_motion_module::from_ijk_to_rsw interface~from_ijk_to_rsw->proc~from_ijk_to_rsw_mat proc~from_ijk_to_rsw_rv relative_motion_module::from_ijk_to_rsw_rv interface~from_ijk_to_rsw->proc~from_ijk_to_rsw_rv proc~bplane_test bplane_module::bplane_test proc~bplane_test->proc~bplane proc~bplane_test->proc~calculate_bplane_data proc~get_c_cdot_two_body_rotating_pulsating transformation_module::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_module::lambert_test proc~lambert_test->proc~solve_lambert_gooding proc~lambert_test->proc~solve_lambert_izzo proc~modified_equinoctial_test modified_equinoctial_module::modified_equinoctial_test proc~modified_equinoctial_test->proc~cartesian_to_equinoctial proc~vector_test vector_module::vector_test proc~vector_test->proc~axis_angle_rotation proc~vector_test->proc~axis_angle_rotation_to_rotation_matrix proc~from_ijk_to_lvlh_rv->interface~from_ijk_to_lvlh proc~from_ijk_to_rsw_rv->interface~from_ijk_to_rsw proc~from_lvlh_to_ijk_mat relative_motion_module::from_lvlh_to_ijk_mat proc~from_lvlh_to_ijk_mat->interface~from_ijk_to_lvlh proc~from_rsw_to_ijk_mat relative_motion_module::from_rsw_to_ijk_mat proc~from_rsw_to_ijk_mat->interface~from_ijk_to_rsw proc~relative_motion_test relative_motion_module::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 relative_motion_module::from_lvlh_to_ijk interface~from_lvlh_to_ijk->proc~from_lvlh_to_ijk_mat proc~from_lvlh_to_ijk_rv relative_motion_module::from_lvlh_to_ijk_rv interface~from_lvlh_to_ijk->proc~from_lvlh_to_ijk_rv interface~from_rsw_to_ijk relative_motion_module::from_rsw_to_ijk interface~from_rsw_to_ijk->proc~from_rsw_to_ijk_mat proc~from_rsw_to_ijk_rv relative_motion_module::from_rsw_to_ijk_rv interface~from_rsw_to_ijk->proc~from_rsw_to_ijk_rv proc~from_lvlh_to_ijk_rv->interface~from_lvlh_to_ijk proc~from_rsw_to_ijk_rv->interface~from_rsw_to_ijk

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