26#include <boost/geometry/core/cs.hpp>
27#include <boost/geometry/geometries/point.hpp>
110template <
int dim,
typename Number =
double>
151 Point(
const Number x,
const Number y);
163 Point(
const Number x,
const Number y,
const Number z);
168 template <std::size_t dummy_dim,
169 std::enable_if_t<(dim == dummy_dim) && (dummy_dim != 0),
int> = 0>
171 const boost::geometry::model::
172 point<Number, dummy_dim,
boost::geometry::cs::cartesian> &boost_pt);
205 template <
typename OtherNumber>
269 template <
typename OtherNumber>
281 template <
typename OtherNumber>
341 template <
class Archive>
352template <
int dim,
typename Number>
359template <
int dim,
typename Number>
362 const
Tensor<1, dim, Number> &t)
363 :
Tensor<1, dim, Number>(t)
368template <
int dim,
typename Number>
374 "You can only initialize Point<1> objects using the constructor "
375 "that takes only one argument. Point<dim> objects with dim!=1 "
376 "require initialization with the constructor that takes 'dim' "
394template <
int dim,
typename Number>
401 "You can only initialize Point<2> objects using the constructor "
402 "that takes two arguments. Point<dim> objects with dim!=2 "
403 "require initialization with the constructor that takes 'dim' "
409 constexpr unsigned int y_index = (dim < 2) ? 0 : 1;
411 this->
values[y_index] = y;
416template <
int dim,
typename Number>
424 "You can only initialize Point<3> objects using the constructor "
425 "that takes three arguments. Point<dim> objects with dim!=3 "
426 "require initialization with the constructor that takes 'dim' "
432 constexpr unsigned int y_index = (dim < 2) ? 0 : 1;
433 constexpr unsigned int z_index = (dim < 3) ? 0 : 2;
435 this->
values[y_index] = y;
436 this->
values[z_index] = z;
441template <
int dim,
typename Number>
443template <
std::
size_t dummy_dim,
444 std::enable_if_t<(dim == dummy_dim) && (dummy_dim != 0),
int>>
446 const
boost::geometry::model::
447 point<Number, dummy_dim,
boost::geometry::cs::cartesian> &boost_pt)
450 this->
values[0] = boost::geometry::get<0>(boost_pt);
451 constexpr unsigned int y_index = (dim < 2) ? 0 : 1;
452 constexpr unsigned int z_index = (dim < 3) ? 0 : 2;
455 this->
values[y_index] = boost::geometry::get<y_index>(boost_pt);
458 this->
values[z_index] = boost::geometry::get<z_index>(boost_pt);
463template <
int dim,
typename Number>
466 Point<dim, Number>
Point<dim, Number>::unit_vector(
unsigned int i)
474template <
int dim,
typename Number>
477 const
unsigned int index)
const
485template <
int dim,
typename Number>
488 const
unsigned int index)
496template <
int dim,
typename Number>
498template <typename OtherNumber>
500 &
Point<dim, Number>::operator=(const
Tensor<1, dim, OtherNumber> &p)
508template <
int dim,
typename Number>
511 const
Tensor<1, dim, Number> &p)
const
520template <
int dim,
typename Number>
523 Tensor<1, dim, Number>
Point<dim, Number>::operator-(
524 const
Point<dim, Number> &p)
const
531template <
int dim,
typename Number>
534 const
Tensor<1, dim, Number> &p)
const
543template <
int dim,
typename Number>
549 for (
unsigned int i = 0; i < dim; ++i)
550 result.
values[i] = -this->values[i];
556template <
int dim,
typename Number>
558template <typename OtherNumber>
562 type>
Point<dim, Number>::operator*(const OtherNumber factor)
const
565 for (
unsigned int i = 0; i < dim; ++i)
566 tmp[i] = this->
operator[](i) * factor;
572template <
int dim,
typename Number>
574template <typename OtherNumber>
578 type>
Point<dim, Number>::operator/(const OtherNumber factor)
const
585 ::operator/(base_object, factor));
590template <
int dim,
typename Number>
593 const
Tensor<1, dim, Number> &p)
const
595 Number res = Number();
596 for (
unsigned int i = 0; i < dim; ++i)
597 res += this->
operator[](i) * p[i];
602template <
int dim,
typename Number>
605 Point<dim, Number>::square()
const
607 return this->norm_square();
612template <
int dim,
typename Number>
615 Point<dim, Number>::distance(const
Point<dim, Number> &p)
const
622template <
int dim,
typename Number>
625 Point<dim, Number>::distance_square(const
Point<dim, Number> &p)
const
628 for (
unsigned int i = 0; i < dim; ++i)
630 const Number diff =
static_cast<Number
>(this->
values[i]) - p[i];
639template <
int dim,
typename Number>
641template <class Archive>
642inline
void Point<dim, Number>::serialize(Archive &ar, const
unsigned int)
662template <
int dim,
typename Number,
typename OtherNumber>
681template <
int dim,
typename Number>
684operator<<(
std::ostream &out, const
Point<dim, Number> &p)
686 for (
unsigned int i = 0; i < dim - 1; ++i)
701template <
int dim,
typename Number>
706 for (
unsigned int i = 0; i < dim; ++i)
720template <
typename Number>
std::ostream & operator<<(std::ostream &out, const Point< dim, Number > &p)
constexpr Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber) const
constexpr Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const OtherNumber) const
constexpr Tensor< 1, dim, Number > operator-(const Point< dim, Number > &) const
constexpr Point(const boost::geometry::model::point< Number, dummy_dim, boost::geometry::cs::cartesian > &boost_pt)
constexpr Point< dim, Number > & operator=(const Tensor< 1, dim, OtherNumber > &p)
constexpr numbers::NumberTraits< Number >::real_type distance_square(const Point< dim, Number > &p) const
constexpr Number & operator()(const unsigned int index)
constexpr Point(const Number x, const Number y)
constexpr Point< dim, Number > operator+(const Tensor< 1, dim, Number > &) const
constexpr Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber factor, const Point< dim, Number > &p)
constexpr Point(const Number x, const Number y, const Number z)
static constexpr Point< dim, Number > unit_vector(const unsigned int i)
constexpr Point< dim, Number > operator-() const
constexpr Point(const Number x)
void serialize(Archive &ar, const unsigned int version)
constexpr Point(const Tensor< 1, dim, Number > &)
numbers::NumberTraits< Number >::real_type distance(const Point< dim, Number > &p) const
constexpr numbers::NumberTraits< Number >::real_type square() const
constexpr Number operator()(const unsigned int index) const
constexpr Point< dim, Number > operator-(const Tensor< 1, dim, Number > &) const
constexpr Number operator*(const Tensor< 1, dim, Number > &p) const
std::conditional_t< rank_==1, std::array< Number, dim >, std::array< Tensor< rank_ - 1, dim, Number >, dim > > values
constexpr Tensor & operator=(const Tensor< rank_, dim, OtherNumber > &rhs)
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_HOST_DEVICE
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
T sum(const T &t, const MPI_Comm mpi_communicator)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
static constexpr const T & value(const T &t)
static constexpr real_type abs_square(const number &x)