public void H5DfillTest1() { hsize_t[] dims = { 10 }; hid_t space = H5S.create_simple(1, dims, null); Assert.IsTrue(H5S.select_all(space) >= 0); double[] v = new double[10]; double fill = 1.0; GCHandle v_hnd = GCHandle.Alloc(v, GCHandleType.Pinned); GCHandle fill_hnd = GCHandle.Alloc(fill, GCHandleType.Pinned); Assert.IsTrue( H5D.fill(fill_hnd.AddrOfPinnedObject(), H5T.NATIVE_DOUBLE, v_hnd.AddrOfPinnedObject(), H5T.NATIVE_DOUBLE, space) >= 0); fill_hnd.Free(); v_hnd.Free(); for (int i = 0; i < v.Length; ++i) { Assert.IsTrue(v[i] == 1.0); } Assert.IsTrue(H5S.close(space) >= 0); }
public void H5DfillTest2() { hsize_t[] dims = { 5 }; hid_t space = H5S.create_simple(1, dims, null); Assert.IsTrue(H5S.select_all(space) >= 0); double[] v = new double[5] { 0.0, 1.0, 2.0, 3.0, 4.0 }; GCHandle v_hnd = GCHandle.Alloc(v, GCHandleType.Pinned); Assert.IsTrue( H5D.fill(IntPtr.Zero, H5T.NATIVE_DOUBLE, v_hnd.AddrOfPinnedObject(), H5T.NATIVE_DOUBLE, space) >= 0); v_hnd.Free(); for (int i = 0; i < v.Length; ++i) { Assert.IsTrue(v[i] == 0.0); } Assert.IsTrue(H5S.close(space) >= 0); }