The Python plotting routines often allow the user to specify a call back function as plotting parameters, for example ClawPlotAxes has an attribute afteraxes that can be set to a function to be executed after performing all plots on the specified axes. This is useful for setting parameters for these axes that are not covered by the provided attributes, for annotating the plots on these axes, for adding a plot of the true solution, etc.
Call back functions include:
- beforeframe and afterframe attributes of ClawPlotData
- afteraxes attribute of ClawPlotAxes
- afteritem, aftergrid, plot_var, map2d_to_1d attributes of ClawPlotItem
All of these functions are designed to take a single argument current_data, an object with attributes that may be useful to the user in evaluating the function.
Warning
The mapc2p function is one exception that does not take argument current_data.
Some of these may be unavailable because they don’t make sense in the current context, e.g. in a beforeframe function.
q array for current frame, so for example the in a scalar 2d problem the value in the (i,j) cell would be current_data.q[i,j,0] (remember that Python always indexes starting at 0).
In an AMR calculation q will be from the last grid plotted.
aux array for current frame, provided these have been output by the Fortran code. At the moment this requires modifying the library routine outN.f to set outaux = .true. so that fort.a files are produced along with fort.q files. [This should be an input parameter!]
If fort.a files are not found then current_data.aux will be None.
In an AMR calculation aux will be from the last grid plotted.