OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
OpenMD::Vector2< Real > Class Template Reference
+ Inheritance diagram for OpenMD::Vector2< Real >:

Public Types

typedef Real ElemType
 
typedef Real * ElemPoinerType
 
- Public Types inherited from OpenMD::Vector< Real, 2 >
using ElemType
 
using ElemPoinerType
 

Public Member Functions

 Vector2 (Real x, Real y)
 Constructs and initializes a Vector2 from x and y coordinates.
 
 Vector2 (Real *array)
 Constructs and initializes from an array.
 
 Vector2 (const Vector< Real, 2 > &v)
 
Vector2< Real > & operator= (const Vector< Real, 2 > &v)
 
Real & x ()
 Returns reference of the first element of Vector2.
 
Real x () const
 Returns the first element of Vector2.
 
Real & y ()
 Returns reference of the second element of Vector2.
 
Real y () const
 Returns the second element of Vector2.
 
- Public Member Functions inherited from OpenMD::Vector< Real, 2 >
 Vector ()
 default constructor
 
 Vector (const Vector< Real, Dim > &v)
 Constructs and initializes a Vector from a vector.
 
 Vector (const Real &s)
 
 Vector (Real *v)
 Constructs and initializes a Vector from an array.
 
Vector< Real, Dim > & operator= (const Vector< Real, Dim > &v)
 copy assignment operator
 
Vector< Real, Dim > & operator= (const Real *v)
 array assignment operator
 
Real & operator[] (unsigned int i)
 Returns reference of ith element.
 
const Real & operator[] (unsigned int i) const
 Returns constant reference of ith element.
 
Real & operator() (unsigned int i)
 Returns reference of ith element.
 
const Real & operator() (unsigned int i) const
 Returns constant reference of ith element.
 
void getArray (Real *array)
 Copy the internal data to an array.
 
Real * getArrayPointer ()
 Returns the pointer of internal array.
 
bool operator== (const Vector< Real, Dim > &v)
 Tests if this vetor is equal to other vector.
 
bool operator!= (const Vector< Real, Dim > &v)
 Tests if this vetor is not equal to other vector.
 
void zero ()
 Zeros out the values in this vector in place.
 
void negate ()
 Negates the value of this vector in place.
 
void negate (const Vector< Real, Dim > &v1)
 Sets the value of this vector to the negation of vector v1.
 
void add (const Vector< Real, Dim > &v1)
 Sets the value of this vector to the sum of itself and v1 (*this += v1).
 
void add (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2)
 Sets the value of this vector to the sum of v1 and v2 (*this = v1 + v2).
 
void sub (const Vector< Real, Dim > &v1)
 Sets the value of this vector to the difference of itself and v1 (*this -= v1).
 
void sub (const Vector< Real, Dim > &v1, const Vector &v2)
 Sets the value of this vector to the difference of vector v1 and v2 (*this = v1 - v2).
 
void mul (Real s)
 Sets the value of this vector to the scalar multiplication of itself (*this *= s).
 
void mul (const Vector< Real, Dim > &v1, Real s)
 Sets the value of this vector to the scalar multiplication of vector v1 (*this = s * v1).
 
void Vmul (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2)
 Sets the elements of this vector to the multiplication of elements of two other vectors.
 
Vector< Real, Dim > & abs ()
 
Real max ()
 
void div (Real s)
 Sets the value of this vector to the scalar division of itself (*this /= s ).
 
void div (const Vector< Real, Dim > &v1, Real s)
 Sets the value of this vector to the scalar division of vector v1 (*this = v1 / s ).
 
void Vdiv (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2)
 Sets the elements of this vector to the division of elements of two other vectors.
 
Vector< Real, Dim > & operator+= (const Vector< Real, Dim > &v1)
 
Vector< Real, Dim > & operator-= (const Vector< Real, Dim > &v1)
 
Vector< Real, Dim > & operator*= (Real s)
 
Vector< Real, Dim > & operator/= (Real s)
 
Real sum ()
 Returns the sum of all elements of this vector.
 
Real componentProduct ()
 Returns the product of all elements of this vector.
 
Real length ()
 Returns the length of this vector.
 
Real lengthSquare ()
 Returns the squared length of this vector.
 
void normalize ()
 Normalizes this vector in place.
 
bool isNormalized ()
 Tests if this vector is normalized.
 
unsigned int size () const
 

Additional Inherited Members

- Protected Attributes inherited from OpenMD::Vector< Real, 2 >
Real data_ [Dim]
 

Detailed Description

template<typename Real>
class OpenMD::Vector2< Real >

Definition at line 56 of file Vector2.hpp.

Member Typedef Documentation

◆ ElemPoinerType

template<typename Real >
typedef Real* OpenMD::Vector2< Real >::ElemPoinerType

Definition at line 59 of file Vector2.hpp.

◆ ElemType

template<typename Real >
typedef Real OpenMD::Vector2< Real >::ElemType

Definition at line 58 of file Vector2.hpp.

Constructor & Destructor Documentation

◆ Vector2() [1/4]

template<typename Real >
OpenMD::Vector2< Real >::Vector2 ( )
inline

Definition at line 60 of file Vector2.hpp.

◆ Vector2() [2/4]

template<typename Real >
OpenMD::Vector2< Real >::Vector2 ( Real x,
Real y )
inline

Constructs and initializes a Vector2 from x and y coordinates.

Definition at line 63 of file Vector2.hpp.

References OpenMD::Vector2< Real >::x(), and OpenMD::Vector2< Real >::y().

◆ Vector2() [3/4]

template<typename Real >
OpenMD::Vector2< Real >::Vector2 ( Real * array)
inline

Constructs and initializes from an array.

Definition at line 69 of file Vector2.hpp.

◆ Vector2() [4/4]

template<typename Real >
OpenMD::Vector2< Real >::Vector2 ( const Vector< Real, 2 > & v)
inline

Definition at line 71 of file Vector2.hpp.

Member Function Documentation

◆ operator=()

template<typename Real >
Vector2< Real > & OpenMD::Vector2< Real >::operator= ( const Vector< Real, 2 > & v)
inline

Definition at line 73 of file Vector2.hpp.

◆ x() [1/2]

template<typename Real >
Real & OpenMD::Vector2< Real >::x ( )
inline

Returns reference of the first element of Vector2.

Returns
reference of the first element of Vector2

Definition at line 83 of file Vector2.hpp.

Referenced by OpenMD::Vector2< Real >::Vector2(), and OpenMD::Vlinear().

◆ x() [2/2]

template<typename Real >
Real OpenMD::Vector2< Real >::x ( ) const
inline

Returns the first element of Vector2.

Returns
the first element of Vector2

Definition at line 89 of file Vector2.hpp.

◆ y() [1/2]

template<typename Real >
Real & OpenMD::Vector2< Real >::y ( )
inline

Returns reference of the second element of Vector2.

Returns
reference of the second element of Vector2

Definition at line 95 of file Vector2.hpp.

Referenced by OpenMD::Vector2< Real >::Vector2(), and OpenMD::Vlinear().

◆ y() [2/2]

template<typename Real >
Real OpenMD::Vector2< Real >::y ( ) const
inline

Returns the second element of Vector2.

Returns
c the second element of Vector2

Definition at line 101 of file Vector2.hpp.


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