Commit Graph

23 Commits

Author SHA1 Message Date
Kenneth Moreland
c802adcbeb Add support for CastAndCallVariableVecField in FilterField
The `FilterField` class provides convenience functions for subclasses to
determine the `ArrayHandle` type for scalar and vector fields. However, you
needed to know the specific size of vectors. For filters that support an
input field of any type, a new form, `CastAndCallVariableVecField` has been
added. This calls the underlying functor with an `ArrayHandleRecombineVec`
of the appropriate component type.

The `CastAndaCallVariableVecField` method also reduces the number of
instances created by having a float fallback for any component type that
does not satisfy the field types.
2023-05-22 10:14:59 -06: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
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
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
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
2945813755 Removed ExecutionWholeArray class
`ExecutionWholeArray` is an archaic class in VTK-m that is a thin wrapper
around an array portal. In the early days of VTK-m, this class was used to
transfer whole arrays to the execution environment. However, now the
supported method is to use `WholeArray*` tags in the `ControlSignature` of
a worklet.

Nevertheless, the `WholeArray*` tags caused the array portal transferred to
the worklet to be wrapped inside of an `ExecutionWholeArray` class. This
is unnecessary and can cause confusion about the types of data being used.

Most code is unaffected by this change. Some code that had to work around
the issue of the portal wrapped in another class used the `GetPortal`
method which is no longer needed (for obvious reasons). One extra feature
that `ExecutionWholeArray` had was that it provided an subscript operator
(somewhat incorrectly). Thus, any use of '[..]' to index the array portal
have to be changed to use the `Get` method.
2022-10-27 15:07:41 -06:00
Kenneth Moreland
ad1e7b5bdb Add module mechanism
This mechanism sets up CMake variables that allow a user to select which
modules/libraries to create. Dependencies will be tracked down to ensure
that all of a module's dependencies are also enabled.

The modules are also arranged into groups.
Groups allow you to set the enable flag for a group of modules at once.
Thus, if you have several modules that are likely to be used together,
you can create a group for them.

This can be handy in converting user-friendly CMake options (such as
`VTKm_ENABLE_RENDERING`) to the modules that enable that by pointing to
the appropriate group.
2022-10-26 12:51:05 -06:00
Mathieu Westphal
70ba476bd5 Fix doxygen groups 2022-09-09 10:37:31 +08:00
Dave Pugmire
fbe78b45cf Change all usage of IsField* to Is*Field. 2022-08-29 14:42:02 -04:00
Li-Ta Lo
69e7100e3d remove redundant Run overload 2022-08-08 14:28:11 -06:00
Sujin Philip
6d254d3e60 Fix StructuredPointGradient for Uniform Point Coordinates
The scalar field difference along x, y, and z should be divided by the
spacing not multiplied. This was causing some test failures in VTK and
ParaView when overriding the default contour filter with `vtkmContour`.
2022-04-28 12:50:09 -04:00
Kenneth Moreland
a96f2a32b4 Merge topic 'gradient-test'
3b0cdcec2 Add tests for divergence, vorticity, and q criterion

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2739
2022-04-01 10:11:43 -04:00
Kenneth Moreland
1c1881d53e Declare methods for instances out of line
For the templated methods that we are precompiling instances for, do not
put their implementation inside of the class declaration. The problem is
that if you define a method inside of a class, it is implicitly inline.
If it is inline, a compiler might choose to compile it even if an
external symbol exists.
2022-03-23 06:33:45 -06:00
Kenneth Moreland
13de2b7303 Protect gradient instantiations from ambiguity
It appears that some compilers treat template instances different than
calling a template. For example, if you have

```cpp
template <typename T, typename U>
void Foo(T t, U u);

template <typename T>
void Foo(T t, int u);

template void Foo(int t, int u);
```

that some compilers will complain that the instance is ambiguous because
it matches both versions of Foo even though the second one is the one
that is called (unless you specifically declare template parameters).

This is what happend with the gradient instances. Fix the problem by
wrapping the "ambiguous" cases to be called by a simple, single
templated function.
2022-03-23 06:33:41 -06:00
Kenneth Moreland
f4de1d8ee2 Compile instantiations of the gradient filter
When the gradient filter was moved over to the new filter structure, it
lost its instantiations. This is a problem because the gradient filter,
which compresses a lot of the code into single worklet calls for
efficiency, is one of the longest to compile filters.

This commit restores the instantiations with the updated instantiation
functionality. This breaks up the code into many translation units that
can be compiled simultaneously and thus not hold up the entire compile
on one process.
2022-03-23 06:33:41 -06:00
Kenneth Moreland
3b0cdcec27 Add tests for divergence, vorticity, and q criterion
The gradient filter has the ability to compute divergence, vorticity,
and q criterion. However, none of the gradient tests were actually
testing the result of these computations. At best, one of the tests was
checking that the arrays were created, but never actually looking at the
values.

For one of the gradient tests, this change computes these 3 values and
checks the results, which look reasonable compared to ParaView.
2022-03-18 12:58:57 -06:00
Kenneth Moreland
f8f41e0ef5 Update use of field association enumerations
The enumerations in `vtkm::cont::Field::Association` were renamed in the
previous commit. The old names still exist, but are deprecated. Change
the rest of the code to use the new names.
2022-03-17 11:02:37 -06:00
Li-Ta Lo
5cb9792bdc SurfaceNormal -> SurfaceNormals 2022-03-03 15:28:20 -07:00
Kenneth Moreland
c238cfea50 Improve deprecation support for moved or renamed headers
VTK-m has a deprecation method that supports API changes in minor
releases. When an API change is made, the old API is marked with the
VTKM_DEPRECATED macro. If code attempts to use the old API, it still
works, but the compiler issues a warning that the thing is deprecated
and where to find the new API.

We have recently run into an issue when the API changes have a header
file renamed or moved. We still keep the old header file with the old
API, so code including that file will still work. However, sometimes
code expected the contents of that header file without directly
including that header file. In these cases, the code could get an error
about missing classes.

As an example, consider the change from `DynamicCellSet` to
`UnknownCellSet`/`UncertainCellSet`. The deprecated `DynamicCellSet` is
still around. But there is a lot of code that did not directly include
DynamicCellSet.h. This header file was necessarily included by
DataSet.h. Now, when this code uses `vtkm::cont::DynamicCellSet`, you
get a confusing error that the class does not exist. Backward
compatibility broken.

In response to this, we should be more careful about where we put the
deprecated API. Instead of containing the deprecated API, moved headers
should be empty except for a warning and an inclusion of the new header
file. The deprecated API should be moved to the new header file. For
example, in the case of `DynamicCellSet`, the implementation for the
deprecated `DynamicCellSet` is moved to UnknownCellSet.h, which is
included by anything that was including DynamicCellSet.h before.
2022-02-16 07:08:05 -07:00
Li-Ta Lo
d41e1e40f0 remove ALL_BACKENDS 2022-02-09 16:15:08 -07:00
Li-Ta Lo
6a465e8bed tidy-up language usage 2022-02-02 12:44:00 -07:00
Li-Ta Lo
79afd73b31 explicitly use CoordinateSystem as input field 2022-01-31 09:52:25 -07:00
Li-Ta Lo
cdc4c29c5f renamve vector_calculus -> vector_analysis 2022-01-31 08:58:38 -07:00