Commit Graph

103 Commits

Author SHA1 Message Date
Kenneth Moreland
b80b7e2e71 Add VTK-m User's Guide to source
This is a start of moving the VTK-m User's Guide into the VTK-m source.
This is only the start of the process. There are several goals of this
work.

1. Integrate the documentation into the source code better to better
   keep the code up to date.
2. Move the documentation over to Sphinx so that it can be posted online
   and be more easily linked.
3. Incoporate Doxygen into the guide to keep the documentation
   consistent.
4. Build the user guide examples as part of the VTK-m CI to catch
   compatibility changes quickly.
2023-10-17 11:31:27 -04:00
Kenneth Moreland
8befbc47c7 Fix dot product type promotion
Update the dot product functions to use auto returns to capture proper
type promotion.
2023-02-08 07:04:07 -07:00
Kenneth Moreland
d9c988b200 Allow for different types in basic type operators
The basic type operators in `Types.h` (i.e. `vtkm::Add`,
`vtkm::Subtract`, `vtkm::Multiply` and `vtkm::Divide`) required the same
type for both arguments. This caused problems when used with `Reduce`
and the initial value type did not match exactly.

Use some tricks from `BinaryOperators.h` to be flexible about using
different types.
2021-03-03 09:39:45 -07:00
Kenneth Moreland
1cc6dbb0c2 Allow VecBaseCommon operators to work with any Vec-like
Previously, the arithmetic assignment operators (`+=`, `-=`, `*=`, `/=`)
on `VecBaseCommon` only accepted another subclass of `VecBaseCommon`.
Changed the operators to accept any type.

The benefit of this change is that the assignment operator of classes
that inherit from `VecBaseCommon` can now work with `Vec`-like classes
that do not inherit from `VecBaseCommon`. I think the only real downside
is that the template could match other classes that would lead to
invalid comparisons. But such use would lead to a compile error anyway.
The difference is that instead of getting an error that no overloaded
version of the operator is available, you will get an error inside the
code of the operator.
2021-01-13 09:19:34 -07:00
Kenneth Moreland
88eed2bbeb Make sure all C scalar types are in TypeListScalarAll
C++ template considers some types different even though they have the
exact same format. For example `int`, `long`, and `long long` all match
different types even though they all represent either signed 32-bit ints
or signed 64-bit ints.

List all these possible types in
`TypeListScalarAll`.
2020-11-12 16:18:56 -07:00
Vicente Adolfo Bolea Sanchez
fb919e048e vtkm::Vec: added unrolled arithmetic operators overload
Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-09-03 16:10:15 -04:00
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Kenneth Moreland
56bec1dd7b Replace basic ArrayHandle implementation to use Buffers
This encapsulates a lot of the required memory management into the
Buffer object and related code.

Many now unneeded classes were deleted.
2020-06-25 14:02:26 -06:00
Ben Boeckel
0488aab201 docs: update gitlab links to include /-/ component 2020-05-26 14:48:49 -04:00
Li-Ta Lo
26b73f1dd3 Using C++11 integer types
Using C++11 fixed width integer type defined in cstdint
for various integer types alias instead of our own
2020-03-09 17:53:12 -06:00
Robert Maynard
485df972f8 Update the documentation on the different VTK-m namespaces 2019-09-12 17:45:39 -04:00
Robert Maynard
a529b90c73 vtkm::Vec const& operator[] is now constexpr
This allows for developers to do things such as the following
as constexpr's:
```cxx
constexpr vtkm::Id2 dims(16,16);
constexpr vtkm::Float64 dx = vtkm::Float64(4.0 * vtkm::Pi()) / vtkm::Float64(dims[0] - 1);
```
2019-08-22 08:34:25 -04:00
Kenneth Moreland
b3e2952149 Add aliases for common Vec types
It is a hassle to write out vtkm::Vec<vtkm::FloatDefault, 3>. Instead,
you can now just write vtkm::Vec3f.
2019-07-31 12:55:30 -06:00
Robert Maynard
2041091e72 Move vtkm:: operators from global namespace to vtkm namespace
Fixes #361
The Vec, Range, and Pair free function operators are all now in
the vtk-m namespace to help with ADL lookup.
2019-05-20 14:16:32 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Allison Vacanti
56cc5c3d3a Add support for BitFields.
BitFields are:
- Stored in memory using a contiguous buffer of bits.
- Accessible via portals, a la ArrayHandle.
- Portals operate on individual bits or words.
- Operations may be atomic for safe use from concurrent kernels.

The new BitFieldToUnorderedSet device algorithm produces an ArrayHandle
containing the indices of all set bits, in no particular order.

The new AtomicInterface classes provide an abstraction into bitwise
atomic operations across control and execution environments and are used
to implement the BitPortals.
2019-04-11 08:27:17 -04:00
Shreeraj Jadhav
947496550e constexpr construction for Vec classes
Vec class objects can now be constructed during compile-time
as constant expressions by calling Vec( T, ... ) constructors
or through brace-initialization.
Constant expression using fill constructor and nested vectors
of sizes greater than 4 are not supported yet.
Changes made to WrappedOperators.h for resolving overload
ambiguities in Vec construction and typecasting.
Appropriate test cases were added to UnitTestTypes.cxx.
Addresses issue #199.
2018-06-20 14:15:29 -04:00
Sujin Philip
d4f94d4e14 Fix Vec <T, sizeof...(Ts)> warnings
Several "conversion to ‘int’ from ‘long unsigned int’" are produced in gcc.
2018-06-18 14:44:35 -04:00
Kenneth Moreland
1578944360 Enable Vec construction with intializer_list of single value
Previously, the initilaizer_list of Vec had to be the exact
same number of values as the size of the Vec. Now, we also
accept a single value that is duplicated for all values in
the Vec. That allows you to more easily construct lists
of lists with repeated values.
2018-06-04 21:08:26 -05:00
Kenneth Moreland
ae8d994d21 Add support for initializer lists in Vec
Add constructors to the `vtkm::Vec` classes that accept
`std::initializer_list`. The main advantage of this addition is that it
makes it much easier to initialize `Vec`s of arbitrary length.
2018-05-30 16:49:40 -06:00
David Thompson
00c7905afb Rename vtkm::dot() to vtkm::Dot().
This keeps the old name around but prepares it for removal
in the next release.
2018-05-17 08:51:01 -04:00
Robert Maynard
5bc9ecef16 Add a vtkm::Vec<T,N> fast path for CopyInto a vec of the same type
Rather than use the general case which has a for loop we can just
use the assignment operator.
2018-05-02 15:54:51 -04:00
Robert Maynard
adcabb034b VTK-m Vec<> constructors are now more conservative.
When you have a Vec<Vec<float,3>> it was possible to incorrectly correct
it with the contents of a Vec<double,3>. An example of this is:

using Vec3d = vtkm::Vec<double, 3>;
using Vec3f = vtkm::Vec<float, 3>;
using Vec3x3f = vtkm::Vec<Vec3f, 3>;

Vec3d x(0.0, 1.0, 2.0);
Vec3x3f b(x); // becomes [[0,0,0],[1,1,1],[2,2,2]]
Vec3x3f c(x, x, x); // becomes [[0,1,2],[0,1,2],[0,1,2]]
Vec3x3f d(Vec3f(0.0f,1.0f,2.0f)) //becomes [[0,0,0],[1,1,1],[2,2,2]]

So the solution we have chosen is to disallow the construction of objects such
as b. This still allows the free implicit cast to go from double to float.

So while `Vec3x3 b = x is supported by vtk-m, it produces very incorrect results.
2018-04-27 16:47:54 -04:00
Robert Maynard
dc6e7d1ac8 Make all Vec types consistently mark methods as inline 2018-04-25 10:48:28 -04:00
Robert Maynard
8808b41fbd Merge branch 'master' into vtk-m-cmake_refactor 2018-03-29 22:51:26 -04:00
Robert Maynard
7c54125b66 Switch over from static const to static constexpr where possible. 2018-03-10 11:39:58 -05:00
Robert Maynard
e630ac5aa4 Merge branch 'master' into vtk-m-cmake_refactor 2018-02-23 14:52:00 -05:00
luz.paz
80b11afa24 Misc. typos
Found via `codespell -q 3` via downstream VTK
2018-01-30 06:51:47 -05: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
0660c67fef Merge branch 'master' into vtk-m-cmake_refactor 2018-01-16 15:42:28 -05:00
Robert Maynard
687071f9b0 Remove unneeded host/device markups on default constructors 2018-01-08 14:00:58 -05:00
Robert Maynard
a8415d8e37 VTK-m now widens result type for UInt8/Int8/UInt16/Int16 input.
When using vtkm::dot on narrow types you easily rollover the values.
Instead the result type of vtkm::dot should be wide enough to store the results
(32bits) when this occurs.

Fixes #193
2018-01-03 16:32:41 -05:00
Allison Vacanti
4cd791932b Ensure that Pair and Vec are trivial classes.
For std::copy to optimize a copy to memcpy, the valuetype must be both
trivially constructable and trivially copyable.

The new copy benchmarks highlighted an issue that std::copy'ing pairs
and vecs were not optimized to memcpy. For a 256 MiB buffer on my
laptop w/ GCC, the serial copy speeds were:

UInt8:                 10.10 GiB/s
Vec<UInt8, 2>           3.12 GiB/s
Pair<UInt32, Float32>   6.92 GiB/s

After this patch, the optimization occurs and a bitwise copy occurs:

UInt8:                 10.12 GiB/s
Vec<UInt8, 2>           9.66 GiB/s
Pair<UInt32, Float32>   9.88 GiB/s

Check were also added to the Vec and Pair unit tests to ensure that
this classes continue to be trivial.

The ArrayHandleSwizzle test was refactored a bit to eliminate a new
'possibly uninitialized memory' warning introduced with the default
Vec ctors.
2017-10-18 14:58:35 -04: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
Dave Pugmire
b23564a526 Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into pics_unittests 2017-08-10 16:18:18 -04:00
Robert Maynard
b85cdd9080 Convert VTK-m over to use 'using' instead of 'typedef' 2017-08-07 14:05:43 -04:00
Dave Pugmire
3759887aed Merge branch 'master' of gitlab.kitware.com:dpugmire/vtk-m 2017-07-28 10:07:37 -04:00
Robert Maynard
c09e88d214 Improve the overall doxygen content for vtk-m. 2017-07-07 11:14:25 -04:00
Robert Maynard
ccc8455e1d First initial pass at cleaning up the doxygen generation for vtkm 2017-07-07 11:14:25 -04:00
Kitware Robot
4ade5f5770 clang-format: apply to the entire tree 2017-05-25 07:51:37 -04:00
Robert Maynard
57ab48fe8e Replace occurrences of NULL with nullptr. 2017-05-04 10:50:57 -04:00
Dave Pugmire
69f9125663 Experiment with speeding up the GetHexahedronClassification. 2017-03-28 09:28:03 -04:00
Sujin Philip
8c4bbc39ad Use C++11 =delete keyword 2017-02-24 09:39:22 -05:00
Robert Maynard
fc398d36a1 Make sure vtkm::Vec types are always exported. 2017-01-16 09:17:38 -05:00
Kenneth Moreland
f23ff9fa49 Fix warnings about assignment operators not being generated
For some reason when VTK-m was being compiled as an accelerator in VTK,
Visual Studio 2013 gave a bunch of warnings about not being able to generate
assignment operators for many classes. This happened for classes with a
const ivar that could not be automatically set. (Automatic copy constructors
are fine on this count.) I'm not sure why these warnings did not happen
when just compiling VTK-m, nor am I sure why they were generated at all as
no code actually used the copy constructors.

This commit fixes the problems by adding a private declaration for assignment
operators that cannot be automatically created. No implementation is
provided, nor should any be needed.
2017-01-10 11:10:38 -07:00
Robert Maynard
270ece24b3 Types and Matrix don't emit Wunused-value warnings from __builtin_expect
When using Types or Matrix with the nvcc compiler with Wunused-value
enabled you would get the following warning:
(__builtin_expect(!(rowIndex < (this,NUM_ROWS)), 0)) ?
__assert_rtn(__func__, "vtkm/Matrix.h", 86, "rowIndex < this->NUM_ROWS") :
((void)0);

This is solved by changing this->NUM_ROWS to just NUM_ROWS.
2017-01-03 11:05:25 -05:00
Kenneth Moreland
eb7ea79241 Add VTKM_EXEC_CONT to make_VecC
I forgot to add the VTKM_EXEC_CONT modifier to the make_VecC methods,
and that causes them to fail on CUDA devices.

I wish the compiler would have said something. I was calling one of them
from a VTKM_EXEC method.
2016-12-08 17:24:07 -07:00
Kenneth Moreland
f53cd748f3 Add VecC and VecCConst structs
These structs behave much like Vec except that they work on a short C
array given to them rather than having the statically sized short array
defined within.

I expect to use this in the short term to help implement cell face
classes, but there are probably many other uses.
2016-12-01 15:04:22 -06:00
Robert Maynard
719a8bd35d Merge topic 'nvcc_version_check'
4de37559 fix a pragma location bug
9048e0ba detect cuda versions and decide if to put a diagnostic inside or outside of a class.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !611
2016-11-16 19:21:31 -05:00
Samuel Li
4de37559fd fix a pragma location bug 2016-11-16 09:55:22 -08:00