Mercurial > hg > minc-tools
changeset 1017:51ec6a2164fd
Added wrappers for miopn, micre and miclos.
author | neelin <neelin> |
---|---|
date | Tue, 14 Jan 1997 19:46:53 +0000 |
parents | 3360d01230e8 |
children | 38766d118f10 |
files | fortran/minc.inc fortran/minc_ftest.f fortran/minc_jackets.src |
diffstat | 3 files changed, 95 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/fortran/minc.inc +++ b/fortran/minc.inc @@ -25,7 +25,7 @@ C make no representations about the suitability of this C software for any purpose. It is provided "as is" without C express or implied warranty. -C@RCSID : $Header: /private-cvsroot/minc/fortran/Attic/minc.inc,v 3.0 1995-05-15 19:32:47 neelin Rel $ MINC (MNI) +C@RCSID : $Header: /private-cvsroot/minc/fortran/Attic/minc.inc,v 3.1 1997-01-14 19:46:53 neelin Exp $ MINC (MNI) C----------------------------------------------------------------------------- C Some useful constants @@ -337,6 +337,7 @@ PARAMETER (MI_ERR_MAXMIN_DIMS =1348) C Function and subroutine declarations + EXTERNAL MIOPN, MICRE, MICLOSE EXTERNAL MIAGT, MIAGT1, MIVGT, MIVGT1, MIVPT, MIVPT1 EXTERNAL MISTCD, MITRCD, MICAAT, MICVD, MICVV, MICAVD EXTERNAL MICAVV, MIAPTP, MIAGTP, MICHLD, MISTDV, MIGRPV @@ -344,6 +345,7 @@ EXTERNAL ICVNQI, ICVNQS, ICVNDA, ICVDET, ICVGET, ICVPUT EXTERNAL ICVATT + INTEGER MIOPN, MICRE INTEGER MIAGTP, MICVD, MISTDV, MIGRPV INTEGER ICVCRT
--- a/fortran/minc_ftest.f +++ b/fortran/minc_ftest.f @@ -34,7 +34,7 @@ call icvstd(icv, MI_ICV_VALID_MAX, 200.0D0, rcode) call icvstd(icv, MI_ICV_VALID_MIN, 10.0D0, rcode) - mincid = nccre(filename, NCCLOB, rcode) + mincid = micre(filename, NCCLOB, rcode) dim(1) = ncddef(mincid, MIxspace, 2, rcode) dim(2) = ncddef(mincid, MIyspace, 2, rcode) @@ -143,9 +143,16 @@ call icvfre(icv, rcode) C +C Close input file +C + call miclos(mincid) + +C C Test copy routines C - mincid2 = nccre('test2.mnc', NCCLOB, rcode) + mincid = miopn(filename, NCNOWRIT, rcode) + + mincid2 = micre('test2.mnc', NCCLOB, rcode) call micavd(mincid, mincid2, 1, imgid, rcode)
--- a/fortran/minc_jackets.src +++ b/fortran/minc_jackets.src @@ -58,9 +58,12 @@ @CALLS : @CREATED : January 28, 1993 @MODIFIED : $Log: minc_jackets.src,v $ -@MODIFIED : Revision 3.0 1995-05-15 19:32:47 neelin -@MODIFIED : Release of minc version 0.3 +@MODIFIED : Revision 3.1 1997-01-14 19:46:53 neelin +@MODIFIED : Added wrappers for miopn, micre and miclos. @MODIFIED : +Revision 3.0 1995/05/15 19:32:47 neelin +Release of minc version 0.3 + Revision 2.1 1995/02/08 14:07:58 neelin Removed declaration of miicv_put function. @@ -86,7 +89,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/fortran/Attic/minc_jackets.src,v 3.0 1995-05-15 19:32:47 neelin Rel $ MINC (MNI)"; +static char rcsid[] = "$Header: /private-cvsroot/minc/fortran/Attic/minc_jackets.src,v 3.1 1997-01-14 19:46:53 neelin Exp $ MINC (MNI)"; #endif #include <ctype.h> @@ -113,6 +116,83 @@ /* From netcdf_convenience.c */ +/* + * Fortran version of miopen + */ +% int +% miopn ( +% string path, /* File to be opened */ +% int *mode, /* NCWRITE or NCNOWRIT */ +% int *rcode /* returned error code */ +% ) +% { + char *name; + int mincid; + + *rcode = 0; + + /* Copy the path */ + name = malloc(pathlen + 1); + (void) nstrncpy (name, path, pathlen); + + /* Call the C function */ + mincid = miopen(name, *mode); + free(name); + if (mincid == MI_ERROR) { + *rcode = ncerr; + } + return mincid; + +} + + +/* + * Fortran version of micreate + */ +% int +% micre ( +% string path, /* File to be created */ +% int *cmode, /* NCCLOB or NCNOCLOB */ +% int *rcode /* returned error code */ +% ) +% { + char *name; + int mincid; + + *rcode = 0; + + /* Copy the path */ + name = malloc(pathlen + 1); + (void) nstrncpy (name, path, pathlen); + + /* Call the C function */ + mincid = micreate(name, *cmode); + free(name); + if (mincid == MI_ERROR) { + *rcode = ncerr; + } + return mincid; + +} + + +/* + * Fortran version of miclose + */ +% void +% miclos ( +% int *cdfid, /* netCDF ID */ +% int *rcode /* returned error code */ +% ) +% { + + *rcode = 0; + if (miclose(*cdfid) == MI_ERROR) { + *rcode = ncerr; + } + +} + /* * Fortran version of miattget