Point< dim > Class Template Reference
[Geometric and other primitives]

Inheritance diagram for Point< dim >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Point ()
 Point (const bool initialize)
 Point (const Tensor< 1, dim > &)
 Point (const double x)
 Point (const double x, const double y)
 Point (const double x, const double y, const double z)
double operator() (const unsigned int index) const
doubleoperator() (const unsigned int index)
Point< dim > operator+ (const Tensor< 1, dim > &) const
Point< dim > operator- (const Tensor< 1, dim > &) const
Point< dim > operator- () const
Point< dim > operator* (const double) const
double operator* (const Tensor< 1, dim > &) const
Point< dim > operator/ (const double) const
double square () const
double distance (const Point< dim > &p) const

Related Functions

(Note that these are not member functions.)



template<int dim>
Point< dim > operator* (const double factor, const Point< dim > &p)
template<int dim>
std::ostream & operator<< (std::ostream &out, const Point< dim > &p)
template<int dim>
std::istream & operator>> (std::istream &in, Point< dim > &p)

Detailed Description

template<int dim>
class Point< dim >

The Point class provides for a point or vector in a space with arbitrary dimension dim.

It is the preferred object to be passed to functions which operate on points in spaces of a priori unknown dimension: rather than using functions like double f(double x) and double f(double x, double y), you use double f(Point<dim> &p).

Point also serves as a starting point for the implementation of the geometrical primitives like cells, edges, or faces.

Within deal.II, we use the Point class mainly to denote the points that make up geometric objects. As such, they have a small number of additional operations over general tensors of rank 1 for which we use the Tensor<1,dim> class. In particular, there is a distance() function to compute the Euclidian distance between two points in space.

The Point class is really only used where the coordinates of an object can be thought to possess the dimension of a length. For all other uses, such as the gradient of a scalar function (which is a tensor of rank 1, or vector, with as many elements as a point object, but with different physical units), we use the Tensor<1,dim> class.

Author:
Wolfgang Bangerth, 1997

Constructor & Destructor Documentation

template<int dim>
Point< dim >::Point (  ) 

Standard constructor. Creates an origin.

template<int dim>
Point< dim >::Point ( const bool  initialize  )  [explicit]

Constructor. Initialize all entries to zero if initialize==true.

template<int dim>
Point< dim >::Point ( const Tensor< 1, dim > &   ) 

Convert a tensor to a point. Since no additional data is inside a point, this is ok.

template<int dim>
Point< dim >::Point ( const double  x  )  [explicit]

Constructor for one dimensional points. This function is only implemented for dim==1 since the usage is considered unsafe for points with dim!=1.

template<int dim>
Point< dim >::Point ( const double  x,
const double  y 
)

Constructor for two dimensional points. This function is only implemented for dim==2 since the usage is considered unsafe for points with dim!=2.

template<int dim>
Point< dim >::Point ( const double  x,
const double  y,
const double  z 
)

Constructor for three dimensional points. This function is only implemented for dim==3 since the usage is considered unsafe for points with dim!=3.


Member Function Documentation

template<int dim>
double Point< dim >::operator() ( const unsigned int  index  )  const

Read access to the indexth coordinate.

template<int dim>
double& Point< dim >::operator() ( const unsigned int  index  ) 

Read and write access to the indexth coordinate.

template<int dim>
Point<dim> Point< dim >::operator+ ( const Tensor< 1, dim > &   )  const

Add two point vectors. If possible, use operator += instead since this does not need to copy a point at least once.

template<int dim>
Point<dim> Point< dim >::operator- ( const Tensor< 1, dim > &   )  const

Subtract two point vectors. If possible, use operator += instead since this does not need to copy a point at least once.

template<int dim>
Point<dim> Point< dim >::operator- (  )  const

The opposite vector.

Reimplemented from Tensor< 1, dim >.

template<int dim>
Point<dim> Point< dim >::operator* ( const   double  )  const

Multiply by a factor. If possible, use operator *= instead since this does not need to copy a point at least once.

There is a commutative complement to this function also

template<int dim>
double Point< dim >::operator* ( const Tensor< 1, dim > &   )  const

Returns the scalar product of two vectors.

template<int dim>
Point<dim> Point< dim >::operator/ ( const   double  )  const

Divide by a factor. If possible, use operator /= instead since this does not need to copy a point at least once.

template<int dim>
double Point< dim >::square (  )  const

Returns the scalar product of this point vector with itself, i.e. the square, or the square of the norm.

template<int dim>
double Point< dim >::distance ( const Point< dim > &  p  )  const

Returns the Euclidian distance of this point to the point p, i.e. the l_2 norm of the difference between the vectors representing the two points.


Friends And Related Function Documentation

template<int dim>
Point< dim > operator* ( const double  factor,
const Point< dim > &  p 
) [related]

Global operator scaling a point vector by a scalar.

template<int dim>
std::ostream & operator<< ( std::ostream &  out,
const Point< dim > &  p 
) [related]

Output operator for points. Print the elements consecutively, with a space in between.

template<int dim>
std::istream & operator>> ( std::istream &  in,
Point< dim > &  p 
) [related]

Output operator for points. Print the elements consecutively, with a space in between.


The documentation for this class was generated from the following file:

deal.II documentation generated on Mon Nov 23 22:57:59 2009 by doxygen 1.6.1