Feel++

Using Feel++

Step 1 : Configure your project with Feel++

In order to configure your project to use Feel++, you will have to use CMake and add a CMakeLists.txt file in the root directory of your sources.
To detect your Feel++ installation and configure your application you can use the following template file:

cmake_minimum_required(VERSION 2.8)

# This will check for the installed Feel++ library
# If you did not install it in a standard system path,
# you need to specify the FEELPP_DIR variable to the root
# of your installation directory or add the path of your
# installation in the PATHS section
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} )
    find_package(Feel++
        PATHS $ENV{FEELPP_DIR}/share/feel/cmake/modules
            /usr/share/feel/cmake/modules
            /usr/local/share/feel/cmake/modules
            /opt/share/feel/cmake/modules
    )
    if(NOT FEELPP_FOUND)
        message(FATAL_ERROR "Feel++ was not found on your system. Make sure to install it and specify the FEELPP_DIR to reference the installation directory.")
    endif()
endif()

# Then you can add your application and the associated hpp, cpp, geo, msh and cfg files
feelpp_add_application(
 applicationName
  SRCS file.cpp file1.hpp file2.hpp
  GEO geoFile1 geoFile2
  DEFS A_DEF=2
  CFG cfgFile1.cfg cfgFile2.cfg )

Step 2 : Build your project with Feel++

There are two ways that you can configure your project to use Feel++:

  • You can use the research directory located in Feel++ sources,

  • You can install Feel++ and use it as an external library for your project.

Using the research directory

  1. Create a file named README.md or README.adoc in your source directory.

  2. Move your source directory in feelpp/research

  3. (Re-)run the cmake process with -DFEELPP_ENABLE_RESEARCH_<directory>=ON (everything in uppercase)

  4. Compile everything (cd build/research/project; make feelpp_my_personal_app)

Using an installation of Feel++

If you already installed Feel++ either through your package manager or with a manual installation, then you can directly compile your project.

Create a separate build directory (to keep your code separate from build data) and configure your application:

# Create a build directory
mkdir -p /path/to/build/directory
cd /path/to/build/directory

# If you installed Feel++ in a directory referenced in the CMakeLists.txt
# previsouly described, then you have nothing to add

# Otherwise you should either set the FEELPP_DIR or CMAKE_PREFIX_PATH environment variable.
# For example, if you manually installed Feel++ to <install_dir>, either set:
# - CMAKE_PREFIX_PATH to <install_dir>/share/feel/cmake/modules/
# or
# - FEELPP_DIR to <install_dir>

# Configure your project
cmake /path/to/source/directory \
 -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
 -DCMAKE_C_COMPILER=/usr/bin/clang \
 -DCMAKE_BUILD_TYPE=RelWithDebInfo

Compile your project

Eventually, you can build your application:

# Build your project, you can use concurrent jobs by
# adding the -j flag, this will reduce the compilation time
make -j 2 feelpp_applicationName
cd ./where/is/my/app
./feelpp_applicationName