Setting up the {feelpp} Environment

merge with 01-OutputDirectories.adoc and rewrite pending!

Minimal Example

Let’s begin with our first program using the {feelpp} framework. To start, you include the {feelpp} headers.

We use the C++ namespace to avoid Feel:: prefix before {feelpp} objects.

We initialize the environment variables through the {feelpp} Environment class, which can be found here.

Unresolved directive in 02-SettingUpEnvironment.adoc - include::../../../codes/02-environment.cpp[]

and the config file

Unresolved directive in 02-SettingUpEnvironment.adoc - include::../../../codes/02-environment.cfg[lines=2..3]

Adding options

We pass command line options using the Boost Program Options, library using the prefix po:: which is a {feelpp} alias for the Boost::program_options namespace. To add a new {feelpp} option, we must create a new {feelpp} options_description. You must add the default {feelpp} options and the new one that we choose here as a double value. Note that the default value will be assigned if not specified by the user.

Compilation execution and logs

To compile a tutorial, just use the GNU make command.

make feelpp_tut_<appname>

where <appname> is the name of the application you wish to compile (here, myapp). Go to the execution directory as specified in the program, and execute it.You can list the log files created :

ls /tmp/<your login>/feelpp/feelpp_tut_myapp/

If you open one of these log, you should be able to see your value and the processor number used to compute. You can run your application on several processors using MPI :

mpirun -np 2 feelpp_tut_myapp

Note that there will be one log for each processor in that case.

Config files

A config file can be parsed to the program to profile your options. The default config paths are,

  • current dir

  • $HOME/Feelpp/config/

  • $INSTALL_PREFIX/share/Feelpp/config/

then you have to write inside one of these folders a file called <app_name>.cfg or feelpp_<app_name>.cfg. For example, our myapp.cfg would look like :


Note that you can specify the config file through the option --config-file=<path>

It’s also possible to give several configuration files with the option --config-files <path1> <path2> <path3>

./feelpp_tut_myapp --config-files ex1.cfg ex2.cfg ex3.cfg

In the case where some options are duplicated in the files, the priority is given at the end :

  • ex3.cfg can overwrite options in ex2.cfg and ex1.cfg

  • ex2.cfg can overwrite options in ex1.cfg

All files in --config-files can overwrite options given by --config-file. And all options in the command line can overwrite all options given in cfg files.

Initializing PETSc, SLEPc and other third party libraries

PETSc is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations. It employs the MPI standard for parallelism.

{feelpp} supports the PETSc framework, the Environment takes care of initializing the associated PETSc environment.