24 package org.lightvoting;
26 import org.bytedeco.javacpp.IntPointer;
27 import org.bytedeco.javacpp.hdf5;
50 final hdf5.H5File l_h5file =
new hdf5.H5File( p_filename, org.bytedeco.javacpp.hdf5.H5F_ACC_TRUNC );
53 catch (
final Exception l_ex )
55 l_ex.printStackTrace();
64 public static void test(
final String p_name )
66 final hdf5.H5File l_file =
new hdf5.H5File();
67 l_file.openFile( p_name, hdf5.H5F_ACC_RDWR );
69 final String l_DATASETNAME =
"Results";
70 final int l_DIM0 = 100;
71 final int l_DIM1 = 20;
74 final long[] l_dims = {l_DIM0, l_DIM1};
76 final long[] l_chunkDims = {20, 20};
77 final int[] l_buf =
new int[l_DIM0 * l_DIM1];
82 final hdf5.DataSpace l_dataSpace =
new hdf5.DataSpace( 2, l_dims );
85 final hdf5.DSetCreatPropList l_plist =
new hdf5.DSetCreatPropList();
86 l_plist.setChunk( 2, l_chunkDims );
88 final hdf5.DataSet l_dataset =
new hdf5.DataSet( l_file.asCommonFG().createDataSet( l_DATASETNAME,
89 new hdf5.DataType( hdf5.PredType.STD_I32BE() ), l_dataSpace, l_plist ) );
91 for (
int i = 0; i < l_DIM0; i++ )
92 for (
int j = 0; j < l_DIM1; j++ )
93 l_buf[i * l_DIM1 + j] = i + j;
96 l_dataset.write(
new IntPointer( l_buf ),
new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );
Created by sophie on 15.05.17.
static void test(final String p_name)
test for h5 file
static void createHDF5(final String p_filename)
create HDF5 file