SOFA API  7352f41a
Open source framework for multi-physics simuation
sofa::AffinePatch_sofa_test< _DataTypes > Struct Template Reference
Inheritance diagram for sofa::AffinePatch_sofa_test< _DataTypes >:

Detailed Description

template<typename _DataTypes>
struct sofa::AffinePatch_sofa_test< _DataTypes >

AFfine Patch test. An affine movement (rotation and translation) is applied to the borders of a mesh. Test if the points inside have the same affine movement.

Public Attributes

simulation::Node::SPtr root
 Root of the scene graph. More...
 
simulation::Simulationsimulation
 Tested simulation. More...
 
PatchTestStruct< DataTypespatchStruct
 Structure which contains current node and pointers to the mechanical object and the affine constraint. More...
 
type::Mat< 3, 3, RealtestedRotation
 Tested Rotation: random rotation matrix. More...
 
Coord testedTranslation
 Tested Translation: random translation. More...
 
- Public Attributes inherited from sofa::testing::BaseTest
sofa::testing::MessageAsTestFailure m_fatal
 
sofa::testing::MessageAsTestFailure m_error
 

Public Member Functions

void SetUp () override
 Create the context for the scene. More...
 
void createScene2DRegularGrid (bool randomRotation=true, bool randomTranslation=true)
 Create a scene with a 2D regular grid and an affine constraint. More...
 
void createScene3DRegularGrid (bool randomRotation=true, bool randomTranslation=true)
 Create a scene with a 3D regular grid and an affine constraint. More...
 
void setRotation (type::Mat< 3, 3, Real > rotationMatrix)
 
void setTranslation (int x, int y, int z)
 
bool compareSimulatedToTheoreticalPositions (double convergenceAccuracy, double diffMaxBetweenSimulatedAndTheoreticalPosition)
 After simulation compare the positions of points to the theoretical positions. More...
 
- 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< _DataTypes::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< _DataTypes::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< _DataTypes::Real >
static float norm (float a)
 
static double norm (double a)
 
static Real norm (T a)
 

Attribute details

◆ patchStruct

template<typename _DataTypes >
PatchTestStruct<DataTypes> sofa::AffinePatch_sofa_test< _DataTypes >::patchStruct

Structure which contains current node and pointers to the mechanical object and the affine constraint.

◆ root

template<typename _DataTypes >
simulation::Node::SPtr sofa::AffinePatch_sofa_test< _DataTypes >::root

Root of the scene graph.

◆ simulation

template<typename _DataTypes >
simulation::Simulation* sofa::AffinePatch_sofa_test< _DataTypes >::simulation

Tested simulation.

◆ testedRotation

template<typename _DataTypes >
type::Mat<3,3,Real> sofa::AffinePatch_sofa_test< _DataTypes >::testedRotation

Tested Rotation: random rotation matrix.

◆ testedTranslation

template<typename _DataTypes >
Coord sofa::AffinePatch_sofa_test< _DataTypes >::testedTranslation

Tested Translation: random translation.

Function details

◆ compareSimulatedToTheoreticalPositions()

template<typename _DataTypes >
bool sofa::AffinePatch_sofa_test< _DataTypes >::compareSimulatedToTheoreticalPositions ( double  convergenceAccuracy,
double  diffMaxBetweenSimulatedAndTheoreticalPosition 
)
inline

After simulation compare the positions of points to the theoretical positions.

◆ createScene2DRegularGrid()

template<typename _DataTypes >
void sofa::AffinePatch_sofa_test< _DataTypes >::createScene2DRegularGrid ( bool  randomRotation = true,
bool  randomTranslation = true 
)
inline

Create a scene with a 2D regular grid and an affine constraint.

◆ createScene3DRegularGrid()

template<typename _DataTypes >
void sofa::AffinePatch_sofa_test< _DataTypes >::createScene3DRegularGrid ( bool  randomRotation = true,
bool  randomTranslation = true 
)
inline

Create a scene with a 3D regular grid and an affine constraint.

◆ setRotation()

template<typename _DataTypes >
void sofa::AffinePatch_sofa_test< _DataTypes >::setRotation ( type::Mat< 3, 3, Real rotationMatrix)
inline

◆ setTranslation()

template<typename _DataTypes >
void sofa::AffinePatch_sofa_test< _DataTypes >::setTranslation ( int  x,
int  y,
int  z 
)
inline

◆ SetUp()

template<typename _DataTypes >
void sofa::AffinePatch_sofa_test< _DataTypes >::SetUp ( )
inlineoverride

Create the context for the scene.