ug4
|
#include <vector.h>
Public Types | |
typedef TValueType | value_type |
typedef Vector< TValueType > | vector_type |
Public Member Functions | |
template<typename V > | |
void | add (const V &u) |
void | add (const value_type *u, const size_t *indices, size_t nr) |
size_t | capacity () const |
SmartPtr< vector_type > | clone () const |
clones the vector (deep-copy) including values More... | |
SmartPtr< vector_type > | clone_without_values () const |
clones the vector (deep-copy) excluding values More... | |
void | create (const Vector &v) |
create as a copy of other vector More... | |
void | create (size_t size) |
create a vector with specific size More... | |
size_t | defragment () |
double | dotprod (const Vector &w) |
returns v.T w, that is the dotprod of this vector and w More... | |
template<typename V > | |
void | get (V &u) const |
void | get (value_type *u, const size_t *indices, size_t nr) const |
double | maxnorm () const |
return max values[i] (max norm) More... | |
double | norm () const |
return sqrt(sum values[i]^2) (euclidian norm) More... | |
void | operator*= (const number &a) |
void | operator+= (const Vector &v) |
void | operator-= (const Vector &v) |
void | operator= (const Vector &v) |
assign other vector v More... | |
double | operator= (double d) |
assign double d to whole Vector More... | |
value_type & | operator[] (size_t i) |
access element i of the vector More... | |
const value_type & | operator[] (size_t i) const |
void | p () |
gdb shortcut for print More... | |
void | print (const char *const text=NULL) const |
print vector to console More... | |
void | reserve (size_t newCapacity, bool bCopyValues=true) |
void | reserve_exactly (size_t newCapacity, bool bCopyValues) |
void | reserve_sloppy (size_t newCapacity, bool bCopyValues=true) |
void | resize (size_t newSize, bool bCopyValues=true) |
void | resize_exactly (size_t newSize, bool bCopyValues=true) |
resize the vector to be EXACTLY newSize big (no overhead) More... | |
void | resize_sloppy (size_t newSize, bool bCopyValues=true) |
template<typename V > | |
void | set (const V &u) |
void | set (const value_type *u, const size_t *indices, size_t nr) |
void | set (double d) |
assign double d to whole Vector More... | |
void | set_random (double from, double to) |
size_t | size () const |
Vector () | |
constructor More... | |
Vector (const vector_type &v) | |
Vector (size_t size) | |
constructor with size More... | |
virtual | ~Vector () |
virtual destructor More... | |
Protected Member Functions | |
virtual vector_type * | virtual_clone () const |
virtual clone using covariant return type More... | |
virtual vector_type * | virtual_clone_without_values () const |
virtual clone using covariant return type excluding values More... | |
Private Member Functions | |
void | destroy () |
Private Attributes | |
size_t | m_capacity |
size of the vector (vector is from 0..size-1) More... | |
size_t | m_size |
size of the vector (vector is from 0..size-1) More... | |
value_type * | values |
array where the values are stored, size m_size More... | |
Friends | |
std::ostream & | operator<< (std::ostream &output, const Vector &v) |
ostream << operator More... | |
typedef TValueType ug::Vector< TValueType >::value_type |
typedef Vector<TValueType> ug::Vector< TValueType >::vector_type |
Vector< value_type >::Vector |
constructor
References FORCE_CREATION, and ug::Vector< TValueType >::p().
Vector< value_type >::Vector | ( | size_t | size | ) |
constructor with size
References ug::Vector< TValueType >::create(), FORCE_CREATION, ug::Vector< TValueType >::p(), and ug::Vector< TValueType >::size().
|
virtual |
virtual destructor
|
inline |
add/set/get a local vector
The local vector type must provide the following members:
void Vector< value_type >::add | ( | const value_type * | u, |
const size_t * | indices, | ||
size_t | nr | ||
) |
|
inline |
References ug::Vector< TValueType >::m_capacity.
SmartPtr< Vector< value_type > > Vector< value_type >::clone |
clones the vector (deep-copy) including values
SmartPtr< Vector< value_type > > Vector< value_type >::clone_without_values |
clones the vector (deep-copy) excluding values
void Vector< value_type >::create | ( | const Vector< TValueType > & | v | ) |
create as a copy of other vector
References ug::Vector< TValueType >::m_size, UG_ASSERT, and ug::Vector< TValueType >::values.
void Vector< value_type >::create | ( | size_t | size | ) |
create a vector with specific size
Referenced by ug::Vector< TValueType >::Vector().
|
inline |
|
private |
|
inline |
returns v.T w, that is the dotprod of this vector and w
References ug::Vector< TValueType >::m_size, UG_ASSERT, and ug::VecProd().
void Vector< value_type >::get | ( | value_type * | u, |
const size_t * | indices, | ||
size_t | nr | ||
) | const |
|
inline |
return max values[i] (max norm)
References ug::BlockMaxNorm().
|
inline |
return sqrt(sum values[i]^2) (euclidian norm)
References ug::BlockNorm2().
|
inline |
References ug::Vector< TValueType >::size(), and ug::Vector< TValueType >::values.
|
inline |
References ug::Vector< TValueType >::size(), and UG_ASSERT.
|
inline |
References ug::Vector< TValueType >::size(), and UG_ASSERT.
|
inline |
assign other vector v
References resize(), and ug::Vector< TValueType >::size().
|
inline |
assign double d to whole Vector
Referenced by ug::Vector< TValueType >::set(), and ug::Vector< TValueType >::Vector().
|
inline |
access element i of the vector
References UG_ASSERT.
Referenced by ug::GPUVector< TValueType >::operator[]().
|
inline |
References UG_ASSERT.
|
inline |
gdb shortcut for print
References ug::Vector< TValueType >::print().
Referenced by ug::Vector< TValueType >::Vector().
void Vector< value_type >::print | ( | const char *const | text = NULL | ) | const |
print vector to console
Referenced by ug::Vector< TValueType >::p().
|
inline |
References ug::Vector< TValueType >::reserve_exactly().
void Vector< value_type >::reserve_exactly | ( | size_t | newCapacity, |
bool | bCopyValues | ||
) |
reserve will allocate EXACTLY newCapacity assertion if newCapacity < size
References UG_ASSERT.
Referenced by ug::Vector< TValueType >::reserve().
void Vector< value_type >::reserve_sloppy | ( | size_t | newCapacity, |
bool | bCopyValues = true |
||
) |
reserve capacity in vector. if bigger than capacity, new capacity is newCapacity+oldCapacity/2
|
inline |
References ug::Vector< TValueType >::resize_exactly().
Referenced by ug::IExternalSolver< TAlgebra >::apply(), ug::ILUTScalarPreconditioner< TAlgebra >::apply_double(), ug::CloneVector(), ug::Deserialize(), ug::GetBlockGSCorrectionILUT(), ug::GPUVector< TValueType >::resize(), and ug::ILUTScalarPreconditioner< TAlgebra >::solve().
void Vector< value_type >::resize_exactly | ( | size_t | newSize, |
bool | bCopyValues = true |
||
) |
resize the vector to be EXACTLY newSize big (no overhead)
Referenced by ug::Vector< TValueType >::resize().
void Vector< value_type >::resize_sloppy | ( | size_t | newSize, |
bool | bCopyValues = true |
||
) |
resize vector. if bigger than capacity, new capacity is newSize+oldSize/2 so growth factor is 1.5 (this is to keep memory overhead small)
void Vector< value_type >::set | ( | const value_type * | u, |
const size_t * | indices, | ||
size_t | nr | ||
) |
|
inline |
assign double d to whole Vector
References ug::Vector< TValueType >::operator=().
|
inline |
References ug::BlockRef(), ug::GetSize(), and ug::urand().
|
inline |
|
protectedvirtual |
virtual clone using covariant return type
This should be used instead of the copy constructor at the places where the additional information stored in the object of the derived class (like the geometry or the topology of the grid) should be kept.
Reimplemented in ug::ParallelVector< Vector< double > >, and ug::GPUVector< TValueType >.
|
protectedvirtual |
virtual clone using covariant return type excluding values
This should be used instead of the copy constructor at the places where the additional information stored in the object of the derived class (like the geometry or the topology of the grid) should be kept.
Reimplemented in ug::ParallelVector< Vector< double > >, and ug::GPUVector< TValueType >.
|
friend |
ostream << operator
|
private |
size of the vector (vector is from 0..size-1)
Referenced by ug::Vector< TValueType >::capacity(), and ug::Vector< TValueType >::Vector().
|
private |
size of the vector (vector is from 0..size-1)
Referenced by ug::Vector< TValueType >::create(), ug::Vector< TValueType >::dotprod(), ug::Vector< TValueType >::size(), and ug::Vector< TValueType >::Vector().
|
private |
array where the values are stored, size m_size
Referenced by ug::Vector< TValueType >::create(), ug::Vector< TValueType >::operator*=(), and ug::Vector< TValueType >::Vector().