Skip to content

Commit

Permalink
Add VTKm Probe filter for regular grid resampling (#1247)
Browse files Browse the repository at this point in the history
* Provide an uniform grid sampling of an in input mesh
  • Loading branch information
nicolemarsaglia committed May 8, 2024
1 parent 32d0848 commit 109e128
Show file tree
Hide file tree
Showing 69 changed files with 3,465 additions and 3 deletions.
79 changes: 79 additions & 0 deletions src/docs/sphinx/Actions/Examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,84 @@ Resulting image:

.. image:: examples/tout_cell_gradient_mag_radial100.png


An example of using the uniform sample grid filter on a 20x20x20 hexahedron mesh to sample a grid that is smaller in each dimension by 10.
---------------------------------------------------------------------------------------------------------------------

YAML actions:

.. literalinclude:: examples/tout_uniform_smaller_by10_grid100.yaml

Resulting image:

.. image:: examples/tout_uniform_smaller_by10_grid100.png

An example of using the uniform sample grid filter on a 20x20x20 hexahedron mesh to sample a grid that is equal in dimensions.
---------------------------------------------------------------------------------------------------------------------

YAML actions:

.. literalinclude:: examples/tout_uniform_equal_grid100.yaml

Resulting image:

.. image:: examples/tout_uniform_equal_grid100.png

An example of using the uniform sample grid filter on a 20x20x20 hexahedron mesh to sample a grid that is equal in dimensions but with smaller spacing between points.
---------------------------------------------------------------------------------------------------------------------

YAML actions:

.. literalinclude:: examples/tout_uniform_grid_equal_dims_decrease_spacing100.yaml

Resulting image:

.. image:: examples/tout_uniform_grid_equal_dims_decrease_spacing100.png

An example of using the uniform sample grid filter on a 20x20x20 hexahedron mesh to sample a grid that is equal in dimensions but with larger spacing between points.
---------------------------------------------------------------------------------------------------------------------

YAML actions:

.. literalinclude:: examples/tout_uniform_grid_equal_dims_increase_spacing100.yaml

Resulting image:

.. image:: examples/tout_uniform_grid_equal_dims_increase_spacing100.png

An example of using the uniform sample grid filter on a 20x20x20 hexahedron mesh to sample a grid that is equal in dimensions but with a shifted origin.
---------------------------------------------------------------------------------------------------------------------

YAML actions:

.. literalinclude:: examples/tout_uniform_grid_shift_origin100.yaml

Resulting image:

.. image:: examples/tout_uniform_grid_shift_origin100.png

An example of using the uniform sample grid filter on a 20x20x20 hexahedron mesh to sample a grid that has larger dimensions by 5.
---------------------------------------------------------------------------------------------------------------------

YAML actions:

.. literalinclude:: examples/tout_uniform_larger_by5_grid100.yaml

Resulting image:

.. image:: examples/tout_uniform_larger_by5_grid100.png

An example of using the uniform sample grid filter on a 20x20x20 hexahedron mesh to sample a grid that has larger dimensions by 5 and with a disproportionately large invalid_value.
---------------------------------------------------------------------------------------------------------------------

YAML actions:

.. literalinclude:: examples/tout_uniform_larger_by5_grid_with_invalid_value100.yaml

Resulting image:

.. image:: examples/tout_uniform_larger_by5_grid_with_invalid_value100.png

An example of using the streamline filter and associated tube parameters to produce a rendering.
--------------------------------------------------------------------------------------------------

Expand All @@ -778,6 +856,7 @@ Resulting image:
.. image:: examples/tout_streamline_render100.png



An example of using the xray extract.
--------------------------------------

Expand Down
25 changes: 25 additions & 0 deletions src/docs/sphinx/Actions/Pipelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,31 @@ the data set has more than one domain. Without ghost, the averaging will not be
params["association"] = "vertex"; // output field association
// or params["association"] = "element"; // output field association

Uniform Grid
~~~~~~~~~~~~~~~~~~~~~
Uniform Grid filter changes the coordinate system of the input mesh to that of the user-specified regular mesh. Input fields are transferred by sampling the data at the vertex locations of the output geometry. For the output geometry, users must specify the field (`field`) to be sampled, and have the option to specify the origin (`origin`), the number of points along each axis (`dims`) from the origin, and the spacing between these points (`spacing`).

For distributed data, the final output of this filter is composited on the root process, and ties for sampled points are handled by taking the average of all valid values.
.. code-block:: c++

conduit::Node pipelines;
// pipeline 1
pipelines["pl1/f1/type"] = "sample_grid";
//params optional
conduit::Node &params = pipelines["pl1/f1/params"];
params["field"] = "dist"; //required
params["origin/x"] = 0.0; //default: minimum point in x dim
params["origin/y"] = 0.0; //default: minimum point in y dim
params["origin/z"] = 0.0; //default: minimum point in z dim
params["dims/i"] = 10.0; //default: x extents
params["dims/j"] = 10.0; //default: y extents
params["dims/k"] = 10.0; //default: z extents
params["spacing/dx"] = 1.0; //default: 1.0
params["spacing/dy"] = 1.0; //default: 1.0
params["spacing/dz"] = 1.0; //default: 1.0
//field value for sampled points outside of input mesh
params["invalid_value"] = -100.0; //default: 0.0

Gradient
~~~~~~~~
Computes the gradient of a vertex-centered input field for every element
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/docs/sphinx/Actions/examples/tout_uniform_equal_grid100.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
params:
dims:
i: 20
j: 20
k: 20
invalid_value: -10.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_equal_grid"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_grid_default_values"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
params:
spacing:
dx: 0.5
dy: 0.5
dz: 0.5
invalid_value: -10.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_grid_equal_dims_decrease_spacing"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
params:
spacing:
dx: 2.0
dy: 2.0
dz: 2.0
invalid_value: -10.0
f2:
type: "slice"
params:
point:
x: 0.0
y: 0.0
z: 0.0
normal:
x: 0.0
y: 0.0
z: 1.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_grid_equal_dims_increase_spacing"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
params:
origin:
x: -5.0
y: -5.0
z: -5.0
invalid_value: -10.0
f2:
type: "slice"
params:
point:
x: 0.0
y: 0.0
z: 0.0
normal:
x: 0.0
y: 0.0
z: 1.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_grid_shift_origin"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
params:
origin:
x: 0.0
invalid_value: -10.0
f2:
type: "slice"
params:
point:
x: 0.0
y: 0.0
z: 0.0
normal:
x: 0.0
y: 0.0
z: 1.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_grid_shift_origin_x"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
params:
origin:
y: 0.0
invalid_value: -10.0
f2:
type: "slice"
params:
point:
x: 0.0
y: 0.0
z: 0.0
normal:
x: 0.0
y: 0.0
z: 1.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_grid_shift_origin_y"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#An example of using the uniform grid filter.

-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "uniform_grid"
params:
origin:
z: 0.0
invalid_value: -10.0
f2:
type: "slice"
params:
point:
x: 0.0
y: 0.0
z: 0.0
normal:
x: 0.0
y: 0.0
z: 1.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "braid"
pipeline: "pl1"
image_prefix: "/home/user/ascent/build/tests/_output/tout_uniform_grid_shift_origin_z"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 109e128

Please sign in to comment.