OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
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 27 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
 
typedef int yes_is_point
 Indicate that is a Point.
 
typedef native_encapsulated_type< T[dim]>::type type_native
 

Public Member Functions

template<typename orig , typename exp1 , typename exp2 , unsigned int op>
__device__ __host__ Point (const point_expression_op< orig, exp1, exp2, op > &p_exp)
 Evaluate the expression and save the result on the point. More...
 
__device__ __host__ Point (const Point< dim, T > &&p)
 Point constructor from point. More...
 
__device__ __host__ Point (const Point< dim, T > &p)
 Point constructor from point. More...
 
__device__ __host__ Point (const T(&p)[dim])
 Constructor from an array. More...
 
__device__ __host__ Point (T d)
 Constructor from scalar. More...
 
template<typename S >
__device__ __host__ 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...
 
template<typename vmpl >
__device__ __host__ Point (const openfpm::detail::multi_array::sub_array_openfpm< T, 1, vmpl > &mar)
 Point constructor from multi array. More...
 
template<typename vmpl >
__device__ __host__ Point (const openfpm::detail::multi_array::const_sub_array_openfpm< T, 1, vmpl > &mar)
 Point constructor from multi array. More...
 
__device__ __host__ Point (std::initializer_list< T > p1)
 Constructor from a list. More...
 
__device__ __host__ Point ()
 Default contructor.
 
__device__ __host__ const T & get (unsigned int i) const
 Get coordinate. More...
 
get_vtk (size_t i) const
 Get coordinate. More...
 
__device__ __host__ T & get (unsigned int i)
 Get coordinate. More...
 
__device__ __host__ T & operator[] (unsigned int i)
 Get the component i. More...
 
__device__ __host__ const T & operator[] (unsigned int i) const
 Get the component i. More...
 
__device__ __host__ T norm ()
 norm of the vector More...
 
__device__ __host__ T distance (const Point< dim, T > &q) const
 It calculate the distance between 2 points. More...
 
distance2 (const Point< dim, T > &q) const
 It calculate the square distance between 2 points. More...
 
__device__ __host__ 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...
 
__device__ __host__ bool operator== (const Point< dim, T > &p) const
 Check if two points match. More...
 
__device__ __host__ bool operator!= (const Point< dim, T > &p) const
 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...
 
__device__ __host__ T 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>
__device__ __host__ Point< dim, T > & operator= (const point_expression_op< orig, exp1, exp2, op > &p_exp)
 Fill the vector with the evaluated expression. More...
 
template<typename any >
__device__ __host__ Point< dim, T > & operator= (const point_expression< any > &p_exp)
 Fill the vector property with the evaluated expression. More...
 
__device__ __host__ 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>
__device__ __host__ Point< dim, T > & operator= (const point_expression< const T1[dim]> &p_exp)
 Fill the vector property with the evaluated expression. More...
 
template<typename aT >
__device__ __host__ Point< dim, T > operator/ (const aT(&ar)[dim])
 divide each component by an array More...
 
template<typename aT >
__device__ __host__ Point< dim, T > operator/= (const aT c)
 divide each component by a constant More...
 
__device__ __host__ Point< dim, T > & operator= (T d)
 Fill the vector property with some value. More...
 
__device__ __host__ Point< dim, T > & operator= (const Point< dim, T > &p)
 operator= between points More...
 
__device__ __host__ Point< dim, T > & operator-= (const Point< dim, T > &p)
 Subtract two points. More...
 
__device__ __host__ Point< dim, T > & operator+= (const Point< dim, T > &p)
 Sum two points. More...
 
__device__ __host__ 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

◆ Point() [1/10]

template<unsigned int dim, typename T>
template<typename orig , typename exp1 , typename exp2 , unsigned int op>
__device__ __host__ 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 56 of file Point.hpp.

◆ Point() [2/10]

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

Point constructor from point.

Parameters
pthe point

Definition at line 66 of file Point.hpp.

◆ Point() [3/10]

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

Point constructor from point.

Parameters
pthe point

Definition at line 77 of file Point.hpp.

◆ Point() [4/10]

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

Constructor from an array.

Parameters
parray with the coordinate of the point

Definition at line 88 of file Point.hpp.

◆ Point() [5/10]

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

Constructor from scalar.

Parameters
dscalar

Definition at line 99 of file Point.hpp.

◆ Point() [6/10]

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

Point constructor.

Parameters
pPoint

Definition at line 109 of file Point.hpp.

◆ Point() [7/10]

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 120 of file Point.hpp.

◆ Point() [8/10]

template<unsigned int dim, typename T>
template<typename vmpl >
__device__ __host__ Point< dim, T >::Point ( const openfpm::detail::multi_array::sub_array_openfpm< T, 1, vmpl > &  mar)
inline

Point constructor from multi array.

Definition at line 131 of file Point.hpp.

◆ Point() [9/10]

template<unsigned int dim, typename T>
template<typename vmpl >
__device__ __host__ Point< dim, T >::Point ( const openfpm::detail::multi_array::const_sub_array_openfpm< T, 1, vmpl > &  mar)
inline

Point constructor from multi array.

Definition at line 142 of file Point.hpp.

◆ Point() [10/10]

template<unsigned int dim, typename T>
__device__ __host__ 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 155 of file Point.hpp.

Member Function Documentation

◆ asArray()

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 441 of file Point.hpp.

◆ convertPoint()

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 451 of file Point.hpp.

◆ distance()

template<unsigned int dim, typename T>
__device__ __host__ T Point< dim, T >::distance ( const Point< dim, T > &  q) const
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 250 of file Point.hpp.

◆ distance2()

template<unsigned int dim, typename T>
T Point< dim, T >::distance2 ( const Point< dim, T > &  q) const
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 269 of file Point.hpp.

◆ get() [1/2]

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

Get coordinate.

Parameters
idimension
Returns
the i-coordinate of the point

Definition at line 172 of file Point.hpp.

◆ get() [2/2]

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

Get coordinate.

Parameters
idimension
Returns
the i-coordinate of the point

Definition at line 195 of file Point.hpp.

◆ get_vtk()

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 184 of file Point.hpp.

◆ init()

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

Do nothing stub operation.

Required to make the code compilable

Definition at line 639 of file Point.hpp.

◆ norm()

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

norm of the vector

Returns
the norm of the vector

Definition at line 231 of file Point.hpp.

◆ one()

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

Set to one the point coordinate.

Definition at line 296 of file Point.hpp.

◆ operator!=()

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

Check if two points match.

Parameters
ppoint to compare with
Returns
true if two points match

Definition at line 378 of file Point.hpp.

◆ operator+=()

template<unsigned int dim, typename T>
__device__ __host__ 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 626 of file Point.hpp.

◆ operator-=()

template<unsigned int dim, typename T>
__device__ __host__ 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 611 of file Point.hpp.

◆ operator/()

template<unsigned int dim, typename T>
template<typename aT >
__device__ __host__ 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 548 of file Point.hpp.

◆ operator/=()

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

divide each component by a constant

Parameters
cconstant
Returns
itself

Definition at line 565 of file Point.hpp.

◆ operator=() [1/6]

template<unsigned int dim, typename T>
template<typename orig , typename exp1 , typename exp2 , unsigned int op>
__device__ __host__ 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 479 of file Point.hpp.

◆ operator=() [2/6]

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

Fill the vector property with the evaluated expression.

Parameters
p_expexpression to evaluate
Returns
itself

Definition at line 497 of file Point.hpp.

◆ operator=() [3/6]

template<unsigned int dim, typename T>
__device__ __host__ 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 514 of file Point.hpp.

◆ operator=() [4/6]

template<unsigned int dim, typename T>
template<typename T1 , typename check = typename std::enable_if<std::is_const<T1>::value == false>::type>
__device__ __host__ 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 531 of file Point.hpp.

◆ operator=() [5/6]

template<unsigned int dim, typename T>
__device__ __host__ 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 581 of file Point.hpp.

◆ operator=() [6/6]

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

operator= between points

Parameters
pPoint
Returns
itself

Definition at line 596 of file Point.hpp.

◆ operator==()

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

Check if two points match.

Parameters
ppoint to compare with
Returns
true if two points match

Definition at line 360 of file Point.hpp.

◆ operator[]() [1/2]

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

Get the component i.

Parameters
icomponent
Returns
the i-component

Definition at line 208 of file Point.hpp.

◆ operator[]() [2/2]

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

Get the component i.

Parameters
icomponent
Returns
the i-component

Definition at line 221 of file Point.hpp.

◆ swap()

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 343 of file Point.hpp.

◆ to_string()

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 388 of file Point.hpp.

◆ toPointString()

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 326 of file Point.hpp.

◆ toString()

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 398 of file Point.hpp.

◆ value() [1/2]

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 419 of file Point.hpp.

◆ value() [2/2]

template<unsigned int dim, typename T>
__device__ __host__ 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 431 of file Point.hpp.

◆ zero()

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

Set to zero the point coordinate.

Definition at line 284 of file Point.hpp.

◆ zero_p()

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 309 of file Point.hpp.


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