Caribou
Public Types | Public Member Functions | List of all members
SofaCaribou::Algebra::EigenVector< Derived, Enable > Class Template Reference

Detailed Description

template<typename Derived, typename Enable = void>
class SofaCaribou::Algebra::EigenVector< Derived, Enable >

This class can be use to represent any Eigen vector within SOFA.

It implements (and overloads) the BaseVector class of Sofa. This class hence allows to either to create a new Eigen vector or copy/map an existing one and use it in Sofa's components or visitors.

Template Parameters
Derived
Enable

#include <EigenVector.h>

Inheritance diagram for SofaCaribou::Algebra::EigenVector< Derived, Enable >:

Public Types

using EigenType = std::remove_cv_t< std::remove_reference_t< Derived > >
 
using Base = sofa::defaulttype::BaseVector
 
using Index = Base::Index
 
using Real = typename EigenType::Scalar
 

Public Member Functions

 EigenVector (std::remove_reference_t< Derived > &eigen_vector)
 Construct the class using another Eigen vector. More...
 
 EigenVector (Eigen::Index n)
 Construct a new Eigen vector of type Derived have n elements. More...
 
Index size () const final
 Number of elements in the vector.
 
SReal element (Index index) const final
 Read the value of element i.
 
void resize (Index n) final
 Resize the vector. More...
 
void clear () final
 Reset all values to 0.
 
void set (Index index, SReal value) final
 Write the value of element index.
 
void add (Index index, SReal value) final
 Add v to the existing value of element i.
 
Base::ElementType getElementType () const final
 Type of elements stored in this matrix.
 
std::size_t getElementSize () const final
 Size of one element stored in this matrix.
 
const EigenType & vector () const
 Get a const reference to the underlying Eigen vector

 
EigenType & vector ()
 Get a reference to the underlying Eigen vector

 

Constructor & Destructor Documentation

◆ EigenVector() [1/2]

template<typename Derived , typename Enable = void>
SofaCaribou::Algebra::EigenVector< Derived, Enable >::EigenVector ( std::remove_reference_t< Derived > &  eigen_vector)
inlineexplicit

Construct the class using another Eigen vector.

Depending on the template parameter used for the class, this constructor will either create a new Eigen vector and copy its content from the parameter eigen_matrix, or it will simply store a reference to this external matrix.

Parameters
eigen_matrixThe external matrix

◆ EigenVector() [2/2]

template<typename Derived , typename Enable = void>
SofaCaribou::Algebra::EigenVector< Derived, Enable >::EigenVector ( Eigen::Index  n)
inline

Construct a new Eigen vector of type Derived have n elements.

Parameters
nNumber of elements in the vector.

Member Function Documentation

◆ resize()

template<typename Derived , typename Enable = void>
void SofaCaribou::Algebra::EigenVector< Derived, Enable >::resize ( Index  n)
inlinefinal

Resize the vector.

This method resets to zero all entries.


The documentation for this class was generated from the following file: