9.0
general documentation
Loading...
Searching...
No Matches
cs_time_table.h
Go to the documentation of this file.
1#ifndef __CS_TIME_TABLE_H__
2#define __CS_TIME_TABLE_H__
3
4/*============================================================================
5 * Tabulation handling for code_saturne
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2025 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 "base/cs_defs.h"
35#include "base/cs_time_step.h"
36
37/*----------------------------------------------------------------------------*/
38
40
41/*============================================================================
42 * Type definitions
43 *============================================================================*/
44
45typedef struct _cs_time_table_t cs_time_table_t;
46
47/*=============================================================================
48 * Public function prototypes
49 *============================================================================*/
50
51/*----------------------------------------------------------------------------*/
60/*----------------------------------------------------------------------------*/
61
62int
63cs_time_table_column_id_by_name(const cs_time_table_t *table,
64 const char *name);
65
66/*----------------------------------------------------------------------------*/
74/*----------------------------------------------------------------------------*/
75
76cs_time_table_t *
77cs_time_table_by_name_try(const char *name);
78
79/*----------------------------------------------------------------------------*/
87/*----------------------------------------------------------------------------*/
88
89cs_time_table_t *
90cs_time_table_by_name(const char *name);
91
92/*----------------------------------------------------------------------------*/
99/*----------------------------------------------------------------------------*/
100
101void
102cs_time_table_set_offset(cs_time_table_t *table,
103 cs_real_t time_offset);
104
105/*----------------------------------------------------------------------------*/
114/*----------------------------------------------------------------------------*/
115
116void
117cs_time_table_set_headers(cs_time_table_t *table,
118 const int n_headers,
119 const char **headers);
120
121/*----------------------------------------------------------------------------*/
135/*----------------------------------------------------------------------------*/
136
137cs_time_table_t *
138cs_time_table_from_csv_file(const char *name,
139 const char *file_name,
140 const char *separator,
141 const int n_headers,
142 const int n_columns,
143 const int *col_idx,
144 const bool ignore_missing_tokens);
145
146/*----------------------------------------------------------------------------*/
157/*----------------------------------------------------------------------------*/
158
159cs_time_table_t *
161 const char *file_name,
162 const char *separator);
163
164/*----------------------------------------------------------------------------*/
176/*----------------------------------------------------------------------------*/
177
178cs_time_table_t *
180 const char *file_name,
181 const char *separator,
182 const int n_headers);
183
184/*----------------------------------------------------------------------------*/
191/*----------------------------------------------------------------------------*/
192
193void
194cs_time_table_set_time_col_id(cs_time_table_t *table,
195 const int col_id);
196
197/*----------------------------------------------------------------------------*/
204/*----------------------------------------------------------------------------*/
205
206void
207cs_time_table_set_time_from_label(cs_time_table_t *table,
208 const char *time_label);
209
210/*----------------------------------------------------------------------------*/
217/*----------------------------------------------------------------------------*/
218
219void
220cs_time_table_reset_position(cs_time_table_t *table);
221
222/*----------------------------------------------------------------------------*/
231/*----------------------------------------------------------------------------*/
232
233void
234cs_time_table_update_position(cs_time_table_t *table,
235 cs_real_t time,
236 bool reset_time_value);
237
238/*----------------------------------------------------------------------------*/
249/*----------------------------------------------------------------------------*/
250
252cs_time_table_compute_time_value(const char *name,
253 cs_real_t t,
254 const int col,
255 bool overwrite_prev);
256
257/*----------------------------------------------------------------------------*/
268/*----------------------------------------------------------------------------*/
269
272 cs_real_t t,
273 const char *label,
274 bool overwrite_prev);
275
276/*----------------------------------------------------------------------------*/
288/*----------------------------------------------------------------------------*/
289
290void
292 cs_real_t t,
293 const int n_cols,
294 const int cols[],
295 bool overwrite_prev,
296 cs_real_t *retvals);
297
298/*----------------------------------------------------------------------------*/
310/*----------------------------------------------------------------------------*/
311
312void
314 cs_real_t t,
315 const int n_cols,
316 const char *labels[],
317 bool overwrite_prev,
318 cs_real_t *retvals);
319
320/*----------------------------------------------------------------------------*/
330/*----------------------------------------------------------------------------*/
331
332static inline cs_real_t
333CS_TIME_TABLE(const char *name,
334 const char *label)
335{
337 cs_glob_time_step->t_cur,
338 label,
339 false);
340}
341
342/*----------------------------------------------------------------------------*/
348/*----------------------------------------------------------------------------*/
349
350int
351cs_time_table_get_n_rows(const char *name);
352
353/*----------------------------------------------------------------------------*/
359/*----------------------------------------------------------------------------*/
360
361int
362cs_time_table_get_n_cols(const char *name);
363
364/*----------------------------------------------------------------------------*/
371/*----------------------------------------------------------------------------*/
372
373const cs_real_t **
374cs_time_table_get_data(const char *name);
375
376/*----------------------------------------------------------------------------*/
380/*----------------------------------------------------------------------------*/
381
382void
384
385/*----------------------------------------------------------------------------*/
386
388
389#endif /* __CS_TIME_TABLE_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
@ t
Definition cs_field_pointer.h:94
const cs_time_step_t * cs_glob_time_step
void cs_time_table_set_time_col_id(cs_time_table_t *table, const int col_id)
Define the column id for time based on an index.
Definition cs_time_table.cpp:522
const cs_real_t ** cs_time_table_get_data(const char *name)
Return pointer to table data.
Definition cs_time_table.cpp:815
void cs_time_table_compute_n_time_values_by_label(const char *name, cs_real_t t, const int n_cols, const char *labels[], bool overwrite_prev, cs_real_t *retvals)
Compute values for several columns of a time table for a given abscissa.
Definition cs_time_table.cpp:757
void cs_time_table_update_position(cs_time_table_t *table, cs_real_t time, bool reset_time_value)
Update time coefficients used for data interpolation.
Definition cs_time_table.cpp:611
void cs_time_table_destroy_all(void)
Free all data structures related to datasets.
Definition cs_time_table.cpp:829
int cs_time_table_get_n_cols(const char *name)
Extract n_cols from cs_time_table_t structure.
Definition cs_time_table.cpp:798
void cs_time_table_set_headers(cs_time_table_t *table, const int n_headers, const char **headers)
Set headers labels for a time table. Number of headers needs to be equal to the number of columns,...
Definition cs_time_table.cpp:355
cs_time_table_t * cs_time_table_from_csv_file_simple_headers(const char *name, const char *file_name, const char *separator, const int n_headers)
Define a time table from a CSV file. We suppose that all columns are to be read and that missing toke...
Definition cs_time_table.cpp:496
cs_time_table_t * cs_time_table_from_csv_file(const char *name, const char *file_name, const char *separator, const int n_headers, const int n_columns, const int *col_idx, const bool ignore_missing_tokens)
Define a time table from a CSV file.
Definition cs_time_table.cpp:396
cs_time_table_t * cs_time_table_by_name_try(const char *name)
Try to get time table based on name.
Definition cs_time_table.cpp:295
int cs_time_table_column_id_by_name(const cs_time_table_t *table, const char *name)
Get column id corresponding to a given header/label.
Definition cs_time_table.cpp:262
cs_time_table_t * cs_time_table_from_csv_file_simple(const char *name, const char *file_name, const char *separator)
Define a time table from a CSV file. We suppose that all columns are to be read, no headers line to s...
Definition cs_time_table.cpp:466
cs_time_table_t * cs_time_table_by_name(const char *name)
Get time table based on name.
Definition cs_time_table.cpp:313
int cs_time_table_get_n_rows(const char *name)
Extract n_rows from cs_time_table_t structure.
Definition cs_time_table.cpp:782
void cs_time_table_set_time_from_label(cs_time_table_t *table, const char *time_label)
Define the column id for time based on a label.
Definition cs_time_table.cpp:540
static cs_real_t CS_TIME_TABLE(const char *name, const char *label)
Compute value from time table based on label and current time. Positions are not updated for the tabl...
Definition cs_time_table.h:333
cs_real_t cs_time_table_compute_time_value(const char *name, cs_real_t t, const int col, bool overwrite_prev)
Compute value using a given abscissa and a specific column.
Definition cs_time_table.cpp:669
void cs_time_table_compute_n_time_values(const char *name, cs_real_t t, const int n_cols, const int cols[], bool overwrite_prev, cs_real_t *retvals)
Compute values for several columns of a time table for a given abscissa.
Definition cs_time_table.cpp:727
void cs_time_table_set_offset(cs_time_table_t *table, cs_real_t time_offset)
Set time offset value for a time table.
Definition cs_time_table.cpp:335
void cs_time_table_reset_position(cs_time_table_t *table)
Reset time table time value (force search from beginning of table).
Definition cs_time_table.cpp:589
cs_real_t cs_time_table_compute_time_value_by_label(const char *name, cs_real_t t, const char *label, bool overwrite_prev)
Compute value using a given abscissa and a label.
Definition cs_time_table.cpp:695
char * label
Definition keywords.h:58