diff --git a/vtkm/filter/flow/worklet/Analysis.h b/vtkm/filter/flow/worklet/Analysis.h index 452319332..39f928d45 100644 --- a/vtkm/filter/flow/worklet/Analysis.h +++ b/vtkm/filter/flow/worklet/Analysis.h @@ -35,6 +35,12 @@ public: VTKM_EXEC_CONT NoAnalysisExec() {} + VTKM_EXEC void PreStepAnalyze(const vtkm::Id index, const ParticleType& particle) + { + (void)index; + (void)particle; + } + //template VTKM_EXEC void Analyze(const vtkm::Id index, const ParticleType& oldParticle, @@ -147,21 +153,26 @@ public: Validity = validity.PrepareForInPlace(device, token); } + VTKM_EXEC void PreStepAnalyze(const vtkm::Id index, const ParticleType& particle) + { + vtkm::Id streamLength = this->StreamLengths.Get(index); + if (streamLength == 0) + { + this->StreamLengths.Set(index, 1); + vtkm::Id loc = index * MaxSteps; + this->Streams.Set(loc, particle.GetPosition()); + this->Validity.Set(loc, 1); + } + } + //template VTKM_EXEC void Analyze(const vtkm::Id index, const ParticleType& oldParticle, const ParticleType& newParticle) { - vtkm::Id loc = index * MaxSteps; + (void)oldParticle; vtkm::Id streamLength = this->StreamLengths.Get(index); - if (streamLength == 0) - { - this->StreamLengths.Set(index, 1); - this->Streams.Set(loc, oldParticle.GetPosition()); - this->Validity.Set(loc, 1); - ++streamLength; - } - loc += streamLength; + vtkm::Id loc = index * MaxSteps + streamLength; this->StreamLengths.Set(index, ++streamLength); this->Streams.Set(loc, newParticle.GetPosition()); this->Validity.Set(loc, 1); @@ -317,9 +328,6 @@ public: this->PolyLines.Fill(this->Streams.GetNumberOfValues(), cellTypes, connectivity, offsets); this->Particles = particles; - //this->Validity.ReleaseResources(); - //this->InitialLengths.ReleaseResources(); - //this->StreamLengths.ReleaseResources(); } diff --git a/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h b/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h index e6a0d7ecb..a45c3ac77 100644 --- a/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h +++ b/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h @@ -64,7 +64,7 @@ public: // 1. you could have success AND at temporal boundary. // 2. could you have success AND at spatial? // 3. all three? - integralCurve.PreStepUpdate(idx); + integralCurve.PreStepUpdate(idx, particle); do { particle = integralCurve.GetParticle(idx); diff --git a/vtkm/filter/flow/worklet/Particles.h b/vtkm/filter/flow/worklet/Particles.h index 1a5321dfe..0d01a1cdd 100644 --- a/vtkm/filter/flow/worklet/Particles.h +++ b/vtkm/filter/flow/worklet/Particles.h @@ -51,7 +51,10 @@ public: ParticleType GetParticle(const vtkm::Id& idx) { return this->Particles.Get(idx); } VTKM_EXEC - void PreStepUpdate(const vtkm::Id& vtkmNotUsed(idx)) {} + void PreStepUpdate(const vtkm::Id& idx, const ParticleType& particle) + { + this->Analysis.PreStepAnalyze(idx, particle); + } VTKM_EXEC void StepUpdate(const vtkm::Id& idx,