VTK-m  2.0
FilterParticleAdvection.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_FilterParticleAdvection_h
12 #define vtk_m_filter_flow_FilterParticleAdvection_h
13 
14 #include <vtkm/Particle.h>
17 #include <vtkm/filter/flow/vtkm_filter_flow_export.h>
18 
19 namespace vtkm
20 {
21 namespace filter
22 {
23 namespace flow
24 {
25 
27 
30 
31 class VTKM_FILTER_FLOW_EXPORT FilterParticleAdvection : public vtkm::filter::FilterField
32 {
33 public:
34  VTKM_CONT
35  bool CanThread() const override { return false; }
36 
37  VTKM_CONT
38  void SetStepSize(vtkm::FloatDefault s) { this->StepSize = s; }
39 
40  VTKM_CONT
41  void SetNumberOfSteps(vtkm::Id n) { this->NumberOfSteps = n; }
42 
43  template <typename ParticleType>
45  {
46  this->Seeds = seeds;
47  }
48 
49  template <typename ParticleType>
50  VTKM_CONT void SetSeeds(const std::vector<ParticleType>& seeds,
52  {
53  this->Seeds = vtkm::cont::make_ArrayHandle(seeds, copyFlag);
54  }
55 
56  VTKM_CONT
58 
59  VTKM_CONT
61  {
63  }
64 
65  VTKM_CONT
67  {
68  this->VecFieldType = vecFieldType;
69  }
70 
74  VTKM_CONT void SetEField(const std::string& name) { this->SetActiveField(0, name); }
75 
76  VTKM_CONT void SetBField(const std::string& name) { this->SetActiveField(1, name); }
77 
78  VTKM_CONT std::string GetEField() const { return this->GetActiveFieldName(0); }
79 
80  VTKM_CONT std::string GetBField() const { return this->GetActiveFieldName(1); }
81 
82  VTKM_CONT
83  bool GetUseThreadedAlgorithm() { return this->UseThreadedAlgorithm; }
84 
85  VTKM_CONT
86  void SetUseThreadedAlgorithm(bool val) { this->UseThreadedAlgorithm = val; }
87 
88 protected:
89  VTKM_CONT virtual void ValidateOptions() const;
90 
91  VTKM_CONT virtual vtkm::filter::flow::FlowResultType GetResultType() const = 0;
92 
93  vtkm::Id NumberOfSteps = 0;
97  vtkm::FloatDefault StepSize = 0;
98  bool UseThreadedAlgorithm = false;
101 
102 private:
103  VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& inData) override;
104 };
105 
106 }
107 }
108 } // namespace vtkm::filter::flow
109 
110 #endif // vtk_m_filter_flow_FilterParticleAdvection_h
vtkm::filter::flow::FilterParticleAdvection::SetEField
VTKM_CONT void SetEField(const std::string &name)
Definition: FilterParticleAdvection.h:74
vtkm::cont::make_ArrayHandle
VTKM_CONT vtkm::cont::ArrayHandleBasic< T > make_ArrayHandle(const T *array, vtkm::Id numberOfValues, vtkm::CopyFlag copy)
A convenience function for creating an ArrayHandle from a standard C array.
Definition: ArrayHandleBasic.h:217
vtkm::filter::flow::IntegrationSolverType::RK4_TYPE
@ RK4_TYPE
vtkm::cont::ArrayHandle< ParticleType >
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::filter::flow::IntegrationSolverType::EULER_TYPE
@ EULER_TYPE
vtkm::filter::flow::VectorFieldType::VELOCITY_FIELD_TYPE
@ VELOCITY_FIELD_TYPE
vtkm::cont::UnknownArrayHandle
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:406
vtkm::filter::flow::FilterParticleAdvection::GetUseThreadedAlgorithm
VTKM_CONT bool GetUseThreadedAlgorithm()
Definition: FilterParticleAdvection.h:83
vtkm::cont::DataSet
Definition: DataSet.h:34
vtkm::filter::flow::FilterParticleAdvection::Seeds
vtkm::cont::UnknownArrayHandle Seeds
Definition: FilterParticleAdvection.h:94
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::filter::flow::FilterParticleAdvection::SetSolverRK4
VTKM_CONT void SetSolverRK4()
Definition: FilterParticleAdvection.h:57
FilterField.h
vtkm::filter::FilterField
Definition: FilterField.h:21
vtkm::filter::flow::FilterParticleAdvection::SetSolverEuler
VTKM_CONT void SetSolverEuler()
Definition: FilterParticleAdvection.h:60
vtkm::filter::flow::FilterParticleAdvection::SetUseThreadedAlgorithm
VTKM_CONT void SetUseThreadedAlgorithm(bool val)
Definition: FilterParticleAdvection.h:86
vtkm::filter::flow::FlowResultType
FlowResultType
Definition: FlowTypes.h:31
vtkm::filter::flow::IntegrationSolverType
IntegrationSolverType
Definition: FlowTypes.h:19
vtkm::filter::flow::VectorFieldType
VectorFieldType
Definition: FlowTypes.h:25
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::filter::flow::FilterParticleAdvection::SetNumberOfSteps
VTKM_CONT void SetNumberOfSteps(vtkm::Id n)
Definition: FilterParticleAdvection.h:41
vtkm::filter::flow::FilterParticleAdvection
base class for advecting particles in a vector field.
Definition: FilterParticleAdvection.h:31
vtkm::CopyFlag::On
@ On
vtkm::filter::flow::FilterParticleAdvection::GetBField
VTKM_CONT std::string GetBField() const
Definition: FilterParticleAdvection.h:80
vtkm::filter::flow::FilterParticleAdvection::SetSeeds
VTKM_CONT void SetSeeds(vtkm::cont::ArrayHandle< ParticleType > &seeds)
Definition: FilterParticleAdvection.h:44
vtkm::filter::flow::FilterParticleAdvection::SetVectorFieldType
VTKM_CONT void SetVectorFieldType(vtkm::filter::flow::VectorFieldType vecFieldType)
Definition: FilterParticleAdvection.h:66
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::filter::flow::FilterParticleAdvection::SetBField
VTKM_CONT void SetBField(const std::string &name)
Definition: FilterParticleAdvection.h:76
vtkm::filter::flow::FilterParticleAdvection::GetEField
VTKM_CONT std::string GetEField() const
Definition: FilterParticleAdvection.h:78
vtkm::filter::flow::FilterParticleAdvection::SetStepSize
VTKM_CONT void SetStepSize(vtkm::FloatDefault s)
Definition: FilterParticleAdvection.h:38
vtkm::filter::flow::FilterParticleAdvection::CanThread
VTKM_CONT bool CanThread() const override
Definition: FilterParticleAdvection.h:35
vtkm::CopyFlag
CopyFlag
Definition: Flags.h:16
FlowTypes.h
Particle.h
vtkm::filter::flow::FilterParticleAdvection::SetSeeds
VTKM_CONT void SetSeeds(const std::vector< ParticleType > &seeds, vtkm::CopyFlag copyFlag=vtkm::CopyFlag::On)
Definition: FilterParticleAdvection.h:50