source: LMDZ6/trunk/tools/netcdf95/Groups/nf95_inq_grp_parent.f90 @ 5227

Last change on this file since 5227 was 5084, checked in by Laurent Fairhead, 4 months ago

Reverting to r4065. Updating fortran standard broke too much stuff. Will do it by smaller chunks
AB, LF

File size: 1.3 KB
Line 
1module nf95_inq_grp_parent_m
2
3  implicit none
4
5contains
6
7  subroutine nf95_inq_grp_parent(ncid, parent_ncid, ncerr)
8
9    ! Note that this procedure is indirectly called by nf95_abort, so
10    ! it cannot call it.
11
12    use, intrinsic:: ISO_C_BINDING
13
14    use netcdf, only: nf90_strerror
15
16    use nc_constants, only: NC_NOERR
17    use nf95_constants, only: nf95_noerr
18
19    integer, intent(in):: ncid
20    integer, intent(out):: parent_ncid
21    integer, intent(out), optional:: ncerr
22
23    ! Local:
24
25    Integer(C_INT) cparent_ncid, cncerr
26
27    Interface
28       Integer(C_INT) Function nc_inq_grp_parent(cncid, cparent_ncid) BIND(C)
29         import c_int
30         Integer(C_INT), VALUE:: cncid
31         Integer(C_INT), Intent(OUT) :: cparent_ncid
32       End Function nc_inq_grp_parent
33    End Interface
34
35    !------------------------------------------------------------
36
37    cncerr = nc_inq_grp_parent(int(ncid, c_int), cparent_ncid)
38
39    if (cncerr == NC_NOERR) then
40       parent_ncid = cparent_ncid
41       if (present(ncerr)) ncerr = nf95_noerr
42    else
43       if (present(ncerr)) then
44          ncerr = cncerr
45       else
46          print *, "nf95_inq_grp_parent:"
47          print *, trim(nf90_strerror(int(cncerr)))
48          stop 1
49       end if
50    end if
51
52  end subroutine nf95_inq_grp_parent
53
54end module nf95_inq_grp_parent_m
Note: See TracBrowser for help on using the repository browser.