Handles small size vectors like element vectors. More...
#include <LocalVect.h>
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... | |
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... | |
Detailed Description
class OFELI::LocalVect< T_, N_ >
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.
- Template Parameters
-
T_ Data type (double, float, complex<double>, ...) N_ Vector size
- Copyright
- GNU Lesser Public License
Constructor & Destructor Documentation
◆ LocalVect() [1/3]
Constructor of an element vector from a global Vect instance.
The constructed vector has local numbering of nodes
- Parameters
-
[in] el Pointer to Element to localize [in] v Global vector to localize [in] opt Option for DOF treatment - = 0, Normal case [Default]
- Any other value : only one DOF is handled (Local vector has as dimension number of degrees of freedom)
◆ LocalVect() [2/3]
Constructor of an element vector from a global Vect instance.
The constructed vector has local numbering of nodes
- Parameters
-
[in] el Reference to Element instance to localize [in] v Global vector to localize [in] opt Option for DOF treatment - = 0, Normal case [Default]
- Any other value : only one DOF is handled (Local vector has as dimension number of degrees of freedom)
◆ LocalVect() [3/3]
Constructor of a side vector from a global Vect instance.
The constructed vector has local numbering of nodes
- Parameters
-
[in] sd Pointer to Side to localize [in] v Global vector to localize [in] opt Option for DOF treatment - = 0, Normal case [Default]
- Any other value : only one DOF is handled (Local vector has as dimension number of degrees of freedom)
Member Function Documentation
◆ getLocal()
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)
- Parameters
-
[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() [1/2]
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)
- Parameters
-
[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() [2/2]
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)
- Parameters
-
[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]
◆ operator()() [1/2]
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]
◆ operator()() [2/2]
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]
◆ operator*=()
LocalVect< T_, N_ > & operator*= | ( | const T_ & | a | ) |
Operator *=
Multiply vector by constant a
◆ operator+=() [1/2]
Operator +=
Add vector v
to this instance
◆ operator+=() [2/2]
LocalVect< T_, N_ > & operator+= | ( | const T_ & | a | ) |
Operator +=
Add constant a
to vector entries
◆ operator,()
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>
- Parameters
-
[in] v LocalVect instance by which the current instance is multiplied
◆ operator-=() [1/2]
Operator -=
Subtract vector v
from this instance
◆ operator-=() [2/2]
LocalVect< T_, N_ > & operator-= | ( | const T_ & | a | ) |
Operator -=
Subtract constant a
from vector entries
◆ operator/=()
LocalVect< T_, N_ > & operator/= | ( | const T_ & | a | ) |
Operator /=
Divide vector by constant a
◆ operator=() [1/2]
Operator =
Copy a LocalVect instance to the current one
◆ operator=() [2/2]
LocalVect< T_, N_ > & operator= | ( | const T_ & | x | ) |
Operator =
Assign value x
to all vector entries
◆ operator[]() [1/2]
T_ & operator[] | ( | size_t | i | ) |
Operator []
(Non constant version).
v[i]
starts at v[0]
to v[size()-1]
◆ operator[]() [2/2]
T_ operator[] | ( | size_t | i | ) | const |
Operator []
(Constant version).
v[i]
starts at v[0]
to v[size()-1]