Commit Graph

476 Commits

Author SHA1 Message Date
Louis Gombert
dcdda3065a Split flying edges and marching cells into separate filters
In order to compile the contour filter more efficiently, we split the contour filter into two separate translation units, corresponding to the new filters ContourFlyingEdges and ContourMarchingCells. The API for Contour filter is left totally unchanged, and tries to use flying edges if the dataset is structured and uniform.
All three contour filters inherit from the `AbstractContour` class, providing utility methods used in the implementations.
2023-05-04 15:20:20 +02:00
Louis Gombert
1d272592e3 Tetrahedralize and Triangulate filters check if input is already triangulated
Previously, tetrahedralize/triangulate would blindly convert all the cells to tetrahedra/triangles, even when they were already. Now, the dataset is directly returned if the CellSet is a CellSetSingleType of tetras/triangles, and no further processing is done in the worklets for CellSetExplicit when all shapes are tetras or triangles.
2023-04-24 12:37:11 +02:00
Kenneth Moreland
de28a43510 Add an entry to VariantUnion to help compiler copy structs
I've been seeing errors in a nightly build that compiles for CUDA Pascal
using GCC5. The issue is that one of the `ArrayHandleMultiplexer` tests
is failing to copy an implicit array correctly. I think the problem is
that in this test the first and second type of the `Variant` are the same
size, but the first type has some padding in the middle whereas the
second type does not. When using this second type, the values in the
same position of the padding of the first type don't seem to be
initialized properly in the kernel invocation.

My nonexhaustive experiment shows that things work OK as long as the
first type is large enough and has no fillers. Enforce this by adding an
internal entry to the union that is completely full.
2023-04-19 11:14:48 -06:00
Louis Gombert
627b757733 Merge topic 'continuous-scatterplot'
4ba15a993 Add new ContinuousScatterPlot filter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3028
2023-04-14 12:01:15 -04:00
Louis Gombert
4ba15a993d Add new ContinuousScatterPlot filter
This new filtered designed for bi-variate analysis builds the continuous scatterplot of a 3D tetrahedralized mesh for two given scalar point fields. The continuous scatterplot is an extension of the discrete scatterplot for continuous bi-variate analysis.
2023-04-14 10:00:33 +02:00
Sujin Philip
1261e459d3 Clip: Remove unused points
The clip filter used to copy the input points and point fields as is,
regardless of if they were actually part of the output. With this change,
we track which input points are actually part of the output and copy
only those values.

Address: #112
2023-04-11 14:35:25 -04:00
Zhe Wang
1fc84b85f9 Merge topic 'distributed_statistics'
d8f3e68d1 add distributed statistics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !3017
2023-03-24 14:51:42 -04:00
Jay
d8f3e68d1d add distributed statistics 2023-03-24 15:19:23 +00:00
Kenneth Moreland
af6218936f Merge topic 'vectraits-for-all'
ac889b500 Implement VecTraits class for all types

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !3018
2023-03-21 12:55:00 -04:00
Dave Pugmire
3efa8bb744 Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into add_visit_file_reader 2023-03-20 10:58:55 -04:00
Dave Pugmire
6a516de22e Add entry for change log. 2023-03-20 10:58:28 -04:00
Kenneth Moreland
94d8698d16 Merge topic 'data-license'
f545feba8 Add changelog for documenting data license
a24358a1a Document source of WarpX files
60559ce9b Document the source of venn250.vtk
796ec9638 Document data that comes from VisIt tutorial
06391c4e6 Clarify license for ECL data

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !3016
2023-03-20 09:42:41 -04:00
Kenneth Moreland
ac889b5004 Implement VecTraits class for all types
The `VecTraits` class allows templated functions, methods, and classes to
treat type arguments uniformly as `Vec` types or to otherwise differentiate
between scalar and vector types. This only works for types that `VecTraits`
is defined for.

The `VecTraits` templated class now has a default implementation that will
be used for any type that does not have a `VecTraits` specialization. This
removes many surprise compiler errors when using a template that, unknown
to you, has `VecTraits` in its implementation.

One potential issue is that if `VecTraits` gets defined for a new type, the
behavior of `VecTraits` could change for that type in backward-incompatible
ways. If `VecTraits` is used in a purely generic way, this should not be an
issue. However, if assumptions were made about the components and length,
this could cause problems.

Fixes #589
2023-03-16 12:59:38 -06:00
Kenneth Moreland
f545feba8f Add changelog for documenting data license 2023-03-14 12:25:21 -06:00
Louis Gombert
b970a6f4c7 Merge topic 'shrink-filter'
67d6780fb Add Shrink filter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !3007
2023-03-09 09:14:01 -05:00
Louis Gombert
67d6780fba Add Shrink filter
This filter shrinks the cells of a DataSet towards their centroid, computed as the average position of the cell points
2023-03-09 09:48:46 +01:00
Kenneth Moreland
58fc99c2f8 Fix fast paths for ArrayRangeCompute
The precompiled `ArrayRangeCompute` function was not following proper fast
paths for special arrays. For example, when computing the range of an
`ArrayHandleUniformPointCoordinates`, the ranges should be taken from the
origin and spacing of the special array. However, the precompiled version
was calling the generic range computation, which was doing an unnecessary
reduction over the entire array. These fast paths have been fixed.

These mistakes in the code were caused by quirks in how templated method
overloading works. To prevent this mistake from happening again in the
precompiled `ArrayRangeCompute` function and elsewhere, all templated forms
of `ArrayRangeCompute` have been deprecated. Most will call
`ArrayRangeCompute` with no issues. For those that need the templated
version, `ArrayRangeComputeTemplate` replaces the old templated
`ArrayRangeCompute`. There is exactly one templated declaration of
`ArrayRangeComputeTemplate` that uses a class, `ArrayRangeComputeImpl`,
with partial specialization to ensure the correct form is used.
2023-03-08 12:36:53 -07:00
Kenneth Moreland
69a9d4a87e Merge topic 'convert-runtime-vec-array'
331a277fe Automatically convert between ArrayHandleBasic and ArrayHandleRuntimeVec

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2994
2023-03-08 14:35:30 -05:00
Kenneth Moreland
2af555f6c9 Simplify serialization of DataSet objects
`vtkm::cont::DataSet` is a dynamic object that can hold cell sets and
fields of many different types, none of which are known until runtime. This
causes a problem with serialization, which has to know what type to compile
the serialization for, particularly when unserializing the type at the
receiving end. The original implementation "solved" the problem by creating
a secondary wrapper object that was templated on types of field arrays and
cell sets that might be serialized. This is not a great solution as it
punts the problem to algorithm developers.

This problem has been completely solved for fields, as it is possible to
serialize most types of arrays without knowing their type now. You still
need to iterate over every possible `CellSet` type, but there are not that
many `CellSet`s that are practically encountered. Thus, there is now a
direct implementation of `Serialization` for `DataSet` that covers all the
data types you are likely to encounter.

The old `SerializableDataSet` has been deprecated. In the unlikely event an
algorithm needs to transfer a non-standard type of `CellSet` (such as a
permuted cell set), it can use the replacement `DataSetWithCellSetTypes`,
which just specifies the cell set types.
2023-03-03 09:17:44 -07:00
Vicente Bolea
5bf0bd57ae Merge topic 'remove-cxx11-references'
ecd4a68ff cxx,c++: Remove c++14 references

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !2999
2023-02-24 11:40:27 -05:00
Vicente Adolfo Bolea Sanchez
ecd4a68ffc cxx,c++: Remove c++14 references
- MSVC C++14 support obtained from: https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-170
- _MSVC_VER taken from https://stackoverflow.com/a/70630/2420872

fixes: #754
2023-02-23 19:30:58 -05:00
Vicente Adolfo Bolea Sanchez
3650b9efd9 release,docs: add freeze release branch step
fixes: #760
2023-02-23 19:14:51 -05:00
Vicente Adolfo Bolea Sanchez
6cd849d703 roadmap: update dates 2023-02-22 12:27:53 -05:00
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
Kenneth Moreland
331a277fe3 Automatically convert between ArrayHandleBasic and ArrayHandleRuntimeVec
The `UnknownArrayHandle` has been updated to allow
`ArrayHandleRuntimeVec` to work interchangeably with basic
`ArrayHandle`. If an `ArrayHandleRuntimeVec` is put into an
`UnknownArrayHandle`, it can be later retrieved as an `ArrayHandleBasic`
as long as the base component type matches and it has the correct amount
of components. This means that an array can be created as an
`ArrayHandleRuntimeVec` and be used with any filters or most other
features designed to operate on basic `ArrayHandle`s. Likewise, an array
added as a basic `ArrayHandle` can be retrieved in an
`ArrayHandleRuntimeVec`. This makes it easier to pull arrays from VTK-m
and place them in external structures (such as `vtkDataArray`).
2023-02-20 07:39:49 -07: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