Go to the documentation of this file.
13 #ifndef vtk_m_filter_flow_worklet_Stepper_h
14 #define vtk_m_filter_flow_worklet_Stepper_h
29 template <
typename ExecIntegratorType,
typename ExecEvaluatorType>
41 const ExecEvaluatorType& evaluator,
51 template <
typename Particle>
57 auto status = this->Integrator.CheckStep(particle, this->DeltaT, velocity);
60 outpos = particle.
GetPosition() + this->DeltaT * velocity;
69 template <
typename Particle>
87 auto evalStatus = this->Evaluator.Evaluate(currPos, particle.
GetTime(), currValue);
88 if (evalStatus.CheckFail())
93 while ((stepRange[1] - stepRange[0]) > eps)
100 IntegratorStatus status = this->Integrator.CheckStep(particle, currStep, currVelocity);
102 if (status.CheckOk())
105 auto newPos = particle.
GetPosition() + currStep * currVelocity;
106 evalStatus = this->Evaluator.Evaluate(newPos, particle.
GetTime() + currStep, tmp);
107 if (evalStatus.CheckOk())
111 stepRange[0] = currStep;
117 stepRange[1] = currStep;
123 stepRange[1] = currStep;
127 evalStatus = this->Evaluator.Evaluate(currPos, particle.
GetTime() + stepRange[0], currValue);
129 VTKM_ASSERT(evalStatus.CheckOk() && !evalStatus.CheckSpatialBounds());
130 if (evalStatus.CheckFail() || evalStatus.CheckSpatialBounds())
134 auto velocity = particle.
Velocity(currValue, stepRange[1]);
135 outpos = currPos + stepRange[1] * velocity;
136 time += stepRange[1];
139 evalStatus = this->Evaluator.Evaluate(outpos, time, currValue);
150 template <
typename IntegratorType,
typename EvaluatorType>
158 std::numeric_limits<vtkm::FloatDefault>::epsilon() *
static_cast<vtkm::FloatDefault>(100.0f);
180 ->
StepperImpl<decltype(this->Integrator.PrepareForExecution(device, token)),
181 decltype(this->Evaluator.PrepareForExecution(device, token))>
183 auto integrator = this->Integrator.PrepareForExecution(device, token);
184 auto evaluator = this->Evaluator.PrepareForExecution(device, token);
185 using ExecIntegratorType = decltype(integrator);
186 using ExecEvaluatorType = decltype(evaluator);
188 integrator, evaluator, this->DeltaT, this->Tolerance);
196 #endif // vtk_m_filter_flow_worklet_Stepper_h
VTKM_EXEC_CONT detail::FloatingPointReturnType< T >::Type MagnitudeSquared(const T &x)
Returns the square of the magnitude of a vector.
Definition: VectorAnalysis.h:64
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_EXEC_CONT StepperImpl(const ExecIntegratorType &integrator, const ExecEvaluatorType &evaluator, const vtkm::FloatDefault deltaT, const vtkm::FloatDefault tolerance)
Definition: Stepper.h:40
ExecIntegratorType Integrator
Definition: Stepper.h:33
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
Definition: Particle.h:90
VTKM_EXEC_CONT vtkm::Vec3f GetEvaluationPosition(const vtkm::FloatDefault &deltaT) const
Definition: Particle.h:155
VTKM_EXEC_CONT void SetOk()
Definition: IntegratorStatus.h:60
vtkm::FloatDefault DeltaT
Definition: Stepper.h:156
VTKM_EXEC IntegratorStatus SmallStep(Particle &particle, vtkm::FloatDefault &time, vtkm::Vec3f &outpos) const
Definition: Stepper.h:70
ExecEvaluatorType Evaluator
Definition: Stepper.h:34
VTKM_CONT auto PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const -> StepperImpl< decltype(this->Integrator.PrepareForExecution(device, token)), decltype(this->Evaluator.PrepareForExecution(device, token))>
Return the StepperImpl object Prepares the execution object of Stepper.
Definition: Stepper.h:178
vtkm::FloatDefault Tolerance
Definition: Stepper.h:36
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
VTKM_CONT void SetTolerance(vtkm::FloatDefault tolerance)
Definition: Stepper.h:173
A short variable-length array with maximum length.
Definition: VecVariable.h:30
Definition: IntegratorStatus.h:33
VTKM_EXEC_CONT vtkm::FloatDefault GetTime() const
Definition: Particle.h:141
#define VTKM_CONT
Definition: ExportMacros.h:57
VTKM_EXEC_CONT vtkm::Vec3f Velocity(const vtkm::VecVariable< vtkm::Vec3f, 2 > &vectors, const vtkm::FloatDefault &vtkmNotUsed(length))
Definition: Particle.h:145
Base ExecutionObjectBase for execution objects to inherit from so that you can use an arbitrary objec...
Definition: ExecutionObjectBase.h:31
Definition: DeviceAdapterTag.h:52
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
const VTKM_EXEC_CONT vtkm::Vec3f & GetPosition() const
Definition: Particle.h:128
vtkm::FloatDefault DeltaT
Definition: Stepper.h:35
Definition: Stepper.h:151
vtkm::FloatDefault Tolerance
Definition: Stepper.h:157
IntegratorType Integrator
Definition: Stepper.h:154
VTKM_CONT Stepper(const EvaluatorType &evaluator, const vtkm::FloatDefault deltaT)
Definition: Stepper.h:165
EvaluatorType Evaluator
Definition: Stepper.h:155
VTKM_CONT Stepper()=default
VTKM_EXEC IntegratorStatus Step(Particle &particle, vtkm::FloatDefault &time, vtkm::Vec3f &outpos) const
Definition: Stepper.h:52