Find cgs factor of a .kipp age, time step, mass or radius column.
def when header gives no unit, else stated unit's factor, which must have dimension dm.
Any other unit stops load w/ error listing allowed units.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | col |
Column name, for the error message. |
||
| character(len=*), | intent(in) | :: | tok |
Unit the header states, blank if none. |
||
| integer(kind=int32), | intent(in) | :: | dm |
Dimension code of column, a |
||
| real(kind=real64), | intent(in) | :: | def |
Factor of unit column name implies. |
||
| real(kind=real64), | intent(out) | :: | fac |
Factor to cgs. |
||
| character(len=*), | intent(out) | :: | unit |
|
subroutine kipp_axis_unit(col, tok, dm, def, fac, unit) !! Find cgs factor of a `.kipp` age, time step, mass or radius column. !! !! `def` when header gives no unit, else stated unit's factor, which must have dimension `dm`. !! Any other unit stops load w/ error listing allowed units. ! Arguments character(len=*), intent(in) :: col !! Column name, for the error message. character(len=*), intent(in) :: tok !! Unit the header states, blank if none. integer(int32), intent(in) :: dm !! Dimension code of column, a `units` `DIM_` constant. real(real64), intent(in) :: def !! Factor of unit column name implies. real(real64), intent(out) :: fac !! Factor to cgs. character(len=*), intent(out) :: unit !! `UNAME` entry of stated unit, blank if none. character(len=64) :: allowed integer(int32) :: k fac = def; unit = '' if (len_trim(tok) == 0) return k = unit_id(tok) if (k > 0) then if (UDIM(k) == dm) then fac = UFAC(k); unit = UNAME(k) return end if end if allowed = '' do k = 1, size(UNAME) if (UDIM(k) == dm) allowed = trim(allowed)//' '//trim(UNAME(k)) end do error stop '[loadkipp] column '//trim(col)//' has unit '//trim(tok)// & '; use one of'//trim(allowed) end subroutine kipp_axis_unit