9.2
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-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
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_base.h"
35
36/*============================================================================
37 * Macro definitions
38 *============================================================================*/
39
40/*============================================================================
41 * Type definitions
42 *============================================================================*/
43
44typedef struct _cs_time_plot_t cs_time_plot_t;
45
46/*============================================================================
47 * Local type definitions
48 *============================================================================*/
49
50/* Type of 1D plot file format */
51
52typedef enum {
53 CS_TIME_PLOT_DAT, /* .dat file (usable by Qtplot or Grace) */
54 CS_TIME_PLOT_CSV /* .csv file (readable by ParaView or spreadsheat) */
56
57/*============================================================================
58 * Global variables
59 *============================================================================*/
60
61/*=============================================================================
62 * Public function prototypes
63 *============================================================================*/
64
65/*----------------------------------------------------------------------------
66 * Initialize a plot file writer for probe-type plots
67 *
68 * This function should only be called by one rank for a given data series.
69 *
70 * parameters:
71 * plot_name <-- plot (variable) name
72 * file_prefix <-- file name prefix
73 * format <-- associated file format
74 * use_iteration <-- should we use the iteration number instead of the
75 * physical time ?
76 * flush_wtime <-- elapsed time interval between file flushes
77 * (if < 0, no forced flush)
78 * n_buffer_steps <-- number of time steps in output buffer if
79 * file is not to be kept open
80 * n_probes <-- number of probes associated with this plot
81 * probe_list <-- numbers (1 to n) of probes if filtered, or NULL
82 * probe_coords <-- probe coordinates, or NULL
83 * probe_names <-- probe names, or NULL
84 *
85 * returns:
86 * pointer to new time plot writer
87 *----------------------------------------------------------------------------*/
88
90cs_time_plot_init_probe(const char *plot_name,
91 const char *file_prefix,
93 bool use_iteration,
94 double flush_wtime,
95 int n_buffer_steps,
96 int n_probes,
97 const int *probe_list,
98 const cs_real_t probe_coords[],
99 const char *probe_names[]);
100
101/*----------------------------------------------------------------------------
102 * Initialize a plot file writer for structure-type plots
103 *
104 * This function should only be called by one rank for a given data series.
105 *
106 * parameters:
107 * plot_name <-- plot (variable) name
108 * file_prefix <-- file name prefix
109 * format <-- associated file format
110 * use_iteration <-- should we use the iteration number instead of the
111 * physical time ?
112 * flush_wtime <-- elapsed time interval between file flushes
113 * (if < 0, no forced flush)
114 * n_buffer_steps <-- number of time steps in output buffer if
115 * file is not to be kept open
116 * n_structures <-- number of structures associated with this plot
117 * mass_matrixes <-- mass matrix coefficients (3x3 blocks)
118 * damping_matrixes <-- damping matrix coefficients (3x3 blocks)
119 * stiffness_matrixes <-- stiffness matrix coefficients (3x3 blocks)
120 *
121 * returns:
122 * pointer to new time plot writer
123 *----------------------------------------------------------------------------*/
124
126cs_time_plot_init_struct(const char *plot_name,
127 const char *file_prefix,
129 bool use_iteration,
130 double flush_wtime,
131 int n_buffer_steps,
132 int n_structures,
133 const cs_real_t mass_matrixes[],
134 const cs_real_t damping_matrixes[],
135 const cs_real_t stiffness_matrixes[]);
136
137/*----------------------------------------------------------------------------
138 * Finalize time plot writer for a given variable
139 *
140 * This function should only be called by one rank for a given data series.
141 *
142 * parameters:
143 * p <-> time plot values file handler
144 *----------------------------------------------------------------------------*/
145
146void
148
149/*----------------------------------------------------------------------------
150 * Write time plot values
151 *
152 * This function should only be called by one rank for a given data series.
153 *
154 * parameters:
155 * p <-- pointer to associated plot structure
156 * tn <-- associated time step number
157 * t <-- associated time value
158 * n_vals <-- number of associated time values
159 * vals <-- associated time values
160 *----------------------------------------------------------------------------*/
161
162void
164 int tn,
165 double t,
166 int n_vals,
167 const cs_real_t vals[]);
168
169/*----------------------------------------------------------------------------
170 * Flush buffered values to file if applicable
171 *
172 * parameters:
173 * p <-> time plot values file handler
174 *----------------------------------------------------------------------------*/
175
176void
178
179/*----------------------------------------------------------------------------
180 * flush all time plots
181 *----------------------------------------------------------------------------*/
182
183void
185
186/*----------------------------------------------------------------------------
187 * Set time plot file writer flush behavior defaults.
188 *
189 * parameters:
190 * flush_wtime <-- elapsed time interval between file flushes;
191 * if < 0, no forced flush
192 * n_buffer_steps <-- number of time steps in output buffer if
193 * file is not to be kept open
194 *----------------------------------------------------------------------------*/
195
196void
197cs_time_plot_set_flush_default(float flush_wtime,
198 int n_buffer_steps);
199
200/*----------------------------------------------------------------------------
201 * Return time plot file writer flush behavior defaults.
202 *
203 * parameters:
204 * flush_wtime --> elapsed time interval between file flushes;
205 * if < 0, no forced flush (NULL if not queried)
206 * n_buffer_steps <-- number of time steps in output buffer if
207 * file is not to be kept open (NULL if not queried)
208 *----------------------------------------------------------------------------*/
209
210void
211cs_time_plot_get_flush_default(float *flush_wtime,
212 int *n_buffer_steps);
213
214/*----------------------------------------------------------------------------*/
215
216#endif /* CS_PROBE_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
@ t
Definition: cs_field_pointer.h:91
@ p
Definition: cs_field_pointer.h:63
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.cpp:920
void cs_time_plot_flush(cs_time_plot_t *p)
Definition: cs_time_plot.cpp:988
struct _cs_time_plot_t cs_time_plot_t
Definition: cs_time_plot.h:44
cs_time_plot_format_t
Definition: cs_time_plot.h:52
@ CS_TIME_PLOT_DAT
Definition: cs_time_plot.h:53
@ CS_TIME_PLOT_CSV
Definition: cs_time_plot.h:54
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.cpp:770
void cs_time_plot_set_flush_default(float flush_wtime, int n_buffer_steps)
Definition: cs_time_plot.cpp:1027
void cs_time_plot_finalize(cs_time_plot_t **p)
Definition: cs_time_plot.cpp:879
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.cpp:836
void cs_time_plot_flush_all(void)
Definition: cs_time_plot.cpp:1010
void cs_time_plot_get_flush_default(float *flush_wtime, int *n_buffer_steps)
Definition: cs_time_plot.cpp:1045