next up previous
Next: Updating Buffers Up: Customizing CLUSTEREASY Previous: CLUSTEREASY Variables

Looping Over the Grid

As described in section 7.2, each processor stores n values in the $i$ direction and N values in each other direction. In addition, each processor stores one extra ``buffer'' value of $i$ at each end of its grid for calculating spatial derivatives. To loop over all gridpoints in 3D, for example, you would write

\begin{displaymath}
for(i=1;i \le n;i++) \;\;\;\; for(j=0;j<N;j++) \;\;\;\; for(k=0;k<N;k++)
\end{displaymath} (7.1)

The macro LOOP automatically does this looping correctly. If you are calculating the average of a quantity across the entire lattice you will need to gather the results from all the processors after the loop is completed. The simplest way to do this is with the functions MPI_Reduce() or MPI_Allreduce(). These are explained in any standard reference on MPI, and you can find examples of them in CLUSTEREASY.




Go to The LATTICEEASY Home Page
Go to Gary Felder's Home Page
Send email to Gary Felder at gfelder@email.smith.edu
Send email to Igor Tkachev at Igor.Tkachev@cern.ch

This documentation was generated on 2008-01-21