FEDEM Solver  R8.0
Source code of the dynamics solver
Public Member Functions | Friends | List of all members
FFaUserFuncPlugin Class Reference

Singleton class for user-defined functions plugins. More...

#include <FFaUserFuncPlugin.H>

Inheritance diagram for FFaUserFuncPlugin:
Inheritance graph
[legend]
Collaboration diagram for FFaUserFuncPlugin:
Collaboration graph
[legend]

Public Member Functions

bool validate (const std::string &lib, int nchar=0, char *sign=NULL)
 Checks if the named library can be loaded as a plugin. More...
 
bool getSign (int nchar, char *sign) const
 Returns the signature string of the loaded plugin. More...
 
int getFuncs (int maxUF, int *funcId, bool silence=false) const
 Returns a list of function types defined in the plugin. More...
 
int getFuncName (int id, int nchar=0, char *name=NULL) const
 Returns a function type name. More...
 
int getParName (int id, int ipar=1, int nchar=0, char *name=NULL) const
 Returns a function parameter name for a given function type. More...
 
double getDefaultParVal (int id, int ipar) const
 Returns a default parameter value for a given function type. More...
 
const char ** getPixmap (int id) const
 Returns a pointer to a pixmap to display in the property panel. More...
 
int getFlag (int id) const
 Returns the function flag for a given function type, id. More...
 
double getValue (int bId, int fId, const double *params, double x, int &err) const
 Evaluates single-argument user-defined functions. More...
 
double getValue (int bId, int fId, const double *params, const double *args, int &err) const
 Evaluates multi-argument user-defined functions. More...
 
double getDiff (int bId, int fId, int ia, const double *params, const double *args, int &err) const
 Evaluates a derivative of multi-argument user-defined functions. More...
 
int wave (int bId, int fId, double d, double g, const double *params, const double *args, double &h, double *u, double *du) const
 Evaluates user-defined wave functions. More...
 
- Public Member Functions inherited from FFaDynamicLibraryBase
bool load (const std::string &libName, bool silence=false)
 Loads the library named libName. More...
 
bool unload (const std::string &libName, bool silence=false)
 Unloads the library named libName. More...
 
void unloadAll ()
 Unloads all libraries and clears the function cache. More...
 
bool areLibsLoaded () const
 Returns whether dynamics libraries have been loaded or not. More...
 
const char * getLibrary (size_t idx=1) const
 Returns the file name of the dynamic library, if loaded. More...
 

Friends

class FFaSingelton< FFaUserFuncPlugin >
 

Additional Inherited Members

- Static Public Member Functions inherited from FFaSingelton< FFaUserFuncPlugin >
static FFaUserFuncPlugininstance ()
 Returns the actual instance of this class. More...
 
static void removeInstance ()
 Deletes the dynamically allocated instance. More...
 
static bool allocated ()
 Returns true, if the instance has been allocated. More...
 
- Protected Types inherited from FFaDynamicLibraryBase
enum  LanguageBinding { Undefined , C , Fortran }
 Enums defining the supported language bindings. More...
 
- Protected Member Functions inherited from FFaDynamicLibraryBase
 FFaDynamicLibraryBase ()
 Default constructor. More...
 
virtual ~FFaDynamicLibraryBase ()
 The destructor unloads all dynamically loaded libraries. More...
 
DLPROC getProcAddr (const std::string &fName, bool silence=false) const
 Returns the function pointer for the named function. More...
 
DLPROC getProcAddr (const std::string &cName, const std::string &fName, LanguageBinding &lang, bool silence=false) const
 Returns the function pointer for the named function. More...
 
DLPROC getProcAddress (const std::string &fName, size_t procID) const
 Returns the function pointer for the given function. More...
 
DLPROC getProcAddress (const std::string &cName, const std::string &fName, LanguageBinding &lang, size_t procID) const
 Returns the function pointer for the given function. More...
 
- Protected Member Functions inherited from FFaSingelton< FFaUserFuncPlugin >
 FFaSingelton ()
 The constructor is protected to allow objects of sub-classes only. More...
 
 FFaSingelton (const FFaSingelton &)=delete
 Disable default copy constructor. More...
 
FFaSingeltonoperator= (const FFaSingelton &)=delete
 Disable default assignment operator. More...
 

Detailed Description

Singleton class for user-defined functions plugins.

Member Function Documentation

◆ getDefaultParVal()

double FFaUserFuncPlugin::getDefaultParVal ( int  id,
int  ipar 
) const

Returns a default parameter value for a given function type.

Parameters
[in]idUnique id identifying the function type
[in]iparFunction parameter index

◆ getDiff()

double FFaUserFuncPlugin::getDiff ( int  bId,
int  fId,
int  ia,
const double *  params,
const double *  args,
int &  err 
) const

Evaluates a derivative of multi-argument user-defined functions.

Parameters
[in]bIdBase id of the function instance
[in]fIdUnique id identifying the function type
[in]iaIndex of the argument of differentiate with respect to
[in]paramsArray of constant function parameters
[in]argsFunction arguments
[in]errError indicator

◆ getFlag()

int FFaUserFuncPlugin::getFlag ( int  id) const

Returns the function flag for a given function type, id.

This flag is used to trigger different handling of the user-defined function in the Fedem dynamics solver:
0 : No particular treatment, the function is evaluated only when needed
1 : (Pre)evaluate this function in the beginning of each increment
2 : Evaluate this function at the end og each time increment
4 : This is a user-defined wave function

◆ getFuncName()

int FFaUserFuncPlugin::getFuncName ( int  id,
int  nchar = 0,
char *  name = NULL 
) const

Returns a function type name.

Parameters
[in]idUnique id identifying the function type
[in]ncharMax length of the function type name
[out]nameThe function type name corresponding to id
Returns
Number of arguments for the function type

◆ getFuncs()

int FFaUserFuncPlugin::getFuncs ( int  maxUF,
int *  funcId,
bool  silence = false 
) const

Returns a list of function types defined in the plugin.

Parameters
[in]maxUFMax number of user-defined function types
[out]funcIdList of unique ids identifying each function type
[in]silenceIf true, suppress error messages
Returns
Number of different function types in the plugin

◆ getParName()

int FFaUserFuncPlugin::getParName ( int  id,
int  ipar = 1,
int  nchar = 0,
char *  name = NULL 
) const

Returns a function parameter name for a given function type.

Parameters
[in]idUnique id identifying the function type
[in]iparFunction parameter index
[in]ncharMax length of the function parameter name
[out]nameThe name of the parameter
Returns
Total number of parameters for this function type

◆ getPixmap()

const char ** FFaUserFuncPlugin::getPixmap ( int  id) const

Returns a pointer to a pixmap to display in the property panel.

◆ getSign()

bool FFaUserFuncPlugin::getSign ( int  nchar,
char *  sign 
) const

Returns the signature string of the loaded plugin.

Parameters
[in]ncharMax length of the signature string
[out]signA signature string describing the loaded plugin

◆ getValue() [1/2]

double FFaUserFuncPlugin::getValue ( int  bId,
int  fId,
const double *  params,
const double *  args,
int &  err 
) const

Evaluates multi-argument user-defined functions.

Parameters
[in]bIdBase id of the function instance
[in]fIdUnique id identifying the function type
[in]paramsArray of constant function parameters
[in]argsFunction arguments
[in]errError indicator

◆ getValue() [2/2]

double FFaUserFuncPlugin::getValue ( int  bId,
int  fId,
const double *  params,
double  x,
int &  err 
) const

Evaluates single-argument user-defined functions.

Parameters
[in]bIdBase id of the function instance
[in]fIdUnique id identifying the function type
[in]paramsArray of constant function parameters
[in]xFunction argument
[in]errError indicator

◆ validate()

bool FFaUserFuncPlugin::validate ( const std::string &  lib,
int  nchar = 0,
char *  sign = NULL 
)

Checks if the named library can be loaded as a plugin.

Parameters
[in]libFull path to the dynamic library
[in]ncharMax length of the signature string
[out]signA signature string describing the loaded plugin

This method is only used to detect whether the name shared object library lib is a plugin containing user-defined function types or not. The method returns true if that is the case, otherwise false.

Here is the call graph for this function:

◆ wave()

int FFaUserFuncPlugin::wave ( int  bId,
int  fId,
double  d,
double  g,
const double *  params,
const double *  args,
double &  h,
double *  u,
double *  du 
) const

Evaluates user-defined wave functions.

Parameters
[in]bIdBase id of the function instance
[in]fIdUnique id identifying the function type
[in]dWater depth
[in]gGravity constant
[in]paramsArray of constant function parameters
[in]argsFunction arguments
[out]hWave elevation
[out]uParticle velocity
[out]duParticle acceleration

Friends And Related Function Documentation

◆ FFaSingelton< FFaUserFuncPlugin >

friend class FFaSingelton< FFaUserFuncPlugin >
friend

The documentation for this class was generated from the following files: