diff options
author | tradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef> | 2003-06-17 08:51:22 +0000 |
---|---|---|
committer | tradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef> | 2003-06-17 08:51:22 +0000 |
commit | 077ee51b636cb8d9a8de34f035c489f1478f1ad0 (patch) | |
tree | 37de6cbb9a56e13a6c9096c17073c61542b0a729 | |
parent | d57552366e2da40e3a3b3d08ad65dc3673f81e1f (diff) |
Also support HDF5 as input/output file format.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusExternal/FlexIO/trunk@34 21a6bef8-4479-4f54-8f8d-0db94a2919ef
-rw-r--r-- | src/ioconvert.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/ioconvert.cc b/src/ioconvert.cc index c816df0..6ba466c 100644 --- a/src/ioconvert.cc +++ b/src/ioconvert.cc @@ -3,7 +3,12 @@ #include <string.h> #include "IO.hh" #include "IEEEIO.hh" +#ifdef WITH_HDF4 #include "HDFIO.hh" +#endif +#ifdef WITH_HDF5 +#include "H5IO.hh" +#endif char *programname; void usage(){ @@ -19,8 +24,10 @@ int main(int argc,char *argv[]){ int i,swap; int sindex=0,dindex=0,findex=0; IObase *infile,*outfile; - HDFIO *hdffile; +#ifdef WITH_HDF4 + HDFIO *hdffile = NULL; int hdfin=0; +#endif for(i=1;i<argc;i++){ if(*(argv[i])=='-') findex=i; else if(!sindex) sindex=i; @@ -36,10 +43,17 @@ int main(int argc,char *argv[]){ // for the input file char *s_ext=strrchr(argv[sindex],'.'); char *d_ext=strrchr(argv[dindex],'.'); +#ifdef WITH_HDF4 if(s_ext && !strcmp(s_ext,".hdf")){ infile=hdffile=new HDFIO(argv[sindex],IObase::Read); hdfin=1; } +#endif +#ifdef WITH_HDF5 + else if(s_ext && !strcmp(s_ext,".h5")){ + infile=new H5IO(argv[sindex],IObase::Read); + } +#endif else // assume its raw infile=new IEEEIO(argv[sindex],IObase::Read); if(!infile->isValid()){ @@ -49,7 +63,15 @@ int main(int argc,char *argv[]){ // for the outfile, if(d_ext && !strcmp(d_ext,".hdf")) + { outfile=new HDFIO(argv[dindex],IObase::Create); + } +#ifdef WITH_HDF5 + else if(d_ext && !strcmp(d_ext,".h5")) + { + outfile=new H5IO(argv[dindex],IObase::Create); + } +#endif else // assume its raw outfile=new IEEEIO(argv[dindex],IObase::Create,swap); // swap only affects IEEEIO output if(!outfile->isValid()){ @@ -64,7 +86,9 @@ int main(int argc,char *argv[]){ IObase::DataType type; char *data; infile->seek(i); +#ifdef WITH_HDF4 if(hdfin && hdffile->isCoord()) continue; // skip coord vars +#endif fprintf(stderr,".%u",i); infile->readInfo(type,rank,dims); { |