vtk-m/vtkm/cont/internal/PointLocatorBase.h
Kenneth Moreland 3e1339f9a7 Remove deprecated features from VTK-m
With the major revision 2.0 of VTK-m, many items previously marked as
deprecated were removed. If updating to a new version of VTK-m, it is
recommended to first update to VTK-m 1.9, which will include the deprecated
features but provide warnings (with the right compiler) that will point to
the replacement code. Once the deprecations have been fixed, updating to
2.0 should be smoother.
2022-11-17 07:12:31 -06:00

66 lines
1.8 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_cont_internal_PointLocatorBase_h
#define vtk_m_cont_internal_PointLocatorBase_h
#include <vtkm/cont/vtkm_cont_export.h>
#include <vtkm/Types.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/ExecutionObjectBase.h>
namespace vtkm
{
namespace cont
{
namespace internal
{
/// \brief Base class for all `PointLocator` classes.
///
/// `PointLocatorBase` uses the curiously recurring template pattern (CRTP). Subclasses
/// must provide their own type for the template parameter. Subclasses must implement
/// `Build` and `PrepareForExecution` methods.
///
template <typename Derived>
class VTKM_ALWAYS_EXPORT PointLocatorBase : public vtkm::cont::ExecutionObjectBase
{
public:
vtkm::cont::CoordinateSystem GetCoordinates() const { return this->Coords; }
void SetCoordinates(const vtkm::cont::CoordinateSystem& coords)
{
this->Coords = coords;
this->SetModified();
}
void Update()
{
if (this->Modified)
{
static_cast<Derived*>(const_cast<PointLocatorBase*>(this))->Build();
this->Modified = false;
}
}
protected:
void SetModified() { this->Modified = true; }
bool GetModified() const { return this->Modified; }
private:
vtkm::cont::CoordinateSystem Coords;
mutable bool Modified = true;
};
} // vtkm::cont::internal
} // vtkm::cont
} // vtkm
#endif // vtk_m_cont_internal_PointLocatorBase_h