Struct basis3D

Struct Documentation

struct basis3D

represent a basis of 3D vectors

The use of a “working basis” (e.g. Cartesian) is assumed throughout, and all vectors of the basis3D object are expressed in terms of this working basis.

Public Functions

inline basis3D()
basis3D(vector<double> _e)
inline void trivial()
void init()

initialises the basis once its vectors have been defined.

Calculates the matrix M necessary for basis changes, and the volume.

void inverse()

Used when the basis vectors provided, instead of being expressed in the working basis, are rather the working basis vectors expressed in the basis we are interested in.

In other words, the basis needs to be inverted. The matrix M is read directly (without need to invert) and then a copy of it is inverted in order to read the components of the vectors.

vector3D<double> to(const vector3D<double> &v)

from a vector V expressed in the working basis, provides as output its components in the current basis

Parameters:

V – vector expressed in the working (Cartesian) basis

vector3D<double> from(const vector3D<double> &v)

from a vector V expressed in the current basis, provides as output its components in the working basis

void dual(basis3D &D)

Returns another basis, 2PI dual of the current basis.

Public Members

vector<vector3D<double>> e

basis vectors

matrix<double> M

inverse of the matrix whose rows are the basis vectors

double vol

volume of the triad (triple product of the basis vectors)

Friends

friend std::istream &operator>>(std::istream &flux, basis3D &x)

reads the vectors of the basis from a stream

friend std::ostream &operator<<(std::ostream &flux, basis3D &x)

writes the vectors of the basis from a stream