--- myst: substitutions: bloc1: python: 1-5,15-59 cpp: 4-19,23-59,65 bloc2: python: 33,35-44 cpp: 40-43 bloc3: python: 46-55 cpp: 45-55 --- (use_cases_macro_relauncher_cint)= # Macro "**relauncherFunctionFlowrateCInt.{{extension}}**" ## Objective The goal of this macro is to show how to handle (in the most simple way) a C++-written function, compliant with the {{root}} (CINT) format. This function has been presented, at least its equation (see {eq}`flowrate_function`) and would be interfaced through the `TCIntEval` class in the {{Relaun}} module (which means that we'll use the function database from {{root}}'s catalog, see [](#overview_root_important_modif) for more explanations). As this class is usually considered not thread-safe, it can only be used with a `TSequentialRun` runner. (use_cases_macro_relauncher_cint_macro)= ## Macro {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherFunctionFlowrateCInt." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} The first part of the macro is the definition of the `flowrateModel` function, already discussed throughout this documentation. The dataserver object is then created and filled using the database file and pointers to the corresponding input attributes are created, along with the new attribute for the output provided by the function. The following part is then specific to the {{Relaun}} organisation: a `TCIntEval` object is created with the function as only argument. Both the input and output attributes are provided (here in a contracted way for input, but it could have been done one-by-one, as for output). {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherFunctionFlowrateCInt." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} ```{only} py The methods `setInputs` and `setOutputs` are not allowed in python, so attributes has to be added one-by-one. ``` The following part is the heart of the relauncher strategy: the assessor is provided to the chosen runner, which should always start the slaves (even in the case of a sequential one like here). On the main CPU, the master is created as well (with the dataserver and the runner) and the resolution is requested. {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherFunctionFlowrateCInt." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc3[language] + "\n" + "```" }} Once this is done, the slaves are stopped and the results is displayed for cross-check in the following subsection. ## Graph {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/relauncher/use_cases/" + language + "/cint/relauncherFunctionFlowrateCInt.png\n" ":align: center\n" ":name: usecases_relauncherFunctionFlowrateCInt\n" + figure_scale + "\n" "\n" "Representation of the output as a function of the first input with a colZ option\n" "```" }}