HLIBpro  2.3.1
Storage
Table of contents

𝓗𝖫𝖨𝖡𝗉𝗋𝗈 supports several file formats for reading/writing coordinates, vectors, matrices and files, e.g. Matlab, Harwell/Boeing, MatrixMarket, SAMG, PLY, Gmsh, SurfaceMesh. However, not all features of each file format is fully implemented in 𝓗𝖫𝖨𝖡𝗉𝗋𝗈, e.g. only a single object may be written to Matlab files and only triangular grids are supported in corresponding file formats.

Remarks
All I/O classes will automatically add a corresponding filename suffix, e.g. ".hm" in case of HLIBpro file format, if no suffix is present.

Coordinate I/O

Vector I/O

Matrix I/O

The following file formats are supported for reading and writing matrices:

Format Class

Remarks

𝓗𝖫𝖨𝖡𝗉𝗋𝗈 format THLibMatrixIO
  • 𝓗-, sparse and dense matrices (only format for 𝓗-matrices!).

Matlab v5 TMatlabMatrixIO
  • sparse and dense matrices in single and double precision
  • when writing files, only a single object may be stored
  • limited support for reading from structures
  • support for compression via zlib

Harwell/Boeing
Harwell/Rutherford
THBMatrixIO
  • sparse matrix format
  • no read support for elemental matrices

MatrixMarket TMMMatrixIO
  • sparse matrix format
  • only reading supported
  • only unsymmetric matrices supported
  • no support for array format

SAMG TSAMGMatrixIO
  • sparse matrix format

All storage classes implement the same basic interface defined by the functions:

virtual void write ( const TMatrix * A, const String & name ) const;
virtual TMatrix * read ( const String & name ) const;

Furthermore, a class for reading/writing matrices with file format autodetection is available (TAutoMatrixIO). In case of reading from a file, the auto detection works by actually looking at the stored data and hence, is very robust in choosing the correct file format. On the other hand, if data output is used, only the file name is used to decide the format. The following rules apply based on the file name extension:

Extension File Format
hm HLIBpro format
mat, m Matlab format
hb, rb, rua, rsa, psa Harwell/Boeing format
mtx MatrixMarket format
amg SAMG format

The I/O functions from TAutoMatrixIO are also available in direct from via the functions:

TMatrix * read_matrix ( const char * filename );
void write_matrix ( const TMatrix * A,
const char * filename );

If the file format supports named storage, e.g. Matlab, the corresponding matrix name may be provided by an additional argument:

TMatrix * read_matrix ( const char * filename,
const char * matname );
void write_matrix ( const TMatrix * A,
const char * filename,
const char * matname );

For all other file formats, this parameter will be ignored.

Grid I/O