Decode one record of version 10700 or later.
Reads record twice: header, then in full.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | iunit |
Unit of open |
function loadconv_10700(iunit) result(cnv) !! Decode one record of version 10700 or later. !! !! Reads record twice: header, then in full. use typedef, only: & int32 use convdata, only: & convtype, & nuc_kind_len, idx_kind_len ! Arguments integer(kind=int32), intent(IN):: & iunit !! Unit of open `.cnv` file, positioned at record. type(convtype) :: & cnv integer(kind=int32) :: & iostat ! Stage 1: read the leading header to learn every array size. For ! version 10700 the header carries toffset (right after dt) and ladv ! (right after ncoord), so nadv = popcnt(ladv) is known here as well and ! the advection arrays can be allocated in a single pass (no second ! size-probe read is needed, unlike loadconv_10600). read(iunit, IOSTAT=iostat) & cnv%nvers, & cnv%ncyc, & cnv%timesec, & cnv%dt, & cnv%toffset, & cnv%nconv, & cnv%nnuc, & cnv%nnuk, & cnv%nneu, & cnv%nnucd, & cnv%nnukd, & cnv%nneud, & cnv%ncoord, & cnv%ladv, & cnv%idx_kind_len, & cnv%nuc_kind_len if (IS_IOSTAT_END(iostat)) then cnv%nvers = 0 return endif if (cnv%nvers < 10700) & error stop '[loadconv_10700] version out of range (expects >= 10700)' if (cnv%idx_kind_len /= idx_kind_len) error stop 'idx_kind_len mismatch' if (cnv%nuc_kind_len /= nuc_kind_len) error stop 'nuc_kind_len mismatch' cnv%nadv = popcnt(cnv%ladv) allocate( & cnv%nuc(cnv%nnuc), & cnv%nuk(cnv%nnuk), & cnv%neu(cnv%nneu), & cnv%nucd(cnv%nnucd), & cnv%nukd(cnv%nnukd), & cnv%neud(cnv%nneud), & cnv%yzip(cnv%nconv), & cnv%xmcoord(cnv%ncoord), & cnv%rncoord(cnv%ncoord), & cnv%inuc(cnv%nnuc), & cnv%inuk(cnv%nnuk), & cnv%ineu(cnv%nneu), & cnv%inucd(cnv%nnucd), & cnv%inukd(cnv%nnukd), & cnv%ineud(cnv%nneud), & cnv%iconv(cnv%nconv), & cnv%iadv(cnv%nadv), & cnv%dmadv(cnv%nadv), & cnv%dvadv(cnv%nadv)) backspace(iunit) ! Stage 2: full record read in version-10700 field order. Differs from ! 10600 only by toffset (after dt) and ladv read in the early header ! (after ncoord) instead of after rncoord. read(iunit) & cnv%nvers, & cnv%ncyc, & cnv%timesec, & cnv%dt, & cnv%toffset, & cnv%nconv, & cnv%nnuc, & cnv%nnuk, & cnv%nneu, & cnv%nnucd, & cnv%nnukd, & cnv%nneud, & cnv%ncoord, & cnv%ladv, & cnv%idx_kind_len, & cnv%nuc_kind_len, & cnv%nuc, & cnv%nuk, & cnv%neu, & cnv%nucd, & cnv%nukd, & cnv%neud, & cnv%yzip, & cnv%xmcoord, & cnv%rncoord, & cnv%iadv, & cnv%dmadv, & cnv%dvadv, & cnv%inuc, & cnv%inuk, & cnv%ineu, & cnv%inucd, & cnv%inukd, & cnv%ineud, & cnv%iconv, & cnv%levcnv, & cnv%minloss, & cnv%mingain, & cnv%minnucl, & cnv%minnucg, & cnv%minneul, & cnv%minneug, & cnv%minlossd, & cnv%mingaind, & cnv%minnucld, & cnv%minnucgd, & cnv%minneuld, & cnv%minneugd, & cnv%tc, & cnv%dc, & cnv%pc, & cnv%ec, & cnv%sc, & cnv%ye, & cnv%ab, & cnv%et, & cnv%sn, & cnv%su, & cnv%g1, & cnv%g2, & cnv%s1, & cnv%s2, & cnv%aw, & cnv%summ0, & cnv%radius0, & cnv%an, & cnv%abun, & cnv%eni , & cnv%enk , & cnv%enp , & cnv%ent , & cnv%epro , & cnv%enn , & cnv%enr , & cnv%ensc , & cnv%enes , & cnv%enc , & cnv%enpist , & cnv%enid , & cnv%enkd , & cnv%enpd , & cnv%entd , & cnv%eprod , & cnv%xlumn , & cnv%enrd , & cnv%enscd , & cnv%enesd , & cnv%encd , & cnv%enpistd, & cnv%xlum , & cnv%xlum0 , & cnv%entloss, & cnv%eniloss, & cnv%enkloss, & cnv%enploss, & cnv%enrloss, & cnv%angit , & cnv%angltv , & cnv%xmacc return end function loadconv_10700