Mark classes that should not be derived from as final.

This commit is contained in:
Robert Maynard 2018-06-15 10:49:59 -04:00
parent 2714cbe50a
commit 8276e35cf4
7 changed files with 30 additions and 33 deletions

@ -146,7 +146,7 @@ public:
VTKM_EXEC_CONT const Vector& GetMaxPoint() const { return this->MaxPoint; }
VTKM_EXEC_CONT Scalar Value(const Vector& point) const override
VTKM_EXEC_CONT Scalar Value(const Vector& point) const final
{
Scalar minDistance = vtkm::NegativeInfinity32();
Scalar diff, t, dist;
@ -214,7 +214,7 @@ public:
}
}
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const override
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const final
{
vtkm::IdComponent minAxis = 0;
Scalar dist = 0.0;
@ -343,7 +343,7 @@ private:
//============================================================================
/// \brief Implicit function for a cylinder
class VTKM_ALWAYS_EXPORT Cylinder : public vtkm::ImplicitFunction
class VTKM_ALWAYS_EXPORT Cylinder final : public vtkm::ImplicitFunction
{
public:
VTKM_EXEC_CONT Cylinder()
@ -385,14 +385,14 @@ public:
this->Modified();
}
VTKM_EXEC_CONT Scalar Value(const Vector& point) const override
VTKM_EXEC_CONT Scalar Value(const Vector& point) const final
{
Vector x2c = point - this->Center;
FloatDefault proj = vtkm::Dot(this->Axis, x2c);
return vtkm::Dot(x2c, x2c) - (proj * proj) - (this->Radius * this->Radius);
}
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const override
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const final
{
Vector x2c = point - this->Center;
FloatDefault t = this->Axis[0] * x2c[0] + this->Axis[1] * x2c[1] + this->Axis[2] * x2c[2];
@ -409,7 +409,7 @@ private:
//============================================================================
/// \brief Implicit function for a frustum
class VTKM_ALWAYS_EXPORT Frustum : public vtkm::ImplicitFunction
class VTKM_ALWAYS_EXPORT Frustum final : public vtkm::ImplicitFunction
{
public:
Frustum() = default;
@ -480,7 +480,7 @@ public:
this->Modified();
}
VTKM_EXEC_CONT Scalar Value(const Vector& point) const override
VTKM_EXEC_CONT Scalar Value(const Vector& point) const final
{
Scalar maxVal = vtkm::NegativeInfinity<Scalar>();
for (vtkm::Id index : { 0, 1, 2, 3, 4, 5 })
@ -493,7 +493,7 @@ public:
return maxVal;
}
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const override
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const final
{
Scalar maxVal = vtkm::NegativeInfinity<Scalar>();
vtkm::Id maxValIdx = 0;
@ -518,7 +518,7 @@ private:
//============================================================================
/// \brief Implicit function for a plane
class VTKM_ALWAYS_EXPORT Plane : public vtkm::ImplicitFunction
class VTKM_ALWAYS_EXPORT Plane final : public vtkm::ImplicitFunction
{
public:
VTKM_EXEC_CONT Plane()
@ -554,12 +554,12 @@ public:
VTKM_EXEC_CONT const Vector& GetOrigin() const { return this->Origin; }
VTKM_EXEC_CONT const Vector& GetNormal() const { return this->Normal; }
VTKM_EXEC_CONT Scalar Value(const Vector& point) const override
VTKM_EXEC_CONT Scalar Value(const Vector& point) const final
{
return vtkm::Dot(point - this->Origin, this->Normal);
}
VTKM_EXEC_CONT Vector Gradient(const Vector&) const override { return this->Normal; }
VTKM_EXEC_CONT Vector Gradient(const Vector&) const final { return this->Normal; }
private:
Vector Origin;
@ -568,7 +568,7 @@ private:
//============================================================================
/// \brief Implicit function for a sphere
class VTKM_ALWAYS_EXPORT Sphere : public vtkm::ImplicitFunction
class VTKM_ALWAYS_EXPORT Sphere final : public vtkm::ImplicitFunction
{
public:
VTKM_EXEC_CONT Sphere()
@ -605,12 +605,12 @@ public:
VTKM_EXEC_CONT const Vector& GetCenter() const { return this->Center; }
VTKM_EXEC_CONT Scalar Value(const Vector& point) const override
VTKM_EXEC_CONT Scalar Value(const Vector& point) const final
{
return vtkm::MagnitudeSquared(point - this->Center) - (this->Radius * this->Radius);
}
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const override
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const final
{
return Scalar(2) * (point - this->Center);
}

@ -34,7 +34,7 @@ namespace cont
{
template <vtkm::IdComponent DIMENSION>
class VTKM_ALWAYS_EXPORT CellSetStructured : public CellSet
class VTKM_ALWAYS_EXPORT CellSetStructured final : public CellSet
{
private:
using Thisclass = vtkm::cont::CellSetStructured<DIMENSION>;
@ -55,19 +55,16 @@ public:
Thisclass& operator=(const Thisclass& src);
virtual vtkm::Id GetNumberOfCells() const override { return this->Structure.GetNumberOfCells(); }
vtkm::Id GetNumberOfCells() const override { return this->Structure.GetNumberOfCells(); }
virtual vtkm::Id GetNumberOfPoints() const override
{
return this->Structure.GetNumberOfPoints();
}
vtkm::Id GetNumberOfPoints() const override { return this->Structure.GetNumberOfPoints(); }
virtual vtkm::Id GetNumberOfFaces() const override { return -1; }
vtkm::Id GetNumberOfFaces() const override { return -1; }
virtual vtkm::Id GetNumberOfEdges() const override { return -1; }
vtkm::Id GetNumberOfEdges() const override { return -1; }
// Since the entire topology is defined by by three integers, nothing to do here.
virtual void ReleaseResourcesExecution() override {}
void ReleaseResourcesExecution() override {}
void SetPointDimensions(SchedulingRangeType dimensions)
{
@ -101,7 +98,7 @@ public:
typename ExecutionTypes<DeviceAdapter, FromTopology, ToTopology>::ExecObjectType
PrepareForInput(DeviceAdapter, FromTopology, ToTopology) const;
virtual void PrintSummary(std::ostream& out) const;
void PrintSummary(std::ostream& out) const override;
private:
InternalsType Structure;

@ -29,7 +29,7 @@ namespace cont
namespace internal
{
template <>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagCuda>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagCuda> final
: public ExecutionArrayInterfaceBasicBase
{
using Superclass = ExecutionArrayInterfaceBasicBase;

@ -86,7 +86,7 @@ struct ExecutionPortalFactoryBasic<T, DeviceAdapterTagOpenMP>
};
template <>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagOpenMP>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagOpenMP> final
: public ExecutionArrayInterfaceBasicShareWithControl
{
using Superclass = ExecutionArrayInterfaceBasicShareWithControl;

@ -31,7 +31,7 @@ namespace internal
{
template <>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagSerial>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagSerial> final
: public ExecutionArrayInterfaceBasicShareWithControl
{
using Superclass = ExecutionArrayInterfaceBasicShareWithControl;

@ -34,7 +34,7 @@ namespace internal
{
template <>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagTBB>
struct VTKM_CONT_EXPORT ExecutionArrayInterfaceBasic<DeviceAdapterTagTBB> final
: public ExecutionArrayInterfaceBasicShareWithControl
{
using Superclass = ExecutionArrayInterfaceBasicShareWithControl;

@ -63,7 +63,7 @@ private:
float& weight) const;
};
class VTKM_ALWAYS_EXPORT ColorTableRGB : public ColorTableBase
class VTKM_ALWAYS_EXPORT ColorTableRGB final : public ColorTableBase
{
public:
inline VTKM_EXEC vtkm::Vec<float, 3> MapThroughColorSpace(const vtkm::Vec<float, 3>& rgb1,
@ -71,7 +71,7 @@ public:
float weight) const final;
};
class VTKM_ALWAYS_EXPORT ColorTableHSV : public ColorTableBase
class VTKM_ALWAYS_EXPORT ColorTableHSV final : public ColorTableBase
{
public:
inline VTKM_EXEC vtkm::Vec<float, 3> MapThroughColorSpace(const vtkm::Vec<float, 3>& rgb1,
@ -79,7 +79,7 @@ public:
float weight) const final;
};
class VTKM_ALWAYS_EXPORT ColorTableHSVWrap : public ColorTableBase
class VTKM_ALWAYS_EXPORT ColorTableHSVWrap final : public ColorTableBase
{
public:
inline VTKM_EXEC vtkm::Vec<float, 3> MapThroughColorSpace(const vtkm::Vec<float, 3>& rgb1,
@ -87,7 +87,7 @@ public:
float weight) const final;
};
class VTKM_ALWAYS_EXPORT ColorTableLab : public ColorTableBase
class VTKM_ALWAYS_EXPORT ColorTableLab final : public ColorTableBase
{
public:
inline VTKM_EXEC vtkm::Vec<float, 3> MapThroughColorSpace(const vtkm::Vec<float, 3>& rgb1,
@ -95,7 +95,7 @@ public:
float weight) const final;
};
class VTKM_ALWAYS_EXPORT ColorTableDiverging : public ColorTableBase
class VTKM_ALWAYS_EXPORT ColorTableDiverging final : public ColorTableBase
{
public:
inline VTKM_EXEC vtkm::Vec<float, 3> MapThroughColorSpace(const vtkm::Vec<float, 3>& rgb1,