2018-06-24 01:33:50 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2018-06-24 01:33:50 +00:00
|
|
|
// 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.
|
|
|
|
//============================================================================
|
2018-06-05 03:04:38 +00:00
|
|
|
#ifndef vtk_m_cont_CellLocator_h
|
|
|
|
#define vtk_m_cont_CellLocator_h
|
|
|
|
|
2019-01-31 20:41:56 +00:00
|
|
|
#include <vtkm/cont/vtkm_cont_export.h>
|
|
|
|
|
2018-06-05 03:04:38 +00:00
|
|
|
#include <vtkm/Types.h>
|
|
|
|
#include <vtkm/cont/CoordinateSystem.h>
|
|
|
|
#include <vtkm/cont/DynamicCellSet.h>
|
|
|
|
#include <vtkm/cont/ExecutionObjectBase.h>
|
2019-03-29 18:45:10 +00:00
|
|
|
|
2018-06-25 00:16:46 +00:00
|
|
|
#include <vtkm/exec/CellLocator.h>
|
2018-06-05 03:04:38 +00:00
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace cont
|
|
|
|
{
|
|
|
|
|
2019-03-20 21:28:08 +00:00
|
|
|
class VTKM_CONT_EXPORT CellLocator : public vtkm::cont::ExecutionObjectBase
|
2018-06-05 03:04:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2019-03-20 23:38:50 +00:00
|
|
|
virtual ~CellLocator();
|
|
|
|
|
2019-04-01 20:25:51 +00:00
|
|
|
const vtkm::cont::DynamicCellSet& GetCellSet() const { return this->CellSet; }
|
2018-06-05 03:04:38 +00:00
|
|
|
|
|
|
|
void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet)
|
|
|
|
{
|
2019-03-29 18:45:10 +00:00
|
|
|
this->CellSet = cellSet;
|
2019-03-28 12:27:37 +00:00
|
|
|
this->SetModified();
|
2018-06-05 03:04:38 +00:00
|
|
|
}
|
|
|
|
|
2019-04-01 20:25:51 +00:00
|
|
|
const vtkm::cont::CoordinateSystem& GetCoordinates() const { return this->Coords; }
|
2018-06-05 03:04:38 +00:00
|
|
|
|
2018-06-25 00:16:46 +00:00
|
|
|
void SetCoordinates(const vtkm::cont::CoordinateSystem& coords)
|
2018-06-05 03:04:38 +00:00
|
|
|
{
|
2019-03-29 18:45:10 +00:00
|
|
|
this->Coords = coords;
|
2019-03-28 12:27:37 +00:00
|
|
|
this->SetModified();
|
2018-06-05 03:04:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
{
|
2019-03-28 12:27:37 +00:00
|
|
|
if (this->Modified)
|
|
|
|
{
|
2019-03-29 18:45:10 +00:00
|
|
|
this->Build();
|
2019-03-28 12:27:37 +00:00
|
|
|
this->Modified = false;
|
|
|
|
}
|
2018-06-05 03:04:38 +00:00
|
|
|
}
|
|
|
|
|
2019-03-28 12:27:37 +00:00
|
|
|
VTKM_CONT virtual const vtkm::exec::CellLocator* PrepareForExecution(
|
2020-01-21 20:18:03 +00:00
|
|
|
vtkm::cont::DeviceAdapterId device,
|
|
|
|
vtkm::cont::Token& token) const = 0;
|
|
|
|
|
|
|
|
VTKM_CONT
|
|
|
|
VTKM_DEPRECATED(1.6, "PrepareForExecution now requires a vtkm::cont::Token object.")
|
|
|
|
const vtkm::exec::CellLocator* PrepareForExecution(vtkm::cont::DeviceAdapterId device) const
|
|
|
|
{
|
|
|
|
vtkm::cont::Token token;
|
|
|
|
return this->PrepareForExecution(device, token);
|
|
|
|
}
|
2018-08-29 21:19:31 +00:00
|
|
|
|
2018-06-13 22:08:15 +00:00
|
|
|
protected:
|
2019-03-28 12:27:37 +00:00
|
|
|
void SetModified() { this->Modified = true; }
|
|
|
|
bool GetModified() const { return this->Modified; }
|
2018-06-25 00:16:46 +00:00
|
|
|
|
|
|
|
//This is going to need a TryExecute
|
|
|
|
VTKM_CONT virtual void Build() = 0;
|
|
|
|
|
2018-06-05 03:04:38 +00:00
|
|
|
private:
|
|
|
|
vtkm::cont::DynamicCellSet CellSet;
|
|
|
|
vtkm::cont::CoordinateSystem Coords;
|
2019-03-28 12:27:37 +00:00
|
|
|
bool Modified = true;
|
2018-06-05 03:04:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace cont
|
|
|
|
} // namespace vtkm
|
|
|
|
|
|
|
|
#endif // vtk_m_cont_CellLocator_h
|