src/hdf5/H5ecloud/ORG/H5PartF.c

Go to the documentation of this file.
00001 #include "H5Part.h"
00002 #include <hdf5.h>
00003 /*
00004 Determine underscores using perl and then send through one stage of preprocessing
00005 to get the F77NAME fixed up.  Otherwise, must include correct flag each time.
00006 
00007 Or just don't declare F77NAME in the header (only in source as symbols).
00008 
00009 
00010 All pointers are cast to haddr_t (a unint64_t) within the C/C++ code
00011 In fortran, these pointers (handles) are carried as INTEGER*8
00012 
00013 */
00014 
00015 #ifdef F77_SINGLE_UNDERSCORE
00016 #define F77NAME(a,b,c) a
00017 #elif defined(F77_NO_UNDERSCORE)
00018 #define F77NAME(a,b,c) b
00019 #elif defined(F77_CRAY_UNDERSCORE)
00020 #define F77NAME(a,b,c) c
00021 #else
00022 #error Error, no way to determine how to construct fortran bindings
00023 #endif
00024 
00025 #define f_h5prt_openr F77NAME(h5prt_openr_,h5prt_openr,H5PRT_OPENR)
00026 #define f_h5prt_openw F77NAME(h5prt_openw_,h5prt_openw,H5PRT_OPENW)
00027 #define f_h5prt_close F77NAME(h5prt_close_,h5prt_close,H5PRT_CLOSE)
00028 #define f_h5prt_nprt F77NAME(h5prt_nprt_,h5prt_nprt,H5PRT_NPRT)
00029 #define f_h5prt_ndata F77NAME(h5prt_ndata_,h5prt_ndata,H5PRT_NDATA)
00030 #define f_h5prt_nstep F77NAME(h5prt_nstep_,h5prt_nstep,H5PRT_NSTEP)
00031 #define f_h5prt_readstep F77NAME(h5prt_readstep_,h5prt_readstep,H5PRT_READSTEP)
00032 #define f_h5prt_step F77NAME(h5prt_step_,h5prt_step,H5PRT_STEP)
00033 #define f_h5prt_wreal8 F77NAME(h5prt_wreal8_,h5prt_wreal8,H5PRT_WREAL8)
00034 #define f_h5prt_wint8 F77NAME(h5prt_wint8_,h5prt_wint8,H5PRT_WINT8)
00035 
00036 haddr_t f_h5prt_openr (char *file,int flen){
00037   haddr_t fh;
00038   H5PartFile* f;
00039   file[flen]='\0'; /* null terminate */
00040   f = (H5PartOpenFile(file,H5PART_READ));
00041   /*  printf("openr file=[%s] flen=%u haddr=%u\n",file,flen,f); */
00042   fh = (haddr_t)f;
00043   /* printf("FileHandle=%llu\n",fh); */
00044   return fh;
00045 }
00046 
00047 haddr_t f_h5prt_openw (char *file,int flen){
00048   haddr_t f;
00049   file[flen]='\0'; /* null terminate */
00050   f=(haddr_t)(H5PartOpenFile(file,H5PART_WRITE));
00051   return f;
00052 }
00053 
00054 void f_h5prt_close(haddr_t *file){
00055   H5PartCloseFile((H5PartFile*)*file);
00056 }
00057 
00058 haddr_t f_h5prt_nprt(haddr_t *file){
00059   /*  printf("nprt Haddr=%llu\n",file); */
00060   return H5PartGetNumParticles((H5PartFile*)*file);
00061 }
00062 
00063 int f_h5prt_ndata(haddr_t *file){
00064   /* printf("ndata Haddr=%llu\n",file); */
00065   return H5PartGetNumDatasets((H5PartFile*)*file);
00066 }
00067 
00068 int f_h5prt_nstep(haddr_t *file){
00069   /* printf("nstep Haddr=%llu\n",file); */
00070    return H5PartGetNumSteps((H5PartFile*)*file);
00071 }
00072 
00073 void f_h5prt_readstep(haddr_t *file,int *step,
00074                       double *x,double *y,double *z,
00075                       double *px,double *py,double *pz,
00076                       void *id){
00077   H5PartReadParticleStep((H5PartFile*)*file,(*step)-1,x,y,z,px,py,pz,(long long*)id);
00078 }
00079 
00080 void f_h5prt_step(haddr_t *file,int *step){
00081   H5PartSetStep((H5PartFile*)*file,(*step)-1);
00082 }
00083 
00084 void f_h5prt_wreal8(haddr_t *file,
00085                     char *name,void *data,int flen){
00086   name[flen]='\0';
00087   H5PartWriteDataFloat64((H5PartFile*)*file,name,(double*)data);
00088 }
00089 
00090 void f_h5prt_wint8(haddr_t *file,
00091                     char *name,void *data,int flen){
00092   name[flen]='\0';
00093   H5PartWriteDataInt64((H5PartFile*)*file,name,(long long*)data);
00094 }
00095 

Generated on Mon Jan 16 13:23:48 2006 for IPPL by  doxygen 1.4.6