public void H5Aget_create_plistTest1() { hid_t att = H5A.create(m_v2_test_file, "A", H5T.IEEE_F64LE, m_space_scalar); Assert.IsTrue(att >= 0); hid_t acpl = H5A.get_create_plist(att); Assert.IsTrue(acpl >= 0); Assert.IsTrue(H5P.close(acpl) >= 0); Assert.IsTrue(H5A.close(att) >= 0); att = H5A.create(m_v0_test_file, "A", H5T.IEEE_F64LE, m_space_scalar); Assert.IsTrue(att >= 0); acpl = H5A.get_create_plist(att); Assert.IsTrue(acpl >= 0); Assert.IsTrue(H5P.close(acpl) >= 0); Assert.IsTrue(H5A.close(att) >= 0); }
public static Array ReadPrimitiveAttributes <T>(hid_t groupId, string name) //where T : struct { Type type = typeof(T); var datatype = GetDatatype(type); var attributeId = H5A.open(groupId, name); var spaceId = H5A.get_space(attributeId); int rank = H5S.get_simple_extent_ndims(spaceId); ulong[] maxDims = new ulong[rank]; ulong[] dims = new ulong[rank]; hid_t memId = H5S.get_simple_extent_dims(spaceId, dims, maxDims); long[] lengths = dims.Select(d => Convert.ToInt64(d)).ToArray(); Array attributes = Array.CreateInstance(type, lengths); var typeId = H5A.get_type(attributeId); var mem_type = H5T.copy(datatype); if (datatype == H5T.C_S1) { H5T.set_size(datatype, new IntPtr(2)); } var propId = H5A.get_create_plist(attributeId); memId = H5S.create_simple(rank, dims, maxDims); GCHandle hnd = GCHandle.Alloc(attributes, GCHandleType.Pinned); H5A.read(attributeId, datatype, hnd.AddrOfPinnedObject()); hnd.Free(); H5A.close(typeId); H5A.close(attributeId); H5S.close(spaceId); return(attributes); }
public void H5Aget_create_plistTest2() { Assert.IsFalse( H5A.get_create_plist(Utilities.RandomInvalidHandle()) >= 0); }