Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
graphics::MatlabGraphics Class Reference

Draws a picture of data in Matlab format and stores the result in a single file. More...

#include <matlab.hh>

Inheritance diagram for graphics::MatlabGraphics:
Inheritance graph
[legend]
Collaboration diagram for graphics::MatlabGraphics:
Collaboration graph
[legend]

List of all members.

Public Member Functions

template<class G >
 MatlabGraphics (const concepts::Space< G > &spc, const std::string filename, const uint dim=2)
 Constructor for output of mesh only.
 MatlabGraphics (concepts::Mesh &msh, const std::string filename, const uint dim=2, const uint points=noPoints)
 Constructor for output of mesh only.
template<class F , class G >
 MatlabGraphics (const concepts::Space< G > &spc, const std::string filename, const concepts::ElementFormula< F, G > &frm, const uint dim=2)
 Constructor for output of a element formula.
template<class F >
 MatlabGraphics (concepts::Mesh &msh, const std::string filename, const concepts::PiecewiseFormulaBase< F > &frm, const uint dim=2, const uint points=noPoints)
 Constructor for output of a scalar formula.
template<class F , class G >
 MatlabGraphics (const concepts::Space< G > &spc, const std::string filename, const concepts::Vector< F > &sol, const uint dim=2, const concepts::ElementFunction< F, G > *fun=0)
 Constructor for output of solutions and functions of it.
template<class F , class G >
void operator() (const concepts::Space< G > &spc, const concepts::Formula< F > &frm)
 Application operator for output of a scalar formula.
template<class F , class G >
void operator() (concepts::Mesh &msh, const concepts::Formula< F > &frm, const uint points=5)
 Application operator for output of a scalar formula.
template<class F , class G >
void operator() (const concepts::Space< G > &spc, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0)
 Application operator for output of solutions and functions of it.
virtual ~MatlabGraphics ()

Static Public Attributes

static uint noPoints

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream.

Protected Attributes

std::auto_ptr< std::ofstream > ofs_
 Stream for output file.

Private Member Functions

void closeStreams_ (const uint &n)
 Closes the streams.
void createStreams_ (bool data)
 Create the streams.
template<class F >
void write_ (concepts::GlobalPostprocess< F > &postProcess, BaseOutputCell< F > &matlab, bool data=false)
 Creates standard streams, writes to streams, writes to file and clear and delete all streams.

Private Attributes

uint cnt_
 Number of vectors written to the files.
uint dim_
 Spatial dimension of the space.
std::map< std::string,
std::ostream * > 
s_ptr_
 Pointer to the streams, i.e. *(s_ptr_["vtxmsh"]) for FE mesh.

Detailed Description

Draws a picture of data in Matlab format and stores the result in a single file.

The data is stored in a Matlab M-file by appending '.m'. The data can be read into Matlab by giving the file name as commands (and ommiting the ending '.m').

In general there is the FE-mesh (cells) and the output mesh, which in hp-FEM is given by the quadrature points. The data points are given in the vertices of the output mesh (x, y).

The FE-mesh of triangles or quadrilaterials is given by edgemsh, while vtxmsh consists of the vertices. For a FE-mesh with cells with only straight edges its more efficient to use vtxmsh instead of edgemesh. In each column there are the numbers of the vertices of one cell given, and can be plotted by

      plot(x(edgemsh),y(edgemsh),'k');
      

The data values are in the variable u. For vector values spaces or repeated set of values the i.th component is U{i} (as well as in u(i,:)). In the following examples of scalar data one can replace u(msh) with U{i}(msh) for plotting one component of vector valued data.

Scalar data is plotted in the view from above with

      patch(x(msh),y(msh),u(msh))
      

whereby in msh the output mesh is given.

Its possible to emphasize the FE-mesh in this diagramme with

      patch(x(msh),y(msh),u(msh));
      hold on
      plot(x(edgemsh),y(edgemsh),'k');
      

whereby in edgemsh represents the points in the output mesh lying on the FE mesh.

As the command contour is only applicable to tensor product meshes, there is in general no contour plot possible.

Scalar data is plotted in the side view with

fill3(x(msh),y(msh),u(msh),u(msh));

Its possible to emphasize the FE-mesh in this diagramme with

      fill3(x(msh),y(msh),u(msh),u(msh));
      hold on
      plot3(x(edgemsh),y(edgemsh),u(edgemsh),'k','linewidth',2)
      

The data can be shown unicoloured in side view with

      fill3(x(msh),y(msh),u(msh),ones(size(msh)));
      

For vector valued spaces, the variables of the data values are U{1},..,U{n}.

2D Vectorial data is shown with

      quiver(x,y,U{1},U{2});
      

Its possible to emphasize the FE-mesh in this diagramme with

      quiver(x,y,U{1},U{2});
      hold on
      plot(x(edgemsh),y(edgemsh),'k');
      
Author:
Kersten Schmidt, 2005
Examples:

BGT_0.cc, exactDtN.cc, inhomDirichletBCs.cc, inhomDirichletBCsLagrange.cc, inhomNeumannBCs.cc, and RobinBCs.cc.

Definition at line 112 of file matlab.hh.


Constructor & Destructor Documentation

template<class G >
graphics::MatlabGraphics::MatlabGraphics ( const concepts::Space< G > &  spc,
const std::string  filename,
const uint  dim = 2 
)

Constructor for output of mesh only.

Parameters:
spcSpace which holds the mesh
filenameName base for the files to be written
dimSpatial dimension of the cells

Definition at line 218 of file matlab.hh.

Here is the call graph for this function:

graphics::MatlabGraphics::MatlabGraphics ( concepts::Mesh msh,
const std::string  filename,
const uint  dim = 2,
const uint  points = noPoints 
)

Constructor for output of mesh only.

Parameters:
mshMesh
filenameName base for the files to be written
dimSpatial dimension of the cells
template<class F , class G >
graphics::MatlabGraphics::MatlabGraphics ( const concepts::Space< G > &  spc,
const std::string  filename,
const concepts::Vector< F > &  sol,
const uint  dim = 2,
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
filenameName base for the files to be written
solThe first solution set which should be plotted
dimSpatial dimension of the cells
funFunction of the FE function, e.g. itself.

Definition at line 232 of file matlab.hh.

Here is the call graph for this function:

template<class F , class G >
graphics::MatlabGraphics::MatlabGraphics ( const concepts::Space< G > &  spc,
const std::string  filename,
const concepts::ElementFormula< F, G > &  frm,
const uint  dim = 2 
)

Constructor for output of a element formula.

Parameters:
spcSpace on which the data should be plotted
filenameName base for the files to be written
frmElement formula
dimSpatial dimension of the cells

Definition at line 249 of file matlab.hh.

Here is the call graph for this function:

template<class F >
graphics::MatlabGraphics::MatlabGraphics ( concepts::Mesh msh,
const std::string  filename,
const concepts::PiecewiseFormulaBase< F > &  frm,
const uint  dim = 2,
const uint  points = noPoints 
)

Constructor for output of a scalar formula.

Parameters:
mshMesh
filenameName base for the files to be written
frmFormula
dimSpatial dimension of the cells
pointsNumber of points inside the element (in one direction)

Definition at line 265 of file matlab.hh.

Here is the call graph for this function:

virtual graphics::MatlabGraphics::~MatlabGraphics ( ) [inline, virtual]

Definition at line 164 of file matlab.hh.


Member Function Documentation

void graphics::MatlabGraphics::closeStreams_ ( const uint &  n) [private]

Closes the streams.

void graphics::MatlabGraphics::createStreams_ ( bool  data) [private]

Create the streams.

virtual std::ostream& graphics::MatlabGraphics::info ( std::ostream &  os) const [protected, virtual]

Returns information in an output stream.

Reimplemented from graphics::OutputBase.

template<class F , class G >
void graphics::MatlabGraphics::operator() ( const concepts::Space< G > &  spc,
const concepts::Vector< F > &  sol,
const concepts::ElementFunction< F, G > *  fun = 0 
)

Application operator for output of solutions and functions of it.

Parameters:
spcSpace on which the data should be plotted
solThe first solution set which should be plotted
funFunction of the FE function, e.g. itself.

Definition at line 281 of file matlab.hh.

template<class F , class G >
void graphics::MatlabGraphics::operator() ( const concepts::Space< G > &  spc,
const concepts::Formula< F > &  frm 
)

Application operator for output of a scalar formula.

Parameters:
spcSpace on which the data should be plotted
frmFormula

Definition at line 288 of file matlab.hh.

template<class F , class G >
void graphics::MatlabGraphics::operator() ( concepts::Mesh msh,
const concepts::Formula< F > &  frm,
const uint  points = 5 
)

Application operator for output of a scalar formula.

Parameters:
mshMesh
frmFormula

Definition at line 294 of file matlab.hh.

template<class F >
void graphics::MatlabGraphics::write_ ( concepts::GlobalPostprocess< F > &  postProcess,
BaseOutputCell< F > &  matlab,
bool  data = false 
) [private]

Creates standard streams, writes to streams, writes to file and clear and delete all streams.

Definition at line 301 of file matlab.hh.

Here is the call graph for this function:


Member Data Documentation

Number of vectors written to the files.

Definition at line 214 of file matlab.hh.

Spatial dimension of the space.

Definition at line 212 of file matlab.hh.

Definition at line 194 of file matlab.hh.

std::auto_ptr<std::ofstream> graphics::OutputBase::ofs_ [protected, inherited]

Stream for output file.

Definition at line 85 of file basis.hh.

std::map<std::string, std::ostream*> graphics::MatlabGraphics::s_ptr_ [private]

Pointer to the streams, i.e. *(s_ptr_["vtxmsh"]) for FE mesh.

Definition at line 210 of file matlab.hh.


The documentation for this class was generated from the following file:

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)