Commit Graph

296 Commits

Author SHA1 Message Date
Allison Vacanti
29ea46fa52 Refactor IsWritableArrayHandle to use PortalSupportsSets. 2019-09-11 12:50:17 -04: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
bf6d6cc604 Get around alignas bug in GCC 4.8
I ran into a bug with GCC 4.8 where if you use the alignas keyword
with a number declared with a constexpr, it gives an error about
the expression not being a constant expression (even though it
is). A workaround to the issue is to wrap the alianas in a class
templated by the size you want to align with. GCC does not
complain when you use a constexpr with a template parameter, and
it is happy to use that template parameter in the alignas
expression.

Workaround found here:
https://stackoverflow.com/questions/29879609/g-complains-constexpr-function-is-not-a-constant-expression
2019-08-08 07:59:43 -06:00
Allison Vacanti
5db762ee71 Refactor topology mappings to clarify meaning.
The `From` and `To` nomenclature for topology mapping has been confusing for
both users and developers, especially at lower levels where the intention of
mapping attributes from one element to another is easily conflated with the
concept of mapping indices (which maps in the exact opposite direction).

These identifiers have been renamed to `VisitTopology` and `IncidentTopology`
to clarify the direction of the mapping. The order in which these template
parameters are specified for `WorkletMapTopology` have also been reversed,
since eventually there may be more than one `IncidentTopology`, and having
`IncidentTopology` at the end will allow us to replace it with a variadic
template parameter pack in the future.

Other implementation details supporting these worklets, include `Fetch` tags,
`Connectivity` classes, and methods on the various `CellSet` classes (such as
`PrepareForInput` have also reversed their template arguments. These will need
to be cautiously updated.

The convenience implementations of `WorkletMapTopology` have been renamed for
clarity as follows:

```
WorkletMapPointToCell --> WorkletVisitCellsWithPoints
WorkletMapCellToPoint --> WorkletVisitPointsWithCells
```

The `ControlSignature` tags have been renamed as follows:

```
FieldInTo --> FieldInVisit
FieldInFrom --> FieldInMap
FromCount --> IncidentElementCount
FromIndices --> IncidentElementIndices
```
2019-08-06 11:27:26 -04:00
Kenneth Moreland
0be50c119d Update VTK-m code to use new Vec aliases
Should make the code easier to read.
2019-07-31 12:55:40 -06:00
Kenneth Moreland
01176efbdf Provide implementation of aligned_union
Although it is mostly C++11 compliant, GCC 4.8 does not have an
implementation of std::aligned_union. We cannot drop this compiler, so
provide our own implementation in that case.
2019-07-29 17:09:27 -06:00
Kenneth Moreland
d80a8125cc Sprinkle noexcept goodness on Variant and ArrayPortalMultiplexer
Allow Variant copy constructor/operators and its CastAndCall to operate
in noexcept methods. This can help the compiler make optimizations.
2019-07-25 15:25:29 -06:00
Kenneth Moreland
a96a13cf33 Use large case statements to CastAndCall variants
Previously, templates were used in the implementation of CastAndCall to
find the type and call the underlying function. The templates checked
one type at a time.

However, compilers were not always great at optimizing a 15-call deep
stack with an if statement at each one. Instead, use a case statement in
a single function block. This requires providing separate code for each
number of types. Currently, up to 20 are created (with pyexpander). If
there are more than that, then the template recurses.
2019-07-22 14:37:17 -06:00
Kenneth Moreland
7b72e31dfb Fixes for CUDA 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
Mark Kim
771c7cb7b3 fix warnings 2019-06-21 12:11:36 -04:00
Mark Kim
978fc2b9c2 Copyright notices. 2019-06-21 11:35:46 -04:00
Mark Kim
cffd3873fc Merge branch 'advdatamodel' 2019-06-20 22:20:44 -04:00
Mark Kim
6e1d3a84f0 First Extrude commit.
how did any of this work?

match other CellSet file layouts.

???

compile in CUDA.

unit tests.

also only serial.

make error message accurate

Well, this compiles and works now.

Did it ever?

use CellShapeTagGeneric

UnitTest matches previous changes.

whoops

Fix linking problems.

Need the same interface

as other ThreadIndices.

add filter test

okay, let's try duplicating CellSetStructure.

okay

inching...

change to wedge in CellSetListTag

Means changing these to support it.

switch back to wedge from generic

compiles and runs

remove ExtrudedType

need vtkm_worklet

vtkm_worklet needs to be included

fix segment count for wedge specialization

need to actually save the index

for the other constructor.

specialize on Explicit

clean up warning

angled brackets not quotes.

formatting
2019-06-20 22:17:24 -04:00
Kenneth Moreland
03ea0bab0a Use __pragma on MSVC
All C++11 compilers support _Pragma to insert pragmas inline into code
and within macros. All compilers, that is, except for visual studio
because Microsoft has to be contrarian and make life miserable for all
programmers. Instead, you have to use __pragma with visual studio.
2019-06-05 10:04:56 -06:00
Robert Maynard
bdabfbe116 Make sure ArrayPortalUniformPointCoordinates constructor is explicit
We have had problems in the past with host/device default constructors
2019-04-26 10:23:59 -04:00
Robert Maynard
0f31c69f32 Remove unnecessary constructor from ParameterContainer 2019-04-24 10:12:43 -04:00
Robert Maynard
ff687016ee For VTK-m libs all includes of DeviceAdapterTagCuda happen from cuda files
It is very easy to cause ODR violations with DeviceAdapterTagCuda.
If you include that header from a C++ file and a CUDA file inside
the same program we an ODR violation. The reasons is that the C++
versions will say the tag is invalid, and the CUDA will say the
tag is valid.

The solution to this is that any compilation unit that includes
DeviceAdapterTagCuda from a version of VTK-m that has CUDA enabled
must be invoked by the cuda compiler.
2019-04-22 10:39:54 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Allison Vacanti
d01b973821 Allow VTKM_SUPPRESS_EXEC_WARNINGS to be used inside macros. 2019-04-11 08:27:17 -04:00
Robert Maynard
0130088b86 Suppress more self-assign-overloaded warnings found by clang 2019-04-09 14:09:54 -04:00
Robert Maynard
fa54558542 UnitTestArrayPortalValueReference doesn't warn when compiled with appleclang 2019-04-09 12:26:22 -04:00
Robert Maynard
5c2f2ebce9 suppress warnings found by Wself-assign-overloaded 2019-04-09 11:42:45 -04:00
Robert Maynard
58884a7299 Fix warnings found when cuda is the cuda host compiler 2019-04-05 15:40:03 -04:00
Kenneth Moreland
e43770a376 Update pyexpander input files to work with python 3
Python 3 does not use xrange anymore. Use the range function instead.
2019-04-04 11:20:56 -06:00
Robert Maynard
f1056affa7 Move select functions to host only to remove host/device suppressions
We previously had to mark the make_FunctionInterface function as
host/device as it could be used in either place. The ramifications
of this is that each time we launched a worklet any input parameter
had to either suppress cuda exceptions, or had to rely on the
DispatcherBase to suppress the warnings.

By making make_FunctionInterface only host callable ( as it is ),
we can remove all of our unneccesary suppression logic and better
expose real issues with code that is marked host/device but can't
be due to calling things such as std::abort
2019-04-03 12:48:33 -04:00
Kenneth Moreland
4e34feecb4 Add ability to specialize worklet for device
This adds an ExecutionSignature tag named Device that passes the
DeviceAdapterTag as an argument to the worklet's operator(). This allows
worklets to specialize their code based on the device.
2019-04-01 10:01:54 -06:00
Robert Maynard
8dd6b1b2cb Merge topic 'update_constexpr_array_macros'
31cf7383c CUDA 10 allows us to use constexpr arrays!

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1573
2019-03-11 08:12:44 -04:00
Robert Maynard
31cf7383c3 CUDA 10 allows us to use constexpr arrays! 2019-03-08 13:58:55 -05:00
Kenneth Moreland
bfe06d6d18 Merge topic 'point-merge'
6aa99aec0 Add ability to remove degenerate cells in CleanGrid
5688375c9 Add point merge capabilities to CleanGrid filter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Abhishek Yenpure <abhishek@uoregon.edu>
Merge-request: !1558
2019-03-07 20:33:36 -05:00
Robert Maynard
8114e9e627 VTK-m now doesn't use reserved C++ identifiers
Fixes #340
2019-02-28 15:08:08 -05:00
Kenneth Moreland
5688375c99 Add point merge capabilities to CleanGrid filter 2019-02-26 12:44:33 -07:00
Kenneth Moreland
191d6e5580 Add Mask capabilities to worklets
Mask objects allow you to specify which output values should be
generated when a worklet is run. That is, the Mask allows you to skip
the invocation of a worklet for any number of outputs.
2019-02-25 08:58:39 -07:00
Kenneth Moreland
af4aef9913 Add missing %= operator to ArrayPortalValueReference 2019-02-22 17:11:11 -07:00
Kenneth Moreland
9e02cd33af Declare ArrayPortalValueReference::operator= as const
Declaring operator= as const seems a little weird because we are
changing the value. But remember that ArrayPortalReference is only a
reference class. The reference itself does not change, just the thing
that it is referencing. So declaring as const is correct and necessary
so that you can set the value of a reference returned from a function
(which is a right hand side value).
2019-02-21 08:39:21 -07:00
Kenneth Moreland
b141f75150 Add more operator= to ArrayPortalValueReference
Forward arguments to assignment operator in ArrayPoetalValueReference
better.
2019-02-20 13:33:55 -07:00
Kenneth Moreland
c8db70ae8c Fix warning about automatic conversions loosing precision 2019-02-20 13:33:55 -07:00
Kenneth Moreland
1ca55ac319 Add specialized operators for ArrayPortalValueReference
The ArrayPortalValueReference is supposed to behave just like the value
it encapsulates and does so by automatically converting to the base type
when necessary. However, when it is possible to convert that to
something else, it is possible to get errors about ambiguous overloads.
To avoid these, add specialized versions of the operators to specify
which ones should be used.

Also consolidated the CUDA version of an ArrayPortalValueReference to the
standard one. The two implementations were equivalent and we would like
changes to apply to both.
2019-02-20 13:33:55 -07:00
Ben Boeckel
5b71c34675 brigand: fix intel check
This matches the check that CMake uses to detect the Intel compiler. It
also avoids warnings with `-Wundef`.
2019-02-14 16:26:14 -05: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
Robert Maynard
d6f66d17a3 Testing run methods now take argc/argv to init logging/runtime device
`vtkm::cont::testing` now initializes with logging enabled and support
for device being passed on the command line, `vtkm::testing` only
enables logging.
2019-01-17 13:16:27 -06:00
Robert Maynard
cead0e26ac ArrayPortalVirtual+ nvcc 9 fix annotation warnings on defaulted methods 2019-01-08 12:40:15 -05:00
Robert Maynard
6e1cbaa16a Add StorageVirtual and ArrayHandleVirtual to vtkm::cont 2018-12-27 14:35:56 -05:00
Sujin Philip
6d81bc8b06 Implement extents support
Adds a variable `GlobalPointIndexStart` to `CellSetStructured`.
Adding this to the cell-set, instead of the coordinate system, enables this
feature for different types of datasets like uniform grid, rectilinear, etc.,
with this one change.
The extents can be computed using `GlobalPointIndexStart` and `PointDimensions`.
2018-12-03 15:56:45 -05:00
Allison Vacanti
bd337854ec Initial implementation of general logging.
Addresses #291.
2018-10-02 11:37:55 -04:00
Robert Maynard
23c5f11823 vtk-m brigand nows knows what workaround are only needed for CUDA 9.
Some CUDA 9 compiler issues are fixed in CUDA 10.
2018-09-20 14:02:16 -04:00
Robert Maynard
3eec282f24 GCC 7.1 was warning about invalid ConnectivityStructuredInternals states
In theory if you requested negative indices's or generated a structure
with invalid point sizes the result of some operations would be
in an invalid state. Gave the compiler hints that this states
can't occur.
2018-09-17 08:15:43 -04:00
Robert Maynard
e3ef8ed52c Make BRIGAND_COMP_CUDA_9PLUS capture all future versions of cuda 2018-08-09 15:12:24 -04:00