Feel++  0.91.4
Creating applications

Application and Options

As a Feel user, the first step in order to use Feel is to create an application. First we include the Application header file, feel/feelcore/application.hpp and the header which the internal Feel options. Feel uses the boost::program_options ( see Boost Program Options ) library from Boost to handle its command line options

Next to ease the programming and reading, we use the using C++ directive to bring the namespace Feel to the current namespace

  using namespace Feel;

Then we define the command line options that the applications will provide. Note that on the return line, we incorporate the options defined internally in Feel.

In the example, we provide the options dt which takes an argument, a double and its default value is 1 if the options is not set by the command line.

Then we describe the application by defining a class AboutData which will be typically used by the help command line options to describe the application

Now we turn to the class MyApp itself: it derives from Feel::Application. Two constructors take argc, argv and the AboutData as well as possibly the description of the command line options Feel::po::option_description.

The class MyApp must redefine the run() member function. It is defined as a pure virtual function in Application.

The implementation of the constructors is usually simple, we pass the arguments to the super class Application that will analyze them and subsequently provide them with a Feel::po::variable_map data structure which operates like a map. Have a look at the document boost::program_options for further details.

The MyApp::run() member function holds the application commands/statements. Here we provide the smallest code unit: we print the description of the application if the --help command line options is set.

Finally the main() function can be implemented. We pass the results of the makeAbout() and makeOptions() to the constructor of MyApp as well as argc and argv. Then we call the MyApp::run() member function to execute the application.

Here is the full code

The next step is to compile it and execute it

make feel_doc_myapp
./feel_doc_myapp

The output should be

Application, Logging and Archiving

Feel provides some basic logging and archiving support: using the Application::changeRepository member functions of the class Application, the logfile and results of the application will be stored in a subdirectory of ~/feel. For example the following code

will create the directory ~/feel/myapp and will store the logfile and any files created after calling changeRepository. Refer to the documentation of Boost::format of further details about the arguments to be passed to Application::changeRepository. The logfile is named ~/feel/myapp/myapp-1.0. The name of the logfile is built using the application name, here myapp, the number of processes, here 1 and the id of the current process, here 0.

Parallel Application

Feel relies on MPI for parallel computations and the class Application initialises the MPI environment.

Initializing PETSc and Trilinos

Feel supports also the PETSc and Trilinos framework, the class takes care of initialize the associated environments.