From 108176774f76ab98264b72898007fb56775fb35c Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Wed, 21 Feb 2024 16:31:36 -0500 Subject: [PATCH] Fix doxygen warnings for math functions Doxygen was having trouble with `@copydoc` when copying documentation of templated functions. The doxygen comments in `Math.h` is restructured to not need `@copydoc`, and the documentation is generated correctly. --- vtkm/Math.h | 160 +++++++++++++++++++++---------------------------- vtkm/Math.h.in | 160 +++++++++++++++++++++---------------------------- 2 files changed, 138 insertions(+), 182 deletions(-) diff --git a/vtkm/Math.h b/vtkm/Math.h index e59ccde72..9c74e2490 100644 --- a/vtkm/Math.h +++ b/vtkm/Math.h @@ -2003,151 +2003,129 @@ struct FloatLimits> #undef VTKM_EPSILON_64 } // namespace detail +#endif //VTKM_USE_IEEE_NONFINITE +///@{ /// Returns the representation for infinity. The result is greater than any other /// number except another infinity or NaN. When comparing two infinities or infinity /// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated +/// `Nan()` function is templated to specify either a 32 or 64 bit floating point +/// number. The convenience functions `Nan32()` and `Nan64()` are non-templated /// versions that return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T Nan() { return detail::FloatLimits::Nan(); } - -/// Returns the representation for infinity. The result is greater than any other -/// number except another infinity or NaN. When comparing two infinities or infinity -/// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated -/// versions that return the precision for a particular precision. -template -static inline VTKM_EXEC_CONT T Infinity() -{ - return detail::FloatLimits::Infinity(); -} - -/// Returns the representation for negative infinity. The result is less than any -/// other number except another negative infinity or NaN. When comparing two -/// negative infinities or negative infinity to NaN, neither is greater than, less -/// than, nor equal to the other. The `NegativeInfinity` method is templated to -/// specify either a 32 or 64 bit floating point number. The convenience methods -/// `NegativeInfinity32` and`NegativeInfinity64` are non-templated versions that -/// return the precision for a particular precision. -template -static inline VTKM_EXEC_CONT T NegativeInfinity() -{ - return detail::FloatLimits::NegativeInfinity(); -} - -/// Returns the difference between 1 and the least value greater than 1 that -/// is representable by a floating point number. Epsilon is useful for specifying -/// the tolerance one should have when considering numerical error. The `Epsilon` -/// method is templated to specify either a 32 or 64 bit floating point number. The -/// convenience methods `Epsilon32` and`Epsilon64` are non-templated versions that -/// return the precision for a particular precision. -template -static inline VTKM_EXEC_CONT T Epsilon() -{ - return detail::FloatLimits::Epsilon(); -} - #else // !VTKM_USE_IEEE_NONFINITE - -/// Returns the representation for infinity. The result is greater than any other -/// number except another infinity or NaN. When comparing two infinities or infinity -/// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated -/// versions that return the precision for a particular precision. template static inline VTKM_EXEC_CONT T Nan() { return std::numeric_limits::quiet_NaN(); } +#endif // !VTKM_USE_IEEE_NONFINITE +static inline VTKM_EXEC_CONT vtkm::Float32 Nan32() +{ + return vtkm::Nan(); +} +static inline VTKM_EXEC_CONT vtkm::Float64 Nan64() +{ + return vtkm::Nan(); +} +///@} +///@{ /// Returns the representation for infinity. The result is greater than any other /// number except another infinity or NaN. When comparing two infinities or infinity /// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated +/// `Infinity()` function is templated to specify either a 32 or 64 bit floating point +/// number. The convenience functions `Infinity32()` and`Infinity64()` are non-templated /// versions that return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE +template +static inline VTKM_EXEC_CONT T Infinity() +{ + return detail::FloatLimits::Infinity(); +} +#else // !VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T Infinity() { return std::numeric_limits::infinity(); } +#endif // !VTKM_USE_IEEE_NONFINITE +static inline VTKM_EXEC_CONT vtkm::Float32 Infinity32() +{ + return vtkm::Infinity(); +} +static inline VTKM_EXEC_CONT vtkm::Float64 Infinity64() +{ + return vtkm::Infinity(); +} +///@} +///@{ /// Returns the representation for negative infinity. The result is less than any /// other number except another negative infinity or NaN. When comparing two /// negative infinities or negative infinity to NaN, neither is greater than, less -/// than, nor equal to the other. The `NegativeInfinity` method is templated to -/// specify either a 32 or 64 bit floating point number. The convenience methods -/// `NegativeInfinity32` and`NegativeInfinity64` are non-templated versions that +/// than, nor equal to the other. The `NegativeInfinity()` function is templated to +/// specify either a 32 or 64 bit floating point number. The convenience functions +/// `NegativeInfinity32()` and`NegativeInfinity64()` are non-templated versions that /// return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE +template +static inline VTKM_EXEC_CONT T NegativeInfinity() +{ + return detail::FloatLimits::NegativeInfinity(); +} +#else // !VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T NegativeInfinity() { return -std::numeric_limits::infinity(); } +#endif // !VTKM_USE_IEEE_NONFINITE +static inline VTKM_EXEC_CONT vtkm::Float32 NegativeInfinity32() +{ + return vtkm::NegativeInfinity(); +} +static inline VTKM_EXEC_CONT vtkm::Float64 NegativeInfinity64() +{ + return vtkm::NegativeInfinity(); +} +///@} +///@{ /// Returns the difference between 1 and the least value greater than 1 that /// is representable by a floating point number. Epsilon is useful for specifying -/// the tolerance one should have when considering numerical error. The `Epsilon` -/// method is templated to specify either a 32 or 64 bit floating point number. The -/// convenience methods `Epsilon32` and`Epsilon64` are non-templated versions that +/// the tolerance one should have when considering numerical error. The `Epsilon()` +/// function is templated to specify either a 32 or 64 bit floating point number. The +/// convenience functions `Epsilon32()` and`Epsilon64()` are non-templated versions that /// return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE +template +static inline VTKM_EXEC_CONT T Epsilon() +{ + return detail::FloatLimits::Epsilon(); +} +#else // !VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T Epsilon() { return std::numeric_limits::epsilon(); } #endif // !VTKM_USE_IEEE_NONFINITE - -/// @copydoc Nan -static inline VTKM_EXEC_CONT vtkm::Float32 Nan32() -{ - return vtkm::Nan(); -} -/// @copydoc Nan -static inline VTKM_EXEC_CONT vtkm::Float64 Nan64() -{ - return vtkm::Nan(); -} - -/// @copydoc Infinity -static inline VTKM_EXEC_CONT vtkm::Float32 Infinity32() -{ - return vtkm::Infinity(); -} -/// @copydoc Infinity -static inline VTKM_EXEC_CONT vtkm::Float64 Infinity64() -{ - return vtkm::Infinity(); -} - -/// @copydoc NegativeInfinity -static inline VTKM_EXEC_CONT vtkm::Float32 NegativeInfinity32() -{ - return vtkm::NegativeInfinity(); -} -/// @copydoc NegativeInfinity -static inline VTKM_EXEC_CONT vtkm::Float64 NegativeInfinity64() -{ - return vtkm::NegativeInfinity(); -} - -/// @copydoc Epsilon static inline VTKM_EXEC_CONT vtkm::Float32 Epsilon32() { return vtkm::Epsilon(); } -/// @copydoc Epsilon static inline VTKM_EXEC_CONT vtkm::Float64 Epsilon64() { return vtkm::Epsilon(); } +///@} + //----------------------------------------------------------------------------- /// Returns true if \p x is not a number. diff --git a/vtkm/Math.h.in b/vtkm/Math.h.in index a82e7d87f..f9e996681 100644 --- a/vtkm/Math.h.in +++ b/vtkm/Math.h.in @@ -851,151 +851,129 @@ struct FloatLimits> #undef VTKM_EPSILON_64 } // namespace detail +#endif //VTKM_USE_IEEE_NONFINITE +///@{ /// Returns the representation for infinity. The result is greater than any other /// number except another infinity or NaN. When comparing two infinities or infinity /// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated +/// `Nan()` function is templated to specify either a 32 or 64 bit floating point +/// number. The convenience functions `Nan32()` and `Nan64()` are non-templated /// versions that return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T Nan() { return detail::FloatLimits::Nan(); } - -/// Returns the representation for infinity. The result is greater than any other -/// number except another infinity or NaN. When comparing two infinities or infinity -/// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated -/// versions that return the precision for a particular precision. -template -static inline VTKM_EXEC_CONT T Infinity() -{ - return detail::FloatLimits::Infinity(); -} - -/// Returns the representation for negative infinity. The result is less than any -/// other number except another negative infinity or NaN. When comparing two -/// negative infinities or negative infinity to NaN, neither is greater than, less -/// than, nor equal to the other. The `NegativeInfinity` method is templated to -/// specify either a 32 or 64 bit floating point number. The convenience methods -/// `NegativeInfinity32` and`NegativeInfinity64` are non-templated versions that -/// return the precision for a particular precision. -template -static inline VTKM_EXEC_CONT T NegativeInfinity() -{ - return detail::FloatLimits::NegativeInfinity(); -} - -/// Returns the difference between 1 and the least value greater than 1 that -/// is representable by a floating point number. Epsilon is useful for specifying -/// the tolerance one should have when considering numerical error. The `Epsilon` -/// method is templated to specify either a 32 or 64 bit floating point number. The -/// convenience methods `Epsilon32` and`Epsilon64` are non-templated versions that -/// return the precision for a particular precision. -template -static inline VTKM_EXEC_CONT T Epsilon() -{ - return detail::FloatLimits::Epsilon(); -} - #else // !VTKM_USE_IEEE_NONFINITE - -/// Returns the representation for infinity. The result is greater than any other -/// number except another infinity or NaN. When comparing two infinities or infinity -/// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated -/// versions that return the precision for a particular precision. template static inline VTKM_EXEC_CONT T Nan() { return std::numeric_limits::quiet_NaN(); } +#endif // !VTKM_USE_IEEE_NONFINITE +static inline VTKM_EXEC_CONT vtkm::Float32 Nan32() +{ + return vtkm::Nan(); +} +static inline VTKM_EXEC_CONT vtkm::Float64 Nan64() +{ + return vtkm::Nan(); +} +///@} +///@{ /// Returns the representation for infinity. The result is greater than any other /// number except another infinity or NaN. When comparing two infinities or infinity /// to NaN, neither is greater than, less than, nor equal to the other. The -/// `Infinity` method is templated to specify either a 32 or 64 bit floating point -/// number. The convenience methods `Infinity32` and`Infinity64` are non-templated +/// `Infinity()` function is templated to specify either a 32 or 64 bit floating point +/// number. The convenience functions `Infinity32()` and`Infinity64()` are non-templated /// versions that return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE +template +static inline VTKM_EXEC_CONT T Infinity() +{ + return detail::FloatLimits::Infinity(); +} +#else // !VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T Infinity() { return std::numeric_limits::infinity(); } +#endif // !VTKM_USE_IEEE_NONFINITE +static inline VTKM_EXEC_CONT vtkm::Float32 Infinity32() +{ + return vtkm::Infinity(); +} +static inline VTKM_EXEC_CONT vtkm::Float64 Infinity64() +{ + return vtkm::Infinity(); +} +///@} +///@{ /// Returns the representation for negative infinity. The result is less than any /// other number except another negative infinity or NaN. When comparing two /// negative infinities or negative infinity to NaN, neither is greater than, less -/// than, nor equal to the other. The `NegativeInfinity` method is templated to -/// specify either a 32 or 64 bit floating point number. The convenience methods -/// `NegativeInfinity32` and`NegativeInfinity64` are non-templated versions that +/// than, nor equal to the other. The `NegativeInfinity()` function is templated to +/// specify either a 32 or 64 bit floating point number. The convenience functions +/// `NegativeInfinity32()` and`NegativeInfinity64()` are non-templated versions that /// return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE +template +static inline VTKM_EXEC_CONT T NegativeInfinity() +{ + return detail::FloatLimits::NegativeInfinity(); +} +#else // !VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T NegativeInfinity() { return -std::numeric_limits::infinity(); } +#endif // !VTKM_USE_IEEE_NONFINITE +static inline VTKM_EXEC_CONT vtkm::Float32 NegativeInfinity32() +{ + return vtkm::NegativeInfinity(); +} +static inline VTKM_EXEC_CONT vtkm::Float64 NegativeInfinity64() +{ + return vtkm::NegativeInfinity(); +} +///@} +///@{ /// Returns the difference between 1 and the least value greater than 1 that /// is representable by a floating point number. Epsilon is useful for specifying -/// the tolerance one should have when considering numerical error. The `Epsilon` -/// method is templated to specify either a 32 or 64 bit floating point number. The -/// convenience methods `Epsilon32` and`Epsilon64` are non-templated versions that +/// the tolerance one should have when considering numerical error. The `Epsilon()` +/// function is templated to specify either a 32 or 64 bit floating point number. The +/// convenience functions `Epsilon32()` and`Epsilon64()` are non-templated versions that /// return the precision for a particular precision. +#ifdef VTKM_USE_IEEE_NONFINITE +template +static inline VTKM_EXEC_CONT T Epsilon() +{ + return detail::FloatLimits::Epsilon(); +} +#else // !VTKM_USE_IEEE_NONFINITE template static inline VTKM_EXEC_CONT T Epsilon() { return std::numeric_limits::epsilon(); } #endif // !VTKM_USE_IEEE_NONFINITE - -/// @copydoc Nan -static inline VTKM_EXEC_CONT vtkm::Float32 Nan32() -{ - return vtkm::Nan(); -} -/// @copydoc Nan -static inline VTKM_EXEC_CONT vtkm::Float64 Nan64() -{ - return vtkm::Nan(); -} - -/// @copydoc Infinity -static inline VTKM_EXEC_CONT vtkm::Float32 Infinity32() -{ - return vtkm::Infinity(); -} -/// @copydoc Infinity -static inline VTKM_EXEC_CONT vtkm::Float64 Infinity64() -{ - return vtkm::Infinity(); -} - -/// @copydoc NegativeInfinity -static inline VTKM_EXEC_CONT vtkm::Float32 NegativeInfinity32() -{ - return vtkm::NegativeInfinity(); -} -/// @copydoc NegativeInfinity -static inline VTKM_EXEC_CONT vtkm::Float64 NegativeInfinity64() -{ - return vtkm::NegativeInfinity(); -} - -/// @copydoc Epsilon static inline VTKM_EXEC_CONT vtkm::Float32 Epsilon32() { return vtkm::Epsilon(); } -/// @copydoc Epsilon static inline VTKM_EXEC_CONT vtkm::Float64 Epsilon64() { return vtkm::Epsilon(); } +///@} + //----------------------------------------------------------------------------- /// Returns true if \p x is not a number.