From c33bf063f443913c6a4d202e385eef74221adf8a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 17 Apr 2018 12:00:23 -0400 Subject: [PATCH] RK4Integrator now properly initializes all variables. Previously the RK4Integrator could compute velocity with uninitialized inputs. --- vtkm/worklet/particleadvection/Integrators.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vtkm/worklet/particleadvection/Integrators.h b/vtkm/worklet/particleadvection/Integrators.h index 2ce5aca9b..76cbd668b 100644 --- a/vtkm/worklet/particleadvection/Integrators.h +++ b/vtkm/worklet/particleadvection/Integrators.h @@ -21,6 +21,7 @@ #ifndef vtk_m_worklet_particleadvection_Integrators_h #define vtk_m_worklet_particleadvection_Integrators_h +#include #include #include #include @@ -171,7 +172,8 @@ public: { return ParticleStatus::EXITED_SPATIAL_BOUNDARY; } - vtkm::Vec k1, k2, k3, k4; + vtkm::Vec k1 = vtkm::TypeTraits>::ZeroInitialization(); + vtkm::Vec k2 = k1, k3 = k1, k4 = k1; bool firstOrderValid = this->Evaluator.Evaluate(inpos, k1); bool secondOrderValid = this->Evaluator.Evaluate(inpos + (stepLength / 2) * k1, k2); bool thirdOrderValid = this->Evaluator.Evaluate(inpos + (stepLength / 2) * k2, k3); @@ -179,6 +181,7 @@ public: velocity = (k1 + 2 * k2 + 2 * k3 + k4) / 6.0f; if (firstOrderValid && secondOrderValid && thirdOrderValid && fourthOrderValid) { + return ParticleStatus::STATUS_OK; } else