Viskores  1.0
ParticleAdvector.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_filter_flow_internal_ParticleAdvector_h
20 #define viskores_filter_flow_internal_ParticleAdvector_h
21 
26 
27 namespace viskores
28 {
29 namespace filter
30 {
31 namespace flow
32 {
33 namespace internal
34 {
35 
36 template <typename DSIType>
37 class ParticleAdvector
38 {
39 public:
40  using ParticleType = typename DSIType::PType;
41 
42  ParticleAdvector(const viskores::filter::flow::internal::BoundsMap& bm,
43  const std::vector<DSIType>& blocks,
44  const bool& useThreaded)
45  : Blocks(blocks)
46  , BoundsMap(bm)
47  , UseThreadedAlgorithm(useThreaded)
48  {
49  }
50 
52  viskores::FloatDefault stepSize)
53  {
54  if (!this->UseThreadedAlgorithm)
55  {
56  using AlgorithmType = viskores::filter::flow::internal::AdvectAlgorithm<DSIType>;
57  return this->RunAlgo<AlgorithmType>(seeds, stepSize);
58  }
59  else
60  {
61  using AlgorithmType = viskores::filter::flow::internal::AdvectAlgorithmThreaded<DSIType>;
62  return this->RunAlgo<AlgorithmType>(seeds, stepSize);
63  }
64  }
65 
66 private:
67  template <typename AlgorithmType>
69  viskores::FloatDefault stepSize)
70  {
71  AlgorithmType algo(this->BoundsMap, this->Blocks);
72  algo.Execute(seeds, stepSize);
73  return algo.GetOutput();
74  }
75 
76  std::vector<DSIType> Blocks;
77  viskores::filter::flow::internal::BoundsMap BoundsMap;
78  bool UseThreadedAlgorithm;
79 };
80 
81 }
82 }
83 }
84 } //viskores::filter::flow::internal
85 
86 
87 #endif //viskores_filter_flow_internal_ParticleAdvector_h
BoundsMap.h
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
DataSetIntegrator.h
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::PartitionedDataSet
Comprises a set of viskores::cont::DataSet objects.
Definition: PartitionedDataSet.h:34
AdvectAlgorithm.h
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
AdvectAlgorithmThreaded.h