Beispiel #1
0
        public static void ClassInit(TestContext testContext)
        {
            // create test files which persists across file tests
            m_v0_class_file = Utilities.H5TempFile(ref m_v0_class_file_name,
                                                   H5F.libver_t.EARLIEST);
            Assert.IsTrue(m_v0_class_file >= 0);
            m_v2_class_file = Utilities.H5TempFile(ref m_v2_class_file_name);
            Assert.IsTrue(m_v2_class_file >= 0);

            m_lcpl = H5P.create(H5P.LINK_CREATE);
            Assert.IsTrue(H5P.set_create_intermediate_group(m_lcpl, 1) >= 0);

            m_lcpl_utf8 = H5P.copy(m_lcpl);
            Assert.IsTrue(
                H5P.set_char_encoding(m_lcpl_utf8, H5T.cset_t.UTF8) >= 0);
        }
Beispiel #2
0
        public static void ClassInit(TestContext testContext)
        {
#if HDF5_VER1_10
            // create test files which persists across file tests
            m_v3_class_file = Utilities.H5TempFileSWMR(ref m_v3_class_file_name);
            Assert.IsTrue(m_v3_class_file >= 0);

            m_lcpl = H5P.create(H5P.LINK_CREATE);
            Assert.IsTrue(H5P.set_create_intermediate_group(m_lcpl, 1) >= 0);

            m_lcpl_utf8 = H5P.copy(m_lcpl);
            Assert.IsTrue(
                H5P.set_char_encoding(m_lcpl_utf8, H5T.cset_t.UTF8) >= 0);

            // create a sample dataset

            hsize_t[] dims       = { 6, 6 };
            hsize_t[] maxdims    = { 6, H5S.UNLIMITED };
            hsize_t[] chunk_dims = { 2, 5 };
            int[]     cbuf       = new int[36];

            hid_t dsp = H5S.create_simple(2, dims, maxdims);
            Assert.IsTrue(dsp >= 0);

            hid_t dcpl = H5P.create(H5P.DATASET_CREATE);
            Assert.IsTrue(dcpl >= 0);
            Assert.IsTrue(H5P.set_chunk(dcpl, 2, chunk_dims) >= 0);

            hid_t dst = H5D.create(m_v3_class_file, "int6x6",
                                   H5T.NATIVE_INT, dsp, H5P.DEFAULT, dcpl);
            Assert.IsTrue(dst >= 0);

            GCHandle hnd = GCHandle.Alloc(cbuf, GCHandleType.Pinned);

            Assert.IsTrue(H5D.write(dst, H5T.NATIVE_INT, H5S.ALL, H5S.ALL,
                                    H5P.DEFAULT, hnd.AddrOfPinnedObject()) >= 0);

            hnd.Free();

            Assert.IsTrue(H5D.flush(dst) >= 0);

            Assert.IsTrue(H5D.close(dst) >= 0);
            Assert.IsTrue(H5P.close(dcpl) >= 0);
            Assert.IsTrue(H5S.close(dsp) >= 0);
#endif
        }
Beispiel #3
0
        public static void ClassInit(TestContext testContext)
        {
            // create test files which persists across file tests
            m_v0_class_file = Utilities.H5TempFile(ref m_v0_class_file_name,
                                                   H5F.libver_t.EARLIEST);
            Assert.IsTrue(m_v0_class_file >= 0);
            m_v2_class_file = Utilities.H5TempFile(ref m_v2_class_file_name);
            Assert.IsTrue(m_v2_class_file >= 0);

            m_space_null = H5S.create(H5S.class_t.NULL);
            Assert.IsTrue(m_space_null >= 0);
            m_space_scalar = H5S.create(H5S.class_t.SCALAR);
            Assert.IsTrue(m_space_scalar >= 0);

            m_acpl = H5P.create(H5P.ATTRIBUTE_CREATE);
            Assert.IsTrue(m_acpl >= 0);
            Assert.IsTrue(H5P.set_char_encoding(m_acpl, H5T.cset_t.UTF8) >= 0);
        }