source: LMDZ6/branches/cirrus/tools/netcdf95/Groups/nf95_inq_grp_parent.f90 @ 5522

Last change on this file since 5522 was 4918, checked in by Laurent Fairhead, 10 months ago

Reintegrated NetCDF95 in LMDZ so that it is compiled and made available by the makelmdz_fcm script.
The makelmdz_fcm creates the libnetcdf95 library and copies it in the tools/netcdf/lib directory, copying
the mod files in the tools/netcdf/include library.

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.