Plug-ins and Interface Manager IFM   

Introduction

FEFLOW covers a broad range of functionality for porous-media flow and transport simulation, accessible via a comprehensive user interface.

Nevertheless there are cases in which extended user control over the internal processes in the software is desired and useful. Typical examples include data import from user-defined sources, coupled simulations with other soft­ware, extended interdependencies between parameters, specific physical processes, and user-specific output formats.

Many of these cases can be accommodated by the FEFLOW plug-in concept and its open programming interface controlled by the FEFLOW Interface Manager (IFM).

While the use of available plug-ins does not require any programming skills, the IFM also provides support for coding of own plug-ins by advanced modellers with some programming experience.

Plug-ins for Users

Plug-ins for FEFLOW typically come as a set of three files:

  • a *.dll (Windows) or *.so (Linux) file

  • a *.html file with a description

  •  a *.txt file with a copyright statement

For the plug-in functionality, only the first file is important. Plug-ins are auto­matically registered to FEFLOW when they are located in the modules32 (32-bit version of FEFLOW) or modules64 (64-bit version) folder in the FEFLOW installation directory.

The Plug-ins panel is used to manage the plug-ins. Additional plug-ins in other than the above described locations can be registered, and any regis­tered plug-in can be added to the current model. There is no limitation in the number of plug-ins in a model. Their execution order is based on the list order in the Plug-ins panel.

Some of the plug-ins have functionality that is invoked by clicking the Edit button in the panel or by choosing Activate from the context menu of the plug-in. Plug-ins with their own user interface typically bring up the interface when hitting the Edit button.

Plug-ins also have the ability to store their own data into the *.fem file. Thus data input to the plug-in can be saved with the model file.

When deactivating a plug-in the panel, it is no longer executed, but its data are kept. In contrast, removing the plug-in from the current model also removes its data from the FEFLOW model.

Technology

Plug-ins are compiled into Dynamic Link Libraries (DLL) on Windows operat­ing systems, and into Dynamic Shared Objects (DSO) on Linux. With these, it is possible to extend the capabilities of FEFLOW without modifying its source code. The Interface Manager (IFM) uses a technique based on jump-tables that are provided in source code, which supersedes the use of object code or libraries. The jump tables are internally implemented by FEFLOW, so that plug-ins have no external references to FEFLOW’s code or data. The plug-ins are thus largely shielded from changes within FEFLOW. In particular, they are not bound to a specific version of FEFLOW, making plug-in management independent from FEFLOW.

The set of API functions provided by the IFM ensures read and write access to nearly all parameters and settings in FEFLOW, along with functionality to influence the course of simulation runs.

IFM for Programmers

The backbone of the programming interface are the above-mentioned API functions together with callbacks, the possible entry points for plug-in code. Each of the callback functions is called at a specific point of FEFLOW’s inter­nal code sequence. For example, the PreTimeStep callback function is called immediately before a new time step of the simulation is started.

For each callback to be implemented by the plug-in, a separate C/C++ func­tion stub can be automatically generated. While C and C++ are the ’native’ languages for coding FEFLOW plug-ins, code in other programming lan­guages can also be included via mixed-language programming.

On Windows systems, Microsoft Visual Studio is often used for plug-in devel­opment, either as the commercial or as the free Express edition. To be able to develop plug-ins, the IFM Development Kit has to be installed as part of the FEFLOW installation. With this software development kit (SDK), a wizard for Microsoft Visual Studio is installed. This wizard provides a graphically sup­ported, efficient way to generate the frame code for a new FEFLOW plug-in project, including all required project and solution settings. The programmer ’only’ has to fill in the user-specific code and compile the plug-in. Even the registration of the plug-in to FEFLOW is done automatically during the compi­lation process.

Table of Contents

Index

Glossary

-Search-

Back