Printing Data

This tutorial shows how to print data from a simulation.

  • Created 5-29-07; code revision 203

Visualizer Data

We previously have used a pipe to print data to Vis3d application, allowing for the system to be visualized as it runs. To do this, we created a pipe using opstream:

opstream vis_pipe("vis3d");

We then called the PrintVisual? routine that is a part of the MdSimulation class (my_simulation is our instance of MdSimulation:

my_simulation.PrintVisual(vis_pipe);

This essentially tells PrintVisual? where to send the data.

Position Data

Similar to Visualizer data, there is a routine called "PrintPositions?" which will print particle positions. The routine accepts as an argument where to print the data. For instance, we could pass it std::out and it will print it to the screen. Similarly, we could set up a file stream using ofstream and print this data to a file.

std::ofstream positions_file("positions.txt");

Similar to using the visualizer, we would access this as follows:

my_simulation.PrintPositions(positions_file);

Other routines

Other print statements for various types are declared in MdSimulation. They can be used as described above. These include:

See the Glotzilla documentation for more info on these routines, http://spahn.engin.umich.edu/glotzilla/html/