9.2
general documentation
cs_notebook.h
Go to the documentation of this file.
1#ifndef CS_NOTEBOOK_H
2#define CS_NOTEBOOK_H
3
4/*============================================================================
5 * Notebook management.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------
29 * Local headers
30 *----------------------------------------------------------------------------*/
31
32#include "base/cs_defs.h"
33
34/*----------------------------------------------------------------------------*/
35/*
36 * \brief Initialize the notebook object (based on cs_tree_node_t).
37 */
38/*----------------------------------------------------------------------------*/
39
40void
42
43/*----------------------------------------------------------------------------*/
44/*
45 * \brief Check if a parameter value is present.
46 *
47 * \param[in] name name of the parameter
48 * \param[out] editable 1 if the value is editable, 0 otherwise (optional)
49 *
50 * \return 0 if not present, 1 if present
51 */
52/*----------------------------------------------------------------------------*/
53
54int
56 int *editable);
57
58/*----------------------------------------------------------------------------*/
59/*
60 * \brief Return a parameter value (real).
61 *
62 * The name used is the same as the one in the GUI.
63 *
64 * \param[in] name name of the parameter
65 *
66 * \return value of the given parameter
67 */
68/*----------------------------------------------------------------------------*/
69
72
73/*----------------------------------------------------------------------------*/
74/*
75 * \brief Set a parameter value (real) for an editable parameter.
76 *
77 * The name used is the same as the one in the GUI.
78 *
79 * \param[in] name name of the parameter
80 * \param[in] val value of the parameter
81 */
82/*----------------------------------------------------------------------------*/
83
84void
85cs_notebook_parameter_set_value(const char *name,
86 cs_real_t val);
87
88/*----------------------------------------------------------------------------*/
89/*
90 * \brief Indicate whether the parameter is used for a study with openturns.
91 *
92 * Returns an int flag to indicate whether this paramter is used for an
93 * OpenTurns study.
94 * -1 : The parameter is not used with OpenTurns
95 * 0 : The parameter is used as an input from OpenTurns
96 * 1 : The parameter is used as an output to OpenTurns
97 *
98 * \param[in] name name of the parameter
99 *
100 * \return an int flag value
101 */
102/*----------------------------------------------------------------------------*/
103
104int
106
107/*----------------------------------------------------------------------------*/
108/*
109 * \brief Returns the description of the parameter (GUI defined).
110 *
111 * \param[in] name name of the parameter
112 *
113 * \return a const char pointer containing the description.
114 */
115/*----------------------------------------------------------------------------*/
116
117const char *
119
120/*----------------------------------------------------------------------------*/
121/*
122 * \brief Get id associated with a notebook parameter.
123 *
124 * \param[in] name name of the parameter
125 *
126 * \return -1 if not present, id if present
127 */
128/*----------------------------------------------------------------------------*/
129
130int
131cs_notebook_parameter_get_id(const char *name);
132
133/*----------------------------------------------------------------------------*/
134/*
135 * \brief Get a group of notebook variable values
136 *
137 * \param[in] n number of notebook variables to query
138 * \param[in] ids ids of notebook variables to query
139 * (value set to 0 where id < 0)
140 * \param[out] values values of notebook variables to query
141 */
142/*----------------------------------------------------------------------------*/
143
144void
146 const int ids[],
147 double values[]);
148
149/*----------------------------------------------------------------------------*/
150/*
151 * \brief Set a group of notebook variable values
152 *
153 * \param[in] n number of notebook variables to set
154 * \param[in] ids ids of notebook variables to set
155 * (ignored where id < 0)
156 * \param[in] values values of notebook variables to set
157 */
158/*----------------------------------------------------------------------------*/
159
160void
162 const int ids[],
163 const double values[]);
164
165/*----------------------------------------------------------------------------*/
166/*
167 * \brief Destroy the notebook structure.
168 *
169 * Destroys the structures related to the notebook.
170 */
171/*----------------------------------------------------------------------------*/
172
173void
175
176/*----------------------------------------------------------------------------*/
177/*
178 * \brief Output the notebook info to the setup log.
179 */
180/*----------------------------------------------------------------------------*/
181
182void
184
185/*----------------------------------------------------------------------------*/
189/*----------------------------------------------------------------------------*/
190
191void
192cs_notebook_log(void);
193
194/*----------------------------------------------------------------------------*/
195/*
196 * \brief Number of notebook variables
197 *
198 * \returns number of notebook variables (int)
199 */
200/*----------------------------------------------------------------------------*/
201
202int
204
205/*----------------------------------------------------------------------------*/
206/*
207 * \brief Indicate if the notebook parameter is editable
208 *
209 * Returns a boolean to indicate wheter this parameter is editable
210 *
211 * \param[in] id Id of the notebook parameter
212 *
213 * \returns true is variable can be edited, false otherwise
214 */
215/*----------------------------------------------------------------------------*/
216
217bool
219
220/*----------------------------------------------------------------------------*/
221/*
222 * \brief Indicate if the notebook parameter is read at restart
223 *
224 * Returns a boolean to indicate wheter this parameter is read at restart
225 *
226 * \param[in] id Id of the notebook parameter
227 *
228 * \returns true if variable should be read from checkpoint file, false otherwise
229 */
230/*----------------------------------------------------------------------------*/
231
232bool
234
235/*----------------------------------------------------------------------------*/
236/*
237 * \brief Change the editable property of the notebook parameter
238 *
239 * \param[in] id Id of the notebook parameter
240 * \param[in] val flag (bool) indicating if the value is set to editable
241 */
242/*----------------------------------------------------------------------------*/
243
244void
246 bool val);
247
248/*----------------------------------------------------------------------------*/
249/*
250 * \brief Get name of a notebook parameter based on its id
251 *
252 * \param[in] id Id of the notebook parameter
253 * \param[out] name Name of the notebook parameter
254 *
255 * \returns name of variable (char *)
256 */
257/*----------------------------------------------------------------------------*/
258
259const char *
261
262/*----------------------------------------------------------------------------*/
263/*
264 * \brief Write uncertain values to output file.
265 *
266 * If input and output uncertain variables are provided, output values
267 * are written to an output file: cs_uncertain_output.dat
268 * Results are ordered in the definition order in the notebook.
269 */
270/*----------------------------------------------------------------------------*/
271
272void
274
275/*----------------------------------------------------------------------------*/
276
277#endif /* CS_NOTEBOOK_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_notebook_parameter_is_present(const char *name, int *editable)
Check if a parameter value is present.
Definition: cs_notebook.cpp:376
void cs_notebook_uncertain_output(void)
Write uncertain values to output file.
Definition: cs_notebook.cpp:795
cs_real_t cs_notebook_parameter_value_by_name(const char *name)
Return a parameter value (real).
Definition: cs_notebook.cpp:408
const char * cs_notebook_parameter_get_description(char *name)
Returns the description of the parameter (GUI defined).
Definition: cs_notebook.cpp:473
void cs_notebook_get_values(int n, const int ids[], double values[])
Get a group of notebook variable values.
Definition: cs_notebook.cpp:509
void cs_notebook_log_setup(void)
Output the notebook info to the setup log.
Definition: cs_notebook.cpp:591
void cs_notebook_log(void)
Print values of editable notebook variables to default log file.
Definition: cs_notebook.cpp:630
int cs_notebook_parameter_get_id(const char *name)
Get id associated with a notebook parameter.
Definition: cs_notebook.cpp:490
int cs_notebook_nb_var(void)
Number of notebook variables.
Definition: cs_notebook.cpp:698
const char * cs_notebook_name_by_id(int id)
Get name of a notebook parameter based on its id.
Definition: cs_notebook.cpp:776
void cs_notebook_parameter_set_value(const char *name, cs_real_t val)
Set a parameter value (real) for an editable parameter.
Definition: cs_notebook.cpp:426
void cs_notebook_var_change_editable(int id, bool val)
Change the editable property of the notebook parameter.
Definition: cs_notebook.cpp:755
void cs_notebook_load_from_file(void)
Initialize the notebook object (based on cs_tree_node_t).
Definition: cs_notebook.cpp:286
int cs_notebook_parameter_get_openturns_status(char *name)
Indicate whether the parameter is used for a study with openturns.
Definition: cs_notebook.cpp:456
void cs_notebook_set_values(int n, const int ids[], const double values[])
Set a group of notebook variable values.
Definition: cs_notebook.cpp:534
bool cs_notebook_var_is_editable(int id)
Indicate if the notebook parameter is editable.
Definition: cs_notebook.cpp:716
void cs_notebook_destroy_all(void)
Destroy the notebook structure.
Definition: cs_notebook.cpp:561
bool cs_notebook_var_is_read_from_checkpoint(int id)
Indicate if the notebook parameter is read at restart.
Definition: cs_notebook.cpp:737