Concepts *.mat-file tool. More...

#include <matfileIO.hh>

Inheritance diagram for concepts::MatfileIO:
concepts::OutputOperator graphics::MatlabBinaryGraphics graphics::MatlabElasticityGraphics

Public Member Functions

template<class T >
void add (const T &u, const std::string varName, enum matio_compression compress=MAT_COMPRESSION_NONE) throw (MatfileIOError)
 Method to add various objects to a current open MatfileIO. More...
 
void assertCmplx (const std::string &varName) const throw (MatfileIOError)
 Throws an exception if the variable is not (at least) a complex. More...
 
void assertExistence (const std::string &varName) const throw (MatfileIOError)
 Throws an exception if the variable does not exist. More...
 
void assertQuadratic (const std::string &varName) const throw (MatfileIOError)
 Throws an exception if the variable is not a quadratic rank 2 object. More...
 
void assertVector (const std::string &varName) const throw (MatfileIOError)
 Throws an exception if the variable has no vector struct, that is at most one dimension is larger than one. More...
 
void clear ()
 Method to remove all variable in the current *.mat-file. More...
 
void close ()
 Method to close the current *.mat-file. More...
 
bool exists (const std::string &varName) const
 Returns true if the variable /c varName exists, false otherwise. More...
 
std::string filename () const
 Returns the name of the current open *.mat-file. More...
 
template<class T >
void get (T &u, const std::string varName) throw (MatfileIOError, MissingFeature)
 Method to get various objects out of the current open MatfileIO. More...
 
bool isCmplx (const std::string &varName) const
 Return true if the variable /c varName is of type double complex. More...
 
bool isDense (const std::string &varName) const
 Returns true if the variable /c varName is dense, else 0. More...
 
bool isEmpty () const
 Routine to check if a *.mat-file is empty, i.e. More...
 
bool isInt (const std::string &varName) const
 Returns true if the variable /c varname is int, else 0. More...
 
bool isOpen () const
 Routine to check if a *.mat-file is currently open. More...
 
bool isReal (const std::string &varName) const
 Return true if the variable /c varName is of type double. More...
 
bool isScalar (const std::string &varName) const
 Return true if the variable /c varName is a scalar. More...
 
bool isSparse (const std::string &varName) const
 Returns true if the variable /c varName is sparse, else 0. More...
 
bool isUint (const std::string &varName) const
 Returns true if the variable /c varname is uint, else 0. More...
 
uint lengthVector (const std::string &varName) const
 Return its length if /c varName is a vector, 0 otherwise. More...
 
 MatfileIO (const std::string filename)
 Constructor to open/create a *.mat with given name. More...
 
void overWrite (bool toOverWrite)
 Method with that u can secure already existing variables in a current open *.mat-file. More...
 
bool remove (const std::string varName)
 Removes the requested variable named 'str' if it exist in the current matfile. More...
 
void reopen ()
 Method to reopen the *.mat-file that was once opened with the constructor. More...
 
virtual ~MatfileIO ()
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 Gives an overview about the variables that are in a current open *.mat-file. More...
 

Private Member Functions

template<uint dim>
void add_ (const Array< Point< Cmplx, dim > > &array, const std::string &varName, enum matio_compression compress)
 Add routine for a complex concepts::Array<concepts::Point> More...
 
template<uint dim>
void add_ (const Array< Point< Real, dim > > &array, const std::string &varName, enum matio_compression compress)
 Add routine for a real concepts::Array<concepts::Point> More...
 
template<class T >
void add_ (const Array< T > &array, const std::string &varName, enum matio_compression compress)
 Add routine for an concepts::Array. More...
 
void add_ (const Cmplx &scalar, const std::string &varName, enum matio_compression compress)
 Add routine for a cmplx scalar. More...
 
template<class T >
void add_ (const DiagonalMatrix< T > &diagM, const std::string &varName, enum matio_compression compress)
 adds a DiagonalMatrix to the current *.mat file. More...
 
template<class T >
void add_ (const ElementMatrix< T > &dense, const std::string &varName, enum matio_compression compress)
 Add routine for an concepts::ElementMatrix, i.e. More...
 
void add_ (const int scalar, const std::string &str, enum matio_compression compress)
 Add routine for int scalar. More...
 
template<uint dim>
void add_ (const Mapping< Cmplx, dim > &map, const std::string &varName, enum matio_compression compress)
 Add routine for a cmplx concepts::Mapping. More...
 
template<uint dim>
void add_ (const Mapping< Real, dim > &map, const std::string &varName, enum matio_compression compress)
 Add routine for a real concepts::Mapping. More...
 
template<uint dim>
void add_ (const Point< Cmplx, dim > &point, const std::string &varName, enum matio_compression compress)
 Add routine for a cmplx concepts::Point. More...
 
template<uint dim>
void add_ (const Point< Real, dim > &point, const std::string &varName, enum matio_compression compress)
 Add routine for a real concepts::Point. More...
 
void add_ (const Real &scalar, const std::string &varName, enum matio_compression compress)
 Add routine for a real scalar. More...
 
template<class T >
void add_ (const SparseMatrix< T > &sparseM, const std::string &varName, enum matio_compression compress)
 adds a SparseMatrix to the current *.mat file. More...
 
template<class T >
void add_ (const std::vector< T > &vec, const std::string &varName, enum matio_compression compress)
 Add routine for a std::vector, i.e. More...
 
void add_ (const uint scalar, const std::string &str, enum matio_compression compress)
 Add routine for int scalar. More...
 
template<class T >
void add_ (const Vector< T > &vec, const std::string &varName, enum matio_compression compress)
 Add routine for a concepts::Vector. More...
 
void assertDiagStructur_ (matvar_t *&var) const throw (MatfileIOError)
 throws an exception if the variable has no diagonal structure, that is if it is a dense/sparse matrix that is not diagonal (has offdiagonal non zero entries), if it has no vector structur. More...
 
void assertDimension_ (uint dim, uint vardim) const throw (MatfileIOError)
 throws an exception if the dimensions mismatch, application for Mapping/ Points More...
 
void assertOpenFile_ (mat_t *file) const throw (MatfileIOError)
 throws an exception if mat-file could not be opened More...
 
void assertQuadratic_ (matvar_t *&var) const throw (MatfileIOError)
 throws an exception if the variable is not rank 2 and quadratic. More...
 
void assertScalar_ (matvar_t *&var) const throw (MatfileIOError)
 throws an exception if the variable has no Scalar structure. More...
 
void assertVar_ (mat_sparse_t *var) const throw (MatfileIOError)
 Throws an exception if the matvar sparse pointer is Null use i.e. More...
 
void assertVar_ (matvar_t *var) const throw (MatfileIOError)
 Throws an exception if the matvar pointer is Null use i.e. More...
 
void assertVector_ (matvar_t *&var) const throw (MatfileIOError)
 throws an exception if the variable has no Vector_structur. More...
 
void createDenseCmplx_ (uint m, uint n, const std::string &varName, Real *&realP, Real *&imgP)
 Creates the mat variable for a dense complex structure and sets pointers to the real and the imaginary part of the data of the variable. More...
 
void createDenseReal_ (uint m, uint n, const std::string &varName, Real *&dataAccP)
 Creates the mat variable for a dense real structure and sets a pointer to the data of the variable. More...
 
template<class T >
void get_ (Array< T > &arr, matvar_t *&matvar)
 Getter routine for a concepts::Array. More...
 
void get_ (Cmplx &scalar, matvar_t *&matvar)
 Getter routine for a cmplx scalar. More...
 
template<class T >
void get_ (DenseMatrix< T > &dense, matvar_t *&matvar)
 Getter routine for a concepts::DenseMatrix. More...
 
template<class T >
void get_ (DiagonalMatrix< T > &sparse, matvar_t *&matvar)
 Getter routine for a concepts::DiagonalMatrix This methods works iff matvar-data has vector structur or is sparse/dense matrix that is diagonal. More...
 
template<class T >
void get_ (ElementMatrix< T > &dense, matvar_t *&matvar)
 Getter routine for a concepts::ElementMatrix. More...
 
void get_ (int &scalar, matvar_t *&matvar) throw (MatfileIOError)
 Getter routine for int scalar. More...
 
template<uint dim>
void get_ (Mapping< Cmplx, dim > &map, matvar_t *&matvar)
 Getter routine for a cmplx concepts::Mapping. More...
 
template<uint dim>
void get_ (Mapping< Real, dim > &map, matvar_t *&matvar)
 Getter routine for a real concepts::Mapping. More...
 
template<uint dim>
void get_ (Point< Cmplx, dim > &point, matvar_t *&matvar)
 Getter routine for a cmplx concepts::Point. More...
 
template<uint dim>
void get_ (Point< Real, dim > &point, matvar_t *&matvar)
 Getter routine for a real concepts::Point. More...
 
void get_ (Real &scalar, matvar_t *&matvar)
 Getter routine for a real scalar. More...
 
template<class T >
void get_ (SparseMatrix< T > &sparse, matvar_t *&matvar)
 Getter routine for a concepts::SparseMatrix. More...
 
template<class T >
void get_ (std::vector< T > &seq, matvar_t *&matvar)
 Getter routine for an std::vector, i.e. More...
 
template<class T >
void get_ (std::vector< Vector< T > > &seq, matvar_t *&matvar)
 Getter routine for an std::vector<concepts::Vector>, i.e. More...
 
void get_ (uint &scalar, matvar_t *&matvar) throw (MatfileIOError)
 Getter routine for uint scalar. More...
 
template<class T >
void get_ (Vector< T > &vec, matvar_t *&matvar)
 Getter routine for a concepts::Vector. More...
 
bool hasDiagStructur_ (matvar_t *var) const
 test if object has diagonal confortable structure, that is diagonal square matrix or vector More...
 
bool isCmplx_ (matvar_t *var) const
 Returns 1 if the variable's field is Complex, otherwise 0. More...
 
bool isDense_ (matvar_t *var) const
 Returns true if the variable is a dense Matlab object. More...
 
bool isInt_ (matvar_t *var) const
 Returns true if the variable is a int matlab object. More...
 
bool isQuadratic_ (matvar_t *var) const
 test if the requested variable is quadratic and a 2D Tensor (used for Mapping) More...
 
bool isReal_ (matvar_t *var) const
 Returns 1 if the variables field is Real, otherwise 0. More...
 
bool isScalar_ (matvar_t *var) const
 test if the requested variable is scalar. More...
 
bool isSparse_ (matvar_t *var) const
 Returns true if the variable is a Matlab sparse array, 0 else. More...
 
bool isUint_ (matvar_t *var) const
 Returns true if the variable is a uint matlab object. More...
 
bool isVector_ (matvar_t *var) const
 tests if object has vector size, i.e. More...
 
uint lengthVector_ (matvar_t *var) const
 returns the length of a vector structure, else 0 More...
 
std::string matfileEnding_ (const std::string &filename)
 adds the ending .mat if needed More...
 
void wrongField_ (matvar_t *&var) const throw ()
 
void wrongStructure_ (matvar_t *&var) const throw ()
 throws an exception for wrong structure. More...
 

Private Attributes

std::string fileName_
 
mat_t * mat_
 
matvar_t * matvar_
 
concepts::Set< std::string > matvar_str_
 
concepts::Set< std::string > matvar_str_cur_
 
bool overWrite_
 

Detailed Description

Concepts *.mat-file tool.

The class works as an interface between the Concepts and (some parts of) the library MatIO by Christopher C. Hulbert. It allows to write and read *.mat-files that are compressed with the z library or without compression within Concepts. If you do not have the z library installed, by default all compression is neglected. The heart of this class are the add/get routines. At the moment you are able to add/get concepts::ElementMatrix<T> , concepts::SparseMatrix<T>, concepts::DiagonalMatrix, concepts::Array<T>, concepts::Vector<T>, std::vector<T> (i.e. concepts::Sequence<T>), concepts::Mapping<T,dim> , Point<T,dim> and Scalars(concepts::Real, concepts::Cmplx). Furthermore you are able get std::vector<Vector<T> > objects out of a *.mat-file. There are lot of routines in this class that check if the requested object to get/add fits to the *.mat-file variabel on works with. For more details check the docu on the add/ get routines. For some control possibilities in own programm when using MatfileIO there are various control routines with that you can check for existence, sparse/dense structure, field, etc. The above mentioned classes (without SparseMatrix, DiagonalMatrix) are all called dense objects and need a dense structur representation in the matfile, when you want to get them with getter routines. A SparseMatrix needs a sparse representation in the *.mat-file. A DiagonalMatrix is a exception. It is added as sparse Matrix into a *.mat-file, but you can get it from diagonal dense/sparse matrices or dense vectorial structures.

When you add a variable you cannot get it before closing the current MatfileIO. Use The close() , reopen() routines for that issue. The class works with rank 2 objects only at the moment. In Matlab 1D-vectors/arrays and matrices are rank 2 objects. Matlabs multi-arrays with rank > 2 are not supported at the moment. This class works with Matlab level-5 file and Version 4 file *.mat-files, but not supports Matlab version 7.3 files atm. When using *.mat files produced with octave use the matlab binary options (-mat-binary , -mat4-binary, -mat7-binary) to save them.

Author
Robert Gruhlke , 2012/2013
Examples
matfileTutorial.cc.

Definition at line 112 of file matfileIO.hh.

Constructor & Destructor Documentation

◆ MatfileIO()

concepts::MatfileIO::MatfileIO ( const std::string  filename)

Constructor to open/create a *.mat with given name.

The constructor trys to open a binary *.mat file with the given name filename. If no such *.mat file already exists, a new *.mat file with the given filename will be created. If the Input string does not end with the typical '.mat' label, it will be automatically added.

Parameters
filenameName of the *.mat-file.

◆ ~MatfileIO()

virtual concepts::MatfileIO::~MatfileIO ( )
inlinevirtual

Definition at line 130 of file matfileIO.hh.

Member Function Documentation

◆ add()

template<class T >
void concepts::MatfileIO::add ( const T &  u,
const std::string  varName,
enum matio_compression  compress = MAT_COMPRESSION_NONE 
)
throw (MatfileIOError
)
inline

Method to add various objects to a current open MatfileIO.

Objects that can be added are:

  • ElementMatrix<T> (i.e. DenseMatrix<T>)
  • Array<Point<T, dim>>
  • DiagonalMatrix<T>
  • SparseMatrix<T>
  • Array<T>,
  • std::vector<T> (i.e. Sequence<T>)
  • Vector<T>,
  • Point<T, dim>,
  • Mapping<T, dim>,
  • Scalars (Real, Cmplx)

This add routine controls the Input quantities and throws an exception, if the MatfileIO instance is not open; the Input class type T is not supported (yet); a variable with the same name varName is added in the current MatfileIO instance, before closing it; a variable with the same name varName already exists in the *.mat-file and is set not to be rewritable. If no error occurs the desired object is added.

Parameters
uThe object you want to add to the current open *.mat-file
varNameName of the variable.
compressMAT_COMPRESSION_NONE / MAT_COMPRESSION_ZLIB
Examples
matfileTutorial.cc.

Definition at line 160 of file matfileIO.hh.

◆ add_() [1/16]

template<uint dim>
void concepts::MatfileIO::add_ ( const Array< Point< Cmplx, dim > > &  array,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a complex concepts::Array<concepts::Point>

◆ add_() [2/16]

template<uint dim>
void concepts::MatfileIO::add_ ( const Array< Point< Real, dim > > &  array,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a real concepts::Array<concepts::Point>

◆ add_() [3/16]

template<class T >
void concepts::MatfileIO::add_ ( const Array< T > &  array,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for an concepts::Array.

◆ add_() [4/16]

void concepts::MatfileIO::add_ ( const Cmplx scalar,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a cmplx scalar.

◆ add_() [5/16]

template<class T >
void concepts::MatfileIO::add_ ( const DiagonalMatrix< T > &  diagM,
const std::string &  varName,
enum matio_compression  compress 
)
private

adds a DiagonalMatrix to the current *.mat file.

It is added as sparse matrix in the matfile.

◆ add_() [6/16]

template<class T >
void concepts::MatfileIO::add_ ( const ElementMatrix< T > &  dense,
const std::string &  varName,
enum matio_compression  compress 
)
private

◆ add_() [7/16]

void concepts::MatfileIO::add_ ( const int  scalar,
const std::string &  str,
enum matio_compression  compress 
)
private

Add routine for int scalar.

◆ add_() [8/16]

template<uint dim>
void concepts::MatfileIO::add_ ( const Mapping< Cmplx, dim > &  map,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a cmplx concepts::Mapping.

◆ add_() [9/16]

template<uint dim>
void concepts::MatfileIO::add_ ( const Mapping< Real, dim > &  map,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a real concepts::Mapping.

◆ add_() [10/16]

template<uint dim>
void concepts::MatfileIO::add_ ( const Point< Cmplx, dim > &  point,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a cmplx concepts::Point.

◆ add_() [11/16]

template<uint dim>
void concepts::MatfileIO::add_ ( const Point< Real, dim > &  point,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a real concepts::Point.

◆ add_() [12/16]

void concepts::MatfileIO::add_ ( const Real scalar,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a real scalar.

◆ add_() [13/16]

template<class T >
void concepts::MatfileIO::add_ ( const SparseMatrix< T > &  sparseM,
const std::string &  varName,
enum matio_compression  compress 
)
private

adds a SparseMatrix to the current *.mat file.

◆ add_() [14/16]

template<class T >
void concepts::MatfileIO::add_ ( const std::vector< T > &  vec,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a std::vector, i.e.

concepts::Sequence

◆ add_() [15/16]

void concepts::MatfileIO::add_ ( const uint  scalar,
const std::string &  str,
enum matio_compression  compress 
)
private

Add routine for int scalar.

◆ add_() [16/16]

template<class T >
void concepts::MatfileIO::add_ ( const Vector< T > &  vec,
const std::string &  varName,
enum matio_compression  compress 
)
private

Add routine for a concepts::Vector.

◆ assertCmplx()

void concepts::MatfileIO::assertCmplx ( const std::string &  varName) const
throw (MatfileIOError
)

Throws an exception if the variable is not (at least) a complex.

◆ assertDiagStructur_()

void concepts::MatfileIO::assertDiagStructur_ ( matvar_t *&  var) const
throw (MatfileIOError
)
private

throws an exception if the variable has no diagonal structure, that is if it is a dense/sparse matrix that is not diagonal (has offdiagonal non zero entries), if it has no vector structur.

It also frees the matvar_t pointer.

◆ assertDimension_()

void concepts::MatfileIO::assertDimension_ ( uint  dim,
uint  vardim 
) const
throw (MatfileIOError
)
private

throws an exception if the dimensions mismatch, application for Mapping/ Points

◆ assertExistence()

void concepts::MatfileIO::assertExistence ( const std::string &  varName) const
throw (MatfileIOError
)

Throws an exception if the variable does not exist.

◆ assertOpenFile_()

void concepts::MatfileIO::assertOpenFile_ ( mat_t *  file) const
throw (MatfileIOError
)
private

throws an exception if mat-file could not be opened

◆ assertQuadratic()

void concepts::MatfileIO::assertQuadratic ( const std::string &  varName) const
throw (MatfileIOError
)

Throws an exception if the variable is not a quadratic rank 2 object.

◆ assertQuadratic_()

void concepts::MatfileIO::assertQuadratic_ ( matvar_t *&  var) const
throw (MatfileIOError
)
private

throws an exception if the variable is not rank 2 and quadratic.

It also frees the matvar_t pointer

◆ assertScalar_()

void concepts::MatfileIO::assertScalar_ ( matvar_t *&  var) const
throw (MatfileIOError
)
private

throws an exception if the variable has no Scalar structure.

It also frees the matvar_t pointer.

◆ assertVar_() [1/2]

void concepts::MatfileIO::assertVar_ ( mat_sparse_t *  var) const
throw (MatfileIOError
)
private

Throws an exception if the matvar sparse pointer is Null use i.e.

if creating one fails, or reading fails

◆ assertVar_() [2/2]

void concepts::MatfileIO::assertVar_ ( matvar_t *  var) const
throw (MatfileIOError
)
private

Throws an exception if the matvar pointer is Null use i.e.

if creating one fails, or reading fails

◆ assertVector()

void concepts::MatfileIO::assertVector ( const std::string &  varName) const
throw (MatfileIOError
)

Throws an exception if the variable has no vector struct, that is at most one dimension is larger than one.

◆ assertVector_()

void concepts::MatfileIO::assertVector_ ( matvar_t *&  var) const
throw (MatfileIOError
)
private

throws an exception if the variable has no Vector_structur.

It also frees the matvar_t pointer

◆ clear()

void concepts::MatfileIO::clear ( )

Method to remove all variable in the current *.mat-file.

◆ close()

void concepts::MatfileIO::close ( )

Method to close the current *.mat-file.

This method has the effect to finish the writing to the *.mat-file. It may be used in combination with reopen(). If you don't close the current MatfileIO-object the deconstructor will do it anyway.

Examples
matfileTutorial.cc.

◆ createDenseCmplx_()

void concepts::MatfileIO::createDenseCmplx_ ( uint  m,
uint  n,
const std::string &  varName,
Real *&  realP,
Real *&  imgP 
)
private

Creates the mat variable for a dense complex structure and sets pointers to the real and the imaginary part of the data of the variable.

Parameters
m,nsize of the input-Argument
varNamename of the variable that will be created
realPdata access pointer to the real part of the data of the variable
imgPdata access pointer to the imaginary part of the data of the variable

◆ createDenseReal_()

void concepts::MatfileIO::createDenseReal_ ( uint  m,
uint  n,
const std::string &  varName,
Real *&  dataAccP 
)
private

Creates the mat variable for a dense real structure and sets a pointer to the data of the variable.

Parameters
m,nsize of the input-Argument
varNamename of the variable that will be created
dataAccPdata access pointer to the data of the variable

◆ exists()

bool concepts::MatfileIO::exists ( const std::string &  varName) const

Returns true if the variable /c varName exists, false otherwise.

It throws an exception if no file is opened currently.

Examples
matfileTutorial.cc.

◆ filename()

std::string concepts::MatfileIO::filename ( ) const
inline

Returns the name of the current open *.mat-file.

Definition at line 304 of file matfileIO.hh.

◆ get()

template<class T >
void concepts::MatfileIO::get ( T &  u,
const std::string  varName 
)
throw (MatfileIOError,
MissingFeature
)
inline

Method to get various objects out of the current open MatfileIO.

Objects that can be gained:

  • ElementMatrix<T> (i.e. DenseMatrix<T>)
  • DiagonalMatrix<T>
  • SparseMatrix<T>
  • Array<T>,
  • std::vector<T> (i.e.Sequence<T>)
  • std::vector<Vector<T> > (i.e. Sequence<Vector< T > >)
  • Vector<T>,
  • Point<T, dim>,
  • Mapping<T, dim>,
  • Scalars (Real, Cmplx)

This get routine controlls the Input quantities and throws an exception, if no variable named varName exists in the current open *.mat-file; if the field of the requested variable in the *.mat-file and the field of u differs, that is concepts::Real or concepts::Cmplx; if the class of u is not supported (yet). Matlab's multidimensional arrays with rank > 2 are not supported to be read out of a *.mat-file (yet). If no error occurs the desired object gets filled. The object u does not need to be preallocated, it gets resized due to the *.mat-file informations.

Parameters
uThe object you want to get out of the current open *.mat-file
varNameName of the requested variable.
Examples
matfileTutorial.cc.

Definition at line 233 of file matfileIO.hh.

◆ get_() [1/16]

template<class T >
void concepts::MatfileIO::get_ ( Array< T > &  arr,
matvar_t *&  matvar 
)
private

Getter routine for a concepts::Array.

◆ get_() [2/16]

void concepts::MatfileIO::get_ ( Cmplx scalar,
matvar_t *&  matvar 
)
private

Getter routine for a cmplx scalar.

◆ get_() [3/16]

template<class T >
void concepts::MatfileIO::get_ ( DenseMatrix< T > &  dense,
matvar_t *&  matvar 
)
private

Getter routine for a concepts::DenseMatrix.

◆ get_() [4/16]

template<class T >
void concepts::MatfileIO::get_ ( DiagonalMatrix< T > &  sparse,
matvar_t *&  matvar 
)
private

Getter routine for a concepts::DiagonalMatrix This methods works iff matvar-data has vector structur or is sparse/dense matrix that is diagonal.

If the matrices have off diagonal non zero values that will be asserted If the sparse matrix has diagonal entrie zero, then there are less data entries than the dimension of the matrix, therefore a CCS inverse routine is involved

◆ get_() [5/16]

template<class T >
void concepts::MatfileIO::get_ ( ElementMatrix< T > &  dense,
matvar_t *&  matvar 
)
private

Getter routine for a concepts::ElementMatrix.

◆ get_() [6/16]

void concepts::MatfileIO::get_ ( int &  scalar,
matvar_t *&  matvar 
)
throw (MatfileIOError
)
private

Getter routine for int scalar.

◆ get_() [7/16]

template<uint dim>
void concepts::MatfileIO::get_ ( Mapping< Cmplx, dim > &  map,
matvar_t *&  matvar 
)
private

Getter routine for a cmplx concepts::Mapping.

◆ get_() [8/16]

template<uint dim>
void concepts::MatfileIO::get_ ( Mapping< Real, dim > &  map,
matvar_t *&  matvar 
)
private

Getter routine for a real concepts::Mapping.

◆ get_() [9/16]

template<uint dim>
void concepts::MatfileIO::get_ ( Point< Cmplx, dim > &  point,
matvar_t *&  matvar 
)
private

Getter routine for a cmplx concepts::Point.

◆ get_() [10/16]

template<uint dim>
void concepts::MatfileIO::get_ ( Point< Real, dim > &  point,
matvar_t *&  matvar 
)
private

Getter routine for a real concepts::Point.

◆ get_() [11/16]

void concepts::MatfileIO::get_ ( Real scalar,
matvar_t *&  matvar 
)
private

Getter routine for a real scalar.

◆ get_() [12/16]

template<class T >
void concepts::MatfileIO::get_ ( SparseMatrix< T > &  sparse,
matvar_t *&  matvar 
)
private

Getter routine for a concepts::SparseMatrix.

◆ get_() [13/16]

template<class T >
void concepts::MatfileIO::get_ ( std::vector< T > &  seq,
matvar_t *&  matvar 
)
private

Getter routine for an std::vector, i.e.

concepts::Sequence

◆ get_() [14/16]

template<class T >
void concepts::MatfileIO::get_ ( std::vector< Vector< T > > &  seq,
matvar_t *&  matvar 
)
private

Getter routine for an std::vector<concepts::Vector>, i.e.

concepts::Sequence<concepts::Vector>

◆ get_() [15/16]

void concepts::MatfileIO::get_ ( uint &  scalar,
matvar_t *&  matvar 
)
throw (MatfileIOError
)
private

Getter routine for uint scalar.

◆ get_() [16/16]

template<class T >
void concepts::MatfileIO::get_ ( Vector< T > &  vec,
matvar_t *&  matvar 
)
private

Getter routine for a concepts::Vector.

◆ hasDiagStructur_()

bool concepts::MatfileIO::hasDiagStructur_ ( matvar_t *  var) const
private

test if object has diagonal confortable structure, that is diagonal square matrix or vector

◆ info()

virtual std::ostream& concepts::MatfileIO::info ( std::ostream &  os) const
protectedvirtual

Gives an overview about the variables that are in a current open *.mat-file.

Reimplemented from concepts::OutputOperator.

◆ isCmplx()

bool concepts::MatfileIO::isCmplx ( const std::string &  varName) const

Return true if the variable /c varName is of type double complex.

Examples
matfileTutorial.cc.

◆ isCmplx_()

bool concepts::MatfileIO::isCmplx_ ( matvar_t *  var) const
inlineprivate

Returns 1 if the variable's field is Complex, otherwise 0.

Definition at line 696 of file matfileIO.hh.

◆ isDense()

bool concepts::MatfileIO::isDense ( const std::string &  varName) const

Returns true if the variable /c varName is dense, else 0.

Examples
matfileTutorial.cc.

◆ isDense_()

bool concepts::MatfileIO::isDense_ ( matvar_t *  var) const
inlineprivate

Returns true if the variable is a dense Matlab object.

Definition at line 710 of file matfileIO.hh.

◆ isEmpty()

bool concepts::MatfileIO::isEmpty ( ) const
inline

Routine to check if a *.mat-file is empty, i.e.

does not contain any variables.

Definition at line 288 of file matfileIO.hh.

◆ isInt()

bool concepts::MatfileIO::isInt ( const std::string &  varName) const

Returns true if the variable /c varname is int, else 0.

Examples
matfileTutorial.cc.

◆ isInt_()

bool concepts::MatfileIO::isInt_ ( matvar_t *  var) const
inlineprivate

Returns true if the variable is a int matlab object.

Definition at line 717 of file matfileIO.hh.

◆ isOpen()

bool concepts::MatfileIO::isOpen ( ) const
inline

Routine to check if a *.mat-file is currently open.

Might be use with reopen() and close() routines.

Definition at line 281 of file matfileIO.hh.

◆ isQuadratic_()

bool concepts::MatfileIO::isQuadratic_ ( matvar_t *  var) const
inlineprivate

test if the requested variable is quadratic and a 2D Tensor (used for Mapping)

Definition at line 746 of file matfileIO.hh.

◆ isReal()

bool concepts::MatfileIO::isReal ( const std::string &  varName) const

Return true if the variable /c varName is of type double.

Examples
matfileTutorial.cc.

◆ isReal_()

bool concepts::MatfileIO::isReal_ ( matvar_t *  var) const
inlineprivate

Returns 1 if the variables field is Real, otherwise 0.

Definition at line 690 of file matfileIO.hh.

◆ isScalar()

bool concepts::MatfileIO::isScalar ( const std::string &  varName) const

Return true if the variable /c varName is a scalar.

Examples
matfileTutorial.cc.

◆ isScalar_()

bool concepts::MatfileIO::isScalar_ ( matvar_t *  var) const
private

test if the requested variable is scalar.

this works for multidimensional arrays in Matlab, i.e. rank > 2

◆ isSparse()

bool concepts::MatfileIO::isSparse ( const std::string &  varName) const

Returns true if the variable /c varName is sparse, else 0.

Examples
matfileTutorial.cc.

◆ isSparse_()

bool concepts::MatfileIO::isSparse_ ( matvar_t *  var) const
inlineprivate

Returns true if the variable is a Matlab sparse array, 0 else.

Definition at line 703 of file matfileIO.hh.

◆ isUint()

bool concepts::MatfileIO::isUint ( const std::string &  varName) const

Returns true if the variable /c varname is uint, else 0.

Examples
matfileTutorial.cc.

◆ isUint_()

bool concepts::MatfileIO::isUint_ ( matvar_t *  var) const
inlineprivate

Returns true if the variable is a uint matlab object.

Definition at line 726 of file matfileIO.hh.

◆ isVector_()

bool concepts::MatfileIO::isVector_ ( matvar_t *  var) const
private

tests if object has vector size, i.e.

if at most one dimension is > 1. this works for multidimensional arrays in Matlab, i.e. rank > 2

◆ lengthVector()

uint concepts::MatfileIO::lengthVector ( const std::string &  varName) const

Return its length if /c varName is a vector, 0 otherwise.

◆ lengthVector_()

uint concepts::MatfileIO::lengthVector_ ( matvar_t *  var) const
private

returns the length of a vector structure, else 0

◆ matfileEnding_()

std::string concepts::MatfileIO::matfileEnding_ ( const std::string &  filename)
private

adds the ending .mat if needed

◆ overWrite()

void concepts::MatfileIO::overWrite ( bool  toOverWrite)
inline

Method with that u can secure already existing variables in a current open *.mat-file.

By default variables get overwritten. If you disable overwriting and try to overwrite a secured variable, it will be asserted.

Parameters
toOverWriteParameter to secure (false) or to unsecure (true) variables from overwriting.

Definition at line 314 of file matfileIO.hh.

◆ remove()

bool concepts::MatfileIO::remove ( const std::string  varName)

Removes the requested variable named 'str' if it exist in the current matfile.

Therefore, first the MatfileIO gets closed to finish writing and then a attempt to delete is performed. If the removal was successful it returns 1, else (i.e. the requested var does not exist in the *.mat-file) it returns 0.

◆ reopen()

void concepts::MatfileIO::reopen ( )

Method to reopen the *.mat-file that was once opened with the constructor.

This could be used in combination with the close()-routine. It may has an application when using the same name for different variables in iterations, where they will be overwritten at each iteration.

◆ wrongField_()

void concepts::MatfileIO::wrongField_ ( matvar_t *&  var) const
throw (
)
private

◆ wrongStructure_()

void concepts::MatfileIO::wrongStructure_ ( matvar_t *&  var) const
throw (
)
private

throws an exception for wrong structure.

Application in get_-routines to handle sparse/dense format differences. It also frees the matvar_t pointer.

Member Data Documentation

◆ fileName_

std::string concepts::MatfileIO::fileName_
private

Definition at line 410 of file matfileIO.hh.

◆ mat_

mat_t* concepts::MatfileIO::mat_
private

Definition at line 405 of file matfileIO.hh.

◆ matvar_

matvar_t* concepts::MatfileIO::matvar_
private

Definition at line 407 of file matfileIO.hh.

◆ matvar_str_

concepts::Set<std::string> concepts::MatfileIO::matvar_str_
private

Definition at line 413 of file matfileIO.hh.

◆ matvar_str_cur_

concepts::Set<std::string> concepts::MatfileIO::matvar_str_cur_
private

Definition at line 418 of file matfileIO.hh.

◆ overWrite_

bool concepts::MatfileIO::overWrite_
private

Definition at line 422 of file matfileIO.hh.


The documentation for this class was generated from the following file:
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich