|Message: Re: The Strangest Problem I've ever met||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
You most definitely do not want to open and read a file during EVERY call to GetFieldValue() -- this will slow your simulation down by a truly enormous factor! You consider "only 3 or 4 min" to be "quickly" -- I routinely track hundreds of particles per second for many meters through magnetic field maps. Even a single sprintf() or sscanf() during tracking slows it down unacceptably.
Arrange the code so you open and read the files ONCE during initialization and keep the results around to use in GetFieldValue(). It is generally better (more general, easier to modify) to use a single file with a field map, rather than multiple files. A good design has the field map file describe its own geometrical structure (boundaries of the map, grid within the map, units, etc.) and the code uses this rather than hard-coded values for the geometry. I strongly recommend an ASCII format, so you can edit it easily, and can write conversion programs from the output of an EM modeling program (superfish, tosca, ...) to the format your simulation reads. Field maps of several tens of megabytes are not a problem on modern computers.
Whenever a track reaches the edge of the world, the track is killed. Similarly, when a track stops (kinetic energy goes to 0 or below a limit set in the program) it is killed unless there is an applicable physics process that makes it get captured or decay (which also kills the track). Just think about it -- how could a track possibly be tracked outside the known world? Or tracked forever while stopped?
Normally, when all tracks have been processed (i.e. tracked until they are killed), the run is ended and the program exits. But you must do this in your main program, as in the examples.
|Inline Depth:||Outline Depth:||Add message:|