#include <matlab.hh>
Public Member Functions | |
template<class G > | |
MatlabGraphics (const concepts::Space< G > &spc, const std::string filename, const uint dim=2) | |
MatlabGraphics (concepts::Mesh &msh, const std::string filename, const uint dim=2, const uint points=noPoints) | |
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) | |
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) | |
template<class F > | |
MatlabGraphics (concepts::Mesh &msh, const std::string filename, const concepts::PiecewiseFormulaBase< F > &frm, const uint dim=2, const uint points=noPoints) | |
template<class F , class G > | |
void | operator() (const concepts::Space< G > &spc, const concepts::Vector< F > &sol, const concepts::ElementFunction< F, G > *fun=0) |
template<class F , class G > | |
void | operator() (const concepts::Space< G > &spc, const concepts::Formula< F > &frm) |
template<class F , class G > | |
void | operator() (concepts::Mesh &msh, const concepts::Formula< F > &frm, const uint points=5) |
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::unique_ptr< std::ofstream > | ofs_ |
Stream for output file. | |
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');
graphics::MatlabGraphics::MatlabGraphics | ( | const concepts::Space< G > & | spc, |
const std::string | filename, | ||
const uint | dim = 2 |
||
) |
graphics::MatlabGraphics::MatlabGraphics | ( | concepts::Mesh & | msh, |
const std::string | filename, | ||
const uint | dim = 2 , |
||
const uint | points = noPoints |
||
) |
Constructor for output of mesh only.
msh | Mesh |
filename | Name base for the files to be written |
dim | Spatial dimension of the cells |
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.
spc | Space on which the data should be plotted |
filename | Name base for the files to be written |
sol | The first solution set which should be plotted |
dim | Spatial dimension of the cells |
fun | Function of the FE function, e.g. itself. |
graphics::MatlabGraphics::MatlabGraphics | ( | const concepts::Space< G > & | spc, |
const std::string | filename, | ||
const concepts::ElementFormula< F, G > & | frm, | ||
const uint | dim = 2 |
||
) |
graphics::MatlabGraphics::MatlabGraphics | ( | concepts::Mesh & | msh, |
const std::string | filename, | ||
const concepts::PiecewiseFormulaBase< F > & | frm, | ||
const uint | dim = 2 , |
||
const uint | points = noPoints |
||
) |
|
inlinevirtual |
|
protectedvirtual |
Returns information in an output stream.
Reimplemented from graphics::OutputBase.
void graphics::MatlabGraphics::operator() | ( | concepts::Mesh & | msh, |
const concepts::Formula< F > & | frm, | ||
const uint | points = 5 |
||
) |
void graphics::MatlabGraphics::operator() | ( | const concepts::Space< G > & | spc, |
const concepts::Formula< F > & | frm | ||
) |
void graphics::MatlabGraphics::operator() | ( | const concepts::Space< G > & | spc, |
const concepts::Vector< F > & | sol, | ||
const concepts::ElementFunction< F, G > * | fun = 0 |
||
) |
|
protectedinherited |