vtk-m/tutorial
Kenneth Moreland a17ebdf52a Deprecated vtkm::filter::FilterField
The original design of the filter base class required several specialized
base classes to control what information was pulled from the input
`DataSet` and provided to the derived class. Since the filter base class was
redesigned, the derived classes all get a `DataSet` and pull their own
information from it. Thus, most specialized filter base classes became
unnecessary and removed.

The one substantial exception was the `FilterField`. This filter base class
managed input and output arrays. This was kept separate from the base
`Filter` because not all filters need the ability to select this
information.

That said, this separation has not been particularly helpful. There are
several other features of `Filter` that does not apply to all subclasses.
Furthermore, there are several derived filters that are using `FilterField`
merely to pick a single part, like selecting a coordinate system, and
ignoring the rest of the abilities.

Thus, it makes more sense to deprecate `FilterField` and have these classes
inherit directly from `Filter`.
2024-02-12 08:13:19 +09:00
..
data nested folders removed for tutorial examples 2022-02-07 12:26:13 -05:00
CMakeLists.txt Update tutorial CMakeLists to reflect VTK-m target namespace changes 2023-02-23 10:55:05 +01:00
contour_two_fields.cxx Minor formatting changes to tutorial examples 2022-10-11 18:23:44 -06:00
contour.cxx Minor formatting changes to tutorial examples 2022-10-11 18:23:44 -06:00
error_handling.cxx fixes to the header files included in tutorial examples and CMakeLists.txt 2022-02-07 15:34:18 -05:00
extract_edges.cxx Rename NewFilter base classes to Filter 2022-12-01 13:07:56 -07:00
io.cxx Minor formatting changes to tutorial examples 2022-10-11 18:23:44 -06:00
logging.cxx Update the tutorial README 2022-10-13 14:50:02 -06:00
mag_grad.cxx Deprecated vtkm::filter::FilterField 2024-02-12 08:13:19 +09:00
point_to_cell.cxx Deprecated vtkm::filter::FilterField 2024-02-12 08:13:19 +09:00
README.md Update the tutorial README 2022-10-13 14:50:02 -06:00
rendering.cxx move Actor 2023-06-01 12:36:23 -06:00
two_filters.cxx Minor formatting changes to tutorial examples 2022-10-11 18:23:44 -06:00

VTK-m Tutorial

This page contains materials and instructions for the VTK-m tutorial. Slides are available, and the instructions for getting the example source code exercises are below.

Developers interested in VTK-m should also consult The VTK-m User's Guide, which contains a quick start guide along with detailed documentation of most of VTK-m's features.

Further information is available at https://m.vtk.org.

Downloading VTK-m

The tutorial materials are maintained as part of the VTK-m code repository to help keep the examples up to date. Thus, getting, compiling, and running the tutorial examples is all part of VTK-m itself.

There are two options for getting the VTK-m source code. You could either download a tarball for a release or you can clone the source code directly from the VTK-m git repository.

Downloading a VTK-m Release Tarball

Souce code archives for every VTK-m release are posted on the VTK-m releases page in multiple archive formats. Simply download an archive for the desired version of VTK-m and extract the contents from that archive.

Cloning the VTK-m Git Repository

Developers familiar with git might find it easier to simply clone the VTK-m git repository. The latest VTK-m release is always on the release branch and can be cloned as so.

git clone --branch release https://gitlab.kitware.com/vtk/vtk-m.git

If you are feeling more daring, you can simply clone the main branch with the latest developments.

git clone https://gitlab.kitware.com/vtk/vtk-m.git

Building VTK-m and the Tutorial Examples

To build VTK-m, you will need at a minimum CMake and, of course, a C++ compiler. The VTK-m dependencies list has details on required and optional packages.

When configuring the build with CMake, turn on the VTKm_ENABLE_TUTORIALS option. There are lots of other options available including the ability to compile for many different types of devices. But if this is your first experience with VTK-m, it might be best to start with a simple build.

Here is a list of minimal commands to download and build VTK-m.

git clone --branch release https://gitlab.kitware.com/vtk/vtk-m.git
mkdir vtk-m-build
cd vtk-m-build
cmake ../vtk-m -DVTKm_ENABLE_TUTORIALS=ON
make -j8

The first line above downloads VTK-m using git. You can choose to download a release as described above. Note that if you do so, the source code will be placed in a directory named something like vtk-m-vX.X.X rather than the vtk-m directory you get by default when cloning VTK-m.

Examples

The tutorial contains several examples that can be built and edited. Each example is described in detail in the slides. Here is a brief description of each one, listed from most basic to increasing complexity.

  • io.cxx A bare minimum example of loading a DataSet object from a data file and then writing it out again.
  • contour.cxx A basic example of running a filter that extracts isosurfaces from a data set.
  • contour_two_fields.cxx A simple extension of contour.cxx that selects two of the input fields to be passed to the output.
  • two_filters.cxx Further extends the contour.cxx example by running a sequence of 2 filters. The first extracts the isosurfaces and the second clips the surface by a second fields.
  • rendering.cxx Demonstrates how to render data in VTK-m.
  • error_handling.cxx Demonstrates catching exceptions to react to errors in VTK-m execution.
  • logging.cxx Uses VTK-m's logging mechanism to write additional information to the program output.
  • mag_grad.cxx The implementation of a simple VTK-m filter which happens to take the magnitude of a vector.
  • point_to_cell.cxx A slightly more complicated filter that averages the values of a point field for each cell.
  • extract_edges.cxx A fully featured example of a nontrivial filter that extracts topological features from a mesh.