#include <MultiMappingTestCreation.h>
Base class for the MultiMapping tests, directly adapted from Mapping_test. More...
Base class for the MultiMapping tests, directly adapted from Mapping_test.
Public Attributes | |
core::MultiMapping< In, Out > * | mapping |
the mapping to be tested More... | |
type::vector< typename InDOFs::SPtr > | inDofs |
mapping input More... | |
OutDOFs::SPtr | outDofs |
mapping output More... | |
simulation::Node::SPtr | root |
Root of the scene graph, created by the constructor an re-used in the tests. More... | |
simulation::Node::SPtr | child |
Child node, created by setupScene. More... | |
type::vector< simulation::Node::SPtr > | parents |
Parent nodes, created by setupScene. More... | |
simulation::Simulation * | simulation |
created by the constructor an re-used in the tests More... | |
std::pair< Real, Real > | deltaRange |
The minimum and maximum magnitudes of the change of each scalar value of the small displacement is deltaRange * numeric_limits<Real>::epsilon. This epsilon is 1.19209e-07 for float and 2.22045e-16 for double. More... | |
Real | errorMax |
The test is successful if the (infinite norm of the) difference is less than maxError * numeric_limits<Real>::epsilon. More... | |
Public Attributes inherited from sofa::testing::BaseTest | |
sofa::testing::MessageAsTestFailure | m_fatal |
sofa::testing::MessageAsTestFailure | m_error |
Public Member Functions | |
MultiMapping_test () | |
void | setupScene (int numParents) |
OutDeriv | difference (const OutCoord &c1, const OutCoord &c2) |
bool | runTest (const type::vector< InVecCoord > &parentCoords, const OutVecCoord &expectedChildCoords) |
~MultiMapping_test () override | |
Public Member Functions inherited from sofa::testing::BaseSimulationTest | |
BaseSimulationTest () | |
bool | importPlugin (const std::string &name) |
Public Member Functions inherited from sofa::testing::BaseTest | |
BaseTest () | |
Initialize Sofa and the random number generator. More... | |
~BaseTest () override | |
virtual void | onSetUp () |
virtual void | onTearDown () |
Public Member Functions inherited from sofa::testing::NumericTest< _MultiMapping::In::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... | |
Additional Inherited Members | |
Static Public Attributes inherited from sofa::testing::BaseTest | |
static int | seed = (unsigned int)time(nullptr) |
Seed value. More... | |
Static Public Member Functions inherited from sofa::testing::NumericTest< _MultiMapping::In::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< _MultiMapping::In::Real > | |
static float | norm (float a) |
static double | norm (double a) |
static Real | norm (T a) |
simulation::Node::SPtr sofa::MultiMapping_test< _MultiMapping >::child |
Child node, created by setupScene.
std::pair<Real,Real> sofa::MultiMapping_test< _MultiMapping >::deltaRange |
The minimum and maximum magnitudes of the change of each scalar value of the small displacement is deltaRange * numeric_limits<Real>::epsilon. This epsilon is 1.19209e-07 for float and 2.22045e-16 for double.
Real sofa::MultiMapping_test< _MultiMapping >::errorMax |
The test is successful if the (infinite norm of the) difference is less than maxError * numeric_limits<Real>::epsilon.
type::vector<typename InDOFs::SPtr> sofa::MultiMapping_test< _MultiMapping >::inDofs |
mapping input
core::MultiMapping<In,Out>* sofa::MultiMapping_test< _MultiMapping >::mapping |
the mapping to be tested
OutDOFs::SPtr sofa::MultiMapping_test< _MultiMapping >::outDofs |
mapping output
type::vector<simulation::Node::SPtr> sofa::MultiMapping_test< _MultiMapping >::parents |
Parent nodes, created by setupScene.
simulation::Node::SPtr sofa::MultiMapping_test< _MultiMapping >::root |
Root of the scene graph, created by the constructor an re-used in the tests.
simulation::Simulation* sofa::MultiMapping_test< _MultiMapping >::simulation |
created by the constructor an re-used in the tests
|
inline |
|
inlineoverride |
|
inline |
Returns OutCoord subtraction a-b (should return a OutDeriv, but???)
|
inline |
Test the mapping using the given values and small changes. Return true in case of success, if all errors are below maxError*epsilon. The parent position is applied, the resulting child position is compared with the expected one. Additionally, the Jacobian-related methods are tested using finite differences.
The parent coordinates are transferred in the parent states, then the scene is initialized, then various mapping functions are applied. The parent states are resized based on the size of the parentCoords vectors. The child state is not resized. Its should be already sized, or its size set automatically during initialization.
parentCoords | Parent positions (one InVecCoord per parent) |
expectedChildCoords | expected position of the child corresponding to the parent positions |
|
inline |
Create scene with given number of parent states. Currently, only one child state is handled. All the parents are set as child of the root node, while the child is in a child node.