SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::component::linearsolver::FullVector< T > Class Template Reference

#include <FullVector.h>

Inheritance diagram for sofa::component::linearsolver::FullVector< T >:

Protected Attributes

T * data
 
Index cursize
 
Index allocsize
 

Public Member Functions

 FullVector ()
 
 FullVector (const FullVector &vect)
 
 FullVector (Index n)
 
 FullVector (T *ptr, Index n)
 
 FullVector (T *ptr, Index n, Index nmax)
 
 ~FullVector () override
 
T * ptr ()
 
const T * ptr () const
 
void setptr (T *p)
 
Index capacity () const
 
Iterator begin ()
 
Iterator end ()
 
ConstIterator begin () const
 
ConstIterator end () const
 
void fastResize (Index dim)
 
void resize (Index dim) override
 Resize the vector, and reset all values to 0. More...
 
void clear () override
 Reset all values to 0. More...
 
void swap (FullVector< T > &v)
 
void clear (Index dim) override
 Reset the value of element i to 0. More...
 
T & operator[] (Index i)
 
const T & operator[] (Index i) const
 
SReal element (Index i) const override
 Read the value of element i. More...
 
void set (Index i, SReal v) override
 Write the value of element i. More...
 
void add (Index i, SReal v) override
 Add v to the existing value of element i. More...
 
Index size () const override
 Number of elements. More...
 
FullVector< T > sub (Index i, Index n)
 
template<class TV >
void getsub (Index i, Index n, TV &v)
 
template<class TV >
void setsub (Index i, Index n, const TV &v)
 
void operator= (const FullVector< T > &a)
 v = a More...
 
void operator= (const T &a)
 
template<typename Real2 >
void operator+= (const FullVector< Real2 > &a)
 v += a More...
 
template<typename Real2 >
void operator-= (const FullVector< Real2 > &a)
 v -= a More...
 
template<typename Real2 , typename Real3 >
void eq (const FullVector< Real2 > &a, Real3 f)
 v = a*f More...
 
template<typename Real2 , typename Real3 >
void eq (const FullVector< Real2 > &a, const FullVector< Real2 > &b, Real3 f=1.0)
 v = a+b*f More...
 
template<typename Real2 , typename Real3 >
void peq (const FullVector< Real2 > &a, Real3 f)
 v += a*f More...
 
template<typename Real2 >
void operator*= (Real2 f)
 v *= f More...
 
Real dot (const FullVector< Real > &a) const
 
double norm () const
 
template<>
void set (Index i, SReal v)
 Write the value of element i. More...
 
template<>
void add (Index i, SReal v)
 Add v to the existing value of element i. More...
 
template<>
bool dot (const FullVector< Real > &a) const
 
template<>
double norm () const
 
template<>
SOFA_BASE_LINEAR_SOLVER_API void set (Index i, SReal v)
 Write the value of element i. More...
 
template<>
SOFA_BASE_LINEAR_SOLVER_API void add (Index i, SReal v)
 Add v to the existing value of element i. More...
 
template<>
SOFA_BASE_LINEAR_SOLVER_API bool dot (const FullVector< Real > &a) const
 
template<>
SOFA_BASE_LINEAR_SOLVER_API double norm () const
 
- Public Member Functions inherited from sofa::defaulttype::BaseVector
virtual ~BaseVector ()
 
virtual const floatelements (Index i0, Index n, float *src) const
 Get the values of n elements, starting at element i0, into given float buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
virtual const doubleelements (Index i0, Index n, double *src) const
 Get the values of n elements, starting at element i0, into given double buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
virtual const intelements (Index i0, Index n, int *src) const
 Get the values of n elements, starting at element i0, into given int buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
virtual void set (Index i0, Index n, const float *src)
 Write the values of n float elements, starting at element i0. More...
 
virtual void set (Index i0, Index n, const double *src)
 Write the values of n double elements, starting at element i0. More...
 
virtual void set (Index i0, Index n, const int *src)
 Write the values of n int elements, starting at element i0. More...
 
virtual void add (Index i0, Index n, const float *src)
 Add to the values of n float elements, starting at element i0. More...
 
virtual void add (Index i0, Index n, const double *src)
 Add to the values of n double elements, starting at element i0. More...
 
virtual void add (Index i0, Index n, const int *src)
 Add to the values of n int elements, starting at element i0. More...
 
virtual ElementType getElementType () const
 
virtual std::size_t getElementSize () const
 
virtual bool isFull () const
 Return true if this vector is full, i.a. all elements are stored in memory. More...
 
bool isSparse () const
 

Static Public Member Functions

static const char * Name ()
 

Protected Member Functions

void checkIndex (Index n) const
 
- Protected Member Functions inherited from sofa::defaulttype::BaseVector
template<class T >
const T * elementsDefaultImpl (Index i0, Index n, T *buffer) const
 
template<class T >
void setDefaultImpl (Index i0, Index n, const T *src)
 
template<class T >
void addDefaultImpl (Index i0, Index n, const T *src)
 

Friends

std::ostream & operator<< (std::ostream &out, const FullVector< Real > &v)
 

Attribute details

template<typename T>
Index sofa::component::linearsolver::FullVector< T >::allocsize
protected
template<typename T>
Index sofa::component::linearsolver::FullVector< T >::cursize
protected
template<typename T>
T* sofa::component::linearsolver::FullVector< T >::data
protected

Constructor details

template<typename T>
sofa::component::linearsolver::FullVector< T >::FullVector ( )
inline
template<typename T>
sofa::component::linearsolver::FullVector< T >::FullVector ( const FullVector< T > &  vect)
inline
template<typename T>
sofa::component::linearsolver::FullVector< T >::FullVector ( Index  n)
inlineexplicit
template<typename T>
sofa::component::linearsolver::FullVector< T >::FullVector ( T *  ptr,
Index  n 
)
inline
template<typename T>
sofa::component::linearsolver::FullVector< T >::FullVector ( T *  ptr,
Index  n,
Index  nmax 
)
inline
template<typename T>
sofa::component::linearsolver::FullVector< T >::~FullVector ( )
inlineoverride

Function details

template<>
void sofa::component::linearsolver::FullVector< bool >::add ( Index  i,
SReal  v 
)
virtual

Add v to the existing value of element i.

Implements sofa::defaulttype::BaseVector.

template<typename T>
void sofa::component::linearsolver::FullVector< T >::add ( Index  i,
SReal  v 
)
inlineoverridevirtual

Add v to the existing value of element i.

Implements sofa::defaulttype::BaseVector.

template<>
SOFA_BASE_LINEAR_SOLVER_API void sofa::component::linearsolver::FullVector< bool >::add ( Index  i,
SReal  v 
)
virtual

Add v to the existing value of element i.

Implements sofa::defaulttype::BaseVector.

template<typename T>
Iterator sofa::component::linearsolver::FullVector< T >::begin ( )
inline
template<typename T>
ConstIterator sofa::component::linearsolver::FullVector< T >::begin ( ) const
inline
template<typename T>
Index sofa::component::linearsolver::FullVector< T >::capacity ( ) const
inline
template<typename T>
void sofa::component::linearsolver::FullVector< T >::checkIndex ( Index  n) const
inlineprotected
template<typename T>
void sofa::component::linearsolver::FullVector< T >::clear ( )
inlineoverridevirtual

Reset all values to 0.

Implements sofa::defaulttype::BaseVector.

template<typename T>
void sofa::component::linearsolver::FullVector< T >::clear ( Index  i)
inlineoverridevirtual

Reset the value of element i to 0.

Reimplemented from sofa::defaulttype::BaseVector.

template<>
bool sofa::component::linearsolver::FullVector< bool >::dot ( const FullVector< Real > &  a) const
template<typename T>
Real sofa::component::linearsolver::FullVector< T >::dot ( const FullVector< Real > &  a) const
inline
Returns
v.a
template<>
SOFA_BASE_LINEAR_SOLVER_API bool sofa::component::linearsolver::FullVector< bool >::dot ( const FullVector< Real > &  a) const
template<typename T>
SReal sofa::component::linearsolver::FullVector< T >::element ( Index  i) const
inlineoverridevirtual

Read the value of element i.

Implements sofa::defaulttype::BaseVector.

template<typename T>
Iterator sofa::component::linearsolver::FullVector< T >::end ( )
inline
template<typename T>
ConstIterator sofa::component::linearsolver::FullVector< T >::end ( ) const
inline
template<typename T>
template<typename Real2 , typename Real3 >
void sofa::component::linearsolver::FullVector< T >::eq ( const FullVector< Real2 > &  a,
Real3  f 
)
inline

v = a*f

template<typename T>
template<typename Real2 , typename Real3 >
void sofa::component::linearsolver::FullVector< T >::eq ( const FullVector< Real2 > &  a,
const FullVector< Real2 > &  b,
Real3  f = 1.0 
)
inline

v = a+b*f

template<typename T>
void sofa::component::linearsolver::FullVector< T >::fastResize ( Index  dim)
inline
template<typename T>
template<class TV >
void sofa::component::linearsolver::FullVector< T >::getsub ( Index  i,
Index  n,
TV &  v 
)
inline
template<typename T>
static const char* sofa::component::linearsolver::FullVector< T >::Name ( )
inlinestatic
template<>
double sofa::component::linearsolver::FullVector< bool >::norm ( ) const
template<typename T>
double sofa::component::linearsolver::FullVector< T >::norm ( ) const
inline
Returns
sqrt(v.v)
template<>
SOFA_BASE_LINEAR_SOLVER_API double sofa::component::linearsolver::FullVector< bool >::norm ( ) const
template<typename T>
template<typename Real2 >
void sofa::component::linearsolver::FullVector< T >::operator*= ( Real2  f)
inline

v *= f

template<typename T>
template<typename Real2 >
void sofa::component::linearsolver::FullVector< T >::operator+= ( const FullVector< Real2 > &  a)
inline

v += a

template<typename T>
template<typename Real2 >
void sofa::component::linearsolver::FullVector< T >::operator-= ( const FullVector< Real2 > &  a)
inline

v -= a

template<typename T>
void sofa::component::linearsolver::FullVector< T >::operator= ( const FullVector< T > &  a)
inline

v = a

template<typename T>
void sofa::component::linearsolver::FullVector< T >::operator= ( const T &  a)
inline
template<typename T>
T& sofa::component::linearsolver::FullVector< T >::operator[] ( Index  i)
inline
template<typename T>
const T& sofa::component::linearsolver::FullVector< T >::operator[] ( Index  i) const
inline
template<typename T>
template<typename Real2 , typename Real3 >
void sofa::component::linearsolver::FullVector< T >::peq ( const FullVector< Real2 > &  a,
Real3  f 
)
inline

v += a*f

template<typename T>
T* sofa::component::linearsolver::FullVector< T >::ptr ( )
inline
template<typename T>
const T* sofa::component::linearsolver::FullVector< T >::ptr ( ) const
inline
template<typename T>
void sofa::component::linearsolver::FullVector< T >::resize ( Index  dim)
inlineoverridevirtual

Resize the vector, and reset all values to 0.

Implements sofa::defaulttype::BaseVector.

template<>
void sofa::component::linearsolver::FullVector< bool >::set ( Index  i,
SReal  v 
)
virtual

Write the value of element i.

Implements sofa::defaulttype::BaseVector.

template<typename T>
void sofa::component::linearsolver::FullVector< T >::set ( Index  i,
SReal  v 
)
inlineoverridevirtual

Write the value of element i.

Implements sofa::defaulttype::BaseVector.

template<>
SOFA_BASE_LINEAR_SOLVER_API void sofa::component::linearsolver::FullVector< bool >::set ( Index  i,
SReal  v 
)
virtual

Write the value of element i.

Implements sofa::defaulttype::BaseVector.

template<typename T>
void sofa::component::linearsolver::FullVector< T >::setptr ( T *  p)
inline
template<typename T>
template<class TV >
void sofa::component::linearsolver::FullVector< T >::setsub ( Index  i,
Index  n,
const TV &  v 
)
inline
template<typename T>
Index sofa::component::linearsolver::FullVector< T >::size ( ) const
inlineoverridevirtual

Number of elements.

Implements sofa::defaulttype::BaseVector.

template<typename T>
FullVector<T> sofa::component::linearsolver::FullVector< T >::sub ( Index  i,
Index  n 
)
inline
template<typename T>
void sofa::component::linearsolver::FullVector< T >::swap ( FullVector< T > &  v)
inline

Related details

template<typename T>
std::ostream& operator<< ( std::ostream &  out,
const FullVector< Real > &  v 
)
friend