| Bsoft 2.0.5 Bernard's software package

Classes | Functions
Vector3.h File Reference

Class for 3-value vectors. More...

`#include <iostream>`
`#include <cmath>`
`#include <vector>`
`#include "math_util.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Classes
class | Vector3< Type >
| Vector class for 3-value vectors used in 3D space. The internal variables are an array of 3 numbers. More...

## Functions
template<typename Type >
ostream & | operator<< (ostream &output, Vector3< Type > vec)
template<typename Type >
ostream & | operator<< (ostream &output, vector< Type > vec)
template<typename T >
vector< T > | operator- (vector< T > v1)
template<typename T1 , typename T2 >
vector< T1 > | operator+ (vector< T1 > v1, vector< T2 > v2)
template<typename T1 , typename T2 >
vector< T1 > | operator+ (vector< T1 > v1, T2 v2)
template<typename T1 , typename T2 >
void | operator+= (vector< T1 > &v1, vector< T2 > v2)
template<typename T1 , typename T2 >
void | operator+= (vector< T1 > &v1, T2 v2)
template<typename T1 , typename T2 >
vector< T1 > | operator- (vector< T1 > v1, vector< T2 > v2)
template<typename T1 , typename T2 >
vector< T1 > | operator- (vector< T1 > v1, Vector3< T2 > &v2)
template<typename T1 , typename T2 >
vector< T1 > | operator- (vector< T1 > v1, T2 v2)
template<typename T1 , typename T2 >
void | operator-= (vector< T1 > &v1, vector< T2 > v2)
template<typename T1 , typename T2 >
void | operator-= (vector< T1 > &v1, T2 v2)
template<typename T1 , typename T2 >
vector< T1 > | operator * (vector< T1 > v1, T2 v2)
template<typename T1 , typename T2 >
void | operator *= (vector< T1 > &v1, T2 v2)
template<typename T1 , typename T2 >
vector< T1 > | operator * (vector< T1 > v1, vector< T2 > v2)
template<typename T1 , typename T2 >
void | operator *= (vector< T1 > &v1, vector< T2 > v2)
template<typename T1 , typename T2 >
vector< T1 > | operator/ (vector< T1 > v1, T2 v2)
template<typename T1 , typename T2 >
void | operator/= (vector< T1 > &v1, T2 v2)
template<typename T1 , typename T2 >
vector< T1 > | operator/ (vector< T1 > v1, vector< T2 > v2)
template<typename T1 , typename T2 >
void | operator/= (vector< T1 > v1, vector< T2 > v2)
template<typename T >
double | length2 (vector< T > v)
template<typename T >
double | length (vector< T > v)
template<typename T1 , typename T2 >
double | distance (vector< T1 > &v1, vector< T2 > &v2)
template<typename T >
T | volume (vector< T > v)
template<typename T >
vector< T > | absolute (vector< T > v1)
template<typename T1 , typename T2 >
vector< T1 > | vecmin (vector< T1 > v1, vector< T2 > v2)
template<typename T1 , typename T2 >
vector< T1 > | vecmin (vector< T1 > v1, T2 v2)
template<typename T1 , typename T2 >
vector< T1 > | vecmax (vector< T1 > v1, vector< T2 > v2)
template<typename T1 , typename T2 >
vector< T1 > | vecmax (vector< T1 > v1, T2 v2)
template<typename T1 , typename T2 >
double | scalar (vector< T1 > &v1, vector< T2 > &v2)
template<typename T1 , typename T2 >
vector< T1 > | cross (vector< T1 > &v1, vector< T2 > &v2)
template<typename Type >
Vector3< Type > | operator/ (double d, Vector3< Type > vec)
| Divides a value by each of the elements of a 3-value vector. More...
template<typename Type >
Vector3< Type > | vector3_scalar_range (Vector3< Type > vec, double min, double max)
template<typename T1 , typename T2 >
Vector3< T1 > | vector3_origin_to_shift (Vector3< T1 > origin, Vector3< T2 > size)
template<typename T1 , typename T2 >
Vector3< T1 > | vector3_set_PBC (Vector3< T1 > coord, Vector3< T2 > box)
template<typename T1 , typename T2 >
Vector3< T1 > | vector3_difference_PBC (Vector3< T1 > &v1, Vector3< T1 > &v2, Vector3< T2 > &box)

## Detailed Description

Class for 3-value vectors.

Author
  Bernard Heymann

Date
  Created: 20000501
  Modified: 20190708

Definition in file Vector3.h.

## Function Documentation

## ◆ absolute()

template<typename T >

vector<T> absolute | ( | vector< T > | v1 | ) |
| inline

Definition at line 556 of file Vector3.h.

## ◆ cross()

template<typename T1 , typename T2 >

vector<T1> cross | ( | vector< T1 > & | v1,
|  | vector< T2 > & | v2
| ) |  |
| inline

Definition at line 622 of file Vector3.h.

## ◆ distance()

template<typename T1 , typename T2 >

double distance | ( | vector< T1 > & | v1,
|  | vector< T2 > & | v2
| ) |  |
| inline

Definition at line 536 of file Vector3.h.

## ◆ length()

template<typename T >

double length | ( | vector< T > | v | ) |
| inline

Definition at line 528 of file Vector3.h.

## ◆ length2()

template<typename T >

double length2 | ( | vector< T > | v | ) |
| inline

Definition at line 517 of file Vector3.h.

## ◆ operator *() [1/2]

template<typename T1 , typename T2 >

vector<T1> operator * | ( | vector< T1 > | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 445 of file Vector3.h.

## ◆ operator *() [2/2]

template<typename T1 , typename T2 >

vector<T1> operator * | ( | vector< T1 > | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 463 of file Vector3.h.

## ◆ operator *=() [1/2]

template<typename T1 , typename T2 >

void operator *= | ( | vector< T1 > & | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 456 of file Vector3.h.

## ◆ operator *=() [2/2]

template<typename T1 , typename T2 >

void operator *= | ( | vector< T1 > & | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 474 of file Vector3.h.

## ◆ operator+() [1/2]

template<typename T1 , typename T2 >

vector<T1> operator+ | ( | vector< T1 > | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 363 of file Vector3.h.

## ◆ operator+() [2/2]

template<typename T1 , typename T2 >

vector<T1> operator+ | ( | vector< T1 > | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 374 of file Vector3.h.

## ◆ operator+=() [1/2]

template<typename T1 , typename T2 >

void operator+= | ( | vector< T1 > & | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 385 of file Vector3.h.

## ◆ operator+=() [2/2]

template<typename T1 , typename T2 >

void operator+= | ( | vector< T1 > & | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 392 of file Vector3.h.

## ◆ operator-() [1/4]

template<typename T >

vector<T> operator- | ( | vector< T > | v1 | ) |
| inline

Definition at line 352 of file Vector3.h.

## ◆ operator-() [2/4]

template<typename T1 , typename T2 >

vector<T1> operator- | ( | vector< T1 > | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 400 of file Vector3.h.

## ◆ operator-() [3/4]

template<typename T1 , typename T2 >

vector<T1> operator- | ( | vector< T1 > | v1,
|  | Vector3< T2 > & | v2
| ) |  |
| inline

Definition at line 411 of file Vector3.h.

## ◆ operator-() [4/4]

template<typename T1 , typename T2 >

vector<T1> operator- | ( | vector< T1 > | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 420 of file Vector3.h.

## ◆ operator-=() [1/2]

template<typename T1 , typename T2 >

void operator-= | ( | vector< T1 > & | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 431 of file Vector3.h.

## ◆ operator-=() [2/2]

template<typename T1 , typename T2 >

void operator-= | ( | vector< T1 > & | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 438 of file Vector3.h.

## ◆ operator/() [1/3]

template<typename T1 , typename T2 >

vector<T1> operator/ | ( | vector< T1 > | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 481 of file Vector3.h.

## ◆ operator/() [2/3]

template<typename T1 , typename T2 >

vector<T1> operator/ | ( | vector< T1 > | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 499 of file Vector3.h.

## ◆ operator/() [3/3]

template<typename Type >

Vector3<Type> operator/ | ( | double | d,
|  | Vector3< Type > | vec
| ) |  |
| inline

Divides a value by each of the elements of a 3-value vector.

Parameters

  d | value to be divided.
  vec | 3-value vector.

Returns
  Vector3<Type> new 3-value vector.

      All elements of the vector must be non-zero.

Definition at line 643 of file Vector3.h.

## ◆ operator/=() [1/2]

template<typename T1 , typename T2 >

void operator/= | ( | vector< T1 > & | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 492 of file Vector3.h.

## ◆ operator/=() [2/2]

template<typename T1 , typename T2 >

void operator/= | ( | vector< T1 > | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 510 of file Vector3.h.

## ◆ operator<<() [1/2]

template<typename Type >

ostream& operator<< | ( | ostream & | output,
|  | Vector3< Type > | vec
| ) |  |

Definition at line 290 of file Vector3.h.

## ◆ operator<<() [2/2]

template<typename Type >

ostream& operator<< | ( | ostream & | output,
|  | vector< Type > | vec
| ) |  |

Definition at line 297 of file Vector3.h.

## ◆ scalar()

template<typename T1 , typename T2 >

double scalar | ( | vector< T1 > & | v1,
|  | vector< T2 > & | v2
| ) |  |
| inline

Definition at line 611 of file Vector3.h.

## ◆ vecmax() [1/2]

template<typename T1 , typename T2 >

vector<T1> vecmax | ( | vector< T1 > | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 589 of file Vector3.h.

## ◆ vecmax() [2/2]

template<typename T1 , typename T2 >

vector<T1> vecmax | ( | vector< T1 > | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 600 of file Vector3.h.

## ◆ vecmin() [1/2]

template<typename T1 , typename T2 >

vector<T1> vecmin | ( | vector< T1 > | v1,
|  | vector< T2 > | v2
| ) |  |
| inline

Definition at line 567 of file Vector3.h.

## ◆ vecmin() [2/2]

template<typename T1 , typename T2 >

vector<T1> vecmin | ( | vector< T1 > | v1,
|  | T2 | v2
| ) |  |
| inline

Definition at line 578 of file Vector3.h.

## ◆ vector3_difference_PBC()

template<typename T1 , typename T2 >

Vector3<T1> vector3_difference_PBC | ( | Vector3< T1 > & | v1,
|  | Vector3< T1 > & | v2,
|  | Vector3< T2 > & | box
| ) |  |
| inline

Definition at line 695 of file Vector3.h.

## ◆ vector3_origin_to_shift()

template<typename T1 , typename T2 >

Vector3<T1> vector3_origin_to_shift | ( | Vector3< T1 > | origin,
|  | Vector3< T2 > | size
| ) |  |

Definition at line 667 of file Vector3.h.

## ◆ vector3_scalar_range()

template<typename Type >

Vector3<Type> vector3_scalar_range | ( | Vector3< Type > | vec,
|  | double | min,
|  | double | max
| ) |  |
| inline

Definition at line 652 of file Vector3.h.

## ◆ vector3_set_PBC()

template<typename T1 , typename T2 >

Vector3<T1> vector3_set_PBC | ( | Vector3< T1 > | coord,
|  | Vector3< T2 > | box
| ) |  |
| inline

Definition at line 682 of file Vector3.h.

## ◆ volume()

template<typename T >

T volume | ( | vector< T > | v | ) |
| inline

Definition at line 545 of file Vector3.h.