SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::linearalgebra::BlockVector< N, T >::Block Class Reference

#include <BlockVector.h>

Inheritance diagram for sofa::linearalgebra::BlockVector< N, T >::Block:

Public Member Functions

Index Nrows () const
 
void resize (Index)
 
void operator= (const type::Vec< N, T > &v)
 
void operator= (int v)
 
void operator= (float v)
 
void operator= (double v)
 
- Public Member Functions inherited from sofa::type::Vec< N, T >
constexpr Vec ()=default
 Default constructor: sets all values to 0. More...
 
constexpr Vec (NoInit)
 Fast constructor: no initialization. More...
 
constexpr Vec (const T r1) noexcept
 Specific constructor for 1-element vectors. More...
 
constexpr Vec (ArgsT &&... r) noexcept
 
 Vec (const Vec< 3, R > &a, const Vec< 3, T > &b)
 Specific constructor for 6-elements vectors, taking two 3-elements vectors. More...
 
constexpr Vec (const Vec< N-1, T > &v, T r1) noexcept
 Constructor from an N-1 elements vector and an additional value (added at the end). More...
 
constexpr Vec (const sofa::type::fixed_array< T, N > &p) noexcept
 
constexpr Vec (const Vec< N2, real2 > &v) noexcept
 Constructor from a different size vector (null default value and ignoring outside entries) More...
 
constexpr Vec (const Vec< N, real2 > &p) noexcept
 
constexpr Vec (const real2 *p) noexcept
 Constructor from an array of values. More...
 
constexpr void set (const T r1) noexcept
 Specific set function for 1-element vectors. More...
 
constexpr void set (const ArgsT... r) noexcept
 
constexpr void set (const Vec< N2, real2 > &v, T defaultvalue=0) noexcept
 Specific set from a different size vector (given default value and ignored outside entries) More...
 
constexpr T & x () noexcept
 Special access to first element. More...
 
constexpr const T & x () const noexcept
 Special const access to first element. More...
 
constexpr T & y () noexcept
 Special access to second element. More...
 
constexpr const T & y () const noexcept
 Special const access to second element. More...
 
constexpr T & z () noexcept
 Special access to third element. More...
 
constexpr const T & z () const noexcept
 Special const access to third element. More...
 
constexpr T & w () noexcept
 Special access to fourth element. More...
 
constexpr const T & w () const noexcept
 Special const access to fourth element. More...
 
constexpr void operator= (const T r1) noexcept
 Specific Assignment operator for 1-element vectors. More...
 
constexpr void operator= (const real2 *p) noexcept
 Assignment operator from an array of values. More...
 
constexpr void operator= (const Vec< M, real2 > &v) noexcept
 Assignment from a vector with different dimensions. More...
 
constexpr void assign (const T &value) noexcept
 
constexpr void clear () noexcept
 Sets every element to 0. More...
 
constexpr void fill (T r) noexcept
 Sets every element to r. More...
 
constexpr T & operator() (Size i) noexcept
 Access to i-th element. More...
 
constexpr const T & operator() (Size i) const noexcept
 Const access to i-th element. More...
 
constexpr const T * ptr () const noexcept
 Cast into a const array of values. More...
 
constexpr T * ptr () noexcept
 Cast into an array of values. More...
 
constexpr void getsub (const Size i, Vec< N2, T > &m) const noexcept
 
constexpr void getsub (const Size i, T &m) const noexcept
 
constexpr Vec< N, T > mulscalar (const T f) const noexcept
 
constexpr Vec< N, T > mulscalar (const real2 f) const noexcept
 Multiplication by a scalar f. More...
 
constexpr Vec< N, T > operator* (const real2 f) const noexcept
 
constexpr T operator* (const Vec< N, real2 > &v) const noexcept
 Dot product. More...
 
constexpr void eqmulscalar (const T f) noexcept
 In-place multiplication by a scalar f. More...
 
constexpr void eqmulscalar (const real2 f) noexcept
 
constexpr void operator*= (const real2 f) noexcept
 
constexpr Vec< N, T > divscalar (const T f) const noexcept
 Division by a scalar f. More...
 
constexpr Vec< N, T > divscalar (const real2 f) const noexcept
 
constexpr Vec< N, T > operator/ (const real2 f) const noexcept
 
constexpr void eqdivscalar (const T f) noexcept
 In-place division by a scalar f. More...
 
constexpr void eqdivscalar (const real2 f) noexcept
 
constexpr void operator/= (const real2 f) noexcept
 
constexpr Vec< N, T > linearProduct (const Vec< N, real2 > &v) const noexcept
 linear product. More...
 
constexpr Vec< N, T > linearDivision (const Vec< N, real2 > &v) const noexcept
 linear division. More...
 
constexpr Vec< N, T > operator+ (const Vec< N, real2 > &v) const noexcept
 Vector addition. More...
 
constexpr void operator+= (const Vec< N, real2 > &v) noexcept
 In-place vector addition. More...
 
constexpr Vec< N, T > operator- (const Vec< N, real2 > &v) const noexcept
 Vector subtraction. More...
 
constexpr Vec< N, T > operator- () const noexcept
 Vector negation. More...
 
constexpr void operator-= (const Vec< N, real2 > &v) noexcept
 In-place vector subtraction. More...
 
constexpr T norm2 () const noexcept
 Squared norm. More...
 
norm () const noexcept
 Euclidean norm. More...
 
lNorm (int l) const
 
constexpr bool normalizeWithNorm (T norm, T threshold=std::numeric_limits< T >::epsilon()) noexcept
 
bool normalize (T threshold=std::numeric_limits< T >::epsilon()) noexcept
 
void normalize (Vec< N, T > failsafe, T threshold=std::numeric_limits< T >::epsilon()) noexcept
 
Vec< N, T > normalized () const noexcept
 
bool isNormalized (T threshold=std::numeric_limits< T >::epsilon() *(T) 10) const
 return true if norm()==1 More...
 
constexpr Vec cross (const Vec< 3, R > &b) const noexcept
 
constexpr T sum () const noexcept
 sum of all elements of the vector More...
 
constexpr bool operator== (const Vec &b) const noexcept
 
constexpr bool operator!= (const Vec &b) const noexcept
 
constexpr reference operator[] (size_type i)
 
constexpr const_reference operator[] (size_type i) const
 
constexpr const T * data () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr iterator end () noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr reference front ()
 
constexpr const_reference front () const
 
constexpr reference back ()
 
constexpr const_reference back () const
 

Additional Inherited Members

- Public Attributes inherited from sofa::type::Vec< N, T >
ArrayType elems
 
- Static Public Attributes inherited from sofa::type::Vec< N, T >
static constexpr sofa::Size static_size
 
static constexpr Size total_size
 Compile-time constant specifying the number of scalars within this vector (equivalent to static_size and size() method) More...
 
static constexpr Size spatial_dimensions
 Compile-time constant specifying the number of dimensions of space (equivalent to total_size here) More...
 
- Static Public Member Functions inherited from sofa::type::Vec< N, T >
static constexpr sofa::Size size ()
 

Function details

◆ Nrows()

template<std::size_t N, typename T >
Index sofa::linearalgebra::BlockVector< N, T >::Block::Nrows ( ) const
inline

◆ operator=() [1/4]

template<std::size_t N, typename T >
void sofa::linearalgebra::BlockVector< N, T >::Block::operator= ( const type::Vec< N, T > &  v)
inline

◆ operator=() [2/4]

template<std::size_t N, typename T >
void sofa::linearalgebra::BlockVector< N, T >::Block::operator= ( double  v)
inline

◆ operator=() [3/4]

template<std::size_t N, typename T >
void sofa::linearalgebra::BlockVector< N, T >::Block::operator= ( float  v)
inline

◆ operator=() [4/4]

template<std::size_t N, typename T >
void sofa::linearalgebra::BlockVector< N, T >::Block::operator= ( int  v)
inline

◆ resize()

template<std::size_t N, typename T >
void sofa::linearalgebra::BlockVector< N, T >::Block::resize ( Index  )
inline