private bool setOMXFileIndexMaps() { this.luGroup = H5G.create(fileId, luGroupName); this.NumIndexMap = 0; this.IndexMapNames = new List <string>(); return(true); }
public void H5Rget_obj_typeTest2() { byte[] path = Encoding.UTF8.GetBytes(String.Join("/", m_utf8strings)); // make room for the trailling \0 byte[] name = new byte[path.Length + 1]; Array.Copy(path, name, path.Length); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, path, m_lcpl_utf8)) >= 0); byte[] refer = new byte[H5R.OBJ_REF_BUF_SIZE]; GCHandle hnd = GCHandle.Alloc(refer, GCHandleType.Pinned); Assert.IsTrue( H5R.create(hnd.AddrOfPinnedObject(), m_v2_test_file, name, H5R.type_t.OBJECT, -1) >= 0); H5O.type_t obj_type = H5O.type_t.UNKNOWN; Assert.IsTrue( H5R.get_obj_type(m_v2_test_file, H5R.type_t.OBJECT, hnd.AddrOfPinnedObject(), ref obj_type) >= 0); hnd.Free(); Assert.IsTrue(obj_type == H5O.type_t.GROUP); }
public void H5Oget_info_by_idxTest1() { Assert.IsTrue( H5G.close(H5G.create(m_v0_test_file, "A")) >= 0); Assert.IsTrue( H5G.close(H5G.create(m_v0_test_file, "AA")) >= 0); Assert.IsTrue( H5G.close(H5G.create(m_v0_test_file, "AAA")) >= 0); Assert.IsTrue( H5G.close(H5G.create(m_v0_test_file, "AAAA")) >= 0); H5O.info_t info = new H5O.info_t(); Assert.IsTrue(H5O.get_info_by_idx(m_v0_test_file, ".", H5.index_t.NAME, H5.iter_order_t.NATIVE, 2, ref info) >= 0); Assert.IsTrue(info.type == H5O.type_t.GROUP); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, "A")) >= 0); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, "AA")) >= 0); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, "AAA")) >= 0); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, "AAAA")) >= 0); info = new H5O.info_t(); Assert.IsTrue(H5O.get_info_by_idx(m_v2_test_file, ".", H5.index_t.NAME, H5.iter_order_t.NATIVE, 2, ref info) >= 0); Assert.IsTrue(info.type == H5O.type_t.GROUP); }
public void H5LmoveTest1() { Assert.IsTrue( H5G.close(H5G.create(m_v0_test_file, "A/B/C/D", m_lcpl)) >= 0); Assert.IsTrue( H5L.create_hard(m_v0_test_file, "A/B/C/D", m_v0_test_file, "shortcut") >= 0); Assert.IsTrue( H5L.move(m_v0_test_file, "shortcut", m_v0_test_file, "A/B/C/D/E") >= 0); Assert.IsTrue( H5L.exists(m_v0_test_file, "A/B/C/D/E") > 0); Assert.IsTrue( H5L.exists(m_v0_test_file, "A/B/C/D/shortcut") == 0); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, "A/B/C/D", m_lcpl)) >= 0); Assert.IsTrue( H5L.create_hard(m_v2_test_file, "A/B/C/D", m_v2_test_file, "shortcut") >= 0); Assert.IsTrue( H5L.move(m_v2_test_file, "shortcut", m_v2_test_file, "A/B/C/D/E") >= 0); Assert.IsTrue( H5L.exists(m_v0_test_file, "A/B/C/D/E") > 0); Assert.IsTrue( H5L.exists(m_v0_test_file, "A/B/C/D/shortcut") == 0); }
public void H5OvisitTest2() { string path = String.Join("/", m_utf8strings); Assert.IsTrue(H5G.create(m_v0_test_file, Encoding.UTF8.GetBytes(path), m_lcpl_utf8) >= 0); Assert.IsTrue(H5G.create(m_v2_test_file, Encoding.UTF8.GetBytes(path), m_lcpl_utf8) >= 0); ArrayList al = new ArrayList(); GCHandle hnd = GCHandle.Alloc(al); IntPtr op_data = (IntPtr)hnd; // the callback is defined in H5LTest.cs H5O.iterate_t cb = DelegateMethod; Assert.IsTrue(H5O.visit(m_v0_test_file, H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 6 elements in the array list Assert.IsTrue(al.Count == 6); Assert.IsTrue(H5O.visit(m_v2_test_file, H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 12 (6 + 6) elements in the array list Assert.IsTrue(al.Count == 12); hnd.Free(); }
public void H5Iget_nameTest1() { hid_t gid = H5G.create(m_v0_test_file, "AAAAAAAAAAAAAAAAAAAAA"); Assert.IsTrue(gid > 0); ssize_t buf_size = H5I.get_name(gid, (StringBuilder)null, IntPtr.Zero) + 1; Assert.IsTrue(buf_size.ToInt32() > 1); StringBuilder nameBuilder = new StringBuilder(buf_size.ToInt32()); IntPtr size = H5I.get_name(gid, nameBuilder, buf_size); Assert.IsTrue(size.ToInt32() > 0); Assert.IsTrue(nameBuilder.ToString() == "/AAAAAAAAAAAAAAAAAAAAA"); Assert.IsTrue(H5G.close(gid) >= 0); gid = H5G.create(m_v2_test_file, "AAAAAAAAAAAAAAAAAAAAA"); Assert.IsTrue(gid > 0); buf_size = H5I.get_name(gid, (StringBuilder)null, IntPtr.Zero) + 1; Assert.IsTrue(buf_size.ToInt32() > 1); nameBuilder = new StringBuilder(buf_size.ToInt32()); size = H5I.get_name(gid, nameBuilder, buf_size); Assert.IsTrue(size.ToInt32() > 0); Assert.IsTrue(nameBuilder.ToString() == "/AAAAAAAAAAAAAAAAAAAAA"); Assert.IsTrue(H5G.close(gid) >= 0); }
protected override void WriteEpochGroupStart(string label, string source, string[] keywords, IDictionary <string, object> properties, Guid identifier, DateTimeOffset startTime, double timeZoneOffset) { H5FileOrGroupId parent = CurrentEpochGroupID == null ? (H5FileOrGroupId)fileId : CurrentEpochGroupID.SubGroupsId; var epochGroup = H5G.create((H5LocId)parent, label + "-" + identifier); var subGroups = H5G.create((H5LocId)epochGroup, "epochGroups"); var epochs = H5G.create((H5LocId)epochGroup, "epochs"); WriteAttribute(epochGroup, "label", label); WriteAttribute(epochGroup, "source", string.IsNullOrEmpty(source) ? "<none>" : source); WriteDictionary(epochGroup, "properties", properties); WriteAttribute(epochGroup, "symphony.uuid", identifier.ToString()); WriteKeywords(epochGroup, new HashSet <string>(keywords)); WriteAttribute(epochGroup, startTimeUtcName, startTime.Ticks); WriteAttribute(epochGroup, startTimeOffsetName, timeZoneOffset); //H5G.close(subGroups); //H5G.close(epochs); EpochGroupsIDs.Push(new EpochGroupIDs(epochGroup, subGroups, epochs)); }
public static unsafe void AddSomeLinks(long fileId) { long res; var groupId = H5G.create(fileId, "simple"); var groupId_sub = H5G.create(groupId, "sub"); // datasets var dataspaceId1 = H5S.create_simple(1, new ulong[] { 1 }, new ulong[] { 1 }); var datasetId1 = H5D.create(fileId, "D", H5T.NATIVE_INT8, dataspaceId1); var data1 = new byte[] { 1 }; fixed(void *ptr = data1) { res = H5D.write(datasetId1, H5T.NATIVE_INT8, dataspaceId1, dataspaceId1, 0, new IntPtr(ptr)); } res = H5D.close(datasetId1); res = H5S.close(dataspaceId1); var dataspaceId2 = H5S.create_simple(1, new ulong[] { 1 }, new ulong[] { 1 }); var datasetId2 = H5D.create(groupId, "D1", H5T.NATIVE_INT8, dataspaceId2); res = H5D.close(datasetId2); res = H5S.close(dataspaceId2); var dataspaceId3 = H5S.create_simple(1, new ulong[] { 1 }, new ulong[] { 1 }); var datasetId3 = H5D.create(groupId_sub, "D1.1", H5T.NATIVE_INT8, dataspaceId3); res = H5D.close(datasetId3); res = H5S.close(dataspaceId3); res = H5G.close(groupId); res = H5G.close(groupId_sub); }
public void H5LdeleteTest1() { Assert.IsTrue( H5G.close(H5G.create(m_v0_test_file, "A/B/C/D", m_lcpl)) >= 0); Assert.IsTrue( H5L.create_hard(m_v0_test_file, Encoding.ASCII.GetBytes("A/B/C/D"), m_v0_test_file, Encoding.ASCII.GetBytes("shortcut")) >= 0); hid_t group = H5G.open(m_v0_test_file, "A/B/C"); Assert.IsTrue(group >= 0); Assert.IsTrue(H5L.delete(group, "D") >= 0); Assert.IsTrue(H5G.close(group) >= 0); Assert.IsTrue(H5L.exists(m_v0_test_file, "shortcut") > 0); Assert.IsTrue(H5L.exists(m_v0_test_file, "A/B/C/D") == 0); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, "A/B/C/D", m_lcpl)) >= 0); Assert.IsTrue( H5L.create_hard(m_v2_test_file, Encoding.ASCII.GetBytes("A/B/C/D"), m_v2_test_file, Encoding.ASCII.GetBytes("shortcut")) >= 0); group = H5G.open(m_v2_test_file, "A/B/C"); Assert.IsTrue(group >= 0); Assert.IsTrue(H5L.delete(group, "D") >= 0); Assert.IsTrue(H5G.close(group) >= 0); Assert.IsTrue(H5L.exists(m_v0_test_file, "shortcut") > 0); Assert.IsTrue(H5L.exists(m_v0_test_file, "A/B/C/D") == 0); }
public void H5OvisitTest1() { Assert.IsTrue(H5G.create(m_v0_test_file, "A/B/C/D", m_lcpl) >= 0); Assert.IsTrue( H5L.create_hard(m_v0_test_file, "A/B/C/D", m_v0_test_file, "shortcut") >= 0); Assert.IsTrue(H5G.create(m_v2_test_file, "A/B/C/D", m_lcpl) >= 0); Assert.IsTrue( H5L.create_hard(m_v2_test_file, "A/B/C/D", m_v2_test_file, "shortcut") >= 0); ArrayList al = new ArrayList(); GCHandle hnd = GCHandle.Alloc(al); IntPtr op_data = (IntPtr)hnd; // the callback is defined in H5LTest.cs H5O.iterate_t cb = DelegateMethod; Assert.IsTrue(H5O.visit(m_v0_test_file, H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 5 elements in the array list Assert.IsTrue(al.Count == 5); Assert.IsTrue(H5O.visit(m_v2_test_file, H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 10 (5 + 5) elements in the array list Assert.IsTrue(al.Count == 10); hnd.Free(); }
public void H5GcreateTest2() { hid_t file = Utilities.RandomInvalidHandle(); hid_t gid = H5G.create(file, "A"); Assert.IsTrue(gid < 0); }
private bool setOMXFileMatrixTables() { this.dataGroup = H5G.create(fileId, dataGroupName); this.NumMatrix = 0; this.MatrixNames = new List <string>(); return(true); }
public void H5Oexists_by_nameTest1() { Assert.IsTrue(H5L.create_soft("/oh my", m_v0_test_file, "AA") >= 0); hid_t gid = H5G.create(m_v0_test_file, "A/B/C", m_lcpl); Assert.IsTrue(gid >= 0); Assert.IsTrue(H5O.exists_by_name(m_v0_test_file, "A/B") > 0); Assert.IsTrue(H5O.exists_by_name(m_v0_test_file, "AA") == 0); Assert.IsTrue( H5O.exists_by_name(m_v0_test_file, "A/B/Caesar") < 0); Assert.IsTrue(H5G.close(gid) >= 0); Assert.IsTrue(H5L.create_soft("/oh my", m_v2_test_file, "AA") >= 0); gid = H5G.create(m_v2_test_file, "A/B/C", m_lcpl); Assert.IsTrue(gid >= 0); Assert.IsTrue(H5O.exists_by_name(m_v2_test_file, "A/B") > 0); Assert.IsTrue(H5O.exists_by_name(m_v2_test_file, "AA") == 0); Assert.IsTrue( H5O.exists_by_name(m_v2_test_file, "A/B/Caesar") < 0); Assert.IsTrue(H5G.close(gid) >= 0); }
private static void WriteFile(string filePath) { var file = H5F.create(filePath, H5F.CreateMode.ACC_TRUNC); var group = H5G.create(file, "/group"); H5G.close(group); const int RANK = 2; const int DIM0 = 3; const int DIM1 = 4; var dims = new long[RANK] { DIM0, DIM1 }; var dataSpace = H5S.create_simple(RANK, dims); var dataSet = H5D.create(file, "/group/dataset", H5T.H5Type.NATIVE_INT, dataSpace); H5S.close(dataSpace); var data = new int[DIM0, DIM1] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } }; H5D.write(dataSet, new H5DataTypeId(H5T.H5Type.NATIVE_INT), new H5Array <int>(data)); var dataType = new H5DataTypeId(H5T.H5Type.NATIVE_INT); dataSpace = H5S.create(H5S.H5SClass.SCALAR); var integerAttribute = H5A.create(dataSet, "int", dataType, dataSpace); H5A.write(integerAttribute, dataType, new H5Array <int>(new int[1] { 42 })); H5A.close(integerAttribute); H5S.close(dataSpace); //H5T.close(dataType); // Read-only. var str = "Hello, world!"; var strBytes = Encoding.ASCII.GetBytes(str); // There is a H5T.get_cset, but there does not seem to be a way of setting the character encoding, i.e. set_cset. dataType = H5T.copy(H5T.H5Type.C_S1); H5T.setSize(dataType, strBytes.Length); dataSpace = H5S.create(H5S.H5SClass.SCALAR); var stringAttribute = H5A.create(dataSet, "string", dataType, dataSpace); H5A.write(stringAttribute, dataType, new H5Array <byte>(strBytes)); H5A.close(stringAttribute); H5S.close(dataSpace); H5T.close(dataType); H5D.close(dataSet); H5F.close(file); }
public void CreateGroup(string name) { With(id => { var newID = H5G.create(id, name); H5G.close(newID); }); }
static void test_file_open() { try { // Output message about test being performed. Console.Write("Testing file opening I/O"); // First ensure the file does not exist File.Delete(FILE2); // Try opening a non-existent file. This should fail. try { H5FileId non_exist_file = H5F.open(FILE2, H5F.OpenMode.ACC_RDWR); // should fail, but didn't, print out the error message. Console.WriteLine("\ntest_file_open: Attempting to open a non-existent file."); nerrors++; } catch (H5FopenException) { } // does nothing, it should fail // Open the file. H5FileId fileId = H5F.open(FILE1, H5F.OpenMode.ACC_RDWR); // Create dataspace for the dataset in the file. hssize_t[] dims = { 20 }; H5DataSpaceId dspace = H5S.create_simple(RANK, dims); // Create a group. H5GroupId groupId = H5G.create(fileId, GROUP_NAME); // Create a dataset using file as location. H5DataSetId dset1Id = H5D.create(fileId, DSET1_NAME, H5T.H5Type.NATIVE_INT, dspace); // Create a dataset using group as location. H5DataSetId dset2Id = H5D.create(groupId, DSET2_NAME, H5T.H5Type.NATIVE_SHORT, dspace); // Close objects and files. H5D.close(dset1Id); H5D.close(dset2Id); H5S.close(dspace); H5G.close(groupId); H5F.close(fileId); Console.WriteLine("\t\t\t\tPASSED"); } catch (HDFException anyHDF5E) { Console.WriteLine(anyHDF5E.Message); nerrors++; } catch (System.Exception sysE) { Console.WriteLine(sysE.TargetSite); Console.WriteLine(sysE.Message); nerrors++; } } // test_file_open
private H5Group Create(hid_t loc_id, string key) { if (!IsWritable) { throw new InvalidOperationException("trying to write a readonly file"); } return(new H5Group(H5G.create(loc_id, key), key, IsWritable)); }
public static unsafe void AddExternalFileLink(long fileId, string filePath) { long res; var groupId = H5G.create(fileId, "links"); res = H5L.create_external(filePath, "/external/group", groupId, "external_link"); res = H5G.close(groupId); }
public void H5Odisable_mdc_flushesTestSWMR2() { hid_t grp = H5G.create(m_v3_test_file_no_swmr, "/A/B/C", m_lcpl); Assert.IsTrue(grp >= 0); Assert.IsTrue(H5O.disable_mdc_flushes(grp) >= 0); Assert.IsTrue(H5G.flush(grp) >= 0); Assert.IsTrue(H5G.close(grp) >= 0); }
public void H5GcloseTest1() { hid_t gid = H5G.create(m_v0_test_file, "A"); Assert.IsTrue(gid >= 0); Assert.IsTrue(H5G.close(gid) >= 0); gid = H5G.create(m_v2_test_file, "A"); Assert.IsTrue(gid >= 0); Assert.IsTrue(H5G.close(gid) >= 0); }
public void WriteAndReadGroupsWithDataset() { string filename = Path.Combine(folder, "testGroups.H5"); try { var fileId = Hdf5.CreateFile(filename); Assert.IsTrue(fileId > 0); var dset = dsets.First(); var groupId = H5G.create(fileId, Hdf5Utils.NormalizedName("/A")); ///B/C/D/E/F/G/H Hdf5.WriteDataset(groupId, Hdf5Utils.NormalizedName("test"), dset); var subGroupId = Hdf5.CreateOrOpenGroup(groupId, Hdf5Utils.NormalizedName("C")); var subGroupId2 = Hdf5.CreateOrOpenGroup(groupId, Hdf5Utils.NormalizedName("/D")); // will be saved at the root location dset = dsets.Skip(1).First(); Hdf5.WriteDataset(subGroupId, Hdf5Utils.NormalizedName("test2"), dset); Hdf5.CloseGroup(subGroupId); Hdf5.CloseGroup(subGroupId2); Hdf5.CloseGroup(groupId); groupId = H5G.create(fileId, Hdf5Utils.NormalizedName("/A/B")); ///B/C/D/E/F/G/H dset = dsets.Skip(1).First(); Hdf5.WriteDataset(groupId, Hdf5Utils.NormalizedName("test"), dset); Hdf5.CloseGroup(groupId); groupId = Hdf5.CreateGroupRecursively(fileId, Hdf5Utils.NormalizedName("A/B/C/D/E/F/I")); Hdf5.CloseGroup(groupId); Hdf5.CloseFile(fileId); fileId = Hdf5.OpenFile(filename); Assert.IsTrue(fileId > 0); fileId = Hdf5.OpenFile(filename); groupId = H5G.open(fileId, Hdf5Utils.NormalizedName("/A/B")); double[,] dset2 = (double[, ])Hdf5.ReadDataset <double>(groupId, Hdf5Utils.NormalizedName("test")).result; CompareDatasets(dset, dset2); Assert.IsTrue(Hdf5.CloseGroup(groupId) >= 0); groupId = H5G.open(fileId, Hdf5Utils.NormalizedName("/A/C")); dset2 = (double[, ])Hdf5.ReadDataset <double>(groupId, Hdf5Utils.NormalizedName("test2")).result; CompareDatasets(dset, dset2); Assert.IsTrue(Hdf5.CloseGroup(groupId) >= 0); bool same = dset == dset2; dset = dsets.First(); dset2 = (double[, ])Hdf5.ReadDataset <double>(fileId, Hdf5Utils.NormalizedName("/A/test")).result; CompareDatasets(dset, dset2); Assert.IsTrue(Hdf5Utils.ItemExists(fileId, Hdf5Utils.NormalizedName("A/B/C/D/E/F/I"), DataTypes.Hdf5ElementType.Dataset)); Assert.IsTrue(Hdf5.CloseFile(fileId) == 0); } catch (Exception ex) { CreateExceptionAssert(ex); } }
public void H5Lcreate_hardTest1() { Assert.IsTrue(H5G.create(m_v0_test_file, "A/B/C/D", m_lcpl) >= 0); Assert.IsTrue( H5L.create_hard(m_v0_test_file, "A/B/C/D", m_v0_test_file, "shortcut") >= 0); Assert.IsTrue(H5G.create(m_v2_test_file, "A/B/C/D", m_lcpl) >= 0); Assert.IsTrue( H5L.create_hard(m_v2_test_file, "A/B/C/D", m_v2_test_file, "shortcut") >= 0); }
public void H5Idec_refTest1() { hid_t gid = H5G.create(m_v0_test_file, "A"); Assert.IsTrue(gid > 0); Assert.IsTrue(H5I.dec_ref(gid) >= 0); Assert.IsFalse(H5G.close(gid) >= 0); gid = H5G.create(m_v2_test_file, "A"); Assert.IsTrue(gid > 0); Assert.IsTrue(H5I.dec_ref(gid) >= 0); Assert.IsFalse(H5G.close(gid) >= 0); }
/// <summary> /// Creates a group if it does not exists and returns the handle id. /// </summary> /// <param name="groupId">parent group id. Note, fileId is the root group.</param> /// <param name="name">name of the group to create</param> /// <returns></returns> private long CreateGroup(long groupId, string name) { if (string.IsNullOrEmpty(name)) { return(groupId); } // check if group exists if (H5L.exists(groupId, name) > 0) { return(H5G.open(groupId, name)); } return(H5G.create(groupId, name)); }
public void H5OcopyTest1() { hid_t gid = H5G.create(m_v0_test_file, "A/B/C", m_lcpl); Assert.IsTrue(gid >= 0); Assert.IsTrue( H5O.copy(m_v0_test_file, "A", m_v2_test_file, "A_copy") >= 0); Assert.IsTrue(H5L.exists(m_v2_test_file, "A_copy/B/C") > 0); Assert.IsTrue(H5G.close(gid) >= 0); }
public static unsafe void Add(ContainerType container, long fileId, string groupName, string elementName, long typeId, void *dataPtr, long spaceId, long cpl = 0, long apl = 0) { long res; long groupId; if (H5L.exists(fileId, groupName) > 0) { groupId = H5G.open(fileId, groupName); } else { groupId = H5G.create(fileId, groupName); } long id; if (container == ContainerType.Dataset) { id = H5D.create(groupId, Encoding.UTF8.GetBytes(elementName), typeId, spaceId, dcpl_id: cpl, dapl_id: apl); if (id == -1) { throw new Exception("Could not create dataset."); } if ((int)dataPtr != 0) { res = H5D.write(id, typeId, spaceId, H5S.ALL, 0, new IntPtr(dataPtr)); } res = H5D.close(id); } else { id = H5A.create(groupId, Encoding.UTF8.GetBytes(elementName), typeId, spaceId, acpl_id: cpl); if (id == -1) { throw new Exception("Could not create attribute."); } if ((int)dataPtr != 0) { res = H5A.write(id, typeId, new IntPtr(dataPtr)); } res = H5A.close(id); } res = H5G.close(groupId); }
public void H5LexistsTest1() { Assert.IsTrue( H5G.close(H5G.create(m_v0_test_file, "A/B/C/D", m_lcpl)) >= 0); Assert.IsTrue(H5L.exists(m_v0_test_file, "A") > 0); Assert.IsTrue(H5L.exists(m_v0_test_file, "A/B") > 0); Assert.IsTrue(H5L.exists(m_v0_test_file, "A/C/B") < 0); Assert.IsTrue( H5G.close(H5G.create(m_v2_test_file, "A/B/C/D", m_lcpl)) >= 0); Assert.IsTrue(H5L.exists(m_v2_test_file, "A") > 0); Assert.IsTrue(H5L.exists(m_v2_test_file, "A/B") > 0); Assert.IsTrue(H5L.exists(m_v2_test_file, "A/C/B") < 0); }
public static hid_t CreateGroup(hid_t groupId, string groupName) { hid_t gid; if (GroupExists(groupId, groupName)) { gid = H5G.open(groupId, groupName); } else { gid = H5G.create(groupId, groupName); } return(gid); }
private static H5GroupId CreateGroupIfNoneExists(H5FileId fileId, string path) { H5GroupId group = null; if (H5L.Exists(fileId, path)) { group = H5G.open(fileId, path); } else { group = H5G.create(fileId, path); } return(group); }
public static unsafe void AddMassLinks(long fileId) { long res; var groupId = H5G.create(fileId, "mass_links"); for (int i = 0; i < 1000; i++) { var linkId = H5G.create(groupId, $"mass_{i.ToString("D4")}"); res = H5G.close(linkId); } res = H5G.close(groupId); }