I need to read a HDF5 dataset that contains a 3 x 3 array, datatype is double.
My Visual Studio 2017 Pro crashes when returning from my code below.
Stepping with debugger, this code reads the 2-dim array from the HDF5; I can read it in the debugger; but function read_double_array crashes when it returns to caller.
2ND CODE ATTEMPT FROM EXAMPLE AT STACKO ….
public static double[,] read_double_array( H5FileId fileId, string dataset_name, int dim1, int dim2 )
{
double [,] return_data = new double[ dim1, dim2 ];
try
{
H5Array<double> h5_array = new H5Array<double>( return_data );
H5DataSetId double_array_dataset = H5D.open( fileId, dataset_name );
H5D.read<double>( double_array_dataset,
new H5DataTypeId(H5T.H5Type.NATIVE_DOUBLE),
h5_array );
H5D.close(double_array_dataset);
}
catch( HDFException e )
{
Console.WriteLine( e.Message );
int aa=0;
}
return return_data;
}
MY CODE 1ST ATTEMPT, WHICH CRASHED ……………………
public static double[,] read_double_array( H5FileId fileId, string dataset_name, int dim1, int dim2 )
{
double [,] return_data = new double[ dim1, dim2 ];
try
{
H5DataSetId dataSetId = H5D.open( fileId, dataset_name );
H5D.read( dataSetId,
new H5DataTypeId( H5T.H5Type.NATIVE_DOUBLE ),
new H5Array<double>( return_data ) );
}
catch( HDFException e )
{
Console.WriteLine( e.Message );
int aa=0;
}
return return_data; <<<<<<<<<<<<<<<<<< H A N G S H E R E
}