Updating particle advection filters to use field associativity

This commit is contained in:
Abhishek Yenpure 2021-10-14 14:57:36 -07:00
parent 79bb38c2b3
commit 3237c58c2b
3 changed files with 3 additions and 16 deletions

@ -256,11 +256,6 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
vtkm::cont::ArrayCopy(BasisParticles, BasisParticlesOriginal); vtkm::cont::ArrayCopy(BasisParticles, BasisParticlesOriginal);
} }
if (!fieldMeta.IsPointField())
{
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
if (this->writeFrequency == 0) if (this->writeFrequency == 0)
{ {
throw vtkm::cont::ErrorFilterExecution( throw vtkm::cont::ErrorFilterExecution(
@ -284,7 +279,7 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
vtkm::worklet::ParticleAdvection particleadvection; vtkm::worklet::ParticleAdvection particleadvection;
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> res; vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> res;
FieldType velocities(field); FieldType velocities(field, fieldMeta.GetAssociation());
GridEvalType gridEval(coords, cells, velocities); GridEvalType gridEval(coords, cells, velocities);
Stepper rk4(gridEval, static_cast<vtkm::Float32>(this->stepSize)); Stepper rk4(gridEval, static_cast<vtkm::Float32>(this->stepSize));

@ -75,11 +75,6 @@ inline VTKM_CONT vtkm::cont::DataSet LagrangianStructures::DoExecute(
const vtkm::filter::FieldMetadata& fieldMeta, const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>&) const vtkm::filter::PolicyBase<DerivedPolicy>&)
{ {
if (!fieldMeta.IsPointField())
{
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
using Structured2DType = vtkm::cont::CellSetStructured<2>; using Structured2DType = vtkm::cont::CellSetStructured<2>;
using Structured3DType = vtkm::cont::CellSetStructured<3>; using Structured3DType = vtkm::cont::CellSetStructured<3>;
@ -137,7 +132,7 @@ inline VTKM_CONT vtkm::cont::DataSet LagrangianStructures::DoExecute(
{ {
vtkm::cont::Invoker invoke; vtkm::cont::Invoker invoke;
FieldType velocities(field); FieldType velocities(field, fieldMeta.GetAssociation());
GridEvaluator evaluator(input.GetCoordinateSystem(), input.GetCellSet(), velocities); GridEvaluator evaluator(input.GetCoordinateSystem(), input.GetCellSet(), velocities);
Stepper integrator(evaluator, stepSize); Stepper integrator(evaluator, stepSize);
vtkm::worklet::ParticleAdvection particles; vtkm::worklet::ParticleAdvection particles;

@ -51,9 +51,6 @@ inline VTKM_CONT vtkm::cont::DataSet StreamSurface::DoExecute(
const vtkm::cont::CoordinateSystem& coords = const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()); input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
if (!fieldMeta.IsPointField())
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>; using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>; using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>; using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
@ -61,7 +58,7 @@ inline VTKM_CONT vtkm::cont::DataSet StreamSurface::DoExecute(
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>; using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
//compute streamlines //compute streamlines
FieldType velocities(field); FieldType velocities(field, fieldMeta.GetAssociation());
GridEvalType eval(coords, cells, velocities); GridEvalType eval(coords, cells, velocities);
Stepper rk4(eval, this->StepSize); Stepper rk4(eval, this->StepSize);