OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::Vector< Real, Dim > Class Template Reference

Fix length vector class. More...

#include "math/Vector.hpp"

Public Types

typedef Real ElemType
 
typedef Real * ElemPoinerType
 

Public Member Functions

 Vector ()
 
 Vector (const Vector< Real, Dim > &v)
 
Vector< Real, Dim > & operator= (const Vector< Real, Dim > &v)
 
 Vector (const Real &s)
 
 Vector (Real *v)
 
Real & operator[] (unsigned int i)
 
Real & operator() (unsigned int i)
 
const Real & operator[] (unsigned int i) const
 
const Real & operator() (unsigned int i) const
 
void getArray (Real *array)
 
Real * getArrayPointer ()
 
bool operator== (const Vector< Real, Dim > &v)
 
bool operator!= (const Vector< Real, Dim > &v)
 
void zero ()
 
void negate ()
 
void negate (const Vector< Real, Dim > &v1)
 
void add (const Vector< Real, Dim > &v1)
 
void add (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2)
 
void sub (const Vector< Real, Dim > &v1)
 
void sub (const Vector< Real, Dim > &v1, const Vector &v2)
 
void mul (Real s)
 
void mul (const Vector< Real, Dim > &v1, Real s)
 
void Vmul (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2)
 
Vector< Real, Dim > & abs ()
 
Real max ()
 
void div (Real s)
 
void div (const Vector< Real, Dim > &v1, Real s)
 
void Vdiv (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2)
 
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 ()
 
Real componentProduct ()
 
Real length ()
 
Real lengthSquare ()
 
void normalize ()
 
bool isNormalized ()
 
unsigned int size ()
 

Protected Attributes

Real data_ [Dim]
 

Detailed Description

template<typename Real, unsigned int Dim>
class OpenMD::Vector< Real, Dim >

Fix length vector class.

Definition at line 81 of file Vector.hpp.

Member Typedef Documentation

◆ ElemPoinerType

template<typename Real, unsigned int Dim>
typedef Real* OpenMD::Vector< Real, Dim >::ElemPoinerType

Definition at line 85 of file Vector.hpp.

◆ ElemType

template<typename Real, unsigned int Dim>
typedef Real OpenMD::Vector< Real, Dim >::ElemType

Definition at line 84 of file Vector.hpp.

Constructor & Destructor Documentation

◆ Vector() [1/4]

template<typename Real, unsigned int Dim>
OpenMD::Vector< Real, Dim >::Vector ( )
inline

default constructor

Definition at line 88 of file Vector.hpp.

◆ Vector() [2/4]

template<typename Real, unsigned int Dim>
OpenMD::Vector< Real, Dim >::Vector ( const Vector< Real, Dim > &  v)
inline

Constructs and initializes a Vector from a vector

Definition at line 94 of file Vector.hpp.

◆ Vector() [3/4]

template<typename Real, unsigned int Dim>
OpenMD::Vector< Real, Dim >::Vector ( const Real &  s)
inline

Definition at line 111 of file Vector.hpp.

◆ Vector() [4/4]

template<typename Real, unsigned int Dim>
OpenMD::Vector< Real, Dim >::Vector ( Real *  v)
inline

Constructs and initializes a Vector from an array

Definition at line 117 of file Vector.hpp.

Member Function Documentation

◆ abs()

template<typename Real, unsigned int Dim>
Vector<Real, Dim>& OpenMD::Vector< Real, Dim >::abs ( )
inline

Definition at line 294 of file Vector.hpp.

Referenced by OpenMD::Cuboctahedron::inCluster111().

◆ add() [1/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::add ( const Vector< Real, Dim > &  v1)
inline

Sets the value of this vector to the sum of itself and v1 (*this += v1).

Parameters
v1the other vector

Definition at line 225 of file Vector.hpp.

Referenced by OpenMD::operator+(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::operator+=().

◆ add() [2/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::add ( const Vector< Real, Dim > &  v1,
const Vector< Real, Dim > &  v2 
)
inline

Sets the value of this vector to the sum of v1 and v2 (*this = v1 + v2).

Parameters
v1the first vector
v2the second vector

Definition at line 235 of file Vector.hpp.

◆ componentProduct()

template<typename Real, unsigned int Dim>
Real OpenMD::Vector< Real, Dim >::componentProduct ( )
inline

Returns the product of all elements of this vector.

Returns
the product of all elements of this vector

Definition at line 384 of file Vector.hpp.

◆ div() [1/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::div ( Real  s)
inline

Sets the value of this vector to the scalar division of itself (*this /= s ).

Parameters
sthe scalar value

Definition at line 314 of file Vector.hpp.

Referenced by OpenMD::operator/(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::operator/=().

◆ div() [2/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::div ( const Vector< Real, Dim > &  v1,
Real  s 
)
inline

Sets the value of this vector to the scalar division of vector v1 (*this = v1 / s ).

Parameters
v1the source vector
sthe scalar value

Definition at line 324 of file Vector.hpp.

◆ getArray()

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::getArray ( Real *  array)
inline

Copy the internal data to an array

Definition at line 163 of file Vector.hpp.

◆ getArrayPointer()

template<typename Real, unsigned int Dim>
Real* OpenMD::Vector< Real, Dim >::getArrayPointer ( )
inline

◆ isNormalized()

template<typename Real, unsigned int Dim>
bool OpenMD::Vector< Real, Dim >::isNormalized ( )
inline

Tests if this vector is normalized

Returns
true if this vector is normalized, otherwise return false

Definition at line 424 of file Vector.hpp.

◆ length()

template<typename Real, unsigned int Dim>
Real OpenMD::Vector< Real, Dim >::length ( )
inline

Returns the length of this vector.

Returns
the length of this vector

Definition at line 396 of file Vector.hpp.

Referenced by OpenMD::Triangle::a(), OpenMD::Triangle::b(), OpenMD::Triangle::c(), OpenMD::DipoleCorrFunc::calcCorrVal(), OpenMD::DirectionalRCorrFunc::calcCorrVals(), OpenMD::LegendreCorrFunc::calcCorrVals(), OpenMD::COHZ::calcCorrVals(), OpenMD::LegendreCorrFuncZ::calcCorrVals(), OpenMD::GhostBend::calcForce(), OpenMD::GhostTorsion::calcForce(), OpenMD::Bond::calcForce(), OpenMD::Inversion::calcForce(), OpenMD::Torsion::calcForce(), OpenMD::ObjectRestraint::calcForce(), OpenMD::Bend::calcForce(), OpenMD::MolecularRestraint::calcForce(), OpenMD::ApproximationModel::calcHydroPropsAtCD(), OpenMD::ApproximationModel::calcHydroPropsAtCR(), OpenMD::RNEMD::collectData(), OpenMD::GofRAngle2::collectHistogram(), OpenMD::GofR::collectHistogram(), OpenMD::GofZ::collectHistogram(), OpenMD::Kirkwood::collectHistogram(), OpenMD::GofRAngle::collectHistogram(), OpenMD::KirkwoodQuadrupoles::collectHistogram(), OpenMD::SelectionEvaluator::compareProperty(), OpenMD::Triangle::computeArea(), OpenMD::HBondJump::computeFrame(), OpenMD::RCorrFuncR::computeProperty1(), OpenMD::Rattle::constraintPairA(), OpenMD::Rattle::constraintPairB(), OpenMD::distance(), OpenMD::ContactAngle2::doFrame(), OpenMD::GCNSeq::doFrame(), OpenMD::DistanceFinder::find(), OpenMD::ShellStatistics::getBin(), OpenMD::RNEMDRTheta::getBins(), OpenMD::NanoLength::getLength(), OpenMD::Electrostatic::getSitePotentials(), OpenMD::Thermo::getTaggedAtomPairDistance(), OpenMD::Torsion::getValue(), OpenMD::Bend::getValue(), OpenMD::Bond::getValue(), OpenMD::Sphere::isInterior(), OpenMD::shapedLatticeSpherical::isInterior(), main(), OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::normalize(), OpenMD::DumpReader::parseDumpLine(), OpenMD::RestReader::parseDumpLine(), OpenMD::LDForceManager::postCalculation(), OpenMD::MultipoleSum::process(), OpenMD::AngleR::process(), OpenMD::RhoR::process(), OpenMD::BOPofR::process(), OpenMD::SurfaceDiffusion::process(), OpenMD::BondAngleDistribution::process(), OpenMD::CoordinationNumber::process(), OpenMD::HBondGeometric::process(), OpenMD::TetrahedralityHBMatrix::process(), OpenMD::TetrahedralityParamXYZ::process(), OpenMD::TetrahedralityParam::process(), OpenMD::TetrahedralityParamZ::process(), OpenMD::TetrahedralityParamDens::process(), and OpenMD::BondOrderParameter::process().

◆ lengthSquare()

◆ max()

template<typename Real, unsigned int Dim>
Real OpenMD::Vector< Real, Dim >::max ( )
inline

Definition at line 302 of file Vector.hpp.

Referenced by OpenMD::Electrostatic::ReciprocalSpaceSum().

◆ mul() [1/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::mul ( Real  s)
inline

Sets the value of this vector to the scalar multiplication of itself (*this *= s).

Parameters
sthe scalar value

Definition at line 263 of file Vector.hpp.

Referenced by OpenMD::operator*(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::operator*=().

◆ mul() [2/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::mul ( const Vector< Real, Dim > &  v1,
Real  s 
)
inline

Sets the value of this vector to the scalar multiplication of vector v1 (*this = s * v1).

Parameters
v1the vector
sthe scalar value

Definition at line 274 of file Vector.hpp.

◆ negate() [1/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::negate ( )
inline

Negates the value of this vector in place.

Definition at line 206 of file Vector.hpp.

Referenced by OpenMD::operator-(), OpenMD::RippleOP::process(), and OpenMD::P2OrderParameter::process().

◆ negate() [2/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::negate ( const Vector< Real, Dim > &  v1)
inline

Sets the value of this vector to the negation of vector v1.

Parameters
v1the source vector

Definition at line 215 of file Vector.hpp.

◆ normalize()

◆ operator!=()

template<typename Real, unsigned int Dim>
bool OpenMD::Vector< Real, Dim >::operator!= ( const Vector< Real, Dim > &  v)
inline

Tests if this vetor is not equal to other vector

Returns
true if equal, otherwise return false
Parameters
vvector to be compared

Definition at line 195 of file Vector.hpp.

◆ operator()() [1/2]

template<typename Real, unsigned int Dim>
Real& OpenMD::Vector< Real, Dim >::operator() ( unsigned int  i)
inline

Returns reference of ith element.

Returns
reference of ith element
Parameters
iindex

Definition at line 137 of file Vector.hpp.

◆ operator()() [2/2]

template<typename Real, unsigned int Dim>
const Real& OpenMD::Vector< Real, Dim >::operator() ( unsigned int  i) const
inline

Returns constant reference of ith element.

Returns
reference of ith element
Parameters
iindex

Definition at line 157 of file Vector.hpp.

◆ operator*=()

template<typename Real, unsigned int Dim>
Vector<Real, Dim>& OpenMD::Vector< Real, Dim >::operator*= ( Real  s)
inline
See also
mul

Definition at line 357 of file Vector.hpp.

◆ operator+=()

template<typename Real, unsigned int Dim>
Vector<Real, Dim>& OpenMD::Vector< Real, Dim >::operator+= ( const Vector< Real, Dim > &  v1)
inline
See also
add

Definition at line 345 of file Vector.hpp.

◆ operator-=()

template<typename Real, unsigned int Dim>
Vector<Real, Dim>& OpenMD::Vector< Real, Dim >::operator-= ( const Vector< Real, Dim > &  v1)
inline
See also
sub

Definition at line 351 of file Vector.hpp.

◆ operator/=()

template<typename Real, unsigned int Dim>
Vector<Real, Dim>& OpenMD::Vector< Real, Dim >::operator/= ( Real  s)
inline
See also
div

Definition at line 363 of file Vector.hpp.

◆ operator=()

template<typename Real, unsigned int Dim>
Vector<Real, Dim>& OpenMD::Vector< Real, Dim >::operator= ( const Vector< Real, Dim > &  v)
inline

copy assignment operator

Definition at line 99 of file Vector.hpp.

Referenced by OpenMD::Vector3< int >::operator=(), and OpenMD::Quaternion< Real >::operator=().

◆ operator==()

template<typename Real, unsigned int Dim>
bool OpenMD::Vector< Real, Dim >::operator== ( const Vector< Real, Dim > &  v)
inline

Tests if this vetor is equal to other vector

Returns
true if equal, otherwise return false
Parameters
vvector to be compared

Definition at line 179 of file Vector.hpp.

◆ operator[]() [1/2]

template<typename Real, unsigned int Dim>
Real& OpenMD::Vector< Real, Dim >::operator[] ( unsigned int  i)
inline

Returns reference of ith element.

Returns
reference of ith element
Parameters
iindex

Definition at line 127 of file Vector.hpp.

◆ operator[]() [2/2]

template<typename Real, unsigned int Dim>
const Real& OpenMD::Vector< Real, Dim >::operator[] ( unsigned int  i) const
inline

Returns constant reference of ith element.

Returns
reference of ith element
Parameters
iindex

Definition at line 147 of file Vector.hpp.

◆ size()

template<typename Real, unsigned int Dim>
unsigned int OpenMD::Vector< Real, Dim >::size ( )
inline

Definition at line 428 of file Vector.hpp.

Referenced by OpenMD::TetrahedralityParam::writeOrderParameter().

◆ sub() [1/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::sub ( const Vector< Real, Dim > &  v1)
inline

Sets the value of this vector to the difference of itself and v1 (*this -= v1).

Parameters
v1the other vector

Definition at line 244 of file Vector.hpp.

Referenced by OpenMD::operator-(), and OpenMD::Vector< RealType, N_INTERACTION_FAMILIES >::operator-=().

◆ sub() [2/2]

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::sub ( const Vector< Real, Dim > &  v1,
const Vector< Real, Dim > &  v2 
)
inline

Sets the value of this vector to the difference of vector v1 and v2 (*this = v1 - v2).

Parameters
v1the first vector
v2the second vector

Definition at line 254 of file Vector.hpp.

◆ sum()

template<typename Real, unsigned int Dim>
Real OpenMD::Vector< Real, Dim >::sum ( )
inline

Returns the sum of all elements of this vector.

Returns
the sum of all elements of this vector

Definition at line 372 of file Vector.hpp.

Referenced by OpenMD::RMSD::calculate_rmsd().

◆ Vdiv()

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::Vdiv ( const Vector< Real, Dim > &  v1,
const Vector< Real, Dim > &  v2 
)
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]).

Parameters
v1the first vector
v2the second vector

Definition at line 338 of file Vector.hpp.

Referenced by OpenMD::Electrostatic::ReciprocalSpaceSum().

◆ Vmul()

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::Vmul ( const Vector< Real, Dim > &  v1,
const Vector< Real, Dim > &  v2 
)
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]).

Parameters
v1the first vector
v2the second vector

Definition at line 288 of file Vector.hpp.

Referenced by OpenMD::Electrostatic::ReciprocalSpaceSum().

◆ zero()

template<typename Real, unsigned int Dim>
void OpenMD::Vector< Real, Dim >::zero ( )
inline

Zeros out the values in this vector in place

Definition at line 200 of file Vector.hpp.

Referenced by OpenMD::Electrostatic::calcForce(), and OpenMD::ForceManager::longRangeInteractions().

Member Data Documentation

◆ data_


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