SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::linearalgebra::FullVector< T > Class Template Reference

#include <FullVector.h>

Inheritance diagram for sofa::linearalgebra::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)
 
void operator+= (const FullVector< Real > &a)
 v += a More...
 
void operator-= (const FullVector< Real > &a)
 v -= a More...
 
void eq (const FullVector< Real > &a, Real f)
 v = a*f More...
 
void eq (const FullVector< Real > &a, const FullVector< Real > &b, Real f=1.0)
 v = a+b*f More...
 
void peq (const FullVector< Real > &a, Real f)
 v += a*f More...
 
void operator*= (Real f)
 v *= f More...
 
Real dot (const FullVector< Real > &a) const
 
double norm () const
 
- Public Member Functions inherited from sofa::linearalgebra::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 double * elements (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 int * elements (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 charName ()
 

Protected Member Functions

void checkIndex (Index n) const
 
- Protected Member Functions inherited from sofa::linearalgebra::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)
 

Attribute details

◆ allocsize

template<typename T >
Index sofa::linearalgebra::FullVector< T >::allocsize
protected

◆ cursize

template<typename T >
Index sofa::linearalgebra::FullVector< T >::cursize
protected

◆ data

template<typename T >
T* sofa::linearalgebra::FullVector< T >::data
protected

Constructor details

◆ FullVector() [1/5]

template<typename T >
sofa::linearalgebra::FullVector< T >::FullVector ( )
inline

◆ FullVector() [2/5]

template<typename T >
sofa::linearalgebra::FullVector< T >::FullVector ( const FullVector< T > &  vect)
inline

◆ FullVector() [3/5]

template<typename T >
sofa::linearalgebra::FullVector< T >::FullVector ( Index  n)
inlineexplicit

◆ FullVector() [4/5]

template<typename T >
sofa::linearalgebra::FullVector< T >::FullVector ( T *  ptr,
Index  n 
)
inline

◆ FullVector() [5/5]

template<typename T >
sofa::linearalgebra::FullVector< T >::FullVector ( T *  ptr,
Index  n,
Index  nmax 
)
inline

◆ ~FullVector()

template<typename T >
sofa::linearalgebra::FullVector< T >::~FullVector ( )
inlineoverride

Function details

◆ add()

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

Add v to the existing value of element i.

Implements sofa::linearalgebra::BaseVector.

◆ begin() [1/2]

template<typename T >
Iterator sofa::linearalgebra::FullVector< T >::begin ( )
inline

◆ begin() [2/2]

template<typename T >
ConstIterator sofa::linearalgebra::FullVector< T >::begin ( ) const
inline

◆ capacity()

template<typename T >
Index sofa::linearalgebra::FullVector< T >::capacity ( ) const
inline

◆ checkIndex()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::checkIndex ( Index  n) const
protected

◆ clear() [1/2]

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::clear ( )
overridevirtual

Reset all values to 0.

Implements sofa::linearalgebra::BaseVector.

◆ clear() [2/2]

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::clear ( Index  i)
overridevirtual

Reset the value of element i to 0.

Reimplemented from sofa::linearalgebra::BaseVector.

◆ dot()

template<typename Real >
Real sofa::linearalgebra::FullVector< Real >::dot ( const FullVector< Real > &  a) const
Returns
v.a

◆ element()

template<typename T >
SReal sofa::linearalgebra::FullVector< T >::element ( Index  i) const
inlineoverridevirtual

Read the value of element i.

Implements sofa::linearalgebra::BaseVector.

◆ end() [1/2]

template<typename T >
Iterator sofa::linearalgebra::FullVector< T >::end ( )
inline

◆ end() [2/2]

template<typename T >
ConstIterator sofa::linearalgebra::FullVector< T >::end ( ) const
inline

◆ eq() [1/2]

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::eq ( const FullVector< Real > &  a,
const FullVector< Real > &  b,
Real  f = 1.0 
)

v = a+b*f

◆ eq() [2/2]

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::eq ( const FullVector< Real > &  a,
Real  f 
)

v = a*f

◆ fastResize()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::fastResize ( Index  dim)

◆ getsub()

template<typename T >
template<class TV >
void sofa::linearalgebra::FullVector< T >::getsub ( Index  i,
Index  n,
TV &  v 
)
inline

◆ Name()

template<typename T >
static const char* sofa::linearalgebra::FullVector< T >::Name ( )
inlinestatic

◆ norm()

template<typename Real >
double sofa::linearalgebra::FullVector< Real >::norm
Returns
sqrt(v.v)

◆ operator*=()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::operator*= ( Real  f)

v *= f

◆ operator+=()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::operator+= ( const FullVector< Real > &  a)

v += a

◆ operator-=()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::operator-= ( const FullVector< Real > &  a)

v -= a

◆ operator=() [1/2]

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::operator= ( const FullVector< T > &  a)

v = a

◆ operator=() [2/2]

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::operator= ( const T &  a)

◆ operator[]() [1/2]

template<typename T >
T& sofa::linearalgebra::FullVector< T >::operator[] ( Index  i)
inline

◆ operator[]() [2/2]

template<typename T >
const T& sofa::linearalgebra::FullVector< T >::operator[] ( Index  i) const
inline

◆ peq()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::peq ( const FullVector< Real > &  a,
Real  f 
)

v += a*f

◆ ptr() [1/2]

template<typename T >
T* sofa::linearalgebra::FullVector< T >::ptr ( )
inline

◆ ptr() [2/2]

template<typename T >
const T* sofa::linearalgebra::FullVector< T >::ptr ( ) const
inline

◆ resize()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::resize ( Index  dim)
overridevirtual

Resize the vector, and reset all values to 0.

Implements sofa::linearalgebra::BaseVector.

◆ set()

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

Write the value of element i.

Implements sofa::linearalgebra::BaseVector.

◆ setptr()

template<typename T >
void sofa::linearalgebra::FullVector< T >::setptr ( T *  p)
inline

◆ setsub()

template<typename T >
template<class TV >
void sofa::linearalgebra::FullVector< T >::setsub ( Index  i,
Index  n,
const TV &  v 
)
inline

◆ size()

template<typename T >
Index sofa::linearalgebra::FullVector< T >::size ( ) const
inlineoverridevirtual

Number of elements.

Implements sofa::linearalgebra::BaseVector.

◆ sub()

template<typename T >
FullVector<T> sofa::linearalgebra::FullVector< T >::sub ( Index  i,
Index  n 
)
inline

◆ swap()

template<typename Real >
void sofa::linearalgebra::FullVector< Real >::swap ( FullVector< T > &  v)