16 #ifndef dealii_point_h
17 #define dealii_point_h
26 #include <boost/geometry/core/cs.hpp>
27 #include <boost/geometry/geometries/point.hpp>
109 template <
int dim,
typename Number =
double>
149 Point(
const Number x,
const Number y);
161 Point(
const Number x,
const Number y,
const Number z);
166 template <std::size_t dummy_dim,
167 typename std::enable_if<(dim == dummy_dim) && (dummy_dim != 0),
169 Point(
const boost::geometry::model::
170 point<Number, dummy_dim, boost::geometry::cs::cartesian> &boost_pt);
203 template <
typename OtherNumber>
267 template <
typename OtherNumber>
279 template <
typename OtherNumber>
337 template <
class Archive>
348 template <
int dim,
typename Number>
355 template <
int dim,
typename Number>
358 :
Tensor<1, dim, Number>(t)
363 template <
int dim,
typename Number>
367 # ifndef __CUDA_ARCH__
370 "You can only initialize Point<1> objects using the constructor "
371 "that takes only one argument. Point<dim> objects with dim!=1 "
372 "require initialization with the constructor that takes 'dim' "
391 template <
int dim,
typename Number>
395 # ifndef __CUDA_ARCH__
398 "You can only initialize Point<2> objects using the constructor "
399 "that takes two arguments. Point<dim> objects with dim!=2 "
400 "require initialization with the constructor that takes 'dim' "
407 constexpr
unsigned int y_index = (dim < 2) ? 0 : 1;
409 this->
values[y_index] = y;
414 template <
int dim,
typename Number>
418 # ifndef __CUDA_ARCH__
421 "You can only initialize Point<3> objects using the constructor "
422 "that takes three arguments. Point<dim> objects with dim!=3 "
423 "require initialization with the constructor that takes 'dim' "
430 constexpr
unsigned int y_index = (dim < 2) ? 0 : 1;
431 constexpr
unsigned int z_index = (dim < 3) ? 0 : 2;
433 this->
values[y_index] = y;
434 this->
values[z_index] = z;
439 template <
int dim,
typename Number>
441 std::size_t dummy_dim,
442 typename std::enable_if<(dim == dummy_dim) && (dummy_dim != 0),
int>::type>
444 const boost::geometry::model::
445 point<Number, dummy_dim, boost::geometry::cs::cartesian> &boost_pt)
448 this->
values[0] = boost::geometry::get<0>(boost_pt);
449 constexpr
unsigned int y_index = (dim < 2) ? 0 : 1;
450 constexpr
unsigned int z_index = (dim < 3) ? 0 : 2;
453 this->
values[y_index] = boost::geometry::get<y_index>(boost_pt);
456 this->
values[z_index] = boost::geometry::get<z_index>(boost_pt);
461 template <
int dim,
typename Number>
471 template <
int dim,
typename Number>
475 # ifndef __CUDA_ARCH__
478 return this->
values[index];
483 template <
int dim,
typename Number>
487 # ifndef __CUDA_ARCH__
490 return this->
values[index];
495 template <
int dim,
typename Number>
496 template <
typename OtherNumber>
506 template <
int dim,
typename Number>
517 template <
int dim,
typename Number>
526 template <
int dim,
typename Number>
537 template <
int dim,
typename Number>
542 for (
unsigned int i = 0; i < dim; ++i)
543 result.
values[i] = -this->values[i];
549 template <
int dim,
typename Number>
550 template <
typename OtherNumber>
558 for (
unsigned int i = 0; i < dim; ++i)
559 tmp[i] = this->
operator[](i) * factor;
565 template <
int dim,
typename Number>
566 template <
typename OtherNumber>
578 ::operator/(base_object, factor));
583 template <
int dim,
typename Number>
587 Number res = Number();
588 for (
unsigned int i = 0; i < dim; ++i)
589 res += this->
operator[](i) * p[i];
594 template <
int dim,
typename Number>
603 template <
int dim,
typename Number>
612 template <
int dim,
typename Number>
617 for (
unsigned int i = 0; i < dim; ++i)
619 const Number diff =
static_cast<Number
>(this->
values[i]) - p(i);
628 template <
int dim,
typename Number>
629 template <
class Archive>
652 template <
int dim,
typename Number,
typename OtherNumber>
669 template <
int dim,
typename Number>
670 inline std::ostream &
673 for (
unsigned int i = 0; i < dim - 1; ++i)
686 template <
int dim,
typename Number>
687 inline std::istream &
690 for (
unsigned int i = 0; i < dim; ++i)
704 template <
typename Number>
705 inline std::ostream &
OutputOperator< VectorType > & operator<<(OutputOperator< VectorType > &out, unsigned int step)
numbers::NumberTraits< Number >::real_type distance_square(const Point< dim, Number > &p) const
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const OtherNumber) const
Tensor< 1, dim, Number > operator-(const Point< dim, Number > &) const
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber) const
Number operator*(const Tensor< 1, dim, Number > &p) const
Number & operator()(const unsigned int index)
numbers::NumberTraits< Number >::real_type distance(const Point< dim, Number > &p) const
Point(const boost::geometry::model::point< Number, dummy_dim, boost::geometry::cs::cartesian > &boost_pt)
Point(const Tensor< 1, dim, Number > &)
Point(const Number x, const Number y, const Number z)
Point< dim, Number > & operator=(const Tensor< 1, dim, OtherNumber > &p)
Point< dim, Number > operator-(const Tensor< 1, dim, Number > &) const
void serialize(Archive &ar, const unsigned int version)
numbers::NumberTraits< Number >::real_type square() const
std::istream & operator>>(std::istream &in, Point< dim, Number > &p)
Point< dim, Number > operator-() const
Point< dim, Number > operator+(const Tensor< 1, dim, Number > &) const
Point(const Number x, const Number y)
static Point< dim, Number > unit_vector(const unsigned int i)
Number operator()(const unsigned int index) const
constexpr Tensor & operator=(const Tensor< rank_, dim, OtherNumber > &rhs)
constexpr numbers::NumberTraits< double >::real_type norm_square() const
Tensor< rank_ - 1, dim, double > values[(dim !=0) ? dim :1]
Tensor< rank, dim, double > sum(const Tensor< rank, dim, double > &local, const MPI_Comm &mpi_communicator)
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define DEAL_II_CUDA_HOST_DEV
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber factor, const Point< dim, Number > &p)
static constexpr const T & value(const T &t)
static constexpr std::enable_if< std::is_same< Dummy, number >::value &&is_cuda_compatible< Dummy >::value, real_type >::type abs_square(const number &x)