OpenMPCD
Public Member Functions | Friends | List of all members
OpenMPCD::RemotelyStoredVector< T, D > Class Template Reference

Represents a vector whose data is stored elsewhere. More...

#include <RemotelyStoredVector.hpp>

Public Member Functions

OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector (T *const storageBase, const std::size_t vectorID=0)
 The constructor. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector (const RemotelyStoredVector< T, D > &rhs)
 The copy constructor. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICEget (const unsigned int i) const
 Returns the coodinate with the given index. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICEgetX () const
 Returns the x coodinate. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE void setX (const T val)
 Sets the x coordinate. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE void addToX (const T val)
 Adds the given value to the x coordinate. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICEgetY () const
 Returns the y coodinate. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE void setY (const FP val)
 Sets the y coordinate. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE FP getZ () const
 Returns the z coodinate. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE void setZ (const FP val)
 Sets the z coordinate. More...
 
OPENMPCD_CUDA_DEVICE void atomicAdd (const RemotelyStoredVector< typename boost::add_const< T >::type, D > &rhs)
 Atomically adds the right-hand-side instance to this instance. More...
 
OPENMPCD_CUDA_DEVICE void atomicAdd (const RemotelyStoredVector< typename boost::remove_const< T >::type, D > &rhs)
 Atomically adds the right-hand-side instance to this instance. More...
 
OPENMPCD_CUDA_DEVICE void atomicAdd (const Vector3D< typename boost::remove_const< T >::type > &rhs)
 Atomically adds the right-hand-side instance to this instance. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICEdot (const RemotelyStoredVector &rhs) const
 Returns the scalar product of this vector with the given vector. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICEgetMagnitudeSquared () const
 Returns the square of the magnitude of this vector. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICEgetMagnitude () const
 Returns the magnitude of this vector. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool isFinite () const
 Returns whether all components are finite, i.e. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVectoroperator= (const RemotelyStoredVector &rhs)
 The assignment operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVectoroperator= (const Vector3D< T > &rhs)
 The assignment operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVectoroperator+= (const Vector3D< T > &rhs)
 The addition-and-assignment operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator+ (const RemotelyStoredVector &rhs) const
 Addition operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator+ (const Vector3D< typename boost::remove_const< T >::type > &rhs) const
 Addition operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator- (const RemotelyStoredVector &rhs) const
 Substraction operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator- (const Vector3D< typename boost::remove_const< T >::type > &rhs) const
 Substraction operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVectoroperator*= (const FP rhs)
 The scalar multiplication-and-assignment operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator* (const FP rhs) const
 The scalar multiplication operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator/ (const FP rhs) const
 Scalar division operator. More...
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector operator/= (const FP rhs)
 Scalar division-and-assignment operator. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE operator Vector3D< typename boost::remove_const< T >::type > () const
 Converts this instance into a Vector3D. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator== (const Vector3D< typename boost::remove_const< T >::type > &rhs) const
 The comparison operator. More...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator!= (const Vector3D< typename boost::remove_const< T >::type > &rhs) const
 The inequality operator. More...
 

Friends

std::ostream & operator<< (std::ostream &stream, const RemotelyStoredVector &vector)
 Output operator for streams. More...
 

Detailed Description

template<typename T, unsigned int D = 3>
class OpenMPCD::RemotelyStoredVector< T, D >

Represents a vector whose data is stored elsewhere.

Template Parameters
TThe type stored.
DThe dimensionality of the vector.

Definition at line 26 of file RemotelyStoredVector.hpp.

Constructor & Destructor Documentation

◆ RemotelyStoredVector() [1/2]

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE OpenMPCD::RemotelyStoredVector< T, D >::RemotelyStoredVector ( T *const  storageBase,
const std::size_t  vectorID = 0 
)
inline

The constructor.

Parameters
[in]storageBaseThe base address of the storage.
[in]vectorIDThe ID of the vector in the given storage.

Definition at line 37 of file RemotelyStoredVector.hpp.

◆ RemotelyStoredVector() [2/2]

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE OpenMPCD::RemotelyStoredVector< T, D >::RemotelyStoredVector ( const RemotelyStoredVector< T, D > &  rhs)
inline

The copy constructor.

Parameters
[in]rhsThe right-hand-side instance.

Definition at line 47 of file RemotelyStoredVector.hpp.

Member Function Documentation

◆ addToX()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE void OpenMPCD::RemotelyStoredVector< T, D >::addToX ( const T  val)
inline

Adds the given value to the x coordinate.

Parameters
[in]valThe value to add

Definition at line 92 of file RemotelyStoredVector.hpp.

◆ atomicAdd() [1/3]

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_DEVICE void OpenMPCD::RemotelyStoredVector< T, D >::atomicAdd ( const RemotelyStoredVector< typename boost::add_const< T >::type, D > &  rhs)

Atomically adds the right-hand-side instance to this instance.

Parameters
[in]rhsThe right-hand-side.

◆ atomicAdd() [2/3]

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_DEVICE void OpenMPCD::RemotelyStoredVector< T, D >::atomicAdd ( const RemotelyStoredVector< typename boost::remove_const< T >::type, D > &  rhs)

Atomically adds the right-hand-side instance to this instance.

Parameters
[in]rhsThe right-hand-side.

◆ atomicAdd() [3/3]

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_DEVICE void OpenMPCD::RemotelyStoredVector< T, D >::atomicAdd ( const Vector3D< typename boost::remove_const< T >::type > &  rhs)

Atomically adds the right-hand-side instance to this instance.

Parameters
[in]rhsThe right-hand-side.

◆ dot()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE T OpenMPCD::RemotelyStoredVector< T, D >::dot ( const RemotelyStoredVector< T, D > &  rhs) const
inline

Returns the scalar product of this vector with the given vector.

Parameters
[in]rhsThe right-hand-side.

Definition at line 170 of file RemotelyStoredVector.hpp.

◆ get()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE T OpenMPCD::RemotelyStoredVector< T, D >::get ( const unsigned int  i) const
inline

Returns the coodinate with the given index.

Exceptions
OutOfBoundsExceptionIf OPENMPCD_DEBUG is defined, in Host code, throws if i >= D.
Parameters
[in]iThe coordinate index.

Definition at line 59 of file RemotelyStoredVector.hpp.

◆ getMagnitude()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE T OpenMPCD::RemotelyStoredVector< T, D >::getMagnitude ( ) const
inline

Returns the magnitude of this vector.

Definition at line 191 of file RemotelyStoredVector.hpp.

◆ getMagnitudeSquared()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE T OpenMPCD::RemotelyStoredVector< T, D >::getMagnitudeSquared ( ) const
inline

Returns the square of the magnitude of this vector.

Definition at line 182 of file RemotelyStoredVector.hpp.

◆ getX()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE T OpenMPCD::RemotelyStoredVector< T, D >::getX ( ) const
inline

Returns the x coodinate.

Definition at line 72 of file RemotelyStoredVector.hpp.

◆ getY()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE T OpenMPCD::RemotelyStoredVector< T, D >::getY ( ) const
inline

Returns the y coodinate.

Definition at line 101 of file RemotelyStoredVector.hpp.

◆ getZ()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE FP OpenMPCD::RemotelyStoredVector< T, D >::getZ ( ) const
inline

Returns the z coodinate.

Definition at line 124 of file RemotelyStoredVector.hpp.

◆ isFinite()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::RemotelyStoredVector< T, D >::isFinite ( ) const
inline

Returns whether all components are finite, i.e.

neither infinite nor NaN.

Definition at line 200 of file RemotelyStoredVector.hpp.

◆ operator Vector3D< typename boost::remove_const< T >::type >()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE OpenMPCD::RemotelyStoredVector< T, D >::operator Vector3D< typename boost::remove_const< T >::type > ( ) const
inline

Converts this instance into a Vector3D.

Definition at line 395 of file RemotelyStoredVector.hpp.

◆ operator!=()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::RemotelyStoredVector< T, D >::operator!= ( const Vector3D< typename boost::remove_const< T >::type > &  rhs) const
inline

The inequality operator.

Parameters
[in]rhsThe right-hand-side value.

Definition at line 429 of file RemotelyStoredVector.hpp.

◆ operator*()

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D<typename boost::remove_const<T>::type> OpenMPCD::RemotelyStoredVector< T, D >::operator* ( const FP  rhs) const
inline

The scalar multiplication operator.

Parameters
[in]rhsThe scalar factor.

Definition at line 350 of file RemotelyStoredVector.hpp.

◆ operator*=()

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector& OpenMPCD::RemotelyStoredVector< T, D >::operator*= ( const FP  rhs)
inline

The scalar multiplication-and-assignment operator.

Parameters
[in]rhsThe scalar factor.
Returns
Returns this instance.

Definition at line 334 of file RemotelyStoredVector.hpp.

◆ operator+() [1/2]

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D<typename boost::remove_const<T>::type> OpenMPCD::RemotelyStoredVector< T, D >::operator+ ( const RemotelyStoredVector< T, D > &  rhs) const
inline

Addition operator.

Parameters
[in]rhsThe right-hand-side vector.

Definition at line 270 of file RemotelyStoredVector.hpp.

◆ operator+() [2/2]

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D<typename boost::remove_const<T>::type> OpenMPCD::RemotelyStoredVector< T, D >::operator+ ( const Vector3D< typename boost::remove_const< T >::type > &  rhs) const
inline

Addition operator.

Parameters
[in]rhsThe right-hand-side vector.

Definition at line 286 of file RemotelyStoredVector.hpp.

◆ operator+=()

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector& OpenMPCD::RemotelyStoredVector< T, D >::operator+= ( const Vector3D< T > &  rhs)
inline

The addition-and-assignment operator.

Parameters
[in]rhsThe right-hand-side instance.
Returns
Returns this instance.

Definition at line 253 of file RemotelyStoredVector.hpp.

◆ operator-() [1/2]

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D<typename boost::remove_const<T>::type> OpenMPCD::RemotelyStoredVector< T, D >::operator- ( const RemotelyStoredVector< T, D > &  rhs) const
inline

Substraction operator.

Parameters
[in]rhsThe right-hand-side vector.

Definition at line 302 of file RemotelyStoredVector.hpp.

◆ operator-() [2/2]

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D<typename boost::remove_const<T>::type> OpenMPCD::RemotelyStoredVector< T, D >::operator- ( const Vector3D< typename boost::remove_const< T >::type > &  rhs) const
inline

Substraction operator.

Parameters
[in]rhsThe right-hand-side vector.

Definition at line 318 of file RemotelyStoredVector.hpp.

◆ operator/()

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D<typename boost::remove_const<T>::type> OpenMPCD::RemotelyStoredVector< T, D >::operator/ ( const FP  rhs) const
inline

Scalar division operator.

Parameters
[in]rhsThe right-hand-side scalar.

Definition at line 365 of file RemotelyStoredVector.hpp.

◆ operator/=()

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector OpenMPCD::RemotelyStoredVector< T, D >::operator/= ( const FP  rhs)
inline

Scalar division-and-assignment operator.

Parameters
[in]rhsThe right-hand-side scalar.

Definition at line 380 of file RemotelyStoredVector.hpp.

◆ operator=() [1/2]

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector& OpenMPCD::RemotelyStoredVector< T, D >::operator= ( const RemotelyStoredVector< T, D > &  rhs)
inline

The assignment operator.

Parameters
[in]rhsThe right-hand-side instance.
Returns
Returns this instance.

Definition at line 222 of file RemotelyStoredVector.hpp.

◆ operator=() [2/2]

template<typename T , unsigned int D = 3>
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector& OpenMPCD::RemotelyStoredVector< T, D >::operator= ( const Vector3D< T > &  rhs)
inline

The assignment operator.

Parameters
[in]rhsThe right-hand-side instance.
Returns
Returns this instance.

Definition at line 236 of file RemotelyStoredVector.hpp.

◆ operator==()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::RemotelyStoredVector< T, D >::operator== ( const Vector3D< typename boost::remove_const< T >::type > &  rhs) const
inline

The comparison operator.

Parameters
[in]rhsThe right-hand-side value.

Definition at line 408 of file RemotelyStoredVector.hpp.

◆ setX()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE void OpenMPCD::RemotelyStoredVector< T, D >::setX ( const T  val)
inline

Sets the x coordinate.

Parameters
[in]valThe new value.

Definition at line 82 of file RemotelyStoredVector.hpp.

◆ setY()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE void OpenMPCD::RemotelyStoredVector< T, D >::setY ( const FP  val)
inline

Sets the y coordinate.

Parameters
[in]valThe new value.

Definition at line 113 of file RemotelyStoredVector.hpp.

◆ setZ()

template<typename T , unsigned int D = 3>
OPENMPCD_CUDA_HOST_AND_DEVICE void OpenMPCD::RemotelyStoredVector< T, D >::setZ ( const FP  val)
inline

Sets the z coordinate.

Parameters
[in]valThe new value.

Definition at line 136 of file RemotelyStoredVector.hpp.

Friends And Related Function Documentation

◆ operator<<

template<typename T , unsigned int D = 3>
std::ostream& operator<< ( std::ostream &  stream,
const RemotelyStoredVector< T, D > &  vector 
)
friend

Output operator for streams.

Appends vector.getX(), vector.getY(), and vector.getZ() to the stream in that order, separated by single spaces (" ").

Parameters
[in]streamThe stream to print to.
[in]vectorThe vector to print.

Definition at line 448 of file RemotelyStoredVector.hpp.


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