Commit Graph

7332 Commits

Author SHA1 Message Date
Kenneth Moreland
6afff75501 Modify Variant CastAndCall to have fewer cases in its switch
The previous implementation of `Variant`'s `CastAndCall` generated a
switch statement with 20 cases (plus a default) regardless of how many
types were handled by the `Variant` (with the excess doing nothing
useful). This reduced the amount of code, but caused the compiler to
have to build many more instructions (and optimize for them). This in
turn lead to large compile times and unnecessary large libraries/
executables.

This change makes a different function to use for `CastAndCall` so that
the number of cases in the switch matches exactly the number of types in
the `Variant`'s union.

Because the size of VariantImplDetail.h was getting large, I also
reduced the maximum expansions for the code. This does not seem to
negatively affect compile time, and I doubt it will have an noticible
difference in running time (when in release mode).

I also modified some other parts of this code to match the expansion
without making unnecessary defaults.
2022-03-28 14:14:06 -06:00
Kenneth Moreland
61a44887fd Update vtkm_add_instantiations documentation 2022-03-23 06:34:05 -06: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
6eb9c9876c Add generalized instantiation
Recently, an instantiation method was added to the VTK-m configuration
files to set up a set of source files that compile instances of a template.
This allows the template instances to be compiled exactly once in separate
build files.

However, the implementation made the assumption that the instantiations
were happening for VTK-m filters. Now that the VTK-m filters are being
redesigned, this assumption is broken.

Thus, the instantiation code has been redesigned to be more general. It can
now be applied to code within the new filter structure. It can also be
applied anywhere else in the VTK-m source code.
2022-03-23 06:33:36 -06:00
Kenneth Moreland
b544b8e09f Fix point merge for Marching Cubes with multiple isosurfaces
When the Marching Cubes algorithm merges points together for multiple
isosurfaces, it uses an ArrayHandleZip to combine the isosurface id and
the edge identification. This is to prevent merging points from
different isosurfaces. However, internally this has to do an array copy.

It was doing this copy with `ArrayCopy`. A recent change to that method
made the copy fail for `ArrayHandleZip`. The fix is to change to
`ArrayCopyDevice`.

The reason why this bug was introduced was because there was no test
case for this specific use. A regression test has been updated to test
for this case.
2022-03-21 11:44:36 -06:00
Kenneth Moreland
e1e3d4af2f Merge topic 'scoped-enum-cell-classification'
5d90102f1 Remove deprecated use of vtkm::CellClassification
ccef4d2db Fix scoping of vtkm::CellClassification

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2737
2022-03-21 12:40:05 -04:00
Kenneth Moreland
86f238753b Merge topic 'scoped-enum-field-selection'
08e682601 Remove deprecated use of old unscoped enums in FieldSelection
28aa9b570 Use scoped enum for FieldSelection mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2735
2022-03-21 08:43:24 -04:00
Kenneth Moreland
1053b40bde Merge topic 'scoped-enum-rendering'
2fd8a9b9a Remove deprecated use of old unscoped enums in rendering
e051565d9 Use scoped enums in rendering classes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2736
2022-03-21 08:36:35 -04:00
Kenneth Moreland
821e5f7473 Merge topic 'no-test-compile'
97f5ed640 Remove testing include from ZFP worklet headers
8d5e636ac Enable ci that compiles without testing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !2738
2022-03-21 08:35:47 -04:00
Kenneth Moreland
08e6826017 Remove deprecated use of old unscoped enums in FieldSelection 2022-03-18 13:16:55 -06:00
Kenneth Moreland
28aa9b570f Use scoped enum for FieldSelection mode 2022-03-18 13:14:57 -06:00
Kenneth Moreland
13a3560f40 Merge topic 'rename-field-associations'
f8f41e0ef Update use of field association enumerations
56670dbba Rename field associations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !2733
2022-03-18 13:39:13 -04:00
Kenneth Moreland
97f5ed640f Remove testing include from ZFP worklet headers
Several of the ZFP worklet headers included `vtkm/cont/testing/
MakeTestDataSet.h`. This is a problem because if testing is turned off,
then `MakeTestDataSet.h` attempts to include a file that is not
generated, so the compile just fails if testing is off (and the testing
library is not on). This include must be a remanent of some old testing
code during development. It can be safely removed.
2022-03-18 11:04:37 -06:00
Kenneth Moreland
d0679d868c Merge topic 'histogram-range'
df24ea138 Fix Histogram filter range for DataSet

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2731
2022-03-18 11:08:01 -04:00
Kenneth Moreland
5d90102f1b Remove deprecated use of vtkm::CellClassification 2022-03-17 15:34:01 -06:00
Kenneth Moreland
ccef4d2dbf Fix scoping of vtkm::CellClassification
The cell classifications were using an unscoped enum to define them. The
problem was that the symbols of the enum littered the `vtkm` namespace
without qualification. For example, it defined `vtkm::NORMAL`, which
could easily collide with some other meaning of normal.

Change the cell classification flags to be scoped within
`vtkm::CellClassification`. This thing behaves mostly like a scoped
enum. You can use the values declared within and reference
`vtkm::CellClassification` as a type itself. However, unlike a scoped
enum, `vtkm::CellClassification` items can automatically be cast to and
from `vtkm::UInt8`.
2022-03-17 15:33:57 -06:00
Kenneth Moreland
2fd8a9b9aa Remove deprecated use of old unscoped enums in rendering 2022-03-17 15:28:11 -06:00
Kenneth Moreland
e051565d96 Use scoped enums in rendering classes
We should try to favor scoped enums over unscoped enums for their
enhanced type safety.
2022-03-17 15:28:11 -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
Kenneth Moreland
56670dbbaa Rename field associations
The symbols in `vtkm::cont::Field::Association` have been changed from
`ANY`, `WHOLE_MESH`, `POINTS`, and `CELL_SET` to `Any`, `WholeMesh`,
`Points`, and `Cells`, respectively. The reason for this change is twofold:

  * The general standard that VTK-m follows for `enum struct` enumerators
    is to use camel case (with the first character capitalized), not all
    upper case.
  * The use of `CELL_SET` for fields associated with cells is obsolete. A
    `DataSet` used to support having more than one `CellSet`, and so a
    field association on cells was actually bound to a particular
    `CellSet`. However, that is no longer the case. A `DataSet` has exactly
    one `CellSet`, so a cell field no longer has to point to a `CellSet`.
    Thus the enumeration symbol for `Cells` should match the one for
    `Points`.

For backward compatibility, the old enumerations still exist. They are
aliases for the new names, and they are marked as deprecated, so using them
will result in a compiler warning (on some systems).
2022-03-17 09:36:44 -06:00
Kenneth Moreland
df24ea138d Fix Histogram filter range for DataSet
In the transition of the `Histogram` filter to the new filter types, a
bug was introduced. The `Histogram` filter has an option to set the
range for which to compute the histogram. (The range of the data will be
used instead if none is specified.) This range was properly used when
computing the histogram on a `PartitionedDataSet`. However, when running
on a single `DataSet`, the new filter structure skipped over the
partition code that checked to see if the range was specified. (It also
skipped over the code that properly computed the range in MPI.)

This change properly checks to see if `Execute` was called with a single
`DataSet` and updates the `ComputedRange` appropriately.
2022-03-16 15:47:59 -06:00
Kenneth Moreland
9d6f63b677 Add vtkm_cont_testing to interface of vtkm_cont
Recent changes to VTK-m include changes to MakeDataSet.h that require
the vtkm_cont_testing library to be loaded. This is problematic for
software using an earlier minor revision as they do not expect to need
to include this library.

For now, include vtkm_cont_testing in the interface of vtkm_cont so that
downstream code will load it. This should be a temporary solution. As we
move to new versions of VTK-m, we should break this link and require
downstream components to include it themselves.
2022-03-16 14:44:42 -06:00
Kenneth Moreland
2723cd082b Include UncertainCellSet.h from UnknownCellSet.h
This is mostly to support external code that expects deprecated
behavior. UnknownCellSet/UncertainCellSet replace DynamicCellSet. In the
deprecated class, you could use `ResetCellSetList` without having to
include a secondary file. It would be better to support that now so the
minor change does not break things.
2022-03-16 14:24:29 -06:00
Kenneth Moreland
2b64630674 Enable predicate parameter to ListAll and ListAny
In pretty much any practical circumstance, whenusing `ListAll` or
`ListAny`, you have a list of types on which you run some sort of
predicate on each item in the list to determine whether any or all of
the items match the predicate. To make this easier, add a second
argument to `ListAll` and `ListAny` to provide a predicate that will
automatically be added.

If no predicate is given, then the operation is run directly on the
list. This is implemented by just using an identity operation.
2022-03-08 09:26:35 -07:00
Kenneth Moreland
0f96a6b0be Remove brigand.hpp
GCC 11 is having trouble compiling brigand.hpp at all, even before we
instantiate any templates. Since we no longer need it, let's get rid of
it. It was always placed in an internal namespace.
2022-03-08 07:25:08 -07:00
Kenneth Moreland
8d00bb1644 Deprecate brigand.hpp
Add deprecation warnings to the code whenever someone uses brigand.hpp.
We are no longer supporting this header file, but we'll give code a
chance to transition off of it.

Also added some other deprecation warnings to other header files that
are themselves deprecated but only issued warnings if you used something
in it.
2022-03-08 07:25:08 -07:00
Kenneth Moreland
9562de9457 Remove brigand from DispatcherBase 2022-03-08 07:25:08 -07:00
Kenneth Moreland
a771359d72 Remove brigand from FunctionInterface
Replace with features in `vtkm::List`.
2022-03-08 07:25:08 -07:00
Kenneth Moreland
be8004b01a Remove brigand from ArrayHandleDecorator
Replaced with features provided by `vtkm::List` and some simple
templates now in `vtkm/internal/Meta.h`.
2022-03-08 07:24:53 -07:00
Kenneth Moreland
2eb6fb9dd1 Remove brigand from ArrayHandleCompositeVector
Use new features of vtkm::List instead.
2022-03-08 06:53:05 -07:00
Kenneth Moreland
124f08381b Added ListReduce, ListAll, and ListAny
These new features to VTK-m lists allow you to compute a single value
from a list. `ListReduce` allows you to compute a value based on a
predicate. `ListAll` and `ListAny` use this feature to determine if all
or any of a list of `true_type` or `false_type` objects are true.
2022-03-08 06:53:05 -07:00
Kenneth Moreland
55143ef894 Merge topic 'better-deprecated-headers'
5cb9792bd SurfaceNormal -> SurfaceNormals
b2947a1d7 Improve deprecation support of CellMeasures
5b7893a3f Support deprecated MeshQuality features
d22a509b5 Split CoordinateSystemTransform.h
c238cfea5 Improve deprecation support for moved or renamed headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2718
2022-03-04 14:40:29 -05:00
Li-Ta Lo
5cb9792bdc SurfaceNormal -> SurfaceNormals 2022-03-03 15:28:20 -07:00
Vicente Adolfo Bolea Sanchez
3956115969 unittests: relaxed test thresholds for Ascent 2022-02-22 22:00:32 -05:00
Vicente Bolea
e155e4913d Merge topic 'encapsulate-loguru-namespace'
26c8252dc Loguru: encapsulate loguru
65063ca48 Logging: avoid reinit loguru
2be4da84d Merge branch 'upstream-loguru' into encapsulate-loguru-namespace
9c8dd6045 Loguru: set to track tags instead of branch
dd1d8c134 loguru 2022-02-17 (7c85104f)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !2702
2022-02-17 17:44:25 -05:00
Vicente Adolfo Bolea Sanchez
26c8252dc5 Loguru: encapsulate loguru 2022-02-17 16:03:23 -05:00
Vicente Adolfo Bolea Sanchez
65063ca485 Logging: avoid reinit loguru 2022-02-17 16:03:23 -05:00
Vicente Adolfo Bolea Sanchez
2be4da84d1 Merge branch 'upstream-loguru' into encapsulate-loguru-namespace
# By Loguru Upstream
* upstream-loguru:
  loguru 2022-02-17 (7c85104f)
2022-02-17 16:03:23 -05:00
Vicente Adolfo Bolea Sanchez
9c8dd60453 Loguru: set to track tags instead of branch 2022-02-17 16:03:21 -05:00
Li-Ta Lo
753b32b9a2 Merge topic 'contour_surface_normals'
82a5bde74 use SurfaceNomrals filter rather than worklet

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <morelandkd@ornl.gov>
Merge-request: !2719
2022-02-17 10:07:09 -05:00
Li-Ta Lo
82a5bde744 use SurfaceNomrals filter rather than worklet 2022-02-16 14:59:46 -07:00
Kenneth Moreland
b2947a1d78 Improve deprecation support of CellMeasures
Moved deprecated class to new headers (so that indirect includes still
work).

Changed vtkm::filter::mesh_info::IntegrationType to a scoped enum (which
we favor in VTK-m).

Correct the implementation of the deprecated integration types (which
would not have actually compiled anyway).
2022-02-16 11:36:40 -07:00
Kenneth Moreland
5b7893a3f7 Support deprecated MeshQuality features
Reenable the `vtkm::filter::CellMetric` class and
`vtkm::filter::MetricNames` static variable for backward compatibility.
(Both are of course marked deprecated.)

Also, adjust names in the new `vtkm::filter::mesh_info::CellMetric` to
conform with the rest of VTK-m style for scoped enums.
2022-02-16 11:36:13 -07:00
Kenneth Moreland
d22a509b52 Split CoordinateSystemTransform.h
This header file contained two filters: `CylindricalCoordinateTransform`
and `SphericalCoordinateTransform`. By convention, each header (and
source) file should contain one filter. Now that filters are split into
separate libraries, there is little reason to combine things into header
files.
2022-02-16 07:24:04 -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
a462552c2c use CreateResult that accepts a CoordSystem 2022-02-15 08:08:48 -07:00
Li-Ta Lo
f09032aaaf migrate geometry refinement filters 2022-02-11 20:52:43 -07:00
Kenneth Moreland
eb48d65399 Merge topic 'less-brigand'
8cca11601 Limit size of vtkm::List
9a94270e9 Better implementation of ListAt
ae28519af Fix ICE in MSVC 2017
878e56d97 Reduce the size of lists used when serializing UnknownArrayHandle
18c4b3258 Remove brigand from List.h

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !2700
2022-02-10 20:36:50 -05:00