Helper for writing ForceField tests. The constructor creates a root node and adds it a State and a ForceField (of the paremeter type of this template class). Pointers to node, state and force are available. Deriving the ForceField test from this class makes it easy to write: just call function run_test with positions, velocities and the corresponding expected forces. This function automatically checks not only the forces (function addForce), but also the stiffness (methods addDForce and addKToMatrix), using finite differences.
More...
template<typename _ForceFieldType>
struct sofa::ForceField_test< _ForceFieldType >
Helper for writing ForceField tests. The constructor creates a root node and adds it a State and a ForceField (of the paremeter type of this template class). Pointers to node, state and force are available. Deriving the ForceField test from this class makes it easy to write: just call function run_test with positions, velocities and the corresponding expected forces. This function automatically checks not only the forces (function addForce), but also the stiffness (methods addDForce and addKToMatrix), using finite differences.
- Author
- François Faure, 2014
|
}
{
|
unsigned char | flags |
|
static const unsigned char | TEST_POTENTIAL_ENERGY = 1 |
| testing getPotentialEnergy function. The tests will only work with conservative forces (if dissipative forces such as viscosity or damping are computed, the test is wrong) More...
|
|
static const unsigned char | TEST_ALL = UCHAR_MAX |
| testing everything More...
|
|
| ForceField_test () |
| } More...
|
|
| ForceField_test (std::string filename) |
|
void | run_test (const VecCoord &x, const VecDeriv &v, const VecDeriv &ef, bool initScene=true) |
| Given positions and velocities, checks that the expected forces are obtained, and that a small change of positions generates the corresponding change of forces. More...
|
|
|
static int | seed = (unsigned int)time(nullptr) |
| Seed value. More...
|
|
| BaseSimulationTest () |
|
bool | importPlugin (const std::string &name) |
|
| BaseTest () |
| Initialize Sofa and the random number generator. More...
|
|
| ~BaseTest () override |
|
virtual void | onSetUp () |
|
virtual void | onTearDown () |
|
| 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...
|
|
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 float | norm (float a) |
|
static double | norm (double a) |
|
static Real | norm (T a) |
|