You are here: Home Documentation How-To LifeV and Eclipse Developing LifeV inside Eclipse

Developing LifeV inside Eclipse

Make sure you have a working environment before starting this tutorial (see here and here).

Set up the Eclipse indexer

You will need to set up the indexer in order to allow Eclipse to correctly navigate through your LifeV source tree. Right-click the project in the Project Explorer tab and choose Properties.

Eclipse indexer: discovery set upThe C/C++ Build --> Discovery Options tab shows you how Eclipse finds the path of the included code in each compilation unit. Automate discovery of paths and symbols means that Eclipse tries to locate the inclusion paths by analyzing the output of the make command (which indeed usually provides a lot of information, starting from the flags passed to the compiler). Leaving this option enabled should be good enough in most cases.

In other cases, you may want to specify the paths of the included code, for instance when you are working with different versions of some libraries (say, you have both Trilinos 8 and Trilinos 9 installed on your computer). In that case, the indexer may fail in tracking the correct path of the headers, unless you specify the include paths.

 Eclipse project indexer pathsThe C/C++ General --> Paths and Symbols tab lets you list the paths in which you want the indexer to look for header files.

The Editor and the Outline tool

Once the indexer is trained, your source file behaves like a hyper-text, with anchors and external links to the included headers. Try to open a file in the library and play with the Text Editor (at the center of the screen) and the Outline tab (in the right-hand side of the screen).

 Eclipse: outline of the source codeYou can navigate inside the source file by single-clicking an object in the Outline tab; you can open the included headers in the Text Editor by double-clicking the corresponding entries in the outline tab or by CTRL-clicking the corresponding #include directive in the Text Editor.

You can open declarations of the variables by highlighting them, right-clicking and choosing Open Declaration from the pop-up menu. A shortcut for this operation is highlighting the variable name and pressing F3; or simply CTRL-clicking the variable name.

Amongst many other things, you can comment/uncomment code lines by simply highlighting them, right-clicking them and Source --> Comment/Uncomment them.

Try to play with all these tools and be comfortable with them. They help a lot in managing a large and complex code like LifeV.

Notes about code formatting

The Text Editor has a code formatter able to automatically set up indentation on selected code regions.

Please, don't apply Eclipse default formatting style to the code you are editing.

LifeV source code was written in a distributed environment, following specific Coding Standards, to which the Eclipse default formatting style does not conform exactly.

The point is, there's no need to reformat the whole code each time you work on it. Simply plug in your corrections / add-ons following the pre-existing format. In most cases, Eclipse Text Editor will suggest the correct choice while you're typing (e. g. the indentation of a new line will be in most of the cases compatible with the pre-existing code).

If you're starting a new application, and committing brand new files, you should make sure that your code follows the LifeV Coding Standards.

 

Document Actions
« September 2010 »
September
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
27282930