72 lines
2.5 KiB
C++
72 lines
2.5 KiB
C++
//============================================================================
|
|
// 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.
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_filter_StreamSurface_h
|
|
#define vtk_m_filter_StreamSurface_h
|
|
|
|
#include <vtkm/filter/FilterDataSetWithField.h>
|
|
#include <vtkm/worklet/ParticleAdvection.h>
|
|
#include <vtkm/worklet/StreamSurface.h>
|
|
#include <vtkm/worklet/particleadvection/GridEvaluators.h>
|
|
#include <vtkm/worklet/particleadvection/Integrators.h>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace filter
|
|
{
|
|
/// \brief generate streamlines from a vector field.
|
|
|
|
/// Takes as input a vector field and seed locations and generates the
|
|
/// paths taken by the seeds through the vector field.
|
|
class StreamSurface : public vtkm::filter::FilterDataSetWithField<StreamSurface>
|
|
{
|
|
public:
|
|
using SupportedTypes = vtkm::TypeListTagFieldVec3;
|
|
|
|
VTKM_CONT
|
|
StreamSurface();
|
|
|
|
VTKM_CONT
|
|
void SetStepSize(vtkm::worklet::particleadvection::ScalarType s) { this->StepSize = s; }
|
|
|
|
VTKM_CONT
|
|
void SetNumberOfSteps(vtkm::Id n) { this->NumberOfSteps = n; }
|
|
|
|
VTKM_CONT
|
|
void SetSeeds(vtkm::cont::ArrayHandle<vtkm::Vec3f>& seeds) { this->Seeds = seeds; }
|
|
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
|
VTKM_CONT vtkm::cont::DataSet DoExecute(
|
|
const vtkm::cont::DataSet& input,
|
|
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& field,
|
|
const vtkm::filter::FieldMetadata& fieldMeta,
|
|
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
|
|
|
//Map a new field onto the resulting dataset after running the filter
|
|
//this call is only valid
|
|
template <typename T, typename StorageType, typename DerivedPolicy>
|
|
VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
|
|
const vtkm::cont::ArrayHandle<T, StorageType>& input,
|
|
const vtkm::filter::FieldMetadata& fieldMeta,
|
|
vtkm::filter::PolicyBase<DerivedPolicy> policy);
|
|
|
|
private:
|
|
vtkm::Id NumberOfSteps;
|
|
vtkm::cont::ArrayHandle<vtkm::Vec3f> Seeds;
|
|
vtkm::worklet::particleadvection::ScalarType StepSize;
|
|
vtkm::worklet::StreamSurface Worklet;
|
|
};
|
|
}
|
|
} // namespace vtkm::filter
|
|
|
|
#include <vtkm/filter/StreamSurface.hxx>
|
|
|
|
#endif // vtk_m_filter_StreamSurface_h
|