Class that allows to store graphical infomations in .mat files to use them in Matlab. More...

#include <matlabBinaryGraphics.hh>

Inheritance diagram for graphics::MatlabBinaryGraphics:
concepts::MatfileIO graphics::DenseMatrixGraphics concepts::OutputOperator 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...
 
template<class F , class G >
void addFunction (const concepts::Space< G > &spc, const std::string name, const concepts::ElementFormula< F, G > &frm)
 Adds a solution vector to the current matfile. More...
 
template<class F , class G >
void addSolution (const concepts::Space< G > &spc, const std::string name, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0)
 Adds a solution vector to the current matfile. 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...
 
 MatlabBinaryGraphics (concepts::Mesh &msh, const std::string filename, const uint points=5)
 Constructor for output of mesh only. More...
 
template<class G >
 MatlabBinaryGraphics (const concepts::Space< G > &spc, const std::string filename)
 Constructor for output of space only. More...
 
template<class G , class F >
 MatlabBinaryGraphics (const concepts::Space< G > &spc, const std::string filename, const concepts::ElementFormula< F, G > &frm)
 Constructor for output of an element formula. More...
 
template<class G , class F >
 MatlabBinaryGraphics (const concepts::Space< G > &spc, const std::string filename, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0)
 Constructor for output of solutions and functions of it. More...
 
template<class G , class F >
 MatlabBinaryGraphics (const concepts::Space< G > &spc, const std::string filename, const concepts::Vector< F > &sol, const std::string varName, const concepts::ElementFunction< F, G > *fun=0)
 Constructor for output of solutions and functions of it. More...
 
template<class G , class F >
 MatlabBinaryGraphics (const concepts::Space< G > &spc, const std::string filename, std::vector< concepts::Vector< F > > &sol, const concepts::ElementFunction< F, G > *fun=0)
 Constructor for output of solutions and functions of it. More...
 
 MatlabBinaryGraphics (const std::string filename)
 Constructor that only creates a Matlab binary file of filename filename for further adding of space, solutions etc. 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 ~MatlabBinaryGraphics ()
 

Static Public Attributes

static uint noPoints
 

Protected Member Functions

template<class G >
void addSpace_ (const concepts::Space< G > &spc)
 Adds informations of a given Space to the matfile. More...
 
template<class F , class G >
concepts::RCP< concepts::ElementMatrix< typename concepts::Datatype< F >::type > > getFunction (const concepts::Space< G > &spc, const concepts::ElementFormula< F, G > &frm)
 Returns a vector with the value of the function on the quadrature-points of a given space using the given concepts::ElementFormula. More...
 
DenseMatrixCollection< Real > getMesh (concepts::Mesh &msh, const uint points=5)
 Returns a graphics::DenseMatrixCollection<G> that contains informations for graphical output of the given mesh. More...
 
template<class F , class G >
concepts::RCP< concepts::ElementMatrix< F > > getSolution (const concepts::Space< G > &spc, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0)
 Returns a vector with the value of the solution on the quadrature-points of a given space using a given coefficient vector. More...
 
template<class G >
DenseMatrixCollection< G > getSpace (const concepts::Space< G > &spc)
 Returns a graphics::DenseMatrixCollection<G> that contains informations for graphical output of the given space. More...
 
virtual std::ostream & info (std::ostream &os) const
 Gives an overview about the variables that are in a current open *.mat-file. More...
 
template<class G >
void storeData_ (DenseMatrixCollection< G > &dense_ptr_)
 Stores data hold by dense_ptr. More...
 

Protected Attributes

uint data_
 Information which data should be stored. 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

Class that allows to store graphical infomations in .mat files to use them in Matlab.

Author
Christian Heier, 2011
Examples
BGT_0.cc, exactDtN.cc, howToGetStarted.cc, and parallelizationTutorial.cc.

Definition at line 27 of file matlabBinaryGraphics.hh.

Constructor & Destructor Documentation

◆ MatlabBinaryGraphics() [1/7]

graphics::MatlabBinaryGraphics::MatlabBinaryGraphics ( const std::string  filename)

Constructor that only creates a Matlab binary file of filename filename for further adding of space, solutions etc.

Parameters
filenameFilename of the Matlab binary file (".mat" will be added if filename does not end with ".mat")

◆ MatlabBinaryGraphics() [2/7]

template<class G >
graphics::MatlabBinaryGraphics::MatlabBinaryGraphics ( const concepts::Space< G > &  spc,
const std::string  filename 
)

Constructor for output of space only.

Parameters
spcSpace holding the mesh
filenameFilename of the Matlab binary file

Definition at line 162 of file matlabBinaryGraphics.hh.

◆ MatlabBinaryGraphics() [3/7]

graphics::MatlabBinaryGraphics::MatlabBinaryGraphics ( concepts::Mesh msh,
const std::string  filename,
const uint  points = 5 
)

Constructor for output of mesh only.

Parameters
mshMesh
filenameFilename of the Matlab binary file (".mat" will be added if filename does not end with ".mat")
pointsNumber of points per edge

◆ MatlabBinaryGraphics() [4/7]

template<class G , class F >
graphics::MatlabBinaryGraphics::MatlabBinaryGraphics ( const concepts::Space< G > &  spc,
const std::string  filename,
const concepts::Vector< F > &  sol,
const concepts::ElementFunction< F, G > *  fun = 0 
)

Constructor for output of solutions and functions of it.

Parameters
spcSpace on which the data should be plotted
filenameFilename of the Matlab binary file (".mat" will be added if filename does not end with ".mat")
solThe first solution set which should be plotted
funFunction of the FE function, e.g. itself.

Definition at line 138 of file matlabBinaryGraphics.hh.

◆ MatlabBinaryGraphics() [5/7]

template<class G , class F >
graphics::MatlabBinaryGraphics::MatlabBinaryGraphics ( const concepts::Space< G > &  spc,
const std::string  filename,
const concepts::Vector< F > &  sol,
const std::string  varName,
const concepts::ElementFunction< F, G > *  fun = 0 
)

Constructor for output of solutions and functions of it.

Parameters
spcSpace on which the data should be plotted
filenameFilename of the Matlab binary file (".mat" will be added if filename does not end with ".mat")
solThe first solution set which should be plotted
varNameName of the fem approximation
funFunction of the FE function, e.g. by default itself.

Definition at line 150 of file matlabBinaryGraphics.hh.

◆ MatlabBinaryGraphics() [6/7]

template<class G , class F >
graphics::MatlabBinaryGraphics::MatlabBinaryGraphics ( const concepts::Space< G > &  spc,
const std::string  filename,
std::vector< concepts::Vector< F > > &  sol,
const concepts::ElementFunction< F, G > *  fun = 0 
)

Constructor for output of solutions and functions of it.

Parameters
spcSpace on which the data should be plotted
filenameFilename of the Matlab binary file (".mat" will be added if filename does not end with ".mat")
solThe first solution set which should be plotted
funFunction of the FE function, e.g. itself.

◆ MatlabBinaryGraphics() [7/7]

template<class G , class F >
graphics::MatlabBinaryGraphics::MatlabBinaryGraphics ( const concepts::Space< G > &  spc,
const std::string  filename,
const concepts::ElementFormula< F, G > &  frm 
)

Constructor for output of an element formula.

Parameters
spcSpace on which the data should be plotted
filenameFilename of the Matlab binary file (".mat" will be added if filename does not end with ".mat")
frmElement formula

Definition at line 170 of file matlabBinaryGraphics.hh.

◆ ~MatlabBinaryGraphics()

virtual graphics::MatlabBinaryGraphics::~MatlabBinaryGraphics ( )
virtual

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
)
inlineinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

Add routine for an concepts::Array.

◆ add_() [4/16]

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

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 
)
privateinherited

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 
)
privateinherited

◆ add_() [7/16]

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

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

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 
)
privateinherited

Add routine for a concepts::Vector.

◆ addFunction()

template<class F , class G >
void graphics::MatlabBinaryGraphics::addFunction ( const concepts::Space< G > &  spc,
const std::string  name,
const concepts::ElementFormula< F, G > &  frm 
)

Adds a solution vector to the current matfile.

Parameters
spcThe space from which the solution vector was generated
nameThe name of the variable, e.g. "frm"
frmThe function represented by an element formula

Definition at line 191 of file matlabBinaryGraphics.hh.

◆ addSolution()

template<class F , class G >
void graphics::MatlabBinaryGraphics::addSolution ( const concepts::Space< G > &  spc,
const std::string  name,
const concepts::Vector< F > &  sol,
const concepts::ElementFunction< F, G > *  fun = 0 
)

Adds a solution vector to the current matfile.

Parameters
spcThe space from which the solution vector was generated
nameThe name of the variable, e.g. "u0"
solThe solution vector
funThe type of vector you need (i.e. values, gradient, Laplacian etc.), default argument is Values
Examples
howToGetStarted.cc, and parallelizationTutorial.cc.

Definition at line 178 of file matlabBinaryGraphics.hh.

◆ addSpace_()

template<class G >
void graphics::MatlabBinaryGraphics::addSpace_ ( const concepts::Space< G > &  spc)
protected

Adds informations of a given Space to the matfile.

Parameters
spcThe space that should be stored

Definition at line 201 of file matlabBinaryGraphics.hh.

◆ assertCmplx()

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

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

◆ assertDiagStructur_()

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

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
)
privateinherited

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

◆ assertExistence()

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

Throws an exception if the variable does not exist.

◆ assertOpenFile_()

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

throws an exception if mat-file could not be opened

◆ assertQuadratic()

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

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

◆ assertQuadratic_()

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

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
)
privateinherited

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
)
privateinherited

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
)
privateinherited

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
)
inherited

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
)
privateinherited

throws an exception if the variable has no Vector_structur.

It also frees the matvar_t pointer

◆ clear()

void concepts::MatfileIO::clear ( )
inherited

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

◆ close()

void concepts::MatfileIO::close ( )
inherited

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 
)
privateinherited

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 
)
privateinherited

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
inherited

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
inlineinherited

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
)
inlineinherited

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 
)
privateinherited

Getter routine for a concepts::Array.

◆ get_() [2/16]

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

Getter routine for a cmplx scalar.

◆ get_() [3/16]

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

Getter routine for a concepts::DenseMatrix.

◆ get_() [4/16]

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

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 
)
privateinherited

Getter routine for a concepts::ElementMatrix.

◆ get_() [6/16]

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

Getter routine for int scalar.

◆ get_() [7/16]

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

Getter routine for a cmplx concepts::Mapping.

◆ get_() [8/16]

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

Getter routine for a real concepts::Mapping.

◆ get_() [9/16]

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

Getter routine for a cmplx concepts::Point.

◆ get_() [10/16]

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

Getter routine for a real concepts::Point.

◆ get_() [11/16]

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

Getter routine for a real scalar.

◆ get_() [12/16]

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

Getter routine for a concepts::SparseMatrix.

◆ get_() [13/16]

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

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 
)
privateinherited

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
)
privateinherited

Getter routine for uint scalar.

◆ get_() [16/16]

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

Getter routine for a concepts::Vector.

◆ getFunction()

template<class F , class G >
concepts::RCP< concepts::ElementMatrix< typename concepts::Datatype< F >::type > > graphics::DenseMatrixGraphics::getFunction ( const concepts::Space< G > &  spc,
const concepts::ElementFormula< F, G > &  frm 
)
protectedinherited

Returns a vector with the value of the function on the quadrature-points of a given space using the given concepts::ElementFormula.

Parameters
spcThe space on which the Element Formula is defined
frmThe ElementFormula of the function that should be plotted

Definition at line 194 of file denseMatrixGraphics.hh.

◆ getMesh()

DenseMatrixCollection<Real> graphics::DenseMatrixGraphics::getMesh ( concepts::Mesh msh,
const uint  points = 5 
)
protectedinherited

Returns a graphics::DenseMatrixCollection<G> that contains informations for graphical output of the given mesh.

Parameters
mshThe mesh
dimThe dimension of the mesh

◆ getSolution()

template<class F , class G >
concepts::RCP< concepts::ElementMatrix< F > > graphics::DenseMatrixGraphics::getSolution ( const concepts::Space< G > &  spc,
const concepts::Vector< F > &  sol,
const concepts::ElementFunction< F, G > *  fun = 0 
)
protectedinherited

Returns a vector with the value of the solution on the quadrature-points of a given space using a given coefficient vector.

Parameters
spcThe space from which the solution vector was generated
solThe solution vector
funFunction of the solution (e.g. solution itself, its gradient, it's Laplacien etc.)

Definition at line 130 of file denseMatrixGraphics.hh.

◆ getSpace()

template<class G >
DenseMatrixCollection< G > graphics::DenseMatrixGraphics::getSpace ( const concepts::Space< G > &  spc)
protectedinherited

Returns a graphics::DenseMatrixCollection<G> that contains informations for graphical output of the given space.

Parameters
spcThe space
dimThe dimension of the space

Definition at line 171 of file denseMatrixGraphics.hh.

◆ hasDiagStructur_()

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

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
protectedvirtualinherited

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
inherited

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

Examples
matfileTutorial.cc.

◆ isCmplx_()

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

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
inherited

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

Examples
matfileTutorial.cc.

◆ isDense_()

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

Returns true if the variable is a dense Matlab object.

Definition at line 710 of file matfileIO.hh.

◆ isEmpty()

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

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
inherited

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

Examples
matfileTutorial.cc.

◆ isInt_()

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

Returns true if the variable is a int matlab object.

Definition at line 717 of file matfileIO.hh.

◆ isOpen()

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

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
inlineprivateinherited

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
inherited

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

Examples
matfileTutorial.cc.

◆ isReal_()

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

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
inherited

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

Examples
matfileTutorial.cc.

◆ isScalar_()

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

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
inherited

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

Examples
matfileTutorial.cc.

◆ isSparse_()

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

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
inherited

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

Examples
matfileTutorial.cc.

◆ isUint_()

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

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
privateinherited

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
inherited

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

◆ lengthVector_()

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

returns the length of a vector structure, else 0

◆ matfileEnding_()

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

adds the ending .mat if needed

◆ overWrite()

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

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)
inherited

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 ( )
inherited

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.

◆ storeData_()

template<class G >
void graphics::MatlabBinaryGraphics::storeData_ ( DenseMatrixCollection< G > &  dense_ptr_)
protected

Stores data hold by dense_ptr.

Definition at line 209 of file matlabBinaryGraphics.hh.

◆ wrongField_()

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

◆ wrongStructure_()

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

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

◆ data_

uint graphics::MatlabBinaryGraphics::data_
protected

Information which data should be stored.

Definition at line 134 of file matlabBinaryGraphics.hh.

◆ fileName_

std::string concepts::MatfileIO::fileName_
privateinherited

Definition at line 410 of file matfileIO.hh.

◆ mat_

mat_t* concepts::MatfileIO::mat_
privateinherited

Definition at line 405 of file matfileIO.hh.

◆ matvar_

matvar_t* concepts::MatfileIO::matvar_
privateinherited

Definition at line 407 of file matfileIO.hh.

◆ matvar_str_

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

Definition at line 413 of file matfileIO.hh.

◆ matvar_str_cur_

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

Definition at line 418 of file matfileIO.hh.

◆ noPoints

uint graphics::DenseMatrixGraphics::noPoints
staticinherited

Definition at line 78 of file denseMatrixGraphics.hh.

◆ overWrite_

bool concepts::MatfileIO::overWrite_
privateinherited

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