SEARCH
TOOLBOX
LANGUAGES
Tips

Tips

From SOFAWiki

Jump to: navigation, search
Tips

Contents

Default Type

A type SReal exists in Sofa, giving a default type for floating point variables. Depending on the Sofa Configuration, it can be simple or double precision. 

Visualization Data

If your component has a "Data" dedicated to visualization purpose, making its name beginning with show will place it inside the Visualization tab, displayed when you try to modify a component in the GUI.

Trace and Profiling

You can Trace and Profile the Visitors, components, methods execution within Sofa. To do it, you must have enabled the option SOFA_DUMP_VISITOR_INFO.

Image:Profiling.png

  • Meaning of the colors:
    • blue: Visitor
    • purple: Component
    • gray: Node
    • yellow: Comment
  • How to use it:

The Visitors, and Components triggered by the visitors are automatically traced, and profiled.

To print a comment, add in your code:

simulation::Visitor::printComment("You Comment");

To trace and profile the execution of a part of your program, put, at the beginning of the code to profile:

simulation::Visitor::printNode("NameMethod");

and at end the process

simulation::Visitor::printCloseNode("NameMethod");

The method printNode can take other arguments to get a more detailed log; please refer to its API in the file modules/sofa/simulation/common/Visitor.h

Sofa Configuration

A graphic tool exists to configure Sofa, it is called sofaConfiguration. It will display all the options available for Sofa, and automatically update your project.

You may compile it independtly from everything else on Sofa. From your Sofa directory, change to applications/projects/sofaConfiguration and execute:

qmake
make

Then go back to your Sofa directory and launch ./bin/sofaConfiguration.

Usage of the Modeler

To have an example linked inside the Modeler, you have to create a .scn file with the exact same name as your component. It must be placed in examples/Components and a subdirectory corresponding to its base class (forcefield, constraint, ...)

Graphic Documentation of a special Scene

To pop-up a small documentation of a scene, when loaded in Sofa, you need to create a .html file, with the same name as your .scn file. An example can be found for examples/Demos/chainHybridNoGroup.scn.