RepastHPC  2.3.1
Public Types | Public Member Functions | Friends | List of all members
repast::Point< T > Class Template Reference

A N-dimensional Point representation. More...

#include <Point.h>

Public Types

typedef std::vector< T >::const_iterator const_iterator
 

Public Member Functions

 Point (T x)
 Creates a one dimensional point with the specified value. More...
 
 Point (T x, T y)
 Creates a two dimensional point with the specified values. More...
 
 Point (T x, T y, T z)
 Creates a three dimensional point with the specified values. More...
 
 Point (std::vector< T > coordinates)
 Creates a multi-dimensional point with the specified values. More...
 
getX () const
 Gets the x coordinate of the point. More...
 
getY () const
 Gets the y coordinate of the point. More...
 
getZ () const
 Gets the z coordinate of the point. More...
 
getCoordinate (int coordIndex) const
 Gets the coodinate of the point in the specified dimension. More...
 
void add (const Point< T > &pt)
 Adds the specified GridPoint to this GridPoint. More...
 
size_t dimensionCount () const
 Gets the number of dimensions of this point. More...
 
const T & operator[] (size_t index) const
 Gets the coordinate value at the specified index. More...
 
T & operator[] (size_t index)
 Gets the coordinate value at the specified index. More...
 
const std::vector< T > & coords () const
 Gets the coordinates of this point as a vector. More...
 
const_iterator begin () const
 Gets the start of an iterator over the coordinates of this point. More...
 
const_iterator end () const
 Gets the end of an iterator over the coordinates of this point. More...
 
void copy (std::vector< T > &out) const
 Copies the point into the specified vector. More...
 

Friends

struct HashGridPoint< T >
 
class boost::serialization::access
 
bool operator== (const Point< T > &one, const Point< T > &two)
 
std::ostream & operator<< (std::ostream &os, const Point< T > &pt)
 

Detailed Description

template<typename T>
class repast::Point< T >

A N-dimensional Point representation.

N dimensional point for addressing matrix locations.

Parameters
Ta numeric type. In repast and relogo these are limited to int and double.

Constructor & Destructor Documentation

◆ Point() [1/4]

template<typename T >
repast::Point< T >::Point ( x)
explicit

Creates a one dimensional point with the specified value.

Parameters
xthe x coordinate of the point

◆ Point() [2/4]

template<typename T >
repast::Point< T >::Point ( x,
y 
)

Creates a two dimensional point with the specified values.

Parameters
xthe x coordinate of the point
ythe y coordinate of the point

◆ Point() [3/4]

template<typename T >
repast::Point< T >::Point ( x,
y,
z 
)

Creates a three dimensional point with the specified values.

Parameters
xthe x coordinate of the point
ythe y coordinate of the point
zthe z coordinate of the point

◆ Point() [4/4]

template<typename T >
repast::Point< T >::Point ( std::vector< T >  coordinates)

Creates a multi-dimensional point with the specified values.

Parameters
coordinatesthe coordinate values of the point. The first element will be x, the second y and so on.

Member Function Documentation

◆ add()

template<typename T >
void repast::Point< T >::add ( const Point< T > &  pt)

Adds the specified GridPoint to this GridPoint.

This GridPoint contains the result.

Exceptions
invalid_argumentexception if the pt doesn't have the same number of dimensions as this GridPoint.

◆ begin()

template<typename T >
const_iterator repast::Point< T >::begin ( ) const
inline

Gets the start of an iterator over the coordinates of this point.

Returns
the start of an iterator over the coordinates of this point.

◆ coords()

template<typename T >
const std::vector<T>& repast::Point< T >::coords ( ) const
inline

Gets the coordinates of this point as a vector.

Returns
a vector containing the coordinates of this point.

◆ copy()

template<typename T >
void repast::Point< T >::copy ( std::vector< T > &  out) const

Copies the point into the specified vector.

Assumes the array is the same length as this GridPoint.

Parameters
[out]thevector to copy the point coordinates into

◆ dimensionCount()

template<typename T >
size_t repast::Point< T >::dimensionCount ( ) const
inline

Gets the number of dimensions of this point.

Returns
the number of dimensions of this point.

◆ end()

template<typename T >
const_iterator repast::Point< T >::end ( ) const
inline

Gets the end of an iterator over the coordinates of this point.

Returns
the end of an iterator over the coordinates of this point.

◆ getCoordinate()

template<typename T >
T repast::Point< T >::getCoordinate ( int  coordIndex) const

Gets the coodinate of the point in the specified dimension.

Parameters
coordIndexthe dimension of the point to get the coordinate for. X is the first, y is the second and so on.
Returns
the coordinate of the point in the specified dimension.
Exceptions
anout_of_range exception if this GridPoint has doesn't have the specified dimension.

◆ getX()

template<typename T >
T repast::Point< T >::getX

Gets the x coordinate of the point.

Returns
the x coordinate of the point.

◆ getY()

template<typename T >
T repast::Point< T >::getY

Gets the y coordinate of the point.

Returns
the y coordinate of the point.
Exceptions
anout_of_range exception if this GridPoint has less than 2 dimensions.

◆ getZ()

template<typename T >
T repast::Point< T >::getZ

Gets the z coordinate of the point.

Returns
the z coordinate of the point.
Exceptions
anout_of_range exception if this GridPoint has less than 3 dimensions.

◆ operator[]() [1/2]

template<typename T >
T& repast::Point< T >::operator[] ( size_t  index)
inline

Gets the coordinate value at the specified index.

Parameters
indexthe dimension of the point to get the coordinate for. X is the first, y is the second and so on.
Returns
the coordinate of the point in the specified dimension.

◆ operator[]() [2/2]

template<typename T >
const T& repast::Point< T >::operator[] ( size_t  index) const
inline

Gets the coordinate value at the specified index.

Parameters
indexthe dimension of the point to get the coordinate for. X is the first, y is the second and so on.
Returns
the coordinate of the point in the specified dimension.

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