Commit Graph

72 Commits

Author SHA1 Message Date
Robert Maynard
687071f9b0 Remove unneeded host/device markups on default constructors 2018-01-08 14:00:58 -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
Samuel Li
9048e0bac1 detect cuda versions and decide if to put a diagnostic inside or outside of a class. 2016-11-15 22:43:40 -08: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
9caabf97ce vtkm::Vec now supports +=, -=, *=, and /=.
It is common to write template code that needs to operate across both
scalar and vector values. To facilitate code like this we are required
to provide these common operators.
2016-11-14 13:07:33 -05:00
Robert Maynard
5cd9acadf6 Fixup for 1 back. 2016-10-28 14:57:16 -04: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
Robert Maynard
12810165bb Switch over to c++11 type_traits. 2016-08-31 16:11:26 -04:00
T.J. Corona
3463db3b28 Add division operator for Vec/scalar operations. 2016-08-02 14:21:19 -04:00
Kenneth Moreland
2ddad8bcc5 Add POSIX assert wrapper
Add in the vtkm namespace an assert macro (technically VTKM_ASSERT) that
basically replicates the functionality of the POSIX assert macro. This
form of assert is set to replace the separate control/exection asserts.

It has been decided that an assert that throws an exception instead of
terminating the program is not all that great of a feature and it causes
some limitations on how it is used. The next commit will remove the
other forms of VTK-m assert.
2016-04-20 14:19:22 -06:00
Robert Maynard
1ec3bc0e7a Rename the opengl folder / namespace to interop.
To clarify what functionality the classes inside provide.
2016-04-13 15:52:15 -04:00
Robert Maynard
8820c0fbc8 Make sure vtk and vtkm types match when long and long long are both 8bytes.
Previously vtk would use long long and vtkm would use long, which would
cause nightmares when trying to do zero copy between the two libraries.
2016-02-22 14:20:25 -05:00
Kenneth Moreland
cadf0e53ab Fix MSVC warnings
Fix your typical batch of MSVC warnings including picky type conversions
and using "unsafe" std functions on pointers for iterators.
2016-01-26 16:23:00 -07:00
Robert Maynard
f5f9939f26 Update all of vtkm to understand it can only identify as one compiler. 2016-01-12 11:05:40 -05:00
Kenneth Moreland
1a538ca196 Merge branch 'scatter-worklets' into 'master'
Scatter in worklets

Add the functionality to perform a scatter operation from input to output in a worklet invocation. This allows you to, for example, specify a variable amount of outputs generated for each input.

See merge request !221
2015-11-11 13:09:47 -05:00
Kenneth Moreland
bf03243516 Add ability to multiply any Vec by vtkm::Float64.
This has been requested on the mailing list to make it easier to
interpolate integer vectors.

There are a couple of downsides to this addition. First, it implicitly
casts doubles back to whatever the vector type is, which can cause a
loss of precision. Second, it makes it more likely to get overload
errors when multiplying with Vec. In particular, the operator to cast
Vec of size 1 to the component class had to be removed.
2015-11-07 06:33:50 -07:00
Kenneth Moreland
b0c5a32611 Add Scatter parameters to Invocation.
We are passing in execution objects with the Invocation when the Worklet
is scheduled, but we are not using it yet.
2015-11-06 18:05:20 -07:00
Kenneth Moreland
77568789ea Make vtkm::Pair behave as a better core type
These changes are basically to support some upcoming changes to
ArrayHandleZip. The major additions are an implementation of VecTraits
for Pair and an overloaded << operator to ostream for Pair.

I also had to declare the operator<< for Pair to be in Types.h. Under
some circumstances the operator has to either be declared before the
template is declared or declared in the vtkm namespace. (The reasons are
described at <http://clang.llvm.org/compatibility.html#dep_lookup> but I
still don't understand.) I tried adding it to the vtkm namespace, but
that caused several of the other operator<< to fail. Since there is no
way to guarantee that Pair.h is declared before, say, ArrayHandle.h, I
moved the implementation to Types.h.

Since I was moving operator<< to Types.h, I went ahead and moved the
TypeTraits and VecTraits to their respective headers. Since Pair is
declared (but not implemented) in Types.h, these templated classes can
be implemented without including Pair.h.
2015-09-20 00:01:04 -06:00
Kenneth Moreland
9b22a72d6c Only suppress unused-local-typedef warning when it exists
The recently added pragma to suppress warnings about unused local
typedefs caused lots of dashboard failures because many GCC and clang
compiler do not have this warning so did not recognized the pragma to
suppress it. Now only use the pragma on clang compilers with a large
enough version.

I also discovered that the check for VTKM_CLANG was wrong (at least for
the most modern versions of XCode). Fixed that as well as some uses of
VTKM_CLANG that were wrong.
2015-09-17 07:44:56 -06:00
Kenneth Moreland
08f9c04fab Add specialization of topology map fetch for regular point coords
In the special case where you are loading the point coordinates for a
structured grid in a point to cell map (an important use case), create a
VecRectilinearPointCoordinates rather than build a Vec of the values.
This will activate the cell specalizations in previous commits.

These changes also added some flat-to-logical index conversion and vice
versa in ConnectivityStructuredInternals. This change also fixed a bug
in getting cells attached to points in 2D grids. (Actually, technically
someone else fixed it and checked it in first. The changes were merged
during a rebase.)

I also added a specalization to Vec for 1D that implicitly converts
between the 1D Vec and the component. This can be convenient when
templating on the Vec length.
2015-09-02 13:54:51 -07:00
Robert Maynard
86b3f9a08c Remove namespaces from doxygen that don't exist. 2015-08-31 13:06:44 -04:00
Kenneth Moreland
827b58a8f2 Merge branch 'shape-specific-functions' into 'master'
Shape specific functions

These changes support creating methods that are specific to cell shape in worklets (issue #27).

See merge request !149
2015-08-28 13:21:21 -04:00
Kenneth Moreland
457720bd63 Add derivative functions. 2015-08-27 16:31:07 -06:00
Kenneth Moreland
9cd8cb22eb Make PrintSummary actually work for Field and CoordinateSystem.
The PrintSummary for CoordinateSystem went in an infinite loop. It was
supposed to call PrintSummary of its superclass (Field), but instead it
called itself.

The PrintSummary for Field only worked for fields of type vtkm::Float32.
To make it work for all array types, I added a PrintSummary method to
DynamicArrayHandle, and Field calls that without trying to cast to a
static type.
2015-08-27 10:20:30 -06:00
Kenneth Moreland
5c3646af70 Changes to Vec/VecTraits for Vec-like objects.
Some changes to the Vec class and VecTraits in anticipation of creating
Vec-like objects. The following changes are made:

* Add GetNumberOfComponents to Vec, which returns NUM_COMPONENTS.

* Likewise, all VecTraits have a GetNumberOfComponents method.

* The ToVec method in VecTraits is changed to CopyInto so that it can be
used when the length of the Vec-like is not known. CopyInto is also
added to Vec.

* VecTraits has a typedef named IsSizeStatic which is set to
VecTraitsTagSizeStatic when the number of components is known at compile
time and VecTraitsTagSizeVariable when the number of components is not
known until runtime.
2015-08-14 09:15:46 -06: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
Robert Maynard
bae6ff7f55 Merge branch 'introduce_binary_and_unary_operators' into 'master'
Introduce binary and unary operators

See merge request !94
2015-08-06 15:14:28 -04:00
Robert Maynard
06f1345316 Suppress bad conversion warnings generated by gcc. 2015-08-06 14:06:43 -04:00
Kenneth Moreland
04fce28ae3 Deal with small integer promotions
C and C++ has a funny feature where operations on small integers (char
and short) actually promote the result to a 32 bit integer. Most often
in our code the result is pushed back to the same type, and picky compilers
can then give a warning about an implicit type conversion (that we
inevitably don't care about). Here are a lot of changes to suppress
the warnings.
2015-07-30 17:41:58 -06: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
Robert Maynard
d3fd571ef2 Add vtkm/UnaryPredicates header.
Currently includes the following predicates:
  - IsDefaultConstructor
  - NotDefaultConstructor
  - LogicalNot
2015-07-30 13:12:59 -04:00
Kenneth Moreland
0b6d351a49 Enable the Vec negate operator only if the component is negatable.
Robert Maynard pointed out that the unary operator- I added to Vec could
lead to undesirable behavior for vectors of unsigned integer types. This
changed makes the definition of operator- conditional on the component
type being either a signed integer or a float type.

I also added some more actual testing of the new operator.
2015-06-30 14:55:16 -06:00
Kenneth Moreland
b5398babc5 Remove overloads for scalar to Vec multiplications
Previously, the templated Vec classes had overloaded multiply operators
to allow it to be multiplied by any basic type (float, double, int,
long, char, etc.). This was there to make it easier to multiply a vector
by a scalar without having to jump through introspection hoops for the
component types. However, using them almost always resulted in a
conversion warning on some type of compiler, so I think it is easier
just to remove them.
2015-06-30 09:23:18 -06:00