MADNESS
0.10.1
|
trunk/src/examples/functionio.cc
shows how to do this, and the critical lines are Here, f
, g
, and h
are MADNESS functions of any type (they need not have the same type or dimension).MADNESS has a generic mechanism for (de)serializing objects from directional streams, called archives, that avoids confusion with the STL stream concept. Anything can be written to and read from an archive, though user-defined types usually need a little additional code to enable this (see trunk/src/madness/world/archive.h
for documentation). Most archives are sequential objects accessible only to a single process and it makes little sense to write a potentially large function that is distributed across the entire parallel computer to such an archive. For that reason, functions must be written to/from a parallel archive that performs efficient parallel I/O.
Large amounts of data (more than a few gigabytes) will benefit from increasing the number of processors actually doing disk I/O (refer to the relevant parallel archive class for more info).
MADNESS can presently generate uniform grids in formats suitable for several visualization software packages. The following are explicitly supported:
*.dx
file)mraplot
can be used to generate plots from functions stored on disk.OpenDX
OpenDX is an open source visualization software based on IBM's Visualization Data Explorer (www.opendx.org). Please refer to the OpenDX manual for its use. An example configuration file (vizit.cfg
) and a network file (vizit.net
) can be found in the trunk/src/apps/moldft/
directory. Here are some details on creating your own DX files.
Given any MADNESS function f
, you can write to disk a uniform grid over the entire simulation volume with
Additional arguments permit us to change the plot volume (default is the entire simulation volume), the number of points (default is 201) and binary/text format (default is binary). This is a collective operation.
Visualizing this with OpenDX is straightforward, but depends on the number of dimensions. The easiest way is to start OpenDX, click "Import Data ...", enter your filename, and click "Visualize Data". However, you will want to learn how to build your own networks. To display an iso-surface of 3D data, start the visual editor and connect
file-selector --> import --> isosurface --> image
Enter your name in the file-selector, and you should see the picture. You can adjust the isosurface value in the isosurface control or by connecting it to an interactor. Have fun!
VTK format and Paraview
MADNESS can export MADNESS functions to the serial vtkStructuredGrid (.vts) file format, which can be ready by several post-processing visualization packages such as Paraview. To write this data file, you must first define four quantities:
filename
),plotlo
) bound of Cartesian coordinates in each dimension to plot,plothi
) bound,npts
) in each dimension to evaluate.plotlo
and plothi
.After the above four quantities have been defined, three functions must be called:
plotvtk_begin
: Writes the VTK boilerplate header information.plotvtk_data
: Evaluates and writes the MADNESS function at npts
.plotvtk_end
: Writes the VTK boilerplate footer information.plotvtk_data
is done in serial.An example of code for plotting two two-dimensional functions u
and v
in a box with 101 points is as follows:
plotvtk_data
may be called multiple times between plotvtk_begin
and plotvtk_end
function calls.Ntimestep
files, each containing one increment of time.To visualize your functions, Paraview has been extensively tested, although other external visualization packages may also be compatible with the vts
file format. Paraview is an open-source visualization application that is freely downloadable. For information about how to download, install and use Paraview, please consult their webpage at http://www.paraview.org.
Line plots
With a single function call, up to three functions can be simultaneously evaluated at points along a line with the values printed to a file suitable for use by any standard 2D graphics or spreadsheet software. For example, to plot one 4D function (f
) along a line between and with 101 points
To plot two functions (f
and g
) you would use instead
With gnuplot, you can plot the data as follows
gnuplot -persist -e 'set style data lines; plot "plot.txt"'
Previous: MADNESS functions; Next: Load and memory balancing