forked from sofa-framework/sofa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r2563/sofa-dev : DOC: implementing task 2432. Small How To, and will …
…be continued
- Loading branch information
falipou
committed
Jun 18, 2008
1 parent
618dfb7
commit 22791a8
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
|
||
\section{How To create a new Force Field} | ||
to come... | ||
|
||
In SOFA, the Force Field already existing are located in the namespace sofa::component::forcefield. They derive from the core class sofa::core::componentmodel::behavior::ForceField. It is templated by the type of elements you want to model. It can be a deformable object of 1,2,3 or 6 dimensions, or rigid bodies of 2 and 3 dimensions.\\ | ||
The simplest way to implement your own ForceField is : | ||
\begin{enumerate} | ||
\item make it derive from sofa::core::componentmodel::behavior::ForceField | ||
\item implements the following virtual fonctions: addForce, getPotentialEnery. Others virtual functions exist like addDForce, addDForceV (if you want to make dynamics), and you should read the doxigen documentation about ForceField. | ||
\item as all the others component you might create, you have to add it to the project. Edit \$SOFA\_DIR/modules/sofa/component/component.pro, and add the path to new files in the section HEADERS and SOURCES. | ||
\item Edit \$SOFA\_DIR/modules/sofa/simulation/common/init.cpp and add your new forcefield to the list. This step is compulsory for Windows system, and does the linking of a new component to the factory. If you forget it, your component won't be created at initialization time. | ||
\end{enumerate} | ||
|
||
The method addForce computes and accumulates the forces given the positions and velocities of its associated mechanical state.\\ | ||
If the ForceField can be represented as a matrix, this method computes | ||
$$ f += B v + K x $$ | ||
This method is usually called by the generic ForceField::addForce() method. |
Binary file not shown.