Commit Graph

32 Commits

Author SHA1 Message Date
Kenneth Moreland
dc112b5169 Enable changing policy used for library compiles
Previously, the PolicyDefault used to compile all the filters was hard-
coded. The problem was that if any external project that depends on VTK-
m needs a different policy, it had to recompile everything in its own
translation units with a custom policy.

This change allows an external project provide a simple header file that
changes the type lists used in the default policy. That allows VTK-m to
compile the filters exactly as specified by the external project.
2020-03-19 15:07:07 -06:00
Kenneth Moreland
8516fa7ac6 Shorten tag name for ArrayHandleCartesianProduct 2020-01-07 07:01:04 -07:00
Kenneth Moreland
d5fe4046c5 Remove instances of ListTag in favor of List 2019-12-06 21:32:36 -07:00
Kenneth Moreland
92db376236 Convert uses of ListTagBase to List 2019-12-06 15:37:46 -07:00
Kenneth Moreland
cd302effb3 Update lists in TypeListTag.h
A new header named TypeList.h and the type lists have been redefined in
this new file. All the types have been renamed from `TypeListTag*` to
`TypeList*`. TypeListTag.h has been gutted to provide deprecated
versions of the old type list names.

There were also some other type lists that were changed from using the
old `ListTagBase` to the new `List`.
2019-12-05 11:05:19 -07:00
Kenneth Moreland
6fc883213c Deprecate ListTag operations
The newer List operations should still work on the old ListTags, so make
those changes first to ensure that everything still works as expected if
given an old ListTag.

Next step is to deprecate ListTagBase itself and move all the lists to
the new types.
2019-12-05 11:27:31 -05:00
Kenneth Moreland
6feb0c3763 Remove invalid arrays when applying policies to fields
Previously when ApplyPolicyFieldOfType was used in cases where not all
of the types matched not all of the storages, those invalid arrays were
replaced with an ArrayHandleDiscard. This unnecessarily increased the
length of the type names used for the resulting ArrayHandleMultiplexer.

Now, ListTagRemoveIf is used to remove any invalid arrays so that the
resulting ArrayHandleMultiplexer only includes the valid arrays.
2019-11-02 11:08:09 -06:00
Kenneth Moreland
5fa02057ae Rely less on overload resolution for ApplyPolicy
Previously, all the ApplyPolicy functions had the same name and used
template resolution to figure out which one to use. This was pretty
clear at first when there was just one for fields and one for cell sets.
But then it grew to several different types, particularly for fields. It
was hard to look at the code and figure out which form of ApplyPolicy
was being used, and compilers were starting to get confused.

Resolve the problem by giving all the methods unique names to make it
clear which one you expect to be called.
2019-09-09 16:08:11 -06:00
Kenneth Moreland
26d7bfd0db Force ArrayPolicy of a specific type to the right template
There is a form of ApplyPolicy that takes a field and a value type and
returns an ArrayHandle with that value type that can be used directly.
This is implemented with an ArrayHandleMultiplexer.

For some reason, this version of ApplyPolicy magically stopped working.
The compiler, for some reason, grabbed a different overload and then
complained because it tried to use the ValueType as a list. I'm not sure
why this didn't get ignored due to SFINAE. (Maybe a compiler bug.)

At any rate, the problem is fixed by renaming that ApplyPolicy to
ApplyPolicyFieldOfType to make it clear what we are doing and to help
the compiler along.
2019-09-09 13:12:56 -06:00
Kenneth Moreland
07c59fcf72 Update filters with secondary fields to use new policy method
Rather than do a CastAndCall on all possible field types when calling a
worklet with two fields (where they all typically get cast to the same
type as the primary field), use the new mechanism with
ArrayHandleMultiplexer to create one code path.

Also update the ApplyPolicy to accept the Field type, which is used to
determine any additional storage types to support.
2019-09-09 08:19:16 -06:00
Kenneth Moreland
3039a18baf Add ability to get an array from a Field for a particular type
This is done through a new version of ApplyPolicy. This version takes
a type of the array as its first template argument, which must be
specified.

This requires having a list of potential storage to try. It will use
that to construct an ArrayHandleMultiplexer containing all potential
types. This list of storages comes from the policy. A StorageList
item was added to the policy.

Types are automatically converted. So if you ask for a vtkm::Float64 and
field contains a vtkm::Float32, it will the array wrapped in an
ArrayHandleCast to give the expected type.
2019-09-09 08:19:15 -06:00
Robert Maynard
d7b2ff04c9 Provide a simpler way to restrict value types for filters 2019-08-06 17:04:07 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Robert Maynard
0a40c620ac Rename ArrayHandleVariant to VariantArrayHandle. 2018-12-27 14:35:56 -05:00
Robert Maynard
f63be1abe6 Update vtkm/filter to work with ArrayHandleVariant 2018-12-27 14:35:56 -05:00
Kenneth Moreland
86a747a117 Add ability to customize filter policy to auxiliary input fields
The field infrastructure has a "trait" that specifies the valid types
for the default active scalar field. Most filters have at most one input
field. The majority of the remaining filters use the same types for
inputs. There are some examples, however, where some auxiliary fields
use different types. This change adds a second template parameter to
FieldTraits to customize the valid types of the input scalar field to
different fields.

These changes are in anticipation of the removal of list specifier tags
on worklet ControlSignature arguments.
2018-10-31 23:51:36 +01:00
Kenneth Moreland
bddad9b386 Remove TryExecute from filters
Now that the dispatcher does its own TryExecute, filters do not need to
do that. This change requires all worklets called by filters to be able
to execute without knowing the device a priori.
2018-10-16 15:59:53 -06:00
Sujin Philip
365d3d3921 Implement DataSet Serialization 2018-09-25 13:58:39 -04:00
Robert Maynard
182f4707e7 vtkm prefers 'using' over typedef. 2018-02-23 10:47:20 -05:00
Sujin Philip
70fcd1d1cc Update CoordinateSystem to use the Virtual Array 2018-01-10 10:19:19 -05:00
Kenneth Moreland
c3a3184d51 Update copyright for Sandia
Sandia National Laboratories recently changed management from the
Sandia Corporation to the National Technology & Engineering Solutions
of Sandia, LLC (NTESS). The copyright statements need to be updated
accordingly.
2017-09-20 15:33:44 -06:00
Robert Maynard
5dd346007b Respect VTK-m convention of parameters all or nothing on a line
clang-format BinPack settings have been disabled to make sure that the
VTK-m style guideline is obeyed.
2017-05-26 13:53:28 -04:00
Kitware Robot
4ade5f5770 clang-format: apply to the entire tree 2017-05-25 07:51:37 -04:00
Robert Maynard
9eb288419e vtkm::filter now deduces the subset of valid field types.
Previously the ApplyPolicy logic was to use the filters
field set, and ignore the policy field set.

But this caused problems, as a filter couldn't express that
it was able to work on all valid types. This caused
certain complex types Vec of Vec's to fail to work properly,
and would cause compile use code paths that would never
be valid for a given policy.
2016-12-30 08:30:44 -05:00
Kenneth Moreland
bb32e40804 Allow all policies to inherit defaults
Previously, all declared policies had to implement every tag required by
the policy, even if it was the same as the default. In addition to being
annoying, this makes us less forward compatible because if we add a new
item to the policy any unchanged policy would become incorrect.

This change moves the default policy declarations from the default
policy to PolicyBase. The default policy inherits all of them without
any change. Other policies need only override those that are different
than the default.
2016-11-23 14:00:49 -07:00
Kenneth Moreland
fdaccc22db Remove exports for header-only functions/methods
Change the VTKM_CONT_EXPORT to VTKM_CONT. (Likewise for EXEC and
EXEC_CONT.) Remove the inline from these macros so that they can be
applied to everything, including implementations in a library.

Because inline is not declared in these modifies, you have to add the
keyword to functions and methods where the implementation is not inlined
in the class.
2016-11-15 22:22:13 -07:00
Kenneth Moreland
adfb0bba55 Fix ApplyPolicy for CoordinateSystem objects
There was a mismatch in the ApplyPolicy function for CoordinateSystem
objects. The return type declared for the function was not the same as
the type of object actually returned.

Also added a test that actually uses a filter with a CoordinateSystem as
a field to actually test this functionality.
2016-10-23 11:51:09 -04:00
Robert Maynard
5e200528ee Allow filters to have finer control on what cell sets they support
Certain algorithms like VertexClustering only work on certain cellset types.
It is pointless to generate the code paths for structured data cell sets,
when the algorithm can't operate on those dataset types.
2016-05-26 11:32:35 -04:00
Robert Maynard
c0bd0a67d4 Add missing new lines and #endif comments to vtkm::filter 2016-04-07 17:09:11 -04:00
Robert Maynard
2d3d157ecd Properly use the policy to determine the coordiante policy conversions. 2016-03-29 10:12:49 -04:00
Robert Maynard
f699c98602 Renamed the ``Convert` method to `ApplyPolicy``
The original name was a really bad name, so thank to Ken for suggesting
a better name.
2016-03-14 08:39:17 -04:00
Robert Maynard
bcee827097 First draft of vtkm::filter design. 2016-03-14 08:39:17 -04:00