#include <space.hh>
Public Types | |
typedef ScalarFieldTraits < Scalar >::AbsType | NormRetType |
convenient typedef for positive real type | |
Public Member Functions | |
Vector (const Vector< Scalar > &x) | |
Copy constructor. | |
Vector (const Space< Scalar > &_sp, bool _initZero=false) | |
Standard constructor. | |
~Vector () | |
Destructor. | |
const Space< Scalar > & | getSpace () const |
access to Space | |
bool | inSpace (const Space< Scalar > &sp1) const |
returns nonzero if this vector is a member of this space. | |
bool | inSameSpace (const Vector< Scalar > &x) const |
returns nonzero if this vector is member of same space as argument vector. | |
unsigned int | getVersion () const |
Version numbers are automatically incremented in the eval methods for which this is target. | |
void | incrementVersion () |
void | eval (FunctionObject &f, vector< Vector< Scalar > const * > &x) |
generic evaluation of a FunctionObject | |
void | eval (FunctionObject &f) |
eval convenience interface: no additional vector args | |
void | eval (FunctionObject &f, const Vector< Scalar > &x) |
eval convenience interface: one additional vector arg | |
void | eval (FunctionObject &f, const Vector< Scalar > &x, const Vector< Scalar > &y) |
eval convenience interface: two additional vector args | |
void | eval (FunctionObject &f, const Vector< Scalar > &x, const Vector< Scalar > &y, const Vector< Scalar > &z) |
eval convenience interface: three additional vector args | |
void | eval (FunctionObjectConstEval &f, vector< Vector< Scalar > const * > &x) const |
generic evaluation of a FunctionObjectConstEval | |
void | eval (FunctionObjectConstEval &f) const |
eval convenience interface: no additional vector args | |
void | eval (FunctionObjectConstEval &f, const Vector< Scalar > &x) const |
eval convenience interface: one additional vector arg | |
void | eval (FunctionObjectConstEval &f, const Vector< Scalar > &x, const Vector< Scalar > &y) const |
eval convenience interface: two additional vector args | |
void | eval (FunctionObjectConstEval &f, const Vector< Scalar > &x, const Vector< Scalar > &y, const Vector< Scalar > &z) const |
eval convenience interface: three additional vector args | |
Scalar | inner (const Vector< Scalar > &y) const |
Inner product. | |
void | linComb (Scalar a, const Vector< Scalar > &x, Scalar b=ScalarFieldTraits< Scalar >::One()) |
Linear Combination. | |
void | zero () |
Assignment to zero vector. | |
void | copy (const Vector< Scalar > &x) |
convenience methods, defined in terms of space convenience methods | |
void | scale (Scalar c) |
Scale, unary version. | |
void | scale (Scalar c, const Vector< Scalar > &x) |
Scale, binary version. | |
void | negate () |
Negation, unary version. | |
void | negate (const Vector< Scalar > &x) |
Negation, binary version. | |
NormRetType | normsq () const |
return Norm Squared. | |
NormRetType | norm () const |
return Norm. | |
ostream & | write (ostream &str) const |
Static Public Member Functions | |
static std::shared_ptr< Vector < Scalar > > | newPtr (Space< Scalar > const &sp) |
class method for safe dynamic allocation | |
Protected Member Functions | |
DataContainer * | getDataContainer () const |
The following three functions expose the internal data of Vector to its friends and children classes (there are only two
| |
Vector (const Space< Scalar > &_sp, DataContainer *_d, unsigned int &_verref, bool _own=false) | |
Protected vector copy constructor, shallow copy semantics. | |
Vector< Scalar > * | build_from_kit (const Space< Scalar > &_sp, DataContainer *_d, unsigned int &_verref, bool _own=false) |
by hiding the constructor, makes it available to child classes | |
Vector (const Vector< Scalar > *v) | |
Protected constructor which lets child classes wrap either space or datacontainer data members in other interfaces. | |
void * | operator new (size_t size) |
The Evaluation classes have Vectors as data members. | |
unsigned int & | getVersionRef () const |
Friends | |
class | Components< Scalar > |
Concrete class with all aspects of a natural vector interface implemented through delegation to Space and DataContainer data members. Provision for evaluation of arbitrary FunctionObject and FunctionObjectConstEval instances implemented through delegation to DataContainer::eval.
Definition at line 422 of file space.hh.
typedef ScalarFieldTraits<Scalar>::AbsType RVL::Vector< Scalar >::NormRetType |
RVL::Vector< Scalar >::Vector | ( | const Space< Scalar > & | _sp, | |
DataContainer * | _d, | |||
unsigned int & | _verref, | |||
bool | _own = false | |||
) | [protected] |
RVL::Vector< Scalar >::Vector | ( | const Vector< Scalar > * | v | ) | [protected] |
RVL::Vector< Scalar >::Vector | ( | const Vector< Scalar > & | x | ) |
RVL::Vector< Scalar >::Vector | ( | const Space< Scalar > & | _sp, | |
bool | _initZero = false | |||
) |
Standard constructor.
Constructs a member of a given vector space. Note that data is not initialized. For large vector sizes, this constructor is therefore to be preferred to the copy constructor when a choice exists and data copying is not needed.
The data container can be initialized to zero by setting the optional second parameter to true.
RVL::Vector< Scalar >::~Vector | ( | ) |
Destructor.
Deallocates dynamically allocated DataContainer.
DataContainer* RVL::Vector< Scalar >::getDataContainer | ( | ) | const [protected] |
The following three functions expose the internal data of Vector to its friends and children classes (there are only two
General objects should not be able to either access the private data of a Vector or build a Vector from random pieces, so these functions are protected. access to DataContainer
Vector<Scalar>* RVL::Vector< Scalar >::build_from_kit | ( | const Space< Scalar > & | _sp, | |
DataContainer * | _d, | |||
unsigned int & | _verref, | |||
bool | _own = false | |||
) | [protected] |
void* RVL::Vector< Scalar >::operator new | ( | size_t | size | ) | [protected] |
The Evaluation classes have Vectors as data members.
Accordingly, general RVL apps should avoid dynamic allocation of Vectors, just as they should avoid dynamic allocation of Spaces - to eliminate the risk of dangling references, and because it is unnecessary. However the Components and LocalVector classes do need to construct vectors dynamically, using the protected constructors described above. Therefore we make operator new protected.
Version 1.0: user control, for the bold. There are old sailors, and there are bold sailors, but there are no old, bold sailors.
unsigned int& RVL::Vector< Scalar >::getVersionRef | ( | ) | const [protected] |
static std::shared_ptr< Vector<Scalar> > RVL::Vector< Scalar >::newPtr | ( | Space< Scalar > const & | sp | ) | [static] |
const Space<Scalar>& RVL::Vector< Scalar >::getSpace | ( | ) | const |
bool RVL::Vector< Scalar >::inSpace | ( | const Space< Scalar > & | sp1 | ) | const |
bool RVL::Vector< Scalar >::inSameSpace | ( | const Vector< Scalar > & | x | ) | const |
unsigned int RVL::Vector< Scalar >::getVersion | ( | ) | const |
Version numbers are automatically incremented in the eval methods for which this is target.
Else they are left the same. If a version number seems to be getting to high, make sure that the writesData() method of all FunctionObjects are returning correct information.
void RVL::Vector< Scalar >::incrementVersion | ( | ) |
void RVL::Vector< Scalar >::eval | ( | FunctionObject & | f, | |
vector< Vector< Scalar > const * > & | x | |||
) |
generic evaluation of a FunctionObject
void RVL::Vector< Scalar >::eval | ( | FunctionObject & | f | ) |
void RVL::Vector< Scalar >::eval | ( | FunctionObject & | f, | |
const Vector< Scalar > & | x | |||
) |
void RVL::Vector< Scalar >::eval | ( | FunctionObject & | f, | |
const Vector< Scalar > & | x, | |||
const Vector< Scalar > & | y | |||
) |
void RVL::Vector< Scalar >::eval | ( | FunctionObject & | f, | |
const Vector< Scalar > & | x, | |||
const Vector< Scalar > & | y, | |||
const Vector< Scalar > & | z | |||
) |
void RVL::Vector< Scalar >::eval | ( | FunctionObjectConstEval & | f, | |
vector< Vector< Scalar > const * > & | x | |||
) | const |
generic evaluation of a FunctionObjectConstEval
void RVL::Vector< Scalar >::eval | ( | FunctionObjectConstEval & | f | ) | const |
void RVL::Vector< Scalar >::eval | ( | FunctionObjectConstEval & | f, | |
const Vector< Scalar > & | x | |||
) | const |
void RVL::Vector< Scalar >::eval | ( | FunctionObjectConstEval & | f, | |
const Vector< Scalar > & | x, | |||
const Vector< Scalar > & | y | |||
) | const |
void RVL::Vector< Scalar >::eval | ( | FunctionObjectConstEval & | f, | |
const Vector< Scalar > & | x, | |||
const Vector< Scalar > & | y, | |||
const Vector< Scalar > & | z | |||
) | const |
Scalar RVL::Vector< Scalar >::inner | ( | const Vector< Scalar > & | y | ) | const |
void RVL::Vector< Scalar >::linComb | ( | Scalar | a, | |
const Vector< Scalar > & | x, | |||
Scalar | b = ScalarFieldTraits<Scalar>::One() | |||
) |
void RVL::Vector< Scalar >::zero | ( | ) |
void RVL::Vector< Scalar >::copy | ( | const Vector< Scalar > & | x | ) |
void RVL::Vector< Scalar >::scale | ( | Scalar | c | ) |
void RVL::Vector< Scalar >::scale | ( | Scalar | c, | |
const Vector< Scalar > & | x | |||
) |
void RVL::Vector< Scalar >::negate | ( | ) |
void RVL::Vector< Scalar >::negate | ( | const Vector< Scalar > & | x | ) |
NormRetType RVL::Vector< Scalar >::normsq | ( | ) | const |
NormRetType RVL::Vector< Scalar >::norm | ( | ) | const |
ostream& RVL::Vector< Scalar >::write | ( | ostream & | str | ) | const [virtual] |
Implements RVL::Writeable.
friend class Components< Scalar > [friend] |