vtk-m2/vtkm/worklet
Kenneth Moreland 28ecf3636d Change interface of atomic compare and swap
The old atomic compare and swap operations (`vtkm::AtomicCompareAndSwap`
and `vtkm::exec::AtomicArrayExecutionObject::CompareAndSwap`) had an
order of arguments that was confusing. The order of the arguments was
shared pointer (or index), desired value, expected value. Most people
probably assume expected value comes before desired value. And this
order conflicts with the order in the `std` methods, GCC atomics, and
Kokkos.

Change the interface of atomic operations to be patterned off the
`std::atomic_compare_exchange` and `std::atomic<T>::compare_exchange`
methods. First, these methods have a more intuitive order of parameters
(shared pointer, expected, desired). Second, rather than take a value
for the expected and return the actual old value, they take a pointer to
the expected value (or reference in `AtomicArrayExecutionObject`) and
modify this value in the case that it does not match the actual value.
This makes it harder to mix up the expected and desired parameters.
Also, because the methods return a bool indicating whether the value was
changed, there is an additional benefit that compare-exchange loops are
implemented easier.

For example, consider you want to apply the function `MyOp` on a
`sharedValue` atomically. With the old interface, you would have to do
something like this.

```cpp
T oldValue;
T newValue;
do
{
  oldValue = *sharedValue;
  newValue = MyOp(oldValue);
} while (vtkm::AtomicCompareAndSwap(sharedValue, newValue, oldValue) != oldValue);
```

With the new interface, this is simplfied to this.

```cpp
T oldValue = *sharedValue;
while (!vtkm::AtomicCompareExchange(sharedValue, &oldValue, MyOp(oldValue));
```
2020-10-20 08:39:22 -06:00
..
cellmetrics clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
clip Improvements to moving data into ArrayHandle 2020-07-23 10:53:38 -06:00
colorconversion Adjust TransferFunction worklet to get color table as ExecObj argument 2020-09-14 13:38:25 -06:00
connectivities Change interface of atomic compare and swap 2020-10-20 08:39:22 -06:00
contour update float casting to not have warnings on iris 2020-09-08 17:47:53 +00:00
contourtree clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
contourtree_augmented Change interface of atomic compare and swap 2020-10-20 08:39:22 -06:00
contourtree_distributed Fix compile error due to renamed includes 2020-09-17 05:39:14 -07:00
cosmotools Deprecate ReadPortal().Get pattern. 2020-05-12 15:43:40 -04:00
gradient clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
histogram
internal Add dispatcher type when logging worklet invocation 2020-10-08 16:10:00 -06:00
lcs
moments Remove instances of ListTag in favor of List 2019-12-06 21:32:36 -07:00
particleadvection Rename CellLocatorUniformBins to CellLocatorTwoLevel 2020-09-21 15:42:47 -06:00
spatialstructure Add Kokkos backend 2020-08-12 13:55:24 -04:00
splatkernels
testing remove test on large graph and sample data 2020-10-08 13:26:46 -06:00
tetrahedralize
triangulate
wavelets clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
zfp clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
AverageByKey.h Add scope log for functions that help map fields in filters 2020-10-13 16:35:25 -06:00
BoundaryTypes.h Add CellNeighborhood 2020-07-15 14:41:32 -06:00
CellAverage.h
CellDeepCopy.h ConvertNumComponentsToOffsets using ScanExtented vs. ScanExclusive 2020-03-05 10:57:34 -05:00
CellMeasure.h CellMetrics return vtkm::ErrorCode instead of raising errors 2020-04-16 17:27:42 -04:00
Clip.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
CMakeLists.txt Install WorkletNeighborhood.h 2020-07-21 08:48:49 -06:00
Contour.h Support coordinates of both float32 and float64 2020-07-14 08:53:01 -06:00
ContourTreeUniform.h
ContourTreeUniformAugmented.h Added note for future reference during API refactoring 2020-09-16 12:36:14 -07:00
CoordinateSystemTransform.h
CosmoTools.h
CrossProduct.h
DescriptiveStatistics.h Fix issues of calling __host__ from __device__ 2020-06-17 14:55:43 -06:00
DispatcherCellNeighborhood.h reverse #include on CellNeighborhood 2020-07-21 18:49:57 -06:00
DispatcherMapField.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
DispatcherMapTopology.h Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
DispatcherPointNeighborhood.h Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
DispatcherReduceByKey.h Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
DotProduct.h Fix gaps in type support 2020-03-19 17:07:11 -06:00
ExternalFaces.h Convert CleanGrid (and dependents) to use precompiled field map 2020-05-21 08:34:29 -06:00
ExtractGeometry.h Convert filters to use precompiled field map functions where applicable 2020-05-21 08:34:32 -06:00
ExtractPoints.h
ExtractStructured.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
FieldEntropy.h
FieldHistogram.h
FieldStatistics.h
Gradient.h Remove unneeded template parameters from Gradient. 2020-03-22 12:49:58 -04:00
KdTree3D.h Update vtk-m doxygen to generate less warnings 2020-06-01 16:58:32 -04:00
KernelSplatter.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Keys.h Optionally remove all use of ArrayHandleVirtual 2020-09-04 22:52:45 -06:00
Keys.hxx ConvertNumComponentsToOffsets using ScanExtented vs. ScanExclusive 2020-03-05 10:57:34 -05:00
KeysSignedTypes.cxx Optionally remove all use of ArrayHandleVirtual 2020-09-04 22:52:45 -06:00
KeysUnsignedTypes.cxx Optionally remove all use of ArrayHandleVirtual 2020-09-04 22:52:45 -06:00
LagrangianStructures.h
Magnitude.h
Mask.h Convert filters to use precompiled field map functions where applicable 2020-05-21 08:34:32 -06:00
MaskIndices.h
MaskNone.h
MaskPoints.h
MaskSelect.cxx Log the building of arrays for scatters and masks 2020-10-12 13:19:43 -06:00
MaskSelect.h Convert uses of ListTagBase to List 2019-12-06 15:37:46 -07:00
MeshQuality.h CellMetrics return vtkm::ErrorCode instead of raising errors 2020-04-16 17:27:42 -04:00
NDimsEntropy.h
NDimsHistMarginalization.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
NDimsHistogram.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Normalize.h
OrientCellNormals.h
OrientNormals.h
OrientPointAndCellNormals.h
OrientPointNormals.h Change interface of atomic compare and swap 2020-10-20 08:39:22 -06:00
OscillatorSource.h
ParticleAdvection.h Generalize fields for particle advection 2020-07-20 21:15:46 -04:00
PointAverage.h
PointElevation.h
PointMerge.h Optionally remove all use of ArrayHandleVirtual 2020-09-04 22:52:45 -06:00
PointTransform.h
Probe.h Add Kokkos backend 2020-08-12 13:55:24 -04:00
RemoveDegenerateCells.h Convert CleanGrid (and dependents) to use precompiled field map 2020-05-21 08:34:29 -06:00
RemoveUnusedPoints.h Support coordinates of both float32 and float64 2020-07-14 08:53:01 -06:00
ScalarsToColors.h
ScalarsToColors.hxx
ScatterCounting.cxx Log the building of arrays for scatters and masks 2020-10-12 13:19:43 -06:00
ScatterCounting.h Convert uses of ListTagBase to List 2019-12-06 15:37:46 -07:00
ScatterIdentity.h
ScatterPermutation.h
ScatterUniform.h
SplitSharpEdges.h Convert filters to use precompiled field map functions where applicable 2020-05-21 08:34:32 -06:00
StableSortIndices.h Convert execution preparation to use tokens 2020-02-25 09:39:19 -07:00
StreamLineUniformGrid.h Improvements to moving data into ArrayHandle 2020-07-23 10:53:38 -06:00
StreamSurface.h Use new ways to get array portal in control environment 2020-02-26 13:10:46 -07:00
SurfaceNormals.h CoordinateSystem data is VariantArrayHandle 2020-07-14 08:50:39 -06:00
Tetrahedralize.h Convert filters to use precompiled field map functions where applicable 2020-05-21 08:34:32 -06:00
Threshold.h Convert filters to use precompiled field map functions where applicable 2020-05-21 08:34:32 -06:00
ThresholdPoints.h
TriangleWinding.h Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
Triangulate.h Convert filters to use precompiled field map functions where applicable 2020-05-21 08:34:32 -06:00
Tube.h Convert filters to use precompiled field map functions where applicable 2020-05-21 08:34:32 -06:00
VertexClustering.h Improvements to moving data into ArrayHandle 2020-07-23 10:53:38 -06:00
WarpScalar.h
WarpVector.h
WaveletCompressor.h
WorkletCellNeighborhood.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
WorkletMapField.h Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
WorkletMapTopology.h Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
WorkletNeighborhood.h Extract WorkletNeighborhood base class 2020-07-20 17:50:14 -06:00
WorkletPointNeighborhood.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
WorkletReduceByKey.h Reverse Invoker, Dispatcher and Worklet dependency 2020-07-21 17:25:43 -06:00
ZFP1DCompressor.h
ZFP1DDecompress.h
ZFP2DCompressor.h
ZFP2DDecompress.h
ZFPCompressor.h
ZFPDecompress.h