User-Defined Functions (UDFs)
You may change some of the inbuilt functionality of FilterDict with the help of user defined functions. FilterDict UDFs are written in C++. Five different types of user defined functions (UDF) are possible in FilterDict:
UDFs available in FilterDict
|
- Particle Motion UDF
Change the equations that describe the particle motion.
- Collision UDF
Define collision models in addition to the in-built models (Caught on First Touch, Sieving, and Hamaker)
- Pass Through UDF
Define alternative pass-through models that calculate the passing probability for particles passing through a porous voxel.
- User Data UDF
Attach additional data to a particle, that can be used and modified during the simulation. Use this UDF combination with one of the other UDF types.
- Electrostatic Decay UDF
Describe the decay of electrostatic charges with your own decay function.
- Particle Status Codes
Table of status codes used for particles.
|
During the first startup, GeoDict copies a number of sample UDFs into the user’s directory at:
- /home/username/.geodict2026/UDF/ (Linux)
- C:\Users\username\GeoDict2026\UDF\ (Windows)
GeoDict does not compile the source code (*.cpp) automatically. Therefore, you must compile the UDF before using it in GeoDict as described below.
Compilation in Linux
The simplest way to work with UDFs is as follows:
- change into the UDF directory with:
cd ./geodict2026/UDF
- copy one of the exemplary files. For example:
cp ParticleMotionUDF-Standard.cpp MyParticleUDF.cpp
- open MyParticleUDF.cpp in a text editor of your choice (emacs, kwrite, vi…).
The code must be compiled after making all needed changes. For this, the compile.sh script can be used:
./compile.sh MyParticleUDF.cpp
This script creates the runtime library MyParticleUDF.so, that can be used by GeoDict.
|
Compilation in Microsoft Windows
To compile the UDF files delivered with GeoDict, open FilterDictUDF.sln with Visual Studio 2013 (or later) and build the solution.
Alternatively, you can run compilex.bat from the Visual Studio command prompt (x64). This creates three runtime library files that can be used in FilterDict: UDFUserData.dll, CollisionUDF-Count.dll, and CollisionUDF-Hamaker.dll.
To create additional UDFs, add them as additional projects to your solution. The simplest way to do that is to create a copy of an existing *.cpp and *.vcxproj file first. For example,
- Create MyParticleUDF.cpp as a copy of ParticleMotionUDF-Standard.cpp and MyParticleUDF.vcxproj as a copy of ParticleMotionUDF-Standard.vcxproj.
- Open the FilterDictUDF.sln solution in Visual Studio.
- Add the existing project MyParticleUDF.vcxproj.
This project now still contains the old file UDFUserData.cpp. Therefore, remove this file from the project and, instead, add the existing item MyParticleUDF.cpp to the project. Then rebuild the project in Visual Studio or run compilex.bat to create the runtime library files.
|