Commit Graph

26 Commits

Author SHA1 Message Date
Kenneth Moreland
9b992dcdde Add GetNumberOfComponentsFlat method to ArrayHandle
Getting the number of components (or the number of flattened components)
from an `ArrayHandle` is usually trivial. However, if the `ArrayHandle` is
special in that the number of components is specified at runtime, then it
becomes much more difficult to determine.

Getting the number of components is most important when extracting
component arrays (or reconstructions using component arrays) with
`UnknownArrayHandle`. Previously, `UnknownArrayHandle` used a hack to get
the number of components, which mostly worked but broke down when wrapping
a runtime array inside another array such as `ArrayHandleView`.

To prevent this issue, the ability to get the number of components has been
added to `ArrayHandle` proper. All `Storage` objects for `ArrayHandle`s now
need a method named `GetNumberOfComponentsFlat`. The implementation of this
method is usually trivial. The `ArrayHandle` template now also provides a
`GetNumberOfComponentsFlat` method that gets this information from the
`Storage`. This provides an easy access point for the `UnknownArrayHandle`
to pull this information.
2023-10-03 10:31:38 -04:00
Sujin Philip
01bacbcde0 Advanced Compute Range
Add support for masks, vector magnitude range (L2 norm), and finite values only
range computations.
2023-07-04 11:54:56 -04:00
Sujin Philip
b0715e14af ArrayHandle::StorageType should be public
StorageType is public in vtkm::cont::ArrayHandle, but some subclasses  
re-declare it as private. Having it public provides a convenient way to  
get the storage type of an ArrayHandle, otherwise it is quite verbose.

Addresses: #314
2023-04-14 11:26:37 -04:00
Kenneth Moreland
05f144eb19 Allow ArrayHandle to have a runtime selectable number of buffers
Previously, the number of buffers held by an `ArrayHandle` had to be
determined statically at compile time by the storage. Most of the time
this is fine. However, there are some exceptions where the number of
buffers need to be selected at runtime. For example, the
`ArrayHandleRecombineVec` does not specify the number of components it
uses, and it needed a hack where it stored buffers in the metadata of
another buffer, which is bad.

This change allows the number of buffers to vary at runtime (at least at
construction). The buffers were already managed in a `std::vector`. It
now no longer forces the vector to be a specific size.
`GetNumberOfBuffers` was removed from the `Storage`. Instead, if the
number of buffers was not specified at construction, an allocation of
size 0 is done to create default buffers.

The biggest change is to the interface of the storage object methods,
which now take `std::vector` instead of pointers to `Buffer` objects.
This adds a little hastle in having to copy subsets of this `vector`
when a storage object has multiple sub-arrays. But it does simplify some
of the templating.
2022-07-11 07:48:25 -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
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
c55d15f397 Deprecate ArrayHandle::ExecutionTypes
The newer version of `ArrayHandle` no longer supports different types of
portals for different devices. Thus, the `ReadPortalType` and
`WritePortalType` are sufficient for all types of portals across all
devices.

This significantly simplifies supporting execution objects on devices,
and thus this change also includes many changes to various execution
objects to remove their dependence on the device adapter tag.
2021-02-08 12:17:37 -07:00
Kenneth Moreland
5ef4e7eeee Make new style of ArrayHandle the expected style
What was previously declared as `ArrayHandleNewStyle` is now just the
implementation of `ArrayHandle`. The old implementation of `ArrayHandle`
has been moved to `ArrayHandleDeprecated`, and `ArrayHandle`s still
using this implementation must declare `VTKM_ARRAY_HANDLE_DEPRECATED` to
use it.
2021-01-12 07:17:53 -07:00
Kenneth Moreland
f800718947 Convert ArrayHandleDecorator to new buffer-style arrays
It should be noted that a break in backward compatibility is introduced.
The implementation class passed to `ArrayHandleDecorator` changed the
specification of `AllocateSourceArrays`. Thus, decorators that were
previously allocatable now no longer will be until that method is
updated to the new form.
2020-11-19 12:29:16 -07:00
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Kenneth Moreland
f639e152db Fix ICE in VS 2015
After lots of experimenting, it appears that VS 2015 has problems when
you list a variate template argument before a normal template argument
in a specialization of a function, The compiler seems happy when the
variate argument is placed at the end of the template arguments.
2020-03-16 17:12:16 -06:00
Kenneth Moreland
625a6b4a93 Fix CUDA parse error
The nvcc compiler was having problem resolving a template partial
specialization that contained a template param with its own number
list and another param that depended on that template.
2020-03-16 17:12:16 -06:00
Kenneth Moreland
6f0edbec24 Move from tao::tuple to vtkm::Tuple
The new version of vtkm::Tuple should be faster. It also gives us more
control over the implementation and can provide some VTK-m specific
things.
2020-03-16 17:12:16 -06:00
Kenneth Moreland
ec34cb56c4 Use new ways to get array portal in control environment
Also fix deadlocks that occur when portals are not destroyed
in time.
2020-02-26 13:10:46 -07:00
Kenneth Moreland
76ce9c87f0 Support using Token calling PrepareForExecution in ExecutionObject
The old version of ExecutionObject (that only takes a device) is still
supported, but you will get a deprecated warning if that is what is
defined.

Supporing this also included sending vtkm::cont::Token through the
vtkm::cont::arg::Transport mechanism, which was a change that propogated
through a lot of code.
2020-02-25 07:41:39 -07:00
Allison Vacanti
88bf38afe2 Add support for ArrayHandleDecorator resizing.
Fixes #428.
2019-12-20 17:03:36 -05:00
Allison Vacanti
5834c28521 Add cont/exec markup to ArrayHandleDecorator docs. 2019-12-20 16:18:09 -05:00
Allison Vacanti
5b1280600d Cleanup reference types when using declval.
When expanding variadic parameter packs in ArrayHandleDecorator
implementations, make sure that the types used are appropriate.
Since std::declval is used to test whether or not a method with
specific arguments exists, it is important that the reference types
are correct to ensure that the detection works as expected.

Portals are always passed to implementation functions as rvalue
references, and array handles are always passed as lvalue refs.
2019-12-20 16:17:30 -05:00
Allison Vacanti
b6b20f086e Use brigand integer sequences on icc. 2019-12-11 09:26:15 -05:00
Allison Vacanti
56b4fa9a31 MSVC 2019 needs a different integer sequence impl, too. 2019-10-09 10:49:50 -04:00
Kenneth Moreland
c0744dbb49 Fix compile error for Xcode 9
The older Xcode 9 compiler has troubles with ArrayHandleDecorator that
are similar to those of earlier Microsoft and Cuda compilers.

Note that the logic behind the changed compiler check has a lot of
guesswork involved. I noticed this problem on a laptop with Xcode 9
installed. However, even though Xcode uses the clang compiler, it
notoriously does not return the actual clang version. Instead, it
returns some toolchain version that has nothing to do with it. I'm
pretty sure Xcode 9 is using clang version 4 under the covers, but
__clang_major__ reports 9. Oddly, Xcode 10 reports __clang_major__ as 8,
so that's not too much help. So instead, we check for
__apple_build_version__, which returns the Xcode version (sort of) and
that seems a reasonable comparison.

Although I have not tried it, I'm willing to bet that the older clang
outside of Xcode will also have issues. Here is where the real guesswork
takes place since I don't have handy compilers to try. Like I said, I
think the internet claims that Xcode 9 is using clang 4, so also add to
the check any compiler that reports itself clang 4 or below.
2019-10-04 11:32:07 -06:00
Allison Vacanti
b2daec0e35 Stick with brigand sequences for CUDA device passes.
The tao ones won't compile otherwise. This should be okay, since these
are all just compile time helpers on host-only functions -- they won't
generate different sized data structures etc if we mix them in the
same build.
2019-09-27 17:02:19 -04:00
Robert Maynard
99cbbf2ff2 Correct a regression in ArrayHandleDecorator with VisualStudio 2017 2019-09-19 18:35:20 -04:00
Robert Maynard
a46a83cc2a GCC 4.8 now correctly compiles ArrayHandleDecorator 2019-09-19 09:10:00 -04:00
Allison Vacanti
d872e1061f Move template <...> decl before VTKM_EXEC_CONT.
This isn't necessarily a problem, but for consistency's sake I want to
move it to match the rest of the code.
2019-09-13 10:22:30 -04:00
Allison Vacanti
885cce3914 Add ArrayPortalDecorator. 2019-09-11 12:50:59 -04:00