OpenMD 3.1
Molecular Dynamics in the Open
|
Dynamically-sized vector class. More...
#include "math/DynamicVector.hpp"
Public Types | |
using | value_type = Real |
using | allocator_type = Alloc |
using | VectorType = std::vector<Real, Alloc> |
using | size_type = typename VectorType::size_type |
using | difference_type = typename VectorType::difference_type |
using | reference = typename VectorType::reference |
using | const_reference = typename VectorType::const_reference |
using | pointer = typename VectorType::pointer |
using | const_pointer = typename VectorType::const_pointer |
using | iterator = typename VectorType::iterator |
using | const_iterator = typename VectorType::const_iterator |
using | reverse_iterator = typename VectorType::reverse_iterator |
using | const_reverse_iterator = typename VectorType::const_reverse_iterator |
Public Member Functions | |
DynamicVector (const allocator_type &alloc=allocator_type()) | |
Default constructor creates no elements. | |
DynamicVector (size_type n, const value_type &value, const allocator_type &alloc=allocator_type()) | |
Create a DynamicVector with copies of an exemplar element. | |
DynamicVector (size_type n, const allocator_type &alloc=allocator_type()) | |
Create a DynamicVector with default elements. | |
template<typename InputIterator > | |
DynamicVector (InputIterator first, InputIterator last, const allocator_type &alloc=allocator_type()) | |
Create a DynamicVector using an iterator range. | |
DynamicVector (std::initializer_list< value_type > init, const allocator_type &alloc=allocator_type()) | |
Create a DynamicVector with the contents of an initializer_list. | |
reference | operator[] (size_type i) |
const_reference | operator[] (size_type i) const |
reference | operator() (size_type i) |
const_reference | operator() (size_type i) const |
iterator | begin () noexcept |
const_iterator | begin () const noexcept |
const_iterator | cbegin () const noexcept |
iterator | end () noexcept |
const_iterator | end () const noexcept |
const_iterator | cend () const noexcept |
bool | empty () const noexcept |
size_type | size () const noexcept |
void | resize (size_type n) |
void | resize (size_type n, const value_type &value) |
void | reserve (size_type new_cap) |
bool | operator== (const DynamicVector< Real > &v) |
Tests if this vetor is equal to other vector. | |
bool | operator!= (const DynamicVector< Real > &v) |
Tests if this vetor is not equal to other vector. | |
void | negate () |
Negates the value of this vector in place. | |
void | negate (const DynamicVector< Real > &v1) |
Sets the value of this vector to the negation of vector v1. | |
void | add (const DynamicVector< Real > &v1) |
Sets the value of this vector to the sum of itself and v1 (*this += v1). | |
void | add (const DynamicVector< Real > &v1, const DynamicVector< Real > &v2) |
Sets the value of this vector to the sum of v1 and v2 (*this = v1 + v2). | |
void | sub (const DynamicVector< Real > &v1) |
Sets the value of this vector to the difference of itself and v1 (*this -= v1). | |
void | sub (const DynamicVector< Real > &v1, const DynamicVector< Real > &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 DynamicVector< Real > &v1, Real s) |
Sets the value of this vector to the scalar multiplication of vector v1 (*this = s * v1). | |
void | div (Real s) |
Sets the value of this vector to the scalar division of itself (*this /= s). | |
void | div (const DynamicVector< Real > &v1, Real s) |
Sets the value of this vector to the scalar division of vector v1 (*this = v1 / s). | |
DynamicVector< Real > & | operator+= (const DynamicVector< Real > &v1) |
DynamicVector< Real > & | operator-= (const DynamicVector< Real > &v1) |
DynamicVector< Real > & | operator*= (Real s) |
DynamicVector< Real > & | operator/= (Real s) |
void | setZero () |
zero out the 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. | |
template<class VectorType > | |
void | getSubVector (size_type beginning, VectorType &v) |
Dynamically-sized vector class.
Definition at line 71 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::allocator_type = Alloc |
Definition at line 74 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::const_iterator = typename VectorType::const_iterator |
Definition at line 83 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::const_pointer = typename VectorType::const_pointer |
Definition at line 81 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::const_reference = typename VectorType::const_reference |
Definition at line 79 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::const_reverse_iterator = typename VectorType::const_reverse_iterator |
Definition at line 85 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::difference_type = typename VectorType::difference_type |
Definition at line 77 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::iterator = typename VectorType::iterator |
Definition at line 82 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::pointer = typename VectorType::pointer |
Definition at line 80 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::reference = typename VectorType::reference |
Definition at line 78 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::reverse_iterator = typename VectorType::reverse_iterator |
Definition at line 84 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::size_type = typename VectorType::size_type |
Definition at line 76 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::value_type = Real |
Definition at line 73 of file DynamicVector.hpp.
using OpenMD::DynamicVector< Real, Alloc >::VectorType = std::vector<Real, Alloc> |
Definition at line 75 of file DynamicVector.hpp.
|
inlineexplicit |
Default constructor creates no elements.
alloc | The allocator_type to use |
Definition at line 91 of file DynamicVector.hpp.
|
inline |
Create a DynamicVector with copies of an exemplar element.
n | The number of elements to initially create. |
value | An element to copy. |
alloc | The allocator_type to use |
This constructor fills the DynamicVector with n copies of value.
Definition at line 102 of file DynamicVector.hpp.
|
inlineexplicit |
Create a DynamicVector with default elements.
n | The number of elements to initially create. |
alloc | The allocator_type to use |
This constructor fills the DynamicVector with n copies of a default-constructed element.
Definition at line 114 of file DynamicVector.hpp.
|
inline |
Create a DynamicVector using an iterator range.
first | The beginning of the range to copy the elements from |
last | The end of the range to copy the elements from |
alloc | The allocator_type to use |
Definition at line 125 of file DynamicVector.hpp.
|
inline |
Create a DynamicVector with the contents of an initializer_list.
init | Initializer list to initialize the elements with |
alloc | The allocator_type to use |
Definition at line 134 of file DynamicVector.hpp.
|
inline |
Sets the value of this vector to the sum of itself and v1 (*this += v1).
v1 | the other vector |
Definition at line 205 of file DynamicVector.hpp.
Referenced by OpenMD::operator+(), and OpenMD::DynamicVector< Real, Alloc >::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 215 of file DynamicVector.hpp.
|
inlinenoexcept |
Definition at line 147 of file DynamicVector.hpp.
|
inlinenoexcept |
Definition at line 146 of file DynamicVector.hpp.
|
inlinenoexcept |
Definition at line 148 of file DynamicVector.hpp.
|
inlinenoexcept |
Definition at line 152 of file DynamicVector.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 280 of file DynamicVector.hpp.
|
inline |
Sets the value of this vector to the scalar division of itself (*this /= s).
s | the scalar value |
Definition at line 269 of file DynamicVector.hpp.
Referenced by OpenMD::operator/(), and OpenMD::DynamicVector< Real, Alloc >::operator/=().
|
inlinenoexcept |
Definition at line 155 of file DynamicVector.hpp.
|
inlinenoexcept |
Definition at line 151 of file DynamicVector.hpp.
|
inlinenoexcept |
Definition at line 150 of file DynamicVector.hpp.
|
inline |
Definition at line 343 of file DynamicVector.hpp.
|
inline |
Tests if this vector is normalized.
Definition at line 340 of file DynamicVector.hpp.
References OpenMD::equal(), and OpenMD::DynamicVector< Real, Alloc >::lengthSquare().
|
inline |
Returns the length of this vector.
Definition at line 318 of file DynamicVector.hpp.
References OpenMD::DynamicVector< Real, Alloc >::lengthSquare().
Referenced by OpenMD::distance(), and OpenMD::DynamicVector< Real, Alloc >::normalize().
|
inline |
Returns the squared length of this vector.
Definition at line 324 of file DynamicVector.hpp.
References OpenMD::dot().
Referenced by OpenMD::distanceSquare(), OpenMD::DynamicVector< Real, Alloc >::isNormalized(), and OpenMD::DynamicVector< Real, Alloc >::length().
|
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 257 of file DynamicVector.hpp.
|
inline |
Sets the value of this vector to the scalar multiplication of itself (*this *= s).
s | the scalar value |
Definition at line 246 of file DynamicVector.hpp.
Referenced by OpenMD::operator*(), OpenMD::operator*(), and OpenMD::DynamicVector< Real, Alloc >::operator*=().
|
inline |
Negates the value of this vector in place.
Definition at line 187 of file DynamicVector.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 196 of file DynamicVector.hpp.
|
inline |
Normalizes this vector in place.
Definition at line 327 of file DynamicVector.hpp.
References OpenMD::DynamicVector< Real, Alloc >::length().
|
inline |
Tests if this vetor is not equal to other vector.
v | vector to be compared |
Definition at line 184 of file DynamicVector.hpp.
|
inline |
Definition at line 142 of file DynamicVector.hpp.
|
inline |
Definition at line 143 of file DynamicVector.hpp.
|
inline |
Definition at line 300 of file DynamicVector.hpp.
References OpenMD::DynamicVector< Real, Alloc >::mul().
|
inline |
Definition at line 288 of file DynamicVector.hpp.
References OpenMD::DynamicVector< Real, Alloc >::add().
|
inline |
Definition at line 294 of file DynamicVector.hpp.
References OpenMD::DynamicVector< Real, Alloc >::sub().
|
inline |
Definition at line 306 of file DynamicVector.hpp.
References OpenMD::DynamicVector< Real, Alloc >::div().
|
inline |
Tests if this vetor is equal to other vector.
v | vector to be compared |
Definition at line 171 of file DynamicVector.hpp.
|
inline |
Definition at line 139 of file DynamicVector.hpp.
|
inline |
Definition at line 140 of file DynamicVector.hpp.
|
inline |
Definition at line 164 of file DynamicVector.hpp.
|
inline |
Definition at line 159 of file DynamicVector.hpp.
|
inline |
Definition at line 160 of file DynamicVector.hpp.
|
inline |
zero out the vector
Definition at line 312 of file DynamicVector.hpp.
|
inlinenoexcept |
Definition at line 156 of file DynamicVector.hpp.
|
inline |
Sets the value of this vector to the difference of itself and v1 (*this -= v1).
v1 | the other vector |
Definition at line 225 of file DynamicVector.hpp.
Referenced by OpenMD::operator-(), and OpenMD::DynamicVector< Real, Alloc >::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 236 of file DynamicVector.hpp.