Commit 723792a4 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Use new integrators and evaluators for advection

parent d49c29ce
......@@ -70,15 +70,11 @@ void RunTest(const std::string& fname,
using FieldType = vtkm::Float32;
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>>;
using FieldPortalConstType =
typename FieldHandle::template ExecutionTypes<DeviceAdapter>::PortalConst;
vtkm::io::reader::BOVDataSetReader rdr(fname);
vtkm::cont::DataSet ds = rdr.ReadDataSet();
using RGEvalType = vtkm::worklet::particleadvection::UniformGridEvaluate<FieldPortalConstType,
FieldType,
DeviceAdapter>;
using RGEvalType = vtkm::worklet::particleadvection::UniformGridEvaluate<FieldHandle>;
using RK4RGType = vtkm::worklet::particleadvection::RK4Integrator<RGEvalType>;
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>> fieldArray;
......
......@@ -52,8 +52,6 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
using FieldType = vtkm::Float32;
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>>;
using FieldPortalConstType =
typename FieldHandle::template ExecutionTypes<DeviceAdapter>::PortalConst;
// These lines read two datasets, which are BOVs.
// Currently VTKm does not support providing time series datasets
......@@ -73,10 +71,7 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
// The only change in this example and the vanilla particle advection example is
// this example makes use of the TemporalGridEvaluator.
using GridEvaluator =
vtkm::worklet::particleadvection::TemporalGridEvaluator<FieldPortalConstType,
FieldType,
DeviceAdapter>;
using GridEvaluator = vtkm::worklet::particleadvection::TemporalGridEvaluator<FieldHandle>;
using Integrator = vtkm::worklet::particleadvection::EulerIntegrator<GridEvaluator>;
GridEvaluator eval(ds1.GetCoordinateSystem(),
......@@ -114,7 +109,7 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
else
{
vtkm::worklet::Streamline streamline;
vtkm::worklet::StreamlineResult<FieldType> res =
vtkm::worklet::StreamlineResult res =
streamline.Run(integrator, seedArray, numSteps, DeviceAdapter());
vtkm::cont::DataSet outData;
vtkm::cont::CoordinateSystem outputCoords("coordinates", res.positions);
......
......@@ -242,21 +242,16 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
vtkm::cont::ArrayHandleCartesianProduct<AxisHandle, AxisHandle, AxisHandle>;
using UniformType = vtkm::cont::ArrayHandleUniformPointCoordinates;
using FieldHandle = vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>;
using FieldPortalConstType =
typename FieldHandle::template ExecutionTypes<DeviceAdapter>::PortalConst;
using PortalType_Position = typename vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>::PortalControl;
using PortalType_DoublePosition =
typename vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>>::PortalControl;
vtkm::worklet::ParticleAdvection particleadvection;
vtkm::worklet::ParticleAdvectionResult<T> res;
vtkm::worklet::ParticleAdvectionResult res;
if (coords.GetData().IsType<RectilinearType>())
{
using RectilinearGridEvalType = vtkm::worklet::particleadvection::
RectilinearGridEvaluate<FieldPortalConstType, T, DeviceAdapter, StorageType>;
using RectilinearGridEvalType =
vtkm::worklet::particleadvection::RectilinearGridEvaluate<FieldHandle>;
using RK4IntegratorType =
vtkm::worklet::particleadvection::RK4Integrator<RectilinearGridEvalType, T>;
vtkm::worklet::particleadvection::RK4Integrator<RectilinearGridEvalType>;
/*
* If Euler step is preferred.
using EulerIntegratorType = vtkm::worklet::particleadvection::EulerIntegrator<RectilinearGridEvalType, T>;
......@@ -271,10 +266,8 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
}
else if (coords.GetData().IsType<UniformType>())
{
using UniformGridEvalType = vtkm::worklet::particleadvection::
UniformGridEvaluate<FieldPortalConstType, T, DeviceAdapter, StorageType>;
using RK4IntegratorType =
vtkm::worklet::particleadvection::RK4Integrator<UniformGridEvalType, T>;
using UniformGridEvalType = vtkm::worklet::particleadvection::UniformGridEvaluate<FieldHandle>;
using RK4IntegratorType = vtkm::worklet::particleadvection::RK4Integrator<UniformGridEvalType>;
/*
* If Euler step is preferred.
using EulerIntegratorType = vtkm::worklet::particleadvection::EulerIntegrator<UniformGridEvalType, T>;
......@@ -292,17 +285,14 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
std::cout << "Data set type is not rectilinear or uniform." << std::endl;
}
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>> particle_positions = res.positions;
vtkm::cont::ArrayHandle<vtkm::Id> particle_stepstaken = res.stepsTaken;
using PortalType_Position = typename vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>::PortalControl;
using PortalType_ID = typename vtkm::cont::ArrayHandle<vtkm::Id>::PortalControl;
auto particle_positions = res.positions;
auto particle_stepstaken = res.stepsTaken;
PortalType_DoublePosition start_position = BasisParticlesOriginal.GetPortalControl();
PortalType_Position end_position = particle_positions.GetPortalControl();
auto start_position = BasisParticlesOriginal.GetPortalControl();
auto end_position = particle_positions.GetPortalControl();
PortalType_ID portal_stepstaken = particle_stepstaken.GetPortalControl();
PortalType_ID portal_validity = BasisParticlesValidity.GetPortalControl();
auto portal_stepstaken = particle_stepstaken.GetPortalControl();
auto portal_validity = BasisParticlesValidity.GetPortalControl();
vtkm::cont::DataSet outputData;
vtkm::cont::DataSetBuilderExplicit dataSetBuilder;
......
......@@ -272,7 +272,7 @@ public:
template <typename Device>
class ExecObject : public Integrator::ExecObjectBaseImpl<
decltype(std::declval<FieldEvaluateType>().PrepareForExecution(Device())),
RK4Integrator::ExecObject<Device>>
typename RK4Integrator::template ExecObject<Device>>
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment