Changes to address feedback from MR

--  Removing `.inl` files
  --  Removing large comment code blocks
This commit is contained in:
Abhishek Yenpure 2023-08-03 12:31:27 -07:00
parent 67716402bc
commit dbc873efa9
7 changed files with 34 additions and 215 deletions

@ -89,4 +89,21 @@ FilterParticleAdvectionSteadyState<Derived>::DoExecutePartitions(
}
} // namespace vtkm::filter::flow
#include <vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl>
#include <vtkm/filter/flow/ParticleAdvection.h>
#include <vtkm/filter/flow/Streamline.h>
#include <vtkm/filter/flow/WarpXStreamline.h>
namespace vtkm
{
namespace filter
{
namespace flow
{
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::ParticleAdvection>;
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::Streamline>;
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::WarpXStreamline>;
} // namespace flow
} // namespace filter
} // namespace vtkm

@ -1,18 +0,0 @@
#include<vtkm/filter/flow/ParticleAdvection.h>
#include<vtkm/filter/flow/Streamline.h>
#include<vtkm/filter/flow/WarpXStreamline.h>
namespace vtkm
{
namespace filter
{
namespace flow
{
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::ParticleAdvection>;
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::Streamline>;
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::WarpXStreamline>;
} // namespace flow
} // namespace filter
} // namespace vtkm

@ -96,4 +96,19 @@ FilterParticleAdvectionUnsteadyState<Derived>::DoExecutePartitions(
}
} // namespace vtkm::filter::flow
#include <vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl>
#include <vtkm/filter/flow/PathParticle.h>
#include <vtkm/filter/flow/Pathline.h>
namespace vtkm
{
namespace filter
{
namespace flow
{
template class FilterParticleAdvectionUnsteadyState<vtkm::filter::flow::PathParticle>;
template class FilterParticleAdvectionUnsteadyState<vtkm::filter::flow::Pathline>;
} // namespace flow
} // namespace filter
} // namespace vtkm

@ -1,16 +0,0 @@
#include<vtkm/filter/flow/PathParticle.h>
#include<vtkm/filter/flow/Pathline.h>
namespace vtkm
{
namespace filter
{
namespace flow
{
template class FilterParticleAdvectionUnsteadyState<vtkm::filter::flow::PathParticle>;
template class FilterParticleAdvectionUnsteadyState<vtkm::filter::flow::Pathline>;
} // namespace flow
} // namespace filter
} // namespace vtkm

@ -143,7 +143,6 @@ protected:
bool CopySeedArray = false;
};
//template <typename Derived, typename ParticleType, typename AnalysisType>
template <typename Derived, typename ParticleType>
VTKM_CONT inline void DataSetIntegrator<Derived, ParticleType>::ClassifyParticles(
const vtkm::cont::ArrayHandle<ParticleType>& particles,

@ -47,40 +47,12 @@ public:
};
} //detail
/*
template <typename ParticleType>
struct ParticleAdvectionResult
{
ParticleAdvectionResult()
: Particles()
{
}
ParticleAdvectionResult(const vtkm::cont::ArrayHandle<ParticleType>& p)
: Particles(p)
{
}
vtkm::cont::ArrayHandle<ParticleType> Particles;
};
*/
class ParticleAdvection
{
public:
ParticleAdvection() {}
/*
template <typename IntegratorType, typename ParticleType, typename ParticleStorage>
void Run2(const IntegratorType& it,
vtkm::cont::ArrayHandle<ParticleType, ParticleStorage>& particles,
vtkm::Id MaxSteps,
ParticleAdvectionResult<ParticleType>& result)
{
vtkm::worklet::flow::ParticleAdvectionWorklet<IntegratorType, ParticleType> worklet;
worklet.Run(it, particles, MaxSteps);
result = ParticleAdvectionResult<ParticleType>(particles);
}
*/
template <typename IntegratorType,
typename ParticleType,
typename ParticleStorage,
@ -95,7 +67,6 @@ public:
ParticleAdvectionWorklet<IntegratorType, ParticleType, TerminationType, AnalysisType>
worklet;
worklet.Run(it, particles, termination, analysis);
//return ParticleAdvectionResult<ParticleType>(particles);
}
template <typename IntegratorType,
@ -129,56 +100,9 @@ public:
invoke(detail::CopyToParticle{}, points, ids, time, step, particles);
worklet.Run(it, particles, termination, analysis);
//return ParticleAdvectionResult<ParticleType>(particles);
}
};
/*
template <typename ParticleType>
struct StreamlineResult
{
StreamlineResult()
: Particles()
, Positions()
, PolyLines()
{
}
StreamlineResult(const vtkm::cont::ArrayHandle<ParticleType>& part,
const vtkm::cont::ArrayHandle<vtkm::Vec3f>& pos,
const vtkm::cont::CellSetExplicit<>& lines)
: Particles(part)
, Positions(pos)
, PolyLines(lines)
{
}
vtkm::cont::ArrayHandle<ParticleType> Particles;
vtkm::cont::ArrayHandle<vtkm::Vec3f> Positions;
vtkm::cont::CellSetExplicit<> PolyLines;
};
class Streamline
{
public:
Streamline() {}
template <typename IntegratorType, typename ParticleType, typename ParticleStorage>
StreamlineResult<ParticleType> Run(
const IntegratorType& it,
vtkm::cont::ArrayHandle<ParticleType, ParticleStorage>& particles,
vtkm::Id MaxSteps)
{
vtkm::worklet::flow::StreamlineWorklet<IntegratorType, ParticleType> worklet;
vtkm::cont::ArrayHandle<vtkm::Vec3f> positions;
vtkm::cont::CellSetExplicit<> polyLines;
worklet.Run(it, particles, MaxSteps, positions, polyLines);
return StreamlineResult<ParticleType>(particles, positions, polyLines);
}
};
*/
}
}
} // vtkm::worklet::flow

@ -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 <typename ParticleType>
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 <typename ParticleType>
VTKM_EXEC void operator()(const ParticleType& p,
const vtkm::Id& initialNumSteps,
vtkm::Id& diff) const
{
diff = 1 + p.GetNumberOfSteps() - initialNumSteps;
}
};
} // namespace detail
*/
/*
template <typename IntegratorType, typename ParticleType>
class StreamlineWorklet
{
public:
template <typename PointStorage, typename PointStorage2>
void Run(const IntegratorType& it,
vtkm::cont::ArrayHandle<ParticleType, PointStorage>& particles,
vtkm::Id& MaxSteps,
vtkm::cont::ArrayHandle<vtkm::Vec3f, PointStorage2>& positions,
vtkm::cont::CellSetExplicit<>& polyLines)
{
using ParticleWorkletDispatchType =
typename vtkm::worklet::DispatcherMapField<vtkm::worklet::flow::ParticleAdvectWorklet>;
using StreamlineArrayType = vtkm::worklet::flow::StateRecordingParticles<ParticleType>;
vtkm::cont::ArrayHandle<vtkm::Id> initialStepsTaken;
vtkm::Id numSeeds = static_cast<vtkm::Id>(particles.GetNumberOfValues());
vtkm::cont::ArrayHandleIndex idxArray(numSeeds);
vtkm::worklet::DispatcherMapField<detail::GetSteps> 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<vtkm::Id> maxSteps(MaxSteps, numSeeds);
particleWorkletDispatch.Invoke(idxArray, it, streamlines, maxSteps);
//Get the positions
streamlines.GetCompactedHistory(positions);
//Create the cells
vtkm::cont::ArrayHandle<vtkm::Id> numPoints;
vtkm::worklet::DispatcherMapField<detail::ComputeNumPoints> computeNumPointsDispatcher{ (
detail::ComputeNumPoints{}) };
computeNumPointsDispatcher.Invoke(particles, initialStepsTaken, numPoints);
vtkm::cont::ArrayHandle<vtkm::Id> cellIndex;
vtkm::Id connectivityLen = vtkm::cont::Algorithm::ScanExclusive(numPoints, cellIndex);
vtkm::cont::ArrayHandleIndex connCount(connectivityLen);
vtkm::cont::ArrayHandle<vtkm::Id> connectivity;
vtkm::cont::ArrayCopy(connCount, connectivity);
vtkm::cont::ArrayHandle<vtkm::UInt8> cellTypes;
auto polyLineShape =
vtkm::cont::make_ArrayHandleConstant<vtkm::UInt8>(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