2018-06-05 03:04:38 +00:00
|
|
|
#ifndef vtk_m_cont_CellLocator_h
|
|
|
|
#define vtk_m_cont_CellLocator_h
|
|
|
|
|
|
|
|
#include <vtkm/Types.h>
|
2018-06-21 03:08:33 +00:00
|
|
|
#include <vtkm/VirtualObjectBase.h>
|
2018-06-05 03:04:38 +00:00
|
|
|
#include <vtkm/cont/CoordinateSystem.h>
|
|
|
|
#include <vtkm/cont/DeviceAdapter.h>
|
|
|
|
#include <vtkm/cont/DynamicCellSet.h>
|
|
|
|
#include <vtkm/cont/ExecutionObjectBase.h>
|
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace exec
|
|
|
|
{
|
|
|
|
// This will actually be used in the Execution Environment.
|
|
|
|
// As this object is returned by the PrepareForExecution on
|
|
|
|
// the CellLocator we need it to be covarient, and this acts
|
|
|
|
// like a base class.
|
|
|
|
|
2018-06-21 03:08:33 +00:00
|
|
|
class CellLocator : public vtkm::VirtualObjectBase
|
2018-06-05 03:04:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-06-13 22:08:15 +00:00
|
|
|
VTKM_EXEC
|
|
|
|
virtual void FindCell(const vtkm::Vec<vtkm::FloatDefault, 3>& point,
|
|
|
|
vtkm::Id& cellId,
|
|
|
|
vtkm::Vec<vtkm::FloatDefault, 3>& parametric,
|
|
|
|
const vtkm::exec::FunctorBase& worklet) const = 0;
|
2018-06-05 03:04:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace exec
|
|
|
|
|
|
|
|
namespace cont
|
|
|
|
{
|
|
|
|
|
2018-06-21 03:08:33 +00:00
|
|
|
class CellLocator : public vtkm::cont::ExecutionObjectBase
|
2018-06-05 03:04:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
CellLocator()
|
|
|
|
: Dirty(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
vtkm::cont::DynamicCellSet GetCellSet() const { return CellSet; }
|
|
|
|
|
|
|
|
void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet)
|
|
|
|
{
|
|
|
|
CellSet = cellSet;
|
|
|
|
Dirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
vtkm::cont::CoordinateSystem GetCoords() const { return Coords; }
|
|
|
|
|
|
|
|
void SetCoords(const vtkm::cont::CoordinateSystem& coords)
|
|
|
|
{
|
|
|
|
Coords = coords;
|
|
|
|
Dirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//This is going to need a TryExecute
|
|
|
|
virtual void Build() = 0;
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
if (Dirty)
|
|
|
|
Build();
|
|
|
|
Dirty = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename DeviceAdapter>
|
2018-06-21 03:08:33 +00:00
|
|
|
VTKM_CONT const vtkm::exec::CellLocator* PrepareForExecution(DeviceAdapter) const
|
2018-06-05 03:04:38 +00:00
|
|
|
{
|
|
|
|
vtkm::cont::DeviceAdapterId deviceId = vtkm::cont::DeviceAdapterTraits<DeviceAdapter>::GetId();
|
2018-06-21 03:08:33 +00:00
|
|
|
return PrepareForExecutionImpl(deviceId);
|
2018-06-05 03:04:38 +00:00
|
|
|
}
|
|
|
|
|
2018-06-13 22:08:15 +00:00
|
|
|
protected:
|
2018-06-21 03:08:33 +00:00
|
|
|
VTKM_CONT virtual const vtkm::exec::CellLocator* PrepareForExecutionImpl(
|
|
|
|
const vtkm::Int8 device) const = 0;
|
2018-06-05 03:04:38 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
vtkm::cont::DynamicCellSet CellSet;
|
|
|
|
vtkm::cont::CoordinateSystem Coords;
|
|
|
|
bool Dirty;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace cont
|
|
|
|
} // namespace vtkm
|
|
|
|
|
|
|
|
#endif // vtk_m_cont_CellLocator_h
|