SOFA plugin: MultiThreading  master
Open source framework for multi-physics simuation
multithreading::component::solidmechanics::spring::ParallelSpringForceField< DataTypes > Class Template Reference

#include <ParallelSpringForceField.h>

Inheritance diagram for multithreading::component::solidmechanics::spring::ParallelSpringForceField< DataTypes >:

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(ParallelSpringForceField, DataTypes), SOFA_TEMPLATE(SpringForceField, DataTypes))
 
void init () override
 
void addForce (const sofa::core::MechanicalParams *mparams, DataVecDeriv &data_f1, DataVecDeriv &data_f2, const DataVecCoord &data_x1, const DataVecCoord &data_x2, const DataVecDeriv &data_v1, const DataVecDeriv &data_v2) override
 
void addDForce (const sofa::core::MechanicalParams *mparams, DataVecDeriv &data_df1, DataVecDeriv &data_df2, const DataVecDeriv &data_dx1, const DataVecDeriv &data_dx2) override
 
- Public Member Functions inherited from sofa::component::solidmechanics::spring::SpringForceField< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(SpringForceField, DataTypes), SOFA_TEMPLATE(core::behavior::PairInteractionForceField, DataTypes))
 
void init () override
 
void reinit () override
 
bool load (const char *filename)
 
void addForce (const core::MechanicalParams *mparams, DataVecDeriv &f1, DataVecDeriv &f2, const DataVecCoord &x1, const DataVecCoord &x2, const DataVecDeriv &v1, const DataVecDeriv &v2) override
 
void addDForce (const core::MechanicalParams *, DataVecDeriv &df1, DataVecDeriv &df2, const DataVecDeriv &dx1, const DataVecDeriv &dx2) override
 
void addSpringDForce (VecDeriv &df1, const VecDeriv &dx1, VecDeriv &df2, const VecDeriv &dx2, sofa::Index i, const Spring &spring, SReal kFactor, SReal bFactor)
 
DataTypes::DPos computeSpringDForce (VecDeriv &df1, const VecDeriv &dx1, VecDeriv &df2, const VecDeriv &dx2, sofa::Index i, const Spring &spring, SReal kFactor, SReal bFactor)
 
SReal getPotentialEnergy (const core::MechanicalParams *, const DataVecCoord &data_x1, const DataVecCoord &data_x2) const override
 
virtual void addKToMatrix (const core::MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix) override
 
void buildStiffnessMatrix (core::behavior::StiffnessMatrix *matrix) override
 
void buildDampingMatrix (core::behavior::DampingMatrix *) override
 
void draw (const core::visual::VisualParams *vparams) override
 
void computeBBox (const core::ExecParams *params, bool onlyVisible=false) override
 
core::behavior::MechanicalState< DataTypes > * getObject1 ()
 
core::behavior::MechanicalState< DataTypes > * getObject2 ()
 
const sofa::type::vector< Spring > & getSprings () const
 
SReal getArrowSize () const
 
void setArrowSize (float s)
 
int getDrawMode () const
 
void setDrawMode (int m)
 
void clear (sofa::Size reserve=0)
 
void removeSpring (sofa::Index idSpring)
 
void addSpring (sofa::Index m1, sofa::Index m2, SReal ks, SReal kd, SReal initlen)
 
void addSpring (const Spring &spring)
 
void initGnuplot (const std::string path) override
 
void exportGnuplot (SReal time) override
 
- Public Member Functions inherited from PairInteractionForceField< DataTypes >
 SOFA_ABSTRACT_CLASS2 (SOFA_TEMPLATE(PairInteractionForceField, DataTypes), BaseInteractionForceField, SOFA_TEMPLATE2(PairStateAccessor, DataTypes, DataTypes))
 
void setPathObject1 (const std::string &path)
 
void setPathObject2 (const std::string &path)
 
std::string getPathObject1 () const
 
std::string getPathObject2 () const
 
void addForce (const MechanicalParams *mparams, MultiVecDerivId fId) override
 
virtual void addForce (const MechanicalParams *mparams, DataVecDeriv &f1, DataVecDeriv &f2, const DataVecCoord &x1, const DataVecCoord &x2, const DataVecDeriv &v1, const DataVecDeriv &v2)=0
 
void addDForce (const MechanicalParams *mparams, MultiVecDerivId dfId) override
 
virtual void addDForce (const MechanicalParams *mparams, DataVecDeriv &df1, DataVecDeriv &df2, const DataVecDeriv &dx1, const DataVecDeriv &dx2)=0
 
SReal getPotentialEnergy (const MechanicalParams *mparams) const override
 
virtual SReal getPotentialEnergy (const MechanicalParams *mparams, const DataVecCoord &x1, const DataVecCoord &x2) const =0
 
void addForce (const MechanicalParams *mparams, MultiVecDerivId fId) override
 
virtual void addForce (const MechanicalParams *mparams, DataVecDeriv &f1, DataVecDeriv &f2, const DataVecCoord &x1, const DataVecCoord &x2, const DataVecDeriv &v1, const DataVecDeriv &v2)=0
 
void addDForce (const MechanicalParams *mparams, MultiVecDerivId dfId) override
 
virtual void addDForce (const MechanicalParams *mparams, DataVecDeriv &df1, DataVecDeriv &df2, const DataVecDeriv &dx1, const DataVecDeriv &dx2)=0
 
SReal getPotentialEnergy (const MechanicalParams *mparams) const override
 
virtual SReal getPotentialEnergy (const MechanicalParams *mparams, const DataVecCoord &x1, const DataVecCoord &x2) const =0
 
- Public Member Functions inherited from sofa::core::behavior::BaseInteractionForceField
 SOFA_ABSTRACT_CLASS (BaseInteractionForceField, BaseForceField)
 
virtual BaseMechanicalStategetMechModel1 ()
 
virtual BaseMechanicalStategetMechModel2 ()
 
bool insertInNode (objectmodel::BaseNode *node) override
 
bool removeInNode (objectmodel::BaseNode *node) override
 
- Public Member Functions inherited from sofa::core::behavior::BaseForceField
 SOFA_ABSTRACT_CLASS (BaseForceField, StateAccessor)
 
virtual void addForce (const MechanicalParams *mparams, MultiVecDerivId fId)=0
 
virtual void addDForce (const MechanicalParams *mparams, MultiVecDerivId dfId)=0
 
virtual void addMBKdx (const MechanicalParams *mparams, MultiVecDerivId dfId)
 
virtual SReal getPotentialEnergy (const MechanicalParams *mparams=mechanicalparams::defaultInstance()) const=0
 
virtual void addBToMatrix (const MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix)
 
virtual void addMBKToMatrix (const MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix)
 
virtual const sofa::linearalgebra::BaseMatrixgetComplianceMatrix (const MechanicalParams *)=delete
 
virtual void addClambda (const MechanicalParams *, MultiVecDerivId, MultiVecDerivId, SReal)=delete
 
virtual void addForce (const MechanicalParams *mparams, MultiVecDerivId fId)=0
 
virtual void addDForce (const MechanicalParams *mparams, MultiVecDerivId dfId)=0
 
virtual void addMBKdx (const MechanicalParams *mparams, MultiVecDerivId dfId)
 
virtual SReal getPotentialEnergy (const MechanicalParams *mparams=mechanicalparams::defaultInstance()) const=0
 
virtual void addBToMatrix (const MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix)
 
virtual void addMBKToMatrix (const MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix)
 
- Public Member Functions inherited from sofa::core::behavior::StateAccessor
 SOFA_ABSTRACT_CLASS (StateAccessor, objectmodel::BaseObject)
 
virtual const MultiLink< StateAccessor, BaseMechanicalState, BaseLink::FLAG_DUPLICATE >::Container & getMechanicalStates () const
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseObject
 SOFA_CLASS (BaseObject, Base)
 
void setSrc (const std::string &v, std::vector< std::string > *attributeList=nullptr)
 
void setSrc (const std::string &v, const BaseObject *loader, std::vector< std::string > *attributeList=nullptr)
 
BasefindLinkDestClass (const BaseClass *destType, const std::string &path, const BaseLink *link) override
 
virtual std::string getPathName () const override
 
SReal getTime () const
 
const BaseContextgetContext () const
 
BaseContextgetContext ()
 
const BaseObjectgetMaster () const
 
BaseObjectgetMaster ()
 
const VecSlavesgetSlaves () const
 
BaseObjectgetSlave (const std::string &name) const
 
virtual void addSlave (BaseObject::SPtr s)
 
virtual void removeSlave (BaseObject::SPtr s)
 
virtual void handleEvent (Event *)
 
virtual void handleTopologyChange ()
 
virtual void handleTopologyChange (core::topology::Topology *t)
 
void parse (BaseObjectDescription *arg) override
 
virtual void bwdInit ()
 
void updateInternal ()
 
virtual void storeResetState ()
 
virtual void reset ()
 
virtual void cleanup ()
 
SReal getTime () const
 
- Public Member Functions inherited from sofa::core::objectmodel::Base
virtual const BaseClassgetClass () const
 
void addDeprecatedAttribute (lifecycle::DeprecatedData *attribute)
 
void addUpdateCallback (const std::string &name, std::initializer_list< BaseData * > inputs, std::function< sofa::core::objectmodel::ComponentState(const DataTracker &)> function, std::initializer_list< BaseData * > outputs)
 
void addOutputsToCallback (const std::string &name, std::initializer_list< BaseData * > outputs)
 
const std::string & getName () const
 
void setName (const std::string &n)
 
void setName (const std::string &n, int counter)
 
std::string getTypeName () const
 
virtual std::string getClassName () const
 
virtual std::string getTemplateName () const final
 
std::string getNameSpaceName () const
 
void setDefinitionSourceFileName (const std::string &sourceFileName)
 
const std::string & getDefinitionSourceFileName () const
 
void setDefinitionSourceFilePos (const int)
 
int getDefinitionSourceFilePos () const
 
void setInstanciationSourceFileName (const std::string &sourceFileName)
 
const std::string & getInstanciationSourceFileName () const
 
void setInstanciationSourceFilePos (const int)
 
int getInstanciationSourceFilePos () const
 
void addMessage (const sofa::helper::logging::Message &m) const
 
size_t countLoggedMessages (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
const std::deque< sofa::helper::logging::Message > & getLoggedMessages () const
 
const std::string getLoggedMessagesAsString (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
void clearLoggedMessages () const
 
bool notMuted () const
 
const sofa::core::objectmodel::TagSetgetTags () const
 
bool hasTag (Tag t) const
 
void addTag (Tag t)
 
void removeTag (Tag t)
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
bool isComponentStateInvalid () const
 
 SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT () virtual const behavior
 
virtual bool parseField (const std::string &attribute, const std::string &value)
 
virtual bool hasField (const std::string &attribute) const
 
void parseFields (const std::list< std::string > &str)
 
virtual void parseFields (const std::map< std::string, std::string * > &str)
 
void writeDatas (std::map< std::string, std::string * > &str)=delete
 
void writeDatas (std::ostream &out, const std::string &separator=" ")
 
BaseDatafindData (const std::string &name) const
 
std::vector< BaseData * > findGlobalField (const std::string &name) const
 
BaseLinkfindLink (const std::string &name) const
 
std::vector< BaseLink * > findLinks (const std::string &name) const
 
virtual void updateLinks (bool logErrors=true)
 
BaseData::BaseInitData initData (::sofa::core::objectmodel::Data< T > *field, const char *name, const char *help, ::sofa::core::objectmodel::BaseData::DataFlags dataflags)
 
BaseData::BaseInitData initData (Data< T > *field, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
Data< T >::InitData initData (Data< T > *field, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
void addData (BaseData *f, const std::string &name)
 
void addData (BaseData *f)
 
void removeData (BaseData *f)
 
void addAlias (BaseData *field, const char *alias)
 
void addLink (BaseLink *l)
 
void addAlias (BaseLink *link, const char *alias)
 
const VecDatagetDataFields () const
 
const MapDatagetDataAliases () const
 
const VecLinkgetLinks () const
 
const MapLinkgetLinkAliases () const
 
virtual bool findDataLinkDest (BaseData *&ptr, const std::string &path, const BaseLink *link)
 
bool findLinkDest (T *&ptr, const std::string &path, const BaseLink *link)
 
const sofa::core::objectmodel::TagSetgetTags () const
 
bool hasTag (Tag t) const
 
void addTag (Tag t)
 
void removeTag (Tag t)
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
bool isComponentStateInvalid () const
 
 SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT () virtual const behavior
 
- Public Member Functions inherited from sofa::core::behavior::PairStateAccessor< class, class >
 SOFA_ABSTRACT_CLASS (SOFA_TEMPLATE2(PairStateAccessor, DataTypes1, DataTypes2), StateAccessor)
 
MechanicalState< DataTypes1 > * getMState1 ()
 
const MechanicalState< DataTypes1 > * getMState1 () const
 
BaseMechanicalStategetMechModel1 ()
 
const BaseMechanicalStategetMechModel1 () const
 
MechanicalState< DataTypes2 > * getMState2 ()
 
const MechanicalState< DataTypes2 > * getMState2 () const
 
BaseMechanicalStategetMechModel2 ()
 
const BaseMechanicalStategetMechModel2 () const
 

Additional Inherited Members

- Public Attributes inherited from sofa::component::solidmechanics::spring::SpringForceField< DataTypes >
Data< float > d_showArrowSize
 
Data< int > d_drawMode
 
Data< type::vector< SReal > > d_ks
 
Data< type::vector< SReal > > d_kd
 
Data< type::vector< Spring > > d_springs
 
Data< type::vector< SReal > > d_lengths
 
Data< type::vector< bool > > d_elongationOnly
 
Data< type::vector< bool > > d_enabled
 
- Public Attributes inherited from sofa::core::behavior::BaseForceField
Data< SReal > rayleighStiffness
 
objectmodel::lifecycle::RemovedData isCompliance
 
- Public Attributes inherited from sofa::core::objectmodel::BaseObject
Data< bool > f_listening
 
- Public Attributes inherited from sofa::core::objectmodel::Base
std::vector< lifecycle::DeprecatedData * > m_oldAttributes
 
Data< int > d_messageLogCount
 
Data< std::string > name
 
Data< bool > f_printLog
 
Data< sofa::core::objectmodel::TagSetf_tags
 
Data< sofa::type::BoundingBoxf_bbox
 
Data< sofa::core::objectmodel::ComponentStated_componentState
 
std::string m_definitionSourceFileName
 
int m_definitionSourceFilePos
 
std::string m_instanciationSourceFileName
 
int m_instanciationSourceFilePos
 
- Public Attributes inherited from multithreading::TaskSchedulerUser
sofa::Data< int > d_nbThreads
 
sofa::Data< std::string > d_taskSchedulerType
 Type of task scheduler to use. More...
 
- Static Public Attributes inherited from sofa::component::solidmechanics::spring::SpringForceField< DataTypes >
static constexpr auto N
 
- Protected Attributes inherited from sofa::component::solidmechanics::spring::SpringForceField< DataTypes >
sofa::type::vector< Mat > dfdx
 
core::objectmodel::DataFileName fileSprings
 
core::objectmodel::DataCallback c_springCallBack
 
bool areSpringIndicesDirty
 
bool maskInUse
 
Real m_potentialEnergy
 
SpringForceFieldInternalData< DataTypesdata
 
std::array< sofa::core::topology::TopologySubsetIndices, 2 > d_springsIndices
 
std::ofstream * m_gnuplotFileEnergy
 
- Protected Attributes inherited from sofa::core::behavior::StateAccessor
MultiLink< StateAccessor, BaseMechanicalState, BaseLink::FLAG_DUPLICATE > l_mechanicalStates
 
- Protected Attributes inherited from sofa::core::objectmodel::BaseObject
SingleLink< BaseObject, BaseContext, BaseLink::FLAG_DOUBLELINK > l_context
 
LinkSlaves l_slaves
 
SingleLink< BaseObject, BaseObject, BaseLink::FLAG_DOUBLELINK > l_master
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
std::map< std::string, sofa::core::DataTrackerCallbackm_internalEngine
 
VecData m_vecData
 
MapData m_aliasData
 
VecLink m_vecLink
 
MapLink m_aliasLink
 
- Protected Attributes inherited from sofa::core::behavior::PairStateAccessor< class, class >
SingleLink< PairStateAccessor< DataTypes1, DataTypes2 >, MechanicalState< DataTypes1 >, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK > mstate1
 
SingleLink< PairStateAccessor< DataTypes1, DataTypes2 >, MechanicalState< DataTypes2 >, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK > mstate2
 
- Protected Attributes inherited from multithreading::TaskSchedulerUser
sofa::simulation::TaskSchedulerm_taskScheduler { nullptr }
 
- Static Public Member Functions inherited from PairInteractionForceField< DataTypes >
static bool canCreate (T *obj, objectmodel::BaseContext *context, objectmodel::BaseObjectDescription *arg)
 
static T::SPtr create (T *, core::objectmodel::BaseContext *context, core::objectmodel::BaseObjectDescription *arg)
 
static std::string shortName (const T *ptr=nullptr, objectmodel::BaseObjectDescription *arg=nullptr)
 
- Static Public Member Functions inherited from sofa::core::objectmodel::BaseObject
static bool canCreate (T *, BaseContext *, BaseObjectDescription *)
 
static T::SPtr create (T *, BaseContext *context, BaseObjectDescription *arg)
 
- Static Public Member Functions inherited from sofa::core::objectmodel::Base
static const BaseClassGetClass ()
 
static std::string shortName (const T *ptr=nullptr, BaseObjectDescription *=nullptr)
 
- Protected Member Functions inherited from sofa::component::solidmechanics::spring::SpringForceField< DataTypes >
 SpringForceField (SReal _ks=100.0, SReal _kd=5.0)
 
 SpringForceField (MechanicalState *object1, MechanicalState *object2, SReal _ks=100.0, SReal _kd=5.0)
 
virtual std::unique_ptr< SpringForce > computeSpringForce (const VecCoord &p1, const VecDeriv &v1, const VecCoord &p2, const VecDeriv &v2, const Spring &spring)
 
virtual void addSpringForce (Real &potentialEnergy, VecDeriv &f1, const VecCoord &p1, const VecDeriv &v1, VecDeriv &f2, const VecCoord &p2, const VecDeriv &v2, sofa::Index, const Spring &spring)
 
void initializeTopologyHandler (sofa::core::topology::TopologySubsetIndices &indices, core::topology::BaseMeshTopology *topology, sofa::Index mstateId)
 
void updateTopologyIndicesFromSprings ()
 
void updateTopologyIndicesFromSprings_springAdded ()
 
void updateTopologyIndices_springRemoved (unsigned id)
 
void updateSpringsFromTopologyIndices ()
 
void applyRemovedPoints (const sofa::core::topology::PointsRemoved *pointsRemoved, sofa::Index mstateId)
 
void applyRemovedEdges (const sofa::core::topology::EdgesRemoved *edgesRemoved, sofa::Index mstateId)
 
- Protected Member Functions inherited from PairInteractionForceField< DataTypes >
 PairInteractionForceField (MechanicalState< DataTypes > *mm1=nullptr, MechanicalState< DataTypes > *mm2=nullptr)
 
 ~PairInteractionForceField () override
 
- Protected Member Functions inherited from sofa::core::behavior::BaseForceField
 BaseForceField ()
 
 ~BaseForceField () override=default
 
- Protected Member Functions inherited from sofa::core::behavior::StateAccessor
 StateAccessor ()
 
 ~StateAccessor () override=default
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseObject
 BaseObject ()
 
 ~BaseObject () override
 
virtual void doUpdateInternal ()
 
void changeContextLink (BaseContext *before, BaseContext *&after)
 
void changeSlavesLink (BaseObject::SPtr ptr, std::size_t, bool add)
 
void trackInternalData (const BaseData &data)
 
void cleanTracker ()
 
bool hasDataChanged (const BaseData &data)
 
- Protected Member Functions inherited from sofa::core::objectmodel::Base
 Base ()
 
virtual ~Base ()
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, BaseData::DataFlags dataFlags)
 
void initData0 (Data< T > *field, typename Data< T >::InitData &res, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
- Protected Member Functions inherited from sofa::core::IntrusiveObject
virtual ~IntrusiveObject ()=default
 
- Protected Member Functions inherited from sofa::core::behavior::PairStateAccessor< class, class >
 PairStateAccessor (MechanicalState< DataTypes1 > *mm1=nullptr, MechanicalState< DataTypes2 > *mm2=nullptr)
 
 ~PairStateAccessor () override=default
 
- Protected Member Functions inherited from multithreading::TaskSchedulerUser
 TaskSchedulerUser ()
 
void initTaskScheduler ()
 
void reinitTaskScheduler ()
 
void stopTaskSchduler ()
 
- Static Protected Member Functions inherited from sofa::component::solidmechanics::spring::SpringForceField< DataTypes >
static void addToMatrix (Matrix *globalMatrix, const unsigned int offsetRow, const unsigned int offsetCol, const Mat &localMatrix)
 

Function details

◆ addDForce()

template<class DataTypes >
void multithreading::component::solidmechanics::spring::ParallelSpringForceField< DataTypes >::addDForce ( const sofa::core::MechanicalParams mparams,
DataVecDeriv data_df1,
DataVecDeriv data_df2,
const DataVecDeriv data_dx1,
const DataVecDeriv data_dx2 
)
override

◆ addForce()

template<class DataTypes >
void multithreading::component::solidmechanics::spring::ParallelSpringForceField< DataTypes >::addForce ( const sofa::core::MechanicalParams mparams,
DataVecDeriv data_f1,
DataVecDeriv data_f2,
const DataVecCoord data_x1,
const DataVecCoord data_x2,
const DataVecDeriv data_v1,
const DataVecDeriv data_v2 
)
override

◆ init()

template<class DataTypes >
void multithreading::component::solidmechanics::spring::ParallelSpringForceField< DataTypes >::init ( void  )
overridevirtual

◆ SOFA_CLASS()

template<class DataTypes >
multithreading::component::solidmechanics::spring::ParallelSpringForceField< DataTypes >::SOFA_CLASS ( SOFA_TEMPLATE(ParallelSpringForceField< DataTypes >, DataTypes)  ,
SOFA_TEMPLATE(SpringForceField, DataTypes)   
)