|
OpenMD 3.2
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) const |
| Copy the internal data to an array. | |
| const Real * | getArrayPointer () const |
| Returns the pointer of internal array. | |
| Real * | getArrayPointer () |
| 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 () const |
| 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 () const |
| Returns the sum of all elements of this vector. | |
| Real | componentProduct () const |
| Returns the product of all elements of this vector. | |
| Real | length () const |
| Returns the length of this vector. | |
| Real | lengthSquare () const |
| Returns the squared length of this vector. | |
| void | normalize () |
| Normalizes this vector in place. | |
| bool | isNormalized () const |
| Tests if this vector is normalized. | |
| unsigned int | size () const |
Protected Attributes | |
| Real | data_ [Dim] {} |
Fix length vector class.
Definition at line 81 of file Vector.hpp.
| using OpenMD::Vector< Real, Dim >::ElemPoinerType = Real* |
Definition at line 84 of file Vector.hpp.
| using OpenMD::Vector< Real, Dim >::ElemType = Real |
Definition at line 83 of file Vector.hpp.
|
inline |
default constructor
Definition at line 87 of file Vector.hpp.
Referenced by OpenMD::Vector2< int >::Vector2(), and OpenMD::Vector3< int >::Vector3().
|
inline |
Constructs and initializes a Vector from a vector.
Definition at line 93 of file Vector.hpp.
|
inline |
Definition at line 115 of file Vector.hpp.
|
inline |
Constructs and initializes a Vector from an array.
Definition at line 121 of file Vector.hpp.
|
inline |
Definition at line 294 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 222 of file Vector.hpp.
Referenced by OpenMD::operator+(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::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 232 of file Vector.hpp.
|
inline |
Returns the product of all elements of this vector.
Definition at line 385 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 326 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 315 of file Vector.hpp.
Referenced by OpenMD::operator/(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::operator/=().
|
inline |
Copy the internal data to an array.
Definition at line 167 of file Vector.hpp.
|
inline |
Definition at line 175 of file Vector.hpp.
|
inline |
Returns the pointer of internal array.
Definition at line 174 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 418 of file Vector.hpp.
|
inline |
Returns the length of this vector.
Definition at line 397 of file Vector.hpp.
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(), OpenMD::RPY::muRD_dot_E(), OpenMD::RPY::muRR(), OpenMD::RPY::muRT(), OpenMD::RPY::muTD_dot_E(), OpenMD::RPY::muTR(), OpenMD::RPY::muTT(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::normalize().
|
inline |
Returns the squared length of this vector.
Definition at line 403 of file Vector.hpp.
Referenced by OpenMD::distanceSquare(), OpenMD::Cuboctahedron::getPoints(), OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::isNormalized(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::length().
|
inline |
Definition at line 302 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 274 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 263 of file Vector.hpp.
Referenced by OpenMD::operator*(), OpenMD::operator*(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::operator*=().
|
inline |
Negates the value of this vector in place.
Definition at line 204 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 213 of file Vector.hpp.
|
inline |
Normalizes this vector in place.
Definition at line 406 of file Vector.hpp.
Referenced by OpenMD::SquareMatrix3< RealType >::axisAngle(), OpenMD::SquareMatrix3< Real >::diagonalize(), OpenMD::Quaternion< RealType >::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 195 of file Vector.hpp.
|
inline |
Returns reference of ith element.
| i | index |
Definition at line 141 of file Vector.hpp.
|
inline |
Returns constant reference of ith element.
| i | index |
Definition at line 161 of file Vector.hpp.
|
inline |
Definition at line 358 of file Vector.hpp.
|
inline |
Definition at line 346 of file Vector.hpp.
|
inline |
Definition at line 352 of file Vector.hpp.
|
inline |
Definition at line 364 of file Vector.hpp.
|
inline |
array assignment operator
Definition at line 106 of file Vector.hpp.
|
inline |
copy assignment operator
Definition at line 96 of file Vector.hpp.
Referenced by OpenMD::Quaternion< RealType >::operator=().
|
inline |
Tests if this vetor is equal to other vector.
| v | vector to be compared |
Definition at line 182 of file Vector.hpp.
|
inline |
Returns reference of ith element.
| i | index |
Definition at line 131 of file Vector.hpp.
|
inline |
Returns constant reference of ith element.
| i | index |
Definition at line 151 of file Vector.hpp.
|
inline |
Definition at line 420 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 242 of file Vector.hpp.
Referenced by OpenMD::operator-(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::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 253 of file Vector.hpp.
|
inline |
Returns the sum of all elements of this vector.
Definition at line 373 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 340 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 288 of file Vector.hpp.
|
inline |
Zeros out the values in this vector in place.
Definition at line 198 of file Vector.hpp.
|
protected |
Definition at line 423 of file Vector.hpp.