Commit 6daf0f6f authored by Cory Quammen's avatar Cory Quammen Committed by Kitware Robot

Merge topic 'document-field-data-calculator'

e837e0b9 Add formatting to Python Calculator references
830edfa9 Add example that shows how to access field data
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !74
parents bf4b3be4 e837e0b9
Pipeline #106768 passed with stage
in 0 seconds
......@@ -1162,7 +1162,7 @@ Array}).
\subsubsection{Basic tutorial}
Start by creating a Sphere source and applying the Python Calculator to it. As
Start by creating a Sphere source and applying the \ui{Python Calculator} to it. As
the first expression, use the following and apply:
\begin{python}
......@@ -1186,7 +1186,7 @@ calculator. For example, the following is a valid expression:
sin(Normals) + 5
\end{python}
It is very important to note that the Python Calculator has to produce one value
It is very important to note that the \ui{Python Calculator} has to produce one value
per point or cell depending on the Array Association parameter. Most of the
functions described here apply individually to all point or cell values and
produce an array the same dimensions as the input. However, some of them, such
......@@ -1260,7 +1260,7 @@ a different version of the Mandelbrot Set, represented by the same size array.
\item Hold the Shift key down and select both of the Mandelbrot entries in the
Pipeline Inspector, and then go to the Menu Bar, and select \menu{Filter >
Python Calculator}. The two Mandelbrot entries will now be shown as linked, as
inputs, to the Python Calculator. \item In the Properties panel for the Python
inputs, to the \ui{Python Calculator}. \item In the Properties panel for the Python
Calculator filter, enter the following into the Expression box:
\begin{python}
inputs[1].PointData['Iterations'] - inputs[0].PointData['Iterations']
......@@ -1295,7 +1295,7 @@ same way across processes.
\subsubsection{Basic Operations}
The Python calculator supports all of the basic arithmetic operations using the
The \ui{Python Calculator} supports all of the basic arithmetic operations using the
$+$, $-$, $*$ and $/$ operators. These are always applied element-by-element to
point and cell data including scalars, vectors, and tensors. These operations
also work with single values. For example, the following adds 5 to all
......@@ -1352,6 +1352,14 @@ in the expression as \py{t\_index} or \py{time\_index}, and \py{t\_value} or \py
respectively. When dealing with multiple inputs, you can specify the same variable names scoped on the
appropriate input e.g. \py{inputs[0].t\_index}.
In some datasets, field data is used to store global data values not associated with cells or points.
To use field data in a \ui{Python Calculator} expression, access it with the \py{FieldData} dictionary
available in the input as in the following example:
\begin{python}
VolumeOfCell * inputs[0].FieldData['MaterialData'][time_index]
\end{python}
\begin{didyouknow}
Under the cover, the \ui{Python Calculator} uses NumPy. All arrays in the
expression are compatible with NumPy arrays and can be used where NumPy arrays
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment