Commit Graph

40 Commits

Author SHA1 Message Date
Kitware Robot
cf0cdcf7d1 clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Vicente Adolfo Bolea Sanchez
4797426e1f silenced doxygen unsupported c++ syntax
Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-03-23 19:55:46 -04:00
Kenneth Moreland
4fdefe9f1c Suppress some deprecated warnings in visual studio 2019-12-09 07:45:40 -07:00
Kenneth Moreland
5cfc14482b Implement old ListTag features with new ListTag implementations
This cleans up the code a bit by removing duplication. More importantly,
it makes sure that the old ListTag functions work with both the new
`List` and old `ListTagBase`.
2019-12-08 19:20:34 -07:00
Kenneth Moreland
92db376236 Convert uses of ListTagBase to List 2019-12-06 15:37:46 -07:00
Kenneth Moreland
6fc883213c Deprecate ListTag operations
The newer List operations should still work on the old ListTags, so make
those changes first to ensure that everything still works as expected if
given an old ListTag.

Next step is to deprecate ListTagBase itself and move all the lists to
the new types.
2019-12-05 11:27:31 -05:00
Kenneth Moreland
70f6220fa3 Add vtkm::List
`vtkm::List` is meant to replace `vtkm::ListTag`. Rather than
subclassing a base class with a variadic template, all lists expose the
list of types.

`vtkm::ListTag` was originally created before we required C++11 so
supporting variadic templates was problematic. To hide the issue we had,
we made list tags subclass other lists rather than be the list
themselves. It makes for nicer types in the compiler, but hides
important details about what is actually in the type. It also creates
lots of unnecessary new types.

The new `vtkm::List` is in some ways simpler. All lists have to be a
`vtkm::List`. Subclasses are not supported (or rather, they will not
work as expected). All manipulations (such as `vtkm::ListAppend`)
resolve directly back to a `vtkm::List`. Although the types reported by
the compiler will be longer, they will be more specific to the types
being used. Also, the new implimentation should ultimately use fewer
types.
2019-12-04 17:13:56 -07:00
Kenneth Moreland
4c103e421a Add ListTagRemoveIf
Provides the ability to remove items from a list.
2019-10-31 14:32:17 -06:00
Kenneth Moreland
3039a18baf Add ability to get an array from a Field for a particular type
This is done through a new version of ApplyPolicy. This version takes
a type of the array as its first template argument, which must be
specified.

This requires having a list of potential storage to try. It will use
that to construct an ArrayHandleMultiplexer containing all potential
types. This list of storages comes from the policy. A StorageList
item was added to the policy.

Types are automatically converted. So if you ask for a vtkm::Float64 and
field contains a vtkm::Float32, it will the array wrapped in an
ArrayHandleCast to give the expected type.
2019-09-09 08:19:15 -06:00
Kenneth Moreland
866e1d7d5b Update comparison for virtual and multiplexer arrays
Previously the "dynamic" array was taken from a VariantArrayHandle.
However, the VariantArrayHandle will actually cast to a basic array, so
the comparison is not particularly fair. Change that to an
ArrayHandleVirtual so that it is actually calling through a virtual
method.

Also make 2 versions of the multiplexer test. The first version has an
array that is at the 1st index and the second is at the last index. This
tests whether the compiled code has to do lots of actual comparisons to
get to the last index.
2019-07-22 08:36:28 -06:00
Kenneth Moreland
5e23853521 Create ArrayHandleMultiplexer 2019-07-22 08:36:28 -06:00
Kenneth Moreland
827613263a Avoid touching ListTag internals
Currently, ListTags are implemented by having a subtype name list set to
a brigand::list. However, there is always a chance this will change. To
make things more explicit, create a vtkm::internal::ListTagToBrigandList
to make it clear what the resulting type should be (and provide some
potential future-proofing).

Also add a convenient vtkm::ListTagApply that allows you to  easily
instantiate a template with the list of types in a ListTag.
2019-07-22 08:36:28 -06:00
Kenneth Moreland
58d3123370 Add Variant
vtkm::internal::Variant is a simplified version of C++17's std::variant
or boost's variant. It is a template that takes a list of types. The
Variant may be set to any one of those types. A CastAndCall allows you
to call a functor with the appropriately cast type.
2019-07-22 08:36:28 -06:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
luz.paz
7f9b54a31a Misc. typos
Found via `codespell -q 3`
2018-08-07 17:50:41 -04:00
Sujin Philip
ecb46023f6 Add ListTagAppend and ListTagAppendUnique 2018-06-21 15:59:31 -04:00
Robert Maynard
ee69c7a4b7 Remove VS2013 workarounds from VTK-m. 2018-02-23 15:39:39 -05:00
Robert Maynard
c02349a8e7 ListCrossProduct now uses a lazy evaluation implementation
The intel compiler could not generate code in a timely manner ( 12+ hours ) when
asked to produce a cross product of very long lists. By moving to a lazy
evaluation scheme we now have all compilers product a cross product in a
reasonable amount of time ( 2-4 seconds ).

This resolves Issues:
- https://gitlab.kitware.com/vtk/vtk-m/issues/190
- https://gitlab.kitware.com/vtk/vtk/issues/17196
2017-12-11 13:31:56 -05:00
Robert Maynard
cc71e8ec6e vtkm::ListForEach can handle passing any number of extra arguments
Rather than requiring all the arguments to be placed as member variables to
the functor you can now pass extra arguments that will be added to the functor
call signature.

So for example:

  vtkm::ForEach(functor, vtkm::TypeListTagCommon(), double{42.0}, int{42});

will be converted into:

  functor(vtkm::Int32, double, int)
  functor(vtkm::Int64, double, int)
  functor(vtkm::Float32, double, int)
  functor(vtkm::Float64, double, int)
  ...
2017-11-08 08:24:47 -05:00
Robert Maynard
3701776e8d Refactor DynamicArrayHandle CastAndCall
This is the first step in making a more efficient CastAndCall for
DynamicArrayHandle.
2017-11-07 13:20:46 -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
c5232e998c Simplify the implementation of vtkm::ForEach
Also by simplifying the implementation we work around a CUDA 9 issue which
when compiling the old version would cause an internal compiler error and
crash compilation.
2017-08-30 14:35:26 -04:00
Kitware Robot
4ade5f5770 clang-format: apply to the entire tree 2017-05-25 07:51:37 -04:00
Robert Maynard
c27bb01f26 Introduces ListTagUniversal which represents a list of everything.
This makes the FilterTraits design simpler and easier to understand.
2016-12-30 15:44:21 -05:00
Robert Maynard
49c5e8222e vtkm can now find the intersection of two ListTags.
This is the first step in having filters which obey both
the filters field policy and the users applied policy in
field what fields they can run on.
2016-12-29 17:18:29 -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
ac0929a1cc Add fast tracks for ListTag operations on size <= 4.
As the significant majority of Lists contain for or less items,
this is a significant improvement to performance.
2016-09-23 16:39:20 -04:00
Robert Maynard
7ad88b6e5c Use c++11 variadic templates as storage of ListTags. 2016-09-23 16:39:20 -04:00
Robert Maynard
12810165bb Switch over to c++11 type_traits. 2016-08-31 16:11:26 -04:00
Kenneth Moreland
2e8873272d Add parentheses around condition in VTKM_STATIC_ASSERT_MSG
This is necessary for older compilers.
2015-12-15 10:29:53 -07:00
Kenneth Moreland
b15940c1e3 Declare new VTKM_STATIC_ASSERT
This is to be used in place of BOOST_STATIC_ASSERT so that we can
control its implementation.

The implementation is designed to fix the issue where the latest XCode
clang compiler gives a warning about a unused typedefs when the boost
static assert is used within a function. (This warning also happens when
using the C++11 static_assert keyword.) You can suppress this warning
with _Pragma commands, but _Pragma commands inside a block is not
supported in GCC. The implementation of VTKM_STATIC_ASSERT handles all
current cases.
2015-09-17 14:40:39 -06:00
Kenneth Moreland
2ff6576c65 Add third party wrappers around boost macros.
The boost assert macros seem to have an issue where they define an
unused typedef. This is causing the XCode 7 compiler to issue a warning.
Since the offending code is in a macro, the warning is identified with
the VTK-m header even though the code is in boost. To get around this,
wrap all uses of the boost assert that is causing the warning in the
third party pre/post macros to disable the warning.
2015-09-16 23:34:49 -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
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
6b8e7822be The Copyright statement now has all the periods in the correct location. 2015-05-21 10:30:11 -04:00
Kenneth Moreland
184118d9a2 Add a template that tests whether a type is in a list.
Also reduced the maximum list size to 15 (which is the current longest
single list we have). Trying to reduce the size of the generated code a
bit, which is getting a little long.
2014-10-22 10:35:56 -06:00
Kenneth Moreland
b368830fc0 Add VTKM_IS_LIST_TAG macro
As part of this is a ListTagCheck class that can be used for other
template magic.
2014-10-22 07:24:04 -06:00
Kenneth Moreland
b2298172ee Allow longer base lists
Previously we just hand coded base lists up to 4 entries, which was fine
for what we were using it for. However, now that we want to support base
types of different sizes, we are going to need much longer lists.
2014-10-08 12:53:01 -06:00
Kenneth Moreland
7d769a8f4a Add classes to manage point coordinates.
Each type of point coordinates has its own class with the name
PointCoordinates*. Currently there is a PointCoordiantesArray that contains
an ArrayHandle holding the point coordinates and a PointCoordinatesUniform
that takes the standard extent, origin, and spacing for a uniform rectilinear
grid and defines point coordiantes for that. Creating new PointCoordinates
arrays is pretty easy, and we will almost definitely add more. For example,
we should have an elevation version that takes uniform coordinates for
a 2D grid and then an elevation in the third dimension. We can probably
also use a basic composite point coordinates that can build them from
other coordinates.

There is also a DynamicPointCoordinates class that polymorphically stores
an instance of a PointCoordinates class. It has a CastAndCall method that
behaves like DynamicArrayHandle; it can call a functor with an array handle
(possible implicit) that holds the point coordinates.
2014-05-15 13:41:45 -06:00
Kenneth Moreland
c2d926fa49 Add tag-based type list templates
Provies a list of types in a template like boost::mpl::vector and a
method to call a functor on each type. However, rather than explicitly
list each type, uses tags to identify the list. This provides the
following main advantages:

1. Can use these type lists without creating horrendously long class
names based on them, making compiler errors easier to read. For example,
you would have a typename like MyClass<TypeListTagVectors> instead of
MyClass<TypeList<Id3,Vector2,Vector3,Vector4> > (or worse if variadic
templates are not supported). This is the main motivation for this
implementation.

2. Do not require variadic templates and usually few constructions. That
should speed compile times.

There is one main disadvantage to this approach: It is difficult to get
a printed list of items in a list during an error. If necessary, it
probably would not be too hard to make a template to convert a tag to a
boost mpl vector.
2014-03-31 17:45:52 -06:00