/**
* Standard constructor. Creates an object that corresponds to the origin,
* i.e., all coordinates are set to zero.
+ *
+ * @note This function can also be used in CUDA device code.
*/
+ DEAL_II_CUDA_HOST_DEV
Point();
/**
* Convert a tensor to a point.
*/
- explicit Point(const Tensor<1, dim, Number> &);
+ explicit DEAL_II_CUDA_HOST_DEV
+ Point(const Tensor<1, dim, Number> &);
/**
* Constructor for one dimensional points. This function is only implemented
* for <tt>dim==1</tt> since the usage is considered unsafe for points with
* <tt>dim!=1</tt> as it would leave some components of the point
* coordinates uninitialized.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- explicit Point(const Number x);
+ explicit DEAL_II_CUDA_HOST_DEV
+ Point(const Number x);
/**
* Constructor for two dimensional points. This function is only implemented
* <tt>dim!=2</tt> as it would leave some components of the point
* coordinates uninitialized (if dim>2) or would not use some arguments (if
* dim<2).
+ *
+ * @note This function can also be used in CUDA device code.
*/
+ DEAL_II_CUDA_HOST_DEV
Point(const Number x, const Number y);
/**
* points with <tt>dim!=3</tt> as it would leave some components of the
* point coordinates uninitialized (if dim>3) or would not use some
* arguments (if dim<3).
+ *
+ * @note This function can also be used in CUDA device code.
*/
+ DEAL_II_CUDA_HOST_DEV
Point(const Number x, const Number y, const Number z);
/**
* Return a unit vector in coordinate direction <tt>i</tt>, i.e., a vector
* that is zero in all coordinates except for a single 1 in the <tt>i</tt>th
* coordinate.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- static Point<dim, Number>
- unit_vector(const unsigned int i);
+ static DEAL_II_CUDA_HOST_DEV Point<dim, Number>
+ unit_vector(const unsigned int i);
/**
* Read access to the <tt>index</tt>th coordinate.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- Number
- operator()(const unsigned int index) const;
+ DEAL_II_CUDA_HOST_DEV Number
+ operator()(const unsigned int index) const;
/**
* Read and write access to the <tt>index</tt>th coordinate.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- Number &
- operator()(const unsigned int index);
+ DEAL_II_CUDA_HOST_DEV Number &
+ operator()(const unsigned int index);
/**
* @name Addition and subtraction of points.
/**
* Add an offset given as Tensor<1,dim,Number> to a point.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- Point<dim, Number>
- operator+(const Tensor<1, dim, Number> &) const;
+ DEAL_II_CUDA_HOST_DEV Point<dim, Number>
+ operator+(const Tensor<1, dim, Number> &) const;
/**
* Subtract two points, i.e., obtain the vector that connects the two. As
* results in a vector anchored at one of the two points (rather than at the
* origin) and, consequently, the result is returned as a Tensor@<1,dim@>
* rather than as a Point@<dim@>.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- Tensor<1, dim, Number>
- operator-(const Point<dim, Number> &) const;
+ DEAL_II_CUDA_HOST_DEV Tensor<1, dim, Number>
+ operator-(const Point<dim, Number> &) const;
/**
* Subtract a difference vector (represented by a Tensor@<1,dim@>) from the
* current point. This results in another point and, as discussed in the
* documentation of this class, the result is then naturally returned as a
* Point@<dim@> object rather than as a Tensor@<1,dim@>.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- Point<dim, Number>
- operator-(const Tensor<1, dim, Number> &) const;
+ DEAL_II_CUDA_HOST_DEV Point<dim, Number>
+ operator-(const Tensor<1, dim, Number> &) const;
/**
* The opposite vector.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- Point<dim, Number>
- operator-() const;
+ DEAL_II_CUDA_HOST_DEV Point<dim, Number>
+ operator-() const;
/**
* @}
/**
* Multiply the current point by a factor.
*
+ * @note This function can also be used in CUDA device code.
+ *
* @relatesalso EnableIfScalar
*/
template <typename OtherNumber>
- Point<dim,
- typename ProductType<Number,
- typename EnableIfScalar<OtherNumber>::type>::type>
+ DEAL_II_CUDA_HOST_DEV Point<
+ dim,
+ typename ProductType<Number,
+ typename EnableIfScalar<OtherNumber>::type>::type>
operator*(const OtherNumber) const;
/**
* Divide the current point by a factor.
+ *
+ * @note This function can also be used in CUDA device code.
*/
template <typename OtherNumber>
- Point<dim,
- typename ProductType<Number,
- typename EnableIfScalar<OtherNumber>::type>::type>
+ DEAL_II_CUDA_HOST_DEV Point<
+ dim,
+ typename ProductType<Number,
+ typename EnableIfScalar<OtherNumber>::type>::type>
operator/(const OtherNumber) const;
/**
* Return the scalar product of the vectors representing two points.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- Number operator*(const Tensor<1, dim, Number> &p) const;
+ DEAL_II_CUDA_HOST_DEV Number operator*(const Tensor<1, dim, Number> &p) const;
/**
* Return the scalar product of this point vector with itself, i.e. the
* @note This function is equivalent to
* Tensor<rank,dim,Number>::norm_square() which returns the square of the
* Frobenius norm.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- typename numbers::NumberTraits<Number>::real_type
+ DEAL_II_CUDA_HOST_DEV typename numbers::NumberTraits<Number>::real_type
square() const;
/**
* Return the Euclidean distance of <tt>this</tt> point to the point
* <tt>p</tt>, i.e. the <tt>l_2</tt> norm of the difference between the
* vectors representing the two points.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- typename numbers::NumberTraits<Number>::real_type
+ DEAL_II_CUDA_HOST_DEV typename numbers::NumberTraits<Number>::real_type
distance(const Point<dim, Number> &p) const;
/**
* Return the squared Euclidean distance of <tt>this</tt> point to the point
* <tt>p</tt>.
+ *
+ * @note This function can also be used in CUDA device code.
*/
- typename numbers::NumberTraits<Number>::real_type
+ DEAL_II_CUDA_HOST_DEV typename numbers::NumberTraits<Number>::real_type
distance_square(const Point<dim, Number> &p) const;
/**
// At least clang-3.7 requires us to have a user-defined constructor
// and we can't use 'Point<dim,Number>::Point () = default' here.
template <int dim, typename Number>
-inline Point<dim, Number>::Point() // NOLINT
+inline DEAL_II_CUDA_HOST_DEV
+Point<dim, Number>::Point() // NOLINT
{}
template <int dim, typename Number>
-inline Point<dim, Number>::Point(const Tensor<1, dim, Number> &t)
+inline DEAL_II_CUDA_HOST_DEV
+Point<dim, Number>::Point(const Tensor<1, dim, Number> &t)
: Tensor<1, dim, Number>(t)
{}
template <int dim, typename Number>
-inline Point<dim, Number>::Point(const Number x)
+inline DEAL_II_CUDA_HOST_DEV
+Point<dim, Number>::Point(const Number x)
{
Assert(dim == 1,
ExcMessage(
template <int dim, typename Number>
-inline Point<dim, Number>::Point(const Number x, const Number y)
+inline DEAL_II_CUDA_HOST_DEV
+Point<dim, Number>::Point(const Number x, const Number y)
{
Assert(dim == 2,
ExcMessage(
template <int dim, typename Number>
-inline Point<dim, Number>::Point(const Number x, const Number y, const Number z)
+inline DEAL_II_CUDA_HOST_DEV
+Point<dim, Number>::Point(const Number x, const Number y, const Number z)
{
Assert(dim == 3,
ExcMessage(
template <int dim, typename Number>
-inline Point<dim, Number>
-Point<dim, Number>::unit_vector(unsigned int i)
+inline DEAL_II_CUDA_HOST_DEV Point<dim, Number>
+ Point<dim, Number>::unit_vector(unsigned int i)
{
Point<dim, Number> p;
p[i] = 1.;
template <int dim, typename Number>
-inline Number
+inline DEAL_II_CUDA_HOST_DEV Number
Point<dim, Number>::operator()(const unsigned int index) const
{
AssertIndexRange(index, dim);
template <int dim, typename Number>
-inline Number &
+inline DEAL_II_CUDA_HOST_DEV Number &
Point<dim, Number>::operator()(const unsigned int index)
{
AssertIndexRange(index, dim);
template <int dim, typename Number>
-inline Point<dim, Number>
+inline DEAL_II_CUDA_HOST_DEV Point<dim, Number>
Point<dim, Number>::operator+(const Tensor<1, dim, Number> &p) const
{
Point<dim, Number> tmp = *this;
template <int dim, typename Number>
-inline Tensor<1, dim, Number>
+inline DEAL_II_CUDA_HOST_DEV Tensor<1, dim, Number>
Point<dim, Number>::operator-(const Point<dim, Number> &p) const
{
return (Tensor<1, dim, Number>(*this) -= p);
template <int dim, typename Number>
-inline Point<dim, Number>
+inline DEAL_II_CUDA_HOST_DEV Point<dim, Number>
Point<dim, Number>::operator-(const Tensor<1, dim, Number> &p) const
{
Point<dim, Number> tmp = *this;
template <int dim, typename Number>
-inline Point<dim, Number>
+inline DEAL_II_CUDA_HOST_DEV Point<dim, Number>
Point<dim, Number>::operator-() const
{
Point<dim, Number> result;
template <int dim, typename Number>
template <typename OtherNumber>
-inline Point<
- dim,
- typename ProductType<Number,
- typename EnableIfScalar<OtherNumber>::type>::type>
- Point<dim, Number>::operator*(const OtherNumber factor) const
+inline DEAL_II_CUDA_HOST_DEV
+ Point<dim,
+ typename ProductType<Number,
+ typename EnableIfScalar<OtherNumber>::type>::type>
+ Point<dim, Number>::operator*(const OtherNumber factor) const
{
Point<dim, typename ProductType<Number, OtherNumber>::type> tmp;
for (unsigned int i = 0; i < dim; ++i)
template <int dim, typename Number>
template <typename OtherNumber>
-inline Point<
- dim,
- typename ProductType<Number,
- typename EnableIfScalar<OtherNumber>::type>::type>
-Point<dim, Number>::operator/(const OtherNumber factor) const
+inline DEAL_II_CUDA_HOST_DEV
+ Point<dim,
+ typename ProductType<Number,
+ typename EnableIfScalar<OtherNumber>::type>::type>
+ Point<dim, Number>::operator/(const OtherNumber factor) const
{
Point<dim, typename ProductType<Number, OtherNumber>::type> tmp;
for (unsigned int i = 0; i < dim; ++i)
template <int dim, typename Number>
-inline Number Point<dim, Number>::
- operator*(const Tensor<1, dim, Number> &p) const
+inline DEAL_II_CUDA_HOST_DEV Number Point<dim, Number>::
+ operator*(const Tensor<1, dim, Number> &p) const
{
Number res = Number();
for (unsigned int i = 0; i < dim; ++i)
template <int dim, typename Number>
-inline typename numbers::NumberTraits<Number>::real_type
+inline DEAL_II_CUDA_HOST_DEV typename numbers::NumberTraits<Number>::real_type
Point<dim, Number>::square() const
{
return this->norm_square();
template <int dim, typename Number>
-inline typename numbers::NumberTraits<Number>::real_type
+inline DEAL_II_CUDA_HOST_DEV typename numbers::NumberTraits<Number>::real_type
Point<dim, Number>::distance(const Point<dim, Number> &p) const
{
return std::sqrt(distance_square(p));
template <int dim, typename Number>
-inline typename numbers::NumberTraits<Number>::real_type
+inline DEAL_II_CUDA_HOST_DEV typename numbers::NumberTraits<Number>::real_type
Point<dim, Number>::distance_square(const Point<dim, Number> &p) const
{
Number sum = internal::NumberType<Number>::value(0.0);
/**
* Global operator scaling a point vector by a scalar.
*
+ * @note This function can also be used in CUDA device code.
+ *
* @relatesalso Point
* @relatesalso EnableIfScalar
*/
template <int dim, typename Number, typename OtherNumber>
-inline Point<
- dim,
- typename ProductType<Number,
- typename EnableIfScalar<OtherNumber>::type>::type>
-operator*(const OtherNumber factor, const Point<dim, Number> &p)
+inline DEAL_II_CUDA_HOST_DEV
+ Point<dim,
+ typename ProductType<Number,
+ typename EnableIfScalar<OtherNumber>::type>::type>
+ operator*(const OtherNumber factor, const Point<dim, Number> &p)
{
return p * factor;
}