Viskores  1.0
FilterParticleAdvection.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_FilterParticleAdvection_h
20 #define viskores_filter_flow_FilterParticleAdvection_h
21 
22 #include <viskores/Deprecated.h>
23 #include <viskores/Particle.h>
25 #include <viskores/filter/Filter.h>
29 
30 namespace viskores
31 {
32 namespace filter
33 {
34 namespace flow
35 {
36 
38 
41 
42 class VISKORES_FILTER_FLOW_EXPORT FilterParticleAdvection : public viskores::filter::Filter
43 {
44 public:
46  bool CanThread() const override { return false; }
47 
54  VISKORES_CONT void SetStepSize(viskores::FloatDefault s) { this->StepSize = s; }
55 
60  VISKORES_CONT void SetNumberOfSteps(viskores::Id n) { this->NumberOfSteps = n; }
61 
67  template <typename ParticleType>
69  {
70  this->Seeds = seeds;
71  }
72 
74  template <typename ParticleType>
75  VISKORES_CONT void SetSeeds(const std::vector<ParticleType>& seeds,
77  {
78  this->Seeds = viskores::cont::make_ArrayHandle(seeds, copyFlag);
79  }
80 
81  VISKORES_CONT void SetBlockIDs(const std::vector<viskores::Id>& blockIds)
82  {
83  this->BlockIds = blockIds;
84  this->BlockIdsSet = true;
85  }
86 
88  void SetSolverRK4()
89  {
91  }
92 
95  {
97  }
98 
100  bool GetUseThreadedAlgorithm() { return this->UseThreadedAlgorithm; }
101 
103  void SetUseThreadedAlgorithm(bool val) { this->UseThreadedAlgorithm = val; }
104 
105  VISKORES_DEPRECATED(2.2, "All communication is asynchronous now.")
107  void SetUseAsynchronousCommunication() {}
108 
109  VISKORES_DEPRECATED(2.2, "All communication is asynchronous now.")
111  bool GetUseAsynchronousCommunication() { return true; }
112 
113  VISKORES_DEPRECATED(2.2, "All communication is asynchronous now.")
115  void SetUseSynchronousCommunication() {}
116 
117  VISKORES_DEPRECATED(2.2, "All communication is asynchronous now.")
119  bool GetUseSynchronousCommunication() { return false; }
120 
121 
122 protected:
123  VISKORES_CONT virtual void ValidateOptions() const;
124 
125  bool BlockIdsSet = false;
126  std::vector<viskores::Id> BlockIds;
127  viskores::filter::flow::internal::BoundsMap BoundsMap;
128  viskores::Id NumberOfSteps = 0;
133  bool UseThreadedAlgorithm = false;
136 
137 private:
138  VISKORES_CONT viskores::cont::DataSet DoExecute(const viskores::cont::DataSet& inData) override;
139 };
140 
141 }
142 }
143 } // namespace viskores::filter::flow
144 
145 #endif // viskores_filter_flow_FilterParticleAdvection_h
viskores::filter::flow::FilterParticleAdvection
base class for advecting particles in a vector field.
Definition: FilterParticleAdvection.h:42
viskores::filter::flow::FilterParticleAdvection::SetStepSize
void SetStepSize(viskores::FloatDefault s)
Specifies the step size used for the numerical integrator.
Definition: FilterParticleAdvection.h:54
viskores::filter::flow::FilterParticleAdvection::GetUseThreadedAlgorithm
bool GetUseThreadedAlgorithm()
Definition: FilterParticleAdvection.h:100
BoundsMap.h
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::flow::VectorFieldType::VELOCITY_FIELD_TYPE
@ VELOCITY_FIELD_TYPE
viskores::filter::flow::FilterParticleAdvection::SetSeeds
void SetSeeds(const std::vector< ParticleType > &seeds, viskores::CopyFlag copyFlag=viskores::CopyFlag::On)
Specify the seed locations for the particle advection.
Definition: FilterParticleAdvection.h:75
viskores::filter::flow::IntegrationSolverType
IntegrationSolverType
Definition: FlowTypes.h:27
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
ErrorFilterExecution.h
viskores::filter::flow::FilterParticleAdvection::SetSolverRK4
void SetSolverRK4()
Definition: FilterParticleAdvection.h:88
viskores_filter_flow_export.h
viskores::filter::flow::IntegrationSolverType::EULER_TYPE
@ EULER_TYPE
viskores::filter::flow::VectorFieldType
VectorFieldType
Definition: FlowTypes.h:33
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::CopyFlag::On
@ On
VISKORES_DEPRECATED
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
viskores::filter::flow::FilterParticleAdvection::CanThread
bool CanThread() const override
Returns whether the filter can execute on partitions in concurrent threads.
Definition: FilterParticleAdvection.h:46
viskores::filter::flow::FilterParticleAdvection::SetBlockIDs
void SetBlockIDs(const std::vector< viskores::Id > &blockIds)
Definition: FilterParticleAdvection.h:81
viskores::filter::flow::FilterParticleAdvection::SetNumberOfSteps
void SetNumberOfSteps(viskores::Id n)
Specifies the maximum number of integration steps for each particle.
Definition: FilterParticleAdvection.h:60
viskores::filter::flow::FilterParticleAdvection::BlockIds
std::vector< viskores::Id > BlockIds
Definition: FilterParticleAdvection.h:126
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
Deprecated.h
viskores::filter::flow::FilterParticleAdvection::Seeds
viskores::cont::UnknownArrayHandle Seeds
Definition: FilterParticleAdvection.h:129
viskores::cont::UnknownArrayHandle
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:451
viskores::filter::flow::FilterParticleAdvection::SetUseThreadedAlgorithm
void SetUseThreadedAlgorithm(bool val)
Definition: FilterParticleAdvection.h:103
viskores::filter::flow::FilterParticleAdvection::SetSeeds
void SetSeeds(viskores::cont::ArrayHandle< ParticleType > &seeds)
Specify the seed locations for the particle advection.
Definition: FilterParticleAdvection.h:68
viskores::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:25
FlowTypes.h
viskores::cont::make_ArrayHandle
viskores::cont::ArrayHandleBasic< T > make_ArrayHandle(const T *array, viskores::Id numberOfValues, viskores::CopyFlag copy)
A convenience function for creating an ArrayHandle from a standard C array.
Definition: ArrayHandleBasic.h:285
viskores::filter::flow::IntegrationSolverType::RK4_TYPE
@ RK4_TYPE
Particle.h
viskores::filter::flow::FilterParticleAdvection::SetSolverEuler
void SetSolverEuler()
Definition: FilterParticleAdvection.h:94
viskores::filter::flow::FilterParticleAdvection::BoundsMap
viskores::filter::flow::internal::BoundsMap BoundsMap
Definition: FilterParticleAdvection.h:127
Filter.h