Commit Graph

452 Commits

Author SHA1 Message Date
Vicente Bolea
17bee1070b Merge topic 'update-to-2.0.0'
dd79a487a release: 2.0.0 release notes
f6b087689 release: update version and License

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2988
2023-02-20 13:27:25 -05:00
Vicente Adolfo Bolea Sanchez
dd79a487a7 release: 2.0.0 release notes 2023-02-18 18:37:26 -05:00
Kenneth Moreland
cdd1dbd7bc Add ArrayHandleRuntimeVec
The new `ArrayHandleRuntimeVec` is a fancy `ArrayHandle` allows you to
specify a basic array of `Vec`s where the number of components of the `Vec`
are not known until runtime. (It can also optionally specify scalars.) The
behavior is much like that of `ArrayHandleGroupVecVariable` except that its
representation is much more constrained. This constrained representation
allows it to be automatically converted to an `ArrayHandleBasic` with the
proper `Vec` value type. This allows one part of code (such as a file
reader) to create an array with any `Vec` size, and then that array can be
fed to an algorithm that expects an `ArrayHandleBasic` of a certain value
type.
2023-02-16 07:04:10 -07:00
Kenneth Moreland
b06d00d524 Merge topic 'pass-field-fixes'
5a141349a Fix the passing of fields in filters

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2985
2023-02-14 12:43:33 -05:00
Kenneth Moreland
5a141349a9 Fix the passing of fields in filters
While updating the user's guide, I noticed a couple of minor problems
with how filters map fields. First, if a filter was using
`CreateResultCoordinateSystem`, it did not respect the
`PassCoordinateSystems` flag. Second, if both an `initializer_list` and
a mode was given to `SetFieldsToPass`, the mode was captured
incorrectly. Both problems are corrected.
2023-02-13 14:06:43 -07:00
Sujin Philip
d05afa72f5 Merge topic 'vtkm-abort'
42c6959be Add Abort execution feature

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2974
2023-02-13 12:41:06 -05:00
Kenneth Moreland
a80de8019a Add support for getting vec sizes of unknown arrays when runtime selected
The `GetNumberOfComponents` and `GetNumberOfComponentsFlat` methods in
`UnknownArrayHandle` have been updated to correctly report the number of
components in special `ArrayHandle`s where the `Vec` sizes of the values
are not selected until runtime.

Previously, these methods always reported 0 because the value type could
not report the size of the `Vec`. The lookup has been modified to query the
`ArrayHandle`'s `Storage` for the number of components where supported.
Note that this only works on `Storage` that provides a method to get the
runtime `Vec` size. If that is not provided, as will be the case if the
number of components can vary from one value to the next, it will still
report 0.

This feature is implemented by looking for a method named
`GetNumberOfComponents` is the `Storage` class for the `ArrayHandle`. If
this method is found, it is used to query the size at runtime.
2023-02-09 11:53:52 -07:00
Kenneth Moreland
d5ba7f4d59 Change VectorMagnitude to work with any type of field
Previously, `VectorMagnitude` only worked with `Vec`s of size 2, 3, or
4. It now works with `Vec`s of any size. It also avoids a memory copy of
non-float types (although it does add a little arithmetic in the
computation).
2023-02-06 15:00:52 -07:00
Sujin Philip
42c6959be3 Add Abort execution feature
Initial changes to add support for aborting execution.
2023-02-06 14:29:58 -05:00
Kenneth Moreland
eddf6df384 Update probe filter to interpolate any field type
Previously, the probe filter only worked on certain `Vec` sizes and
converted many types to floating point.

This change uses the extract component feature to pull data from any
array at its natural component type.

The bad part of this change is that it has to call the worklet
separately for each component in the field. That adds overhead and
probably lowers the cache efficiency. It was implemented this way
because the cell interpolation function does not work with the
recombined vecs returned from extract array.
2023-02-06 06:54:42 -07:00
Kenneth Moreland
0ba818e907 Enable any scalar field in ParticleDensity filters
This is done using the `CastAndCallScalarField` from `FilterField`,
which uses a cast-and-call with a float fallback.
2023-02-04 09:24:25 -05:00
Kenneth Moreland
d38efa87f2 Allow fields of any type in NDHistogram
Use the ability to extract array components to compute bins of
dimensions.
2023-02-04 09:24:23 -05:00
Kenneth Moreland
634847ce20 Change PointAverage to work on fields of any type
The previous version of the `PointAverage` filter used a float fallback
to handle most array types. The problem with this approach other than
converting field types perhaps unexpectantly is that it does not work
with every `Vec` size. This change uses the extract by component feature
of `UnknownArrayHandle` to handle every array type.

To implement this change the `PointAverage` worklet had to be changed to
handle recombined vecs. This change resulted in a feature degridation
where it can no longer be compiled for inputs of incompatible `Vec`
sizes. This feature dates back to when worklets like this were exposed
in the interface. This worklet class is now hidden away from the exposed
interface, so this degredation should not affect end users. There are
some unit tests that use this worklet to test other features, and these
had to be updated.
2023-02-03 14:52:04 -05:00
Kenneth Moreland
0c13917c1e Change CellAverage to work on fields of any type
The previous version of the `CellAverage` filter used a float fallback
to handle most array types. The problem with this approach other than
converting field types perhaps unexpectantly is that it does not work
with every `Vec` size. This change uses the extract by component feature
of `UnknownArrayHandle` to handle every array type.

To implement this change the `CellAverage` worklet had to be changed to
handle recombined vecs. This change resulted in a feature degridation
where it can no longer be compiled for inputs of incompatible `Vec`
sizes. This feature dates back to when worklets like this were exposed
in the interface. This worklet class is now hidden away from the exposed
interface, so this degredation should not affect end users. There are
some unit tests that use this worklet to test other features, and these
had to be updated.
2023-02-03 14:51:40 -05:00
Kenneth Moreland
29ecbbb005 Map fields of any type in MIRFilter
Use the ability to extract array components to handle any array in the
map field.
2023-02-03 08:34:08 -05:00
Kenneth Moreland
a478081dea Clean up point mapping in CleanGrid
Use the `MapFieldPermutation` function when mapping point coordinates
for points that are removed. (This function was already being used for
the rest of the fields.) Also remove some unneeded code in the
`CleanGrid` worklets.
2023-02-02 12:13:54 -05:00
Kenneth Moreland
3a02a45729 Merge topic 'contour-interp-any-field'
719d347fd Update contour filter's field map to work on any field type

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2973
2023-02-02 12:08:14 -05:00
Zhe Wang
2d8b3ef33f Merge topic 'add_statistics_filter'
58acf3a43 add statistics filter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2957
2023-02-01 22:32:34 -05:00
Kenneth Moreland
719d347fd9 Update contour filter's field map to work on any field type
Use the extract component functionality to get data from any type of
array. This prevents converting fields to `vtkm::DefaultFloat` and
supports any size `Vec` in the component.
2023-01-30 13:14:56 -07:00
Kenneth Moreland
fa30d6774c Update the minimum Kokkos required to 3.7
This was suggested by a developer on the Kokkos team.
2023-01-30 09:53:56 -07:00
Jay
58acf3a43f add statistics filter 2023-01-30 10:21:47 +00:00
Jay
90e1e82b86 add composite filter 2023-01-26 04:48:23 +00:00
Kenneth Moreland
1889447d82 Update clip filter's field map to work on any field type
The previous implementation of the map field in the clip filters
(`ClipWithField` and `ClipWithImplicitFunction`) checked for common field
types and interpolated those. If the field value type did not match, it
would either convert the field to floats (which is at odds with what VTK
does) or fail outright if the `Vec` length is not supported.

The map field function for clip has been changed to support all possible
types. It does this by using the extract component functionality to get
data from any type of array.
2023-01-24 11:14:51 -07:00
Kenneth Moreland
eda6dc39f2 Support using arrays with dynamic Vec-likes as output arrays
When you use an `ArrayHandle` as an output array in a worklet (for example,
as a `FieldOut`), the fetch operation does not read values from the array
during the `Load`. Instead, it just constructs a new object. This makes
sense as an output array is expected to have garbage in it anyway.

This is a problem for some special arrays that contain `Vec`-like objects
that are sized dynamically. For example, if you use an
`ArrayHandleGroupVecVariable`, each entry is a dynamically sized `Vec`. The
array is referenced by creating a special version of `Vec` that holds a
reference to the array portal and an index. Components are retrieved and
set by accessing the memory in the array portal. This allows us to have a
dynamically sized `Vec` in the execution environment without having to
allocate within the worklet.

The problem comes when we want to use one of these arrays with `Vec`-like
objects for an output. The typical fetch fails because you cannot construct
one of these `Vec`-like objects without an array portal to bind it to. In
these cases, we need the fetch to create the `Vec`-like object by reading
it from the array. Even though the data will be garbage, you get the
necessary buffer into the array (and nothing more).

Previously, the problem was fixed by creating partial specializations of
the `Fetch` for these `ArrayHandle`s. This worked OK as long as you were
using the array directly. However, the approach failed if the `ArrayHandle`
was wrapped in another `ArrayHandle` (for example, if an `ArrayHandleView`
was applied to an `ArrayHandleGroupVecVariable`).

To get around this problem and simplify things, the basic `Fetch` for
direct output arrays is changed to handle all cases where the values in the
`ArrayHandle` cannot be directly constructed. A compile-time check of the
array's value type is checked with `std::is_default_constructible`. If it
can be constructed, then the array is not accessed. If it cannot be
constructed, then it grabs a value out of the array.
2023-01-23 13:02:40 -07:00
Kenneth Moreland
2061e95efe Add ability to resize ArrayHandleStride
This feature enables the ability to anonomously create an array (such as
with `UnknownArrayHandle::NewInstance()`) and then use that as an output
array. Although resizing `ArrayHandleStride` is a little wonky, it
allows worklets to resize them after creation rather than having to know
what size to make and allocating the array.
2023-01-18 14:29:23 -06:00
Kenneth Moreland
c0e0032e1d Clarify field index ordering in Doxygen
The fields in a `DataSet` are indexed from `0` to `GetNumberOfFields() - 1`.
It is natural to assume that the fields will be indexed in the order that
they are added, but they are not. Rather, the indexing is arbitrary and can
change any time a field is added to the dataset.

To make this more clear, Doxygen documentation is added to the `DataSet`
methods to inform users to not make any assumptions about the order of
field indexing.
2023-01-10 10:42:49 -07:00
Vicente Adolfo Bolea Sanchez
918de30163 release: 2.0.0-rc1 release notes 2022-12-15 18:12:41 -05:00
Kenneth Moreland
99829cf617 Hide Particle class members
The member variables of the `vtkm::Particle` classes are now hidden. This
means that external code will not be directly able to access member
variables like `Pos`, `Time`, and `ID`. Instead, these need to be retrieved
and changed through accessor methods.

This follows standard C++ principles. It also helps us future-proof the
classes. It means that we can provide subclasses or alternate forms of
`Particle` that operate differently. It also makes it possible to change
interfaces while maintaining a deprecated interface.
2022-12-13 13:19:21 -05:00
Vicente Adolfo Bolea Sanchez
049d0cca8c cmake: namespace vtkm export targets 2022-12-09 18:46:56 -05:00
Kenneth Moreland
1f34e0eaa6 Add performance configuration options
Added a name option that allows the same benchmark executable to be used
in multiple benchmark tests. This allows the benchmarks to be separated.
Also added an option to pass customized arguments to the benchmark
executable to overwrite the default values.
2022-12-05 13:20:18 -07:00
Kenneth Moreland
22e2e5ff32 Merge topic 'source-point-dims'
aa7b83bb2 Handle random seed generation better for PerlinNoise
84bc72312 Make source parameters more clear

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2933
2022-12-04 09:27:21 -05:00
Kenneth Moreland
405643ddbb Rename NewFilter base classes to Filter
During the VTK-m 1.8 and 1.9 development, the filter infrastructure was
overhauled. Part of this created a completely new set of base classes. To
avoid confusion with the original filter base classes and ease transition,
the new filter base classes were named `NewFilter*`. Eventually after all
filters were transitioned, the old filter base classes were deprecated.

With the release of VTK-m 2.0, the old filter base classes are removed. The
"new" filter base classes are no longer new. Thus, they have been renamed
simply `Filter` (and `FilterField`).
2022-12-01 13:07:56 -07:00
Kenneth Moreland
84bc723121 Make source parameters more clear
Originally, most of the sources used constructor parameters to set the
various options of the source. Although convenient, it was difficult to
keep track of what each parameter meant. To make the code more clear,
source parameters are now set with accessor functions (e.g.
`SetPointDimensions`). Although this makes code more verbose, it helps
prevent mistakes and makes the changes more resilient to future changes.
2022-12-01 08:13:58 -07:00
Vicente Adolfo Bolea Sanchez
9e7523c903 Update ReleaseRoadmap; add instructions NewRelease 2022-11-28 18:29:20 -05:00
Kenneth Moreland
2ddaa36858 Merge topic 'tube-cell-fields'
2bcc9aa70 Fix handling of cell fields in Tube filter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2911
2022-11-21 16:43:03 -05:00
Kenneth Moreland
3e1339f9a7 Remove deprecated features from VTK-m
With the major revision 2.0 of VTK-m, many items previously marked as
deprecated were removed. If updating to a new version of VTK-m, it is
recommended to first update to VTK-m 1.9, which will include the deprecated
features but provide warnings (with the right compiler) that will point to
the replacement code. Once the deprecations have been fixed, updating to
2.0 should be smoother.
2022-11-17 07:12:31 -06:00
Kenneth Moreland
2d30e6d45a Coordinate systems are stored as Fields
Previously, `DataSet` managed `CoordinateSystem`s separately from `Field`s.
However, a `CoordinateSystem` is really just a `Field` with some special
attributes. Thus, coordiante systems are now just listed along with the
rest of the fields, and the coordinate systems are simply strings that
point back to the appropriate field. (This was actually the original
concept for `DataSet`, but the coordinate systems were separated from
fields for some now obsolete reasons.)
2022-11-11 06:17:58 -07:00
Kenneth Moreland
dbc2364e35 Merge topic 'ghost-cell-api'
a58c2cdac Change how cell ghost levels are set

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2924
2022-11-11 08:00:29 -05:00
Kenneth Moreland
44a976f905 Merge topic 'zfp-output-fields'
478f765db Attach compressed ZFP data as WholeDatSet field

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2910
2022-11-10 12:41:55 -05:00
Kenneth Moreland
bd0a59a3fd Merge topic 'fix-log-scope'
74ed1c4cd Fix VTKM_LOG_SCOPE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2923
2022-11-10 12:18:41 -05:00
Kenneth Moreland
478f765db2 Attach compressed ZFP data as WholeDatSet field
Previously, point fields compressed by ZFP were attached as point fields
on the output. However, using them as a point field would cause
problems. So, instead attache them as `WholeDataSet` fields.

Also fixed a problem where the 1D decompressor created an output of the
wrong size.
2022-11-10 08:18:11 -07:00
Kenneth Moreland
74ed1c4cd0 Fix VTKM_LOG_SCOPE
The `VTKM_LOG_SCOPE` macro was not working as intended. It was supposed
to print a log message immediately and then print a second log message
when leaving the scope along with the number of seconds that elapsed
between the two messages.

This was not what was happening. The second log message was being
printed immediately after the first. This is because the scope was taken
inside of the `LogScope` method. The macro has been rewritten to put the
tracking in the right scope.
2022-11-10 07:12:19 -07:00
Kenneth Moreland
a58c2cdacf Change how cell ghost levels are set
The name of the methods were changed from `AddGhostCellField` to
`SetGhostCellField` since only one field can be marked as the cell
ghost. Also automatically select a field that matches
`GetGlobalCellFieldName` if nothing else is set.
2022-11-09 08:40:37 -07:00
Kenneth Moreland
f3fa4f127a Allow FieldSelection to simultaneously include and exclude fields
The basic use of `FieldSelection` is to construct the class with a mode
(`None`, `Any`, `Select`, `Exclude`), and then specify particular fields
based off of this mode. This works fine for basic uses where the same code
that constructs a `FieldSelection` sets all the fields.

But what happens, for example, if you have code that takes an existing
`FieldSelection` and wants to exclude the field named `foo`? If the
`FieldSelection` mode happens to be anything other than `Exclude`, the code
would have to go through several hoops to construct a new `FieldSelection`
object with this modified selection.

To make this case easier, `FieldSelection` now has the ability to specify
the mode independently for each field. The `AddField` method now has an
optional mode argument the specifies whether the mode for that field should
be `Select` or `Exclude`.

In the example above, the code can simply add the `foo` field with the
`Exclude` mode. Regardless of whatever state the `FieldSelection` was in
before, it will now report the `foo` field as not selected.
2022-11-03 12:57:59 -06:00
Kenneth Moreland
6db2a8ea37 Merge topic 'cont-portal-token'
54f0ef2a8 Support providing a Token to ReadPortal and WritePortal

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2916
2022-11-02 13:06:59 -04:00
Kenneth Moreland
e57d511823 Merge topic 'field-length-checking'
63702d5d1 Check to make sure that the fields in a DataSet are the proper length

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2914
2022-11-02 08:54:04 -04:00
Kenneth Moreland
de7fd6cd61 Merge topic 'particle-density-output-field'
74a8d688e Correct particle density filter output field

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2913
2022-11-02 08:45:21 -04:00
Kenneth Moreland
63702d5d13 Check to make sure that the fields in a DataSet are the proper length
It is possible in a `DataSet` to add a point field (or coordinate system)
that has a different number of points than reported in the cell set.
Likewise for the number of cells in cell fields. This is very bad practice
because it is likely to lead to crashes in worklets that are expecting
arrays of an appropriate length.

Although `DataSet` will still allow this, a warning will be added to the
VTK-m logging to alert users of the inconsistency introduced into the
`DataSet`. Since warnings are by default printed to standard error, users
are likely to see it.
2022-11-01 12:05:59 -06:00
Kenneth Moreland
27b27bde8e Merge topic 'expose-variant'
c029ac113 Expose the Variant helper class

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2907
2022-11-01 13:50:32 -04:00
Kenneth Moreland
74a8d688e5 Correct particle density filter output field
The field being created by `ParticleDensityNearestGridPoint` was supposed
to be associated with cells, but it was sized to the number of points.
Although the number of points will always be more than the number of cells
(so the array will be big enough), having inappropriately sized arrays can
cause further problems downstream.
2022-11-01 11:45:01 -06:00