8.1
general documentation
cs_time_plot.h
Go to the documentation of this file.
1 #ifndef __CS_TIME_PLOT_H__
2 #define __CS_TIME_PLOT_H__
3 
4 /*============================================================================
5  * Time_Plot helper structures
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 typedef struct _cs_time_plot_t cs_time_plot_t;
49 
50 /*============================================================================
51  * Local type definitions
52  *============================================================================*/
53 
54 /* Type of 1D plot file format */
55 
56 typedef enum {
57  CS_TIME_PLOT_DAT, /* .dat file (usable by Qtplot or Grace) */
58  CS_TIME_PLOT_CSV /* .csv file (readable by ParaView or spreadsheat) */
60 
61 /*============================================================================
62  * Global variables
63  *============================================================================*/
64 
65 /*=============================================================================
66  * Public function prototypes
67  *============================================================================*/
68 
69 /*----------------------------------------------------------------------------
70  * Initialize a plot file writer for probe-type plots
71  *
72  * This function should only be called by one rank for a given data series.
73  *
74  * parameters:
75  * plot_name <-- plot (variable) name
76  * file_prefix <-- file name prefix
77  * format <-- associated file format
78  * use_iteration <-- should we use the iteration number instead of the
79  * physical time ?
80  * flush_wtime <-- elapsed time interval between file flushes
81  * (if < 0, no forced flush)
82  * n_buffer_steps <-- number of time steps in output buffer if
83  * file is not to be kept open
84  * n_probes <-- number of probes associated with this plot
85  * probe_list <-- numbers (1 to n) of probes if filtered, or NULL
86  * probe_coords <-- probe coordinates, or NULL
87  * probe_names <-- probe names, or NULL
88  *
89  * returns:
90  * pointer to new time plot writer
91  *----------------------------------------------------------------------------*/
92 
94 cs_time_plot_init_probe(const char *plot_name,
95  const char *file_prefix,
96  cs_time_plot_format_t format,
97  bool use_iteration,
98  double flush_wtime,
99  int n_buffer_steps,
100  int n_probes,
101  const int *probe_list,
102  const cs_real_t probe_coords[],
103  const char *probe_names[]);
104 
105 /*----------------------------------------------------------------------------
106  * Initialize a plot file writer for structure-type plots
107  *
108  * This function should only be called by one rank for a given data series.
109  *
110  * parameters:
111  * plot_name <-- plot (variable) name
112  * file_prefix <-- file name prefix
113  * format <-- associated file format
114  * use_iteration <-- should we use the iteration number instead of the
115  * physical time ?
116  * flush_wtime <-- elapsed time interval between file flushes
117  * (if < 0, no forced flush)
118  * n_buffer_steps <-- number of time steps in output buffer if
119  * file is not to be kept open
120  * n_structures <-- number of structures associated with this plot
121  * mass_matrixes <-- mass matrix coefficients (3x3 blocks)
122  * damping_matrixes <-- damping matrix coefficients (3x3 blocks)
123  * stiffness_matrixes <-- stiffness matrix coefficients (3x3 blocks)
124  *
125  * returns:
126  * pointer to new time plot writer
127  *----------------------------------------------------------------------------*/
128 
130 cs_time_plot_init_struct(const char *plot_name,
131  const char *file_prefix,
132  cs_time_plot_format_t format,
133  bool use_iteration,
134  double flush_wtime,
135  int n_buffer_steps,
136  int n_structures,
137  const cs_real_t mass_matrixes[],
138  const cs_real_t damping_matrixes[],
139  const cs_real_t stiffness_matrixes[]);
140 
141 /*----------------------------------------------------------------------------
142  * Finalize time plot writer for a given variable
143  *
144  * This function should only be called by one rank for a given data series.
145  *
146  * parameters:
147  * p <-> time plot values file handler
148  *----------------------------------------------------------------------------*/
149 
150 void
152 
153 /*----------------------------------------------------------------------------
154  * Write time plot values
155  *
156  * This function should only be called by one rank for a given data series.
157  *
158  * parameters:
159  * p <-- pointer to associated plot structure
160  * tn <-- associated time step number
161  * t <-- associated time value
162  * n_vals <-- number of associated time values
163  * vals <-- associated time values
164  *----------------------------------------------------------------------------*/
165 
166 void
168  int tn,
169  double t,
170  int n_vals,
171  const cs_real_t vals[]);
172 
173 /*----------------------------------------------------------------------------
174  * Flush buffered values to file if applicable
175  *
176  * parameters:
177  * p <-> time plot values file handler
178  *----------------------------------------------------------------------------*/
179 
180 void
182 
183 /*----------------------------------------------------------------------------
184  * flush all time plots
185  *----------------------------------------------------------------------------*/
186 
187 void
189 
190 /*----------------------------------------------------------------------------
191  * Set time plot file writer flush behavior defaults.
192  *
193  * parameters:
194  * flush_wtime <-- elapsed time interval between file flushes;
195  * if < 0, no forced flush
196  * n_buffer_steps <-- number of time steps in output buffer if
197  * file is not to be kept open
198  *----------------------------------------------------------------------------*/
199 
200 void
201 cs_time_plot_set_flush_default(float flush_wtime,
202  int n_buffer_steps);
203 
204 /*----------------------------------------------------------------------------
205  * Return time plot file writer flush behavior defaults.
206  *
207  * parameters:
208  * flush_wtime --> elapsed time interval between file flushes;
209  * if < 0, no forced flush (NULL if not queried)
210  * n_buffer_steps <-- number of time steps in output buffer if
211  * file is not to be kept open (NULL if not queried)
212  *----------------------------------------------------------------------------*/
213 
214 void
215 cs_time_plot_get_flush_default(float *flush_wtime,
216  int *n_buffer_steps);
217 
218 /*----------------------------------------------------------------------------*/
219 
221 
222 #endif /* __CS_PROBE_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:515
@ t
Definition: cs_field_pointer.h:92
@ p
Definition: cs_field_pointer.h:67
void cs_time_plot_vals_write(cs_time_plot_t *p, int tn, double t, int n_vals, const cs_real_t vals[])
Definition: cs_time_plot.c:922
void cs_time_plot_flush(cs_time_plot_t *p)
Definition: cs_time_plot.c:990
struct _cs_time_plot_t cs_time_plot_t
Definition: cs_time_plot.h:48
cs_time_plot_format_t
Definition: cs_time_plot.h:56
@ CS_TIME_PLOT_DAT
Definition: cs_time_plot.h:57
@ CS_TIME_PLOT_CSV
Definition: cs_time_plot.h:58
void cs_time_plot_set_flush_default(float flush_wtime, int n_buffer_steps)
Definition: cs_time_plot.c:1029
void cs_time_plot_finalize(cs_time_plot_t **p)
Definition: cs_time_plot.c:881
void cs_time_plot_flush_all(void)
Definition: cs_time_plot.c:1012
void cs_time_plot_get_flush_default(float *flush_wtime, int *n_buffer_steps)
Definition: cs_time_plot.c:1047
cs_time_plot_t * cs_time_plot_init_probe(const char *plot_name, const char *file_prefix, cs_time_plot_format_t format, bool use_iteration, double flush_wtime, int n_buffer_steps, int n_probes, const int *probe_list, const cs_real_t probe_coords[], const char *probe_names[])
Definition: cs_time_plot.c:772
cs_time_plot_t * cs_time_plot_init_struct(const char *plot_name, const char *file_prefix, cs_time_plot_format_t format, bool use_iteration, double flush_wtime, int n_buffer_steps, int n_structures, const cs_real_t mass_matrixes[], const cs_real_t damping_matrixes[], const cs_real_t stiffness_matrixes[])
Definition: cs_time_plot.c:838