From dbc873efa95880cd5300c9b5fbe6acdde88599ee Mon Sep 17 00:00:00 2001 From: Abhishek Yenpure Date: Thu, 3 Aug 2023 12:31:27 -0700 Subject: [PATCH] Changes to address feedback from MR -- Removing `.inl` files -- Removing large comment code blocks --- .../FilterParticleAdvectionSteadyState.cxx | 19 +++- .../FilterParticleAdvectionSteadyState.inl | 18 ---- .../FilterParticleAdvectionUnsteadyState.cxx | 17 ++- .../FilterParticleAdvectionUnsteadyState.inl | 16 --- vtkm/filter/flow/internal/DataSetIntegrator.h | 1 - vtkm/filter/flow/worklet/ParticleAdvection.h | 76 ------------- .../flow/worklet/ParticleAdvectionWorklets.h | 102 ------------------ 7 files changed, 34 insertions(+), 215 deletions(-) delete mode 100644 vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl delete mode 100644 vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl diff --git a/vtkm/filter/flow/FilterParticleAdvectionSteadyState.cxx b/vtkm/filter/flow/FilterParticleAdvectionSteadyState.cxx index 02a715c37..c70c2b3d6 100644 --- a/vtkm/filter/flow/FilterParticleAdvectionSteadyState.cxx +++ b/vtkm/filter/flow/FilterParticleAdvectionSteadyState.cxx @@ -89,4 +89,21 @@ FilterParticleAdvectionSteadyState::DoExecutePartitions( } } // namespace vtkm::filter::flow -#include +#include +#include +#include + +namespace vtkm +{ +namespace filter +{ +namespace flow +{ + +template class FilterParticleAdvectionSteadyState; +template class FilterParticleAdvectionSteadyState; +template class FilterParticleAdvectionSteadyState; + +} // namespace flow +} // namespace filter +} // namespace vtkm diff --git a/vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl b/vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl deleted file mode 100644 index 0429e1e14..000000000 --- a/vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include - -namespace vtkm -{ -namespace filter -{ -namespace flow -{ - -template class FilterParticleAdvectionSteadyState; -template class FilterParticleAdvectionSteadyState; -template class FilterParticleAdvectionSteadyState; - -} // namespace flow -} // namespace filter -} // namespace vtkm diff --git a/vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.cxx b/vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.cxx index 4c1033333..7d72cfcc8 100644 --- a/vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.cxx +++ b/vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.cxx @@ -96,4 +96,19 @@ FilterParticleAdvectionUnsteadyState::DoExecutePartitions( } } // namespace vtkm::filter::flow -#include +#include +#include + +namespace vtkm +{ +namespace filter +{ +namespace flow +{ + +template class FilterParticleAdvectionUnsteadyState; +template class FilterParticleAdvectionUnsteadyState; + +} // namespace flow +} // namespace filter +} // namespace vtkm diff --git a/vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl b/vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl deleted file mode 100644 index 5d75f94d9..000000000 --- a/vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -namespace vtkm -{ -namespace filter -{ -namespace flow -{ - -template class FilterParticleAdvectionUnsteadyState; -template class FilterParticleAdvectionUnsteadyState; - -} // namespace flow -} // namespace filter -} // namespace vtkm diff --git a/vtkm/filter/flow/internal/DataSetIntegrator.h b/vtkm/filter/flow/internal/DataSetIntegrator.h index d0e4acf88..44c8d352f 100644 --- a/vtkm/filter/flow/internal/DataSetIntegrator.h +++ b/vtkm/filter/flow/internal/DataSetIntegrator.h @@ -143,7 +143,6 @@ protected: bool CopySeedArray = false; }; -//template template VTKM_CONT inline void DataSetIntegrator::ClassifyParticles( const vtkm::cont::ArrayHandle& particles, diff --git a/vtkm/filter/flow/worklet/ParticleAdvection.h b/vtkm/filter/flow/worklet/ParticleAdvection.h index de4ec5402..c2d4a9c92 100644 --- a/vtkm/filter/flow/worklet/ParticleAdvection.h +++ b/vtkm/filter/flow/worklet/ParticleAdvection.h @@ -47,40 +47,12 @@ public: }; } //detail -/* -template -struct ParticleAdvectionResult -{ - ParticleAdvectionResult() - : Particles() - { - } - ParticleAdvectionResult(const vtkm::cont::ArrayHandle& p) - : Particles(p) - { - } - - vtkm::cont::ArrayHandle Particles; -}; -*/ class ParticleAdvection { public: ParticleAdvection() {} - /* - template - void Run2(const IntegratorType& it, - vtkm::cont::ArrayHandle& particles, - vtkm::Id MaxSteps, - ParticleAdvectionResult& result) - { - vtkm::worklet::flow::ParticleAdvectionWorklet worklet; - worklet.Run(it, particles, MaxSteps); - result = ParticleAdvectionResult(particles); - } -*/ template worklet; worklet.Run(it, particles, termination, analysis); - //return ParticleAdvectionResult(particles); } template (particles); } }; -/* -template -struct StreamlineResult -{ - StreamlineResult() - : Particles() - , Positions() - , PolyLines() - { - } - StreamlineResult(const vtkm::cont::ArrayHandle& part, - const vtkm::cont::ArrayHandle& pos, - const vtkm::cont::CellSetExplicit<>& lines) - : Particles(part) - , Positions(pos) - , PolyLines(lines) - { - } - - vtkm::cont::ArrayHandle Particles; - vtkm::cont::ArrayHandle Positions; - vtkm::cont::CellSetExplicit<> PolyLines; -}; - -class Streamline -{ -public: - Streamline() {} - - template - StreamlineResult Run( - const IntegratorType& it, - vtkm::cont::ArrayHandle& particles, - vtkm::Id MaxSteps) - { - vtkm::worklet::flow::StreamlineWorklet worklet; - - vtkm::cont::ArrayHandle positions; - vtkm::cont::CellSetExplicit<> polyLines; - - worklet.Run(it, particles, MaxSteps, positions, polyLines); - - return StreamlineResult(particles, positions, polyLines); - } -}; -*/ } } } // vtkm::worklet::flow diff --git a/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h b/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h index a45c3ac77..cdded2318 100644 --- a/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h +++ b/vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h @@ -150,109 +150,7 @@ public: analysis.FinalizeAnalysis(particles); } }; -/* -namespace detail -{ -class GetSteps : public vtkm::worklet::WorkletMapField -{ -public: - VTKM_CONT - GetSteps() {} - using ControlSignature = void(FieldIn, FieldOut); - using ExecutionSignature = void(_1, _2); - template - VTKM_EXEC void operator()(const ParticleType& p, vtkm::Id& numSteps) const - { - numSteps = p.GetNumberOfSteps(); - } -}; - -class ComputeNumPoints : public vtkm::worklet::WorkletMapField -{ -public: - VTKM_CONT - ComputeNumPoints() {} - using ControlSignature = void(FieldIn, FieldIn, FieldOut); - using ExecutionSignature = void(_1, _2, _3); - - // Offset is number of points in streamline. - // 1 (inital point) + number of steps taken (p.GetNumberOfSteps() - initalNumSteps) - template - VTKM_EXEC void operator()(const ParticleType& p, - const vtkm::Id& initialNumSteps, - vtkm::Id& diff) const - { - diff = 1 + p.GetNumberOfSteps() - initialNumSteps; - } -}; -} // namespace detail -*/ -/* -template -class StreamlineWorklet -{ -public: - template - void Run(const IntegratorType& it, - vtkm::cont::ArrayHandle& particles, - vtkm::Id& MaxSteps, - vtkm::cont::ArrayHandle& positions, - vtkm::cont::CellSetExplicit<>& polyLines) - { - - using ParticleWorkletDispatchType = - typename vtkm::worklet::DispatcherMapField; - using StreamlineArrayType = vtkm::worklet::flow::StateRecordingParticles; - - vtkm::cont::ArrayHandle initialStepsTaken; - - vtkm::Id numSeeds = static_cast(particles.GetNumberOfValues()); - vtkm::cont::ArrayHandleIndex idxArray(numSeeds); - - vtkm::worklet::DispatcherMapField getStepDispatcher{ (detail::GetSteps{}) }; - getStepDispatcher.Invoke(particles, initialStepsTaken); - - // This method uses the same workklet as ParticleAdvectionWorklet::Run (and more). Yet for - // some reason ParticleAdvectionWorklet::Run needs this adjustment while this method does - // not. -#ifdef VTKM_CUDA - // // This worklet needs some extra space on CUDA. - // vtkm::cont::cuda::internal::ScopedCudaStackSize stack(16 * 1024); - // (void)stack; -#endif // VTKM_CUDA - - //Run streamline worklet - StreamlineArrayType streamlines(particles, MaxSteps); - ParticleWorkletDispatchType particleWorkletDispatch; - vtkm::cont::ArrayHandleConstant maxSteps(MaxSteps, numSeeds); - particleWorkletDispatch.Invoke(idxArray, it, streamlines, maxSteps); - - //Get the positions - streamlines.GetCompactedHistory(positions); - - //Create the cells - vtkm::cont::ArrayHandle numPoints; - vtkm::worklet::DispatcherMapField computeNumPointsDispatcher{ ( - detail::ComputeNumPoints{}) }; - computeNumPointsDispatcher.Invoke(particles, initialStepsTaken, numPoints); - - vtkm::cont::ArrayHandle cellIndex; - vtkm::Id connectivityLen = vtkm::cont::Algorithm::ScanExclusive(numPoints, cellIndex); - vtkm::cont::ArrayHandleIndex connCount(connectivityLen); - vtkm::cont::ArrayHandle connectivity; - vtkm::cont::ArrayCopy(connCount, connectivity); - - vtkm::cont::ArrayHandle cellTypes; - auto polyLineShape = - vtkm::cont::make_ArrayHandleConstant(vtkm::CELL_SHAPE_POLY_LINE, numSeeds); - vtkm::cont::ArrayCopy(polyLineShape, cellTypes); - - auto offsets = vtkm::cont::ConvertNumComponentsToOffsets(numPoints); - polyLines.Fill(positions.GetNumberOfValues(), cellTypes, connectivity, offsets); - } -}; -*/ } } } // namespace vtkm::worklet::flow