World Builder  0.1.0-pre
A geodyanmic initial conditions generator
WorldBuilder::Point< dim > Class Template Reference

#include <point.h>

Public Member Functions

 Point ()
 
 Point (const std::array< double, dim > &location, CoordinateSystem coordinate_system=CoordinateSystem::cartesian)
 
 Point (const Point< dim > &point, CoordinateSystem coordinate_system=CoordinateSystem::cartesian)
 
 Point (const double x, const double y, CoordinateSystem coordinate_system=CoordinateSystem::cartesian)
 
 Point (const double x, const double y, const double z, CoordinateSystem coordinate_system=CoordinateSystem::cartesian)
 
 ~Point ()
 
Point< dim > & operator= (const Point< dim > &point)
 
double operator* (const Point< dim > &point) const
 
Point< dim > operator* (const double scalar) const
 
Point< dim > operator+ (const Point< dim > &point) const
 
Point< dim > operator- (const Point< dim > &point) const
 
Point< dim > & operator*= (const double scalar)
 
Point< dim > & operator+= (const Point< dim > &point)
 
Point< dim > & operator-= (const Point< dim > &point)
 
const double & operator[] (const unsigned int index) const
 
double & operator[] (const unsigned int index)
 
const std::array< double, dim > & get_array () const
 
CoordinateSystem get_coordinate_system () const
 
double norm () const
 
double norm_square () const
 
template<>
 Point ()
 
template<>
 Point ()
 
template<>
 Point (const double x, const double y, CoordinateSystem coordinate_system_)
 
template<>
 Point (const double, const double, CoordinateSystem coordinate_system_)
 
template<>
 Point (const double, const double, const double, CoordinateSystem coordinate_system_)
 
template<>
 Point (const double x, const double y, const double z, CoordinateSystem coordinate_system_)
 
template<>
double norm_square () const
 
template<>
double norm_square () const
 

Detailed Description

template<int dim>
class WorldBuilder::Point< dim >

A class which stores 2d and 3d arrays of doubles (depending on the dimension), and the coordinate system which the coordinates can be used for. It also implements several operations such as the computation of the l2 norm and the dot product.

Definition at line 37 of file point.h.

Constructor & Destructor Documentation

◆ Point() [1/11]

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

Constructor. Constructs a Point at (0,0) in 2d or (0,0,0) in 3d with a Cartesian coordinate system.

◆ Point() [2/11]

template<int dim>
WorldBuilder::Point< dim >::Point ( const std::array< double, dim > &  location,
CoordinateSystem  coordinate_system = CoordinateSystem::cartesian 
)

Constructor. Constructs a Point from a std::array<double,dim> and a coordinate system which is set by default to Cartesian.

Definition at line 43 of file point.cc.

◆ Point() [3/11]

template<int dim>
WorldBuilder::Point< dim >::Point ( const Point< dim > &  point,
CoordinateSystem  coordinate_system = CoordinateSystem::cartesian 
)

Constructor. Constructs a Point from an other Point and a coordinate system which is set by default to Cartesian.

Definition at line 50 of file point.cc.

◆ Point() [4/11]

template<int dim>
WorldBuilder::Point< dim >::Point ( const double  x,
const double  y,
CoordinateSystem  coordinate_system = CoordinateSystem::cartesian 
)

Constructor. Constructs a 2d Point from two doubles and a coordinate system which is set by default to Cartesian.

◆ Point() [5/11]

template<int dim>
WorldBuilder::Point< dim >::Point ( const double  x,
const double  y,
const double  z,
CoordinateSystem  coordinate_system = CoordinateSystem::cartesian 
)

Constructor. Constructs a 3d Point from three doubles and a coordinate system which is set by default to Cartesian.

◆ ~Point()

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

Destructor

Definition at line 93 of file point.cc.

◆ Point() [6/11]

template<>
WorldBuilder::Point< 3 >::Point ( )

Definition at line 29 of file point.cc.

◆ Point() [7/11]

template<>
WorldBuilder::Point< 2 >::Point ( )

Definition at line 36 of file point.cc.

◆ Point() [8/11]

template<>
WorldBuilder::Point< 2 >::Point ( const double  x,
const double  y,
CoordinateSystem  coordinate_system_ 
)

Definition at line 58 of file point.cc.

◆ Point() [9/11]

template<>
WorldBuilder::Point< 3 >::Point ( const double  ,
const double  ,
CoordinateSystem  coordinate_system_ 
)

Definition at line 65 of file point.cc.

◆ Point() [10/11]

template<>
WorldBuilder::Point< 2 >::Point ( const double  ,
const double  ,
const double  ,
CoordinateSystem  coordinate_system_ 
)

Definition at line 75 of file point.cc.

◆ Point() [11/11]

template<>
WorldBuilder::Point< 3 >::Point ( const double  x,
const double  y,
const double  z,
CoordinateSystem  coordinate_system_ 
)

Definition at line 85 of file point.cc.

Member Function Documentation

◆ get_array()

template<int dim>
const std::array< double, dim > & WorldBuilder::Point< dim >::get_array ( ) const

return the internal array which stores the point data.

Definition at line 201 of file point.cc.

Here is the caller graph for this function:

◆ get_coordinate_system()

template<int dim>
CoordinateSystem WorldBuilder::Point< dim >::get_coordinate_system ( ) const

returns the coordinate system associated with the data.

Definition at line 209 of file point.cc.

◆ norm()

template<int dim>
double WorldBuilder::Point< dim >::norm ( ) const

Computes the L2 norm: sqrt(x_i * x_i + y_i * y_i + z_i * z_i) in 3d.

Definition at line 217 of file point.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ norm_square() [1/3]

template<int dim>
double WorldBuilder::Point< dim >::norm_square ( ) const

Computes the square of the norm, which is the sum of the absolute squares x_i * x_i + y_i * y_i + z_i * z_i in 3d.

Here is the caller graph for this function:

◆ norm_square() [2/3]

template<>
double WorldBuilder::Point< 2 >::norm_square ( ) const

Definition at line 225 of file point.cc.

◆ norm_square() [3/3]

template<>
double WorldBuilder::Point< 3 >::norm_square ( ) const

Definition at line 232 of file point.cc.

◆ operator*() [1/2]

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

dot product

Definition at line 105 of file point.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator*() [2/2]

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

Multiply the vector with a scalar

Definition at line 116 of file point.cc.

Here is the call graph for this function:

◆ operator*=()

template<int dim>
Point< dim > & WorldBuilder::Point< dim >::operator*= ( const double  scalar)

Multiply the vector with a scalar

Definition at line 148 of file point.cc.

◆ operator+()

template<int dim>
Point< dim > WorldBuilder::Point< dim >::operator+ ( const Point< dim > &  point) const

add two points

Definition at line 127 of file point.cc.

◆ operator+=()

template<int dim>
Point< dim > & WorldBuilder::Point< dim >::operator+= ( const Point< dim > &  point)

add two points

Definition at line 157 of file point.cc.

◆ operator-()

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

Substract two points

Definition at line 137 of file point.cc.

◆ operator-=()

template<int dim>
Point< dim > & WorldBuilder::Point< dim >::operator-= ( const Point< dim > &  point)

substract two points

Definition at line 167 of file point.cc.

◆ operator=()

template<int dim>
Point< dim > & WorldBuilder::Point< dim >::operator= ( const Point< dim > &  point)

Definition at line 97 of file point.cc.

◆ operator[]() [1/2]

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

access index (const)

access index

Definition at line 180 of file point.cc.

◆ operator[]() [2/2]

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

access index

Definition at line 192 of file point.cc.


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