Charcoal/Flow of the Program

The Program executes as follows:
PDM= ParticleDispsersManager Class PD= ParticleDisperser Class

The PDM first loads the data set parameters from a file (on every node) in the PDM construtor.

Next, aside from calling ApproxData, the flow of the program depends on whether the head node or other nodes are running the code.

On the head node:

The ManageHead is called. In this function ApproxData is called where the code from the Trapazoid program is executed and the result of which is used to calculate a variable. The head node then distributes to each non head node index number of the data set that needs to be calculated next, namely the node rank-1. The head node then distributes the index number of the next data set that needs to be calculated to a node as it complete its computation (or quits if there are fewer datasets than nodes) until all data sets have been calculated and all nodes have been told to quit. The head node then quits and the program ends here.

On the non head nodes:

The rest of the nodes call ManageNonHeads in which ApproxData is called, where the code from the Trapazoid program is executed and the result of which is used to calculate a variable. The non head nodes then proceed to calculate data, write it to a file both as numbers and as a .ppm mapping the concentrations. The node then notifies the head node it has completed its task, receives then next index to calculate, and either calculates that data and repeats this process, or terminates if the index value is larger than the number of data sets.

Notes on a few functions
RunTrapazoid Currently produces the the integral of the gamma function, given a certain input, over a range (a,b). Currently b is set to the arbitrary distance of a+1024. The value of a, however, will need to change as the x variable within the program changes. Instead of recalculating the integral as this x variable changes, we can use the fact that a changes inversely with x so the largest a will result when x=1. We can then calculate the integral between values of x and memoize this data so that the entire integral needs to be calculated only once. This memoized data can then be assembled to equal the portion of the function integral needed for the calculation of the concentration at point (x,y).