VTK-m  2.2
ParticleAdvector.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_filter_flow_internal_ParticleAdvector_h
12 #define vtk_m_filter_flow_internal_ParticleAdvector_h
13 
18 
19 namespace vtkm
20 {
21 namespace filter
22 {
23 namespace flow
24 {
25 namespace internal
26 {
27 
28 template <typename DSIType>
29 class ParticleAdvector
30 {
31 public:
32  using ParticleType = typename DSIType::PType;
33 
34  ParticleAdvector(const vtkm::filter::flow::internal::BoundsMap& bm,
35  const std::vector<DSIType>& blocks,
36  const bool& useThreaded,
37  const bool& useAsyncComm)
38  : Blocks(blocks)
39  , BoundsMap(bm)
40  , UseThreadedAlgorithm(useThreaded)
41  , UseAsynchronousCommunication(useAsyncComm)
42  {
43  }
44 
46  vtkm::FloatDefault stepSize)
47  {
48  if (!this->UseThreadedAlgorithm)
49  {
50  using AlgorithmType = vtkm::filter::flow::internal::AdvectAlgorithm<DSIType>;
51  return this->RunAlgo<AlgorithmType>(seeds, stepSize);
52  }
53  else
54  {
55  using AlgorithmType = vtkm::filter::flow::internal::AdvectAlgorithmThreaded<DSIType>;
56  return this->RunAlgo<AlgorithmType>(seeds, stepSize);
57  }
58  }
59 
60 private:
61  template <typename AlgorithmType>
63  vtkm::FloatDefault stepSize)
64  {
65  AlgorithmType algo(this->BoundsMap, this->Blocks, this->UseAsynchronousCommunication);
66  algo.Execute(seeds, stepSize);
67  return algo.GetOutput();
68  }
69 
70  std::vector<DSIType> Blocks;
71  vtkm::filter::flow::internal::BoundsMap BoundsMap;
72  bool UseThreadedAlgorithm;
73  bool UseAsynchronousCommunication = true;
74 };
75 
76 }
77 }
78 }
79 } //vtkm::filter::flow::internal
80 
81 
82 #endif //vtk_m_filter_flow_internal_ParticleAdvector_h
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
BoundsMap.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
DataSetIntegrator.h
AdvectAlgorithm.h
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
AdvectAlgorithmThreaded.h
vtkm::cont::PartitionedDataSet
Comprises a set of vtkm::cont::DataSet objects.
Definition: PartitionedDataSet.h:26