16 #ifndef dealii_point_h 17 #define dealii_point_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 22 #include <deal.II/base/tensor.h> 25 DEAL_II_NAMESPACE_OPEN
103 template <
int dim,
typename Number =
double>
124 explicit Point (
const Number x);
133 Point (
const Number x,
143 Point (
const Number x,
157 Number
operator () (
const unsigned int index)
const;
210 template <
typename OtherNumber>
217 template <
typename OtherNumber>
259 template <
class Archive>
260 void serialize(Archive &ar,
const unsigned int version);
269 template <
int dim,
typename Number>
276 template <
int dim,
typename Number>
285 template <
int dim,
typename Number>
290 ExcMessage (
"You can only initialize Point<1> objects using the constructor " 291 "that takes only one argument. Point<dim> objects with dim!=1 " 292 "require initialization with the constructor that takes 'dim' " 311 template <
int dim,
typename Number>
317 ExcMessage (
"You can only initialize Point<2> objects using the constructor " 318 "that takes two arguments. Point<dim> objects with dim!=2 " 319 "require initialization with the constructor that takes 'dim' " 324 constexpr
unsigned int y_index = (dim<2)?0:1;
326 this->values[y_index] = y;
331 template <
int dim,
typename Number>
338 ExcMessage (
"You can only initialize Point<3> objects using the constructor " 339 "that takes three arguments. Point<dim> objects with dim!=3 " 340 "require initialization with the constructor that takes 'dim' " 346 constexpr
unsigned int y_index = (dim<2)?0:1;
347 constexpr
unsigned int z_index = (dim<3)?0:2;
349 this->values[y_index] = y;
350 this->values[z_index] = z;
354 template <
int dim,
typename Number>
365 template <
int dim,
typename Number>
371 return this->values[index];
376 template <
int dim,
typename Number>
382 return this->values[index];
387 template <
int dim,
typename Number>
399 template <
int dim,
typename Number>
409 template <
int dim,
typename Number>
421 template <
int dim,
typename Number>
427 for (
unsigned int i=0; i<dim; ++i)
428 result.values[i] = -this->values[i];
434 template <
int dim,
typename Number>
435 template <
typename OtherNumber>
441 for (
unsigned int i=0; i<dim; ++i)
442 tmp[i] = this->
operator[](i) * factor;
448 template <
int dim,
typename Number>
449 template <
typename OtherNumber>
455 for (
unsigned int i=0; i<dim; ++i)
456 tmp[i] = this->
operator[](i) / factor;
462 template <
int dim,
typename Number>
467 Number res = Number();
468 for (
unsigned int i=0; i<dim; ++i)
469 res += this->
operator[](i) * p[i];
474 template <
int dim,
typename Number>
479 return this->norm_square();
484 template <
int dim,
typename Number>
489 return std::sqrt(distance_square(p));
494 template <
int dim,
typename Number>
500 for (
unsigned int i=0; i<dim; ++i)
502 const Number diff=
static_cast<Number
>(this->values[i])-p(i);
511 template <
int dim,
typename Number>
512 template <
class Archive>
534 template <
int dim,
typename Number,
typename OtherNumber>
550 template <
int dim,
typename Number>
555 for (
unsigned int i=0; i<dim-1; ++i)
568 template <
int dim,
typename Number>
573 for (
unsigned int i=0; i<dim; ++i)
587 template <
typename Number>
598 DEAL_II_NAMESPACE_CLOSE
Point< dim, Number > operator-() const
Point< dim, Number > operator+(const Tensor< 1, dim, Number > &) const
#define AssertIndexRange(index, range)
Number operator()(const unsigned int index) const
static ::ExceptionBase & ExcMessage(std::string arg1)
static real_type abs_square(const number &x)
#define Assert(cond, exc)
static Point< dim, Number > unit_vector(const unsigned int i)
void serialize(Archive &ar, const unsigned int version)
numbers::NumberTraits< Number >::real_type distance(const Point< dim, Number > &p) const
SymmetricTensor< rank, dim, Number > sum(const SymmetricTensor< rank, dim, Number > &local, const MPI_Comm &mpi_communicator)
OutputOperator< VectorType > & operator<<(OutputOperator< VectorType > &out, unsigned int step)
numbers::NumberTraits< Number >::real_type square() const
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber) const
numbers::NumberTraits< Number >::real_type distance_square(const Point< dim, Number > &p) const
std::istream & operator>>(std::istream &in, Point< dim, Number > &p)
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const OtherNumber) const