NetCDF-Fortran  4.4.3
fort-lib.h
1 /* This is part of the netCDF package.
2  Copyright 2011 University Corporation for Atmospheric Research/Unidata
3  See COPYRIGHT file for conditions of use.
4 
5  Includes prototypes for some functions used to translate parameters
6  between C and Fortran.
7  */
8 
9 #ifndef UD_FORT_LIB_H
10 #define UD_FORT_LIB_H
11 
12 #include <stddef.h> /* for ptrdiff_t, size_t */
13 #include "ncfortran.h"
14 #include <netcdf_f.h>
15 
16 /*
17  * PURPOSE: Convert a C dimension-ID vector into a FORTRAN dimension-ID
18  * vector
19  * REQUIRE: <ncid> is valid && <varid> is valid && <cdimids> != NULL &&
20  * <fdimids> != NULL && <cdimids> != <fdimids>
21  * PROMISE: The order of the dimensions will be reversed and 1 will be
22  * added to each element. RESULT == <fdimids>
23  */
24 EXTERNL NF_INTEGER *
25 c2f_dimids(int ncid, /* netCDF dataset ID */
26  int varid, /* netCDF variable ID */
27  const int *cdimids, /* C dim IDs */
28  NF_INTEGER *fdimids); /* FORTRAN dim IDs */
29 
30 /*
31  * PURPOSE: Convert a FORTRAN dimension-ID vector into a C dimension-ID
32  * vector
33  * REQUIRE: <ndims> == 0 || (<ndims> >= 0 && <fdimids> != NULL &&
34  * <cdimids> != NULL && <fdimids> != <cdimids>)
35  * PROMISE: The order of the dimensions will be reversed and 1 will be
36  * subtracted from each element. RESULT == <cdimids>
37  */
38 EXTERNL int *
39 f2c_dimids(int ndims, /* number of dims */
40  const NF_INTEGER *fdimids, /* FORTRAN dim IDs */
41  int *cdimids); /* C dim IDs */
42 
43 /* These two are the same as the dimids, but for chunksizes, so that 1
44  * is not added/subtracted. */
45 EXTERNL NF_INTEGER *
46 c2f_chunksizes(int ncid, int varid, const int* cchunksizes,
47  NF_INTEGER *fchunksizes);
48 
49 EXTERNL int *
50 f2c_chunksizes(int ncid, int varid, const NF_INTEGER *fchunksizes,
51  int *cchunksizes);
52 
53 /*
54  * PURPOSE: Convert a FORTRAN co-ordinate vector into a C co-ordinate vector
55  * REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
56  * existing variable && <fcoords> != NULL && <ccoords> != NULL &&
57  * <fcoords> != <ccoords>
58  * PROMISE: The order of the co-ordinates will be reversed and 1 will be
59  * subtracted from each element. RESULT == <ccoords>.
60  */
61 EXTERNL size_t *
62 f2c_coords(int ncid, /* dataset ID */
63  int varid, /* variable ID */
64  const NF_INTEGER *fcoords, /* FORTRAN coords */
65  size_t *ccoords); /* C coords */
66 
67 /*
68  * PURPOSE: Convert a FORTRAN edge-count vector into a C edge-count vector
69  * REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
70  * existing variable && <fcounts> != NULL && <ccounts> != NULL &&
71  * <fcounts> != <ccounts> && <fcounts> != <ccounts>
72  * PROMISE: The order of the edge-counts will be reversed.
73  * RESULT == <ccounts>.
74  */
75 EXTERNL size_t *
76 f2c_counts(int ncid, /* dataset ID */
77  int varid, /* variable ID */
78  const NF_INTEGER* fcounts, /* FORTRAN counts */
79  size_t* ccounts); /* C counts */
80 
81 /*
82  * PURPOSE: Convert a FORTRAN stride vector into a C stride vector
83  * REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
84  * existing variable && <fstrides> != NULL && <cstrides> != NULL &&
85  * <fstrides> != <cstrides>
86  * PROMISE: The order of the strides will be reversed. RESULT == <cstrides>.
87  */
88 EXTERNL ptrdiff_t *
89 f2c_strides(int ncid, /* dataset ID */
90  int varid, /* variable ID */
91  const NF_INTEGER *fstrides, /* FORTRAN strides */
92  ptrdiff_t *cstrides); /* C strides */
93 
94 /*
95  * PURPOSE: Convert a FORTRAN mapping vector into a C mapping vector
96  * REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
97  * existing variable && <fmaps> != NULL && <cmaps> != NULL &&
98  * <fmaps> != <cmaps>
99  * PROMISE: The order of the mapping vector will be reversed.
100  * RESULT == <cmaps>.
101  */
102 EXTERNL ptrdiff_t *
103 f2c_maps(int ncid, /* dataset ID */
104  int varid, /* variable ID */
105  const NF_INTEGER *fmaps, /* FORTRAN mapping */
106  ptrdiff_t *cmaps); /* C mapping */
107 
108 
109 #endif /* header-file lockout */

Return to the Main Unidata NetCDF page.
Generated on Tue Mar 1 2016 12:16:22 for NetCDF-Fortran. NetCDF is a Unidata library.