From b4ba8368902861b033a81b1d4e868b28f08551fd Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Thu, 8 Feb 2024 08:38:40 -0500 Subject: [PATCH] Reduce doxygen warnings --- docs/CodingConventions.md | 8 +- vtkm/ImplicitFunction.h | 142 +++++++++++--- vtkm/Math.h | 179 +++++++----------- vtkm/Math.h.in | 153 +++++++-------- vtkm/Tuple.h | 2 +- vtkm/Tuple.h.in | 12 +- vtkm/VecFlat.h | 2 +- vtkm/VecTraits.h | 14 +- vtkm/cont/ArrayHandleBasic.h | 8 +- vtkm/cont/ArrayHandleExtractComponent.h | 5 + vtkm/cont/ArrayHandleSOA.h | 8 + vtkm/cont/ArrayRangeCompute.h | 59 +++--- vtkm/cont/ColorTableMap.h | 6 +- .../ComputeDistributedContourTreeFunctor.h | 2 +- vtkm/rendering/View.h | 2 +- vtkm/worklet/colorconversion/Conversions.h | 21 +- 16 files changed, 343 insertions(+), 280 deletions(-) diff --git a/docs/CodingConventions.md b/docs/CodingConventions.md index b57645ab0..ff9e9454c 100644 --- a/docs/CodingConventions.md +++ b/docs/CodingConventions.md @@ -102,7 +102,7 @@ class ExposedClass; if (test) { clause; -} +} ``` + Conditional clauses including loop conditionals such as for and while @@ -112,7 +112,7 @@ if (test) for (auto v : vector) { single line clause; -} +} ``` + Two space indentation. Tabs are not allowed. Trailing whitespace @@ -199,8 +199,8 @@ for (auto v : vector) `vtkm::IdComponent` for indices and sizes. Consider using `vtkm::FloatDefault` makes sense. Otherwise, use one of VTK-m's types do be explicit about the data type. These are `vtkm::Int8`, - vtkm::UInt8`, `vtkm::Int16`, vtkm::UInt16`, `vtkm::Int32`, - vtkm::UInt32`, `vtkm::Float32`, `vtkm::Int64`, vtkm::UInt64`, and + `vtkm::UInt8`, `vtkm::Int16`, `vtkm::UInt16`, `vtkm::Int32`, + `vtkm::UInt32`, `vtkm::Float32`, `vtkm::Int64`, `vtkm::UInt64`, and `vtkm::Float64`. + All functions and methods defined within the VTK-m toolkit should be diff --git a/vtkm/ImplicitFunction.h b/vtkm/ImplicitFunction.h index c1e6087d0..436e7e30b 100644 --- a/vtkm/ImplicitFunction.h +++ b/vtkm/ImplicitFunction.h @@ -42,27 +42,11 @@ public: using Scalar = vtkm::FloatDefault; using Vector = vtkm::Vec; - /// @brief Evaluate the value of the implicit function. - /// - /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and - /// returns a `vtkm::FloatDefault` representing the orientation of the point - /// with respect to the implicit function's shape. Negative scalar values - /// represent vector points inside of the implicit function's shape. Positive - /// scalar values represent vector points outside the implicit function's shape. - /// Zero values represent vector points that lie on the surface of the implicit - /// function. VTKM_EXEC_CONT Scalar Value(Scalar x, Scalar y, Scalar z) const { return reinterpret_cast(this)->Value(Vector(x, y, z)); } - /// @brief Evaluate the gradient of the implicit function. - /// - /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` - /// and returns a `vtkm::Vec3f` representing the pointing direction from the - /// implicit function's shape. Gradient calculations are more object shape - /// specific. It is advised to look at the individual shape implementations - /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(Scalar x, Scalar y, Scalar z) const { return reinterpret_cast(this)->Gradient(Vector(x, y, z)); @@ -207,7 +191,15 @@ public: vtkm::Range(this->MinPoint[2], this->MaxPoint[2])); } - /// @copydoc internal::ImplicitFunctionBase::Value + /// @brief Evaluate the value of the implicit function. + /// + /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and + /// returns a `vtkm::FloatDefault` representing the orientation of the point + /// with respect to the implicit function's shape. Negative scalar values + /// represent vector points inside of the implicit function's shape. Positive + /// scalar values represent vector points outside the implicit function's shape. + /// Zero values represent vector points that lie on the surface of the implicit + /// function. VTKM_EXEC_CONT Scalar Value(const Vector& point) const { Scalar minDistance = vtkm::NegativeInfinity32(); @@ -276,7 +268,13 @@ public: } } - /// @copydoc internal::ImplicitFunctionBase::Gradient + /// @brief Evaluate the gradient of the implicit function. + /// + /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` + /// and returns a `vtkm::Vec3f` representing the pointing direction from the + /// implicit function's shape. Gradient calculations are more object shape + /// specific. It is advised to look at the individual shape implementations + /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(const Vector& point) const { vtkm::IdComponent minAxis = 0; @@ -455,7 +453,15 @@ public: /// @brief Specify the radius of the cylinder. VTKM_CONT void SetRadius(Scalar radius) { this->Radius = radius; } - /// @copydoc internal::ImplicitFunctionBase::Value + /// @brief Evaluate the value of the implicit function. + /// + /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and + /// returns a `vtkm::FloatDefault` representing the orientation of the point + /// with respect to the implicit function's shape. Negative scalar values + /// represent vector points inside of the implicit function's shape. Positive + /// scalar values represent vector points outside the implicit function's shape. + /// Zero values represent vector points that lie on the surface of the implicit + /// function. VTKM_EXEC_CONT Scalar Value(const Vector& point) const { Vector x2c = point - this->Center; @@ -463,7 +469,13 @@ public: return vtkm::Dot(x2c, x2c) - (proj * proj) - (this->Radius * this->Radius); } - /// @copydoc internal::ImplicitFunctionBase::Gradient + /// @brief Evaluate the gradient of the implicit function. + /// + /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` + /// and returns a `vtkm::Vec3f` representing the pointing direction from the + /// implicit function's shape. Gradient calculations are more object shape + /// specific. It is advised to look at the individual shape implementations + /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(const Vector& point) const { Vector x2c = point - this->Center; @@ -558,7 +570,15 @@ public: } } - /// @copydoc internal::ImplicitFunctionBase::Value + /// @brief Evaluate the value of the implicit function. + /// + /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and + /// returns a `vtkm::FloatDefault` representing the orientation of the point + /// with respect to the implicit function's shape. Negative scalar values + /// represent vector points inside of the implicit function's shape. Positive + /// scalar values represent vector points outside the implicit function's shape. + /// Zero values represent vector points that lie on the surface of the implicit + /// function. VTKM_EXEC_CONT Scalar Value(const Vector& point) const { Scalar maxVal = vtkm::NegativeInfinity(); @@ -572,7 +592,13 @@ public: return maxVal; } - /// @copydoc internal::ImplicitFunctionBase::Gradient + /// @brief Evaluate the gradient of the implicit function. + /// + /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` + /// and returns a `vtkm::Vec3f` representing the pointing direction from the + /// implicit function's shape. Gradient calculations are more object shape + /// specific. It is advised to look at the individual shape implementations + /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(const Vector& point) const { Scalar maxVal = vtkm::NegativeInfinity(); @@ -640,13 +666,27 @@ public: /// @copydoc SetNormal VTKM_EXEC_CONT const Vector& GetNormal() const { return this->Normal; } - /// @copydoc internal::ImplicitFunctionBase::Value + /// @brief Evaluate the value of the implicit function. + /// + /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and + /// returns a `vtkm::FloatDefault` representing the orientation of the point + /// with respect to the implicit function's shape. Negative scalar values + /// represent vector points inside of the implicit function's shape. Positive + /// scalar values represent vector points outside the implicit function's shape. + /// Zero values represent vector points that lie on the surface of the implicit + /// function. VTKM_EXEC_CONT Scalar Value(const Vector& point) const { return vtkm::Dot(point - this->Origin, this->Normal); } - /// @copydoc internal::ImplicitFunctionBase::Gradient + /// @brief Evaluate the gradient of the implicit function. + /// + /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` + /// and returns a `vtkm::Vec3f` representing the pointing direction from the + /// implicit function's shape. Gradient calculations are more object shape + /// specific. It is advised to look at the individual shape implementations + /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(const Vector&) const { return this->Normal; } private: @@ -691,13 +731,27 @@ public: /// @copydoc SetCenter VTKM_EXEC_CONT const Vector& GetCenter() const { return this->Center; } - /// @copydoc internal::ImplicitFunctionBase::Value + /// @brief Evaluate the value of the implicit function. + /// + /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and + /// returns a `vtkm::FloatDefault` representing the orientation of the point + /// with respect to the implicit function's shape. Negative scalar values + /// represent vector points inside of the implicit function's shape. Positive + /// scalar values represent vector points outside the implicit function's shape. + /// Zero values represent vector points that lie on the surface of the implicit + /// function. VTKM_EXEC_CONT Scalar Value(const Vector& point) const { return vtkm::MagnitudeSquared(point - this->Center) - (this->Radius * this->Radius); } - /// @copydoc internal::ImplicitFunctionBase::Gradient + /// @brief Evaluate the gradient of the implicit function. + /// + /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` + /// and returns a `vtkm::Vec3f` representing the pointing direction from the + /// implicit function's shape. Gradient calculations are more object shape + /// specific. It is advised to look at the individual shape implementations + /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(const Vector& point) const { return Scalar(2) * (point - this->Center); @@ -744,7 +798,15 @@ public: } VTKM_CONT vtkm::VecVariable GetPlanes() const { return this->Planes; } - /// @copydoc internal::ImplicitFunctionBase::Value + /// @brief Evaluate the value of the implicit function. + /// + /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and + /// returns a `vtkm::FloatDefault` representing the orientation of the point + /// with respect to the implicit function's shape. Negative scalar values + /// represent vector points inside of the implicit function's shape. Positive + /// scalar values represent vector points outside the implicit function's shape. + /// Zero values represent vector points that lie on the surface of the implicit + /// function. VTKM_EXEC_CONT Scalar Value(const Vector& point) const { Scalar maxVal = vtkm::NegativeInfinity(); @@ -759,7 +821,13 @@ public: return maxVal; } - /// @copydoc internal::ImplicitFunctionBase::Gradient + /// @brief Evaluate the gradient of the implicit function. + /// + /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` + /// and returns a `vtkm::Vec3f` representing the pointing direction from the + /// implicit function's shape. Gradient calculations are more object shape + /// specific. It is advised to look at the individual shape implementations + /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(const Vector& point) const { Scalar maxVal = vtkm::NegativeInfinity(); @@ -850,13 +918,27 @@ public: { } - /// @copydoc internal::ImplicitFunctionBase::Value + /// @brief Evaluate the value of the implicit function. + /// + /// The `Value()` method for an implicit function takes a `vtkm::Vec3f` and + /// returns a `vtkm::FloatDefault` representing the orientation of the point + /// with respect to the implicit function's shape. Negative scalar values + /// represent vector points inside of the implicit function's shape. Positive + /// scalar values represent vector points outside the implicit function's shape. + /// Zero values represent vector points that lie on the surface of the implicit + /// function. VTKM_EXEC_CONT Scalar Value(const Vector& point) const { return this->Variant.CastAndCall(detail::ImplicitFunctionValueFunctor{}, point); } - /// @copydoc internal::ImplicitFunctionBase::Gradient + /// @brief Evaluate the gradient of the implicit function. + /// + /// The ``Gradient()`` method for an implicit function takes a `vtkm::Vec3f` + /// and returns a `vtkm::Vec3f` representing the pointing direction from the + /// implicit function's shape. Gradient calculations are more object shape + /// specific. It is advised to look at the individual shape implementations + /// for specific implicit functions. VTKM_EXEC_CONT Vector Gradient(const Vector& point) const { return this->Variant.CastAndCall(detail::ImplicitFunctionGradientFunctor{}, point); diff --git a/vtkm/Math.h b/vtkm/Math.h index 79cfd3709..7093d7f7c 100644 --- a/vtkm/Math.h +++ b/vtkm/Math.h @@ -42,7 +42,6 @@ #define VTKM_CUDA_MATH_FUNCTION_32(func) func##f #define VTKM_CUDA_MATH_FUNCTION_64(func) func -// clang-format off namespace vtkm { @@ -53,156 +52,112 @@ template struct FloatingPointReturnType { using ctype = typename vtkm::VecTraits::ComponentType; - using representable_as_float_type = std::integral_constant::value)>; - using Type = typename std::conditional::type; + using representable_as_float_type = + std::integral_constant::value)>; + using Type = typename std:: + conditional::type; }; } // namespace detail +/// Returns the constant 2 times Pi. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type TwoPi() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(6.28318530717958647692528676655900576); +} + +/// Returns the constant Pi. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(3.14159265358979323846264338327950288); +} + +/// Returns the constant Pi halves. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_2() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(1.57079632679489661923132169163975144); +} + +/// Returns the constant Pi thirds. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_3() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(1.04719755119659774615421446109316762); +} + +/// Returns the constant Pi fourths. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_4() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(0.78539816339744830961566084581987572); +} + +/// Returns the constant Pi one hundred and eightieth. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_180() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(0.01745329251994329547437168059786927); +} + /// Returns the constant 2 times Pi in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 TwoPif() { - return 6.28318530717958647692528676655900576f; + return TwoPi(); } /// Returns the constant Pi in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pif() { - return 3.14159265358979323846264338327950288f; + return Pi(); } /// Returns the constant Pi halves in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_2f() { - return 1.57079632679489661923132169163975144f; + return Pi_2(); } /// Returns the constant Pi thirds in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_3f() { - return 1.04719755119659774615421446109316762f; + return Pi_3(); } /// Returns the constant Pi fourths in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_4f() { - return 0.78539816339744830961566084581987572f; + return Pi_4(); } /// Returns the constant Pi one hundred and eightieth in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_180f() { - return 0.01745329251994329547437168059786927f; + return Pi_180(); } -/// Returns the constant 2 times Pi in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 TwoPi() -{ - return 6.28318530717958647692528676655900576; -} - -/// Returns the constant Pi in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi() -{ - return 3.14159265358979323846264338327950288; -} - -/// Returns the constant Pi halves in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_2() -{ - return 1.57079632679489661923132169163975144; -} - -/// Returns the constant Pi thirds in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_3() -{ - return 1.04719755119659774615421446109316762; -} - -/// Returns the constant Pi fourths in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_4() -{ - return 0.78539816339744830961566084581987572; -} - -/// Returns the constant Pi one hundred and eightieth in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_180() -{ - return 0.01745329251994329547437168059786927; -} - -/// Returns the constant 2 times Pi. -/// -template - static constexpr inline VTKM_EXEC_CONT auto TwoPi() -> typename detail::FloatingPointReturnType::Type - { - using FT = typename detail::FloatingPointReturnType::Type; - using RAFT = typename detail::FloatingPointReturnType::representable_as_float_type; - return static_cast(RAFT::value ? TwoPif() : TwoPi()); - } - -/// Returns the constant Pi. -/// -template - static constexpr inline VTKM_EXEC_CONT auto Pi() -> typename detail::FloatingPointReturnType::Type - { - using FT = typename detail::FloatingPointReturnType::Type; - using RAFT = typename detail::FloatingPointReturnType::representable_as_float_type; - return static_cast(RAFT::value ? Pif() : Pi()); - } - -/// Returns the constant Pi halves. -/// -template - static constexpr inline VTKM_EXEC_CONT auto Pi_2() -> typename detail::FloatingPointReturnType::Type - { - using FT = typename detail::FloatingPointReturnType::Type; - using RAFT = typename detail::FloatingPointReturnType::representable_as_float_type; - return static_cast(RAFT::value ? Pi_2f() : Pi_2()); - } - -/// Returns the constant Pi thirds. -/// -template - static constexpr inline VTKM_EXEC_CONT auto Pi_3() -> typename detail::FloatingPointReturnType::Type - { - using FT = typename detail::FloatingPointReturnType::Type; - using RAFT = typename detail::FloatingPointReturnType::representable_as_float_type; - return static_cast(RAFT::value ? Pi_3f() : Pi_3()); - } - -/// Returns the constant Pi fourths. -/// -template - static constexpr inline VTKM_EXEC_CONT auto Pi_4() -> typename detail::FloatingPointReturnType::Type - { - using FT = typename detail::FloatingPointReturnType::Type; - using RAFT = typename detail::FloatingPointReturnType::representable_as_float_type; - return static_cast(RAFT::value ? Pi_4f() : Pi_4()); - } -/// Returns the constant Pi one hundred and eightieth. -/// -template - static constexpr inline VTKM_EXEC_CONT auto Pi_180() -> typename detail::FloatingPointReturnType::Type - { - using FT = typename detail::FloatingPointReturnType::Type; - using RAFT = typename detail::FloatingPointReturnType::representable_as_float_type; - return static_cast(RAFT::value ? Pi_180f() : Pi_180()); - } +// clang-format off /// Compute the sine of \p x. /// diff --git a/vtkm/Math.h.in b/vtkm/Math.h.in index a5bd61837..5da53a386 100644 --- a/vtkm/Math.h.in +++ b/vtkm/Math.h.in @@ -184,15 +184,6 @@ static inline VTKM_EXEC_CONT vtkm::Float64 {0}(vtkm::Float64 x, vtkm::Float64 y) }} '''.format(vtkmname, expression) -def unary_pi_related_function_no_vec(vtkmname): - return '''template - static constexpr inline VTKM_EXEC_CONT auto {0}() -> typename detail::FloatingPointReturnType::Type - {{ - using FT = typename detail::FloatingPointReturnType::Type; - using RAFT = typename detail::FloatingPointReturnType::representable_as_float_type; - return static_cast(RAFT::value ? {0}f() : {0}()); - }} -'''.format(vtkmname) )\ $extend(unary_math_function)\ $extend(unary_math_function_no_vec)\ @@ -200,9 +191,7 @@ $extend(unary_Vec_function)\ $extend(unary_template_function_no_vec)\ $extend(binary_math_function)\ $extend(binary_template_function)\ -$extend(unary_pi_related_function_no_vec)\ \ -// clang-format off namespace vtkm { @@ -213,120 +202,112 @@ template struct FloatingPointReturnType { using ctype = typename vtkm::VecTraits::ComponentType; - using representable_as_float_type = std::integral_constant::value)>; - using Type = typename std::conditional::type; + using representable_as_float_type = + std::integral_constant::value)>; + using Type = typename std:: + conditional::type; }; } // namespace detail +/// Returns the constant 2 times Pi. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type TwoPi() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(6.28318530717958647692528676655900576); +} + +/// Returns the constant Pi. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(3.14159265358979323846264338327950288); +} + +/// Returns the constant Pi halves. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_2() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(1.57079632679489661923132169163975144); +} + +/// Returns the constant Pi thirds. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_3() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(1.04719755119659774615421446109316762); +} + +/// Returns the constant Pi fourths. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_4() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(0.78539816339744830961566084581987572); +} + +/// Returns the constant Pi one hundred and eightieth. +/// +template +static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Pi_180() +{ + using FT = typename detail::FloatingPointReturnType::Type; + return static_cast(0.01745329251994329547437168059786927); +} + /// Returns the constant 2 times Pi in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 TwoPif() { - return 6.28318530717958647692528676655900576f; + return TwoPi(); } /// Returns the constant Pi in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pif() { - return 3.14159265358979323846264338327950288f; + return Pi(); } /// Returns the constant Pi halves in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_2f() { - return 1.57079632679489661923132169163975144f; + return Pi_2(); } /// Returns the constant Pi thirds in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_3f() { - return 1.04719755119659774615421446109316762f; + return Pi_3(); } /// Returns the constant Pi fourths in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_4f() { - return 0.78539816339744830961566084581987572f; + return Pi_4(); } /// Returns the constant Pi one hundred and eightieth in float32. /// static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_180f() { - return 0.01745329251994329547437168059786927f; + return Pi_180(); } -/// Returns the constant 2 times Pi in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 TwoPi() -{ - return 6.28318530717958647692528676655900576; -} - -/// Returns the constant Pi in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi() -{ - return 3.14159265358979323846264338327950288; -} - -/// Returns the constant Pi halves in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_2() -{ - return 1.57079632679489661923132169163975144; -} - -/// Returns the constant Pi thirds in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_3() -{ - return 1.04719755119659774615421446109316762; -} - -/// Returns the constant Pi fourths in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_4() -{ - return 0.78539816339744830961566084581987572; -} - -/// Returns the constant Pi one hundred and eightieth in float64. -/// -static constexpr inline VTKM_EXEC_CONT vtkm::Float64 Pi_180() -{ - return 0.01745329251994329547437168059786927; -} - -/// Returns the constant 2 times Pi. -/// -$unary_pi_related_function_no_vec('TwoPi')\ - -/// Returns the constant Pi. -/// -$unary_pi_related_function_no_vec('Pi')\ - -/// Returns the constant Pi halves. -/// -$unary_pi_related_function_no_vec('Pi_2')\ - -/// Returns the constant Pi thirds. -/// -$unary_pi_related_function_no_vec('Pi_3')\ - -/// Returns the constant Pi fourths. -/// -$unary_pi_related_function_no_vec('Pi_4')\ -/// Returns the constant Pi one hundred and eightieth. -/// -$unary_pi_related_function_no_vec('Pi_180')\ +// clang-format off /// Compute the sine of \p x. /// diff --git a/vtkm/Tuple.h b/vtkm/Tuple.h index 09ffa1037..4bee2db5d 100644 --- a/vtkm/Tuple.h +++ b/vtkm/Tuple.h @@ -36,7 +36,7 @@ class Tuple; /// \brief Get the size of a tuple. /// -/// Given a `vtkm::Tuple` type, because a `std::integral_constant` of the type. +/// Given a `vtkm::Tuple` type, becomes a `std::integral_constant` of the type. /// template using TupleSize = std::integral_constant; diff --git a/vtkm/Tuple.h.in b/vtkm/Tuple.h.in index 513e06065..1bef3b395 100644 --- a/vtkm/Tuple.h.in +++ b/vtkm/Tuple.h.in @@ -77,7 +77,7 @@ class Tuple; /// \brief Get the size of a tuple. /// -/// Given a `vtkm::Tuple` type, because a `std::integral_constant` of the type. +/// Given a `vtkm::Tuple` type, becomes a `std::integral_constant` of the type. /// template using TupleSize = std::integral_constant; @@ -243,6 +243,7 @@ VTKM_EXEC_CONT void ForEach(vtkm::Tuple& tuple, Function&& f) return vtkm::Apply(tuple, detail::TupleForEachFunctor{}, std::forward(f)); } +///@{ /// @brief Construct a new `vtkm::Tuple` by applying a function to each value. /// /// The `vtkm::Transform` function builds a new `vtkm::Tuple` by calling a function @@ -251,17 +252,18 @@ VTKM_EXEC_CONT void ForEach(vtkm::Tuple& tuple, Function&& f) /// created from the return type of the function. template VTKM_EXEC_CONT auto Transform(const TupleType&& tuple, Function&& f) - -> decltype(Apply(tuple, detail::TupleTransformFunctor{}, std::forward(f))) + -> decltype(Apply(tuple, detail::TupleTransformFunctor(), std::forward(f))) { - return Apply(tuple, detail::TupleTransformFunctor{}, std::forward(f)); + return Apply(tuple, detail::TupleTransformFunctor(), std::forward(f)); } template VTKM_EXEC_CONT auto Transform(TupleType&& tuple, Function&& f) - -> decltype(Apply(tuple, detail::TupleTransformFunctor{}, std::forward(f))) + -> decltype(Apply(tuple, detail::TupleTransformFunctor(), std::forward(f))) { - return Apply(tuple, detail::TupleTransformFunctor{}, std::forward(f)); + return Apply(tuple, detail::TupleTransformFunctor(), std::forward(f)); } +///@} template <> class Tuple<> diff --git a/vtkm/VecFlat.h b/vtkm/VecFlat.h index 01d2b5028..a705eec8e 100644 --- a/vtkm/VecFlat.h +++ b/vtkm/VecFlat.h @@ -210,7 +210,7 @@ VTKM_EXEC_CONT void CopyVecFlatToNested(const vtkm::Vec& flatVec, NestedVe /// auto flatVec = vtkm::make_VecFlat(nestedVec); /// ``` /// -/// `flatVec` is now of type `vtkm::VecFlat, 3>. +/// `flatVec` is now of type `vtkm::VecFlat, 3>`. /// `flatVec::NUM_COMPONENTS` is 6 (3 * 2). The `[]` operator takes an index between /// 0 and 5 and returns a value of type `vtkm::Id`. The indices are explored in /// depth-first order. So `flatVec[0] == nestedVec[0][0]`, `flatVec[1] == nestedVec[0][1]`, diff --git a/vtkm/VecTraits.h b/vtkm/VecTraits.h index 2c507175b..fe9e80675 100644 --- a/vtkm/VecTraits.h +++ b/vtkm/VecTraits.h @@ -138,10 +138,13 @@ struct VTKM_NEVER_EXPORT VecTraits /// \brief Get a vector of the same type but with a different component. /// /// This type resolves to another vector with a different component type. For example, - /// `vtkm::VecTraits>::ReplaceComponentType` is `vtkm::Vec`. - /// This replacement is not recursive. So `VecTraits, N>::ReplaceComponentType` - /// is `vtkm::Vec`. + /// `vtkm::VecTraits>::%ReplaceComponentType` is `vtkm::Vec`. This + /// replacement is not recursive. So `VecTraits, N>::%ReplaceComponentType` is + /// `vtkm::Vec`. /// + // Note: the `%` in the code samples above is a hint to doxygen to avoid attempting + // to link to the object (i.e. `ReplaceBaseComponentType`), which results in a warning. + // The `%` is removed from the doxygen text. template using ReplaceComponentType = NewComponentType; @@ -149,8 +152,11 @@ struct VTKM_NEVER_EXPORT VecTraits /// /// This type resolves to another vector with a different base component type. The replacement /// is recursive for nested types. For example, - /// `VecTraits, N>::ReplaceBaseComponentType` is `Vec, N>`. + /// `VecTraits, N>::%ReplaceBaseComponentType` is `Vec, N>`. /// + // Note: the `%` in the code samples above is a hint to doxygen to avoid attempting + // to link to the object (i.e. `ReplaceBaseComponentType`), which results in a warning. + // The `%` is removed from the doxygen text. template using ReplaceBaseComponentType = NewComponentType; diff --git a/vtkm/cont/ArrayHandleBasic.h b/vtkm/cont/ArrayHandleBasic.h index 15b5ce506..5ada4f926 100644 --- a/vtkm/cont/ArrayHandleBasic.h +++ b/vtkm/cont/ArrayHandleBasic.h @@ -367,6 +367,9 @@ struct Serialization> #ifndef vtk_m_cont_ArrayHandleBasic_cxx +/// @cond +/// Make doxygen ignore this section + namespace vtkm { namespace cont @@ -375,8 +378,6 @@ namespace cont namespace internal { -/// \cond -/// Make doxygen ignore this section #define VTKM_STORAGE_EXPORT(Type) \ extern template class VTKM_CONT_TEMPLATE_EXPORT Storage; \ extern template class VTKM_CONT_TEMPLATE_EXPORT Storage, StorageTagBasic>; \ @@ -396,7 +397,6 @@ VTKM_STORAGE_EXPORT(vtkm::Float32) VTKM_STORAGE_EXPORT(vtkm::Float64) #undef VTKM_STORAGE_EXPORT -/// \endcond } // namespace internal @@ -424,6 +424,8 @@ VTKM_ARRAYHANDLE_EXPORT(vtkm::Float64) } } // end vtkm::cont +/// @endcond + #endif // !vtk_m_cont_ArrayHandleBasic_cxx #endif //vtk_m_cont_ArrayHandleBasic_h diff --git a/vtkm/cont/ArrayHandleExtractComponent.h b/vtkm/cont/ArrayHandleExtractComponent.h index 5230c4b14..f22e2597c 100644 --- a/vtkm/cont/ArrayHandleExtractComponent.h +++ b/vtkm/cont/ArrayHandleExtractComponent.h @@ -235,6 +235,9 @@ VTKM_CONT ArrayHandleExtractComponent make_ArrayHandleExtractCo namespace internal { +///@cond +// Doxygen has trouble parsing this, and it is not important to document. + template struct ArrayExtractComponentImpl> { @@ -255,6 +258,8 @@ struct ArrayExtractComponentImpl struct ArrayExtractComponentImpl { @@ -485,6 +487,8 @@ struct ArrayExtractComponentImpl } }; +/// @endcond + } // namespace internal } @@ -559,6 +563,8 @@ struct Serialization`. -/// This array should have the same number of elements as the input array -/// with each value representing the masking status of the corresponding -/// value in the input array (masked if 0 else unmasked). Ignored if empty. -/// \param computeFiniteRange Optional boolean parameter to specify if non-finite values in the -/// array should be ignored to compute the finite range of -/// the array. For Vec types, individual component values -/// are considered independantly. -/// \param device This optional parameter can be used to specify a device to run the -/// range computation on. The default value is `vtkm::cont::DeviceAdapterTagAny{}`. +/// The `array` parameter is the input array as a `vtkm::cont::UnknownArrayHandle`. /// -/// \return The result is returned in an `ArrayHandle` of `Range` objects. There is +/// The optional `maskArray` parameter supports selectively choosing which entries to +/// include in the range. It is an array handle of type `vtkm::cont::ArrayHandle`. +/// This array should have the same number of elements as the input array +/// with each value representing the masking status of the corresponding +/// value in the input array (masked if 0 else unmasked). Ignored if empty. +/// +/// The optional `computeFiniteRange` parameter specifies whether if non-finite +/// values in the array should be ignored to compute the finite range of +/// the array. For Vec types, individual component values are considered independantly. +/// +/// The optional `device` parameter can be used to specify a device to run the +/// range computation on. The default value is `vtkm::cont::DeviceAdapterTagAny{}`. +/// +/// @return The result is returned in an `ArrayHandle` of `Range` objects. There is /// one value in the returned array for every component of the input's value /// type. For nested Vecs the results are stored in depth-first order. /// -/// \note `ArrayRangeCompute` takes an UnknownArrayHandle as the input. +/// @note `ArrayRangeCompute` takes an UnknownArrayHandle as the input. /// The implementation uses precompiled and specicialized code for several of the /// most commonly used value and storage types, with a fallback for other cases. /// This is so that ArrayRangeCompute.h can be included in code that does not use a @@ -56,7 +59,7 @@ namespace cont /// implemented by specializing the template class `ArrayRangeComputeImpl`. /// Please refer to ArrayRangeComputeTemplate.h for details /// -/// \sa ArrayRangeComputeTemplate +/// @sa ArrayRangeComputeTemplate /// VTKM_CONT_EXPORT vtkm::cont::ArrayHandle ArrayRangeCompute( @@ -85,17 +88,21 @@ inline vtkm::cont::ArrayHandle ArrayRangeCompute( /// Given an `ArrayHandle`, this function computes the range (min and max) of /// the magnitude of the values in the array. /// -/// \param array The input array as a `vtkm::cont::UnknownArrayHandle`. -/// \param maskArray An array handle of type `vtkm::cont::ArrayHandle`. -/// This array should have the same number of elements as the input array -/// with each value representing the masking status of the corresponding -/// value in the input array (masked if 0 else unmasked). Ignored if empty. -/// \param computeFiniteRange Optional boolean value to specify if non-finite values in the -/// array should be ignored to compute the finite range of -/// the array. A Vec with any non-finite component will be -/// ignored. -/// \param device This optional parameter can be used to specify a device to run the -/// range computation on. The default value is `vtkm::cont::DeviceAdapterTagAny{}`. +/// +/// The `array` parameter is the input array as a `vtkm::cont::UnknownArrayHandle`. +/// +/// The optional `maskArray` parameter supports selectively choosing which entries to +/// include in the range. It is an array handle of type `vtkm::cont::ArrayHandle`. +/// This array should have the same number of elements as the input array +/// with each value representing the masking status of the corresponding +/// value in the input array (masked if 0 else unmasked). Ignored if empty. +/// +/// The optional `computeFiniteRange` parameter specifies whether if non-finite +/// values in the array should be ignored to compute the finite range of +/// the array. A Vec with any non-finite component will be ignored. +/// +/// The optional `device` parameter can be used to specify a device to run the +/// range computation on. The default value is `vtkm::cont::DeviceAdapterTagAny{}`. /// /// \return The result is returned in a single `Range` objects. /// diff --git a/vtkm/cont/ColorTableMap.h b/vtkm/cont/ColorTableMap.h index faf558598..9fc852914 100644 --- a/vtkm/cont/ColorTableMap.h +++ b/vtkm/cont/ColorTableMap.h @@ -164,7 +164,7 @@ bool ColorTableMap(const vtkm::cont::ArrayHandle& values, template bool ColorTableMap(const vtkm::cont::ArrayHandle& values, const vtkm::cont::ColorTable& table, - vtkm::cont::ArrayHandle& rgbOut) + vtkm::cont::ArrayHandle>& rgbOut) { vtkm::cont::Invoker invoke; invoke(vtkm::worklet::colorconversion::TransferFunction{}, values, table, rgbOut); @@ -188,7 +188,7 @@ bool ColorTableMapMagnitude(const vtkm::cont::ArrayHandle, S>& v template bool ColorTableMapMagnitude(const vtkm::cont::ArrayHandle, S>& values, const vtkm::cont::ColorTable& table, - vtkm::cont::ArrayHandle& rgbOut) + vtkm::cont::ArrayHandle>& rgbOut) { using namespace vtkm::worklet::colorconversion; return vtkm::cont::ColorTableMap( @@ -214,7 +214,7 @@ template bool ColorTableMapComponent(const vtkm::cont::ArrayHandle, S>& values, vtkm::IdComponent comp, const vtkm::cont::ColorTable& table, - vtkm::cont::ArrayHandle& rgbOut) + vtkm::cont::ArrayHandle>& rgbOut) { using namespace vtkm::worklet::colorconversion; return vtkm::cont::ColorTableMap( diff --git a/vtkm/filter/scalar_topology/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h b/vtkm/filter/scalar_topology/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h index 446cb8617..08ad5105c 100644 --- a/vtkm/filter/scalar_topology/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h +++ b/vtkm/filter/scalar_topology/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h @@ -101,7 +101,7 @@ public: /// Operator used by DIY to compute a step in the fan in /// @param[in] block The local data block to be processed in this step. Instance of DistributedContourTreeBlockData. /// @param[in] rp DIY communication proxy - /// @param[in] unused partners of the current block (unused) + // @param[in] unused partners of the current block (unused) void operator()( vtkm::worklet::contourtree_distributed::DistributedContourTreeBlockData* block, const vtkmdiy::ReduceProxy& rp, diff --git a/vtkm/rendering/View.h b/vtkm/rendering/View.h index e12ddc63c..a880e4f17 100644 --- a/vtkm/rendering/View.h +++ b/vtkm/rendering/View.h @@ -92,7 +92,7 @@ public: VTKM_CONT void SetBackgroundColor(const vtkm::rendering::Color& color); - /// @brief @Specify the color of foreground elements. + /// @brief Specify the color of foreground elements. /// /// The foreground is typically used for annotation elements. /// The foreground should contrast well with the background. diff --git a/vtkm/worklet/colorconversion/Conversions.h b/vtkm/worklet/colorconversion/Conversions.h index f6ca9ad58..f239de07c 100644 --- a/vtkm/worklet/colorconversion/Conversions.h +++ b/vtkm/worklet/colorconversion/Conversions.h @@ -10,6 +10,8 @@ #ifndef vtk_m_worklet_colorconversion_Conversions_h #define vtk_m_worklet_colorconversion_Conversions_h +#include + #include namespace vtkm @@ -19,6 +21,9 @@ namespace worklet namespace colorconversion { +/// Cast the provided value to a `vtkm::UInt8`. If the value is floating point, +/// it converts the range [0, 1] to [0, 255] (which is typical for how colors +/// are respectively represented in bytes and floats). template VTKM_EXEC inline vtkm::UInt8 ColorToUChar(T t) { @@ -38,22 +43,32 @@ VTKM_EXEC inline vtkm::UInt8 ColorToUChar(vtkm::Float32 t) } +/// Clamp the provided value to the range [0, 255]. VTKM_EXEC inline void Clamp(vtkm::Float32& val) { val = vtkm::Min(255.0f, vtkm::Max(0.0f, val)); } -VTKM_EXEC inline void Clamp(vtkm::Vec2f_32& val) + +// Note: due to a bug in Doxygen 1.8.17, we are not using the +// vtkm::VecXT_X typedefs below. + +/// Clamp the components of the provided value to the range [0, 255]. +VTKM_EXEC inline void Clamp(vtkm::Vec& val) { val[0] = vtkm::Min(255.0f, vtkm::Max(0.0f, val[0])); val[1] = vtkm::Min(255.0f, vtkm::Max(0.0f, val[1])); } -VTKM_EXEC inline void Clamp(vtkm::Vec3f_32& val) + +/// Clamp the components of the provided value to the range [0, 255]. +VTKM_EXEC inline void Clamp(vtkm::Vec& val) { val[0] = vtkm::Min(255.0f, vtkm::Max(0.0f, val[0])); val[1] = vtkm::Min(255.0f, vtkm::Max(0.0f, val[1])); val[2] = vtkm::Min(255.0f, vtkm::Max(0.0f, val[2])); } -VTKM_EXEC inline void Clamp(vtkm::Vec4f_32& val) + +/// Clamp the components of the provided value to the range [0, 255]. +VTKM_EXEC inline void Clamp(vtkm::Vec& val) { val[0] = vtkm::Min(255.0f, vtkm::Max(0.0f, val[0])); val[1] = vtkm::Min(255.0f, vtkm::Max(0.0f, val[1]));