8.3
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-2024 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 "cs_defs.h"
33
34/*----------------------------------------------------------------------------*/
35
37
38/*----------------------------------------------------------------------------*/
39/*
40 * \brief Initialize the notebook object (based on cs_tree_node_t).
41 */
42/*----------------------------------------------------------------------------*/
43
44void
46
47/*----------------------------------------------------------------------------*/
48/*
49 * \brief Check if a parameter value is present.
50 *
51 * \param[in] name name of the parameter
52 * \param[out] editable 1 if the value is editable, 0 otherwise (optional)
53 *
54 * \return 0 if not present, 1 if present
55 */
56/*----------------------------------------------------------------------------*/
57
58int
60 int *editable);
61
62/*----------------------------------------------------------------------------*/
63/*
64 * \brief Return a parameter value (real).
65 *
66 * The name used is the same as the one in the GUI.
67 *
68 * \param[in] name name of the parameter
69 *
70 * \return value of the given parameter
71 */
72/*----------------------------------------------------------------------------*/
73
76
77/*----------------------------------------------------------------------------*/
78/*
79 * \brief Set a parameter value (real) for an editable parameter.
80 *
81 * The name used is the same as the one in the GUI.
82 *
83 * \param[in] name name of the parameter
84 * \param[in] val value of the parameter
85 */
86/*----------------------------------------------------------------------------*/
87
88void
89cs_notebook_parameter_set_value(const char *name,
90 cs_real_t val);
91
92/*----------------------------------------------------------------------------*/
93/*
94 * \brief Indicate whether the parameter is used for a study with openturns.
95 *
96 * Returns an int flag to indicate whether this paramter is used for an
97 * OpenTurns study.
98 * -1 : The parameter is not used with OpenTurns
99 * 0 : The parameter is used as an input from OpenTurns
100 * 1 : The parameter is used as an output to OpenTurns
101 *
102 * \param[in] name name of the parameter
103 *
104 * \return an int flag value
105 */
106/*----------------------------------------------------------------------------*/
107
108int
110
111/*----------------------------------------------------------------------------*/
112/*
113 * \brief Returns the description of the parameter (GUI defined).
114 *
115 * \param[in] name name of the parameter
116 *
117 * \return a const char pointer containing the description.
118 */
119/*----------------------------------------------------------------------------*/
120
121const char *
123
124/*----------------------------------------------------------------------------*/
125/*
126 * \brief Get id associated with a notebook parameter.
127 *
128 * \param[in] name name of the parameter
129 *
130 * \return -1 if not present, id if present
131 */
132/*----------------------------------------------------------------------------*/
133
134int
135cs_notebook_parameter_get_id(const char *name);
136
137/*----------------------------------------------------------------------------*/
138/*
139 * \brief Get a group of notebook variable values
140 *
141 * \param[in] n number of notebook variables to query
142 * \param[in] ids ids of notebook variables to query
143 * (value set to 0 where id < 0)
144 * \param[out] values values of notebook variables to query
145 */
146/*----------------------------------------------------------------------------*/
147
148void
150 const int ids[],
151 double values[]);
152
153/*----------------------------------------------------------------------------*/
154/*
155 * \brief Set a group of notebook variable values
156 *
157 * \param[in] n number of notebook variables to set
158 * \param[in] ids ids of notebook variables to set
159 * (ignored where id < 0)
160 * \param[in] values values of notebook variables to set
161 */
162/*----------------------------------------------------------------------------*/
163
164void
166 const int ids[],
167 const double values[]);
168
169/*----------------------------------------------------------------------------*/
170/*
171 * \brief Destroy the notebook structure.
172 *
173 * Destroys the structures related to the notebook.
174 */
175/*----------------------------------------------------------------------------*/
176
177void
179
180/*----------------------------------------------------------------------------*/
181/*
182 * \brief Output the notebook info to the setup log.
183 */
184/*----------------------------------------------------------------------------*/
185
186void
188
189/*----------------------------------------------------------------------------*/
193/*----------------------------------------------------------------------------*/
194
195void
196cs_notebook_log(void);
197
198/*----------------------------------------------------------------------------*/
199/*
200 * \brief Number of notebook variables
201 *
202 * \returns number of notebook variables (int)
203 */
204/*----------------------------------------------------------------------------*/
205
206int
208
209/*----------------------------------------------------------------------------*/
210/*
211 * \brief Indicate if the notebook parameter is editable
212 *
213 * Returns a boolean to indicate wheter this parameter is editable
214 *
215 * \param[in] id Id of the notebook parameter
216 *
217 * \returns true is variable can be edited, false otherwise
218 */
219/*----------------------------------------------------------------------------*/
220
221bool
223
224/*----------------------------------------------------------------------------*/
225/*
226 * \brief Indicate if the notebook parameter is read at restart
227 *
228 * Returns a boolean to indicate wheter this parameter is read at restart
229 *
230 * \param[in] id Id of the notebook parameter
231 *
232 * \returns true if variable should be read from checkpoint file, false otherwise
233 */
234/*----------------------------------------------------------------------------*/
235
236bool
238
239/*----------------------------------------------------------------------------*/
240/*
241 * \brief Change the editable property of the notebook parameter
242 *
243 * \param[in] id Id of the notebook parameter
244 * \param[in] val flag (bool) indicating if the value is set to editable
245 */
246/*----------------------------------------------------------------------------*/
247
248void
250 bool val);
251
252/*----------------------------------------------------------------------------*/
253/*
254 * \brief Get name of a notebook parameter based on its id
255 *
256 * \param[in] id Id of the notebook parameter
257 * \param[out] name Name of the notebook parameter
258 *
259 * \returns name of variable (char *)
260 */
261/*----------------------------------------------------------------------------*/
262
263const char *
265
266/*----------------------------------------------------------------------------*/
267/*
268 * \brief Write uncertain values to output file.
269 *
270 * If input and output uncertain variables are provided, output values
271 * are written to an output file: cs_uncertain_output.dat
272 * Results are ordered in the definition order in the notebook.
273 */
274/*----------------------------------------------------------------------------*/
275
276void
278
279/*----------------------------------------------------------------------------*/
280
282
283#endif /* __CS_NOTEBOOK_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_notebook_parameter_is_present(const char *name, int *editable)
Check if a parameter value is present.
Definition: cs_notebook.cpp:378
void cs_notebook_uncertain_output(void)
Write uncertain values to output file.
Definition: cs_notebook.cpp:797
cs_real_t cs_notebook_parameter_value_by_name(const char *name)
Return a parameter value (real).
Definition: cs_notebook.cpp:410
const char * cs_notebook_parameter_get_description(char *name)
Returns the description of the parameter (GUI defined).
Definition: cs_notebook.cpp:475
void cs_notebook_get_values(int n, const int ids[], double values[])
Get a group of notebook variable values.
Definition: cs_notebook.cpp:511
void cs_notebook_log_setup(void)
Output the notebook info to the setup log.
Definition: cs_notebook.cpp:593
void cs_notebook_log(void)
Print values of editable notebook variables to default log file.
Definition: cs_notebook.cpp:632
int cs_notebook_parameter_get_id(const char *name)
Get id associated with a notebook parameter.
Definition: cs_notebook.cpp:492
int cs_notebook_nb_var(void)
Number of notebook variables.
Definition: cs_notebook.cpp:700
const char * cs_notebook_name_by_id(int id)
Get name of a notebook parameter based on its id.
Definition: cs_notebook.cpp:778
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:428
void cs_notebook_var_change_editable(int id, bool val)
Change the editable property of the notebook parameter.
Definition: cs_notebook.cpp:757
void cs_notebook_load_from_file(void)
Initialize the notebook object (based on cs_tree_node_t).
Definition: cs_notebook.cpp:288
int cs_notebook_parameter_get_openturns_status(char *name)
Indicate whether the parameter is used for a study with openturns.
Definition: cs_notebook.cpp:458
void cs_notebook_set_values(int n, const int ids[], const double values[])
Set a group of notebook variable values.
Definition: cs_notebook.cpp:536
bool cs_notebook_var_is_editable(int id)
Indicate if the notebook parameter is editable.
Definition: cs_notebook.cpp:718
void cs_notebook_destroy_all(void)
Destroy the notebook structure.
Definition: cs_notebook.cpp:563
bool cs_notebook_var_is_read_from_checkpoint(int id)
Indicate if the notebook parameter is read at restart.
Definition: cs_notebook.cpp:739