LocalVect Class Template Reference
[Vector and Matrix]
#include <LocalVect.h>
Detailed Description
template<class T_, size_t N_>
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 Arguments :
- T_ data type (double, float, ...)
- N_ vector size
Public Member Functions | |
| Element * | El () |
Return pointer to Element if vector was constructed using an element and NULL otherwise. | |
| T_ * | getArray () |
| Return pointer to vector as a C-Array. | |
| void | Localize (const Side *sd, const Vect< T_ > &v) |
| Localize a side vector from a global Vect instance. | |
| void | Localize (const Element *el, const Vect< T_ > &v) |
| Localize an element vector from a global Vect instance. | |
| LocalVect (const Side *sd, const Vect< T_ > &v, int opt=0) | |
| Constructor of a side vector from a global Vect instance. | |
| LocalVect (const Element *el, const NodeVect< T_ > &v, int opt=0) | |
| Constructor of an element vector from a global NodeVect instance. | |
| LocalVect (const Element *el, const Vect< T_ > &v, int opt=0) | |
| Constructor of an element vector from a global Vect instance. | |
| LocalVect (const LocalVect< T_, N_ > &v) | |
| Copy constructor. | |
| LocalVect (const Side *sd) | |
| Constructor using Side pointer. | |
| LocalVect (const Element *el) | |
| Constructor using Element pointer. | |
| LocalVect (const T_ *a) | |
| Constructor using a C-array. | |
| LocalVect () | |
| Default constructor. | |
| T_ | operator() (size_t i) const |
| Operator () (Constant version). | |
| T_ & | operator() (size_t i) |
| Operator () (Non constant version). | |
| LocalVect< T_, N_ > & | operator*= (const T_ &a) |
| Operator *=. | |
| LocalVect< T_, N_ > & | operator+= (const T_ &a) |
| Operator +=. | |
| LocalVect< T_, N_ > & | operator+= (const LocalVect< T_, N_ > &v) |
| Operator +=. | |
| LocalVect< T_, N_ > & | operator-= (const T_ &a) |
| Operator -=. | |
| LocalVect< T_, N_ > & | operator-= (const LocalVect< T_, N_ > &v) |
| Operator -=. | |
| LocalVect< T_, N_ > & | operator/= (const T_ &a) |
| Operator /=. | |
| LocalVect< T_, N_ > & | operator= (const T_ &x) |
| Operator =. | |
| LocalVect< T_, N_ > & | operator= (const LocalVect< T_, N_ > &v) |
| Operator =. | |
| T_ | operator[] (size_t i) const |
| Operator [] (Constant version). | |
| T_ & | operator[] (size_t i) |
| Operator [] (Non constant version). | |
| Side * | Sd () |
Return pointer to Side if vector was constructed using a side and NULL otherwise. | |
| ~LocalVect () | |
| Destructor. | |
Constructor & Destructor Documentation
| LocalVect | ( | ) |
Default constructor.
Initializes vector entries to zero
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)
References Element::getNbNodes(), Element::getNodeLabel(), and LocalVect::Localize().
Constructor of an element vector from a global NodeVect 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)
References Element::getNbNodes(), and Element::getNodeLabel().
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)
References Side::getNbNodes(), Side::getNodeLabel(), and LocalVect::Localize().
Member Function Documentation
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
References Node::getDOF(), Node::getNbDOF(), Side::getNbNodes(), and Side::getPtrNode().
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
References Node::getFirstDOF(), Node::getNbDOF(), Element::getNbNodes(), and Element::getPtrNode().
Referenced by LocalVect::LocalVect().
| 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]
| 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]
| LocalVect< T_, N_ > & operator*= | ( | const T_ & | a | ) |
Operator *=.
Multiply vector by constant a
| LocalVect< T_, N_ > & operator+= | ( | const T_ & | a | ) |
Operator +=.
Add constant a to vector entries
Operator +=.
Add vector v to this instance
| LocalVect< T_, N_ > & operator-= | ( | const T_ & | a | ) |
Operator -=.
Subtract constant a from vector entries
Operator -=.
Subtract vector v from this instance
| LocalVect< T_, N_ > & operator/= | ( | const T_ & | a | ) |
Operator /=.
Divide vector by constant a
| LocalVect< T_, N_ > & operator= | ( | const T_ & | x | ) |
Operator =.
Assign value x to all vector entries
| T_ operator[] | ( | size_t | i | ) | const |
Operator [] (Constant version).
v[i] starts at v[0] to v[size()-1]
| T_& operator[] | ( | size_t | i | ) |
Operator [] (Non constant version).
v[i] starts at v[0] to v[size()-1]