Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/doc/probe/paper.tex
ViewVC logotype

Diff of /trunk/doc/probe/paper.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 270, Wed Aug 11 15:37:10 2010 UTC revision 271, Wed Aug 11 15:47:35 2010 UTC
# Line 202  Line 202 
202      }\right) h(\vecf_x - i)      }\right) h(\vecf_x - i)
203  \end{displaymath}%  \end{displaymath}%
204  Thus, we see that the kernel $h$ is evaluated $2s$ times per axis (\ie{}, $6s$ times in 3D).  Thus, we see that the kernel $h$ is evaluated $2s$ times per axis (\ie{}, $6s$ times in 3D).
205    \figref{fig:3d-probe-code-c} gives C code for this operation.
206  \begin{figure}[t]  \begin{figure}[p]
207  \begin{quote}  \begin{quote}
208  \lstset{language=C}  \lstset{language=C}
209  \begin{lstlisting}  \begin{lstlisting}
# Line 217  Line 217 
217  {  {
218    double nx, ny, nz, fx, fy, fz;    double nx, ny, nz, fx, fy, fz;
219    
220      fx = modf (x[0], &nx);
221      fy = modf (x[1], &ny);
222      fz = modf (x[2], &nz);
223    
224    // compute kernel values for each axis    // compute kernel values for each axis
225    double hx[4], hy[4], hz[4];    double hx[4], hy[4], hz[4];
226    for (int k = 1-s;  j < s;  k++) {    for (int i = 1-s;  i < s;  i++) {
227      double t = fx - k;      double t;
228      hx[k+s-1] = h[s-k][0] + t*(h[s-k][1] + t*(h[s-k][2] + t*h[s-k][3]));      t = fx - i;
229      double t = fy - k;      hx[i+s-1] = h[s-i][0] + t*(h[s-i][1] + t*(h[s-i][2] + t*h[s-i][3]));
230      hy[k+s-1] = h[s-k][0] + t*(h[s-k][1] + t*(h[s-k][2] + t*h[s-k][3]));      t = fy - i;
231      double t = fz - k;      hy[i+s-1] = h[s-i][0] + t*(h[s-i][1] + t*(h[s-i][2] + t*h[s-i][3]));
232      hz[k+s-1] = h[s-k][0] + t*(h[s-k][1] + t*(h[s-k][2] + t*h[s-k][3]));      t = fz - i;
233        hz[i+s-1] = h[s-i][0] + t*(h[s-i][1] + t*(h[s-i][2] + t*h[s-i][3]));
234    }    }
235    
236    double vx = 0.0    double vx = 0.0
# Line 238  Line 243 
243        }        }
244        vy += vz * hy[j+s-1];        vy += vz * hy[j+s-1];
245      }      }
246      vx += vx * hy[i+s-1];      vx += vx * hx[i+s-1];
247    }    }
248    
249    return vx;    return vx;
# Line 246  Line 251 
251  \end{lstlisting}%  \end{lstlisting}%
252  \end{quote}%  \end{quote}%
253  \caption{Computing $F\mkw{@}\vecx$ for a 3D scalar field in C}  \caption{Computing $F\mkw{@}\vecx$ for a 3D scalar field in C}
254    \label{fig:3d-probe-code-c}
255  \end{figure}  \end{figure}
256    
257  \section{Probing a 3D derivative field}  \section{Probing a 3D derivative field}

Legend:
Removed from v.270  
changed lines
  Added in v.271

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0