Go to the documentation of this file.
    6 #ifndef OPENMPCD_REMOTELYSTOREDVECTOR_HPP 
    7 #define OPENMPCD_REMOTELYSTOREDVECTOR_HPP 
   14 #include <boost/static_assert.hpp> 
   15 #include <boost/type_traits/add_const.hpp> 
   16 #include <boost/type_traits/remove_const.hpp> 
   28         BOOST_STATIC_ASSERT(D != 0);
 
   38                 : storage(storageBase + D * vectorID)
 
   48                 : storage(rhs.storage)
 
   59             T 
get(
const unsigned int i)
 const 
   61                 #if defined(OPENMPCD_DEBUG) && !defined(__CUDA_ARCH__) 
  103                 BOOST_STATIC_ASSERT(D >= 2);
 
  115                 BOOST_STATIC_ASSERT(D >= 2);
 
  126                 BOOST_STATIC_ASSERT(D >= 3);
 
  138                 BOOST_STATIC_ASSERT(D >= 3);
 
  172                 typename boost::remove_const<T>::type ret = 0;
 
  173                 for(std::size_t i=0; i<D; ++i)
 
  174                     ret += storage[i] * rhs.storage[i];
 
  202                 #ifndef __CUDA_ARCH__ 
  206                 for(std::size_t i=0; i<D; ++i)
 
  208                     if(!isfinite(storage[i]))
 
  224                 for(std::size_t i=0; i<D; ++i)
 
  225                     storage[i] = rhs.storage[i];
 
  238                 BOOST_STATIC_ASSERT(D == 3);
 
  240                 storage[0] = rhs.
getX();
 
  241                 storage[1] = rhs.
getY();
 
  242                 storage[2] = rhs.
getZ();
 
  255                 BOOST_STATIC_ASSERT(D == 3);
 
  257                 storage[0] += rhs.
getX();
 
  258                 storage[1] += rhs.
getY();
 
  259                 storage[2] += rhs.
getZ();
 
  272                 BOOST_STATIC_ASSERT(D == 3);
 
  288                 BOOST_STATIC_ASSERT(D == 3);
 
  293                         getZ() + rhs.getZ());
 
  304                 BOOST_STATIC_ASSERT(D == 3);
 
  320                 BOOST_STATIC_ASSERT(D == 3);
 
  325                         getZ() - rhs.getZ());
 
  336                 BOOST_STATIC_ASSERT(D == 3);
 
  352                 BOOST_STATIC_ASSERT(D == 3);
 
  367                 BOOST_STATIC_ASSERT(D == 3);
 
  382                 BOOST_STATIC_ASSERT(D == 3);
 
  397                 BOOST_STATIC_ASSERT(D == 3);
 
  409                 const Vector3D<
typename boost::remove_const<T>::type>& rhs)
 
  412                 BOOST_STATIC_ASSERT(D == 3);
 
  414                 if(storage[0] != rhs.getX())
 
  416                 if(storage[1] != rhs.getY())
 
  418                 if(storage[2] != rhs.getZ())
 
  430                 const Vector3D<
typename boost::remove_const<T>::type>& rhs)
 
  433                 BOOST_STATIC_ASSERT(D == 3);
 
  451                     << vector.
getX() << 
" " 
  452                     << vector.
getY() << 
" " 
  470     template<
typename L, 
typename R>
 
  
OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector(T *const storageBase, const std::size_t vectorID=0)
The constructor.
 
OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector(const RemotelyStoredVector< T, D > &rhs)
The copy constructor.
 
friend std::ostream & operator<<(std::ostream &stream, const RemotelyStoredVector &vector)
Output operator for streams.
 
Represents a vector whose data is stored elsewhere.
 
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.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector & operator*=(const FP rhs)
The scalar multiplication-and-assignment operator.
 
OPENMPCD_CUDA_HOST_AND_DEVICE void setX(const T val)
Sets the x coordinate.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T getZ() const
Returns the z coordinate.
 
#define OPENMPCD_THROW(ExceptionType, message)
Throws the given ExceptionType, passing the given message along with file and line number information...
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator==(const Vector3D< typename boost::remove_const< T >::type > &rhs) const
The comparison operator.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator*(const FP rhs) const
The scalar multiplication operator.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T getMagnitude() const
Returns the magnitude of this vector.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T getX() const
Returns the x coordinate.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator-(const RemotelyStoredVector &rhs) const
Substraction operator.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector operator/=(const FP rhs)
Scalar division-and-assignment operator.
 
OPENMPCD_CUDA_HOST_AND_DEVICE void setY(const FP val)
Sets the y coordinate.
 
OPENMPCD_CUDA_HOST_AND_DEVICE void setZ(const FP val)
Sets the z coordinate.
 
#define OPENMPCD_CUDA_DEVICE
Denotes a function to be callable from a CUDA Device.
 
#define OPENMPCD_CUDA_HOST_AND_DEVICE
Denotes a function to be callable both from the Host and from a CUDA Device.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T getY() const
Returns the y coordinate.
 
OPENMPCD_CUDA_HOST_AND_DEVICE void addToX(const T val)
Adds the given value to the x coordinate.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T getY() const
Returns the y coodinate.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< L > & operator+=(Vector3D< L > &lhs, const RemotelyStoredVector< R, 3 > &rhs)
Addition-and-assignment operator.
 
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.
 
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.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector & operator+=(const Vector3D< T > &rhs)
The addition-and-assignment operator.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator/(const FP rhs) const
Scalar division operator.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector & operator=(const RemotelyStoredVector &rhs)
The assignment operator.
 
OPENMPCD_CUDA_HOST_AND_DEVICE void addToZ(const T val)
Adds the given value to the z coordinate.
 
double FP
Default floating point type.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T get(const unsigned int i) const
Returns the coodinate with the given index.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T getMagnitudeSquared() const
Returns the square of the magnitude of this vector.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T getX() const
Returns the x coodinate.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< typename boost::remove_const< T >::type > operator+(const RemotelyStoredVector &rhs) const
Addition operator.
 
OPENMPCD_CUDA_HOST_AND_DEVICE void addToY(const T val)
Adds the given value to the y coordinate.
 
OPENMPCD_CUDA_HOST_AND_DEVICE void addToX(const T val)
Adds the given value to the x coordinate.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T sqrt(const T x)
Returns the sqaure root of the argument.
 
OPENMPCD_CUDA_HOST_AND_DEVICE FP getZ() const
Returns the z coodinate.
 
Exception for out-of-bounds access.
 
const OPENMPCD_CUDA_HOST_AND_DEVICE RemotelyStoredVector & operator=(const Vector3D< T > &rhs)
The assignment operator.
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator!=(const Vector3D< typename boost::remove_const< T >::type > &rhs) const
The inequality operator.
 
OPENMPCD_CUDA_HOST_AND_DEVICE bool isFinite() const
Returns whether all components are finite, i.e.
 
OPENMPCD_CUDA_HOST_AND_DEVICE T dot(const RemotelyStoredVector &rhs) const
Returns the scalar product of this vector with the given vector.