Logo
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ on Travis-CI Feel++ on Twitter Feel++ on YouTube Feel++ community
 All Classes Files Functions Variables Typedefs Pages
Setting up the Feel++ Environment

See section Programming Environment for more information about Feel++ installation.

Minimal Example

Let's begin with our first program using the Feel++ framework (source: doc/manual/tutorial/myapp.cpp). Before all, you have to include the Feel++ headers.

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

#include <feel/feelcore/environment.hpp>
int main( int argc, char* argv[] )
{
using namespace Feel;
Environment env( _argc=argc, _argv=argv,
_about=about( _name="myapp",
_author="Feel++ Consortium",
_email="feelpp-devel@feelpp.org") );
std::cout << "proc " << Environment::rank()
<<" of "<< Environment::numberOfProcessors()
<< std::endl;
}

We initialize the environment variables through the Feel++ Environment class.

top


Adding options

#include <feel/feelcore/environment.hpp>
int main( int argc, char* argv[] )
{
using namespace Feel;
po::options_description app_options( "MyApp options" );
app_options.add_options()
( "value",
po::value<double>() -> default_value(4.2),
"a 'double' with default value" );
Environment env( _argc=argc, _argv=argv,
_desc=app_options,
_about=about( _name="myapp",
_author="Feel++ Consortium",
_email="feelpp-devel@feelpp.org") );
std::cout << "proc " << Environment::rank()
<<" of "<< Environment::numberOfProcessors()
<< std::endl;
}
  • We pass command line options using the Boost Program Options, library using the prefix po:: which is a Feel++ alias for the Boost::program_options namespace. To add a new Feel++ option, we must create a new

Feel++ options_description. You must add the default Feel++ 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.

top


Compilation, execution, logs

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

  make feelpp_doc_<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 change your option value.

  ./feelpp_doc_myapp [--value 6.6]

You can list the log files created.

  ls /tmp/<your login>/feelpp_doc_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_doc_myapp

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

top


Config files

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

  • current dir
  • $HOME/feel/config/
  • $INSTALL_PREFIX/share/feel/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 looks like,

value=0.53

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

top


Initializing PETSc and Trilinos

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.

Feel++ supports the PETSc framework, the Environment takes care of initializing the associated PETSc environment.

top