Manual for OpenFLUID 2.1.11 |
Class for easier binding with other programming languages.
Class for easier binding of OpenFLUID with other programming languages, such as Python, R, JavaScript, ... This class provides common methods to open datasets, add wares paths, modify parameters and attributes, run simulations and many more. All of these methods have parameters and return values in plain old types for better interoperability with other languages, excepted for internal data usually handled as "external pointers" in bindings.
To use this header-only class
Example
#include <utils/Binding.hpp>
Public Member Functions | |
int | writeDataset (const char *Path, bool WithOriginData=false) |
unsigned short int | runSimulation (int IsVerbose=false) |
void | printSimulationInfo () |
const char * | getSimulationOutputDir () |
int | getDefaultDeltaT () |
void | setDefaultDeltaT (int DeltaT) |
const char * | getPeriodBeginDate () |
const char * | getPeriodEndDate () |
void | setPeriod (const char *BeginDate, const char *EndDate) |
const char * | getSimulatorsIDs () |
const char * | getSimulatorParamNames (const char *SimID) |
const char * | getSimulatorParam (const char *SimID, const char *ParamName) |
void | setSimulatorParam (const char *SimID, const char *ParamName, const char *ParamVal) |
void | removeSimulatorParam (const char *SimID, const char *ParamName) |
const char * | getGeneratorParamNames (const char *UnitsClass, const char *VarName) |
const char * | getGeneratorParam (const char *UnitsClass, const char *VarName, const char *ParamName) |
void | setGeneratorParam (const char *UnitsClass, const char *VarName, const char *ParamName, const char *ParamVal) |
const char * | getGeneratorsVarNames (const char *UnitsClass) |
const char * | getModelGlobalParamNames () |
const char * | getModelGlobalParam (const char *ParamName) |
void | setModelGlobalParam (const char *ParamName, const char *ParamVal) |
void | removeModelGlobalParam (const char *ParamName) |
const char * | getObserversIDs () |
const char * | getObserverParamNames (const char *ObsID) |
const char * | getObserverParam (const char *ObsID, const char *ParamName) |
void | setObserverParam (const char *ObsID, const char *ParamName, const char *ParamVal) |
void | removeObserverParam (const char *ObsID, const char *ParamName) |
char ** | getUnitsClasses () |
unsigned int | getUnitsClassesCount () |
int * | getUnitsIDs (const char *UnitsClass) |
unsigned int | getUnitsIDsCount (const char *UnitsClass) |
const char * | getAttributesNames (const char *UnitsClass) |
void | createAttribute (const char *UnitsClass, const char *AttrName, const char *AttrVal) |
const char * | getAttribute (const char *UnitsClass, int UnitID, const char *AttrName) |
void | setAttribute (const char *UnitsClass, int UnitID, const char *AttrName, const char *AttrVal) |
void | removeAttribute (const char *UnitsClass, const char *AttrName) |
void | addVariablesExportAsCSV (const char *BindingName, const char *UnitsClass, const char *UnitsIDs, const char *VarName, int Precision) |
Static Public Member Functions | |
static void | init () |
static Binding * | make () |
static void | destroy (Binding *B) |
static const char * | getVersion () |
static const char * | getLastError () |
static void | addExtraSimulatorsPaths (const char *Paths) |
static void | resetExtraSimulatorsPaths () |
static unsigned int | getSimulatorsPathsCount () |
static char ** | getSimulatorsPaths () |
static unsigned int | getExtraSimulatorsPathsCount () |
static char ** | getExtraSimulatorsPaths () |
static void | addExtraObserversPaths (const char *Paths) |
static void | resetExtraObserversPaths () |
static unsigned int | getObserversPathsCount () |
static char ** | getObserversPaths () |
static unsigned int | getExtraObserversPathsCount () |
static char ** | getExtraObserversPaths () |
static void | setCurrentOutputDir (const char *Path) |
static Binding * | openDataset (const char *Path) |
static Binding * | openProject (const char *Path) |
|
inlinestatic |
Add supplementary paths to search for observers when running simulations
[in] | Paths | the paths to add using the path separator used on the current system |
|
inlinestatic |
Add supplementary paths to search for simulators when running simulations
[in] | Paths | The paths to add using the path separator used on the current system |
|
inline |
Adds simulation variable to be automatically exported using CSV format.
[in] | BindingName | The name used as an identifier in output files names |
[in] | UnitsClass | The name of the spatial units class |
[in] | UnitsIDs | The semicolon separated list of spatial units IDs, can be '*' for all spatial units |
[in] | VarName | The name of the variable |
[in] | Precision | The floating precision to use for floating point representation, default precision is used if this parameter is less or equal to 0 |
|
inline |
Creates an attribute for all spatial units of a given class, with a default value for this attribute.
[in] | UnitsClass | The spatial units class |
[in] | AttrName | The name of the attribute |
[in] | AttrVal | The default value for this attribute |
|
inlinestatic |
Deletes a given instance
[in] | B | The instance to delete |
|
inline |
Returns the value of an attribute of a spatial unit.
[in] | UnitsClass | The spatial units class |
[in] | UnitID | The spatial unit ID |
[in] | AttrName | The name of the attribute |
|
inline |
Returns the list of the attributes names for a given spatial units class, as a semicolon separated list.
[in] | UnitsClass | The units class |
|
inline |
Returns the default delta T for the current simulation
|
inlinestatic |
Returns the supplementary paths to search for observers
|
inlinestatic |
Returns the number of supplementary paths to search for observers
|
inlinestatic |
Returns the supplementary paths to search for simulators
|
inlinestatic |
Returns the number of supplementary paths to search for simulators
|
inline |
Returns the value of a given generator parameter, an empty string if not found.
[in] | UnitsClass | The name of the spatial units class |
[in] | VarName | The name of the generated variable |
[in] | ParamName | The name of the parameter |
|
inline |
Returns the list of the parameters names for a given generator, as a semicolon separated list.
[in] | UnitsClass | The name of the spatial units class |
[in] | VarName | The name of the generated variable |
|
inline |
Returns the list of the variables produced by generators on a given spatial units class, as a semicolon separated list.
[in] | UnitsClass | The spatial units class |
|
inlinestatic |
Returns the last error message
|
inline |
Returns the value of a given global parameter for the current model.
[in] | ParamName | The name of the parameter |
|
inline |
Returns the list of the global parameters for the current model, as a semicolon separated list.
|
inline |
Returns the value of a given observer parameter, an empty string if not found.
[in] | ObsID | The ID of the observer |
[in] | ParamName | The name of the parameter |
|
inline |
Returns the list of the parameters names for a given observer, as a semicolon separated list.
[in] | ObsID | The ID of the observer |
|
inline |
Returns the IDs list of the observers used in the current model, as a semicolon separated list.
|
inlinestatic |
Returns the default paths to search for observers
|
inlinestatic |
Returns the number of default paths to search for observers
|
inline |
Returns the begin date for the simulation period, as an ISO date-time string (with a space instead of a T letter, e.g. : 2008-01-02 11:13:00)
|
inline |
Returns the end date for the simulation period, as an ISO date-time string (with a space instead of a T letter, e.g. : 2011-08-06 15:00:00)
|
inline |
Returns the simulation output directory
|
inline |
Returns the value of a given simulator parameter, an empty string if not found.
[in] | SimID | The ID of the simulator |
[in] | ParamName | The name of the parameter |
|
inline |
Returns the list of the parameters names for a given simulator, as a semicolon separated list.
[in] | SimID | The ID of the simulator |
|
inline |
Returns the IDs list of the simulators used in the current model, as a semicolon separated list.
|
inlinestatic |
Returns the default paths to search for simulators
|
inlinestatic |
Returns the number of default paths to search for simulators
|
inline |
Returns the spatial units classes names as a list of strings.
|
inline |
Returns the number of spatial units classes names.
|
inline |
Returns the spatial units IDs for a given spatial units class, as a list of integers.
|
inline |
Returns the number of spatial units IDs for a given spatial units class.
|
inlinestatic |
Returns the OpenFLUID version
|
inlinestatic |
Static initialization of the binding. Muste be called at least once.
|
inlinestatic |
Returns a new instance
|
inlinestatic |
Opens an OpenFLUID dataset given by its path
[in] | Path | The path to the dataset |
|
inlinestatic |
Opens an OpenFLUID project given by its path
[in] | Path | The path to the project |
|
inline |
Prints informations about simulation configuration (spatial domain, processes model, ...)
|
inline |
Removes an attribute for all spatial units of a given class.
[in] | UnitsClass | The spatial units class |
[in] | AttrName | The name of the attribute |
|
inline |
Removes a given global parameter for the current model.
[in] | ParamName | The name of the parameter |
|
inline |
Removes a given observer parameter.
[in] | ObsID | The ID of the observer |
[in] | ParamName | The name of the parameter |
|
inline |
Removes a given simulator parameter.
[in] | SimID | The ID of the simulator |
[in] | ParamName | The name of the parameter |
|
inlinestatic |
Resets the list of supplementary paths to search for observers
|
inlinestatic |
Resets the list of supplementary paths to search for simulators
|
inline |
Runs a simulation based on the current configuration for simulation.
[in] | IsVerbose | Set to true to enable verbosity (false by default). |
|
inline |
Sets an attribute value for a given spatial unit.
[in] | UnitsClass | The spatial units class |
[in] | UnitID | The spatial unit ID |
[in] | AttrName | The name of the attribute |
[in] | AttrVal | The new value for this attribute |
|
inlinestatic |
Sets the current output path used by default
[in] | Path | The output path to use |
|
inline |
Sets the default delta T for the current simulation
[in] | DeltaT | The delta T to set |
|
inline |
Sets the value for a given generator parameter, an empty string if not found.
[in] | UnitsClass | The name of the spatial units class |
[in] | VarName | The name of the generated variable |
[in] | ParamName | The name of the parameter |
[in] | ParamVal | The new value for the parameter |
|
inline |
Sets the value of a given global parameter for the current model.
[in] | ParamName | The name of the parameter |
[in] | ParamVal | The new value for the parameter |
|
inline |
Sets the value of a given observer parameter.
[in] | ObsID | The ID of the observer |
[in] | ParamName | The name of the parameter |
[in] | ParamVal | The new value for the parameter |
|
inline |
Sets the simulation period with begin and end dates. The dates are given as ISO date-time strings (with a space instead of a T letter, e.g. : 2008-01-02 11:13:00, 2011-08-06 15:00:00)
[in] | BeginDate | The begin date as a string |
[in] | EndDate | The end date as a string |
|
inline |
Sets the value of a given simulator parameter.
[in] | SimID | The ID of the simulator |
[in] | ParamName | The name of the parameter |
[in] | ParamVal | The new value for the parameter |
|
inline |
Writes an OpenFLUID dataset to disk, optionaly with copy of external data from the original dataset
[in] | Path | The path to the dataset to write |
[in] | WithOriginData | optional parameter to enable the copy of external data from the original dataset. Default is false |