sofa::component::forcefield::SphereForceField< DataTypes > Class Template Reference

#include <SphereForceField.h>

Inheritance diagram for sofa::component::forcefield::SphereForceField< DataTypes >:

Inheritance graph
[legend]
Collaboration diagram for sofa::component::forcefield::SphereForceField< DataTypes >:

Collaboration graph
[legend]

Data Structures

class  Contact

Public Types

typedef
core::componentmodel::behavior::ForceField
< DataTypes > 
Inherit
typedef DataTypes::VecCoord VecCoord
typedef DataTypes::VecDeriv VecDeriv
typedef DataTypes::Coord Coord
typedef DataTypes::Deriv Deriv
typedef Coord::value_type Real

Public Member Functions

 SphereForceField ()
void setSphere (const Coord &center, Real radius)
void setStiffness (Real stiff)
void setDamping (Real damp)
virtual void addForce (VecDeriv &f, const VecCoord &x, const VecDeriv &v)
 Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.
virtual void addDForce (VecDeriv &df, const VecDeriv &dx, double kFactor, double bFactor)
 Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().
virtual double getPotentialEnergy (const VecCoord &x)
 Get the potential energy associated to this ForceField.
virtual void updateStiffness (const VecCoord &x)
void draw ()
 Render internal data of this object, for debugging purposes.
template<>
void addForce (VecDeriv &f, const VecCoord &x, const VecDeriv &v)
 Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.
template<>
void addDForce (VecDeriv &df, const VecDeriv &dx, double kFactor, double bFactor)
 Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().
template<>
void addForce (VecDeriv &f, const VecCoord &x, const VecDeriv &v)
 Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.
template<>
void addDForce (VecDeriv &df, const VecDeriv &dx, double kFactor, double bFactor)
 Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().
template<>
void addForce (VecDeriv &f, const VecCoord &x, const VecDeriv &v)
 Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.
template<>
void addDForce (VecDeriv &df, const VecCoord &dx, double kFactor, double)
template<>
void addForce (VecDeriv &f, const VecCoord &x, const VecDeriv &v)
 Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.
template<>
void addDForce (VecDeriv &df, const VecCoord &dx, double kFactor, double)

Data Fields

Data< Coord > sphereCenter
Data< Real > sphereRadius
Data< Real > stiffness
Data< Real > damping
Data< defaulttype::Vec3f > color
Data< bool > bDraw

Protected Attributes

Data< sofa::helper::vector
< Contact > > 
contacts
SphereForceFieldInternalData
< DataTypes > 
data

Detailed Description

template<class DataTypes>
class sofa::component::forcefield::SphereForceField< DataTypes >

Definition at line 49 of file SphereForceField.h.


Member Typedef Documentation

template<class DataTypes >
typedef DataTypes::Coord sofa::component::forcefield::SphereForceField< DataTypes >::Coord

template<class DataTypes >
typedef DataTypes::Deriv sofa::component::forcefield::SphereForceField< DataTypes >::Deriv

Definition at line 52 of file SphereForceField.h.

template<class DataTypes >
typedef Coord::value_type sofa::component::forcefield::SphereForceField< DataTypes >::Real

Definition at line 57 of file SphereForceField.h.

template<class DataTypes >
typedef DataTypes::VecCoord sofa::component::forcefield::SphereForceField< DataTypes >::VecCoord

template<class DataTypes >
typedef DataTypes::VecDeriv sofa::component::forcefield::SphereForceField< DataTypes >::VecDeriv


Constructor & Destructor Documentation

template<class DataTypes >
sofa::component::forcefield::SphereForceField< DataTypes >::SphereForceField (  )  [inline]

Definition at line 96 of file SphereForceField.h.


Member Function Documentation

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3f1Types >::addDForce ( VecDeriv &  df,
const VecCoord &  dx,
double  kFactor,
double   
) [inline]

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3fTypes >::addDForce ( VecDeriv &  df,
const VecCoord &  dx,
double  kFactor,
double   
) [inline]

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3f1Types >::addDForce ( VecDeriv &  df,
const VecDeriv &  dx,
double  kFactor,
double  bFactor 
) [inline, virtual]

Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().

The derivative should be directly derived from the computations done by addForce. Any forces neglected in addDForce will be integrated explicitly (i.e. using its value at the beginning of the timestep).

If the ForceField can be represented as a matrix, this method computes $ df += kFactor K dx + bFactor B dx $

This method must be implemented by the component, and is usually called by the generic ForceField::addDForce() method.

To support old components that implement the deprecated addForce method without scalar coefficients, it defaults to using a temporaty vector to compute $ K dx $ and then manually scaling all values by kFactor.

Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3fTypes >::addDForce ( VecDeriv &  df,
const VecDeriv &  dx,
double  kFactor,
double  bFactor 
) [inline, virtual]

Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().

The derivative should be directly derived from the computations done by addForce. Any forces neglected in addDForce will be integrated explicitly (i.e. using its value at the beginning of the timestep).

If the ForceField can be represented as a matrix, this method computes $ df += kFactor K dx + bFactor B dx $

This method must be implemented by the component, and is usually called by the generic ForceField::addDForce() method.

To support old components that implement the deprecated addForce method without scalar coefficients, it defaults to using a temporaty vector to compute $ K dx $ and then manually scaling all values by kFactor.

Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.

template<class DataTypes >
void sofa::component::forcefield::SphereForceField< DataTypes >::addDForce ( VecDeriv &  df,
const VecDeriv &  dx,
double  kFactor,
double  bFactor 
) [inline, virtual]

Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().

The derivative should be directly derived from the computations done by addForce. Any forces neglected in addDForce will be integrated explicitly (i.e. using its value at the beginning of the timestep).

If the ForceField can be represented as a matrix, this method computes $ df += kFactor K dx + bFactor B dx $

This method must be implemented by the component, and is usually called by the generic ForceField::addDForce() method.

To support old components that implement the deprecated addForce method without scalar coefficients, it defaults to using a temporaty vector to compute $ K dx $ and then manually scaling all values by kFactor.

Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.

Definition at line 93 of file SphereForceField.inl.

References sofa::component::forcefield::SphereForceField< DataTypes >::contacts, sofa::component::forcefield::SphereForceField< DataTypes >::Contact::fact, sofa::core::objectmodel::Data< T >::getValue(), sofa::component::forcefield::SphereForceField< DataTypes >::Contact::index, sofa::component::forcefield::SphereForceField< DataTypes >::Contact::normal, and sofa::component::forcefield::SphereForceField< DataTypes >::stiffness.

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3f1Types >::addForce ( VecDeriv &  f,
const VecCoord &  x,
const VecDeriv &  v 
) [inline, virtual]

Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.

If the ForceField can be represented as a matrix, this method computes $ f += B v + K x $

This method must be implemented by the component, and is usually called by the generic ForceField::addForce() method.

Implements sofa::core::componentmodel::behavior::ForceField< DataTypes >.

Definition at line 86 of file CudaSphereForceField.inl.

References sofa::component::forcefield::SphereForceField< DataTypes >::damping, sofa::component::forcefield::SphereForceField< DataTypes >::data, sofa::core::objectmodel::Data< T >::getValue(), sofa::component::forcefield::SphereForceField< DataTypes >::sphereCenter, sofa::gpu::cuda::SphereForceFieldCuda3f1_addForce(), sofa::component::forcefield::SphereForceField< DataTypes >::sphereRadius, and sofa::component::forcefield::SphereForceField< DataTypes >::stiffness.

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3fTypes >::addForce ( VecDeriv &  f,
const VecCoord &  x,
const VecDeriv &  v 
) [inline, virtual]

Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.

If the ForceField can be represented as a matrix, this method computes $ f += B v + K x $

This method must be implemented by the component, and is usually called by the generic ForceField::addForce() method.

Implements sofa::core::componentmodel::behavior::ForceField< DataTypes >.

Definition at line 63 of file CudaSphereForceField.inl.

References sofa::component::forcefield::SphereForceField< DataTypes >::damping, sofa::component::forcefield::SphereForceField< DataTypes >::data, sofa::core::objectmodel::Data< T >::getValue(), sofa::component::forcefield::SphereForceField< DataTypes >::sphereCenter, sofa::gpu::cuda::SphereForceFieldCuda3f_addForce(), sofa::component::forcefield::SphereForceField< DataTypes >::sphereRadius, and sofa::component::forcefield::SphereForceField< DataTypes >::stiffness.

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3f1Types >::addForce ( VecDeriv &  f,
const VecCoord &  x,
const VecDeriv &  v 
) [inline, virtual]

Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.

If the ForceField can be represented as a matrix, this method computes $ f += B v + K x $

This method must be implemented by the component, and is usually called by the generic ForceField::addForce() method.

Implements sofa::core::componentmodel::behavior::ForceField< DataTypes >.

template<>
void sofa::component::forcefield::SphereForceField< gpu::cuda::CudaVec3fTypes >::addForce ( VecDeriv &  f,
const VecCoord &  x,
const VecDeriv &  v 
) [inline, virtual]

Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.

If the ForceField can be represented as a matrix, this method computes $ f += B v + K x $

This method must be implemented by the component, and is usually called by the generic ForceField::addForce() method.

Implements sofa::core::componentmodel::behavior::ForceField< DataTypes >.

template<class DataTypes >
void sofa::component::forcefield::SphereForceField< DataTypes >::addForce ( VecDeriv &  f,
const VecCoord &  x,
const VecDeriv &  v 
) [inline, virtual]

template<class DataTypes >
void sofa::component::forcefield::SphereForceField< DataTypes >::draw (  )  [inline, virtual]

template<class DataTypes >
double sofa::component::forcefield::SphereForceField< DataTypes >::getPotentialEnergy ( const VecCoord &  x  )  [inline, virtual]

Get the potential energy associated to this ForceField.

Used to extimate the total energy of the system by some post-stabilization techniques.

This method must be implemented by the component, and is usually called by the generic ForceField::getPotentialEnergy() method.

Implements sofa::core::componentmodel::behavior::ForceField< DataTypes >.

Definition at line 132 of file SphereForceField.inl.

template<class DataTypes >
void sofa::component::forcefield::SphereForceField< DataTypes >::setDamping ( Real  damp  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::SphereForceField< DataTypes >::setSphere ( const Coord &  center,
Real  radius 
) [inline]

template<class DataTypes >
void sofa::component::forcefield::SphereForceField< DataTypes >::setStiffness ( Real  stiff  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::SphereForceField< DataTypes >::updateStiffness ( const VecCoord &  x  )  [inline, virtual]


Field Documentation


The documentation for this class was generated from the following files:

Generated on Sun Nov 23 04:19:37 2008 for Sofa by  doxygen 1.5.7.1