mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
Reduce doxygen warnings
This commit is contained in:
parent
9c42db5c71
commit
b4ba836890
@ -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
|
||||
|
@ -42,27 +42,11 @@ public:
|
||||
using Scalar = vtkm::FloatDefault;
|
||||
using Vector = vtkm::Vec<Scalar, 3>;
|
||||
|
||||
/// @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<const Derived*>(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<const Derived*>(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<Scalar>();
|
||||
@ -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<Scalar>();
|
||||
@ -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<vtkm::Plane, MaxNumPlanes> 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<Scalar>();
|
||||
@ -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<Scalar>();
|
||||
@ -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);
|
||||
|
179
vtkm/Math.h
179
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 <typename T>
|
||||
struct FloatingPointReturnType
|
||||
{
|
||||
using ctype = typename vtkm::VecTraits<T>::ComponentType;
|
||||
using representable_as_float_type = std::integral_constant<bool,
|
||||
((sizeof(ctype) < sizeof(float)) || std::is_same<ctype, vtkm::Float32>::value)>;
|
||||
using Type = typename std::conditional<representable_as_float_type::value,
|
||||
vtkm::Float32,
|
||||
vtkm::Float64>::type;
|
||||
using representable_as_float_type =
|
||||
std::integral_constant<bool,
|
||||
((sizeof(ctype) < sizeof(float)) ||
|
||||
std::is_same<ctype, vtkm::Float32>::value)>;
|
||||
using Type = typename std::
|
||||
conditional<representable_as_float_type::value, vtkm::Float32, vtkm::Float64>::type;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
/// Returns the constant 2 times Pi.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type TwoPi()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(6.28318530717958647692528676655900576);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(3.14159265358979323846264338327950288);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi halves.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_2()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(1.57079632679489661923132169163975144);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi thirds.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_3()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(1.04719755119659774615421446109316762);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi fourths.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_4()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(0.78539816339744830961566084581987572);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi one hundred and eightieth.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_180()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(0.01745329251994329547437168059786927);
|
||||
}
|
||||
|
||||
/// Returns the constant 2 times Pi in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 TwoPif()
|
||||
{
|
||||
return 6.28318530717958647692528676655900576f;
|
||||
return TwoPi<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pif()
|
||||
{
|
||||
return 3.14159265358979323846264338327950288f;
|
||||
return Pi<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi halves in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_2f()
|
||||
{
|
||||
return 1.57079632679489661923132169163975144f;
|
||||
return Pi_2<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi thirds in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_3f()
|
||||
{
|
||||
return 1.04719755119659774615421446109316762f;
|
||||
return Pi_3<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi fourths in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_4f()
|
||||
{
|
||||
return 0.78539816339744830961566084581987572f;
|
||||
return Pi_4<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// 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<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// 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 <typename T>
|
||||
static constexpr inline VTKM_EXEC_CONT auto TwoPi() -> typename detail::FloatingPointReturnType<T>::Type
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
using RAFT = typename detail::FloatingPointReturnType<T>::representable_as_float_type;
|
||||
return static_cast<FT>(RAFT::value ? TwoPif() : TwoPi());
|
||||
}
|
||||
|
||||
/// Returns the constant Pi.
|
||||
///
|
||||
template <typename T>
|
||||
static constexpr inline VTKM_EXEC_CONT auto Pi() -> typename detail::FloatingPointReturnType<T>::Type
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
using RAFT = typename detail::FloatingPointReturnType<T>::representable_as_float_type;
|
||||
return static_cast<FT>(RAFT::value ? Pif() : Pi());
|
||||
}
|
||||
|
||||
/// Returns the constant Pi halves.
|
||||
///
|
||||
template <typename T>
|
||||
static constexpr inline VTKM_EXEC_CONT auto Pi_2() -> typename detail::FloatingPointReturnType<T>::Type
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
using RAFT = typename detail::FloatingPointReturnType<T>::representable_as_float_type;
|
||||
return static_cast<FT>(RAFT::value ? Pi_2f() : Pi_2());
|
||||
}
|
||||
|
||||
/// Returns the constant Pi thirds.
|
||||
///
|
||||
template <typename T>
|
||||
static constexpr inline VTKM_EXEC_CONT auto Pi_3() -> typename detail::FloatingPointReturnType<T>::Type
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
using RAFT = typename detail::FloatingPointReturnType<T>::representable_as_float_type;
|
||||
return static_cast<FT>(RAFT::value ? Pi_3f() : Pi_3());
|
||||
}
|
||||
|
||||
/// Returns the constant Pi fourths.
|
||||
///
|
||||
template <typename T>
|
||||
static constexpr inline VTKM_EXEC_CONT auto Pi_4() -> typename detail::FloatingPointReturnType<T>::Type
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
using RAFT = typename detail::FloatingPointReturnType<T>::representable_as_float_type;
|
||||
return static_cast<FT>(RAFT::value ? Pi_4f() : Pi_4());
|
||||
}
|
||||
/// Returns the constant Pi one hundred and eightieth.
|
||||
///
|
||||
template <typename T>
|
||||
static constexpr inline VTKM_EXEC_CONT auto Pi_180() -> typename detail::FloatingPointReturnType<T>::Type
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
using RAFT = typename detail::FloatingPointReturnType<T>::representable_as_float_type;
|
||||
return static_cast<FT>(RAFT::value ? Pi_180f() : Pi_180());
|
||||
}
|
||||
// clang-format off
|
||||
|
||||
/// Compute the sine of \p x.
|
||||
///
|
||||
|
153
vtkm/Math.h.in
153
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 <typename T>
|
||||
static constexpr inline VTKM_EXEC_CONT auto {0}() -> typename detail::FloatingPointReturnType<T>::Type
|
||||
{{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
using RAFT = typename detail::FloatingPointReturnType<T>::representable_as_float_type;
|
||||
return static_cast<FT>(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 <typename T>
|
||||
struct FloatingPointReturnType
|
||||
{
|
||||
using ctype = typename vtkm::VecTraits<T>::ComponentType;
|
||||
using representable_as_float_type = std::integral_constant<bool,
|
||||
((sizeof(ctype) < sizeof(float)) || std::is_same<ctype, vtkm::Float32>::value)>;
|
||||
using Type = typename std::conditional<representable_as_float_type::value,
|
||||
vtkm::Float32,
|
||||
vtkm::Float64>::type;
|
||||
using representable_as_float_type =
|
||||
std::integral_constant<bool,
|
||||
((sizeof(ctype) < sizeof(float)) ||
|
||||
std::is_same<ctype, vtkm::Float32>::value)>;
|
||||
using Type = typename std::
|
||||
conditional<representable_as_float_type::value, vtkm::Float32, vtkm::Float64>::type;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
/// Returns the constant 2 times Pi.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type TwoPi()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(6.28318530717958647692528676655900576);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(3.14159265358979323846264338327950288);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi halves.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_2()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(1.57079632679489661923132169163975144);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi thirds.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_3()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(1.04719755119659774615421446109316762);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi fourths.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_4()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(0.78539816339744830961566084581987572);
|
||||
}
|
||||
|
||||
/// Returns the constant Pi one hundred and eightieth.
|
||||
///
|
||||
template <typename T = vtkm::Float64>
|
||||
static constexpr inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type Pi_180()
|
||||
{
|
||||
using FT = typename detail::FloatingPointReturnType<T>::Type;
|
||||
return static_cast<FT>(0.01745329251994329547437168059786927);
|
||||
}
|
||||
|
||||
/// Returns the constant 2 times Pi in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 TwoPif()
|
||||
{
|
||||
return 6.28318530717958647692528676655900576f;
|
||||
return TwoPi<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pif()
|
||||
{
|
||||
return 3.14159265358979323846264338327950288f;
|
||||
return Pi<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi halves in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_2f()
|
||||
{
|
||||
return 1.57079632679489661923132169163975144f;
|
||||
return Pi_2<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi thirds in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_3f()
|
||||
{
|
||||
return 1.04719755119659774615421446109316762f;
|
||||
return Pi_3<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// Returns the constant Pi fourths in float32.
|
||||
///
|
||||
static constexpr inline VTKM_EXEC_CONT vtkm::Float32 Pi_4f()
|
||||
{
|
||||
return 0.78539816339744830961566084581987572f;
|
||||
return Pi_4<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// 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<vtkm::Float32>();
|
||||
}
|
||||
|
||||
/// 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.
|
||||
///
|
||||
|
@ -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 <typename TupleType>
|
||||
using TupleSize = std::integral_constant<vtkm::IdComponent, TupleType::Size>;
|
||||
|
@ -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 <typename TupleType>
|
||||
using TupleSize = std::integral_constant<vtkm::IdComponent, TupleType::Size>;
|
||||
@ -243,6 +243,7 @@ VTKM_EXEC_CONT void ForEach(vtkm::Tuple<Ts...>& tuple, Function&& f)
|
||||
return vtkm::Apply(tuple, detail::TupleForEachFunctor{}, std::forward<Function>(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<Ts...>& tuple, Function&& f)
|
||||
/// created from the return type of the function.
|
||||
template <typename TupleType, typename Function>
|
||||
VTKM_EXEC_CONT auto Transform(const TupleType&& tuple, Function&& f)
|
||||
-> decltype(Apply(tuple, detail::TupleTransformFunctor{}, std::forward<Function>(f)))
|
||||
-> decltype(Apply(tuple, detail::TupleTransformFunctor(), std::forward<Function>(f)))
|
||||
{
|
||||
return Apply(tuple, detail::TupleTransformFunctor{}, std::forward<Function>(f));
|
||||
return Apply(tuple, detail::TupleTransformFunctor(), std::forward<Function>(f));
|
||||
}
|
||||
|
||||
template <typename TupleType, typename Function>
|
||||
VTKM_EXEC_CONT auto Transform(TupleType&& tuple, Function&& f)
|
||||
-> decltype(Apply(tuple, detail::TupleTransformFunctor{}, std::forward<Function>(f)))
|
||||
-> decltype(Apply(tuple, detail::TupleTransformFunctor(), std::forward<Function>(f)))
|
||||
{
|
||||
return Apply(tuple, detail::TupleTransformFunctor{}, std::forward<Function>(f));
|
||||
return Apply(tuple, detail::TupleTransformFunctor(), std::forward<Function>(f));
|
||||
}
|
||||
///@}
|
||||
|
||||
template <>
|
||||
class Tuple<>
|
||||
|
@ -210,7 +210,7 @@ VTKM_EXEC_CONT void CopyVecFlatToNested(const vtkm::Vec<T, N>& flatVec, NestedVe
|
||||
/// auto flatVec = vtkm::make_VecFlat(nestedVec);
|
||||
/// ```
|
||||
///
|
||||
/// `flatVec` is now of type `vtkm::VecFlat<vtkm::Vec<vtkm::Vec<T, 2>, 3>.
|
||||
/// `flatVec` is now of type `vtkm::VecFlat<vtkm::Vec<vtkm::Vec<T, 2>, 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]`,
|
||||
|
@ -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<vtkm::Vec<T, N>>::ReplaceComponentType<T2>` is `vtkm::Vec<T2, N>`.
|
||||
/// This replacement is not recursive. So `VecTraits<Vec<Vec<T, M>, N>::ReplaceComponentType<T2>`
|
||||
/// is `vtkm::Vec<T2, N>`.
|
||||
/// `vtkm::VecTraits<vtkm::Vec<T, N>>::%ReplaceComponentType<T2>` is `vtkm::Vec<T2, N>`. This
|
||||
/// replacement is not recursive. So `VecTraits<Vec<Vec<T, M>, N>::%ReplaceComponentType<T2>` is
|
||||
/// `vtkm::Vec<T2, 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 <typename NewComponentType>
|
||||
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<Vec<Vec<T, M>, N>::ReplaceBaseComponentType<T2>` is `Vec<Vec<T2, M>, N>`.
|
||||
/// `VecTraits<Vec<Vec<T, M>, N>::%ReplaceBaseComponentType<T2>` is `Vec<Vec<T2, M>, 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 <typename NewComponentType>
|
||||
using ReplaceBaseComponentType = NewComponentType;
|
||||
|
||||
|
@ -367,6 +367,9 @@ struct Serialization<vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic>>
|
||||
|
||||
#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<Type, StorageTagBasic>; \
|
||||
extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::Vec<Type, 2>, 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
|
||||
|
@ -235,6 +235,9 @@ VTKM_CONT ArrayHandleExtractComponent<ArrayHandleType> make_ArrayHandleExtractCo
|
||||
namespace internal
|
||||
{
|
||||
|
||||
///@cond
|
||||
// Doxygen has trouble parsing this, and it is not important to document.
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
struct ArrayExtractComponentImpl<vtkm::cont::StorageTagExtractComponent<ArrayHandleType>>
|
||||
{
|
||||
@ -255,6 +258,8 @@ struct ArrayExtractComponentImpl<vtkm::cont::StorageTagExtractComponent<ArrayHan
|
||||
}
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
} // namespace internal
|
||||
|
||||
}
|
||||
|
@ -462,6 +462,8 @@ VTKM_CONT
|
||||
namespace internal
|
||||
{
|
||||
|
||||
/// @cond
|
||||
|
||||
template <>
|
||||
struct ArrayExtractComponentImpl<vtkm::cont::StorageTagSOA>
|
||||
{
|
||||
@ -485,6 +487,8 @@ struct ArrayExtractComponentImpl<vtkm::cont::StorageTagSOA>
|
||||
}
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
} // namespace internal
|
||||
|
||||
}
|
||||
@ -559,6 +563,8 @@ struct Serialization<vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagSO
|
||||
|
||||
#ifndef vtkm_cont_ArrayHandleSOA_cxx
|
||||
|
||||
/// @cond
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
@ -585,6 +591,8 @@ VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::Float64)
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
||||
/// @endcond
|
||||
|
||||
#endif // !vtkm_cont_ArrayHandleSOA_cxx
|
||||
|
||||
#endif //vtk_m_cont_ArrayHandleSOA_h
|
||||
|
@ -22,30 +22,33 @@ namespace cont
|
||||
{
|
||||
|
||||
/// @{
|
||||
/// \brief Compute the range of the data in an array handle.
|
||||
/// @brief Compute the range of the data in an array handle.
|
||||
///
|
||||
/// Given an `ArrayHandle`, this function computes the range (min and max) of
|
||||
/// the values in the array. For arrays containing Vec values, the range is
|
||||
/// computed for each component, and in the case of nested Vecs, ranges are computed
|
||||
/// for each of the leaf components.
|
||||
///
|
||||
/// \param array The input array as a `vtkm::cont::UnknownArrayHandle`.
|
||||
/// \param maskArray An array handle of type `vtkm::cont::ArrayHandle<vtkm::UInt8>`.
|
||||
/// 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<vtkm::UInt8>`.
|
||||
/// 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
|
||||
///
|
||||
/// 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
|
||||
/// @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<vtkm::Range> ArrayRangeCompute(
|
||||
@ -85,16 +88,20 @@ inline vtkm::cont::ArrayHandle<vtkm::Range> 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<vtkm::UInt8>`.
|
||||
///
|
||||
/// 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<vtkm::UInt8>`.
|
||||
/// 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
|
||||
///
|
||||
/// 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.
|
||||
|
@ -164,7 +164,7 @@ bool ColorTableMap(const vtkm::cont::ArrayHandle<T, S>& values,
|
||||
template <typename T, typename S>
|
||||
bool ColorTableMap(const vtkm::cont::ArrayHandle<T, S>& values,
|
||||
const vtkm::cont::ColorTable& table,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3ui_8>& rgbOut)
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 3>>& rgbOut)
|
||||
{
|
||||
vtkm::cont::Invoker invoke;
|
||||
invoke(vtkm::worklet::colorconversion::TransferFunction{}, values, table, rgbOut);
|
||||
@ -188,7 +188,7 @@ bool ColorTableMapMagnitude(const vtkm::cont::ArrayHandle<vtkm::Vec<T, N>, S>& v
|
||||
template <typename T, int N, typename S>
|
||||
bool ColorTableMapMagnitude(const vtkm::cont::ArrayHandle<vtkm::Vec<T, N>, S>& values,
|
||||
const vtkm::cont::ColorTable& table,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3ui_8>& rgbOut)
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 3>>& rgbOut)
|
||||
{
|
||||
using namespace vtkm::worklet::colorconversion;
|
||||
return vtkm::cont::ColorTableMap(
|
||||
@ -214,7 +214,7 @@ template <typename T, int N, typename S>
|
||||
bool ColorTableMapComponent(const vtkm::cont::ArrayHandle<vtkm::Vec<T, N>, S>& values,
|
||||
vtkm::IdComponent comp,
|
||||
const vtkm::cont::ColorTable& table,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3ui_8>& rgbOut)
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 3>>& rgbOut)
|
||||
{
|
||||
using namespace vtkm::worklet::colorconversion;
|
||||
return vtkm::cont::ColorTableMap(
|
||||
|
2
vtkm/filter/scalar_topology/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h
2
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<FieldType>* block,
|
||||
const vtkmdiy::ReduceProxy& rp,
|
||||
|
@ -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.
|
||||
|
@ -10,6 +10,8 @@
|
||||
#ifndef vtk_m_worklet_colorconversion_Conversions_h
|
||||
#define vtk_m_worklet_colorconversion_Conversions_h
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
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 <typename T>
|
||||
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<vtkm::Float32, 2>& 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<vtkm::Float32, 3>& 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<vtkm::Float32, 4>& 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]));
|
||||
|
Loading…
Reference in New Issue
Block a user