Commit Graph

365 Commits

Author SHA1 Message Date
Chuck Atkins
f74c0d3c88 Remove type conversion related warnings for GCC 2016-03-17 13:05:38 -04:00
Robert Maynard
8114736510 fix a long long to int warning. 2016-03-16 13:27:32 -04:00
Robert Maynard
177b31f330 Merge topic 'properly_compute_scatter_array_lengths'
85084f2c ScatterIdentity::GetVisitArray parameters are now named properly
86ecad65 ScatterIdentity::GetOutputToInputMap parameters are now named properly
40896e2b Allocate the scatter arrays to be proper length.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !359
2016-03-15 16:59:52 -04:00
Robert Maynard
85084f2ca1 ScatterIdentity::GetVisitArray parameters are now named properly
Now it is clear you pass in the input range and you will get the output
range
2016-03-15 16:49:36 -04:00
Robert Maynard
86ecad659a ScatterIdentity::GetOutputToInputMap parameters are now named properly
Now it is clear you pass in the input range and you will get the output
range.
2016-03-15 16:20:37 -04:00
Robert Maynard
40896e2bab Allocate the scatter arrays to be proper length.
The previous code would over allocate all the scatter arrays since
it was computing the output range, than using that as the input range.
2016-03-15 13:13:34 -04:00
Robert Maynard
531dececfd Multiple changes to VertexClustering to make it more suitable for filter.
The original implementation wasn't flexible enough to handle the requirements
that filter requires ( mainly policy support ).
2016-03-14 08:39:17 -04:00
Kenneth Moreland
f9750e83f7 Fix issues with Field constructor overloads
I ran into a few minor issues with the constructors to the Field class.

The big change I made was that I removed the Field constructors that
take an example type and create an empty field of that type. The problem
was that the example type was easily confused with some other type that
was supposed to describe an array. This lead to some odd behavior in the
compiler and resulted in errors in unexpected places.

The use case for this constructor is dubious. There were several tests
in the code that would create an empty field, add it to a data set, then
get it back out to pass to the worklet. The code is much simpler if you
just make an ArrayHandle of the right type and use that in the worklet
invoke directly. It is also faster to compile with smaller code because
the type is known statically (whereas it is lost the other way).

The other change was to declare references to ArrayHandle and
DynamicArrayHandle as const. There is nothing in the behavior that
invalidates the const, and it accepts arrays constructed in the
parameter.
2016-01-21 13:54:05 -07:00
Kenneth Moreland
c346d40eb4 Add WorkletMapCellToPoint class
The map topology worklets are to have convenience classes for all the
common mappings. However WorkletMapCellToPoint was left out as an
oversight. This adds the class.
2016-01-20 16:16:58 -07:00
Robert Maynard
8070586ea7 Merge topic 'less_temporary_copies'
4153c2c7 Found a few more places where we don't need to return by value.
dd85fc13 Document why we certain classes member variables need to be const ref.
6fb86da8 DynamicArrayHandle Casting methods now holds by const * const.
c1560e2d Perform less unnecessary copies when deducing a worklets parameters.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !320
2016-01-20 12:02:57 -05:00
Kenneth Moreland
9ccd7fa9c7 Change Regular to Uniform
There was an inconsistency in naming classes where axes-aligned grids
with even spacing were sometimes called "uniform" and sometimes called
"regular". Maintain consistency by always calling them uniform.
2016-01-19 15:54:05 -07:00
Robert Maynard
c1560e2d3f Perform less unnecessary copies when deducing a worklets parameters.
One of the causes of the large library size and slow compile times has been
that vtkm has been creating unnecessary copies when not needed. When the
objects being copied use shared_ptr this causes a bloom in library size. I
presume this bloom is caused by the atomic increment/decrement that is
required by shared_ptr.

For testing I used the following example:
```
struct ExampleFieldWorklet : public vtkm::worklet::WorkletMapField
{
  typedef void ControlSignature( FieldIn<>, FieldIn<>, FieldIn<>,
                                 FieldOut<>, FieldOut<>, FieldOut<> );
  typedef void ExecutionSignature( _1, _2, _3, _4, _5, _6 );

  template<typename T, typename U, typename V>
  VTKM_EXEC_EXPORT
  void operator()( const vtkm::Vec< T, 3 > & vec,
                   const U & scalar1,
                   const V& scalar2,
                   vtkm::Vec<T, 3>& out_vec,
                   U& out_scalar1,
                   V& out_scalar2 ) const
  {
    out_vec = vec * scalar1;
    out_scalar1 = scalar1 + scalar2;
    out_scalar2 = scalar2;
  }

  template<typename T, typename U, typename V, typename W, typename X, typename Y>
  VTKM_EXEC_EXPORT
  void operator()( const T & vec,
                   const U & scalar1,
                   const V& scalar2,
                   W& out_vec,
                   X& out_scalar,
                   Y& ) const
  {
  //no-op
  }
};

int main(int argc, char** argv)
{
  std::vector< vtkm::Vec<vtkm::Float32, 3> > inputVec;
  std::vector< vtkm::Int32 > inputScalar1;
  std::vector< vtkm::Float64 > inputScalar2;

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleV =
    vtkm::cont::make_ArrayHandle(inputVec);

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleS1 =
    vtkm::cont::make_ArrayHandle(inputVec);

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleS2 =
    vtkm::cont::make_ArrayHandle(inputVec);

  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleOV;
  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleOS1;
  vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32, 3> > handleOS2;

  std::cout << "Making 3 output DynamicArrayHandles " << std::endl;
  vtkm::cont::DynamicArrayHandle out1(handleOV), out2(handleOS1), out3(handleOS2);

  typedef vtkm::worklet::DispatcherMapField<ExampleFieldWorklet> DispatcherType;

  std::cout << "Invoking ExampleFieldWorklet" << std::endl;
  DispatcherType dispatcher;

  dispatcher.Invoke(handleV, handleS1, handleS2, out1, out2, out3);

}
```

Original vtkm would generate a binary of size 4684kb and would perform 91
ArrayHandle copies or assignments. With this branch the binary size is
reduced to 2392kb and will perform 36 copies or assignments.
2016-01-19 09:20:49 -05:00
Kenneth Moreland
ed43dad6ca Simplify and unify cast interface.
Previously, DynamicArrayHandle and DynamicCellSet had slightly different
interfaces to their CastTo feature. It was a bit confusing and not all
that easy to use.

This change simplifies and unifies them by making each class have a single
CopyTo method that takes a reference to a cast object (an ArrayHandle or
CellSet, respectively) and fills that object with the data contained if
the cast is successfull. This interface gets around having to declare
strange types.

Each object also has a Cast method that has to have a template parameter
specified and returns a reference of that type (if possible).

In addition, the old behavior is preserved for DynamicArrayHandle (but
not DynamicCellSet). To avoid confusion, the name of that cast method is
CastToTypeStorage. However, the method was chaned to not take parameters
to make it consistent with the other Cast method.

Also, the IsType methods have been modified to reflect changes in
cast/copy. IsType now no longer takes arguments. However, an alternate
IsSameType does the same thing but does take an argument.
2016-01-18 15:58:04 -07:00
Robert Maynard
61ed34e154 Merge topic 'remove_fill_via_copy'
4bb3cce0 Use the DataSetBuilderExplicitIterative helper where it is useful.
eba2fb49 Fixed some warnings in the DataSetBuilder code.
dd312516 Fix issue found be moving over to  DataSetBuilderExplicit.
e7456fa1 Update vtkm tests and examples to use DataSetBuilders.
449c425a Allow DataSetBuilderExplicit to create CellSetSingleType.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !318
2016-01-18 17:17:40 -05:00
Robert Maynard
4bb3cce016 Use the DataSetBuilderExplicitIterative helper where it is useful. 2016-01-18 16:19:48 -05:00
Robert Maynard
dd312516f6 Fix issue found be moving over to DataSetBuilderExplicit.
Mainly issue dealing with dimensionality of cell sets and what that represents.
Have added in code to allow user to specify a custom dimensionality so that
tests continue to work properly.
2016-01-15 16:16:38 -05:00
Robert Maynard
e7456fa120 Update vtkm tests and examples to use DataSetBuilders. 2016-01-15 15:44:56 -05:00
Robert Maynard
9da2c081a6 Merge topic 'reduce_placeholder_name_length'
c8551cb7 Reduce the name length on Args<1>, etc to help reduce symbol size.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !312
2016-01-15 10:12:10 -05:00
Robert Maynard
c8551cb758 Reduce the name length on Args<1>, etc to help reduce symbol size. 2016-01-15 08:32:50 -05:00
Robert Maynard
e39c7819aa Merge topic 'more_worklets_not_templated_on_deviceadapter'
956cedfd Turn off the benchmarking ExternalsFaces.
18b866d6 Threshold worklet is not templated on device adapter.
dbee9275 ExternalFaces worklet is not templated on device adapter.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !315
2016-01-15 08:25:18 -05:00
Robert Maynard
f4d2b63fcb Merge topic 'vertex_clustering_not_templated_on_device'
12ddcfdd VertexClustering worklet is not templated on device adapter.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !314
2016-01-14 16:15:10 -05:00
Robert Maynard
956cedfd17 Turn off the benchmarking ExternalsFaces. 2016-01-14 15:56:10 -05:00
Robert Maynard
18b866d6e0 Threshold worklet is not templated on device adapter.
This should help reduce the amount of code generation, when building the
Threshold worklet for all device adapters.
2016-01-14 15:55:22 -05:00
Robert Maynard
dbee92752e ExternalFaces worklet is not templated on device adapter.
This should help reduce the amount of code generation, when building the
ExternalFaces worklet for all device adapters.
2016-01-14 15:55:12 -05:00
Robert Maynard
12ddcfdda7 VertexClustering worklet is not templated on device adapter.
This should help reduce the amount of code generation, when building the
VertexClustering worklet for all device adapters.
2016-01-14 15:42:27 -05:00
Dave Pugmire
a5972e6a15 Merge topic 'dataset-builder2'
f86382f0 Fix support for CoordinateSystems using ArrayHandleCartesianProduct.
d6a2a142 Add toleranced compare for values. Add tests for vtkm::Float32,Float64,Id typed arrays.
5d438353 Add toleranced comparisions for bounds validation. Also, add vtkm::Float32 and vtkm::Float64 to the testing for rectilinear and regular datasets.
b225ae97 Rectilinear coordinates (created with DataSetBuilderRectilinear) are now converted to vtkm::FloatDefault. This reduces the number of types to consider when casting inside CoordinateSystem, and was felt by all to be a reasonable restriction.
d755e43d Use ArrayHandleCompositeVector to represent separated point arrays for DataSetBuilderExplicit.h.
c7b0ffb8 Add tests for DataSetBuilderExplicit. Added cont/testing/ExplicitTestData.h which includes several explicit datasets.  These datasets come from VTK data generated in VisIt.  The new unit tests build datasets in several different ways and do some basic validation.
b4d04fff Add specialization of printSummary_ArrayHandle for UInt8. It prints them as characters, which are a little hard to understand to this computer scientist.
bd929c20 Fix compiler warnings.
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !262
2016-01-14 14:57:02 -05:00
T.J. Corona
15e1f80ddd Generalize MarchingCubes input with additional template parameters. 2016-01-08 14:56:10 -05:00
Robert Maynard
34ad520987 Merge topic 'marching_cubes_normal_generation_option'
82a573f7 MarchingCubes is now able to not generate normals.
502e7c28 Merge branch 'cleanup_scatter_counting_uses' into marching_cubes_normal_generation_option
8079dc28 MarchingCubes generate step now requires a ScatterCounting object.
4cd2f582 Add a default constructor for ScatterCounting.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !300
2016-01-08 11:50:10 -05:00
Robert Maynard
82a573f712 MarchingCubes is now able to not generate normals. 2016-01-08 10:42:49 -05:00
Kenneth Moreland
23c3cd3020 Add PointCount to WorkletMapPointToCell.
WorkletMapPointToCell is a convenience subclass of WorkletMapTopology.
As such, it renames all the From/To signature tags to say Point/Cell to
be easier to read. However, the alias for FromCount was missing. Add the
alias PointCount.
2016-01-07 15:26:29 -07:00
Robert Maynard
502e7c28f2 Merge branch 'cleanup_scatter_counting_uses' into marching_cubes_normal_generation_option 2016-01-04 16:52:46 -05:00
Robert Maynard
30ac46f20e We know the exact FieldOutCell types for MarchingCubes, so restrict it.
By restricting the types explicitly in the ControlSignature we reduce
the code bloat, if we ever pass in a DynamicArrayHandle as one of those
parameters.
2016-01-04 16:43:28 -05:00
Robert Maynard
8079dc28f0 MarchingCubes generate step now requires a ScatterCounting object.
Instead of having the generate step templated on the device adapter and
the counting handle, we take in a fully constructed scatter counting object.
2016-01-04 16:38:11 -05:00
Robert Maynard
4cd2f582f4 Add a default constructor for ScatterCounting.
Without a default constructor for ScatterCounting any class that wants
to hold onto a ScatterCounting object is required to know what device
they are running on. By allowing default construction, we can move that
requirement to just have a method on the object require a device adapter
object.
2016-01-04 16:00:29 -05:00
Robert Maynard
c70da5fc23 Extend vtkm::DeviceAdapterTraits to include a unique numeric identifier.
Previously each device adapter only had a unique string name. This was
not the best when it came to developing data structures to track the status
of a given device at runtime.

This adds in a unique numeric identifier to each device adapter. This will
allow classes to easily create bitmasks / lookup tables for the validity of
devices.
2015-12-16 11:18:52 -05:00
Robert Maynard
f96206338f Merge topic 'enable_runtime_detection_of_cuda'
a7127f0f Adding vtkm::cont::RuntimeDeviceInformation.
7d249e89 Move DeviceAdapterTraits into vtkm::cont as they are user API.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !287
2015-12-16 08:48:24 -05:00
Robert Maynard
a7127f0fc3 Adding vtkm::cont::RuntimeDeviceInformation.
The RuntimeDeviceInformation class allows developers to check if a given
device is supported on a machine at runtime. This allows developers to properly
check for CUDA support before running any worklets.
2015-12-15 17:25:27 -05:00
Robert Maynard
7b7a56c664 UnitTestCellAverage now properly verifies against an explicit cell set. 2015-12-14 10:07:32 -05:00
Robert Maynard
7d249e8996 Move DeviceAdapterTraits into vtkm::cont as they are user API.
When writing multiple backend code users of vtkm need to use the
DeviceAdapterTraits classes, so therefore we should move them to vtkm::cont
to signify this.
2015-12-11 09:52:18 -05:00
dpugmire
e674a6c80d Fix issue with PointToCell indices not being computed.
Also, mark them as valid, when valid.
2015-12-08 15:14:43 -05:00
Kenneth Moreland
6f03f72b49 Use WholeArrayIn instead of ExecObject for MarchingCubes worklets
The two worklets for marching cubes use tables stored in arrays that
have random access. Previously, they arrays were passed using the
ExecObject tag in ControlSignature along with ExecutionWholeArrayConst.
This changes to using a WholeArrayIn tag and just passing the
ArrayHandle directly to the Invoke method. The end result is the same,
but the code is a bit cleaner.
2015-12-07 09:52:29 -07:00
Kenneth Moreland
2ac8456b5e Add WholeArray* ControlSignature tags
The WholeArrayIn, WholeArrayInOut, and WholeArrayOut ControlSignature
tags behave similarly to using an ExecObject tag with an
ExecutionWholeArray or ExecutionWholeArrayConst object. However, the
WholeArray* tags can simplify some implementations in two ways. First,
it allows you to specify more precisely what data is passed in. You have
to pass in an ArrayHandle or else an error will occur (as opposed to be
able to pass in any type of execution object). Second, this allows you
to easily pass in arrays stored in DynamicArrayHandle objects. The
Invoke mechanism will automatically find the appropriate static class.
This cannot be done easily with ExecutionWholeArray.
2015-12-07 09:52:29 -07:00
T.J. Corona
baa73eaad8 Merge topic 'marching-cubes'
33b0d1bf Move marching cubes edge table out of the worklet.
a5ae4127 Remove IsosurfaceUniformGrid.
35355382 Generalize IsosurfaceUniformGrid to Accept explicit cell sets.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !272
2015-12-03 14:54:02 -05:00
T.J. Corona
33b0d1bfd7 Move marching cubes edge table out of the worklet. 2015-12-02 15:33:52 -05:00
T.J. Corona
a5ae4127e0 Remove IsosurfaceUniformGrid. 2015-12-02 15:11:56 -05:00
Dave Pugmire
29e4f06691 remove explicitdataset1, which was identical to dataset0. 2015-12-01 17:24:52 -05:00
Kenneth Moreland
a598f03fbb Fix initialization order of fields in MakeStreamLines class
When a C++ object is constructed, the fields (ivars) of that object are
initialized in the order they are declared in the structure regardless
of the order of initializers listed in the constructor. Thus, it is good
C++ convention to list the initializers of the constructor in the same
order they are declared in the class so that there is no confusion about
the order of initialization (which can matter if there are any
dependencies). To help enforce this convention, some compilers warn if
the order does not match. This commit fixes that issue.

This commit also removes trailing whitespace at the end of some lines in
StreamLineUniformGrid.h. My editor does this automatically because
trailing whitespace bugs some programmers.
2015-11-30 14:20:00 -07:00
Patricia Kroll Fasel - 090207
6c4fb856df Add example data file for streamline. 2015-11-23 17:00:22 -07:00
Patricia Kroll Fasel - 090207
cba0e218d8 Verify unit test results 2015-11-23 16:46:23 -07:00
Patricia Kroll Fasel - 090207
3946b0c462 Add unit test, pass all args in Run() 2015-11-23 16:19:26 -07:00