OpenMD 3.1
Molecular Dynamics in the Open
|
Fix length vector class. More...
#include "math/Vector.hpp"
Public Types | |
using | ElemType = Real |
using | ElemPoinerType = Real* |
Public Member Functions | |
Vector () | |
default constructor | |
Vector (const Vector< Real, Dim > &v) | |
Constructs and initializes a Vector from a vector. | |
Vector< Real, Dim > & | operator= (const Vector< Real, Dim > &v) |
copy assignment operator | |
Vector< Real, Dim > & | operator= (const Real *v) |
array assignment operator | |
Vector (const Real &s) | |
Vector (Real *v) | |
Constructs and initializes a Vector from an array. | |
Real & | operator[] (unsigned int i) |
Returns 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. | |
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 |
Protected Attributes | |
Real | data_ [Dim] {} |
Fix length vector class.
Definition at line 78 of file Vector.hpp.
using OpenMD::Vector< Real, Dim >::ElemPoinerType = Real* |
Definition at line 81 of file Vector.hpp.
using OpenMD::Vector< Real, Dim >::ElemType = Real |
Definition at line 80 of file Vector.hpp.
|
inline |
default constructor
Definition at line 84 of file Vector.hpp.
|
inline |
Constructs and initializes a Vector from a vector.
Definition at line 90 of file Vector.hpp.
|
inline |
Definition at line 112 of file Vector.hpp.
|
inline |
Constructs and initializes a Vector from an array.
Definition at line 118 of file Vector.hpp.
|
inline |
Definition at line 290 of file Vector.hpp.
|
inline |
Sets the value of this vector to the sum of itself and v1 (*this += v1).
v1 | the other vector |
Definition at line 218 of file Vector.hpp.
Referenced by OpenMD::operator+(), and OpenMD::Vector< Real, Dim >::operator+=().
|
inline |
Sets the value of this vector to the sum of v1 and v2 (*this = v1 + v2).
v1 | the first vector |
v2 | the second vector |
Definition at line 228 of file Vector.hpp.
|
inline |
Returns the product of all elements of this vector.
Definition at line 381 of file Vector.hpp.
|
inline |
Sets the value of this vector to the scalar division of vector v1 (*this = v1 / s ).
v1 | the source vector |
s | the scalar value |
Definition at line 322 of file Vector.hpp.
|
inline |
Sets the value of this vector to the scalar division of itself (*this /= s ).
s | the scalar value |
Definition at line 311 of file Vector.hpp.
Referenced by OpenMD::operator/(), and OpenMD::Vector< Real, Dim >::operator/=().
|
inline |
Copy the internal data to an array.
Definition at line 164 of file Vector.hpp.
|
inline |
Returns the pointer of internal array.
Definition at line 171 of file Vector.hpp.
Referenced by OpenMD::Thermo::getAngularMomentum(), OpenMD::Thermo::getCom(), OpenMD::Thermo::getComAll(), OpenMD::Thermo::getComVel(), OpenMD::Thermo::getInertiaTensor(), and OpenMD::Thermo::getSystemDipole().
|
inline |
Tests if this vector is normalized.
Definition at line 417 of file Vector.hpp.
References OpenMD::equal(), and OpenMD::Vector< Real, Dim >::lengthSquare().
|
inline |
Returns the length of this vector.
Definition at line 393 of file Vector.hpp.
References OpenMD::Vector< Real, Dim >::lengthSquare().
Referenced by OpenMD::Bend::calcForce(), OpenMD::GhostBend::calcForce(), OpenMD::MolecularRestraint::calcForce(), OpenMD::distance(), OpenMD::Bend::getValue(), OpenMD::Bond::getValue(), OpenMD::Torsion::getValue(), OpenMD::shapedLatticeSpherical::isInterior(), and OpenMD::Vector< Real, Dim >::normalize().
|
inline |
Returns the squared length of this vector.
Definition at line 399 of file Vector.hpp.
References OpenMD::dot().
Referenced by OpenMD::distanceSquare(), OpenMD::Cuboctahedron::getPoints(), OpenMD::Vector< Real, Dim >::isNormalized(), and OpenMD::Vector< Real, Dim >::length().
|
inline |
Definition at line 298 of file Vector.hpp.
|
inline |
Sets the value of this vector to the scalar multiplication of vector v1 (*this = s * v1).
v1 | the vector |
s | the scalar value |
Definition at line 270 of file Vector.hpp.
|
inline |
Sets the value of this vector to the scalar multiplication of itself (*this *= s).
s | the scalar value |
Definition at line 259 of file Vector.hpp.
Referenced by OpenMD::operator*(), OpenMD::operator*(), and OpenMD::Vector< Real, Dim >::operator*=().
|
inline |
Negates the value of this vector in place.
Definition at line 200 of file Vector.hpp.
Referenced by OpenMD::operator-().
|
inline |
Sets the value of this vector to the negation of vector v1.
v1 | the source vector |
Definition at line 209 of file Vector.hpp.
|
inline |
Normalizes this vector in place.
Definition at line 402 of file Vector.hpp.
References OpenMD::Vector< Real, Dim >::length().
Referenced by OpenMD::SquareMatrix3< Real >::axisAngle(), OpenMD::SquareMatrix3< Real >::diagonalize(), OpenMD::Quaternion< Real >::fromAxisAngle(), OpenMD::Inversion::getValue(), and OpenMD::Torsion::getValue().
|
inline |
Tests if this vetor is not equal to other vector.
v | vector to be compared |
Definition at line 191 of file Vector.hpp.
|
inline |
Returns reference of ith element.
i | index |
Definition at line 138 of file Vector.hpp.
|
inline |
Returns constant reference of ith element.
i | index |
Definition at line 158 of file Vector.hpp.
|
inline |
Definition at line 354 of file Vector.hpp.
References OpenMD::Vector< Real, Dim >::mul().
|
inline |
Definition at line 342 of file Vector.hpp.
References OpenMD::Vector< Real, Dim >::add().
|
inline |
Definition at line 348 of file Vector.hpp.
References OpenMD::Vector< Real, Dim >::sub().
|
inline |
Definition at line 360 of file Vector.hpp.
References OpenMD::Vector< Real, Dim >::div().
|
inline |
array assignment operator
Definition at line 103 of file Vector.hpp.
|
inline |
copy assignment operator
Definition at line 93 of file Vector.hpp.
Referenced by OpenMD::Quaternion< Real >::operator=().
|
inline |
Tests if this vetor is equal to other vector.
v | vector to be compared |
Definition at line 178 of file Vector.hpp.
References OpenMD::equal().
|
inline |
Returns reference of ith element.
i | index |
Definition at line 128 of file Vector.hpp.
|
inline |
Returns constant reference of ith element.
i | index |
Definition at line 148 of file Vector.hpp.
|
inline |
Definition at line 419 of file Vector.hpp.
|
inline |
Sets the value of this vector to the difference of itself and v1 (*this -= v1).
v1 | the other vector |
Definition at line 238 of file Vector.hpp.
Referenced by OpenMD::operator-(), and OpenMD::Vector< Real, Dim >::operator-=().
|
inline |
Sets the value of this vector to the difference of vector v1 and v2 (*this = v1 - v2).
v1 | the first vector |
v2 | the second vector |
Definition at line 249 of file Vector.hpp.
|
inline |
Returns the sum of all elements of this vector.
Definition at line 369 of file Vector.hpp.
|
inline |
Sets the elements of this vector to the division of elements of two other vectors.
Not to be confused with scalar division (div)
(*this.data_[i] = v1.data_[i] / v2.data_[i]).
v1 | the first vector |
v2 | the second vector |
Definition at line 336 of file Vector.hpp.
|
inline |
Sets the elements of this vector to the multiplication of elements of two other vectors.
Not to be confused with scalar multiplication (mul) or dot products.
(*this.data_[i] = v1.data_[i] * v2.data_[i]).
v1 | the first vector |
v2 | the second vector |
Definition at line 284 of file Vector.hpp.
|
inline |
Zeros out the values in this vector in place.
Definition at line 194 of file Vector.hpp.
|
protected |
Definition at line 422 of file Vector.hpp.