File: nf_nc.f90

package info (click to toggle)
netcdf-fortran 4.5.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,456 kB
  • sloc: fortran: 25,848; f90: 20,793; sh: 4,609; ansic: 1,729; makefile: 585; pascal: 292; xml: 173
file content (90 lines) | stat: -rwxr-xr-x 2,157 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
!-------------------------------- nf_create_par -------------------------------
 Function nf_create_par (path, cmode, comm, info, ncid) RESULT(status)

! create parallel file

 USE netcdf_nc_interfaces

 Implicit NONE

 Integer,          Intent(IN)  :: cmode, comm, info
 Character(LEN=*), Intent(IN)  :: path
 Integer,          Intent(OUT) :: ncid

 Integer                       :: status

 Integer(C_INT)               :: ccmode, ccomm, cinfo, cncid, cstatus
 Character(LEN=(LEN(path)+1)) :: cpath
 Integer                      :: ie

 ccmode = cmode
 ccomm  = comm
 cinfo  = info
 cncid  = 0
 cpath  = addCNullChar(path, ie) ! add a C Null char and strip trailing blanks

 cstatus = nc_create_par_fortran(cpath(1:ie), ccmode, ccomm, cinfo, cncid)

 If (cstatus == NC_NOERR) Then
    ncid = cncid
 EndIf
 status = cstatus

 End Function nf_create_par
!-------------------------------- nf_open_par --------------------------------
 Function nf_open_par (path, mode, comm, info, ncid) RESULT(status)

! open a parallel file

 USE netcdf_nc_interfaces

 Implicit NONE

 Integer,          Intent(IN)  :: mode, comm, info
 Character(LEN=*), Intent(IN)  :: path
 Integer,          Intent(OUT) :: ncid

 Integer                       :: status

 Integer(C_INT)               :: cmode, ccomm, cinfo, cncid, cstatus
 Character(LEN=(LEN(path)+1)) :: cpath
 Integer                      :: ie

 cmode = mode
 ccomm = comm
 cinfo = info
 cncid = 0
 cpath = addCNullChar(path, ie)

 cstatus = nc_open_par_fortran(cpath(1:ie), cmode, ccomm, cinfo, cncid)

 If (cstatus == NC_NOERR) Then
   ncid = cncid
 EndIf
 status = cstatus

 End Function nf_open_par
!-------------------------------- nf_var_par_access -------------------------
 Function nf_var_par_access( ncid, varid, iaccess) RESULT (status)

! set parallel variable access

 USE netcdf_nc_interfaces

 Implicit NONE

 Integer, Intent(IN) :: ncid, varid, iaccess

 Integer             :: status

 Integer(C_INT) :: cncid, cvarid, caccess, cstatus

 cncid   = ncid
 cvarid  = varid - 1
 caccess = iaccess

 cstatus = nc_var_par_access(cncid, cvarid, caccess)

 status = cstatus

 End Function nf_var_par_access