My Project
programmer's documentation
Loading...
Searching...
No Matches
cs_gui_util.h
Go to the documentation of this file.
1#ifndef __CS_GUI_UTIL_H__
2#define __CS_GUI_UTIL_H__
3
4/*============================================================================
5 * Management of the GUI parameters file: xpath request and utilities
6 *============================================================================*/
7
8/*
9 This file is part of Code_Saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2019 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
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "cs_base.h"
35#include "cs_tree.h"
36
37/*----------------------------------------------------------------------------*/
38
40
41/*=============================================================================
42 * Public function prototypes
43 *============================================================================*/
44
45/*-----------------------------------------------------------------------------
46 * Indicate if an XML file has been loaded
47 *
48 * returns:
49 * 1 if an XML file has been loaded, 0 otherwise
50 *----------------------------------------------------------------------------*/
51
52int
54
55/*----------------------------------------------------------------------------
56 * Load the XML file in memory.
57 *
58 * parameter:
59 * filename <-- XML file containing the parameters
60 *
61 * returns:
62 * error code (0 in case of success)
63 *----------------------------------------------------------------------------*/
64
65int
66cs_gui_load_file(const char *filename);
67
68/*-----------------------------------------------------------------------------
69 * Check the xml file version.
70 *----------------------------------------------------------------------------*/
71
72void
74
75/*-----------------------------------------------------------------------------
76 * Return the number of characters needed to print an integer number
77 *
78 * parameters:
79 * num <-- integer number
80 *
81 * returns:
82 * number of characters required
83 *----------------------------------------------------------------------------*/
84
85int
87
88/*-----------------------------------------------------------------------------
89 * Compare two strings.
90 *
91 * parameters:
92 * s1 <-- first string
93 * s2 <-- second string
94 *
95 * returns:
96 * 1 if the strings are equal, 0 otherwise.
97 *----------------------------------------------------------------------------*/
98
99int
100cs_gui_strcmp(const char *s1,
101 const char *s2);
102
103/*-----------------------------------------------------------------------------
104 * Test if 2 real values are equal (avoiding compiler warnings)
105 *
106 * parameters:
107 * v1 <-- first value to compare
108 * v2 <-- second value to compare
109 *
110 * returns:
111 * 1 if values are equal, 0 otherwise
112 *----------------------------------------------------------------------------*/
113
114int
116 cs_real_t v2);
117
118/*----------------------------------------------------------------------------*/
128/*----------------------------------------------------------------------------*/
129
130void
131cs_gui_node_get_int(cs_tree_node_t *node,
132 int *value);
133
134/*----------------------------------------------------------------------------*/
144/*----------------------------------------------------------------------------*/
145
146void
147cs_gui_node_get_real(cs_tree_node_t *node,
148 cs_real_t *value);
149
150/*----------------------------------------------------------------------------*/
160/*----------------------------------------------------------------------------*/
161
162void
163cs_gui_node_get_status_int(cs_tree_node_t *node,
164 int *status);
165
166/*----------------------------------------------------------------------------*/
176/*----------------------------------------------------------------------------*/
177
178void
179cs_gui_node_get_status_bool(cs_tree_node_t *node,
180 bool *status);
181
182/*----------------------------------------------------------------------------*/
194/*----------------------------------------------------------------------------*/
195
196const char *
197cs_gui_node_get_tag(cs_tree_node_t *node,
198 const char *tag_name);
199
200/*----------------------------------------------------------------------------*/
211/*----------------------------------------------------------------------------*/
212
213void
214cs_gui_node_get_child_int(cs_tree_node_t *node,
215 const char *child_name,
216 int *value);
217
218/*----------------------------------------------------------------------------*/
229/*----------------------------------------------------------------------------*/
230
231void
232cs_gui_node_get_child_real(cs_tree_node_t *node,
233 const char *child_name,
234 cs_real_t *value);
235
236/*----------------------------------------------------------------------------*/
248/*----------------------------------------------------------------------------*/
249
250void
251cs_gui_node_get_child_status_int(cs_tree_node_t *node,
252 const char *child_name,
253 int *status);
254
255/*----------------------------------------------------------------------------*/
267/*----------------------------------------------------------------------------*/
268
269void
270cs_gui_node_get_child_status_bool(cs_tree_node_t *node,
271 const char *child_name,
272 bool *status);
273
274/*-----------------------------------------------------------------------------
275 * Add timing increment to global MEI time counter.
276 *
277 * parameters:
278 * t <-- timing increment to add
279 *----------------------------------------------------------------------------*/
280
281void
282cs_gui_add_mei_time(double t);
283
284/*-----------------------------------------------------------------------------
285 * Get cumulative global MEI time counter.
286 *
287 * returns:
288 * cumulative global MEI time counter
289 *----------------------------------------------------------------------------*/
290
291double
293
294/*----------------------------------------------------------------------------*/
295
297
298#endif /* __CS_GUI_UTIL_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
#define END_C_DECLS
Definition cs_defs.h:468
@ t
Definition cs_field_pointer.h:98
void cs_gui_node_get_status_bool(cs_tree_node_t *node, bool *status)
Update an bool-valued status value based on a node's status tag.
Definition cs_gui_util.c:364
void cs_gui_node_get_child_status_bool(cs_tree_node_t *node, const char *child_name, bool *status)
Update a bool-valued status value based on a node child's status tag.
Definition cs_gui_util.c:532
void cs_gui_node_get_int(cs_tree_node_t *node, int *value)
Update an integer value based on a tree node.
Definition cs_gui_util.c:271
int cs_gui_is_equal_real(cs_real_t v1, cs_real_t v2)
Definition cs_gui_util.c:241
void cs_gui_node_get_child_int(cs_tree_node_t *node, const char *child_name, int *value)
Update an integer value based on a tree's child node.
Definition cs_gui_util.c:423
void cs_gui_node_get_real(cs_tree_node_t *node, cs_real_t *value)
Update an real value based on a tree node.
Definition cs_gui_util.c:304
void cs_gui_check_version(void)
Check the XML file version.
Definition cs_gui_util.c:140
void cs_gui_node_get_child_real(cs_tree_node_t *node, const char *child_name, cs_real_t *value)
Update an integer value based on a tree's child node.
Definition cs_gui_util.c:460
int cs_gui_load_file(const char *filename)
Load the XML file in memory.
Definition cs_gui_util.c:120
int cs_gui_file_is_loaded(void)
Indicate if an XML file has been loaded.
Definition cs_gui_util.c:101
const char * cs_gui_node_get_tag(cs_tree_node_t *node, const char *tag_name)
Return a string value associated with a "tag" child node and whose presence should be guaranteed.
Definition cs_gui_util.c:393
void cs_gui_add_mei_time(double t)
Definition cs_gui_util.c:559
void cs_gui_node_get_child_status_int(cs_tree_node_t *node, const char *child_name, int *status)
Update an integer-valued status value based on a node child's status tag.
Definition cs_gui_util.c:498
int cs_gui_strcmp(const char *s1, const char *s2)
Definition cs_gui_util.c:220
double cs_gui_get_mei_times(void)
Definition cs_gui_util.c:572
void cs_gui_node_get_status_int(cs_tree_node_t *node, int *status)
Update an integer-valued status value based on a node's status tag.
Definition cs_gui_util.c:337
int cs_gui_characters_number(int num)
Definition cs_gui_util.c:192