Commit Graph

1164 Commits

Author SHA1 Message Date
Robert Maynard
1d28a6dd04 Add a small amount of documentation to CellSet Dimensionality. 2016-01-25 09:23:08 -05:00
Kenneth Moreland
feaed27cb0 Fixes related to changes in how the Dynamic class do casting
A recently merged topic branch changed the methods of how the Dynamic
classes do casting and type checking. The
support_visit_structured_points topic branch was started before these
changes and merged to master afterward. It used an old version of IsType
that did not conflict and caused a compile error. This fixes the compile
error.
2016-01-21 15:27:25 -07:00
Kenneth Moreland
51ef8f470c Merge branch 'static-dataset-builder-methods' into 'master'
Improvements to data set builds

Some improvements to data set builders to make them easier to use. The main changes are making most of the methods static so that the class does not have to be instantiated and to accept DynamicArrayHandle for fields.

See merge request !325
2016-01-21 17:21:59 -05: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
e066214090 Add methods to DataSetFieldAdd that accept a DynamicArrayHandle 2016-01-21 13:00:41 -07:00
Robert Maynard
27c25bd72f Merge topic 'support_visit_structured_points'
c8c0556d Fixed issues that Sujin found during code review.
33b20a8d All readers now support Fields before data (aka VisIt files).
10d59c17 StructuredPointsReader supports multiple visit fields.
735462f8 Update the io readers to handle visit style structured points files.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sujin Philip <sujin.philip@kitware.com>
Merge-request: !313
2016-01-21 13:41:02 -05:00
Kenneth Moreland
d626f7317d Make DataSetBuilder methods static
This makes is slightly easier to use as you do not actually have to
construct the DataSetBuilder object but just call its static method.

The DataSetBuilderExplicitIterative methods are not static because they
use state of the builder object to create the data.
2016-01-21 10:45:33 -07:00
Robert Maynard
c8c0556dbb Fixed issues that Sujin found during code review. 2016-01-21 12:44:14 -05: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
33b20a8d18 All readers now support Fields before data (aka VisIt files). 2016-01-20 15:58:41 -05:00
Kenneth Moreland
020c31caf9 Merge branch 'get-cell-dimensions' into 'master'
Add GetCellDimensions to CellSetStructured

There was not an easy way to get the dimensions of cells in a structured
data set. Add a method to get that.

See merge request !323
2016-01-20 14:42:42 -05: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
384727d00e Add GetCellDimensions to CellSetStructured.
There was not an easy way to get the dimensions of cells in a structured
data set. Add a method to get that.
2016-01-20 09:24:31 -07:00
Kenneth Moreland
dec61fe51a Merge branch 'regular-to-uniform' into 'master'
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.

See merge request !322
2016-01-20 11:04:44 -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
40ecf08948 Merge topic 'cleanup_copy_code_in_datasetbuilder'
2ae3f13a Don't use DeviceAdapter inside DataSetBuilderRectilinear.
8cf9b979 Don't use DeviceAdapter inside DataSetBuilderExplicit.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !319
2016-01-19 17:00:55 -05:00
Robert Maynard
2ae3f13a79 Don't use DeviceAdapter inside DataSetBuilderRectilinear.
No need to use the device adapter, just do a manual host side copy.
2016-01-19 15:43:49 -05:00
Robert Maynard
8973ca8f08 Merge topic 'simplify-vectorize-pragma-logic'
86bb45b9 Simplify the ifdef conditions used for vector pragma definitions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !310
2016-01-19 14:59:27 -05:00
Robert Maynard
4153c2c786 Found a few more places where we don't need to return by value. 2016-01-19 10:54:37 -05:00
Robert Maynard
dd85fc1366 Document why we certain classes member variables need to be const ref. 2016-01-19 09:29:55 -05:00
Robert Maynard
6fb86da8f9 DynamicArrayHandle Casting methods now holds by const * const.
This is to make it more clear to developers that the handle is a
reference that could be NULL.
2016-01-19 09:29:55 -05: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
Robert Maynard
8cf9b979c7 Don't use DeviceAdapter inside DataSetBuilderExplicit.
No need to use the device adapter, just do a manual host side copy.
2016-01-19 08:56:50 -05:00
Kenneth Moreland
c62937d612 Fix warning about uninitialized value. 2016-01-18 15:58:07 -07: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
Kenneth Moreland
92d2ad6a72 Consolidate dynamic_cast calls.
Previously in DynamicArrayHandle the dynamic_cast was contained in a
method that was reimplemented for every different instance of
DynamicArrayHandleBase. Change that to put the dynamic_cast in a
function outside of the class so that there is only one implementation
created per ArrayHandle type.

Similarly, DynamicCellSet had its dynamic_cast in a method plus there
was a second version in the functors used for the CastAndCall method.
Consolidate all of these into a function outside of either much like
DynamicArrayHandle.
2016-01-18 15:55:02 -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
eba2fb493f Fixed some warnings in the DataSetBuilder code. 2016-01-18 15:04:18 -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
449c425a23 Allow DataSetBuilderExplicit to create CellSetSingleType.
If you have only a single cell shape, you can now efficiently create
a vtkm::cont::DataSet whose CellSet is vtkm::cont::CellSetSingleType.
2016-01-15 15:06:09 -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
Kenneth Moreland
f71b59e733 Merge branch 'cuda-timer-bug' into 'master'
Synchronize the CUDA timer on both the start and end events

Previously, the timer for CUDA devices only called cudaEventSynchronize
at the end event when asking for the elapsed time. This, however, could
allow time to pass from when the timer was reset to when the start event
happened that was not recorded in the timer. This added synchronization
should make sure that all time spent in CUDA is recorded.

See merge request !291
2016-01-14 18:22:08 -05:00
Kenneth Moreland
1d1334e2ea Merge branch 'dataset-builder-fixes' into 'master'
DataSetBuilder fixes

There were some compiler warnings and testing issues with the
recently merged DataSetBuilder branch. This fixes some of
those problems.

See merge request !316
2016-01-14 18:03:40 -05:00
Kenneth Moreland
0b2823ba55 Make UnitTestArrayHandleCartesianProduct faster
Reduce the number of conditions UnitTestArrayHandleCartesianProduct
tries so that it is faster. All the conditions are pretty similar, so it
should be OK to reduce some.
2016-01-14 15:22:33 -07:00
Kenneth Moreland
427f3cf57d Make Rectilinear and Regular builder tests faster
Previously UnitTestDataSetBuilderRectilinear and
UnitTestDataSetBuilderRegular did an exhaustive test of all possible
grid sizes within a certain amount of dimensions and with some number of
ways to build point arrays. This created hundreds of thousands of cases
that were checked, and it was running a long time. At best it wasted
time and at worst ctest reported the test as timed out.

It is not really necessary to perform an exhaustive test. The tests are
changed to do 10 trials using random values for dimensions and fill
methods.
2016-01-14 15:15:19 -07: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
Kenneth Moreland
e0184e6648 Fixed warnings about sign conversion. 2016-01-14 14:01:28 -07: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
Robert Maynard
10d59c176b StructuredPointsReader supports multiple visit fields. 2016-01-14 13:10:24 -05:00
Robert Maynard
735462f891 Update the io readers to handle visit style structured points files. 2016-01-14 10:13:24 -05:00
Robert Maynard
719ee34a60 Merge topic 'dynamic_cell_set_use_default'
4e94617f Make DynamicCellSet use VTKM_DEFAULT_CELL_SET_LIST_TAG.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !309
2016-01-14 08:37:36 -05:00
Robert Maynard
020975930c Merge topic 'generalize-marchingcubes-input'
15e1f80d Generalize MarchingCubes input with additional template parameters.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !304
2016-01-13 13:49:13 -05:00