SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::type::VecNoInit< N, real > Class Template Reference

#include <Vec.h>

Same as Vec except the values are not initialized by default. More...

Inheritance diagram for sofa::type::VecNoInit< N, real >:

Detailed Description

template<sofa::Size N, typename real>
class sofa::type::VecNoInit< N, real >

Same as Vec except the values are not initialized by default.

Public Member Functions

constexpr VecNoInit () noexcept
 
constexpr VecNoInit (const Vec< N, real > &v) noexcept
 
constexpr VecNoInit (Vec< N, real > &&v) noexcept
 
- Public Member Functions inherited from sofa::type::Vec< N, real >
constexpr Vec ()=default
 Default constructor: sets all values to 0. More...
 
constexpr Vec (NoInit)
 Fast constructor: no initialization. More...
 
constexpr Vec (const real 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, real > &v, real 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< real, 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 real 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, real defaultvalue=0) noexcept
 Specific set from a different size vector (given default value and ignored outside entries) More...
 
constexpr real & x () noexcept
 Special access to first element. More...
 
constexpr const real & x () const noexcept
 Special const access to first element. More...
 
constexpr real & y () noexcept
 Special access to second element. More...
 
constexpr const real & y () const noexcept
 Special const access to second element. More...
 
constexpr real & z () noexcept
 Special access to third element. More...
 
constexpr const real & z () const noexcept
 Special const access to third element. More...
 
constexpr real & w () noexcept
 Special access to fourth element. More...
 
constexpr const real & w () const noexcept
 Special const access to fourth element. More...
 
constexpr void operator= (const real 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 real &value) noexcept
 
constexpr void clear () noexcept
 Sets every element to 0. More...
 
constexpr void fill (real r) noexcept
 Sets every element to r. More...
 
constexpr real & operator() (Size i) noexcept
 Access to i-th element. More...
 
constexpr const real & operator() (Size i) const noexcept
 Const access to i-th element. More...
 
constexpr const real * ptr () const noexcept
 Cast into a const array of values. More...
 
constexpr real * ptr () noexcept
 Cast into an array of values. More...
 
constexpr void getsub (const Size i, Vec< N2, real > &m) const noexcept
 
constexpr void getsub (const Size i, real &m) const noexcept
 
constexpr Vec< N, real > mulscalar (const real f) const noexcept
 
constexpr Vec< N, real > mulscalar (const real2 f) const noexcept
 Multiplication by a scalar f. More...
 
constexpr Vec< N, real > operator* (const real2 f) const noexcept
 
constexpr real operator* (const Vec< N, real2 > &v) const noexcept
 Dot product. More...
 
constexpr void eqmulscalar (const real 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, real > divscalar (const real f) const noexcept
 Division by a scalar f. More...
 
constexpr Vec< N, real > divscalar (const real2 f) const noexcept
 
constexpr Vec< N, real > operator/ (const real2 f) const noexcept
 
constexpr void eqdivscalar (const real 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, real > linearProduct (const Vec< N, real2 > &v) const noexcept
 linear product. More...
 
constexpr Vec< N, real > linearDivision (const Vec< N, real2 > &v) const noexcept
 linear division. More...
 
constexpr Vec< N, real > 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, real > operator- (const Vec< N, real2 > &v) const noexcept
 Vector subtraction. More...
 
constexpr Vec< N, real > operator- () const noexcept
 Vector negation. More...
 
constexpr void operator-= (const Vec< N, real2 > &v) noexcept
 In-place vector subtraction. More...
 
constexpr real norm2 () const noexcept
 Squared norm. More...
 
real norm () const noexcept
 Euclidean norm. More...
 
real lNorm (int l) const
 
constexpr bool normalizeWithNorm (real norm, real threshold=std::numeric_limits< real >::epsilon()) noexcept
 
bool normalize (real threshold=std::numeric_limits< real >::epsilon()) noexcept
 
void normalize (Vec< N, real > failsafe, real threshold=std::numeric_limits< real >::epsilon()) noexcept
 
Vec< N, real > normalized () const noexcept
 
bool isNormalized (real threshold=std::numeric_limits< real >::epsilon() *(real) 10) const
 return true if norm()==1 More...
 
constexpr Vec cross (const Vec< 3, R > &b) const noexcept
 
constexpr real 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 real * 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
 

Friends

constexpr friend Vec< N, real > operator* (real r, const Vec< N, real > &v) noexcept
 Scalar vector multiplication operator. More...
 

Additional Inherited Members

- Public Attributes inherited from sofa::type::Vec< N, real >
ArrayType elems
 
- Static Public Attributes inherited from sofa::type::Vec< N, real >
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, real >
static constexpr sofa::Size size ()
 

Constructor details

◆ VecNoInit() [1/3]

template<sofa::Size N, typename real >
constexpr sofa::type::VecNoInit< N, real >::VecNoInit ( )
inlineconstexprnoexcept

◆ VecNoInit() [2/3]

template<sofa::Size N, typename real >
constexpr sofa::type::VecNoInit< N, real >::VecNoInit ( const Vec< N, real > &  v)
inlineconstexprnoexcept

◆ VecNoInit() [3/3]

template<sofa::Size N, typename real >
constexpr sofa::type::VecNoInit< N, real >::VecNoInit ( Vec< N, real > &&  v)
inlineconstexprnoexcept

Related details

◆ operator*

template<sofa::Size N, typename real >
constexpr friend Vec<N,real> operator* ( real  r,
const Vec< N, real > &  v 
)
friend

Scalar vector multiplication operator.