had to add copy of fortran files

This commit is contained in:
Ed Hartnett 2011-09-29 14:07:01 +00:00
parent 6f634d8b06
commit 66ac7a9121
2 changed files with 172 additions and 0 deletions

109
liblib/fort-lib.h Normal file
View File

@ -0,0 +1,109 @@
/* This is part of the netCDF package.
Copyright 2011 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Includes prototypes for some functions used to translate parameters
between C and Fortran.
*/
#ifndef UD_FORT_LIB_H
#define UD_FORT_LIB_H
#include <stddef.h> /* for ptrdiff_t, size_t */
#include "ncfortran.h"
#include <netcdf_f.h>
/*
* PURPOSE: Convert a C dimension-ID vector into a FORTRAN dimension-ID
* vector
* REQUIRE: <ncid> is valid && <varid> is valid && <cdimids> != NULL &&
* <fdimids> != NULL && <cdimids> != <fdimids>
* PROMISE: The order of the dimensions will be reversed and 1 will be
* added to each element. RESULT == <fdimids>
*/
EXTERNL NF_INTEGER *
c2f_dimids(int ncid, /* netCDF dataset ID */
int varid, /* netCDF variable ID */
const int *cdimids, /* C dim IDs */
NF_INTEGER *fdimids); /* FORTRAN dim IDs */
/*
* PURPOSE: Convert a FORTRAN dimension-ID vector into a C dimension-ID
* vector
* REQUIRE: <ndims> == 0 || (<ndims> >= 0 && <fdimids> != NULL &&
* <cdimids> != NULL && <fdimids> != <cdimids>)
* PROMISE: The order of the dimensions will be reversed and 1 will be
* subtracted from each element. RESULT == <cdimids>
*/
EXTERNL int *
f2c_dimids(int ndims, /* number of dims */
const NF_INTEGER *fdimids, /* FORTRAN dim IDs */
int *cdimids); /* C dim IDs */
/* These two are the same as the dimids, but for chunksizes, so that 1
* is not added/subtracted. */
EXTERNL NF_INTEGER *
c2f_chunksizes(int ncid, int varid, const int* cchunksizes,
NF_INTEGER *fchunksizes);
EXTERNL int *
f2c_chunksizes(int ncid, int varid, const NF_INTEGER *fchunksizes,
int *cchunksizes);
/*
* PURPOSE: Convert a FORTRAN co-ordinate vector into a C co-ordinate vector
* REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
* existing variable && <fcoords> != NULL && <ccoords> != NULL &&
* <fcoords> != <ccoords>
* PROMISE: The order of the co-ordinates will be reversed and 1 will be
* subtracted from each element. RESULT == <ccoords>.
*/
EXTERNL size_t *
f2c_coords(int ncid, /* dataset ID */
int varid, /* variable ID */
const NF_INTEGER *fcoords, /* FORTRAN coords */
size_t *ccoords); /* C coords */
/*
* PURPOSE: Convert a FORTRAN edge-count vector into a C edge-count vector
* REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
* existing variable && <fcounts> != NULL && <ccounts> != NULL &&
* <fcounts> != <ccounts> && <fcounts> != <ccounts>
* PROMISE: The order of the edge-counts will be reversed.
* RESULT == <ccounts>.
*/
EXTERNL size_t *
f2c_counts(int ncid, /* dataset ID */
int varid, /* variable ID */
const NF_INTEGER* fcounts, /* FORTRAN counts */
size_t* ccounts); /* C counts */
/*
* PURPOSE: Convert a FORTRAN stride vector into a C stride vector
* REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
* existing variable && <fstrides> != NULL && <cstrides> != NULL &&
* <fstrides> != <cstrides>
* PROMISE: The order of the strides will be reversed. RESULT == <cstrides>.
*/
EXTERNL ptrdiff_t *
f2c_strides(int ncid, /* dataset ID */
int varid, /* variable ID */
const NF_INTEGER *fstrides, /* FORTRAN strides */
ptrdiff_t *cstrides); /* C strides */
/*
* PURPOSE: Convert a FORTRAN mapping vector into a C mapping vector
* REQUIRE: <ncid> refers to an open dataset && <varid> refers to an
* existing variable && <fmaps> != NULL && <cmaps> != NULL &&
* <fmaps> != <cmaps>
* PROMISE: The order of the mapping vector will be reversed.
* RESULT == <cmaps>.
*/
EXTERNL ptrdiff_t *
f2c_maps(int ncid, /* dataset ID */
int varid, /* variable ID */
const NF_INTEGER *fmaps, /* FORTRAN mapping */
ptrdiff_t *cmaps); /* C mapping */
#endif /* header-file lockout */

63
liblib/netcdf_f.h Normal file
View File

@ -0,0 +1,63 @@
/*
* Copyright 1993-2011 University Corporation for Atmospheric Research/Unidata
*
* This header contains prototypes for functions only called by fortran 77.
*/
#ifndef _NETCDF_F_
#define _NETCDF_F_
#include <netcdf.h>
#if defined(__cplusplus)
extern "C" {
#endif
EXTERNL int
nc_inq_var_chunking_ints(int ncid, int varid, int *contiguousp, int *chunksizesp);
EXTERNL int
nc_def_var_chunking_ints(int ncid, int varid, int contiguous, int *chunksizesp);
EXTERNL int
nc_open_par_fortran(const char *path, int mode, int comm,
int info, int *ncidp);
EXTERNL int
nc_create_par_fortran(const char *path, int cmode, int comm,
int info, int *ncidp);
EXTERNL int
nc_set_chunk_cache_ints(int size, int nelems, int preemption);
EXTERNL int
nc_get_chunk_cache_ints(int *sizep, int *nelemsp, int *preemptionp);
EXTERNL int
nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
int preemption);
EXTERNL int
nc_get_var_chunk_cache_ints(int ncid, int varid, int *sizep,
int *nelemsp, int *preemptionp);
/* Prototypes for some extra functions in fort-lib.c. */
EXTERNL int
nc_inq_varids_f(int ncid, int *nvars, int *fvarids);
EXTERNL int
nc_inq_dimids_f(int ncid, int *ndims, int *fdimids, int parent);
EXTERNL int
nc_insert_array_compound_f(int ncid, int typeid, char *name,
size_t offset, nc_type field_typeid,
int ndims, int *dim_sizesp);
EXTERNL int
nc_inq_compound_field_f(int ncid, nc_type xtype, int fieldid, char *name,
size_t *offsetp, nc_type *field_typeidp, int *ndimsp,
int *dim_sizesp);
#if defined(__cplusplus)
}
#endif
#endif