Handles small size vectors like element vectors. More...
Public Member Functions | |
LocalVect () | |
Default constructor. | |
LocalVect (const T_ *a) | |
Constructor using a C-array. | |
LocalVect (const Element *el) | |
Constructor using Element pointer. | |
LocalVect (const Side *sd) | |
Constructor using Side pointer. | |
LocalVect (const LocalVect< T_, N_ > &v) | |
Copy constructor. | |
LocalVect (const Element *el, const Vect< T_ > &v, int opt=0) | |
Constructor of an element vector from a global Vect instance. More... | |
LocalVect (const Element &el, const Vect< T_ > &v, int opt=0) | |
Constructor of an element vector from a global Vect instance. More... | |
LocalVect (const Side *sd, const Vect< T_ > &v, int opt=0) | |
Constructor of a side vector from a global Vect instance. More... | |
~LocalVect () | |
Destructor. | |
void | getLocal (const Element &el, const Vect< T_ > &v, int type) |
Localize an element vector from a global Vect instance. More... | |
void | Localize (const Element *el, const Vect< T_ > &v, size_t k=0) |
Localize an element vector from a global Vect instance. More... | |
void | Localize (const Side *sd, const Vect< T_ > &v, size_t k=0) |
Localize a side vector from a global Vect instance. More... | |
void | clear () |
Clear vector. More... | |
T_ & | operator[] (size_t i) |
Operator [] (Non constant version). More... | |
T_ | operator[] (size_t i) const |
Operator [] (Constant version). More... | |
T_ & | operator() (size_t i) |
Operator () (Non constant version). More... | |
T_ | operator() (size_t i) const |
Operator () (Constant version). More... | |
Element * | El () |
Return pointer to Element if vector was constructed using an element and nullptr otherwise. | |
Side * | Sd () |
Return pointer to Side if vector was constructed using a side and nullptr otherwise. | |
LocalVect< T_, N_ > & | operator= (const LocalVect< T_, N_ > &v) |
Operator = More... | |
LocalVect< T_, N_ > & | operator= (const T_ &x) |
Operator = More... | |
LocalVect< T_, N_ > & | operator+= (const LocalVect< T_, N_ > &v) |
Operator += More... | |
LocalVect< T_, N_ > & | operator+= (const T_ &a) |
Operator += More... | |
LocalVect< T_, N_ > & | operator-= (const LocalVect< T_, N_ > &v) |
Operator -= More... | |
LocalVect< T_, N_ > & | operator-= (const T_ &a) |
Operator -= More... | |
LocalVect< T_, N_ > & | operator*= (const T_ &a) |
Operator *= More... | |
LocalVect< T_, N_ > & | operator/= (const T_ &a) |
Operator /= More... | |
T_ * | get () |
Return pointer to vector as a C-Array. | |
T_ | operator, (const LocalVect< T_, N_ > &v) const |
Return Dot (scalar) product of two vectors. More... | |
Handles small size vectors like element vectors.
The template class LocalVect treats small size vectors. Typically, this class is recommended to store element and side arrays. Operators =, [] and () are overloaded so that one can write for instance:
LocalVect<double,10> u, v; v = -1.0; u = v; u(3) = -2.0;
to set vector v entries to -1, copy vector v into vector u and assign third entry of v to -2. Notice that entries of v are here v(1), v(2), ..., v(10), i.e. vector entries start at index 1.
Internally, no dynamic storage is used.
T_ | Data type (double, float, complex<double>, ...) |
N_ | Vector size |
Constructor of an element vector from a global Vect instance.
The constructed vector has local numbering of nodes
[in] | el | Pointer to Element to localize |
[in] | v | Global vector to localize |
[in] | opt | Option for DOF treatment
|
Constructor of an element vector from a global Vect instance.
The constructed vector has local numbering of nodes
[in] | el | Reference to Element instance to localize |
[in] | v | Global vector to localize |
[in] | opt | Option for DOF treatment
|
Constructor of a side vector from a global Vect instance.
The constructed vector has local numbering of nodes
[in] | sd | Pointer to Side to localize |
[in] | v | Global vector to localize |
[in] | opt | Option for DOF treatment
|
void clear | ( | ) |
Clear vector.
Set all vector entries to zero
Localize an element vector from a global Vect instance.
The constructed vector has local numbering of nodes This function is called by the constructor: LocalVect(const Element *el, const Vect<T_> &v)
[in] | el | Pointer to Element to localize |
[in] | v | Global vector to localize |
[in] | type | Type of element. This is to be chosen among enumerated values: LINE2 , TRIANG3 , QUAD4 , TETRA4 , HEXA8 , PENTA6 |
Localize an element vector from a global Vect instance.
The constructed vector has local numbering of nodes This function is called by the constructor: LocalVect(const Element *el, const Vect<T_> &v)
[in] | el | Pointer to Side to localize |
[in] | v | Global vector to localize |
[in] | k | Degree of freedom to localize [Default: All degrees of freedom are stored] |
Localize a side vector from a global Vect instance.
The constructed vector has local numbering of nodes This function is called by the constructor: LocalVect(const Side *sd, const Vect<T_> &v)
[in] | sd | Pointer to Side to localize |
[in] | v | Global vector to localize |
[in] | k | Degree of freedom to localize [Default: All degrees of freedom are stored] |
T_& operator() | ( | size_t | i | ) |
Operator ()
(Non constant version).
v(i)
starts at v(1)
to v(size())
. v(i)
is the same element as v[i-1]
T_ operator() | ( | size_t | i | ) | const |
Operator ()
(Constant version).
v(i)
starts at v(1)
to v(size())
v(i)
is the same element as v[i-1]
LocalVect<T_,N_>& operator*= | ( | const T_ & | a | ) |
Operator *=
Multiply vector by constant a
Operator +=
Add vector v
to this instance
LocalVect<T_,N_>& operator+= | ( | const T_ & | a | ) |
Operator +=
Add constant a
to vector entries
T_ operator, | ( | const LocalVect< T_, N_ > & | v | ) | const |
Return Dot (scalar) product of two vectors.
A typical use of this operator is double a = (v,w)
where v
and w
are 2 instances of LocalVect<double,n>
[in] | v | LocalVect instance by which the current instance is multiplied |
Operator -=
Subtract vector v
from this instance
LocalVect<T_,N_>& operator-= | ( | const T_ & | a | ) |
Operator -=
Subtract constant a
from vector entries
LocalVect<T_,N_>& operator/= | ( | const T_ & | a | ) |
Operator /=
Divide vector by constant a
Operator =
Copy a LocalVect instance to the current one
LocalVect<T_,N_>& operator= | ( | const T_ & | x | ) |
Operator =
Assign value x
to all vector entries
T_& operator[] | ( | size_t | i | ) |
Operator []
(Non constant version).
v[i]
starts at v[0]
to v[size()-1]
T_ operator[] | ( | size_t | i | ) | const |
Operator []
(Constant version).
v[i]
starts at v[0]
to v[size()-1]