Commit Graph

42 Commits

Author SHA1 Message Date
Kenneth Moreland
170a10e4b4 Fix slow ArrayCopy calls
The `ArrayCopy` method has been changed to be precompiled. It handles
most standard array types. But there are some special `ArrayHandle`
types that are not correctly handled, and these go to a slow fallback.
Find places in the code that use that fallback and fix them.

There are also some instances of replacing an `ArrayHandleCounting` with
an `ArrayHandleIndex`. This change is probably not strictly necessary to
make the `ArrayCopy` faster, but when it can be used `ArrayHandleIndex`
is generally better.
2022-01-24 14:15:45 -07:00
Kenneth Moreland
06c59fed13 Update MapFieldMergeAverage/Permuation to use new CastAndCall
These functions now use
`UnknownArrayHandle::CastAndCallWithExtractedArray` to reduce the number
of times the worklet is run.
2021-01-13 09:19:33 -07:00
Kenneth Moreland
03c3f9e178 Update MapField helper functions to use extracted array components
Previously, the `MapFieldMergeAverage` and `MapFieldPermutation` helper
function had to iterate over every possible type and create a separate
code path. This change uses the new extract component functionality to
create separate code paths only for different component types. This both
requires less code (the common filter library dropped from 66MB to 42MB
on my Mac) and covers more cases (such as `Vec`s larger than 4
components).

To make the implementation easier, `UnknownArrayHandle` now can create a
new `UnknownArrayHandle` of the same `ValueType` but with the basic
storage (so you can work with read-only storage) and the ability to
allocate the unknown array.
2020-12-16 17:23:35 -07:00
Kenneth Moreland
19944653bc Add scope log for functions that help map fields in filters 2020-10-13 16:35:25 -06:00
Li-Ta Lo
f333182476 Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
Kenneth Moreland
be7f06bbe7 CoordinateSystem data is VariantArrayHandle
`CoordinateSystem` differed from `Field` in that its `GetData`
method returned an `ArrayHandleVirtualCoordinates` instead of
a `VariantArrayHandle`. This is probably confusing since
`CoordianteSystem` inherits `Field` and has a pretty dramatic
difference in this behavior.

In preparation to deprecate `ArrayHandleVirtualCoordinates`, this
changes `CoordiantSystem` to be much more like `Field`. (In the
future, we may change the `CoordinateSystem` to point to a `Field`
rather than be a special `Field`.)

A method named `GetDataAsMultiplexer` has been added to
`CoordinateSystem`. This method allows you to get data from
`CoordinateSystem` as a single array type without worrying
about creating functors to handle different types and without
needing virtual methods.
2020-07-14 08:50:39 -06:00
Li-Ta Lo
68c18f1546 remove redundant #include 2020-06-16 12:25:58 -06:00
Li-Ta Lo
c25f0b4bb8 Rename StatisticalMoments. more unit tests
Change StatisticalMoments to the more descriptive DescriptiveStatistics,
add some more property based tests.
2020-06-15 14:24:00 -06:00
Li-Ta Lo
5eeeb47914 Change StatState's API to better conform to VTKm's coding standard 2020-06-12 21:41:31 -06:00
Li-Ta Lo
72e21f398e remove auto return type 2020-06-09 18:17:13 -06:00
Li-Ta Lo
8a1a7c1b10 Refactor AverageByKye to use StatisticalMoments 2020-06-09 16:14:21 -06:00
Kenneth Moreland
b1f288aaea Add non-templated base class to Keys class.
The only reason Keys has a template is so that it can hold a UniqueKeys
array and provide the key for each group. If that is not needed and you
want to implement a library function that takes a keys object, you can
now grab the Keys superclass KeysBase. KeysBase is not templated, so you
can pass it to a standard method in a library.
2020-05-21 08:34:07 -06:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Kenneth Moreland
68d5d26951 Fix warnings about conversion to int8
Now that UInt8 has become part of the list of default types compiled,
there have been numerous warnings that have popped up about converting
ints to unsigned char. The reason for these is when you do arithmetic
(+, -, *, or /) on a char or short, it is automatically upconverted to a
32-bit integer. When you then try to set that back to a smaller integer,
you get a conversion warning.

This change gets around this problem by explicitly telling the compiler
we expect this type with static_cast. We have also talked about
disabling conversion warnings, but this has not happened on all
dashboards, and it is not that hard to work around the warning.
2019-03-15 10:38:15 -06:00
Kenneth Moreland
2e426ad547 Run the update-control-signature-tags.sh script 2019-01-11 12:23:10 -07:00
Kenneth Moreland
6ebc3ea761 Fix potential warning in AverageByKey
To get the average, we (of course) divide the sum by the amount of
values, which is returned from valuesIn.GetNumberOfComponents(). To do
this, we need to cast the number of components (returned as a
vtkm::IdComponent) to a FieldType. This is a little more complex than it
first seems because FieldType might be a Vec type. If you just try a
static_cast<FieldType>(), it will use the constructor to FieldType which
might be a Vec constructor expecting the type of the component. This in
turn could cause a warning because the vtkm::IdComponent is implicitly
converted to the Vec's component type.

Get around this problem by first casting to the component type of the
field and then constructing a field value from that.
2018-11-27 09:31:23 -07:00
Matthew Letter
cb03238804 removed device from run function for AverageByKey
I also cleaned up the unit test to no longer pass the device
2018-10-24 10:28:12 -06:00
Kenneth Moreland
d879188de0 Make DispatcherBase invoke using a TryExecute
Rather than force all dispatchers to be templated on a device adapter,
instead use a TryExecute internally within the invoke to select a device
adapter.

Because this removes the need to declare a device when invoking a
worklet, this commit also removes the need to declare a device in
several other areas of the code.
2018-08-29 19:18:54 -07:00
Allison Vacanti
93506d25e2 Change function signatures to use 'using' aliases.
Also cleaned up some lingering type typedefs.
2018-05-25 17:18:41 -04:00
Robert Maynard
e630ac5aa4 Merge branch 'master' into vtk-m-cmake_refactor 2018-02-23 14:52:00 -05:00
Robert Maynard
182f4707e7 vtkm prefers 'using' over typedef. 2018-02-23 10:47:20 -05:00
Robert Maynard
75b0efccc9 Correct casting warnings found with new cmake code 2018-01-08 14:00:58 -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
Kenneth Moreland
b12a20a599 Fix issue where auto type was not resolving template parameters
Portal reference objects automatically cast to their value, but
that does not necessarily mean that it will cast correctly to
a subclass of that type.
2017-08-29 09:34:32 -07:00
Kenneth Moreland
3471dc27fe Expand usage of AverageByKey
The AverageByKey.h header file had a single function that used the
device adapter algorithm ReduceByKey method to do a simple averaging of
a field. I added a second method that can do an average when given a
vtkm::worklet::Keys object. I expect this to be a common use case as we
implement transforming fields from input to output in many algorithms.
2017-08-24 17:20:21 -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
Kitware Robot
efbde1d54b clang-format: sort include directives 2017-05-18 12:59:33 -04: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
Robert Maynard
f31d6c2258 Refactor vtkm::Types to be concise and move math helpers out of internal.
I have verified that the optimized assembly for Vec<3> and Vec<4> are consistent
with what we generated before.
2016-10-28 14:57:16 -04:00
Chuck Atkins
f74c0d3c88 Remove type conversion related warnings for GCC 2016-03-17 13:05:38 -04:00
Kenneth Moreland
891182ee19 Add ArrayHandleIndex class.
This is the most common use case for ArrayHandleCounting, and this class
is a bit easier to use and a bit faster.
2015-09-14 22:11:09 -06:00
Sujin Philip
6fde50160b Update VertexClustering to use the new features in vtkm 2015-09-02 16:41:54 -04:00
Robert Maynard
f20b1ea99a Add vtkm/BinaryPredicates header.
Currently includes the following predicates:
  - Equal
  - NotEqual
  - SortLess
  - SortGreater
  - LogicalAnd
  - LogicalOr
2015-08-04 16:55:53 -04:00
Kenneth Moreland
cc8a5d35ec Some fixes to VertexClustering
VertexClustering previously only worked with data of a specific floating
point type (32 bit for point coordinates). Add some templates to accept
either 32 bit or 64 bit floating points for point coordintes and be a
bit more careful about implicit type conversions.

I also made some changes to conform better with the VTK-m coding
standards. The most common changes are using 2 space indentation for all
block levels, capitolizing and using camel case for all class members,
and prefixing "this->" to all use of internal class members.
2015-06-29 15:14:50 -06:00
Jimmy
e234f29148 remove vc_debug 2015-06-25 10:52:02 -04:00
Jimmy
314c1b9da2 remove if 0 blocks in averageByKey 2015-06-25 10:38:34 -04:00
Jimmy
a5a4fb36ad remove internal namespace to expose AverageByKey 2015-06-25 10:37:11 -04:00
Jimmy
03823d96a1 Fix VertexClustering and missing iteratortype in ArrayHandleImplicit.h for CUDA 2015-06-24 16:35:11 -04:00
Jimmy
4220b37135 Finish testing codes for VertexClustering 2015-06-24 14:55:22 -04:00
Chun-Ming Chen
ebd6e43409 Added VertexClustering test 2015-06-24 14:55:22 -04:00
Chun-Ming Chen
4f813ca4c5 Prepare for vertex clustering algorithm 2015-06-24 14:55:21 -04:00