next up previous contents
Next: 8.8 Snapshot Output Up: 8. A More Modular Previous: 8.6 Command Line Options

8.7 Snapshot Input

The code for snapshot input is straightforward:



\begin{Code}[nbody\_sh1.C: get\_snapshot]
\small\verbatiminput{chap8/nbody_sh1.C.get_snapshot} \end{Code}

Note that we do not check here whether a complete snapshot is being offered on the standard input stream in the right format. It would be better to verify, for example, that new lines
n
occur in the correct places, separating each particle, and that no end-of-file condition is encountered before the whole $N$-body snapshot is read in. In later versions we will provide more complete error checking.



The Art of Computational Science
2004/01/25