Commit Graph

56 Commits

Author SHA1 Message Date
Nick Thompson
dd8863637a Return a vec<T,2> rather than a vtkm::Pair<T,T>. 2021-04-08 16:23:42 -04:00
Nick Thompson
91bec19e97 Additional comments and fix typo in unit test. 2021-04-08 16:23:42 -04:00
Nick Thompson
6f9515aa94 Quadratic roots to 3 ulps. 2021-04-08 16:23:42 -04:00
Nick Thompson
8d54138d3e Kahan's difference of products algorithm 2021-04-05 15:20:56 -04:00
Robert Maynard
0134de4fe4 Don't use HIP overloads for std::min
The HIP overloads for std::min don't return the first parameter
when the two values are equal which causes problems when inputs
such as nan.

Reported upstream:
https://github.com/ROCm-Developer-Tools/HIP/issues/2209
2020-12-28 13:29:32 -05:00
Robert Maynard
1ed5dfca0b vtkm/Math frexp(float) version works now with HIP 2020-10-22 15:32:14 -04:00
Robert Maynard
71ff85e926 vtkm/Math can now works with HIP device functions 2020-10-20 09:49:24 -04:00
Robert Maynard
7834b5155b vtkm::Math::ModF calls correct CUDA math function 2020-10-20 09:24:05 -04:00
Nick
470058c328 Unfoobar the float_distance MR. 2020-06-24 10:52:59 -04:00
Robert Maynard
fa3722bfa3 FindFirstSetBit now correctly compiles with the Intel compiler
Fixes https://gitlab.kitware.com/paraview/paraview/issues/18993
2019-05-08 15:48:58 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Allison Vacanti
2f2ca93709 Add bit operations FindFirstSetBit and CountSetBits to Math.h. 2019-04-11 08:27:17 -04:00
Allison Vacanti
03fc7b66d0 Add VTKM_CUDA_DEVICE_PASS preprocessing definition.
This is only set while compiling device code, and is useful
for code that needs different implementations on devices (e.g.
they call CUDA device intrinsics, etc).
2019-01-24 11:23:45 -05:00
mclarsen
8cd7c5db32 fixed the gather 2018-12-13 14:49:36 -05:00
David Thompson
880d8a989e Add vtkm/Geometry.h and test it.
This commit adds several geometric constructs to vtk-m
in the `vtkm/Geometry.h` header. They may be used from
both the execution and control environments.

We also add methods to perform projection and Gram-Schmidt
orthonormalization to `vtkm/VectorAnalysis.h`.

See `docs/changelog/geometry.md` included in this commit
for more information.
2018-06-20 11:58:14 -04:00
Haocheng LIU
fae8409c9c Add float version operations for vtkm::Math Pi()
This commit also removes the old static_cast<vtkm::float32>vtkm::Pi() usages and
fix serveral conversion warnings.
2018-05-21 10:58:15 -04:00
Haocheng LIU
2e62d78b49 Make vtkm:Math Pi() operations constexpr
If they are used inside other mathematical expressions then the compiler
has a better chance to perform the operation at compile time.
2018-05-15 14:27:26 -04:00
Robert Maynard
b7e6371842 Correct issues found be enabling more CUDA warnings. 2018-04-23 14:27:53 -04:00
Robert Maynard
1d9a9dd1c6 Simplify VTK-m detection of the size of different types.
Most of the code was unneeded as the primitive types have a minimum required
size that we can rely on.
2018-01-17 09:57:51 -05:00
Robert Maynard
d07c696b3c vtkMath.h now opts out of clang-format to make updates through pyexpander easy 2018-01-10 08:38:14 -05:00
Robert Maynard
a9e64c4ba8 FloatPointReturnType is float if 'T' is < 32bytes instead of being double.
Previously FloatPointReturnType would always be double for types that
are not float, which caused Int8/Int16 types to promote to double instead
of float.
2018-01-04 13:22:31 -05:00
Robert Maynard
93bc0198fe Suppress false positive warnings about calling host device functions. 2018-01-02 10:40:49 -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
b85cdd9080 Convert VTK-m over to use 'using' instead of 'typedef' 2017-08-07 14:05:43 -04:00
Kenneth Moreland
071c792148 Merge topic 'indent-generated'
b03a61da Make .in files match new formatting

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !784
2017-05-28 10:28:54 -04:00
Kenneth Moreland
b03a61da5d Make .in files match new formatting
The automatic formatter formatted the result of the .in files, but not
the .in files themselves. This caused the .in file check to fail.
2017-05-27 09:46:32 -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
Thomas J. Otahal
f1300c6143 Changed vtkm::Abs() to return input type 2017-02-06 15:50:13 -07:00
Thomas J. Otahal
71b2348dd9 Adjusted Math.h.in for const vtkm::Float32 function inputs 2017-02-06 12:18:13 -07:00
Thomas J. Otahal
7d6601d794 Modified Math.h.in and VectorAnalysis.h to support integral types.
Unary operations on scalars and vectors will return vtkm::Float64 for
integral input types and vtkm::Float64 input types. Unary operations will
return vtkm::Float32 for vtkm::Float32 input vectors and scalars.
2017-01-26 13:30:28 -07:00
Thomas J. Otahal
cd95cbe90b Modified Math.h.in instead of Math.h
Changed return types for all scalar and vector unary math operations
to return vtkm::FloatDefault instead of input type. vtkm::Float64 will
be returned when the input is vtkm::Float64.
2017-01-24 14:47:51 -07:00
Thomas J. Otahal
556b922733 Created a filter for the vector magnitude worklet.
Modified the vector magnitude worklet to accept VecAll instead
of Vec3 and return Scalar. Modified the Magnitude() and Sqrt() functions
to return FloatDefault for all inputs except for Float64.

Perhaps we should modify other functions in Math.h and VectorAnalysis.h to
return float types for intergral arguments instead of integral types?
2017-01-19 13:27:42 -07:00
Kenneth Moreland
c9e146a2a1 Make literals for bits unsigned
Literals that are used to represent the bits of certain floating point
numbers (e.g. VTKM_NAN_BITS_64) are placed into unsigned integers before
converted to floating points. We ran into an example where the compiler
complained that a literal (specifically VTKM_NEG_INF_BITS_64) was
declared signed and was negative but then placed in an unsigned (64-bit)
integer. This should fix the problem by making the literal itself
unsigned.
2016-12-16 08:47:18 -07:00
Kenneth Moreland
fda3ec71c5 Don't call std functions in math nonfinte functions for CUDA
The math nonfinite check functions (like IsNan) were calling the std
equivalent function. This is fine for most architectures, but is not
available for devices under CUDA. Instead, call the CUDA version of
these functions when compiling with CUDA.

This fixes an issue that became apparent once we added CUDA error code
checking.
2016-12-15 10:40:17 -07:00
Robert Maynard
213188b2c3 Properly use CUDA signbit functions. 2016-11-30 15:36:51 -05: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
b4378c8546 Allow vtkm::Matrix to support T values which are vtkm::Vec. 2016-11-15 18:54:53 -05:00
Robert Maynard
801473bc58 vtkm::Math now doesn't require boost 2016-09-02 13:32:26 -04:00
Kenneth Moreland
5d829f2142 Use std::Min/Max over fmin/fmax
We had a report that vtkm::Min/Max was significantly slower than other
products. This was traced back to the fact that these functions were not
completely inlining because they were calling fmin or fmax, and that
resulted in an actual C library call. It turns out using the templated
functions in the std namespace is faster.

This change has the VTK-m min/max functions use the std version in
almost all circumstances. The one exception (so far) is that fmin and
fmax are used for CUDA devices since the std functions are not declared
to run on the device and the nvcc compiler treats these functions
special.
2015-12-07 09:26:27 -07:00
Kenneth Moreland
9749e57838 Fix pyexpander errors
There was some inconsistencies between the input and output files for
pyexpander checked into the repository. This just makes them consistent.
2015-09-02 13:47:33 -07:00
Robert Maynard
ab59e34a2f Rename pragma header guard so it makes sense for tbb and thrust.
Boost is not the only thirdparty that we are supressing warnings for, so
make the name more generic.
2015-08-13 09:04:23 -04:00
Kenneth Moreland
21b3b318ba Always disable conversion warnings when including boost header files
On one of my compile platforms, GCC was giving conversion warnings from
any boost include that was not wrapped in pragmas to disable conversion
warnings. To make things easier and more robust, I created a pair of
macros, VTKM_BOOST_PRE_INCLUDE and VTKM_BOOST_POST_INCLUDE, that should
be wrapped around any #include of a boost header file.
2015-07-30 17:40:40 -06:00
Kenneth Moreland
13023792c4 Add component-wise Min/Max methods for Vec classes. 2015-07-22 13:27:44 -04:00
Sujin Philip
1a9e8d1e3d Initial support for generating documentation using Doxygen 2015-07-17 15:35:59 -04:00
Kenneth Moreland
abcc6da52f Add Matrix class.
The matrix class is for thread-local matrix computations. It is intended
to store things like tensors or geometric transforms.
2015-07-02 11:20:21 -06:00
Kenneth Moreland
f426b16daf Fix an issue where the remainder function not well supported on MSVC
Also fix a minor conversion warning.
2015-06-30 08:50:02 -06:00
Kenneth Moreland
3ab8288dc7 Fix use of VTKM_MSVC
The VTKM_MSVC is just defined if using MSVC. It is not set to any value.
There was a reference in Math.h that assumed it was set to true, which
it was not. This simple change should fix that.
2015-06-29 09:27:16 -06:00
Kenneth Moreland
4a8d69ca66 Add CUDA math test
Also fix some issues that caused the compile to fail when trying to
run some of the math functions on a CUDA device. In particular, CUDA
is picky about using a global const on a device when the const type is
not one of the basic C types.
2015-06-25 13:54:24 -06:00