M++ uses plotting routines to create .vtu files for any given coefficient FEM Vector.
Plotting is a global routine and can be accessed in multiple ways:
Within the mpp namespace
To access a plot, use the method
mpp namespace. This method returns an object of the type
VtuPlot, which handles data plotting and file generation. To add the data of any Vector
vec, use the overloaded
mpp::plot("NameOfPlot") << vec;
You can use this to add as much data to the plot as you like, given that all Vectors operate on the same Mesh:
mpp::plot("NameOfPlot") << vec1 << vec2;
mpp::plot("NameOfPlot") << vec3;
To create a file, you can either use the
mpp::plot("NameOfPlot") << mpp::save_plot("VtuFileName");
or use the abbreviated command
mpp::plot("NameOfPlot") << mpp::endp;
which creates a file with the name
Of course, these commands can all be done in one line:
mpp::plot("NameOfPlot") << vec1 << vec2 << mpp::endp;
The commands detailed above are abbreviated in some macros:
Single vector plots
When you only need to plot a single vector once, you can use one of the following commands
- The command
creates a .vtu file named vec.vtu containing the data of
- The command
again creates a .vtu file named vec.vtu containing the data of
vec, but distorts the underlying mesh with the displacement vector.
Multiple vector plots
mpp::plot("NameOfPlot") creates a new instance of
VtuPlot, if the name NameOfPlot has not yet been used. When you want to plot a Vector multiple times into multiple files on the same mesh but with different data, as is the case of time dependant problems, you should use the same VtuPlot but a different filename. To abbreviate the command from the previous section, you can either use
to create a .vtu file named vec-step.vtu containing the data of
plot_time_deformed(vec, displacement, step);.
The latter does the same as the single deformed variant, but with the adapted filename.