diff options
-rw-r--r-- | src/.distdep | 963 | ||||
-rw-r--r-- | src/H5D.c | 16 | ||||
-rw-r--r-- | src/H5S.c | 68 | ||||
-rw-r--r-- | src/H5Shyper.c | 212 | ||||
-rw-r--r-- | src/H5Spoint.c | 66 | ||||
-rw-r--r-- | src/H5Sprivate.h | 5 | ||||
-rw-r--r-- | src/H5Spublic.h | 2 | ||||
-rw-r--r-- | src/H5Sselect.c | 98 | ||||
-rw-r--r-- | test/.distdep | 322 | ||||
-rw-r--r-- | test/tselect.c | 340 |
10 files changed, 1342 insertions, 750 deletions
diff --git a/src/.distdep b/src/.distdep index 516813c..15be2c8 100644 --- a/src/.distdep +++ b/src/.distdep @@ -1,3 +1,80 @@ +H5.o: \ + H5.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Zpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h +H5A.o: \ + H5A.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Apkg.h \ + H5Aprivate.h +H5AC.o: \ + H5AC.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Eprivate.h \ + H5Epublic.h H5B.o: \ H5B.c \ H5private.h \ @@ -12,17 +89,110 @@ H5B.o: \ H5Bprivate.h \ H5Bpublic.h \ H5Eprivate.h \ - H5Epublic.h -H5Fcore.o: \ - H5Fcore.c \ + H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h +H5D.o: \ + H5D.c \ H5private.h \ H5public.h \ H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ H5Eprivate.h \ H5Epublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h +H5E.o: \ + H5E.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Eprivate.h +H5F.o: \ + H5F.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Zpublic.h +H5Farray.o: \ + H5Farray.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ H5Ipublic.h \ H5Fprivate.h \ - H5Fpublic.h + H5Fpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h +H5Fcore.o: \ + H5Fcore.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h H5Ffamily.o: \ H5Ffamily.c \ H5private.h \ @@ -30,9 +200,48 @@ H5Ffamily.o: \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ + H5Ipublic.h +H5Fistore.o: \ + H5Fistore.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h +H5Flow.o: \ + H5Flow.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ H5Ipublic.h \ H5Fprivate.h \ - H5Fpublic.h + H5Fpublic.h \ + H5Dpublic.h \ + H5MMprivate.h \ + H5MMpublic.h H5Fmpio.o: \ H5Fmpio.c \ H5private.h \ @@ -74,6 +283,19 @@ H5Fsec2.o: \ H5Dpublic.h \ H5MMprivate.h \ H5MMpublic.h +H5Fsplit.o: \ + H5Fsplit.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5MFprivate.h \ + H5MFpublic.h H5Fstdio.o: \ H5Fstdio.c \ H5private.h \ @@ -87,6 +309,57 @@ H5Fstdio.o: \ H5Dpublic.h \ H5MMprivate.h \ H5MMpublic.h +H5G.o: \ + H5G.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Gpkg.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5Iprivate.h \ + H5MMprivate.h +H5Gent.o: \ + H5Gent.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Gpkg.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h H5Gnode.o: \ H5Gnode.c \ H5private.h \ @@ -116,7 +389,10 @@ H5Gnode.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h H5Gstab.o: \ H5Gstab.c \ H5private.h \ @@ -145,8 +421,25 @@ H5Gstab.o: \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h + H5Sprivate.h +H5HG.o: \ + H5HG.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h H5HL.o: \ H5HL.c \ H5private.h \ @@ -161,7 +454,10 @@ H5HL.o: \ H5Eprivate.h \ H5Epublic.h \ H5HLprivate.h \ - H5HLpublic.h + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h H5I.o: \ H5I.c \ H5private.h \ @@ -169,9 +465,7 @@ H5I.o: \ H5config.h \ H5Iprivate.h \ H5Ipublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h + H5Eprivate.h H5MF.o: \ H5MF.c \ H5private.h \ @@ -179,14 +473,15 @@ H5MF.o: \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h + H5Ipublic.h H5MM.o: \ H5MM.c \ H5private.h \ H5public.h \ - H5config.h + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h H5O.o: \ H5O.c \ H5private.h \ @@ -214,36 +509,37 @@ H5O.o: \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h -H5Ocomp.o: \ - H5Ocomp.c \ + H5Sprivate.h +H5Oattr.o: \ + H5Oattr.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ H5Sprivate.h \ - H5Spublic.h -H5Ocont.o: \ - H5Ocont.c \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Apkg.h +H5Ocomp.o: \ + H5Ocomp.c \ H5private.h \ H5public.h \ H5config.h \ @@ -264,11 +560,9 @@ H5Ocont.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h -H5Oname.o: \ - H5Oname.c \ + H5Tpublic.h +H5Ocont.o: \ + H5Ocont.c \ H5private.h \ H5public.h \ H5config.h \ @@ -289,31 +583,9 @@ H5Oname.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h -H5Onull.o: \ - H5Onull.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h -H5Ostab.o: \ - H5Ostab.c \ + H5Tpublic.h +H5Odtype.o: \ + H5Odtype.c \ H5private.h \ H5public.h \ H5config.h \ @@ -334,132 +606,37 @@ H5Ostab.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h -H5Tbit.o: \ - H5Tbit.c \ + H5Tpublic.h +H5Oefl.o: \ + H5Oefl.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5Iprivate.h \ - H5Tpkg.h \ - H5HGprivate.h \ - H5HGpublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h -H5Tconv.o: \ - H5Tconv.c \ - H5Iprivate.h \ - H5Ipublic.h \ - H5public.h \ - H5config.h \ - H5private.h \ - H5Eprivate.h \ - H5Epublic.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Tpkg.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h -H5Flow.o: \ - H5Flow.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5MMprivate.h \ - H5MMpublic.h -H5Fsplit.o: \ - H5Fsplit.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h -H5Gent.o: \ - H5Gent.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Gpkg.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ - H5HLprivate.h \ - H5HLpublic.h -H5HG.o: \ - H5HG.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HGprivate.h \ - H5HGpublic.h -H5Tinit.o: \ - H5Tinit.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Tpkg.h \ H5HGprivate.h \ H5HGpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ H5Tprivate.h \ H5Tpublic.h \ - H5Gprivate.h -H5Farray.o: \ - H5Farray.c \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h +H5Olayout.o: \ + H5Olayout.c \ H5private.h \ H5public.h \ H5config.h \ @@ -480,51 +657,45 @@ H5Farray.o: \ H5Tpublic.h \ H5Sprivate.h \ H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h -H5Odtype.o: \ - H5Odtype.c \ + H5Zprivate.h +H5Omtime.o: \ + H5Omtime.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ H5MMprivate.h \ H5MMpublic.h \ H5Oprivate.h \ H5Opublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h -H5Oefl.o: \ - H5Oefl.c \ + H5Tpublic.h +H5Oname.o: \ + H5Oname.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ H5MMprivate.h \ H5MMpublic.h \ H5Oprivate.h \ H5Opublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ @@ -533,31 +704,24 @@ H5Oefl.o: \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h -H5Olayout.o: \ - H5Olayout.c \ +H5Onull.o: \ + H5Onull.c \ H5private.h \ H5public.h \ H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5Fprivate.h \ H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h + H5Tprivate.h H5Osdspace.o: \ H5Osdspace.c \ H5private.h \ @@ -580,9 +744,7 @@ H5Osdspace.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h + H5Tpublic.h H5Oshared.o: \ H5Oshared.c \ H5private.h \ @@ -605,21 +767,9 @@ H5Oshared.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h -H5E.o: \ - H5E.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h -H5Oattr.o: \ - H5Oattr.c \ + H5Tpublic.h +H5Ostab.o: \ + H5Ostab.c \ H5private.h \ H5public.h \ H5config.h \ @@ -640,28 +790,24 @@ H5Oattr.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h -H5Z.o: \ - H5Z.c \ + H5Tpublic.h +H5P.o: \ + H5P.c \ H5private.h \ H5public.h \ H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ + H5Iprivate.h \ H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Dprivate.h \ H5Gprivate.h \ H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ @@ -669,7 +815,10 @@ H5Z.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h H5Sall.o: \ H5Sall.c \ H5private.h \ @@ -692,11 +841,9 @@ H5Sall.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Zprivate.h \ - H5Zpublic.h -H5Ssimp.o: \ - H5Ssimp.c \ + H5Tpublic.h +H5Shyper.o: \ + H5Shyper.c \ H5private.h \ H5public.h \ H5config.h \ @@ -717,152 +864,32 @@ H5Ssimp.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Zprivate.h \ - H5Zpublic.h -H5V.o: \ - H5V.c \ + H5Tpublic.h +H5Spoint.o: \ + H5Spoint.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h -H5.o: \ - H5.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Iprivate.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Zpublic.h \ H5Sprivate.h \ H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h -H5F.o: \ - H5F.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Tprivate.h \ - H5Tpublic.h -H5G.o: \ - H5G.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Gpkg.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5HLprivate.h -H5P.o: \ - H5P.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ H5Bprivate.h \ H5Bpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5Dprivate.h \ - H5Gprivate.h \ - H5Gpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h -H5Shyper.o: \ - H5Shyper.c \ + H5HGpublic.h +H5Ssimp.o: \ + H5Ssimp.c \ H5private.h \ H5public.h \ H5config.h \ @@ -883,17 +910,16 @@ H5Shyper.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h \ - H5Zprivate.h \ - H5Zpublic.h -H5Spoint.o: \ - H5Spoint.c \ + H5Tpublic.h +H5Sselect.o: \ + H5Sselect.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ + H5Iprivate.h \ H5MMprivate.h \ H5MMpublic.h \ H5Sprivate.h \ @@ -910,32 +936,23 @@ H5Spoint.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h -H5TB.o: \ - H5TB.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h -H5A.o: \ - H5A.c \ + H5Tpublic.h \ + H5Zprivate.h \ + H5Zpublic.h +H5T.o: \ + H5T.c \ H5private.h \ H5public.h \ H5config.h \ - H5Iprivate.h \ + H5Dprivate.h \ + H5Dpublic.h \ H5Ipublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ H5Fprivate.h \ H5Fpublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ H5Gprivate.h \ H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ @@ -946,71 +963,85 @@ H5A.o: \ H5Spublic.h \ H5Zprivate.h \ H5Zpublic.h \ + H5Iprivate.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h -H5S.o: \ - H5S.c \ + H5MMprivate.h +H5Tbit.o: \ + H5Tbit.c \ H5private.h \ H5public.h \ H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ + H5Iprivate.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Gprivate.h +H5Tconv.o: \ + H5Tconv.c \ H5Iprivate.h \ H5Ipublic.h \ + H5public.h \ + H5config.h \ + H5private.h \ H5Eprivate.h \ H5Epublic.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ - H5Bpublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h -H5Sselect.o: \ - H5Sselect.c \ + H5Bpublic.h +H5Tinit.o: \ + H5Tinit.c \ H5private.h \ H5public.h \ H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5Ipublic.h \ - H5Iprivate.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ H5Tprivate.h -H5Omtime.o: \ - H5Omtime.c \ +H5TB.o: \ + H5TB.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Eprivate.h +H5V.o: \ + H5V.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5Fprivate.h \ @@ -1023,26 +1054,28 @@ H5Omtime.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h -H5D.o: \ - H5D.c \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h +H5Z.o: \ + H5Z.c \ H5private.h \ H5public.h \ H5config.h \ - H5Iprivate.h \ + H5Eprivate.h \ + H5Epublic.h \ H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5Dprivate.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ @@ -1050,79 +1083,27 @@ H5D.o: \ H5Sprivate.h \ H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MFprivate.h \ - H5MFpublic.h -H5T.o: \ - H5T.c \ + H5Zpublic.h +H5S.o: \ + H5S.c \ H5private.h \ H5public.h \ H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ H5Iprivate.h \ + H5Ipublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h -H5AC.o: \ - H5AC.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5Fprivate.h \ H5Fpublic.h \ - H5Ipublic.h \ H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h -H5Fistore.o: \ - H5Fistore.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MFprivate.h \ - H5MFpublic.h + H5Tprivate.h @@ -575,12 +575,20 @@ H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } + /* Check for valid selection */ + if(H5S_select_valid(mem_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); + } /* end if */ } if (H5S_ALL != file_space_id) { if (H5_DATASPACE != H5I_group(file_space_id) || NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } + /* Check for valid selection */ + if(H5S_select_valid(file_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); + } /* end if */ } if (H5P_DEFAULT == plist_id) { xfer_parms = &H5D_xfer_dflt; @@ -666,12 +674,20 @@ H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } + /* Check for valid selection */ + if(H5S_select_valid(mem_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); + } /* end if */ } if (H5S_ALL != file_space_id) { if (H5_DATASPACE != H5I_group(file_space_id) || NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } + /* Check for valid selection */ + if(H5S_select_valid(file_space)!=TRUE) { + HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); + } /* end if */ } if (H5P_DEFAULT == plist_id) { xfer_parms = &H5D_xfer_dflt; @@ -237,6 +237,10 @@ H5S_close(H5S_t *ds) assert(ds); + /* If there was a previous offset for the selection, release it */ + if(ds->select.offset!=NULL) + ds->select.offset=H5MM_xfree(ds->select.offset); + /* Release selection (this should come before the extent release) */ H5S_select_release(ds); @@ -485,8 +489,7 @@ H5S_copy(const H5S_t *src) FUNC_ENTER(H5S_copy, NULL); if (NULL==(dst = H5MM_malloc(sizeof(H5S_t)))) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } *dst = *src; @@ -933,6 +936,11 @@ H5S_read(H5G_entry_t *ent) /* Default to entire dataspace being selected */ ds->select.type=H5S_SEL_ALL; + /* Allocate space for the offset and set it to zeros */ + if (NULL==(ds->select.offset = H5MM_calloc(ds->extent.u.simple.rank*sizeof(hssize_t)))) { + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + } + FUNC_LEAVE(ds); } @@ -1181,6 +1189,15 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, assert(rank>=0); assert(0==rank || dims); + /* If there was a previous offset for the selection, release it */ + if(space->select.offset!=NULL) + space->select.offset=H5MM_xfree(space->select.offset); + + /* Allocate space for the offset and set it to zeros */ + if (NULL==(space->select.offset = H5MM_calloc(rank*sizeof(hssize_t)))) { + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + } + /* shift out of the previous state to a "simple" dataspace */ switch (space->extent.type) { case H5S_SCALAR: @@ -1567,7 +1584,7 @@ H5Sset_extent_none (hid_t space_id) H5TRACE1("e","i",space_id); /* Check args */ - if ((space = H5I_object(space_id)) == NULL) { + if (H5_DATASPACE != H5I_group(space_id) || NULL == (space = H5I_object(space_id))) { HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); } @@ -1580,6 +1597,51 @@ H5Sset_extent_none (hid_t space_id) FUNC_LEAVE(SUCCEED); } /* end H5Sset_extent_none() */ +/*-------------------------------------------------------------------------- + NAME + H5Soffset_simple + PURPOSE + Changes the offset of a selection within a simple dataspace extent + USAGE + herr_t H5Soffset_simple(space_id, offset) + hid_t space_id; IN: Dataspace object to reset + const hssize_t *offset; IN: Offset to position the selection at + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function creates an offset for the selection within an extent, allowing + the same shaped selection to be moved to different locations within a + dataspace without requiring it to be re-defined. +--------------------------------------------------------------------------*/ +herr_t +H5Soffset_simple (hid_t space_id, const hssize_t *offset) +{ + H5S_t *space = NULL; /* dataspace to modify */ + + FUNC_ENTER(H5Soffset_simple, FAIL); + H5TRACE2("e","i*Hs",space_id,offset); + + /* Check args */ + if (H5_DATASPACE != H5I_group(space_id) || NULL == (space = H5I_object(space_id))) { + HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); + } + if (offset == NULL) { + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified"); + } + + /* Allocate space for new offset */ + if(space->select.offset==NULL) { + if (NULL==(space->select.offset = H5MM_malloc(sizeof(hssize_t)*space->extent.u.simple.rank))) { + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + } + } + + /* Copy the offset over */ + HDmemcpy(space->select.offset,offset,sizeof(hssize_t)*space->extent.u.simple.rank); + + FUNC_LEAVE(SUCCEED); +} /* end H5Soffset_simple() */ + /*------------------------------------------------------------------------- * Function: H5S_debug * diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 7a646aa..ebf6cfe 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -41,8 +41,8 @@ static intn H5S_hyper_bsearch(hssize_t size, H5S_hyper_bound_t *barr, size_t count); static H5S_hyper_region_t * H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, - H5S_hyper_bound_t **lo_bounds, - H5S_hyper_bound_t **hi_bounds, hssize_t *pos); + H5S_hyper_bound_t **lo_bounds, H5S_hyper_bound_t **hi_bounds, hssize_t *pos, + hssize_t *offset); static size_t H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info); static size_t H5S_hyper_fwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info); @@ -164,8 +164,8 @@ H5S_hyper_compare_regions (const void *r1, const void *r2) */ static H5S_hyper_region_t * H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, - H5S_hyper_bound_t **lo_bounds, - H5S_hyper_bound_t **hi_bounds, hssize_t *pos) + H5S_hyper_bound_t **lo_bounds, H5S_hyper_bound_t **hi_bounds, hssize_t *pos, + hssize_t *offset) { H5S_hyper_region_t *ret_value=NULL; /* Pointer to array to return */ H5S_hyper_node_t *node; /* Region node for a given boundary */ @@ -196,47 +196,42 @@ H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, #endif /* QAK */ for(i=0; i<bound_count; i++) { /* Skip past already iterated regions */ - if(pos[0]==(-1) || - (pos[0]>=lo_bounds[0][i].bound && pos[0] <= - hi_bounds[0][i].bound)) { + if(pos[0]==(-1) || ((pos[0]+offset[0])>=lo_bounds[0][i].bound && (pos[0]+offset[0]) <= hi_bounds[0][i].bound)) { /* Check if we've allocated the array yet */ if(num_reg==0) { /* Allocate array */ ret_value=H5MM_malloc(sizeof(H5S_hyper_region_t)); /* Initialize with first region */ - ret_value[0].start=MAX(lo_bounds[0][i].bound,pos[0]); - ret_value[0].end=hi_bounds[0][i].bound; + ret_value[0].start=MAX(lo_bounds[0][i].bound,pos[0])+offset[0]; + ret_value[0].end=hi_bounds[0][i].bound+offset[0]; /* Increment the number of regions */ num_reg++; } else { /* - * Check if we should merge this region into the current - * region. - */ + * Check if we should merge this region into the current + * region. + */ if(lo_bounds[0][i].bound<ret_value[curr_reg].end) { ret_value[curr_reg].end=MAX(hi_bounds[0][i].bound, - ret_value[curr_reg].end); - } else { - /* no overlap with previous region, add new region */ + ret_value[curr_reg].end)+(offset!=NULL ? offset[0] : 0 ); + } else { /* no overlap with previous region, add new region */ /* Check if this is actually a different region */ if(lo_bounds[0][i].bound!=ret_value[curr_reg].start && hi_bounds[0][i].bound!=ret_value[curr_reg].end) { /* Enlarge array */ - ret_value=H5MM_realloc(ret_value, - (sizeof(H5S_hyper_region_t)* - (num_reg+1))); + ret_value=H5MM_realloc(ret_value,(sizeof(H5S_hyper_region_t)*(num_reg+1))); /* Initialize with new region */ - ret_value[num_reg].start=lo_bounds[0][i].bound; - ret_value[num_reg].end=hi_bounds[0][i].bound; + ret_value[num_reg].start=lo_bounds[0][i].bound+offset[0]; + ret_value[num_reg].end=hi_bounds[0][i].bound+offset[0]; /* - * Increment the number of regions & the current - * region. - */ + * Increment the number of regions & the current + * region. + */ num_reg++; curr_reg++; } /* end if */ @@ -248,13 +243,19 @@ H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, /* Generate list of regions based on the current position */ #ifdef QAK printf("%s: check 2.0, bound_count=%d\n",FUNC,bound_count); + printf("%s: check 2.0, pos[%d]=%d, offset[%d]=%d, hi_bounds[%d][%d].bound=%d\n",FUNC,(int)dim,(int)pos[dim],(int)dim,(int)offset[dim], + (int)dim,(int)0,(int)hi_bounds[dim][0].bound); #endif /* QAK */ next_dim=dim+1; /* Skip past bounds which don't overlap */ i=0; - while(pos[dim]>hi_bounds[dim][i].bound && i<bound_count) + while(pos[dim]>(hi_bounds[dim][i].bound+offset[dim]) && i<bound_count) i++; - for(; pos[dim]>=lo_bounds[dim][i].bound && i<bound_count; i++) { +#ifdef QAK + printf("%s: check 2.0.5, lo_bounds[%d][%d].bound=%d\n",FUNC, + (int)dim,(int)i,(int)lo_bounds[dim][i].bound); +#endif /* QAK */ + for(; pos[dim]>=(lo_bounds[dim][i].bound+offset[dim]) && i<bound_count; i++) { #ifdef QAK printf("%s: check 2.1, i=%d, num_reg=%d, pos[%d]=%d\n", @@ -270,8 +271,7 @@ H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, /* Check if each boundary overlaps in the higher dimensions */ node=lo_bounds[dim][i].node; temp_dim=dim; - while(temp_dim>=0 && pos[temp_dim]>=node->start[temp_dim] && - pos[temp_dim]<=node->end[temp_dim]) + while(temp_dim>=0 && pos[temp_dim]>=(node->start[temp_dim]+offset[temp_dim]) && pos[temp_dim]<=(node->end[temp_dim]+offset[temp_dim])) temp_dim--; /* Yes, all previous positions match, this is a valid region */ @@ -288,36 +288,28 @@ H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, ret_value=H5MM_malloc(sizeof(H5S_hyper_region_t)); /* Initialize with first region */ - ret_value[0].start=MAX(node->start[next_dim],pos[next_dim]); - ret_value[0].end=node->end[next_dim]; + ret_value[0].start=MAX(node->start[next_dim],pos[next_dim])+offset[next_dim]; + ret_value[0].end=node->end[next_dim]+offset[next_dim]; #ifdef QAK - printf("%s: check 3.2, lo_bounds=%d, start=%d, " - "hi_bounds=%d, end=%d\n", - FUNC, (int)node->start[next_dim], - (int)ret_value[curr_reg].start, - (int)node->end[next_dim], - (int)ret_value[curr_reg].end); + printf("%s: check 3.2, lo_bounds=%d, start=%d, hi_bounds=%d, end=%d\n", + FUNC, (int)node->start[next_dim], (int)ret_value[curr_reg].start, + (int)node->end[next_dim], (int)ret_value[curr_reg].end); #endif /* QAK */ /* Increment the number of regions */ num_reg++; } else { #ifdef QAK - printf("%s: check 4.0, lo_bounds=%d, start=%d, " - "hi_bounds=%d, end=%d\n", - FUNC, (int)node->start[next_dim], - (int)ret_value[curr_reg].start, - (int)node->end[next_dim], - (int)ret_value[curr_reg].end); + printf("%s: check 4.0, lo_bounds=%d, start=%d, hi_bounds=%d, end=%d\n", + FUNC, (int)node->start[next_dim], (int)ret_value[curr_reg].start, + (int)node->end[next_dim], (int)ret_value[curr_reg].end); #endif /* QAK */ /* Enlarge array */ - ret_value=H5MM_realloc(ret_value, - (sizeof(H5S_hyper_region_t)* - (num_reg+1))); + ret_value=H5MM_realloc(ret_value,(sizeof(H5S_hyper_region_t)*(num_reg+1))); /* Initialize with new region */ - ret_value[num_reg].start=node->start[next_dim]; - ret_value[num_reg].end=node->end[next_dim]; + ret_value[num_reg].start=node->start[next_dim]+offset[next_dim]; + ret_value[num_reg].end=node->end[next_dim]+offset[next_dim]; /* Increment the number of regions & the current region */ num_reg++; @@ -328,8 +320,7 @@ H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count, /* Sort region list and eliminate duplicates if necessary */ if(num_reg>1) { - qsort(ret_value,num_reg,sizeof(H5S_hyper_region_t), - H5S_hyper_compare_regions); + qsort(ret_value,num_reg,sizeof(H5S_hyper_region_t),H5S_hyper_compare_regions); for(i=1,curr_reg=0,uniq_reg=1; i<num_reg; i++) { if(ret_value[curr_reg].start!=ret_value[i].start && ret_value[curr_reg].end!=ret_value[i].end) { @@ -400,7 +391,7 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) if((regions=H5S_hyper_get_regions(&num_regions,dim, fhyper_info->space->select.sel_info.hyper_lst->count, fhyper_info->lo_bounds, fhyper_info->hi_bounds, - fhyper_info->iter->hyp.pos))!=NULL) { + fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) { /* * Check if this is the second to last dimension in dataset (Which @@ -419,15 +410,12 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) /* Set up hyperslab I/O parameters which apply to all regions */ /* Copy the location of the region in the file */ - HDmemcpy(file_offset, fhyper_info->iter->hyp.pos, - (fhyper_info->space->extent.u.simple.rank * - sizeof(hssize_t))); + HDmemcpy(file_offset, fhyper_info->iter->hyp.pos, (fhyper_info->space->extent.u.simple.rank * sizeof(hssize_t))); file_offset[fhyper_info->space->extent.u.simple.rank]=0; /* Set the hyperslab size to copy */ hsize[0]=1; - H5V_array_fill(hsize, hsize, sizeof(hsize[0]), - fhyper_info->space->extent.u.simple.rank); + H5V_array_fill(hsize, hsize, sizeof(hsize[0]), fhyper_info->space->extent.u.simple.rank); hsize[fhyper_info->space->extent.u.simple.rank]=fhyper_info->elmt_size; /* Set the memory offset to the origin */ @@ -438,8 +426,7 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) #ifdef QAK printf("%s: check 2.2, i=%d\n",FUNC,(int)i); #endif /* QAK */ - region_size=MIN(fhyper_info->nelmts, - (regions[i].end-regions[i].start)+1); + region_size=MIN(fhyper_info->nelmts, (regions[i].end-regions[i].start)+1); hsize[fhyper_info->space->extent.u.simple.rank-1]=region_size; file_offset[fhyper_info->space->extent.u.simple.rank-1]=regions[i].start; @@ -447,12 +434,9 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) * Gather from file. */ if (H5F_arr_read (fhyper_info->f, fhyper_info->layout, - fhyper_info->comp, fhyper_info->efl, - hsize, hsize, zero, file_offset, - fhyper_info->xfer_mode, - fhyper_info->dst/*out*/)<0) { - HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, - "read error"); + fhyper_info->comp, fhyper_info->efl, hsize, hsize, zero, + file_offset, fhyper_info->xfer_mode, fhyper_info->dst/*out*/)<0) { + HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "read error"); } #ifdef QAK printf("%s: check 2.3, region #%d\n",FUNC,(int)i); @@ -462,8 +446,7 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) #endif /* QAK */ /* Advance the pointer in the buffer */ - fhyper_info->dst = ((uint8 *)fhyper_info->dst) + - region_size*fhyper_info->elmt_size; + fhyper_info->dst = ((uint8 *)fhyper_info->dst) + region_size*fhyper_info->elmt_size; /* Increment the number of elements read */ num_read+=region_size; @@ -475,8 +458,7 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) if(region_size==(hsize_t)((regions[i].end-regions[i].start)+1)) fhyper_info->iter->hyp.pos[dim+1]=(-1); else - fhyper_info->iter->hyp.pos[dim+1] = regions[i].start + - region_size; + fhyper_info->iter->hyp.pos[dim+1] = regions[i].start + region_size; /* Decrement the iterator count */ fhyper_info->iter->hyp.elmt_left-=region_size; @@ -492,17 +474,15 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) /* Step through each region in this dimension */ for(i=0; i<num_regions && fhyper_info->nelmts>0; i++) { /* Step through each location in each region */ - for(j=regions[i].start; - j<=regions[i].end && fhyper_info->nelmts>0; - j++) { + for(j=regions[i].start; j<=regions[i].end && fhyper_info->nelmts>0; j++) { #ifdef QAK printf("%s: check 4.0, dim=%d, location=%d\n",FUNC,dim,j); #endif /* QAK */ /* - * If we are moving to a new position in this dim, reset - * the next lower dim. location. - */ + * If we are moving to a new position in this dim, reset + * the next lower dim. location. + */ if(fhyper_info->iter->hyp.pos[dim]!=j) fhyper_info->iter->hyp.pos[dim+1]=(-1); @@ -659,7 +639,7 @@ H5S_hyper_fwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) if((regions=H5S_hyper_get_regions(&num_regions,dim, fhyper_info->space->select.sel_info.hyper_lst->count, fhyper_info->lo_bounds, fhyper_info->hi_bounds, - fhyper_info->iter->hyp.pos))!=NULL) { + fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) { /* Check if this is the second to last dimension in dataset */ /* (Which means that we've got a list of the regions in the fastest */ @@ -890,7 +870,7 @@ H5S_hyper_mread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) if((regions=H5S_hyper_get_regions(&num_regions,dim, fhyper_info->space->select.sel_info.hyper_lst->count, fhyper_info->lo_bounds, fhyper_info->hi_bounds, - fhyper_info->iter->hyp.pos))!=NULL) { + fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) { /* Check if this is the second to last dimension in dataset */ /* (Which means that we've got a list of the regions in the fastest */ @@ -909,30 +889,24 @@ H5S_hyper_mread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) /* Set up hyperslab I/O parameters which apply to all regions */ /* Set up the size of the memory space */ - HDmemcpy(mem_size, fhyper_info->space->extent.u.simple.size, - fhyper_info->space->extent.u.simple.rank*sizeof(hsize_t)); + HDmemcpy(mem_size, fhyper_info->space->extent.u.simple.size, fhyper_info->space->extent.u.simple.rank*sizeof(hsize_t)); mem_size[fhyper_info->space->extent.u.simple.rank]=fhyper_info->elmt_size; /* Copy the location of the region in the file */ - HDmemcpy(mem_offset, fhyper_info->iter->hyp.pos, - (fhyper_info->space->extent.u.simple.rank * - sizeof(hssize_t))); + HDmemcpy(mem_offset, fhyper_info->iter->hyp.pos, (fhyper_info->space->extent.u.simple.rank * sizeof(hssize_t))); mem_offset[fhyper_info->space->extent.u.simple.rank]=0; /* Set the hyperslab size to copy */ hsize[0]=1; - H5V_array_fill(hsize, hsize, sizeof(hsize[0]), - fhyper_info->space->extent.u.simple.rank); + H5V_array_fill(hsize, hsize, sizeof(hsize[0]), fhyper_info->space->extent.u.simple.rank); hsize[fhyper_info->space->extent.u.simple.rank]=fhyper_info->elmt_size; /* Set the memory offset to the origin */ - HDmemset (zero, 0, ((fhyper_info->space->extent.u.simple.rank+1)* - sizeof(*zero))); + HDmemset (zero, 0, ((fhyper_info->space->extent.u.simple.rank+1)* sizeof(*zero))); /* perform I/O on data from regions */ for(i=0; i<num_regions && fhyper_info->nelmts>0; i++) { - region_size=MIN(fhyper_info->nelmts, - (regions[i].end-regions[i].start)+1); + region_size=MIN(fhyper_info->nelmts, (regions[i].end-regions[i].start)+1); hsize[fhyper_info->space->extent.u.simple.rank-1]=region_size; mem_offset[fhyper_info->space->extent.u.simple.rank-1]=regions[i].start; #ifdef QAK @@ -951,8 +925,7 @@ H5S_hyper_mread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) } /* Advance the pointer in the buffer */ - fhyper_info->dst = ((uint8 *)fhyper_info->dst) + - region_size*fhyper_info->elmt_size; + fhyper_info->dst = ((uint8 *)fhyper_info->dst) + region_size*fhyper_info->elmt_size; /* Increment the number of elements read */ num_read+=region_size; @@ -981,17 +954,15 @@ H5S_hyper_mread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) /* Step through each region in this dimension */ for(i=0; i<num_regions && fhyper_info->nelmts>0; i++) { /* Step through each location in each region */ - for(j=regions[i].start; - j<=regions[i].end && fhyper_info->nelmts>0; - j++) { + for(j=regions[i].start; j<=regions[i].end && fhyper_info->nelmts>0; j++) { #ifdef QAK printf("%s: check 4.0, dim=%d, location=%d\n",FUNC,dim,j); #endif /* QAK */ /* - * If we are moving to a new position in this dim, reset - * the next lower dim. location. - */ + * If we are moving to a new position in this dim, reset + * the next lower dim. location. + */ if(fhyper_info->iter->hyp.pos[dim]!=j) fhyper_info->iter->hyp.pos[dim+1]=(-1); @@ -1164,7 +1135,7 @@ H5S_hyper_mwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info) if((regions=H5S_hyper_get_regions(&num_regions,dim, fhyper_info->space->select.sel_info.hyper_lst->count, fhyper_info->lo_bounds, fhyper_info->hi_bounds, - fhyper_info->iter->hyp.pos))!=NULL) { + fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) { #ifdef QAK printf("%s: check 2.0, rank=%d\n", @@ -1915,4 +1886,57 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src) done: FUNC_LEAVE (ret_value); } /* end H5S_hyper_copy() */ + +/*-------------------------------------------------------------------------- + NAME + H5S_hyper_select_valid + PURPOSE + Check whether the selection fits within the extent, with the current + offset defined. + USAGE + hbool_t H5S_hyper_select_valid(space); + H5S_t *space; IN: Dataspace pointer to query + RETURNS + TRUE if the selection fits within the extent, FALSE if it does not and + FAIL on an error. + DESCRIPTION + Determines if the current selection at the current offet fits within the + extent for the dataspace. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hbool_t +H5S_hyper_select_valid (const H5S_t *space) +{ + H5S_hyper_node_t *curr; /* Hyperslab information nodes */ + intn i; /* Counter */ + hbool_t ret_value=TRUE; /* return value */ + + FUNC_ENTER (H5S_hyper_select_valid, FAIL); + + assert(space); + + /* Check each point to determine whether selection+offset is within extent */ + curr=space->select.sel_info.hyper_lst->head; + while(curr!=NULL && ret_value==TRUE) { + /* Check each dimension */ + for(i=0; i<space->extent.u.simple.rank; i++) { + /* Check if an offset has been defined */ + /* Bounds check the selected point + offset against the extent */ + if(((curr->start[i]+space->select.offset[i])>(hssize_t)space->extent.u.simple.size[i]) + || ((curr->start[i]+space->select.offset[i])<0) + || ((curr->end[i]+space->select.offset[i])>(hssize_t)space->extent.u.simple.size[i]) + || ((curr->end[i]+space->select.offset[i])<0)) { + ret_value=FALSE; + break; + } /* end if */ + } /* end for */ + + curr=curr->next; + } /* end while */ + + FUNC_LEAVE (ret_value); +} /* end H5S_hyper_select_valid() */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 91141a4..d375e0d 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -259,10 +259,13 @@ H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout, while(num_read<nelmts) { if(file_iter->pnt.elmt_left>0) { /* Copy the location of the point to get */ - HDmemcpy(file_offset, file_iter->pnt.curr->pnt, - ndims*sizeof(hssize_t)); + HDmemcpy(file_offset, file_iter->pnt.curr->pnt,ndims*sizeof(hssize_t)); file_offset[ndims] = 0; + /* Add in the offset */ + for(i=0; i<file_space->extent.u.simple.rank; i++) + file_offset[i] += file_space->select.offset[i]; + /* Go read the point */ if (H5F_arr_read (f, layout, comp, efl, hsize, hsize, zero, file_offset, xfer_mode, buf/*out*/)<0) { @@ -375,6 +378,10 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout, HDmemcpy(file_offset,file_iter->pnt.curr->pnt,ndims*sizeof(hssize_t)); file_offset[ndims] = 0; + /* Add in the offset, if there is one */ + for(i=0; i<file_space->extent.u.simple.rank; i++) + file_offset[i] += file_space->select.offset[i]; + #ifdef QAK printf("%s: check 3.0\n",FUNC); { @@ -466,7 +473,7 @@ H5S_point_mgath (const void *_buf, size_t elmt_size, if(mem_iter->pnt.elmt_left>0) { /* Compute the location of the point to get */ for(i=space_ndims-1,acc=1,off=0; i>=0; i--) { - off+=mem_iter->pnt.curr->pnt[i]*acc; + off+=(mem_iter->pnt.curr->pnt[i]+mem_space->select.offset[i])*acc; acc*=mem_size[i]; } /* end for */ @@ -550,7 +557,7 @@ H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, if(mem_iter->pnt.elmt_left>0) { /* Compute the location of the point to get */ for(i=space_ndims-1,acc=1,off=0; i>=0; i--) { - off+=mem_iter->pnt.curr->pnt[i]*acc; + off+=(mem_iter->pnt.curr->pnt[i]+mem_space->select.offset[i])*acc; acc*=mem_size[i]; } /* end for */ @@ -718,4 +725,55 @@ H5S_point_copy (H5S_t *dst, const H5S_t *src) done: FUNC_LEAVE (ret_value); } /* end H5S_point_copy() */ + +/*-------------------------------------------------------------------------- + NAME + H5S_point_select_valid + PURPOSE + Check whether the selection fits within the extent, with the current + offset defined. + USAGE + hbool_t H5S_point_select_valid(space); + H5S_t *space; IN: Dataspace pointer to query + RETURNS + TRUE if the selection fits within the extent, FALSE if it does not and + FAIL on an error. + DESCRIPTION + Determines if the current selection at the current offet fits within the + extent for the dataspace. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hbool_t +H5S_point_select_valid (const H5S_t *space) +{ + H5S_pnt_node_t *curr; /* Point information nodes */ + intn i; /* Counter */ + hbool_t ret_value=TRUE; /* return value */ + + FUNC_ENTER (H5S_point_select_valid, FAIL); + + assert(space); + + /* Check each point to determine whether selection+offset is within extent */ + curr=space->select.sel_info.pnt_lst->head; + while(curr!=NULL) { + /* Check each dimension */ + for(i=0; i<space->extent.u.simple.rank; i++) { + /* Check if an offset has been defined */ + /* Bounds check the selected point + offset against the extent */ + if(((curr->pnt[i]+space->select.offset[i])>(hssize_t)space->extent.u.simple.size[i]) + || ((curr->pnt[i]+space->select.offset[i])<0)) { + ret_value=FALSE; + break; + } /* end if */ + } /* end for */ + + curr=curr->next; + } /* end while */ + + FUNC_LEAVE (ret_value); +} /* end H5S_point_select_valid() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 611ea27..842c114 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -99,7 +99,7 @@ typedef struct { /* Selection information container */ typedef struct { H5S_sel_type type; /* Type of selection (list of points or hyperslabs) */ - hsize_t *offset; /* Offset within the extent (NULL means a 0 offset) */ + hssize_t *offset; /* Offset within the extent (NULL means a 0 offset) */ hsize_t *order; /* Selection order. (NULL means a specific ordering of points) */ hsize_t num_elem; /* Number of elements in selection */ union { @@ -227,6 +227,7 @@ hsize_t H5S_select_npoints (const H5S_t *space); intn H5S_extend (H5S_t *space, const hsize_t *size); herr_t H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, const hsize_t *max); +hbool_t H5S_select_valid (const H5S_t *space); herr_t H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, intn indent, intn fwidth); @@ -288,6 +289,7 @@ herr_t H5S_point_add (H5S_t *space, size_t num_elemn, const hssize_t **coord); herr_t H5S_point_release (H5S_t *space); hsize_t H5S_point_npoints (const H5S_t *space); herr_t H5S_point_copy (H5S_t *dst, const H5S_t *src); +hbool_t H5S_point_select_valid (const H5S_t *space); /* "All" select functions */ herr_t H5S_all_init (const struct H5O_layout_t *layout, @@ -341,5 +343,6 @@ hsize_t H5S_hyper_npoints (const H5S_t *space); int H5S_hyper_compare_regions (const void *r1, const void *r2); int H5S_hyper_compare_bounds (const void *r1, const void *r2); herr_t H5S_hyper_copy (H5S_t *dst, const H5S_t *src); +hbool_t H5S_hyper_select_valid (const H5S_t *space); #endif diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 881e692..9dca348 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -66,6 +66,8 @@ herr_t H5Sset_extent_none (hid_t space_id); herr_t H5Sextent_copy (hid_t dst_id,hid_t src_id); herr_t H5Sselect_all (hid_t spaceid); herr_t H5Sselect_none (hid_t spaceid); +herr_t H5Soffset_simple (hid_t space_id, const hssize_t *offset); +hbool_t H5Sselect_valid (hid_t spaceid); #ifdef __cplusplus } diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 7f7650b..2188470 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -104,7 +104,14 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src) /* Copy regular fields */ dst->select=src->select; -/* Need to copy offset and order information still */ +/* Need to copy order information still */ + + /* Copy offset information */ + if (NULL==(dst->select.offset = H5MM_calloc(src->extent.u.simple.rank*sizeof(hssize_t)))) { + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + } + if(src->select.offset!=NULL) + HDmemcpy(dst->select.offset,src->select.offset,(src->extent.u.simple.rank*sizeof(hssize_t))); /* Perform correct type of copy based on the type of selection */ switch (src->extent.type) { @@ -631,7 +638,7 @@ H5S_select_npoints (const H5S_t *space) { herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5Sselect_npoints, FAIL); + FUNC_ENTER (H5S_select_npoints, FAIL); assert(space); @@ -701,3 +708,90 @@ H5S_sel_iter_release (const H5S_t *space, H5S_sel_iter_t *sel_iter) FUNC_LEAVE (ret_value); } /* H5S_sel_iter_release() */ + +/*-------------------------------------------------------------------------- + NAME + H5Sselect_valid + PURPOSE + Check whether the selection fits within the extent, with the current + offset defined. + USAGE + hbool_t H5Sselect_void(dsid) + hid_t dsid; IN: Dataspace ID to query + RETURNS + TRUE if the selection fits within the extent, FALSE if it does not and + FAIL on an error. + DESCRIPTION + Determines if the current selection at the current offet fits within the + extent for the dataspace. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hbool_t +H5Sselect_valid (hid_t spaceid) +{ + H5S_t *space = NULL; /* Dataspace to modify selection of */ + hbool_t ret_value=FAIL; /* return value */ + + FUNC_ENTER (H5Sselect_valid, 0); + H5TRACE1("b","i",spaceid); + + /* Check args */ + if (H5_DATASPACE != H5I_group(spaceid) || + NULL == (space=H5I_object(spaceid))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data space"); + } + + ret_value = H5S_select_valid(space); + + FUNC_LEAVE (ret_value); +} /* H5Sselect_valid() */ + +/*-------------------------------------------------------------------------- + NAME + H5S_select_valid + PURPOSE + Check whether the selection fits within the extent, with the current + offset defined. + USAGE + hbool_t H5Sselect_void(space) + H5S_t *space; IN: Dataspace pointer to query + RETURNS + TRUE if the selection fits within the extent, FALSE if it does not and + FAIL on an error. + DESCRIPTION + Determines if the current selection at the current offet fits within the + extent for the dataspace. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hbool_t +H5S_select_valid (const H5S_t *space) +{ + hbool_t ret_value=FAIL; /* return value */ + + FUNC_ENTER (H5S_select_valid, FAIL); + + assert(space); + + switch(space->select.type) { + case H5S_SEL_POINTS: /* Sequence of points selected */ + ret_value=H5S_point_select_valid(space); + break; + + case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */ + ret_value=H5S_hyper_select_valid(space); + break; + + case H5S_SEL_ALL: /* Entire extent selected */ + case H5S_SEL_NONE: /* Nothing selected */ + ret_value=TRUE; + break; + } /* end switch */ + + FUNC_LEAVE (ret_value); +} /* H5S_select_valid() */ diff --git a/test/.distdep b/test/.distdep index 502e178..82aaa44 100644 --- a/test/.distdep +++ b/test/.distdep @@ -1,3 +1,34 @@ +testhdf5.o: \ + testhdf5.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h +tattr.o: \ + tattr.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ + ../src/hdf5.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h tfile.o: \ tfile.c \ testhdf5.h \ @@ -11,8 +42,7 @@ tfile.o: \ ../src/H5Bpublic.h \ ../src/H5Fprivate.h \ ../src/H5Fpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Pprivate.h + ../src/H5Dpublic.h theap.o: \ theap.c \ testhdf5.h \ @@ -29,8 +59,7 @@ theap.o: \ ../src/H5Fpublic.h \ ../src/H5Dpublic.h \ ../src/H5Pprivate.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h + ../src/H5Ppublic.h tmeta.o: \ tmeta.c \ testhdf5.h \ @@ -39,7 +68,9 @@ tmeta.o: \ ../src/H5config.h \ ../src/H5Eprivate.h \ ../src/H5Epublic.h \ - ../src/H5Ipublic.h + ../src/H5Ipublic.h \ + ../src/H5Fprivate.h \ + ../src/H5Fpublic.h tohdr.o: \ tohdr.c \ testhdf5.h \ @@ -68,8 +99,30 @@ tohdr.o: \ ../src/H5HGpublic.h \ ../src/H5Tprivate.h \ ../src/H5Tpublic.h \ - ../src/H5Sprivate.h \ - ../src/H5Spublic.h + ../src/H5Sprivate.h +tselect.o: \ + tselect.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ + ../src/hdf5.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h tstab.o: \ tstab.c \ testhdf5.h \ @@ -98,13 +151,67 @@ tstab.o: \ ../src/H5HGpublic.h \ ../src/H5Tprivate.h \ ../src/H5Tpublic.h \ + ../src/H5Sprivate.h +th5s.o: \ + th5s.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ + ../src/H5Bprivate.h \ + ../src/H5Bpublic.h \ + ../src/H5Fprivate.h \ + ../src/H5Fpublic.h \ + ../src/H5Dpublic.h \ ../src/H5Sprivate.h \ - ../src/H5Spublic.h + ../src/H5Spublic.h \ + ../src/H5Gprivate.h \ + ../src/H5Gpublic.h \ + ../src/H5Oprivate.h \ + ../src/H5Opublic.h \ + ../src/H5HGprivate.h \ + ../src/H5HGpublic.h \ + ../src/H5Tprivate.h \ + ../src/H5Tpublic.h \ + ../src/H5Zprivate.h \ + ../src/H5Zpublic.h +dtypes.o: \ + dtypes.c \ + ../src/hdf5.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Ipublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h \ + ../src/H5Tpkg.h \ + ../src/H5HGprivate.h \ + ../src/H5Fprivate.h \ + ../src/H5private.h \ + ../src/H5Tprivate.h hyperslab.o: \ hyperslab.c \ ../src/H5private.h \ ../src/H5public.h \ - ../src/H5config.h + ../src/H5config.h \ + ../src/H5MMprivate.h \ + ../src/H5MMpublic.h istore.o: \ istore.c \ ../src/H5private.h \ @@ -130,9 +237,11 @@ istore.o: \ ../src/H5HGpublic.h \ ../src/H5Tprivate.h \ ../src/H5Tpublic.h \ - ../src/H5Sprivate.h -extend.o: \ - extend.c \ + ../src/H5Sprivate.h \ + ../src/H5Spublic.h \ + ../src/H5Zprivate.h +dsets.o: \ + dsets.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -151,9 +260,10 @@ extend.o: \ ../src/H5Opublic.h \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ - ../src/H5Spublic.h -external.o: \ - external.c \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h +cmpd_dset.o: \ + cmpd_dset.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -172,27 +282,9 @@ external.o: \ ../src/H5Opublic.h \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h -gheap.o: \ - gheap.c \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ - ../src/H5Ipublic.h \ - ../src/H5Fprivate.h \ - ../src/H5Fpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Gprivate.h \ - ../src/H5Gpublic.h \ - ../src/H5Bprivate.h \ - ../src/H5Bpublic.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h -shtype.o: \ - shtype.c \ + ../src/H5Spublic.h +extend.o: \ + extend.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -212,8 +304,8 @@ shtype.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h -links.o: \ - links.c \ +external.o: \ + external.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -234,8 +326,8 @@ links.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -chunk.o: \ - chunk.c \ +iopipe.o: \ + iopipe.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -256,25 +348,27 @@ chunk.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -bittests.o: \ - bittests.c \ - ../src/H5Tpkg.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h \ +gheap.o: \ + gheap.c \ + ../src/H5private.h \ ../src/H5public.h \ ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ ../src/H5Fprivate.h \ ../src/H5Fpublic.h \ - ../src/H5Ipublic.h \ - ../src/H5private.h \ ../src/H5Dpublic.h \ - ../src/H5Tprivate.h \ - ../src/H5Tpublic.h \ ../src/H5Gprivate.h \ ../src/H5Gpublic.h \ - ../src/H5Bprivate.h -big.o: \ - big.c \ + ../src/H5Bprivate.h \ + ../src/H5Bpublic.h \ + ../src/H5HGprivate.h \ + ../src/H5HGpublic.h \ + ../src/H5Pprivate.h \ + ../src/H5Ppublic.h +shtype.o: \ + shtype.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -293,17 +387,9 @@ big.o: \ ../src/H5Opublic.h \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h \ - ../src/H5private.h -testhdf5.o: \ - testhdf5.c \ - testhdf5.h \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h -dsets.o: \ - dsets.c \ + ../src/H5Spublic.h +big.o: \ + big.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -323,9 +409,10 @@ dsets.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ - ../src/H5Tpublic.h -dtypes.o: \ - dtypes.c \ + ../src/H5Tpublic.h \ + ../src/H5private.h +links.o: \ + links.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -345,54 +432,18 @@ dtypes.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ - ../src/H5Tpublic.h \ - ../src/H5Tpkg.h \ - ../src/H5HGprivate.h \ - ../src/H5Fprivate.h \ - ../src/H5private.h \ - ../src/H5Tprivate.h \ - ../src/H5Gprivate.h -th5s.o: \ - th5s.c \ - testhdf5.h \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ - ../src/H5Ipublic.h \ - ../src/H5Bprivate.h \ - ../src/H5Bpublic.h \ - ../src/H5Fprivate.h \ - ../src/H5Fpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Sprivate.h \ - ../src/H5Spublic.h \ - ../src/H5Gprivate.h \ - ../src/H5Gpublic.h \ - ../src/H5Oprivate.h \ - ../src/H5Opublic.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h \ - ../src/H5Tprivate.h \ - ../src/H5Tpublic.h \ - ../src/H5Zprivate.h \ - ../src/H5Zpublic.h \ - ../src/H5Pprivate.h -tattr.o: \ - tattr.c \ - testhdf5.h \ - ../src/H5private.h \ + ../src/H5Tpublic.h +chunk.o: \ + chunk.c \ + ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ ../src/H5Ipublic.h \ - ../src/hdf5.h \ ../src/H5Apublic.h \ ../src/H5ACpublic.h \ ../src/H5Bpublic.h \ ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ ../src/H5Fpublic.h \ ../src/H5Gpublic.h \ ../src/H5HGpublic.h \ @@ -402,53 +453,26 @@ tattr.o: \ ../src/H5Opublic.h \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ - ../src/H5Spublic.h -tselect.o: \ - tselect.c \ - testhdf5.h \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ - ../src/H5Ipublic.h \ - ../src/hdf5.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h +bittests.o: \ + bittests.c \ + ../src/H5Tpkg.h \ + ../src/H5HGprivate.h \ ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h -cmpd_dset.o: \ - cmpd_dset.c \ - ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ + ../src/H5Fprivate.h \ + ../src/H5Fpublic.h \ ../src/H5Ipublic.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ + ../src/H5private.h \ ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h -iopipe.o: \ - iopipe.c \ + ../src/H5Tprivate.h \ + ../src/H5Tpublic.h \ + ../src/H5Gprivate.h \ + ../src/H5Gpublic.h +mtime.o: \ + mtime.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ diff --git a/test/tselect.c b/test/tselect.c index 29fff74..c19bfdd 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -49,12 +49,6 @@ static char RcsId[] = "$Revision$"; #define SPACE3_DIM1 15 #define SPACE3_DIM2 26 -/* 2-D dataset with fixed dimensions */ -#define SPACE4_NAME "Space4" -#define SPACE4_RANK 2 -#define SPACE4_DIM1 15 -#define SPACE4_DIM2 26 - /* Element selection information */ #define POINT1_NPOINTS 10 @@ -1090,6 +1084,338 @@ test_select_point_copy(void) /**************************************************************** ** +** test_select_hyper_offset(): Test basic H5S (dataspace) selection code. +** Tests hyperslabs of various sizes and dimensionalities with selection +** offsets. +** +****************************************************************/ +static void +test_select_hyper_offset(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hssize_t offset[SPACE1_RANK]; /* Offset of selection */ + uint8 *wbuf, /* buffer to write to disk */ + *rbuf, /* buffer read from disk */ + *tbuf, /* temporary buffer pointer */ + *tbuf2; /* temporary buffer pointer */ + intn i,j; /* Counters */ + herr_t ret; /* Generic return value */ + hbool_t valid; /* Generic boolean return value */ + H5S_class_t ext_type; /* Extent type */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Hyperslab Selection Functions with Offsets\n")); + + /* Allocate write & read buffers */ + wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2); + + /* Initialize write buffer */ + for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) + for(j=0; j<SPACE2_DIM2; j++) + *tbuf++=(uint8)((i*SPACE2_DIM2)+j); + + /* Create file */ + fid1 = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Create dataspace for dataset */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + + /* Create dataspace for writing buffer */ + sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); + CHECK(sid2, FAIL, "H5Screate_simple"); + + /* Verify extent type */ + ext_type = H5Sextent_class(sid1); + VERIFY(ext_type, H5S_SIMPLE, "H5Sextent_class"); + + /* Select 2x15x13 hyperslab for disk dataset */ + start[0]=1; start[1]=0; start[2]=0; + stride[0]=1; stride[1]=1; stride[2]=1; + count[0]=2; count[1]=15; count[2]=13; + block[0]=1; block[1]=1; block[2]=1; + ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Check a valid offset */ + offset[0]=-1; offset[1]=0; offset[2]=0; + ret = H5Soffset_simple(sid1,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid1); + VERIFY(valid, TRUE, "H5Svalid_offset"); + + /* Check an invalid offset */ + offset[0]=10; offset[1]=0; offset[2]=0; + ret = H5Soffset_simple(sid1,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid1); + VERIFY(valid, FALSE, "H5Svalid_offset"); + + /* Reset offset */ + offset[0]=0; offset[1]=0; offset[2]=0; + ret = H5Soffset_simple(sid1,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid1); + VERIFY(valid, TRUE, "H5Svalid_offset"); + + /* Select 15x26 hyperslab for memory dataset */ + start[0]=15; start[1]=0; + stride[0]=1; stride[1]=1; + count[0]=15; count[1]=26; + block[0]=1; block[1]=1; + ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Choose a valid offset for the memory dataspace */ + offset[0]=-10; offset[1]=0; + ret = H5Soffset_simple(sid2,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid2); + VERIFY(valid, TRUE, "H5Svalid_offset"); + + /* Create a dataset */ + dataset=H5Dcreate(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT); + + /* Write selection to disk */ + ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close memory dataspace */ + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + + /* Create dataspace for reading buffer */ + sid2 = H5Screate_simple(SPACE3_RANK, dims3, NULL); + CHECK(sid2, FAIL, "H5Screate_simple"); + + /* Select 15x26 hyperslab for reading memory dataset */ + start[0]=0; start[1]=0; + stride[0]=1; stride[1]=1; + count[0]=15; count[1]=26; + block[0]=1; block[1]=1; + ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Read selection from disk */ + ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf); + CHECK(ret, FAIL, "H5Dread"); + + /* Compare data read with data written out */ + for(i=0; i<SPACE3_DIM1; i++) { + tbuf=wbuf+((i+5)*SPACE2_DIM2); + tbuf2=rbuf+(i*SPACE3_DIM2); + for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) { + if(*tbuf!=*tbuf2) { + printf("hyperslab values don't match!, i=%d, j=%d\n",i,j); + } /* end if */ + } /* end for */ + } /* end for */ + + /* Close memory dataspace */ + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Free memory buffers */ + free(wbuf); + free(rbuf); +} /* test_select_hyper_offset() */ + +/**************************************************************** +** +** test_select_point_offset(): Test basic H5S (dataspace) selection code. +** Tests element selections between dataspaces of various sizes +** and dimensionalities with selection offsets. +** +****************************************************************/ +static void +test_select_point_offset(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hssize_t offset[SPACE1_RANK]; /* Offset of selection */ + uint8 *wbuf, /* buffer to write to disk */ + *rbuf, /* buffer read from disk */ + *tbuf, /* temporary buffer pointer */ + *tbuf2; /* temporary buffer pointer */ + intn i,j; /* Counters */ + herr_t ret; /* Generic return value */ + hbool_t valid; /* Generic boolean return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Element Selection Functions\n")); + + /* Allocate write & read buffers */ + wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2); + + /* Initialize write buffer */ + for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) + for(j=0; j<SPACE2_DIM2; j++) + *tbuf++=(uint8)((i*SPACE2_DIM2)+j); + + /* Create file */ + fid1 = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Create dataspace for dataset */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + + /* Create dataspace for write buffer */ + sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); + CHECK(sid2, FAIL, "H5Screate_simple"); + + /* Select sequence of ten points for disk dataset */ + coord1[0][0]=0; coord1[0][1]=10; coord1[0][2]= 5; + coord1[1][0]=1; coord1[1][1]= 2; coord1[1][2]= 7; + coord1[2][0]=2; coord1[2][1]= 4; coord1[2][2]= 9; + coord1[3][0]=0; coord1[3][1]= 6; coord1[3][2]=11; + coord1[4][0]=1; coord1[4][1]= 8; coord1[4][2]=12; + coord1[5][0]=2; coord1[5][1]=12; coord1[5][2]= 0; + coord1[6][0]=0; coord1[6][1]=14; coord1[6][2]= 2; + coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; + coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; + coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; + ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Check a valid offset */ + offset[0]=0; offset[1]=0; offset[2]=1; + ret = H5Soffset_simple(sid1,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid1); + VERIFY(valid, TRUE, "H5Svalid_offset"); + + /* Check an invalid offset */ + offset[0]=10; offset[1]=0; offset[2]=0; + ret = H5Soffset_simple(sid1,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid1); + VERIFY(valid, FALSE, "H5Svalid_offset"); + + /* Reset offset */ + offset[0]=0; offset[1]=0; offset[2]=0; + ret = H5Soffset_simple(sid1,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid1); + VERIFY(valid, TRUE, "H5Svalid_offset"); + + /* Select sequence of ten points for write dataset */ + coord2[0][0]=12; coord2[0][1]= 3; + coord2[1][0]=15; coord2[1][1]=13; + coord2[2][0]= 7; coord2[2][1]=24; + coord2[3][0]= 0; coord2[3][1]= 6; + coord2[4][0]=13; coord2[4][1]= 0; + coord2[5][0]=24; coord2[5][1]=11; + coord2[6][0]=12; coord2[6][1]=21; + coord2[7][0]=23; coord2[7][1]= 4; + coord2[8][0]= 8; coord2[8][1]= 8; + coord2[9][0]=19; coord2[9][1]=17; + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Choose a valid offset for the memory dataspace */ + offset[0]=5; offset[1]=1; + ret = H5Soffset_simple(sid2,offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + valid = H5Sselect_valid(sid2); + VERIFY(valid, TRUE, "H5Svalid_offset"); + + /* Create a dataset */ + dataset=H5Dcreate(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT); + + /* Write selection to disk */ + ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf); + CHECK(ret, FAIL, "H5Dwrite"); + + /* Close memory dataspace */ + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + + /* Create dataspace for reading buffer */ + sid2 = H5Screate_simple(SPACE3_RANK, dims3, NULL); + CHECK(sid2, FAIL, "H5Screate_simple"); + + /* Select sequence of points for read dataset */ + coord3[0][0]= 0; coord3[0][1]= 2; + coord3[1][0]= 4; coord3[1][1]= 8; + coord3[2][0]=13; coord3[2][1]=13; + coord3[3][0]=14; coord3[3][1]=25; + coord3[4][0]= 7; coord3[4][1]= 9; + coord3[5][0]= 2; coord3[5][1]= 0; + coord3[6][0]= 9; coord3[6][1]=19; + coord3[7][0]= 1; coord3[7][1]=22; + coord3[8][0]=12; coord3[8][1]=21; + coord3[9][0]=11; coord3[9][1]= 6; + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Read selection from disk */ + ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf); + CHECK(ret, FAIL, "H5Dread"); + + /* Compare data read with data written out */ + for(i=0; i<POINT1_NPOINTS; i++) { + tbuf=wbuf+((coord2[i][0]+offset[0])*SPACE2_DIM2)+coord2[i][1]+offset[1]; + tbuf2=rbuf+(coord3[i][0]*SPACE3_DIM2)+coord3[i][1]; + if(*tbuf!=*tbuf2) { + printf("element values don't match!, i=%d\n",i); + } /* end if */ + } /* end for */ + + /* Close memory dataspace */ + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /* Free memory buffers */ + free(wbuf); + free(rbuf); +} /* test_select_point() */ + +/**************************************************************** +** ** test_select(): Main H5S selection testing routine. ** ****************************************************************/ @@ -1107,6 +1433,8 @@ test_select(void) test_select_hyper_stride(); /* Test strided hyperslab selection code */ test_select_hyper_copy(); /* Test hyperslab selection copying code */ test_select_point_copy(); /* Test point selection copying code */ + test_select_hyper_offset(); /* Test selection offset code with hyperslabs */ + test_select_point_offset(); /* Test selection offset code with elements */ } /* test_select() */ |