Page 8 - Demo
P. 8


                                    Data File Viewer%uf09f %uf09f RCP Consult 2022-2025 Page 81.10 C/C++ ImplementationThe list of accessible functions/subroutines for binding of binary datalong long OpenBinaryDataFileInit(datafile)Open a MAT/HDF5 binary file and read all data fromdatafile (char *) %u2013 filename having extension *.mat or *.h5Returns identifier (long long) of opened data file or 0 if error.void *GetBinaryDataFileVariable(fid, variable, m1, m2, bytes)Returns identifier of variable data, dimensions and bytes of typefid (long long) %u2013 identifier of data filevariable (char *) %u2013 name of variable in directory of data filem1, m2 (longs) %u2013 dimension of variable data arraybytes (long) %u2013 size in bytes of variable data elementvoid CloseBinaryDataFile(fid)Close a MAT/HDF5 binary filefid (long long) %u2013 identifier of data fileThe invoking of binary data file in the source file is very straightforward. First the data file must be opened and becomes an unique identifier. For example long long fid=OpenBinaryDataFile(\or long long fid=OpenBinaryDataFile(\Next a pointer to data array and corresponding dimensions and size in bytes for a variable of interest should be defined. long m1, m2, nb; double *mc=(double *)GetBinaryDataFileVariable(fid,\Now it is possible to reshape an array of variables to a real shape as is stored in data file double (&ar)[m2][m1]=*reinterpret cast(mc);%uf046 The cl compiler does not allow usage of variables in reinterpret_cast statement. Therefore it is necessary to get these values first using the Data File Viewer of STRUREL. For example, m1=25 and m2=9. After it is possible to reshape an array of variable to a real shape as is stored in data file double (&ar)[9][25]=*reinterpret_cast(mc);Finally, after loading data from binary file it must be closed by CloseBinaryDataFile(fid);
                                
   2   3   4   5   6   7   8   9   10   11   12