SOFA API  b3f2f2a4
Open source framework for multi-physics simuation
sofa::helper::io::XspLoaderDataHook Class Reference

#include <XspLoader.h>

Inherit this class to load data from a Xsp file. More...

Inheritance diagram for sofa::helper::io::XspLoaderDataHook:

Detailed Description

Inherit this class to load data from a Xsp file.

To connect client-code data structure with the XspLoader you need to Inherit from this class and override the virtual methods to you fill your structures from the XspLoader events.

Each overridable method is connected to the reading of a given "token" in the Xsp file format.

See also
XspLoader for an example of use.

Public Member Functions

virtual ~XspLoaderDataHook ()
 Destructor, does nothing special. More...
 
virtual void finalizeLoading (bool isOk)
 Called by the XspLoader when the loading is done. More...
 
virtual void setNumMasses (size_t)
 Called by the XspLoader to specify before loading the number of masses. More...
 
virtual void setNumSprings (size_t)
 Called by the XspLoader to specify before loading the number of springs. More...
 
virtual void setGravity (SReal, SReal, SReal)
 Called by the XspLoader to specify the directional gravity. More...
 
virtual void setViscosity (SReal)
 Called by the XspLoader to specify the viscosity. More...
 
virtual void addMass (SReal, SReal, SReal, SReal, SReal, SReal, SReal, SReal, bool, bool)
 Add a new mass. More...
 
virtual void addSpring (size_t, size_t, SReal, SReal, SReal)
 Add a new spring. More...
 
virtual void addVectorSpring (size_t m1, size_t m2, SReal ks, SReal kd, SReal initpos, SReal, SReal, SReal)
 Add an extended spring. More...
 

Constructor details

◆ ~XspLoaderDataHook()

sofa::helper::io::XspLoaderDataHook::~XspLoaderDataHook ( )
virtual

Destructor, does nothing special.

Function details

◆ addMass()

virtual void sofa::helper::io::XspLoaderDataHook::addMass ( SReal  ,
SReal  ,
SReal  ,
SReal  ,
SReal  ,
SReal  ,
SReal  ,
SReal  ,
bool  ,
bool   
)
inlinevirtual

Add a new mass.

Parameters
px,py,pz3D position.
vx,vz,vz3D velocity.
mass.
elasticproperty.
fixedboolean indicates that the mass is "static".
surfaceindicates that the mass is on the surface.

Reimplemented in sofa::component::mass::DiagonalMass< DataTypes, GeometricalTypes >::Loader, sofa::component::mapping::nonlinear::RigidMapping< TIn, TOut >::Loader, and sofa::component::io::mesh::MeshXspLoadDataHook.

◆ addSpring()

virtual void sofa::helper::io::XspLoaderDataHook::addSpring ( size_t  ,
size_t  ,
SReal  ,
SReal  ,
SReal   
)
inlinevirtual

◆ addVectorSpring()

virtual void sofa::helper::io::XspLoaderDataHook::addVectorSpring ( size_t  m1,
size_t  m2,
SReal  ks,
SReal  kd,
SReal  initpos,
SReal  ,
SReal  ,
SReal   
)
inlinevirtual

◆ finalizeLoading()

virtual void sofa::helper::io::XspLoaderDataHook::finalizeLoading ( bool  isOk)
inlinevirtual

Called by the XspLoader when the loading is done.

This method is called by the XspLoader when the loading is done. Overriding this method allows client-code to implement post-loading checking.

Parameters
isOkis set to false this means that the loading code detected a problem and that the loaded informations are invalid and should be removed from the container.

Reimplemented in sofa::component::io::mesh::MeshXspLoadDataHook.

◆ setGravity()

virtual void sofa::helper::io::XspLoaderDataHook::setGravity ( SReal  ,
SReal  ,
SReal   
)
inlinevirtual

Called by the XspLoader to specify the directional gravity.

Parameters
gx,gy,gzthe three component of the gravity.

◆ setNumMasses()

virtual void sofa::helper::io::XspLoaderDataHook::setNumMasses ( size_t  )
inlinevirtual

Called by the XspLoader to specify before loading the number of masses.

Parameters
nnumber of massses.

Reimplemented in sofa::component::io::mesh::MeshXspLoadDataHook.

◆ setNumSprings()

virtual void sofa::helper::io::XspLoaderDataHook::setNumSprings ( size_t  )
inlinevirtual

Called by the XspLoader to specify before loading the number of springs.

Parameters
nnumber of springs.

Reimplemented in sofa::component::io::mesh::MeshXspLoadDataHook.

◆ setViscosity()

virtual void sofa::helper::io::XspLoaderDataHook::setViscosity ( SReal  )
inlinevirtual

Called by the XspLoader to specify the viscosity.

Parameters
gx,gy,gzthe three component of the gravity.