//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. // // Copyright 2014 Sandia Corporation. // Copyright 2014 UT-Battelle, LLC. // Copyright 2014 Los Alamos National Security. // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ #ifndef vtk_m_worklet_ParticleAdvection_h #define vtk_m_worklet_ParticleAdvection_h #include #include #include namespace vtkm { namespace worklet { template struct ParticleAdvectionResult { ParticleAdvectionResult() : positions() , status() , stepsTaken() { } ParticleAdvectionResult(const vtkm::cont::ArrayHandle>& pos, const vtkm::cont::ArrayHandle& stat, const vtkm::cont::ArrayHandle& steps) : positions(pos) , status(stat) , stepsTaken(steps) { } vtkm::cont::ArrayHandle> positions; vtkm::cont::ArrayHandle status; vtkm::cont::ArrayHandle stepsTaken; }; class ParticleAdvection { public: ParticleAdvection() {} template ParticleAdvectionResult Run( const IntegratorType& it, const vtkm::cont::ArrayHandle, PointStorage>& pts, const vtkm::Id& nSteps, const DeviceAdapter&) { vtkm::worklet::particleadvection::ParticleAdvectionWorklet worklet; vtkm::cont::ArrayHandle stepsTaken, status; vtkm::Id numSeeds = static_cast(pts.GetNumberOfValues()); //Allocate status and steps arrays. vtkm::cont::ArrayHandleConstant init(0, numSeeds); stepsTaken.Allocate(numSeeds); vtkm::cont::DeviceAdapterAlgorithm::Copy(init, stepsTaken); worklet.Run(it, pts, nSteps, status, stepsTaken); //Create output. ParticleAdvectionResult res(pts, status, stepsTaken); return res; } template ParticleAdvectionResult Run( const IntegratorType& it, const vtkm::cont::ArrayHandle, PointStorage>& pts, vtkm::cont::ArrayHandle& stepsTaken, const vtkm::Id& nSteps, const DeviceAdapter&) { vtkm::worklet::particleadvection::ParticleAdvectionWorklet worklet; vtkm::cont::ArrayHandle status; worklet.Run(it, pts, nSteps, status, stepsTaken); //Create output. ParticleAdvectionResult res(pts, status, stepsTaken); return res; } }; class Streamline { public: Streamline() {} template void Run(const IntegratorType& it, const vtkm::cont::ArrayHandle, PointStorage>& pts, vtkm::cont::ArrayHandle, FieldStorage> fieldArray, const vtkm::Id& nSteps, const vtkm::Id& stepsPerRound, const vtkm::Id& particlesPerRound, const DeviceAdapter&) { vtkm::worklet::particleadvection::StreamlineWorklet worklet; worklet.Run(it, pts, fieldArray, nSteps, stepsPerRound, particlesPerRound); } }; } } #endif // vtk_m_worklet_ParticleAdvection_h