311 |
\label{fig:3d-probe-code-opencl} |
\label{fig:3d-probe-code-opencl} |
312 |
\end{figure} |
\end{figure} |
313 |
|
|
314 |
|
\section{Generalizing to derivative fields} |
315 |
|
To generalize the probe operation to work on derivative fields (\eg{}, $(\nabla^k F)\mkw{@}\vecp$), |
316 |
|
we represent the $\nabla^k$ operation as a $k$-order tensor of partial derivative operators. |
317 |
|
To simplify the presentation, we will restrict the discussion to $3$-dimensional space, |
318 |
|
but it easily generalizes. |
319 |
|
In 3D, a partial-derivative operator has the form |
320 |
|
\begin{displaymath} |
321 |
|
\frac{\partial}{\partial{}x^i \partial{}y^j \partial{}z^k} |
322 |
|
\end{displaymath}% |
323 |
|
where $i$, $j$, and $k$ are the number of levels of differentiation in the $x$, $y$, |
324 |
|
and $z$-axes (respectively). |
325 |
|
The normal convention is to omit explicit mention of axes with zero levels of differentiation, |
326 |
|
but we will be explicit here. |
327 |
|
We use $\mathbf{Id}^n$ to represent the identity operator in $n$-dimensions (i.e., the |
328 |
|
one with zero=-levels of differentiation in all axes). |
329 |
|
|
330 |
|
The product of two partial-derivative operators is formed by summing the exponents; |
331 |
|
for example in 3D we have |
332 |
|
\begin{displaymath} |
333 |
|
\frac{\partial}{\partial{}x^i \partial{}y^j \partial{}z^k} |
334 |
|
\frac{\partial}{\partial{}x^{i'} \partial{}y^{j'} \partial{}z^{k'}} = |
335 |
|
\frac{\partial}{\partial{}x^{i+i'} \partial{}y^{j+j'} \partial{}z^{k+k'}} |
336 |
|
\end{displaymath}% |
337 |
|
The last bit of notation that we need is the $n$-vector of partial-derivative |
338 |
|
operators $\delta^n$, in which the $i$th element has one level of differentiation in the $i$th |
339 |
|
axis (and zero in all other axes). |
340 |
|
For example, |
341 |
|
\begin{displaymath} |
342 |
|
\delta^3 = \left[ |
343 |
|
\frac{\partial}{\partial{}x^1 \partial{}y^0 \partial{}z^0} \quad |
344 |
|
\frac{\partial}{\partial{}x^0 \partial{}y^1 \partial{}z^0} \quad |
345 |
|
\frac{\partial}{\partial{}x^0 \partial{}y^0 \partial{}z^1} |
346 |
|
\right] |
347 |
|
\end{displaymath}% |
348 |
|
For $k > 0$ levels of differentiation in $n$-dimensional space, we have |
349 |
|
\begin{displaymath} |
350 |
|
\nabla^k = \left\{\begin{array}{ll} |
351 |
|
\mathbf{Id}^n & \text{when $k = 0$} \\ |
352 |
|
\delta^n \otimes \nabla^{k-1} & \text{when $k > 0$} \\ |
353 |
|
\end{array}\right. |
354 |
|
\end{displaymath}% |
355 |
|
Consider, for example, the case where $k = 2$. |
356 |
|
\begin{displaymath} |
357 |
|
\nabla^2 = \delta^3 \otimes \delta^3 = \left[\begin{array}{ccc} |
358 |
|
\frac{\partial}{\partial{}x^2 \partial{}y^0 \partial{}z^0} |
359 |
|
& \frac{\partial}{\partial{}x^1 \partial{}y^1 \partial{}z^0} |
360 |
|
& \frac{\partial}{\partial{}x^1 \partial{}y^0 \partial{}z^1} \\ |
361 |
|
\frac{\partial}{\partial{}x^1 \partial{}y^1 \partial{}z^0} |
362 |
|
& \frac{\partial}{\partial{}x^0 \partial{}y^2 \partial{}z^0} |
363 |
|
& \frac{\partial}{\partial{}x^0 \partial{}y^1 \partial{}z^1} \\ |
364 |
|
\frac{\partial}{\partial{}x^1 \partial{}y^0 \partial{}z^1} |
365 |
|
& \frac{\partial}{\partial{}x^0 \partial{}y^1 \partial{}z^1} |
366 |
|
& \frac{\partial}{\partial{}x^0 \partial{}y^0 \partial{}z^2} \\ |
367 |
|
\end{array}\right] |
368 |
|
\end{displaymath}% |
369 |
|
|
370 |
|
When we have a probe of a derivative field $(\nabla^k F)\mkw{@}\vecp$, we will generate code for |
371 |
|
each partial derivative operator $\frac{\partial}{\partial{}x^i\partial{}y^j\partial{}z^k}$ |
372 |
|
separately. |
373 |
|
If $F = V\circledast{}h$, then we will use $h^i(x) h^j(y) h^k(z)$ as the interpolation |
374 |
|
coefficients, where $h^i$ is the $i$th derivative of $h$. |
375 |
|
|
376 |
\section{Probing a 3D derivative field} |
\section{Probing a 3D derivative field} |
377 |
We next consider the case of probing the derivative of a scalar field $F = V\circledast{}h$, where $s$ is the support |
We next consider the case of probing the derivative of a scalar field $F = V\circledast{}h$, where $s$ is the support |
378 |
of $h$. |
of $h$. |