Move the worklets over to filter/flow.

This commit is contained in:
Dave Pugmire 2022-07-22 15:31:58 -04:00
parent 43f7109f3e
commit ed11e447d0
28 changed files with 326 additions and 294 deletions

@ -142,6 +142,17 @@ public:
vtkm::Id NumSteps = 0;
vtkm::ParticleStatus Status;
vtkm::FloatDefault Time = 0;
static size_t Sizeof()
{
constexpr std::size_t sz = sizeof(vtkm::Vec3f) // Pos
+ sizeof(vtkm::Id) // ID
+ sizeof(vtkm::Id) // NumSteps
+ sizeof(vtkm::UInt8) // Status
+ sizeof(vtkm::FloatDefault); // Time
return sz;
}
};
class ChargedParticle
@ -251,6 +262,23 @@ private:
static_cast<vtkm::FloatDefault>(2.99792458e8);
friend struct mangled_diy_namespace::Serialization<vtkm::ChargedParticle>;
public:
static size_t Sizeof()
{
constexpr std::size_t sz = sizeof(vtkm::Vec3f) // Pos
+ sizeof(vtkm::Id) // ID
+ sizeof(vtkm::Id) // NumSteps
+ sizeof(vtkm::UInt8) // Status
+ sizeof(vtkm::FloatDefault) // Time
+ sizeof(vtkm::FloatDefault) //Mass
+ sizeof(vtkm::FloatDefault) //Charge
+ sizeof(vtkm::FloatDefault) //Weighting
+ sizeof(vtkm::Vec3f) //Momentum
+ sizeof(vtkm::FloatDefault); //Speed_of_light
return sz;
}
};
} //namespace vtkm

@ -21,13 +21,13 @@
#include <vtkm/cont/DataSetBuilderRectilinear.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/Field.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/Particles.h>
#include <vtkm/filter/flow/worklet/RK4Integrator.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/particleadvection/Field.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/worklet/particleadvection/RK4Integrator.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#include <cstring>
#include <sstream>
@ -274,13 +274,13 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
vtkm::Bounds bounds = input.GetCoordinateSystem().GetBounds();
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
vtkm::worklet::ParticleAdvection particleadvection;
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> res;
vtkm::worklet::flow::ParticleAdvection particleadvection;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> res;
FieldType velocities(field, fieldMeta.GetAssociation());
GridEvalType gridEval(coords, cells, velocities);

@ -15,9 +15,9 @@
#include <vtkm/filter/FilterDataSetWithField.h>
#include <vtkm/worklet/ParticleAdvection.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
namespace vtkm
{

@ -14,11 +14,11 @@
#include <vtkm/cont/ArrayHandleIndex.h>
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/worklet/particleadvection/Field.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/worklet/particleadvection/RK4Integrator.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#include <vtkm/filter/flow/worklet/Field.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/Particles.h>
#include <vtkm/filter/flow/worklet/RK4Integrator.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
#include <vtkm/worklet/LagrangianStructures.h>
@ -79,10 +79,10 @@ inline VTKM_CONT vtkm::cont::DataSet LagrangianStructures::DoExecute(
using Structured3DType = vtkm::cont::CellSetStructured<3>;
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvaluator = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using IntegratorType = vtkm::worklet::particleadvection::RK4Integrator<GridEvaluator>;
using Stepper = vtkm::worklet::particleadvection::Stepper<IntegratorType, GridEvaluator>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvaluator = vtkm::worklet::flow::GridEvaluator<FieldType>;
using IntegratorType = vtkm::worklet::flow::RK4Integrator<GridEvaluator>;
using Stepper = vtkm::worklet::flow::Stepper<IntegratorType, GridEvaluator>;
vtkm::FloatDefault stepSize = this->GetStepSize();
vtkm::Id numberOfSteps = this->GetNumberOfSteps();
@ -135,8 +135,8 @@ inline VTKM_CONT vtkm::cont::DataSet LagrangianStructures::DoExecute(
FieldType velocities(field, fieldMeta.GetAssociation());
GridEvaluator evaluator(input.GetCoordinateSystem(), input.GetCellSet(), velocities);
Stepper integrator(evaluator, stepSize);
vtkm::worklet::ParticleAdvection particles;
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> advectionResult;
vtkm::worklet::flow::ParticleAdvection particles;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> advectionResult;
vtkm::cont::ArrayHandle<vtkm::Particle> advectionPoints;
invoke(detail::MakeParticles{}, lcsInputPoints, advectionPoints);
advectionResult = particles.Run(integrator, advectionPoints, numberOfSteps);

@ -12,10 +12,10 @@
#define vtk_m_filter_StreamSurface_h
#include <vtkm/filter/FilterDataSetWithField.h>
#include <vtkm/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
#include <vtkm/worklet/StreamSurface.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
namespace vtkm
{

@ -16,12 +16,12 @@
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandleIndex.h>
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/worklet/ParticleAdvection.h>
#include <vtkm/worklet/particleadvection/Field.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/worklet/particleadvection/RK4Integrator.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#include <vtkm/filter/flow/worklet/Field.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/Particles.h>
#include <vtkm/filter/flow/worklet/RK4Integrator.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
namespace vtkm
{
@ -52,17 +52,17 @@ inline VTKM_CONT vtkm::cont::DataSet StreamSurface::DoExecute(
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
//compute streamlines
FieldType velocities(field, fieldMeta.GetAssociation());
GridEvalType eval(coords, cells, velocities);
Stepper rk4(eval, this->StepSize);
vtkm::worklet::Streamline streamline;
vtkm::worklet::flow::Streamline streamline;
vtkm::cont::ArrayHandle<vtkm::Particle> seedArray;
vtkm::cont::ArrayCopy(this->Seeds, seedArray);

@ -48,7 +48,7 @@ if (VTKm_ENABLE_MPI)
target_link_libraries(vtkm_filter_flow PUBLIC MPI::MPI_CXX)
endif()
#add_subdirectory(worklet)
add_subdirectory(worklet)
#-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
#if (VTKm_ENABLE_TESTING)

@ -16,11 +16,11 @@
#include <vtkm/cont/ParticleArrayCopy.h>
#include <vtkm/filter/flow/BoundsMap.h>
#include <vtkm/filter/flow/FlowTypes.h>
#include <vtkm/worklet/ParticleAdvection.h>
#include <vtkm/worklet/particleadvection/EulerIntegrator.h>
#include <vtkm/worklet/particleadvection/IntegratorStatus.h>
#include <vtkm/worklet/particleadvection/RK4Integrator.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#include <vtkm/filter/flow/worklet/EulerIntegrator.h>
#include <vtkm/filter/flow/worklet/IntegratorStatus.h>
#include <vtkm/filter/flow/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/RK4Integrator.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
#include <vtkm/cont/internal/Variant.h>
@ -63,11 +63,11 @@ protected:
using FieldNameType =
vtkm::cont::internal::Variant<VelocityFieldNameType, ElectroMagneticFieldNameType>;
using RType =
vtkm::cont::internal::Variant<vtkm::worklet::ParticleAdvectionResult<vtkm::Particle>,
vtkm::worklet::ParticleAdvectionResult<vtkm::ChargedParticle>,
vtkm::worklet::StreamlineResult<vtkm::Particle>,
vtkm::worklet::StreamlineResult<vtkm::ChargedParticle>>;
using RType = vtkm::cont::internal::Variant<
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle>,
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::ChargedParticle>,
vtkm::worklet::flow::StreamlineResult<vtkm::Particle>,
vtkm::worklet::flow::StreamlineResult<vtkm::ChargedParticle>>;
public:
DataSetIntegrator(vtkm::Id id,
@ -250,7 +250,7 @@ VTKM_CONT void DataSetIntegrator::UpdateResult(const ResultType<ParticleType>& r
if (dsiInfo.TermIdx.empty())
return;
using ResType = vtkm::worklet::ParticleAdvectionResult<ParticleType>;
using ResType = vtkm::worklet::flow::ParticleAdvectionResult<ParticleType>;
auto indicesAH = vtkm::cont::make_ArrayHandle(dsiInfo.TermIdx, vtkm::CopyFlag::Off);
auto termPerm = vtkm::cont::make_ArrayHandlePermutation(indicesAH, result.Particles);
@ -273,7 +273,7 @@ VTKM_CONT bool DataSetIntegrator::GetOutput(vtkm::cont::DataSet& ds) const
if (this->IsParticleAdvectionResult())
{
using ResType = vtkm::worklet::ParticleAdvectionResult<ParticleType>;
using ResType = vtkm::worklet::flow::ParticleAdvectionResult<ParticleType>;
std::vector<vtkm::cont::ArrayHandle<ParticleType>> allParticles;
allParticles.reserve(nResults);
@ -300,7 +300,7 @@ VTKM_CONT bool DataSetIntegrator::GetOutput(vtkm::cont::DataSet& ds) const
}
else if (this->IsStreamlineResult())
{
using ResType = vtkm::worklet::StreamlineResult<ParticleType>;
using ResType = vtkm::worklet::flow::StreamlineResult<ParticleType>;
//Easy case with one result.
if (nResults == 1)

@ -45,7 +45,7 @@ public:
protected:
template <typename ArrayType>
VTKM_CONT void GetVelocityField(
vtkm::worklet::particleadvection::VelocityField<ArrayType>& velocityField) const
vtkm::worklet::flow::VelocityField<ArrayType>& velocityField) const
{
if (this->FieldName.GetIndex() == this->FieldName.GetIndexOf<VelocityFieldNameType>())
{
@ -54,7 +54,7 @@ protected:
ArrayType arr;
vtkm::cont::ArrayCopyShallowIfPossible(this->DataSet.GetField(fieldNm).GetData(), arr);
velocityField = vtkm::worklet::particleadvection::VelocityField<ArrayType>(arr, assoc);
velocityField = vtkm::worklet::flow::VelocityField<ArrayType>(arr, assoc);
}
else
throw vtkm::cont::ErrorFilterExecution("Velocity field vector type not available");
@ -68,8 +68,8 @@ private:
namespace internal
{
using ArrayType = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using VelocityFieldType = vtkm::worklet::particleadvection::VelocityField<ArrayType>;
using SteadyStateGridEvalType = vtkm::worklet::particleadvection::GridEvaluator<VelocityFieldType>;
using VelocityFieldType = vtkm::worklet::flow::VelocityField<ArrayType>;
using SteadyStateGridEvalType = vtkm::worklet::flow::GridEvaluator<VelocityFieldType>;
template <typename GridEvalType, typename ParticleType>
class AdvectHelper;
@ -84,20 +84,20 @@ public:
vtkm::FloatDefault stepSize,
vtkm::Id maxSteps,
const IntegrationSolverType& solverType,
vtkm::worklet::ParticleAdvectionResult<ParticleType>& result)
vtkm::worklet::flow::ParticleAdvectionResult<ParticleType>& result)
{
if (solverType == IntegrationSolverType::RK4_TYPE)
{
DoAdvect<vtkm::worklet::ParticleAdvection,
vtkm::worklet::ParticleAdvectionResult,
vtkm::worklet::particleadvection::RK4Integrator>(
DoAdvect<vtkm::worklet::flow::ParticleAdvection,
vtkm::worklet::flow::ParticleAdvectionResult,
vtkm::worklet::flow::RK4Integrator>(
velField, ds, seedArray, stepSize, maxSteps, result);
}
else if (solverType == IntegrationSolverType::EULER_TYPE)
{
DoAdvect<vtkm::worklet::ParticleAdvection,
vtkm::worklet::ParticleAdvectionResult,
vtkm::worklet::particleadvection::EulerIntegrator>(
DoAdvect<vtkm::worklet::flow::ParticleAdvection,
vtkm::worklet::flow::ParticleAdvectionResult,
vtkm::worklet::flow::EulerIntegrator>(
velField, ds, seedArray, stepSize, maxSteps, result);
}
else
@ -110,20 +110,20 @@ public:
vtkm::FloatDefault stepSize,
vtkm::Id maxSteps,
const IntegrationSolverType& solverType,
vtkm::worklet::StreamlineResult<ParticleType>& result)
vtkm::worklet::flow::StreamlineResult<ParticleType>& result)
{
if (solverType == IntegrationSolverType::RK4_TYPE)
{
DoAdvect<vtkm::worklet::Streamline,
vtkm::worklet::StreamlineResult,
vtkm::worklet::particleadvection::RK4Integrator>(
DoAdvect<vtkm::worklet::flow::Streamline,
vtkm::worklet::flow::StreamlineResult,
vtkm::worklet::flow::RK4Integrator>(
velField, ds, seedArray, stepSize, maxSteps, result);
}
else if (solverType == IntegrationSolverType::EULER_TYPE)
{
DoAdvect<vtkm::worklet::Streamline,
vtkm::worklet::StreamlineResult,
vtkm::worklet::particleadvection::EulerIntegrator>(
DoAdvect<vtkm::worklet::flow::Streamline,
vtkm::worklet::flow::StreamlineResult,
vtkm::worklet::flow::EulerIntegrator>(
velField, ds, seedArray, stepSize, maxSteps, result);
}
else
@ -143,8 +143,7 @@ public:
ResultType<ParticleType>& result)
{
using StepperType =
vtkm::worklet::particleadvection::Stepper<SolverType<SteadyStateGridEvalType>,
SteadyStateGridEvalType>;
vtkm::worklet::flow::Stepper<SolverType<SteadyStateGridEvalType>, SteadyStateGridEvalType>;
WorkletType worklet;
SteadyStateGridEvalType eval(ds, velField);
@ -165,7 +164,7 @@ VTKM_CONT inline void DataSetIntegratorSteadyState::DoAdvect(DSIHelperInfo<vtkm:
if (this->VecFieldType == VectorFieldType::VELOCITY_FIELD_TYPE)
{
using FieldType = vtkm::worklet::particleadvection::VelocityField<ArrayType>;
using FieldType = vtkm::worklet::flow::VelocityField<ArrayType>;
FieldType velField;
this->GetVelocityField(velField);
@ -173,14 +172,14 @@ VTKM_CONT inline void DataSetIntegratorSteadyState::DoAdvect(DSIHelperInfo<vtkm:
if (this->IsParticleAdvectionResult())
{
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> result;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> result;
AHType::Advect(
velField, this->DataSet, seedArray, stepSize, maxSteps, this->SolverType, result);
this->UpdateResult(result, b);
}
else if (this->IsStreamlineResult())
{
vtkm::worklet::StreamlineResult<vtkm::Particle> result;
vtkm::worklet::flow::StreamlineResult<vtkm::Particle> result;
AHType::Advect(
velField, this->DataSet, seedArray, stepSize, maxSteps, this->SolverType, result);
this->UpdateResult(result, b);

@ -12,7 +12,7 @@
#define vtk_m_filter_flow_DataSetIntegratorUnsteadyState_h
#include <vtkm/filter/flow/DataSetIntegrator.h>
#include <vtkm/worklet/particleadvection/TemporalGridEvaluators.h>
#include <vtkm/filter/flow/worklet/TemporalGridEvaluators.h>
namespace vtkm
{
@ -53,8 +53,8 @@ public:
protected:
template <typename ArrayType>
VTKM_CONT void GetVelocityFields(
vtkm::worklet::particleadvection::VelocityField<ArrayType>& velocityField1,
vtkm::worklet::particleadvection::VelocityField<ArrayType>& velocityField2) const
vtkm::worklet::flow::VelocityField<ArrayType>& velocityField1,
vtkm::worklet::flow::VelocityField<ArrayType>& velocityField2) const
{
if (this->FieldName.GetIndex() == this->FieldName.GetIndexOf<VelocityFieldNameType>())
{
@ -68,8 +68,8 @@ protected:
vtkm::cont::ArrayCopyShallowIfPossible(this->DataSet1.GetField(fieldNm).GetData(), arr1);
vtkm::cont::ArrayCopyShallowIfPossible(this->DataSet2.GetField(fieldNm).GetData(), arr2);
velocityField1 = vtkm::worklet::particleadvection::VelocityField<ArrayType>(arr1, assoc);
velocityField2 = vtkm::worklet::particleadvection::VelocityField<ArrayType>(arr2, assoc);
velocityField1 = vtkm::worklet::flow::VelocityField<ArrayType>(arr1, assoc);
velocityField2 = vtkm::worklet::flow::VelocityField<ArrayType>(arr2, assoc);
}
else
throw vtkm::cont::ErrorFilterExecution("Velocity field vector type not available");
@ -87,9 +87,8 @@ private:
namespace internal
{
using ArrayType = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using VelocityFieldType = vtkm::worklet::particleadvection::VelocityField<ArrayType>;
using UnsteadyStateGridEvalType =
vtkm::worklet::particleadvection::TemporalGridEvaluator<VelocityFieldType>;
using VelocityFieldType = vtkm::worklet::flow::VelocityField<ArrayType>;
using UnsteadyStateGridEvalType = vtkm::worklet::flow::TemporalGridEvaluator<VelocityFieldType>;
template <typename GridEvalType, typename ParticleType>
class AdvectHelper;
@ -108,20 +107,20 @@ public:
vtkm::FloatDefault stepSize,
vtkm::Id maxSteps,
const IntegrationSolverType& solverType,
vtkm::worklet::ParticleAdvectionResult<ParticleType>& result)
vtkm::worklet::flow::ParticleAdvectionResult<ParticleType>& result)
{
if (solverType == IntegrationSolverType::RK4_TYPE)
{
DoAdvect<vtkm::worklet::ParticleAdvection,
vtkm::worklet::ParticleAdvectionResult,
vtkm::worklet::particleadvection::RK4Integrator>(
DoAdvect<vtkm::worklet::flow::ParticleAdvection,
vtkm::worklet::flow::ParticleAdvectionResult,
vtkm::worklet::flow::RK4Integrator>(
velField1, ds1, t1, velField2, ds2, t2, seedArray, stepSize, maxSteps, result);
}
else if (solverType == IntegrationSolverType::EULER_TYPE)
{
DoAdvect<vtkm::worklet::ParticleAdvection,
vtkm::worklet::ParticleAdvectionResult,
vtkm::worklet::particleadvection::EulerIntegrator>(
DoAdvect<vtkm::worklet::flow::ParticleAdvection,
vtkm::worklet::flow::ParticleAdvectionResult,
vtkm::worklet::flow::EulerIntegrator>(
velField1, ds1, t1, velField2, ds2, t2, seedArray, stepSize, maxSteps, result);
}
else
@ -138,20 +137,20 @@ public:
vtkm::FloatDefault stepSize,
vtkm::Id maxSteps,
const IntegrationSolverType& solverType,
vtkm::worklet::StreamlineResult<ParticleType>& result)
vtkm::worklet::flow::StreamlineResult<ParticleType>& result)
{
if (solverType == IntegrationSolverType::RK4_TYPE)
{
DoAdvect<vtkm::worklet::Streamline,
vtkm::worklet::StreamlineResult,
vtkm::worklet::particleadvection::RK4Integrator>(
DoAdvect<vtkm::worklet::flow::Streamline,
vtkm::worklet::flow::StreamlineResult,
vtkm::worklet::flow::RK4Integrator>(
velField1, ds1, t1, velField2, ds2, t2, seedArray, stepSize, maxSteps, result);
}
else if (solverType == IntegrationSolverType::EULER_TYPE)
{
DoAdvect<vtkm::worklet::Streamline,
vtkm::worklet::StreamlineResult,
vtkm::worklet::particleadvection::EulerIntegrator>(
DoAdvect<vtkm::worklet::flow::Streamline,
vtkm::worklet::flow::StreamlineResult,
vtkm::worklet::flow::EulerIntegrator>(
velField1, ds1, t1, velField2, ds2, t2, seedArray, stepSize, maxSteps, result);
}
else
@ -174,9 +173,8 @@ public:
vtkm::Id maxSteps,
ResultType<ParticleType>& result)
{
using StepperType =
vtkm::worklet::particleadvection::Stepper<SolverType<UnsteadyStateGridEvalType>,
UnsteadyStateGridEvalType>;
using StepperType = vtkm::worklet::flow::Stepper<SolverType<UnsteadyStateGridEvalType>,
UnsteadyStateGridEvalType>;
WorkletType worklet;
UnsteadyStateGridEvalType eval(ds1, t1, velField1, ds2, t2, velField2);
@ -200,13 +198,13 @@ VTKM_CONT inline void DataSetIntegratorUnsteadyState::DoAdvect(DSIHelperInfo<vtk
if (this->VecFieldType == VectorFieldType::VELOCITY_FIELD_TYPE)
{
using FieldType = vtkm::worklet::particleadvection::VelocityField<ArrayType>;
using FieldType = vtkm::worklet::flow::VelocityField<ArrayType>;
FieldType velField1, velField2;
this->GetVelocityFields(velField1, velField2);
if (this->IsParticleAdvectionResult())
{
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> result;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> result;
AHType::Advect(velField1,
this->DataSet1,
this->Time1,
@ -222,7 +220,7 @@ VTKM_CONT inline void DataSetIntegratorUnsteadyState::DoAdvect(DSIHelperInfo<vtk
}
else if (this->IsStreamlineResult())
{
vtkm::worklet::StreamlineResult<vtkm::Particle> result;
vtkm::worklet::flow::StreamlineResult<vtkm::Particle> result;
AHType::Advect(velField1,
this->DataSet1,
this->Time1,

@ -74,14 +74,14 @@ private:
if (this->ResultType == vtkm::filter::flow::FlowResultType::PARTICLE_ADVECT_TYPE)
{
using AlgorithmType = vtkm::filter::flow::
AdvectAlgorithm<DSIType, vtkm::worklet::ParticleAdvectionResult, ParticleType>;
AdvectAlgorithm<DSIType, vtkm::worklet::flow::ParticleAdvectionResult, ParticleType>;
return this->RunAlgo<AlgorithmType, ParticleType>(numSteps, stepSize, seeds);
}
else
{
using AlgorithmType = vtkm::filter::flow::
AdvectAlgorithm<DSIType, vtkm::worklet::StreamlineResult, ParticleType>;
AdvectAlgorithm<DSIType, vtkm::worklet::flow::StreamlineResult, ParticleType>;
return this->RunAlgo<AlgorithmType, ParticleType>(numSteps, stepSize, seeds);
}
@ -90,15 +90,17 @@ private:
{
if (this->ResultType == vtkm::filter::flow::FlowResultType::PARTICLE_ADVECT_TYPE)
{
using AlgorithmType = vtkm::filter::flow::
AdvectAlgorithmThreaded<DSIType, vtkm::worklet::ParticleAdvectionResult, ParticleType>;
using AlgorithmType =
vtkm::filter::flow::AdvectAlgorithmThreaded<DSIType,
vtkm::worklet::flow::ParticleAdvectionResult,
ParticleType>;
return this->RunAlgo<AlgorithmType, ParticleType>(numSteps, stepSize, seeds);
}
else
{
using AlgorithmType = vtkm::filter::flow::
AdvectAlgorithmThreaded<DSIType, vtkm::worklet::StreamlineResult, ParticleType>;
AdvectAlgorithmThreaded<DSIType, vtkm::worklet::flow::StreamlineResult, ParticleType>;
return this->RunAlgo<AlgorithmType, ParticleType>(numSteps, stepSize, seeds);
}

@ -131,7 +131,8 @@ template <typename ParticleType>
std::size_t ParticleMessenger<ParticleType>::CalcParticleBufferSize(std::size_t nParticles,
std::size_t nBlockIds)
{
std::size_t pSize = sizeof(ParticleType);
ParticleType pTmp;
std::size_t pSize = ParticleType::Sizeof();
#ifndef NDEBUG
vtkmdiy::MemoryBuffer buff;
@ -139,6 +140,7 @@ std::size_t ParticleMessenger<ParticleType>::CalcParticleBufferSize(std::size_t
vtkmdiy::save(buff, p);
//Make sure the buffer size is correct.
//If this fires, then the size of the class has changed.
VTKM_ASSERT(pSize == buff.size());
#endif

@ -9,6 +9,7 @@
##============================================================================
set(headers
ParticleAdvection.h
CellInterpolationHelper.h
EulerIntegrator.h
Field.h

@ -8,8 +8,8 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_particle_advection_cell_interpolation_helper
#define vtk_m_worklet_particle_advection_cell_interpolation_helper
#ifndef vtk_m_filter_flow_worklet_CellInterpolationHelper_h
#define vtk_m_filter_flow_worklet_CellInterpolationHelper_h
#include <vtkm/CellShape.h>
#include <vtkm/Types.h>
@ -282,4 +282,4 @@ private:
} //namespace cont
} //namespace vtkm
#endif //vtk_m_worklet_particle_advection_cell_interpolation_helper
#endif //vtk_m_filter_flow_worklet_CellInterpolationHelper_h

@ -10,14 +10,14 @@
//
//=============================================================================
#ifndef vtk_m_worklet_particleadvection_EulerIntegrator_h
#define vtk_m_worklet_particleadvection_EulerIntegrator_h
#ifndef vtk_m_filter_flow_worklet_EulerIntegrator_h
#define vtk_m_filter_flow_worklet_EulerIntegrator_h
namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
template <typename EvaluatorType>
@ -73,8 +73,8 @@ public:
}
}; //EulerIntegrator
} //namespace particleadvection
} //namespace worklet
} //namespace vtkm
}
}
} //vtkm::worklet::flow
#endif // vtk_m_worklet_particleadvection_EulerIntegrator_h
#endif // vtk_m_filter_flow_worklet_EulerIntegrator_h

@ -8,8 +8,8 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtkm_woklet_particleadvection_field_h
#define vtkm_woklet_particleadvection_field_h
#ifndef vtkm_filter_flow_worklet_Field_h
#define vtkm_filter_flow_worklet_Field_h
#include <vtkm/Types.h>
@ -22,7 +22,7 @@ namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
template <typename FieldArrayType>
@ -209,7 +209,8 @@ private:
Association Assoc;
};
} // namespace particleadvection
} // namespace worklet
} // namespace
#endif //vtkm_woklet_particleadvection_field_h
}
}
} //vtkm::worklet::flow
#endif //vtkm_filter_flow_worklet_Field_h

@ -8,8 +8,8 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_particleadvection_GridEvaluatorStatus_h
#define vtk_m_worklet_particleadvection_GridEvaluatorStatus_h
#ifndef vtk_m_filter_flow_worklet_GridEvaluatorStatus_h
#define vtk_m_filter_flow_worklet_GridEvaluatorStatus_h
#include <vtkm/Bitset.h>
#include <vtkm/Types.h>
@ -26,7 +26,7 @@ namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
class GridEvaluatorStatus : public vtkm::Bitset<vtkm::UInt8>
@ -62,8 +62,9 @@ private:
static constexpr vtkm::Id TEMPORAL_BOUNDS_BIT = 2;
static constexpr vtkm::Id IN_GHOST_CELL_BIT = 3;
};
}
}
}
#endif // vtk_m_worklet_particleadvection_GridEvaluatorStatus_h
#endif // vtk_m_filter_flow_worklet_GridEvaluatorStatus_h

@ -8,8 +8,8 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_particleadvection_GridEvaluators_h
#define vtk_m_worklet_particleadvection_GridEvaluators_h
#ifndef vtk_m_filter_flow_worklet_GridEvaluators_h
#define vtk_m_filter_flow_worklet_GridEvaluators_h
#include <vtkm/Bitset.h>
#include <vtkm/CellClassification.h>
@ -24,15 +24,15 @@
#include <vtkm/cont/CellSetStructured.h>
#include <vtkm/cont/DataSet.h>
#include <vtkm/worklet/particleadvection/CellInterpolationHelper.h>
#include <vtkm/worklet/particleadvection/Field.h>
#include <vtkm/worklet/particleadvection/GridEvaluatorStatus.h>
#include <vtkm/filter/flow/worklet/CellInterpolationHelper.h>
#include <vtkm/filter/flow/worklet/Field.h>
#include <vtkm/filter/flow/worklet/GridEvaluatorStatus.h>
namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
template <typename FieldType>
@ -232,8 +232,8 @@ private:
vtkm::cont::CellLocatorGeneral Locator;
};
} //namespace particleadvection
} //namespace worklet
} //namespace vtkm
}
}
} //vtkm::worklet::flow
#endif // vtk_m_worklet_particleadvection_GridEvaluators_h
#endif // vtk_m_filter_flow_worklet_GridEvaluators_h

@ -10,8 +10,8 @@
//
//=============================================================================
#ifndef vtk_m_worklet_particleadvection_Integrator_Status_h
#define vtk_m_worklet_particleadvection_Integrator_Status_h
#ifndef vtk_m_filter_flow_worklet_IntegratorStatus_h
#define vtk_m_filter_flow_worklet_IntegratorStatus_h
#include <iomanip>
#include <limits>
@ -21,13 +21,13 @@
#include <vtkm/Types.h>
#include <vtkm/VectorAnalysis.h>
#include <vtkm/worklet/particleadvection/GridEvaluatorStatus.h>
#include <vtkm/filter/flow/worklet/GridEvaluatorStatus.h>
namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
class IntegratorStatus : public vtkm::Bitset<vtkm::UInt8>
@ -82,9 +82,9 @@ inline VTKM_CONT std::ostream& operator<<(std::ostream& s, const IntegratorStatu
<< " tm= " << status.CheckTemporalBounds() << " gc= " << status.CheckInGhostCell() << "]";
return s;
}
}
}
}
}
}
} //vtkm::worklet::flow
#endif // vtk_m_worklet_particleadvection_IntegratorStatus_h
#endif // vtk_m_filter_flow_worklet_IntegratorStatus_h

@ -8,19 +8,21 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_ParticleAdvection_h
#define vtk_m_worklet_ParticleAdvection_h
#ifndef vtk_m_filter_flow_worklet_ParticleAdvection_h
#define vtk_m_filter_flow_worklet_ParticleAdvection_h
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/worklet/particleadvection/ParticleAdvectionWorklets.h>
#include <vtkm/filter/flow/worklet/ParticleAdvectionWorklets.h>
namespace vtkm
{
namespace worklet
{
namespace flow
{
namespace detail
{
@ -76,8 +78,7 @@ public:
vtkm::Id MaxSteps,
ParticleAdvectionResult<ParticleType>& result)
{
vtkm::worklet::particleadvection::ParticleAdvectionWorklet<IntegratorType, ParticleType>
worklet;
vtkm::worklet::flow::ParticleAdvectionWorklet<IntegratorType, ParticleType> worklet;
worklet.Run(it, particles, MaxSteps);
result = ParticleAdvectionResult<ParticleType>(particles);
@ -89,8 +90,7 @@ public:
vtkm::cont::ArrayHandle<ParticleType, ParticleStorage>& particles,
vtkm::Id MaxSteps)
{
vtkm::worklet::particleadvection::ParticleAdvectionWorklet<IntegratorType, ParticleType>
worklet;
vtkm::worklet::flow::ParticleAdvectionWorklet<IntegratorType, ParticleType> worklet;
worklet.Run(it, particles, MaxSteps);
return ParticleAdvectionResult<ParticleType>(particles);
@ -102,8 +102,7 @@ public:
const vtkm::cont::ArrayHandle<vtkm::Vec3f, PointStorage>& points,
vtkm::Id MaxSteps)
{
vtkm::worklet::particleadvection::ParticleAdvectionWorklet<IntegratorType, ParticleType>
worklet;
vtkm::worklet::flow::ParticleAdvectionWorklet<IntegratorType, ParticleType> worklet;
vtkm::cont::ArrayHandle<ParticleType> particles;
vtkm::cont::ArrayHandle<vtkm::Id> step, ids;
@ -161,7 +160,7 @@ public:
vtkm::cont::ArrayHandle<ParticleType, ParticleStorage>& particles,
vtkm::Id MaxSteps)
{
vtkm::worklet::particleadvection::StreamlineWorklet<IntegratorType, ParticleType> worklet;
vtkm::worklet::flow::StreamlineWorklet<IntegratorType, ParticleType> worklet;
vtkm::cont::ArrayHandle<vtkm::Vec3f> positions;
vtkm::cont::CellSetExplicit<> polyLines;
@ -171,7 +170,9 @@ public:
return StreamlineResult<ParticleType>(particles, positions, polyLines);
}
};
}
}
#endif // vtk_m_worklet_ParticleAdvection_h
}
}
} // vtkm::worklet::flow
#endif // vtk_m_filter_flow_worklet_ParticleAdvection_h

@ -8,8 +8,8 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_particleadvection_ParticleAdvectionWorklets_h
#define vtk_m_worklet_particleadvection_ParticleAdvectionWorklets_h
#ifndef vtk_m_filter_flow_worklet_ParticleAdvectionWorklets_h
#define vtk_m_filter_flow_worklet_ParticleAdvectionWorklets_h
#include <vtkm/Types.h>
#include <vtkm/cont/Algorithm.h>
@ -22,9 +22,9 @@
#include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/Particle.h>
#include <vtkm/filter/flow/worklet/Particles.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#ifdef VTKM_CUDA
#include <vtkm/cont/cuda/internal/ScopedCudaStackSize.h>
@ -34,7 +34,7 @@ namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
class ParticleAdvectWorklet : public vtkm::worklet::WorkletMapField
@ -106,10 +106,10 @@ public:
vtkm::Id& MaxSteps)
{
using ParticleAdvectWorkletType = vtkm::worklet::particleadvection::ParticleAdvectWorklet;
using ParticleAdvectWorkletType = vtkm::worklet::flow::ParticleAdvectWorklet;
using ParticleWorkletDispatchType =
typename vtkm::worklet::DispatcherMapField<ParticleAdvectWorkletType>;
using ParticleArrayType = vtkm::worklet::particleadvection::Particles<ParticleType>;
using ParticleArrayType = vtkm::worklet::flow::Particles<ParticleType>;
vtkm::Id numSeeds = static_cast<vtkm::Id>(particles.GetNumberOfValues());
//Create and invoke the particle advection.
@ -186,10 +186,9 @@ public:
vtkm::cont::CellSetExplicit<>& polyLines)
{
using ParticleWorkletDispatchType = typename vtkm::worklet::DispatcherMapField<
vtkm::worklet::particleadvection::ParticleAdvectWorklet>;
using StreamlineArrayType =
vtkm::worklet::particleadvection::StateRecordingParticles<ParticleType>;
using ParticleWorkletDispatchType =
typename vtkm::worklet::DispatcherMapField<vtkm::worklet::flow::ParticleAdvectWorklet>;
using StreamlineArrayType = vtkm::worklet::flow::StateRecordingParticles<ParticleType>;
vtkm::cont::ArrayHandle<vtkm::Id> initialStepsTaken;
@ -238,8 +237,9 @@ public:
polyLines.Fill(positions.GetNumberOfValues(), cellTypes, connectivity, offsets);
}
};
}
}
} // namespace vtkm::worklet::particleadvection
#endif // vtk_m_worklet_particleadvection_ParticleAdvectionWorklets_h
}
}
} // namespace vtkm::worklet::flow
#endif // vtk_m_filter_flow_worklet_ParticleAdvectionWorklets_h

@ -8,8 +8,8 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_particleadvection_Particles_h
#define vtk_m_worklet_particleadvection_Particles_h
#ifndef vtk_m_filter_flow_worklet_Particles_h
#define vtk_m_filter_flow_worklet_Particles_h
#include <vtkm/Particle.h>
#include <vtkm/Types.h>
@ -17,14 +17,15 @@
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/worklet/particleadvection/IntegratorStatus.h>
#include <vtkm/filter/flow/worklet/IntegratorStatus.h>
namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
template <typename ParticleType>
class ParticleExecutionObject
{
@ -66,7 +67,7 @@ public:
VTKM_EXEC
void StatusUpdate(const vtkm::Id& idx,
const vtkm::worklet::particleadvection::IntegratorStatus& status,
const vtkm::worklet::flow::IntegratorStatus& status,
vtkm::Id maxSteps)
{
ParticleType p(this->GetParticle(idx));
@ -116,10 +117,11 @@ template <typename ParticleType>
class Particles : public vtkm::cont::ExecutionObjectBase
{
public:
VTKM_CONT vtkm::worklet::particleadvection::ParticleExecutionObject<ParticleType>
PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
VTKM_CONT vtkm::worklet::flow::ParticleExecutionObject<ParticleType> PrepareForExecution(
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return vtkm::worklet::particleadvection::ParticleExecutionObject<ParticleType>(
return vtkm::worklet::flow::ParticleExecutionObject<ParticleType>(
this->ParticleArray, this->MaxSteps, device, token);
}
@ -221,10 +223,10 @@ public:
};
VTKM_CONT vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject<ParticleType>
VTKM_CONT vtkm::worklet::flow::StateRecordingParticleExecutionObject<ParticleType>
PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
{
return vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject<ParticleType>(
return vtkm::worklet::flow::StateRecordingParticleExecutionObject<ParticleType>(
this->ParticleArray,
this->HistoryArray,
this->ValidPointArray,
@ -276,9 +278,9 @@ protected:
};
} //namespace particleadvection
} //namespace worklet
} //namespace vtkm
}
}
} //vtkm::worklet::flow
#endif // vtk_m_worklet_particleadvection_Particles_h
#endif // vtk_m_filter_flow_worklet_Particles_h
//============================================================================

@ -10,14 +10,14 @@
//
//=============================================================================
#ifndef vtk_m_worklet_particleadvection_RK4Integrator_h
#define vtk_m_worklet_particleadvection_RK4Integrator_h
#ifndef vtk_m_filter_flow_worklet_RK4Integrator_h
#define vtk_m_filter_flow_worklet_RK4Integrator_h
namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
template <typename ExecEvaluatorType>
@ -112,8 +112,8 @@ public:
}
};
} //namespace particleadvection
} //namespace worklet
} //namespace vtkm
}
}
} //vtkm::worklet::flow
#endif // vtk_m_worklet_particleadvection_RK4Integrator_h
#endif // vtk_m_filter_flow_worklet_RK4Integrator_h

@ -10,8 +10,8 @@
//
//=============================================================================
#ifndef vtk_m_worklet_particleadvection_Stepper_h
#define vtk_m_worklet_particleadvection_Stepper_h
#ifndef vtk_m_filter_flow_worklet_Stepper_h
#define vtk_m_filter_flow_worklet_Stepper_h
#include <limits>
@ -22,15 +22,15 @@
#include <vtkm/cont/DataSet.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/worklet/particleadvection/IntegratorStatus.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/IntegratorStatus.h>
#include <vtkm/filter/flow/worklet/Particles.h>
namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
template <typename ExecIntegratorType, typename ExecEvaluatorType>
@ -194,8 +194,8 @@ public:
}
};
} //namespace particleadvection
} //namespace worklet
} //namespace vtkm
}
}
} //vtkm::worklet::flow
#endif // vtk_m_worklet_particleadvection_Stepper_h
#endif // vtk_m_filter_flow_worklet_Stepper_h

@ -8,26 +8,25 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_particleadvection_TemporalGridEvaluators_h
#define vtk_m_worklet_particleadvection_TemporalGridEvaluators_h
#ifndef vtk_m_filter_flow_worklet_TemporalGridEvaluators_h
#define vtk_m_filter_flow_worklet_TemporalGridEvaluators_h
#include <vtkm/worklet/particleadvection/GridEvaluatorStatus.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/GridEvaluatorStatus.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
namespace vtkm
{
namespace worklet
{
namespace particleadvection
namespace flow
{
template <typename FieldType>
class ExecutionTemporalGridEvaluator
{
private:
using GridEvaluator = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using ExecutionGridEvaluator =
vtkm::worklet::particleadvection::ExecutionGridEvaluator<FieldType>;
using GridEvaluator = vtkm::worklet::flow::GridEvaluator<FieldType>;
using ExecutionGridEvaluator = vtkm::worklet::flow::ExecutionGridEvaluator<FieldType>;
public:
VTKM_CONT
@ -117,7 +116,7 @@ template <typename FieldType>
class TemporalGridEvaluator : public vtkm::cont::ExecutionObjectBase
{
private:
using GridEvaluator = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using GridEvaluator = vtkm::worklet::flow::GridEvaluator<FieldType>;
public:
VTKM_CONT TemporalGridEvaluator() = default;
@ -178,8 +177,8 @@ private:
vtkm::FloatDefault TimeTwo;
};
} // namespace particleadvection
} // namespace worklet
} // namespace vtkm
}
}
} //vtkm::worklet::flow
#endif
#endif // vtk_m_filter_flow_worklet_TemporalGridEvaluators_h

@ -32,7 +32,6 @@ set(headers
MIR.h
NDimsHistMarginalization.h
Normalize.h
ParticleAdvection.h
ScalarsToColors.h
ScatterCounting.h
ScatterIdentity.h
@ -86,7 +85,6 @@ add_subdirectory(mir)
add_subdirectory(splatkernels)
add_subdirectory(spatialstructure)
add_subdirectory(wavelets)
add_subdirectory(particleadvection)
vtkm_library(
NAME vtkm_worklet

@ -13,15 +13,15 @@
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/flow/worklet/EulerIntegrator.h>
#include <vtkm/filter/flow/worklet/Field.h>
#include <vtkm/filter/flow/worklet/GridEvaluators.h>
#include <vtkm/filter/flow/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/Particles.h>
#include <vtkm/filter/flow/worklet/RK4Integrator.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
#include <vtkm/filter/mesh_info/GhostCellClassify.h>
#include <vtkm/io/VTKDataSetReader.h>
#include <vtkm/worklet/ParticleAdvection.h>
#include <vtkm/worklet/particleadvection/EulerIntegrator.h>
#include <vtkm/worklet/particleadvection/Field.h>
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/worklet/particleadvection/RK4Integrator.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#include <vtkm/worklet/testing/GenerateTestDataSets.h>
#include <random>
@ -142,7 +142,7 @@ public:
template <typename EvaluatorType>
VTKM_EXEC void operator()(vtkm::Particle& pointIn,
const EvaluatorType& evaluator,
vtkm::worklet::particleadvection::GridEvaluatorStatus& status,
vtkm::worklet::flow::GridEvaluatorStatus& status,
vtkm::Vec3f& pointOut) const
{
vtkm::VecVariable<vtkm::Vec3f, 2> values;
@ -159,7 +159,7 @@ void ValidateEvaluator(const EvalType& eval,
{
using EvalTester = TestEvaluatorWorklet;
using EvalTesterDispatcher = vtkm::worklet::DispatcherMapField<EvalTester>;
using Status = vtkm::worklet::particleadvection::GridEvaluatorStatus;
using Status = vtkm::worklet::flow::GridEvaluatorStatus;
EvalTester evalTester;
EvalTesterDispatcher evalTesterDispatcher(evalTester);
vtkm::cont::ArrayHandle<vtkm::Particle> pointsHandle =
@ -192,7 +192,7 @@ public:
template <typename Particle, typename IntegratorType>
VTKM_EXEC void operator()(Particle& pointIn,
const IntegratorType integrator,
vtkm::worklet::particleadvection::IntegratorStatus& status,
vtkm::worklet::flow::IntegratorStatus& status,
vtkm::Vec3f& pointOut) const
{
vtkm::FloatDefault time = 0;
@ -211,7 +211,7 @@ void ValidateIntegrator(const IntegratorType& integrator,
{
using IntegratorTester = TestIntegratorWorklet;
using IntegratorTesterDispatcher = vtkm::worklet::DispatcherMapField<IntegratorTester>;
using Status = vtkm::worklet::particleadvection::IntegratorStatus;
using Status = vtkm::worklet::flow::IntegratorStatus;
IntegratorTesterDispatcher integratorTesterDispatcher;
auto pointsHandle = vtkm::cont::make_ArrayHandle(pointIns, vtkm::CopyFlag::Off);
vtkm::Id numPoints = pointsHandle.GetNumberOfValues();
@ -243,7 +243,7 @@ void ValidateIntegratorForBoundary(const vtkm::Bounds& bounds,
{
using IntegratorTester = TestIntegratorWorklet;
using IntegratorTesterDispatcher = vtkm::worklet::DispatcherMapField<IntegratorTester>;
using Status = vtkm::worklet::particleadvection::IntegratorStatus;
using Status = vtkm::worklet::flow::IntegratorStatus;
IntegratorTesterDispatcher integratorTesterDispatcher;
auto pointsHandle = vtkm::cont::make_ArrayHandle(pointIns, vtkm::CopyFlag::Off);
@ -269,10 +269,10 @@ void ValidateIntegratorForBoundary(const vtkm::Bounds& bounds,
void TestEvaluators()
{
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
std::vector<vtkm::Vec3f> vecs;
vtkm::FloatDefault vals[3] = { -1., 0., 1. };
@ -364,10 +364,10 @@ void TestEvaluators()
void TestGhostCellEvaluators()
{
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
constexpr vtkm::Id nX = 6;
constexpr vtkm::Id nY = 6;
@ -395,7 +395,7 @@ void TestGhostCellEvaluators()
vtkm::FloatDefault stepSize = static_cast<vtkm::FloatDefault>(0.1);
Stepper rk4(gridEval, stepSize);
vtkm::worklet::ParticleAdvection pa;
vtkm::worklet::flow::ParticleAdvection pa;
std::vector<vtkm::Particle> seeds;
//Points in a ghost cell.
seeds.push_back(vtkm::Particle(vtkm::Vec3f(.5, .5, .5), 0));
@ -426,7 +426,7 @@ void TestGhostCellEvaluators()
}
void ValidateParticleAdvectionResult(
const vtkm::worklet::ParticleAdvectionResult<vtkm::Particle>& res,
const vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle>& res,
vtkm::Id nSeeds,
vtkm::Id maxSteps)
{
@ -446,7 +446,7 @@ void ValidateParticleAdvectionResult(
}
}
void ValidateStreamlineResult(const vtkm::worklet::StreamlineResult<vtkm::Particle>& res,
void ValidateStreamlineResult(const vtkm::worklet::flow::StreamlineResult<vtkm::Particle>& res,
vtkm::Id nSeeds,
vtkm::Id maxSteps)
{
@ -465,8 +465,8 @@ void ValidateStreamlineResult(const vtkm::worklet::StreamlineResult<vtkm::Partic
void TestIntegrators()
{
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
const vtkm::Id3 dims(5, 5, 5);
const vtkm::Bounds bounds(0., 1., 0., 1., .0, .1);
@ -491,20 +491,20 @@ void TestIntegrators()
std::vector<vtkm::Particle> points;
GenerateRandomParticles(points, 3, bounds);
vtkm::worklet::ParticleAdvection pa;
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> res;
vtkm::worklet::flow::ParticleAdvection pa;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> res;
{
auto seeds = vtkm::cont::make_ArrayHandle(points, vtkm::CopyFlag::On);
using IntegratorType = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<IntegratorType, GridEvalType>;
using IntegratorType = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<IntegratorType, GridEvalType>;
Stepper rk4(eval, stepSize);
res = pa.Run(rk4, seeds, maxSteps);
ValidateParticleAdvectionResult(res, nSeeds, maxSteps);
}
{
auto seeds = vtkm::cont::make_ArrayHandle(points, vtkm::CopyFlag::On);
using IntegratorType = vtkm::worklet::particleadvection::EulerIntegrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<IntegratorType, GridEvalType>;
using IntegratorType = vtkm::worklet::flow::EulerIntegrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<IntegratorType, GridEvalType>;
Stepper euler(eval, stepSize);
res = pa.Run(euler, seeds, maxSteps);
ValidateParticleAdvectionResult(res, nSeeds, maxSteps);
@ -515,10 +515,10 @@ void TestIntegrators()
void TestParticleWorkletsWithDataSetTypes()
{
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
vtkm::FloatDefault stepSize = 0.01f;
const vtkm::Id3 dims(5, 5, 5);
@ -569,8 +569,8 @@ void TestParticleWorkletsWithDataSetTypes()
{
if (i < 2)
{
vtkm::worklet::ParticleAdvection pa;
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> res;
vtkm::worklet::flow::ParticleAdvection pa;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> res;
if (i == 0)
{
auto seeds = vtkm::cont::make_ArrayHandle(pts, vtkm::CopyFlag::On);
@ -585,8 +585,8 @@ void TestParticleWorkletsWithDataSetTypes()
}
else
{
vtkm::worklet::Streamline s;
vtkm::worklet::StreamlineResult<vtkm::Particle> res;
vtkm::worklet::flow::Streamline s;
vtkm::worklet::flow::StreamlineResult<vtkm::Particle> res;
if (i == 2)
{
auto seeds = vtkm::cont::make_ArrayHandle(pts, vtkm::CopyFlag::On);
@ -618,10 +618,10 @@ void TestParticleStatus()
auto dataSets = vtkm::worklet::testing::CreateAllDataSets(bounds, dims, false);
for (auto& ds : dataSets)
{
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
vtkm::Id maxSteps = 1000;
vtkm::FloatDefault stepSize = 0.01f;
@ -631,7 +631,7 @@ void TestParticleStatus()
GridEvalType eval(ds, velocities);
Stepper rk4(eval, stepSize);
vtkm::worklet::ParticleAdvection pa;
vtkm::worklet::flow::ParticleAdvection pa;
std::vector<vtkm::Particle> pts;
pts.push_back(vtkm::Particle(vtkm::Vec3f(.5, .5, .5), 0));
pts.push_back(vtkm::Particle(vtkm::Vec3f(-1, -1, -1), 1));
@ -649,10 +649,10 @@ void TestParticleStatus()
void TestWorkletsBasic()
{
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
vtkm::FloatDefault stepSize = 0.01f;
const vtkm::Id3 dims(5, 5, 5);
@ -711,8 +711,8 @@ void TestWorkletsBasic()
if (w == "particleAdvection")
{
vtkm::worklet::ParticleAdvection pa;
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> res;
vtkm::worklet::flow::ParticleAdvection pa;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> res;
res = pa.Run(rk4, seedsArray, maxSteps);
@ -735,8 +735,8 @@ void TestWorkletsBasic()
}
else if (w == "streamline")
{
vtkm::worklet::Streamline s;
vtkm::worklet::StreamlineResult<vtkm::Particle> res;
vtkm::worklet::flow::Streamline s;
vtkm::worklet::flow::StreamlineResult<vtkm::Particle> res;
res = s.Run(rk4, seedsArray, maxSteps);
@ -830,10 +830,10 @@ void TestParticleAdvectionFile(const std::string& fname,
}
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::particleadvection::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::particleadvection::Stepper<RK4Type, GridEvalType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using GridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
VTKM_TEST_ASSERT(ds.HasField("vec"), "Data set missing a field named 'vec'");
vtkm::cont::Field& field = ds.GetField("vec");
@ -862,16 +862,16 @@ void TestParticleAdvectionFile(const std::string& fname,
if (i == 0)
{
vtkm::worklet::ParticleAdvection pa;
vtkm::worklet::ParticleAdvectionResult<vtkm::Particle> res;
vtkm::worklet::flow::ParticleAdvection pa;
vtkm::worklet::flow::ParticleAdvectionResult<vtkm::Particle> res;
res = pa.Run(rk4, seedArray, maxSteps);
ValidateResult(res, maxSteps, endPts);
}
else if (i == 1)
{
vtkm::worklet::Streamline s;
vtkm::worklet::StreamlineResult<vtkm::Particle> res;
vtkm::worklet::flow::Streamline s;
vtkm::worklet::flow::StreamlineResult<vtkm::Particle> res;
res = s.Run(rk4, seedArray, maxSteps);
ValidateResult(res, maxSteps, endPts);

@ -17,11 +17,11 @@
#include <vtkm/cont/DataSetBuilderRectilinear.h>
#include <vtkm/cont/DataSetBuilderUniform.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/worklet/ParticleAdvection.h>
#include <vtkm/worklet/particleadvection/Field.h>
#include <vtkm/worklet/particleadvection/Particles.h>
#include <vtkm/worklet/particleadvection/Stepper.h>
#include <vtkm/worklet/particleadvection/TemporalGridEvaluators.h>
#include <vtkm/filter/flow/worklet/Field.h>
#include <vtkm/filter/flow/worklet/ParticleAdvection.h>
#include <vtkm/filter/flow/worklet/Particles.h>
#include <vtkm/filter/flow/worklet/Stepper.h>
#include <vtkm/filter/flow/worklet/TemporalGridEvaluators.h>
template <typename ScalarType>
vtkm::cont::DataSet CreateUniformDataSet(const vtkm::Bounds& bounds, const vtkm::Id3& dims)
@ -52,7 +52,7 @@ public:
template <typename EvaluatorType>
VTKM_EXEC void operator()(vtkm::Particle& pointIn,
const EvaluatorType& evaluator,
vtkm::worklet::particleadvection::GridEvaluatorStatus& status,
vtkm::worklet::flow::GridEvaluatorStatus& status,
vtkm::Vec3f& pointOut) const
{
vtkm::VecVariable<vtkm::Vec3f, 2> values;
@ -70,7 +70,7 @@ void ValidateEvaluator(const EvalType& eval,
{
using EvalTester = TestEvaluatorWorklet;
using EvalTesterDispatcher = vtkm::worklet::DispatcherMapField<EvalTester>;
using Status = vtkm::worklet::particleadvection::GridEvaluatorStatus;
using Status = vtkm::worklet::flow::GridEvaluatorStatus;
EvalTester evalTester;
EvalTesterDispatcher evalTesterDispatcher(evalTester);
@ -149,9 +149,9 @@ void TestTemporalEvaluators()
using ScalarType = vtkm::FloatDefault;
using PointType = vtkm::Vec<ScalarType, 3>;
using FieldHandle = vtkm::cont::ArrayHandle<PointType>;
using FieldType = vtkm::worklet::particleadvection::VelocityField<FieldHandle>;
using EvalType = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using TemporalEvalType = vtkm::worklet::particleadvection::TemporalGridEvaluator<FieldType>;
using FieldType = vtkm::worklet::flow::VelocityField<FieldHandle>;
using EvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
using TemporalEvalType = vtkm::worklet::flow::TemporalGridEvaluator<FieldType>;
// Create Datasets
vtkm::Id3 dims(5, 5, 5);