OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
Point< dim, T > Class Template Reference

This class implement the point shape in an N-dimensional space. More...

Detailed Description

template<unsigned int dim, typename T>
class Point< dim, T >

This class implement the point shape in an N-dimensional space.

Parameters
Ttype of the space
dimdimensionality

Definition at line 22 of file Point.hpp.

#include <Point.hpp>

Public Types

typedef int is_vtk_writable
 Indicate that this object is vtk writable.
 
typedef T coord_type
 coordinate type
 
typedef boost::fusion::vector
< T[dim]> 
type
 boost fusion that store the point
 

Public Member Functions

template<typename orig , typename exp1 , typename exp2 , unsigned int op>
 Point (const point_expression_op< orig, exp1, exp2, op > &p_exp)
 Evaluate the expression and save the result on the point. More...
 
 Point (const Point< dim, T > &&p)
 Point constructor from point. More...
 
 Point (const Point< dim, T > &p)
 Point constructor from point. More...
 
 Point (const T(&p)[dim])
 Constructor from an array. More...
 
 Point (T d)
 Constructor from scalar. More...
 
template<typename S >
 Point (const Point< dim, S > &p)
 Point constructor. More...
 
template<unsigned int d, typename M >
 Point (const encapc< d, Point< dim, T >, M > &p)
 Point constructor. More...
 
 Point (std::initializer_list< T > p1)
 Constructor from a list. More...
 
 Point ()
 Default contructor.
 
const T & get (size_t i) const
 Get coordinate. More...
 
get_vtk (size_t i) const
 Get coordinate. More...
 
T & get (size_t i)
 Get coordinate. More...
 
T & operator[] (size_t i)
 Get the component i. More...
 
const T & operator[] (size_t i) const
 Get the component i. More...
 
norm ()
 norm of the vector More...
 
distance (const Point< dim, T > &q)
 It calculate the distance between 2 points. More...
 
distance2 (const Point< dim, T > &q)
 It calculate the square distance between 2 points. More...
 
void zero ()
 Set to zero the point coordinate. More...
 
void one ()
 Set to one the point coordinate. More...
 
std::string toPointString () const
 Convert the point into a string. More...
 
void swap (Point< dim, T > &p)
 exchange the data of two points More...
 
bool operator== (const Point< dim, T > &p)
 Check if two points match. More...
 
bool operator!= (const Point< dim, T > &p)
 Check if two points match. More...
 
std::string to_string () const
 Return the string with the point coordinate. More...
 
std::string toString () const
 Return the string with the point coordinate. More...
 
T & value (size_t i)
 Return the reference to the value at coordinate i. More...
 
value (size_t i) const
 Return the value at coordinate i. More...
 
T(& asArray ())[dim]
 Return the coordinated of the point as reference array. More...
 
template<typename A >
Point< dim, A > convertPoint () const
 
template<typename orig , typename exp1 , typename exp2 , unsigned int op>
Point< dim, T > & operator= (const point_expression_op< orig, exp1, exp2, op > &p_exp)
 Fill the vector with the evaluated expression. More...
 
Point< dim, T > & operator= (const point_expression< T[dim]> &p_exp)
 Fill the vector property with the evaluated expression. More...
 
Point< dim, T > & operator= (const T(&p)[dim])
 Fill the point with the value specified in the array. More...
 
template<typename T1 , typename check = typename std::enable_if<std::is_const<T1>::value == false>::type>
Point< dim, T > & operator= (const point_expression< const T1[dim]> &p_exp)
 Fill the vector property with the evaluated expression. More...
 
template<typename aT >
Point< dim, T > operator/ (const aT(&ar)[dim])
 divide each component by an array More...
 
template<typename aT >
Point< dim, T > operator/= (const aT c)
 divide each component by a constant More...
 
Point< dim, T > & operator= (T d)
 Fill the vector property with some value. More...
 
Point< dim, T > & operator= (const Point< dim, T > &p)
 operator= between points More...
 
Point< dim, T > & operator-= (const Point< dim, T > &p)
 Subtract two points. More...
 
Point< dim, T > & operator+= (const Point< dim, T > &p)
 Sum two points. More...
 
void init () const
 Do nothing stub operation. More...
 

Static Public Member Functions

static Point< dim, T > zero_p ()
 Create a point set to zero. More...
 
static bool noPointers ()
 This structure has no internal pointers.
 

Data Fields

type data
 structure that store the data of the point
 

Static Public Attributes

static const unsigned int x = 0
 Property id of the point.
 
static const unsigned int max_prop = 1
 The point has one property.
 
static const unsigned int max_prop_real = 1
 
static const unsigned int dims = dim
 expose the dimension
 
static const unsigned int nvals = dim
 expose the dimension with a different name
 

Constructor & Destructor Documentation

template<unsigned int dim, typename T>
template<typename orig , typename exp1 , typename exp2 , unsigned int op>
Point< dim, T >::Point ( const point_expression_op< orig, exp1, exp2, op > &  p_exp)
inline

Evaluate the expression and save the result on the point.

Parameters
p_exppoint expression to evaluate

Definition at line 47 of file Point.hpp.

template<unsigned int dim, typename T>
Point< dim, T >::Point ( const Point< dim, T > &&  p)
inline

Point constructor from point.

Parameters
pthe point

Definition at line 57 of file Point.hpp.

template<unsigned int dim, typename T>
Point< dim, T >::Point ( const Point< dim, T > &  p)
inline

Point constructor from point.

Parameters
pthe point

Definition at line 68 of file Point.hpp.

template<unsigned int dim, typename T>
Point< dim, T >::Point ( const T(&)  p[dim])
inline

Constructor from an array.

Parameters
parray with the coordinate of the point

Definition at line 79 of file Point.hpp.

template<unsigned int dim, typename T>
Point< dim, T >::Point ( d)
inline

Constructor from scalar.

Parameters
dscalar

Definition at line 90 of file Point.hpp.

template<unsigned int dim, typename T>
template<typename S >
Point< dim, T >::Point ( const Point< dim, S > &  p)
inline

Point constructor.

Parameters
pPoint

Definition at line 100 of file Point.hpp.

template<unsigned int dim, typename T>
template<unsigned int d, typename M >
Point< dim, T >::Point ( const encapc< d, Point< dim, T >, M > &  p)
inline

Point constructor.

Parameters
pencapc Point

Definition at line 111 of file Point.hpp.

template<unsigned int dim, typename T>
Point< dim, T >::Point ( std::initializer_list< T >  p1)
inline

Constructor from a list.

[Example] Point<3,float> p({0.0,0.0,1.0})

Parameters
p1initializer list

Definition at line 124 of file Point.hpp.

Member Function Documentation

template<unsigned int dim, typename T>
T(& Point< dim, T >::asArray ( ) )[dim]
inline

Return the coordinated of the point as reference array.

Returns
the reference array

Definition at line 413 of file Point.hpp.

template<unsigned int dim, typename T>
template<typename A >
Point<dim,A> Point< dim, T >::convertPoint ( ) const
inline

Convert the point from Point<dim,T> to Point<dim,A>

Returns
the converted point

Definition at line 423 of file Point.hpp.

template<unsigned int dim, typename T>
T Point< dim, T >::distance ( const Point< dim, T > &  q)
inline

It calculate the distance between 2 points.

The distance between itself (p) and the other point (q)

Parameters
qtarget point
Returns
the distance

Definition at line 221 of file Point.hpp.

template<unsigned int dim, typename T>
T Point< dim, T >::distance2 ( const Point< dim, T > &  q)
inline

It calculate the square distance between 2 points.

The distance between itself (p) and the other point (q)

Parameters
qtarget point
Returns
the square of the distance

Definition at line 240 of file Point.hpp.

template<unsigned int dim, typename T>
const T& Point< dim, T >::get ( size_t  i) const
inline

Get coordinate.

Parameters
idimension
Returns
the i-coordinate of the point

Definition at line 142 of file Point.hpp.

template<unsigned int dim, typename T>
T& Point< dim, T >::get ( size_t  i)
inline

Get coordinate.

Parameters
idimension
Returns
the i-coordinate of the point

Definition at line 166 of file Point.hpp.

template<unsigned int dim, typename T>
T Point< dim, T >::get_vtk ( size_t  i) const
inline

Get coordinate.

Parameters
idimension
Returns
the i-coordinate of the point

Definition at line 154 of file Point.hpp.

template<unsigned int dim, typename T>
void Point< dim, T >::init ( ) const
inline

Do nothing stub operation.

Required to make the code compilable

Definition at line 610 of file Point.hpp.

template<unsigned int dim, typename T>
T Point< dim, T >::norm ( )
inline

norm of the vector

Returns
the norm of the vector

Definition at line 202 of file Point.hpp.

template<unsigned int dim, typename T>
void Point< dim, T >::one ( )
inline

Set to one the point coordinate.

Definition at line 267 of file Point.hpp.

template<unsigned int dim, typename T>
bool Point< dim, T >::operator!= ( const Point< dim, T > &  p)
inline

Check if two points match.

Parameters
ppoint to compare with
Returns
true if two points match

Definition at line 349 of file Point.hpp.

template<unsigned int dim, typename T>
Point<dim,T>& Point< dim, T >::operator+= ( const Point< dim, T > &  p)
inline

Sum two points.

Parameters
ppoint to sum
Returns
itself

Definition at line 597 of file Point.hpp.

template<unsigned int dim, typename T>
Point<dim,T>& Point< dim, T >::operator-= ( const Point< dim, T > &  p)
inline

Subtract two points.

Parameters
ppoint to subtract
Returns
itself

Definition at line 582 of file Point.hpp.

template<unsigned int dim, typename T>
template<typename aT >
Point<dim,T> Point< dim, T >::operator/ ( const aT(&)  ar[dim])
inline

divide each component by an array

Parameters
arComponent wise division
Returns
itself

Definition at line 519 of file Point.hpp.

template<unsigned int dim, typename T>
template<typename aT >
Point<dim,T> Point< dim, T >::operator/= ( const aT  c)
inline

divide each component by a constant

Parameters
cconstant
Returns
itself

Definition at line 536 of file Point.hpp.

template<unsigned int dim, typename T>
template<typename orig , typename exp1 , typename exp2 , unsigned int op>
Point<dim,T>& Point< dim, T >::operator= ( const point_expression_op< orig, exp1, exp2, op > &  p_exp)
inline

Fill the vector with the evaluated expression.

Parameters
p_expexpression to evaluate
Returns
itself

Definition at line 451 of file Point.hpp.

template<unsigned int dim, typename T>
Point<dim,T>& Point< dim, T >::operator= ( const point_expression< T[dim]> &  p_exp)
inline

Fill the vector property with the evaluated expression.

Parameters
p_expexpression to evaluate
Returns
itself

Definition at line 468 of file Point.hpp.

template<unsigned int dim, typename T>
Point<dim,T>& Point< dim, T >::operator= ( const T(&)  p[dim])
inline

Fill the point with the value specified in the array.

Parameters
parray
Returns
itself

Definition at line 485 of file Point.hpp.

template<unsigned int dim, typename T>
template<typename T1 , typename check = typename std::enable_if<std::is_const<T1>::value == false>::type>
Point<dim,T>& Point< dim, T >::operator= ( const point_expression< const T1[dim]> &  p_exp)
inline

Fill the vector property with the evaluated expression.

Template Parameters
checkdisable this method if T is a constant
Parameters
p_expexpression to evaluate
Returns
itself

Definition at line 502 of file Point.hpp.

template<unsigned int dim, typename T>
Point<dim,T>& Point< dim, T >::operator= ( d)
inline

Fill the vector property with some value.

Parameters
dvalue to fill
Returns
itself

Definition at line 552 of file Point.hpp.

template<unsigned int dim, typename T>
Point<dim,T>& Point< dim, T >::operator= ( const Point< dim, T > &  p)
inline

operator= between points

Parameters
pPoint
Returns
itself

Definition at line 567 of file Point.hpp.

template<unsigned int dim, typename T>
bool Point< dim, T >::operator== ( const Point< dim, T > &  p)
inline

Check if two points match.

Parameters
ppoint to compare with
Returns
true if two points match

Definition at line 331 of file Point.hpp.

template<unsigned int dim, typename T>
T& Point< dim, T >::operator[] ( size_t  i)
inline

Get the component i.

Parameters
icomponent
Returns
the i-component

Definition at line 179 of file Point.hpp.

template<unsigned int dim, typename T>
const T& Point< dim, T >::operator[] ( size_t  i) const
inline

Get the component i.

Parameters
icomponent
Returns
the i-component

Definition at line 192 of file Point.hpp.

template<unsigned int dim, typename T>
void Point< dim, T >::swap ( Point< dim, T > &  p)
inline

exchange the data of two points

Parameters
pPoint to swap with

Definition at line 314 of file Point.hpp.

template<unsigned int dim, typename T>
std::string Point< dim, T >::to_string ( ) const
inline

Return the string with the point coordinate.

Returns
the string

Definition at line 361 of file Point.hpp.

template<unsigned int dim, typename T>
std::string Point< dim, T >::toPointString ( ) const
inline

Convert the point into a string.

Returns
the string

Definition at line 297 of file Point.hpp.

template<unsigned int dim, typename T>
std::string Point< dim, T >::toString ( ) const
inline

Return the string with the point coordinate.

Returns
the string

Definition at line 371 of file Point.hpp.

template<unsigned int dim, typename T>
T& Point< dim, T >::value ( size_t  i)
inline

Return the reference to the value at coordinate i.

Parameters
icoordinate to return
Returns
the reference

Definition at line 391 of file Point.hpp.

template<unsigned int dim, typename T>
T Point< dim, T >::value ( size_t  i) const
inline

Return the value at coordinate i.

Parameters
icoordinate to return
Returns
the value

Definition at line 403 of file Point.hpp.

template<unsigned int dim, typename T>
void Point< dim, T >::zero ( )
inline

Set to zero the point coordinate.

Definition at line 255 of file Point.hpp.

template<unsigned int dim, typename T>
static Point<dim,T> Point< dim, T >::zero_p ( )
inlinestatic

Create a point set to zero.

Returns
a point with all coorfinate set to 0

Definition at line 280 of file Point.hpp.


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