Skip to main content

SoS C API of FMOPSolver library 2023 R2

sos_capi_common.h File Reference

Last update: 16.07.2025

C-API for utility functions (load/unload library, license management, error handling) More...

Go to the source code of this file.

Enumerations

Public type definitions

Pubic type definitions used within this API

enum  fmop_error_t {
  fmop_success = 0 , fmop_invalid_handle = 1 , fmop_exception_occurred = 2 , fmop_settings_error = 3 ,
  fmop_model_missing = 4 , fmop_license_error = 5 , fmop_script_error = 6 , fmop_script_no_object = 7 ,
  fmop_script_wrong_type = 8 , fmop_not_implemented = 16382 , fmop_const_max = 16383
}
 Error code definitions. More...
 
enum  fmop_license_t { fmop_mesh_signal = 10 , fmop_mesh_all = 30 }
 FMOP mesh features which need to be unlocked by a valid license. More...
 
enum  fmop_dataobject_types { fmop_node_data = 0 , fmop_element_data = 1 , fmop_scalar_data = 3 }
 Data type definitions. More...
 

Functions

License handling

API handling licenes requests

DYNARDO_FMOP_API fmop_error_t FMOP_appendLicenseSearchPath (const char *abs_path)
 Appends another license search path to the default ones. More...
 
DYNARDO_FMOP_API fmop_error_t FMOP_acquireLicense ()
 Acquires an optiSLang enterprise license. More...
 
DYNARDO_FMOP_API bool FMOP_licenseLocked ()
 Check whether any license feature was acquired. More...
 
DYNARDO_FMOP_API fmop_error_t FMOP_releaseLicense ()
 Release the acquired license. More...
 
Error Handling

API to access and interpret recent data object error messages

DYNARDO_FMOP_API const char * FMOP_getLastErrorString ()
 Returns internal log messages of level warning and above. More...
 
DYNARDO_FMOP_API fmop_error_t FMOP_getLastErrno ()
 Returns the error number which has been set at the last library call. More...
 
DYNARDO_FMOP_API const char * FMOP_getLastErrnoString ()
 Returns a pointer to a string that describes the error code which has been set at the last library call. More...
 
DYNARDO_FMOP_API const char * FMOP_getLastLogString ()
 Returns internal log messages of log levels defined by FMOP_setLogLevel. Serves as debug logger. More...
 
DYNARDO_FMOP_API int FMOP_setLogLevel (int log_level)
 Defines the new log level filter. Valid for all subsequent library calls until a new log level gets set. More...
 
DYNARDO_FMOP_API const char * FMOP_getErrnoString (fmop_error_t error_num)
 Returns a string description for the error number given. More...
 
Miscellaneous
DYNARDO_FMOP_API const char * FMOP_getVersionString ()
 Returns a version string. More...
 
FMOP library handling
DYNARDO_FMOP_API fmop_error_t FMOP_initializeLibrary ()
 Initialize the FMOP library Allocates memory for the global script engine. Call FMOP_unloadLibrary() to release it. A warning is logged if the library was initialized already. More...
 
DYNARDO_FMOP_API fmop_error_t FMOP_unloadLibrary ()
 Unload the FMOP library Clears the FMOP library from memory. A warning is logged if the library was unloaded already.
 

Detailed Description

C-API for utility functions (load/unload library, license management, error handling)

Enumeration Type Documentation

◆ fmop_dataobject_types

Data type definitions.

Enumerator
fmop_node_data 

node data (one scalar per node)

fmop_element_data 

element data (one scalar per element)

fmop_scalar_data 

scalar data (vector of size 1)

◆ fmop_error_t

Error code definitions.

Enumerator
fmop_success 

Function execution returned successfully.

fmop_invalid_handle 

The function got an unexpected NULL pointer.

fmop_exception_occurred 

An internal error occurred. Request log messages.

fmop_settings_error 

Input argument(s) is invalid or missing.

fmop_model_missing 

The requested model identifier is not known.

fmop_license_error 

No valid license available.

fmop_script_error 

An error appeare while executing Lua script.

fmop_script_no_object 

Object with ident not found in script engine.

fmop_script_wrong_type 

Object with ident has wrong type.

fmop_not_implemented 

This function is yet not implemented or has been removed.

fmop_const_max 

2^14-1 non-modifiable for each API version

◆ fmop_license_t

FMOP mesh features which need to be unlocked by a valid license.

Enumerator
fmop_mesh_signal 

Unlocks signal meshes.

fmop_mesh_all 

Unlocks all mesh features.

Function Documentation

◆ FMOP_acquireLicense()

DYNARDO_FMOP_API fmop_error_t FMOP_acquireLicense ( )

Acquires an optiSLang enterprise license.

Returns
Call FMOP_getErrnoString() to get a human readable representation

◆ FMOP_appendLicenseSearchPath()

DYNARDO_FMOP_API fmop_error_t FMOP_appendLicenseSearchPath ( const char *  abs_path)

Appends another license search path to the default ones.

Deprecated:

By default the following license search paths will be checked in the order given:

  • @localhost
  • the current working directory
  • the path pointed to by the environment variable 'LM_LICENSE_FILE'
  • the path pointed to by the environment variable 'DYNARDO_LICENSE_FILE'
Parameters
[in]abs_pathAn absolute file system path, e.g. '/opt/DYNARDO/licensing', 'D:\Licenses', ...
Returns
Call FMOP_getErrnoString() to get a human readable representation

◆ FMOP_getErrnoString()

DYNARDO_FMOP_API const char* FMOP_getErrnoString ( fmop_error_t  error_num)

Returns a string description for the error number given.

Parameters
[in]error_numThe error number
Returns
A human readable string description for the error number given.The returned string will be overwritten by this function at the next call and will be destroyed on program termination
Note
Calling this function will neither manipulate the internal log message stack nor the errno state of the last library call
DON'T USE ERRNO as agrument identifier as this seems to be defined as a macro identifier Refer to http://www.cplusplus.com/reference/cerrno/errno/ for details

◆ FMOP_getLastErrno()

DYNARDO_FMOP_API fmop_error_t FMOP_getLastErrno ( )

Returns the error number which has been set at the last library call.

Returns
The error number which has been set at the last library call

◆ FMOP_getLastErrnoString()

DYNARDO_FMOP_API const char* FMOP_getLastErrnoString ( )

Returns a pointer to a string that describes the error code which has been set at the last library call.

Returns
A human readable string description for the error code that has been set at the last library call. The returned string will be overwritten by this function at the next call and will be destroyed on program termination
Note
Calling this function will neither manipulate the internal log message stack nor the errno state of the last library call

◆ FMOP_getLastErrorString()

DYNARDO_FMOP_API const char* FMOP_getLastErrorString ( )

Returns internal log messages of level warning and above.

This log level is immutable. FMOP_setLogLevel() can not modify it. If the internal logger is empty, the value of FMOP_getLastErrnoString() will be returned

Returns
Returns all internal, formatted log messages of log level warning and above if either a warning or an error message occured during the last library call. Otherwise the return value of FMOP_getLastErrnoString() will be returned. The returned string will be overwritten by this function at its next call and will be destroyed on program termination
Note
Calling this function will neither manipulate the internal log message stack nor the errno state of the last library call

◆ FMOP_getLastLogString()

DYNARDO_FMOP_API const char* FMOP_getLastLogString ( )

Returns internal log messages of log levels defined by FMOP_setLogLevel. Serves as debug logger.

Initially all log levels are deactivated and no log messages will be buffered. Call FMOP_setLogLevel ( >0 ) to activate the logger and FMOP_setLogLevel (0) to deactivate it again.

Returns
Returns all internal, formatted log messages of the last library call. The returned string will be overwritten by this function at the next call and will be destroyed on program termination
Note
Calling this function will not manipulate the internal log message stack. Though the errno number will be set and can be queried calling FMOP_getLastErrno()

◆ FMOP_getVersionString()

DYNARDO_FMOP_API const char* FMOP_getVersionString ( )

Returns a version string.

Returns
A const pointer to a character array holding the version string. Ownership is handled internally.
Note
Calling this function will not manipulate the internal log message stack. Though the errno number will be set and can be queried calling FMOP_getLastErrno()

◆ FMOP_initializeLibrary()

DYNARDO_FMOP_API fmop_error_t FMOP_initializeLibrary ( )

Initialize the FMOP library Allocates memory for the global script engine. Call FMOP_unloadLibrary() to release it. A warning is logged if the library was initialized already.

Note
This method must be called once, before requesting the global script engine with FMOP_globalScriptEngine();

◆ FMOP_licenseLocked()

DYNARDO_FMOP_API bool FMOP_licenseLocked ( )

Check whether any license feature was acquired.

Returns
True if any license feature is locked, false otherwise

◆ FMOP_releaseLicense()

DYNARDO_FMOP_API fmop_error_t FMOP_releaseLicense ( )

Release the acquired license.

Note, that no previously acquired license is released if not all loaded Database and FMOP objects are already released

Returns
Call FMOP_getErrnoString() to get a human readable representation

◆ FMOP_setLogLevel()

DYNARDO_FMOP_API int FMOP_setLogLevel ( int  log_level)

Defines the new log level filter. Valid for all subsequent library calls until a new log level gets set.

Parameters
[in]log_levelDefines the new log level filter for messages returned by FMOP_getLastLog. Accepts the following integer values only:
  • 0 ... filter all log levels
  • 1 ... return only log messages of log level ERROR
  • 2 ... return only log messages of log level WARNING and below
  • 3 ... return only log messages of log level INFO and below
  • 4 ... return only log messages of log level DEBUG and below
  • 5 ... return all log messages, i.e. ERROR, WARNING INFO, DEBUG, TRACE. The log level TRACE is not existing in maintenance, i.e. in customer builds.
Returns
The former log level or -1 if the log_level is unknown
Note
Calling this function will not manipulate the internal log message stack. Though the errno number will be set and can be queried calling FMOP_getLastErrno()

Connect with Ansys