SOFA API  1c8b807d
Open source framework for multi-physics simuation
sofa::linearalgebra::testing::TestBaseMatrix< T > Class Template Reference

#include <BaseMatrix_test.h>

Type-parameterized tests for classes derived from BaseMatrix. More...

Inheritance diagram for sofa::linearalgebra::testing::TestBaseMatrix< T >:

Detailed Description

template<class T>
class sofa::linearalgebra::testing::TestBaseMatrix< T >

Type-parameterized tests for classes derived from BaseMatrix.

Static Public Attributes

static constexpr sofa::Index NbRows = T::NbRows
 
static constexpr sofa::Index NbCols = T::NbCols
 
- Static Public Attributes inherited from sofa::testing::BaseTest
static int seed = (unsigned int)time(nullptr)
 Seed value. More...
 

Protected Attributes

sofa::type::Mat< NbRows, NbCols, Realm_modelMatrix
 
std::unique_ptr< sofa::linearalgebra::BaseMatrixm_testedMatrix {nullptr}
 

Public Member Functions

void onSetUp () override
 
void onTearDown () override
 
void checkResize ()
 
void checkAddScalar ()
 
void checkAddBloc (sofa::linearalgebra::BaseMatrix::Index posRow, sofa::linearalgebra::BaseMatrix::Index posCol)
 
- Public Member Functions inherited from sofa::testing::NumericTest< T::Real >
 NumericTest ()
 
Real vectorMaxDiff (const Container1 &c1, const Container2 &c2)
 Return the maximum difference between two containers. Issues a failure if sizes are different. More...
 
Real vectorMaxAbs (const Container &c)
 Return the maximum absolute value of a container. More...
 
- Public Member Functions inherited from sofa::testing::BaseTest
 BaseTest ()
 Initialize Sofa and the random number generator. More...
 
 ~BaseTest () override
 

Additional Inherited Members

- Public Attributes inherited from sofa::testing::BaseTest
sofa::testing::MessageAsTestFailure m_fatal
 
sofa::testing::MessageAsTestFailure m_error
 
- Static Public Member Functions inherited from sofa::testing::NumericTest< T::Real >
static Real matrixMaxDiff (const Matrix1 &m1, const Matrix2 &m2)
 return the maximum difference between corresponding entries, or the infinity if the matrices have different sizes More...
 
static Real matrixMaxDiff (const sofa::type::Mat< M, N, Real > &m1, const Matrix2 &m2)
 Return the maximum difference between corresponding entries, or the infinity if the matrices have different sizes. More...
 
static Real epsilon ()
 the smallest real number More...
 
static Real infinity ()
 Infinity. More...
 
static bool isSmall (Real r, Real ratio=1.)
 true if the magnitude of r is less than ratio*epsilon More...
 
static Real vectorMaxDiff (const sofa::type::Vec< N, Real > &m1, const Vector2 &m2)
 return the maximum difference between corresponding entries, or the infinity if the vectors have different sizes More...
 
static Real vectorMaxDiff (const sofa::type::Vec< N, Real > &m1, const sofa::type::Vec< N, Real > &m2)
 return the maximum difference between corresponding entries More...
 
- Static Protected Member Functions inherited from sofa::testing::NumericTest< T::Real >
static float norm (float a)
 
static double norm (double a)
 
static Real norm (T a)
 

Attribute details

◆ m_modelMatrix

template<class T >
sofa::type::Mat<NbRows, NbCols, Real> sofa::linearalgebra::testing::TestBaseMatrix< T >::m_modelMatrix
protected

◆ m_testedMatrix

template<class T >
std::unique_ptr<sofa::linearalgebra::BaseMatrix> sofa::linearalgebra::testing::TestBaseMatrix< T >::m_testedMatrix {nullptr}
protected

◆ NbCols

template<class T >
constexpr sofa::Index sofa::linearalgebra::testing::TestBaseMatrix< T >::NbCols = T::NbCols
staticconstexpr

◆ NbRows

template<class T >
constexpr sofa::Index sofa::linearalgebra::testing::TestBaseMatrix< T >::NbRows = T::NbRows
staticconstexpr

Function details

◆ checkAddBloc()

A 3x3 matrix is added into the matrix using the corresponding function overload This assumes the matrix is big enough to contain a 3x3 matrix at the requested position

Parameters
posRowrow index at which the 3x3 matrix is added
posColcolumn index at which the 3x3 matrix is added

◆ checkAddScalar()

template<class T >
void sofa::linearalgebra::testing::TestBaseMatrix< T >::checkAddScalar ( )
inline

◆ checkResize()

template<class T >
void sofa::linearalgebra::testing::TestBaseMatrix< T >::checkResize ( )
inline

◆ onSetUp()

template<class T >
void sofa::linearalgebra::testing::TestBaseMatrix< T >::onSetUp ( )
inlineoverridevirtual

Reimplemented from sofa::testing::BaseTest.

◆ onTearDown()

template<class T >
void sofa::linearalgebra::testing::TestBaseMatrix< T >::onTearDown ( )
inlineoverridevirtual

Reimplemented from sofa::testing::BaseTest.