void evalr(Complex (*func)(d3vec,double),double dparam)Input:
- func: function to be evaluated for all grid points
- dparam: parameter to be passed to the function
Output:
- dat[i][j][k]: set to values of func(r,dparam) evaluated on real-space grid-point r corresponding to [i][j][k], wrapping the periodic boundary conditions around the point i=j=k=0.
Add a function of the above prototype to the definition of the pvector class; this utility will make our job of doing physics simpler.
Important: ``Wrapping'' around i=j=k=0 means that, for all grid points, you always take the closest periodic image to the origin. For instance, i=N-1 is the point just before the end of the array (i=N), which by periodic boundary conditions is equivalent to i=0. Thus, we interpret i=N-1 as the point x=-1*d, where d is the grid spacing. Thus, in general, to map points [i][j][k] to vectors in space, we use the following translation: