9.2
general documentation
cs_post.h
Go to the documentation of this file.
1#ifndef CS_POST_H
2#define CS_POST_H
3
4/*============================================================================
5 * Post-processing management
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#include "base/cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Standard C library headers
34 *----------------------------------------------------------------------------*/
35
36/*----------------------------------------------------------------------------
37 * Local headers
38 *----------------------------------------------------------------------------*/
39
40#include "fvm/fvm_nodal.h"
41#include "fvm/fvm_writer.h"
42
43#include "base/cs_base.h"
44#include "base/cs_function.h"
45#include "base/cs_interpolate.h"
46#include "base/cs_probe.h"
47#include "base/cs_time_step.h"
49
50/*============================================================================
51 * Macro definitions
52 *============================================================================*/
53
54/* Output type masks */
55
56#define CS_POST_ON_LOCATION (1 << 0) /* postprocess variables
57 on their base location
58 (volume for variables) */
59#define CS_POST_BOUNDARY_NR (1 << 1) /* postprocess boundary
60 without reconstruction */
61
62#define CS_POST_MONITOR (1 << 2) /* monitor variables */
64/* Default writer ids and filters */
66#define CS_POST_WRITER_ALL_ASSOCIATED 0
68#define CS_POST_WRITER_DEFAULT -1
69#define CS_POST_WRITER_ERRORS -2
70#define CS_POST_WRITER_PARTICLES -3
71#define CS_POST_WRITER_TRAJECTORIES -4
72#define CS_POST_WRITER_PROBES -5
73#define CS_POST_WRITER_PROFILES -6
74#define CS_POST_WRITER_HISTOGRAMS -7
76/* Default mesh ids */
78#define CS_POST_MESH_VOLUME -1
79#define CS_POST_MESH_BOUNDARY -2
80#define CS_POST_MESH_PARTICLES -3
81#define CS_POST_MESH_TRAJECTORIES -4
82#define CS_POST_MESH_PROBES -5
83#define CS_POST_MESH_1D_THERMAL -6
85/* Additional categories (no associated default mesh) */
86
87#define CS_POST_MESH_SURFACE -1001 /* surface (boundary and/or
88 interior) mesh */
89
90/*============================================================================
91 * Local type definitions
92 *============================================================================*/
93
94/* Datatype enumeration (deprecated; cs_datatype_t preferred) */
98#define CS_POST_TYPE_int CS_INT_TYPE
99#define CS_POST_TYPE_cs_real_t CS_REAL_TYPE
100#define CS_POST_TYPE_float CS_FLOAT
101#define CS_POST_TYPE_double CS_DOUBLE
102
103/*----------------------------------------------------------------------------
104 * Function pointer to elements selection definition.
105 *
106 * Each function of this sort may be used to select a given type of element,
107 * usually cells, interior faces, boundary faces, or particles.
108 *
109 * If non-empty and not containing all elements, a list of elements of the
110 * main mesh should be allocated (using CS_MALLOC) and defined by this
111 * function when called. This list's lifecycle is then managed by the
112 * postprocessing subsystem.
113 *
114 * Note: if the input pointer is non-null, it must point to valid data
115 * when the selection function is called, so either:
116 * - that value or structure should not be temporary (i.e. local);
117 * - post-processing output must be ensured using cs_post_write_meshes()
118 * with a fixed-mesh writer before the data pointed to goes out of scope;
119 *
120 * parameters:
121 * input <-> pointer to optional (untyped) value or structure.
122 * n_elts --> number of selected elements.
123 * elt_list --> list of selected elements (0 to n-1 numbering).
124 *----------------------------------------------------------------------------*/
125
126typedef void
127(cs_post_elt_select_t) (void *input,
128 cs_lnum_t *n_elts,
129 cs_lnum_t **elt_list);
130
131/*----------------------------------------------------------------------------
132 * Function pointer associated with a specific post-processing output.
133 *
134 * Such functions are registered using the cs_post_add_time_dep_vars(),
135 * and all registered functions are automatically called by
136 * cs_post_write_vars().
137 *
138 * Note: if the input pointer is non-null, it must point to valid data
139 * when the output function is called, so either:
140 * - that value or structure should not be temporary (i.e. local);
141 * - post-processing output must be ensured using cs_post_write_var()
142 * or similar before the data pointed to goes out of scope.
143 *
144 * parameters:
145 * input <-> pointer to optional (untyped) value or structure.
146 * ts <-- time step status structure, or NULL
147 *----------------------------------------------------------------------------*/
148
149typedef void
150(cs_post_time_dep_output_t) (void *input,
151 const cs_time_step_t *ts);
152
153/*----------------------------------------------------------------------------
154 * Function pointer associated with a specific post-processing output
155 * on multiple meshes.
156 *
157 * Such functions are registered using the cs_post_add_time_mesh_dep_vars(),
158 * and all registered functions are automatically called by
159 * cs_post_write_vars().
160 *
161 * Note: if the input pointer is non-null, it must point to valid data
162 * when the output function is called, so either:
163 * - that value or structure should not be temporary (i.e. local);
164 * - post-processing output must be ensured using cs_post_write_var()
165 * or similar before the data pointed to goes out of scope.
166 *
167 * parameters:
168 * input <-> pointer to optional (untyped) value or structure.
169 * mesh_id <-- id of the output mesh for the current call
170 * cat_id <-- category id of the output mesh for the current call
171 * ent_flag <-- indicate global presence of cells (ent_flag[0]), interior
172 * faces (ent_flag[1]), boundary faces (ent_flag[2]),
173 * particles (ent_flag[3]) or probes (ent_flag[4])
174 * n_cells <-- local number of cells of post_mesh
175 * n_i_faces <-- local number of interior faces of post_mesh
176 * n_b_faces <-- local number of boundary faces of post_mesh
177 * cell_ids <-- list of cells (0 to n-1) of post-processing mesh
178 * i_face_ids <-- list of interior faces (0 to n-1) of post-processing mesh
179 * b_face_ids <-- list of boundary faces (0 to n-1) of post-processing mesh
180 * ts <-- time step status structure, or NULL
181 *----------------------------------------------------------------------------*/
182
183typedef void
184(cs_post_time_mesh_dep_output_t) (void *input,
185 int mesh_id,
186 int cat_id,
187 int ent_flag[5],
188 cs_lnum_t n_cells,
189 cs_lnum_t n_i_faces,
190 cs_lnum_t n_b_faces,
191 const cs_lnum_t cell_ids[],
192 const cs_lnum_t i_face_ids[],
193 const cs_lnum_t b_face_ids[],
194 const cs_time_step_t *ts);
195
196/*=============================================================================
197 * Global variables
198 *============================================================================*/
199
200/*============================================================================
201 * Public function prototypes
202 *============================================================================*/
203
204/*----------------------------------------------------------------------------*/
205/*
206 * \brief Define a writer; this objects manages a case's name, directory,
207 * and format, as well as associated mesh's time dependency, and the
208 * default output interval for associated variables.
209 *
210 * This function must be called before the time loop. If a writer with a
211 * given id is defined multiple times, the last definition supersedes the
212 * previous ones.
213 *
214 * Current reserved ids are the following: CS_POST_WRITER_DEFAULT
215 * for main/default output, CS_POST_WRITER_ERRORS for error visualization,
216 * CS_POST_WRITER_PROBES for main probes, CS_POST_WRITER_PARTICLES for
217 * particles, CS_POST_WRITER_TRAJECTORIES for trajectories. Other negative
218 * ids may be dynamically reserved by the code depending on options.
219 * Positive ids identify user-defined writers.
220 *
221 * \warning depending on the chosen format, the \em case_name may be
222 * shortened (maximum number of characters: 32 for \em MED, 19 for \em EnSight,
223 * or modified automatically (white-space or forbidden characters will be
224 * replaced by "_").
225 *
226 * The \c \b format_name argument is used to choose the output format, and the
227 * following values are allowed (assuming the matching
228 * support was built):
229 *
230 * - \c \b EnSight \c \b Gold (\c \b EnSight also accepted)
231 * - \c \b MED
232 * - \c \b CGNS
233 * - \c \b CCM (only for the full volume and boundary meshes)
234 * - \c \b Catalyst (in-situ visualization)
235 * - \c \b MEDCoupling (in-memory structure, to be used from other code)
236 * - \c \b plot (comma or whitespace separated 2d plot files)
237 * - \c \b time_plot (comma or whitespace separated time plot files)
238 *
239 * The format name is case-sensitive, so \c \b ensight or \c \b cgns are also valid.
240 *
241 * The optional \c \b fmt_opts character string contains a list of options related
242 * to the format, separated by spaces or commas; these options include:
243 *
244 * - \c \b binary for a binary format version (default)
245 * - \c \b big_endian to force outputs to be in \c \b big-endian mode
246 * (for \c \b EnSight).
247 * - \c \b text for a text format version (for \c \b EnSight).
248 * - \c \b adf for ADF file type (for \c \b CGNS).
249 * - \c \b hdf5 for HDF5 file type (for \c \b CGNS, normally the default if
250 * HDF5 support is available).
251 * - \c \b discard_polygons to prevent from exporting faces with more than
252 * four edges (which may not be recognized by some post-processing
253 * tools); such faces will therefore not appear in the post-processing
254 * mesh.
255 * - \c \b discard_polyhedra to prevent from exporting elements which are
256 * neither tetrahedra, prisms, pyramids nor hexahedra (which may not
257 * be recognized by some post-processing tools); such elements will
258 * therefore not appear in the post-processing mesh.
259 * - \c \b divide_polygons to divide faces with more than four edges into
260 * triangles, so that any post-processing tool can recognize them.
261 * - \c \b divide_polyhedra} to divide elements which are neither tetrahedra,
262 * prisms, pyramids nor hexahedra into simpler elements (tetrahedra and
263 * pyramids), so that any post-processing tool can recognize them.
264 * - \c \b separate_meshes to multiple meshes and associated fields to
265 * separate outputs.
266 *
267 * Note that the white-spaces in the beginning or in the end of the
268 * character strings given as arguments here are suppressed automatically.
269 *
270 * \param[in] writer_id id of writer to create. (< 0 reserved,
271 * > 0 for user); eveb for reserved ids,
272 * the matching writer's options
273 * may be redifined by calls to this function
274 * \param[in] case_name associated case name
275 * \param[in] dir_name associated directory name
276 * \param[in] fmt_name associated format name
277 * \param[in] fmt_opts associated format options string
278 * \param[in] time_dep \ref FVM_WRITER_FIXED_MESH if mesh definitions
279 * are fixed, \ref FVM_WRITER_TRANSIENT_COORDS if
280 * coordinates change,
281 * \ref FVM_WRITER_TRANSIENT_CONNECT if
282 * connectivity changes
283 * \param[in] output_at_start force output at calculation start if true
284 * \param[in] output_at_end force output at calculation end if true
285 * \param[in] interval_n default output interval in time-steps, or < 0
286 * \param[in] interval_t default output interval in seconds, or < 0
287 * (has priority over interval_n)
288 */
289/*----------------------------------------------------------------------------*/
290
291void
292cs_post_define_writer(int writer_id,
293 const char *case_name,
294 const char *dir_name,
295 const char *fmt_name,
296 const char *fmt_opts,
297 fvm_writer_time_dep_t time_dep,
298 bool output_at_start,
299 bool output_at_end,
300 int interval_n,
301 double interval_t);
302
303/*----------------------------------------------------------------------------*/
304/*
305 * \brief Define a volume post-processing mesh.
306 *
307 * \param[in] mesh_id id of mesh to define
308 * (< 0 reserved, > 0 for user)
309 * \param[in] mesh_name associated mesh name
310 * \param[in] cell_criteria selection criteria for cells
311 * \param[in] add_groups if true, add group information if present
312 * \param[in] auto_variables if true, automatic output of main variables
313 * \param[in] n_writers number of associated writers
314 * \param[in] writer_ids ids of associated writers
315 */
316/*----------------------------------------------------------------------------*/
317
318void
320 const char *mesh_name,
321 const char *cell_criteria,
322 bool add_groups,
323 bool auto_variables,
324 int n_writers,
325 const int writer_ids[]);
326
327/*----------------------------------------------------------------------------*/
328/*
329 * \brief Define a volume post-processing mesh using a selection function.
330 *
331 * The selection may be updated over time steps if both the time_varying
332 * flag is set to true and the mesh is only associated with writers defined
333 * with the FVM_WRITER_TRANSIENT_CONNECT option.
334 *
335 * Note: if the cell_select_input pointer is non-null, it must point
336 * to valid data when the selection function is called, so either:
337 * - that value or structure should not be temporary (i.e. local);
338 * - post-processing output must be ensured using cs_post_write_meshes()
339 * with a fixed-mesh writer before the data pointed to goes out of scope;
340 *
341 * \param[in] mesh_id id of mesh to define
342 * (< 0 reserved, > 0 for user)
343 * \param[in] mesh_name associated mesh name
344 * \param[in] cell_select_func pointer to cells selection function
345 * \param[in] cell_select_input pointer to optional input data for the cell
346 * selection function, or NULL
347 * \param[in] time_varying if true, try to redefine mesh at each
348 * output time
349 * \param[in] add_groups if true, add group information if present
350 * \param[in] auto_variables if true, automatic output of main variables
351 * \param[in] n_writers number of associated writers
352 * \param[in] writer_ids ids of associated writers
353 */
354/*----------------------------------------------------------------------------*/
355
356void
358 const char *mesh_name,
359 cs_post_elt_select_t *cell_select_func,
360 void *cell_select_input,
361 bool time_varying,
362 bool add_groups,
363 bool auto_variables,
364 int n_writers,
365 const int writer_ids[]);
366
367/*----------------------------------------------------------------------------*/
368/*
369 * \brief Define a surface post-processing mesh.
370 *
371 * \param[in] mesh_id id of mesh to define
372 * (< 0 reserved, > 0 for user)
373 * \param[in] mesh_name associated mesh name
374 * \param[in] i_face_criteria selection criteria for interior faces
375 * \param[in] b_face_criteria selection criteria for boundary faces
376 * \param[in] add_groups if true, add group information if present
377 * \param[in] auto_variables if true, automatic output of main variables
378 * \param[in] n_writers number of associated writers
379 * \param[in] writer_ids ids of associated writers
380 */
381/*----------------------------------------------------------------------------*/
382
383void
385 const char *mesh_name,
386 const char *i_face_criteria,
387 const char *b_face_criteria,
388 bool add_groups,
389 bool auto_variables,
390 int n_writers,
391 const int writer_ids[]);
392
393/*----------------------------------------------------------------------------*/
394/*
395 * \brief Define a surface post-processing mesh using selection functions.
396 *
397 * The selection may be updated over time steps if both the time_varying
398 * flag is set to true and the mesh is only associated with writers defined
399 * with the FVM_WRITER_TRANSIENT_CONNECT option.
400 *
401 * Note: if i_face_select_input or b_face_select_input pointer is non-null,
402 * it must point to valid data when the selection function is called,
403 * so either:
404 * - that value or structure should not be temporary (i.e. local);
405 * - post-processing output must be ensured using cs_post_write_meshes()
406 * with a fixed-mesh writer before the data pointed to goes out of scope;
407 *
408 * \param[in] mesh_id id of mesh to define
409 * (< 0 reserved, > 0 for user)
410 * \param[in] mesh_name associated mesh name
411 * \param[in] i_face_select_func pointer to interior faces selection function
412 * \param[in] b_face_select_func pointer to boundary faces selection function
413 * \param[in] i_face_select_input pointer to optional input data for the
414 * interior faces selection function, or NULL
415 * \param[in] b_face_select_input pointer to optional input data for the
416 * boundary faces selection function, or NULL
417 * \param[in] time_varying if true, try to redefine mesh at each
418 * output time
419 * \param[in] add_groups if true, add group information if present
420 * \param[in] auto_variables if true, automatic output of main variables
421 * \param[in] n_writers number of associated writers
422 * \param[in] writer_ids ids of associated writers
423 */
424/*----------------------------------------------------------------------------*/
425
426void
428 const char *mesh_name,
429 cs_post_elt_select_t *i_face_select_func,
430 cs_post_elt_select_t *b_face_select_func,
431 void *i_face_select_input,
432 void *b_face_select_input,
433 bool time_varying,
434 bool add_groups,
435 bool auto_variables,
436 int n_writers,
437 const int writer_ids[]);
438
439/*----------------------------------------------------------------------------*/
440/*
441 * \brief Define a volume or surface post-processing mesh by associated
442 * mesh location id.
443 *
444 * \param[in] mesh_id id of mesh to define
445 * (< 0 reserved, > 0 for user)
446 * \param[in] mesh_name associated mesh name
447 * \param[in] location_id associated mesh location id
448 * \param[in] add_groups if true, add group information if present
449 * \param[in] auto_variables if true, automatic output of main variables
450 * \param[in] n_writers number of associated writers
451 * \param[in] writer_ids ids of associated writers
452 */
453/*----------------------------------------------------------------------------*/
454
455void
457 const char *mesh_name,
458 int location_id,
459 bool add_groups,
460 bool auto_variables,
461 int n_writers,
462 const int writer_ids[]);
463
464/*----------------------------------------------------------------------------*/
465/*
466 * \brief Define a particles post-processing mesh.
467 *
468 * Such a mesh is always time-varying, and will only be output by writers
469 * defined with the FVM_WRITER_TRANSIENT_CONNECT option.
470 *
471 * If the trajectory_mode argument is set to true, this logic is reversed,
472 * and output will only occur for writers defined with the
473 * FVM_WRITER_FIXED_MESH option. In this case, a submesh consisting of
474 * trajectory segments for the current time step will be added to
475 * the output at each output time step.
476 *
477 * \param[in] mesh_id id of mesh to define
478 * (< 0 reserved, > 0 for user)
479 * \param[in] mesh_name associated mesh name
480 * \param[in] cell_criteria selection criteria for cells containing
481 * particles, or NULL.
482 * \param[in] density fraction of the particles in the selected area
483 * which should be output (0 < density <= 1)
484 * \param[in] trajectory if true, activate trajectory mode
485 * \param[in] auto_variables if true, automatic output of main variables
486 * \param[in] n_writers number of associated writers
487 * \param[in] writer_ids ids of associated writers
488 */
489/*----------------------------------------------------------------------------*/
490
491void
493 const char *mesh_name,
494 const char *cell_criteria,
495 double density,
496 bool trajectory,
497 bool auto_variables,
498 int n_writers,
499 const int writer_ids[]);
500
501/*----------------------------------------------------------------------------*/
502/*
503 * \brief Define a particles post-processing mesh using a selection function.
504 *
505 * The selection may be updated over time steps.
506 *
507 * Such a mesh is always time-varying, and will only be output by writers
508 * defined with the FVM_WRITER_TRANSIENT_CONNECT option.
509 *
510 * If the trajectory_mode argument is set to true, this logic is reversed,
511 * and output will only occur for writers defined with the
512 * FVM_WRITER_FIXED_MESH option. In this case, a submesh consisting of
513 * trajectory segments for the current time step will be added to
514 * the output at each output time step.
515 *
516 * Note: if the p_select_input pointer is non-null, it must point
517 * to valid data when the selection function is called, so
518 * that value or structure should not be temporary (i.e. local);
519 *
520 * \param[in] mesh_id id of mesh to define
521 * (< 0 reserved, > 0 for user)
522 * \param[in] mesh_name associated mesh name
523 * \param[in] p_select_func pointer to particles selection function
524 * \param[in] p_select_input pointer to optional input data for the particles
525 * selection function, or NULL
526 * \param[in] trajectory if true, activate trajectory mode
527 * \param[in] auto_variables if true, automatic output of main variables
528 * \param[in] n_writers number of associated writers
529 * \param[in] writer_ids ids of associated writers
530 */
531/*----------------------------------------------------------------------------*/
532
533void
535 const char *mesh_name,
536 cs_post_elt_select_t *p_select_func,
537 void *p_select_input,
538 bool trajectory,
539 bool auto_variables,
540 int n_writers,
541 const int writer_ids[]);
542
543/*--------------------------------------------------------------------------*/
544/*
545 * \brief Define 1D mesh for the 1D wall thermal module
546 */
547/*--------------------------------------------------------------------------*/
548
549void
551(
552 int mesh_id,
553 bool time_varying,
554 bool auto_variable,
555 int n_writers,
556 const int writer_ids[]
557);
558
559/*----------------------------------------------------------------------------*/
560/*
561 * \brief Create a post-processing mesh associated with an existing exportable
562 * mesh representation.
563 *
564 * If the exportable mesh is not intended to be used elsewhere, one can choose
565 * to transfer its property to the post-processing mesh, which will then
566 * manage its lifecycle based on its own requirements.
567 *
568 * If the exportable mesh must still be shared, one must be careful to
569 * maintain consistency between this mesh and the post-processing output.
570 *
571 * The mesh in exportable dimension may be of a lower dimension than
572 * its parent mesh, if it has been projected. In this case, a
573 * dim_shift value of 1 indicates that parent cells are mapped to
574 * exportable faces, and faces to edges, while a dim_shift value of 2
575 * would indicate that parent cells are mapped to edges.
576 * This is important when variables values are exported.
577 *
578 * \param[in] mesh_id id of mesh to define
579 * (< 0 reserved, > 0 for user)
580 * \param[in] exp_mesh mesh in exportable representation
581 * (i.e. fvm_nodal_t)
582 * \param[in] dim_shift nonzero if exp_mesh has been projected
583 * \param[in] transfer if true, ownership of exp_mesh is transferred
584 * to the post-processing mesh
585 * \param[in] auto_variables if true, automatic output of main variables
586 * \param[in] child_of_global if true, mesh is a child/subset of the compute
587 * mesh (so may have parent element ids)
588 * \param[in] n_writers number of associated writers
589 * \param[in] writer_ids ids of associated writers
590 */
591/*----------------------------------------------------------------------------*/
592
593void
595 fvm_nodal_t *exp_mesh,
596 int dim_shift,
597 bool transfer,
598 bool auto_variables,
599 bool child_of_global,
600 int n_writers,
601 const int writer_ids[]);
602
603void
605 fvm_nodal_t *exp_mesh,
606 int dim_shift,
607 bool transfer,
608 bool auto_variables,
609 int n_writers,
610 const int writer_ids[]);
611
612/*----------------------------------------------------------------------------*/
625/*----------------------------------------------------------------------------*/
626
627void
629 int cat_id,
630 bool auto_variables,
631 int n_writers,
632 const int writer_ids[]);
633
634/*----------------------------------------------------------------------------*/
661/*----------------------------------------------------------------------------*/
662
663void
665 fvm_nodal_t *exp_mesh,
666 int dim_shift,
667 bool transfer);
668
669/*----------------------------------------------------------------------------*/
670/*
671 * \brief Create a mesh based upon the extraction of edges from an existing mesh.
672 *
673 * The newly created edges have no link to their parent elements, so
674 * no variable referencing parent elements may be output to this mesh,
675 * whose main use is to visualize "true" face edges when polygonal faces
676 * are subdivided by the writer. In this way, even highly non-convex
677 * faces may be visualized correctly if their edges are overlaid on
678 * the surface mesh with subdivided polygons.
679 *
680 * \param[in] mesh_id id of edges mesh to create
681 * (< 0 reserved, > 0 for user)
682 * \param[in] base_mesh_id id of existing mesh (< 0 reserved, > 0 for user)
683 * \param[in] n_writers number of associated writers
684 * \param[in] writer_ids ids of associated writers
685 */
686/*----------------------------------------------------------------------------*/
687
688void
689cs_post_define_edges_mesh(int mesh_id,
690 int base_mesh_id,
691 int n_writers,
692 const int writer_ids[]);
693
694/*----------------------------------------------------------------------------*/
695/*
696 * \brief Set restriction of a postprocessing mesh to element centers
697 *
698 * This allow simply using element centers instead of full representations.
699 *
700 * This function must be called during the postprocessing output definition
701 * stage, before any output actually occurs.
702 *
703 * If called with a non-existing mesh or writer id, or if the writer was not
704 * previously associated, no setting is changed, and this function
705 * returns silently.
706 *
707 * \param[in] mesh_id id of mesh to define
708 * (< 0 reserved, > 0 for user)
709 * \param[in] centers_only true if only element centers sould be output,
710 * false fo normal connectivity.
711 */
712/*----------------------------------------------------------------------------*/
713
714void
716 bool centers_only);
717
718/*----------------------------------------------------------------------------*/
719/*
720 * \brief Associate a writer to a postprocessing mesh.
721 *
722 * This function must be called during the postprocessing output definition
723 * stage, before any output actually occurs.
724 *
725 * If called with a non-existing mesh or writer id, or if the writer is
726 * already associated, no setting is changed, and this function
727 * returns silently.
728 *
729 * \param[in] mesh_id id of mesh to define
730 * (< 0 reserved, > 0 for user)
731 * \param[in] writer_id id of writer to associate
732 */
733/*----------------------------------------------------------------------------*/
734
735void
737 int writer_id);
738
739/*----------------------------------------------------------------------------*/
740/*
741 * \brief De-associate a writer from a postprocessing mesh.
742 *
743 * This function must be called during the postprocessing output definition
744 * stage, before any output actually occurs.
745 *
746 * If called with a non-existing mesh or writer id, or if the writer was not
747 * previously associated, no setting is changed, and this function
748 * returns silently.
749 *
750 * \param[in] mesh_id id of mesh to define
751 * (< 0 reserved, > 0 for user)
752 * \param[in] writer_id id of writer to associate
753 */
754/*----------------------------------------------------------------------------*/
755
756void
758 int writer_id);
759
760/*----------------------------------------------------------------------------*/
761/*
762 * \brief Associate a field to a writer and postprocessing mesh combination.
763 *
764 * This function must be called during the postprocessing output definition
765 * stage, before any output actually occurs.
766 *
767 * If the field should already be output automatically based on the mesh
768 * category and field output keywords, it will not be added.
769 *
770 * \param[in] mesh_id id of associated mesh
771 * \param[in] writer_id id of specified associated writer,
772 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
773 * \param[in] field_id id of field to attach
774 * \param[in] comp_id id of field component (-1 for all)
775 */
776/*----------------------------------------------------------------------------*/
777
778void
779cs_post_mesh_attach_field(int mesh_id,
780 int writer_id,
781 int field_id,
782 int comp_id);
783
784/*----------------------------------------------------------------------------*/
785/*
786 * \brief Get a postprocessing meshes entity presence flag.
787 *
788 * This flag is an array of 5 integers, indicating the presence of elements
789 * of given types on at least one subdomain (i.e. rank):
790 * 0: presence of cells
791 * 1: presence of interior faces
792 * 2: presence of boundary faces
793 * 3: presence of particles
794 * 4: presence of probes
795 *
796 * \param[in] mesh_id postprocessing mesh id
797 *
798 * \return pointer to entity presence flag
799 */
800/*----------------------------------------------------------------------------*/
801
802const int *
803cs_post_mesh_get_ent_flag(int mesh_id);
804
805/*----------------------------------------------------------------------------*/
806/*
807 * \brief Get a postprocessing mesh's number of cells
808 *
809 * \param[in] mesh_id postprocessing mesh id
810 *
811 * \return number of cells of postprocessing mesh.
812 */
813/*----------------------------------------------------------------------------*/
814
816cs_post_mesh_get_n_cells(int mesh_id);
817
818/*----------------------------------------------------------------------------*/
819/*
820 * \brief Get a postprocessing mesh's list of cells
821 *
822 * The array of cell ids must be of at least size
823 * cs_post_mesh_get_n_cells(mesh_id).
824 *
825 * \param[in] mesh_id postprocessing mesh id
826 * \param[out] cell_ids array of associated cell ids (0 to n-1 numbering,
827 * relative to main mesh)
828 */
829/*----------------------------------------------------------------------------*/
830
831void
832cs_post_mesh_get_cell_ids(int mesh_id,
833 cs_lnum_t *cell_ids);
834
835/*----------------------------------------------------------------------------*/
836/*
837 * \brief Get a postprocessing mesh's number of interior faces
838 *
839 * \param[in] mesh_id postprocessing mesh id
840 *
841 * \return number of cells of postprocessing mesh.
842 */
843/*----------------------------------------------------------------------------*/
844
846cs_post_mesh_get_n_i_faces(int mesh_id);
847
848/*----------------------------------------------------------------------------*/
849/*
850 * \brief Get a postprocessing mesh's list of boundary faces.
851 *
852 * The array of boundary face ids must be of at least size
853 * cs_post_mesh_get_n_b_faces(mesh_id).
854 *
855 * \param[in] mesh_id postprocessing mesh id
856 * \param[out] i_face_ids array of associated interior faces ids
857 * (0 to n-1 numbering, relative to main mesh)
858 */
859/*----------------------------------------------------------------------------*/
860
861void
863 cs_lnum_t i_face_ids[]);
864
865/*----------------------------------------------------------------------------*/
866/*
867 * \brief Get a postprocessing mesh's number of boundary faces
868 *
869 * \param[in] mesh_id postprocessing mesh id
870 *
871 * \return number of cells of postprocessing mesh.
872 */
873/*----------------------------------------------------------------------------*/
874
876cs_post_mesh_get_n_b_faces(int mesh_id);
877
878/*----------------------------------------------------------------------------*/
879/*
880 * \brief Get a postprocessing mesh's list of boundary faces.
881 *
882 * The array of boundary face ids must be of at least size
883 * cs_post_mesh_get_n_b_faces(mesh_id).
884 *
885 * \param[in] mesh_id postprocessing mesh id
886 * \param[out] b_face_ids array of associated boundary faces ids
887 * (0 to n-1 numbering, relative to main mesh)
888 */
889/*----------------------------------------------------------------------------*/
890
891void
893 cs_lnum_t b_face_ids[]);
894
895/*----------------------------------------------------------------------------*/
896/*
897 * \brief Get a postprocessing mesh's number of vertices
898 *
899 * \param[in] mesh_id postprocessing mesh id
900 *
901 * \return number of vertices of postprocessing mesh.
902 */
903/*----------------------------------------------------------------------------*/
904
906cs_post_mesh_get_n_vertices(int mesh_id);
907
908/*----------------------------------------------------------------------------*/
909/*
910 * \brief Get a postprocessing mesh's list of vertices
911 *
912 * The array of vertex ids must be of at least size
913 * cs_post_mesh_get_n_vertices(mesh_id).
914 *
915 * \param[in] mesh_id postprocessing mesh id
916 * \param[out] vertex_ids array of associated vertex ids (0 to n-1 numbering,
917 * relative to main mesh)
918 */
919/*----------------------------------------------------------------------------*/
920
921void
923 cs_lnum_t *vertex_ids);
924
925/*----------------------------------------------------------------------------*/
926/*
927 * \brief Set whether postprocessing mesh's parallel domain should be output.
928 *
929 * \param[in] mesh_id postprocessing mesh id
930 * \param[in] post_domain true if parallel domain should be output,
931 * false otherwise.
932 */
933/*----------------------------------------------------------------------------*/
934
935void
937 bool post_domain);
938
939/*----------------------------------------------------------------------------*/
940/*
941 * \brief Remove a post-processing mesh.
942 *
943 * No further post-processing output will be allowed on this mesh,
944 * so the associated structures may be freed.
945 *
946 * A post-processing mesh that has been associated with a time-varying
947 * writer may not be removed.
948 *
949 * \param[in] mesh_id postprocessing mesh id
950 */
951/*----------------------------------------------------------------------------*/
952
953void
954cs_post_free_mesh(int mesh_id);
955
956/*----------------------------------------------------------------------------*/
957/*
958 * \brief Check for the existence of a writer of the given id.
959 *
960 * \param[in] writer_id writer id to check
961 *
962 * \return true if writer with this id exists, false otherwise
963 */
964/*----------------------------------------------------------------------------*/
965
966bool
967cs_post_writer_exists(int writer_id);
968
969/*----------------------------------------------------------------------------*/
970/*
971 * \brief Check for the existence of a post-processing mesh of the given id.
972 *
973 * \param[in] mesh_id mesh id to check
974 *
975 * \return true if mesh with this id exists, false otherwise
976 */
977/*----------------------------------------------------------------------------*/
978
979bool
980cs_post_mesh_exists(int mesh_id);
981
982/*----------------------------------------------------------------------------*/
983/*
984 * \brief Find next mesh with a given category id
985 *
986 * \param[in] cat_id mesh category id filter
987 * \param[in] start_mesh_id O at start, then previously returned mesh id
988 *
989 * \return id of next mesh matching catogory, or 0 if none is found
990 */
991/*----------------------------------------------------------------------------*/
992
993int
995 int start_mesh_id);
996
997/*----------------------------------------------------------------------------*/
998/*
999 * \brief Return the default writer format name
1000 *
1001 * \return name of the default writer format
1002 */
1003/*----------------------------------------------------------------------------*/
1004
1005const char *
1007
1008/*----------------------------------------------------------------------------*/
1009/*
1010 * \brief Return the default writer format options
1011 *
1012 * \return default writer format options string
1013 */
1014/*----------------------------------------------------------------------------*/
1015
1016const char *
1018
1019/*----------------------------------------------------------------------------*/
1020/*
1021 * \brief Return the next "reservable" (i.e. non-user) writer id available.
1022 *
1023 * \return the smallest negative integer present, -1
1024 */
1025/*----------------------------------------------------------------------------*/
1026
1027int
1029
1030/*----------------------------------------------------------------------------*/
1031/*
1032 * \brief Return the next "reservable" (i.e. non-user) mesh id available.
1033 *
1034 * \return the smallest negative integer present, -1
1035 */
1036/*----------------------------------------------------------------------------*/
1037
1038int
1040
1041/*----------------------------------------------------------------------------*/
1042/*
1043 * \brief Update "active" or "inactive" flag of writers based on the time step.
1044 *
1045 * Writers are activated if their output interval is a divisor of the
1046 * current time step, or if their optional time step and value output lists
1047 * contain matches for the current time step.
1048 *
1049 * \param[in] ts time step status structure
1050 */
1051/*----------------------------------------------------------------------------*/
1052
1053void
1055
1056/*----------------------------------------------------------------------------*/
1057/*
1058 * \brief Query if a given writer is currently active.
1059 *
1060 * \param[in] writer_id writer id
1061 *
1062 * \return true if writer is active at this time step, false otherwise
1063 */
1064/*----------------------------------------------------------------------------*/
1065
1066bool
1067cs_post_writer_is_active(int writer_id);
1068
1069/*----------------------------------------------------------------------------*/
1070/*
1071 * \brief Force the "active" or "inactive" flag for a specific writer or for all
1072 * writers for the current time step.
1073 *
1074 * \param[in] writer_id writer id, or 0 for all writers
1075 * \param[in] activate false to deactivate, true to activate
1076 */
1077/*----------------------------------------------------------------------------*/
1078
1079void
1080cs_post_activate_writer(int writer_id,
1081 bool activate);
1082
1083/*----------------------------------------------------------------------------*/
1084/*
1085 * \brief Force the "active" or "inactive" flag for a specific writer or for all
1086 * writers for the current time step.
1087 *
1088 * This is ignored for writers which are currently disabled.
1089 *
1090 * \param[in] writer_id writer id, or 0 for all writers
1091 * \param[in] activate false to deactivate, true to activate
1092 */
1093/*----------------------------------------------------------------------------*/
1094
1095void
1097 bool activate);
1098
1099/*----------------------------------------------------------------------------*/
1100/*
1101 * \brief Disable specific writer or all writers not currently active until
1102 * \ref cs_post_enable_writer or \ref cs_post_activate_writer
1103 * is called for those writers.
1104 *
1105 * For each call to this function for a given writer, the same number
1106 * of calls to \ref cs_post_enable_writer or a single call to
1107 * \ref cs_post_activate_writer is required to re-enable the writer.
1108 *
1109 * This is useful to disable output even of fixed meshes in preprocessing
1110 * stages.
1111 *
1112 * \param[in] writer_id writer id, or 0 for all writers
1113 */
1114/*----------------------------------------------------------------------------*/
1115
1116void
1117cs_post_disable_writer(int writer_id);
1118
1119/*----------------------------------------------------------------------------*/
1120/*
1121 * \brief Enable a specific writer or all writers currently disabled by
1122 * previous calls to \ref cs_post_disable_writer.
1123 *
1124 * For each previous call to \ref cs_post_disable_writer for a given writer,
1125 * a call to this function (or a single call to \ref cs_post_activate_writer)
1126 * is required to re-enable the writer.
1127 *
1128 * This is useful to disable output even of fixed meshes in preprocessing
1129 * stages.
1130 *
1131 * \param[in] writer_id writer id, or 0 for all writers
1132 */
1133/*----------------------------------------------------------------------------*/
1134
1135void
1136cs_post_enable_writer(int writer_id);
1137
1138/*----------------------------------------------------------------------------*/
1139/*
1140 * \brief Return a pointer to the FVM writer associated to a writer_id.
1141 *
1142 * \param[in] writer_id associated writer id
1143 *
1144 * \return a pointer to a fvm_writer_t structure
1145 */
1146/*----------------------------------------------------------------------------*/
1147
1148fvm_writer_t *
1149cs_post_get_writer(int writer_id);
1150
1151/*----------------------------------------------------------------------------*/
1152/*
1153 * \brief Return a pointer to the time control associated to a writer_id.
1154 *
1155 * \param[in] writer_id associated writer id
1156 *
1157 * \return a pointer to a cs_time_control_t structure
1158 */
1159/*----------------------------------------------------------------------------*/
1160
1162cs_post_get_time_control(int writer_id);
1163
1164/*----------------------------------------------------------------------------*/
1165/*
1166 * \brief Return time dependency associated to a writer_id.
1167 *
1168 * \param[in] writer_id associated writer id
1169 *
1170 * \return associated writer's time dependency
1171 */
1172/*----------------------------------------------------------------------------*/
1173
1175cs_post_get_writer_time_dep(int writer_id);
1176
1177/*----------------------------------------------------------------------------*/
1178/*
1179 * \brief Add an activation time step for a specific writer or for all writers.
1180 *
1181 * If a negative value is provided, a previously added activation time
1182 * step matching that absolute value will be removed, if present.
1183 *
1184 * \param[in] writer_id writer id, or 0 for all writers
1185 * \param[in] nt time step value to add (or remove)
1186 */
1187/*----------------------------------------------------------------------------*/
1188
1189void
1190cs_post_add_writer_t_step(int writer_id,
1191 int nt);
1192
1193/*----------------------------------------------------------------------------*/
1194/*
1195 * \brief Add an activation time value for a specific writer or for all writers.
1196 *
1197 * If a negative value is provided, a previously added activation time
1198 * step matching that absolute value will be removed, if present.
1199 *
1200 * \param[in] writer_id writer id, or 0 for all writers
1201 * \param[in] t time value to add (or remove)
1202 */
1203/*----------------------------------------------------------------------------*/
1204
1205void
1206cs_post_add_writer_t_value(int writer_id,
1207 double t);
1208
1209/*----------------------------------------------------------------------------*/
1210/*
1211 * \brief Output post-processing meshes using associated writers.
1212 *
1213 * If the time step structure argument passed is NULL, a time-independent
1214 * output will be assumed.
1215 *
1216 * \param[in] ts time step status structure, or NULL
1217 */
1218/*----------------------------------------------------------------------------*/
1219
1220void
1222
1223/*----------------------------------------------------------------------------*/
1224/*
1225 * \brief Output a variable defined at cells or faces of a post-processing mesh
1226 * using associated writers.
1227 *
1228 * \param[in] mesh_id id of associated mesh
1229 * \param[in] writer_id id of specified associated writer,
1230 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1231 * \param[in] var_name name of variable to output
1232 * \param[in] var_dim 1 for scalar, 3 for vector, 6 for symmetric tensor,
1233 * 9 for non-symmetric tensor
1234 * \param[in] interlace if a vector, true for interlaced values,
1235 * false otherwise
1236 * \param[in] use_parent true if values are defined on "parent" mesh,
1237 * false if values are defined on post-processing mesh
1238 * \param[in] datatype variable's data type
1239 * \param[in] cel_vals cell values
1240 * \param[in] i_face_vals interior face values
1241 * \param[in] b_face_vals boundary face values
1242 * \param[in] ts time step status structure, or NULL
1243 */
1244/*----------------------------------------------------------------------------*/
1245
1246void
1247cs_post_write_var(int mesh_id,
1248 int writer_id,
1249 const char *var_name,
1250 int var_dim,
1251 bool interlace,
1252 bool use_parent,
1253 cs_datatype_t datatype,
1254 const void *cel_vals,
1255 const void *i_face_vals,
1256 const void *b_face_vals,
1257 const cs_time_step_t *ts);
1258
1259/*----------------------------------------------------------------------------*/
1260/*
1261 * \brief Output a function evaluation at cells or faces of a
1262 * post-processing mesh using associated writers.
1263 *
1264 * The associated mesh and function locations must have compatible types.
1265 *
1266 * Note that while providing functions for multiple mesh locations
1267 * (such as interior and boundary faces when a postprocessing mesh contains
1268 * both) is possible, it is not handled yet, so such cases will be ignored.
1269 *
1270 * \param[in] mesh_id id of associated mesh
1271 * \param[in] writer_id id of specified associated writer,
1272 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1273 * \param[in] cell_f pointer to function object at cells
1274 * \param[in] i_face_f pointer to function object at interior faces
1275 * \param[in] b_face_f pointer to function object at boundary faces
1276 * \param[in] ts time step status structure, or NULL
1277 */
1278/*----------------------------------------------------------------------------*/
1279
1280void
1281cs_post_write_function(int mesh_id,
1282 int writer_id,
1283 const cs_function_t *cel_f,
1284 const cs_function_t *i_face_f,
1285 const cs_function_t *b_face_f,
1286 const cs_time_step_t *ts);
1287
1288/*----------------------------------------------------------------------------*/
1289/*
1290 * \brief Output a variable defined at vertices of a post-processing mesh using
1291 * associated writers.
1292 *
1293 * \param[in] mesh_id id of associated mesh
1294 * \param[in] writer_id id of specified associated writer,
1295 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1296 * \param[in] var_name name of variable to output
1297 * \param[in] var_dim 1 for scalar, 3 for vector, 6 for symmetric tensor,
1298 * 9 for non-symmetric tensor
1299 * \param[in] interlace if a vector, true for interlaced values,
1300 * false otherwise
1301 * \param[in] use_parent true if values are defined on "parent" mesh,
1302 * false if values are defined on post-processing mesh
1303 * \param[in] datatype variable's data type
1304 * \param[in] vtx_vals vertex values
1305 * \param[in] ts time step status structure, or NULL
1306 */
1307/*----------------------------------------------------------------------------*/
1308
1309void
1310cs_post_write_vertex_var(int mesh_id,
1311 int writer_id,
1312 const char *var_name,
1313 int var_dim,
1314 bool interlace,
1315 bool use_parent,
1316 cs_datatype_t datatype,
1317 const void *vtx_vals,
1318 const cs_time_step_t *ts);
1319
1320/*----------------------------------------------------------------------------*/
1321/*
1322 * \brief Output a function evaluation at cells or faces of a
1323 * post-processing mesh using associated writers.
1324 *
1325 * The associated mesh and function locations must have compatible types.
1326 *
1327 * \param[in] mesh_id id of associated mesh
1328 * \param[in] writer_id id of specified associated writer,
1329 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1330 * \param[in] f pointer to function object at vertices
1331 * \param[in] ts time step status structure, or NULL
1332 */
1333/*----------------------------------------------------------------------------*/
1334
1335void
1337 int writer_id,
1338 const cs_function_t *f,
1339 const cs_time_step_t *ts);
1340
1341/*----------------------------------------------------------------------------*/
1342/*
1343 * \brief Output an existing lagrangian particle attribute at particle
1344 * positions or trajectory endpoints of a particle mesh using
1345 * associated writers.
1346 *
1347 * \param[in] mesh_id id of associated mesh
1348 * \param[in] writer_id id of specified associated writer,
1349 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1350 * \param[in] attr_id associated particle attribute id
1351 * \param[in] var_name name of variable to output
1352 * \param[in] component_id if -1 : extract the whole attribute
1353 * if >0 : id of the component to extract
1354 * \param[in] ts time step status structure, or NULL
1355 */
1356/*----------------------------------------------------------------------------*/
1357
1358void
1360 int writer_id,
1361 int attr_id,
1362 const char *var_name,
1363 int component_id,
1364 const cs_time_step_t *ts);
1365
1366/*----------------------------------------------------------------------------*/
1367/*
1368 * \brief Output a variable defined at cells or faces of a post-processing mesh
1369 * using associated writers.
1370 *
1371 * \param[in] mesh_id id of associated mesh
1372 * \param[in] writer_id id of specified associated writer,
1373 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1374 * \param[in] var_name name of variable to output
1375 * \param[in] var_dim 1 for scalar, 3 for vector, 6 for symmetric
1376 * tensor, 9 for non-symmetric tensor
1377 * \param[in] datatype variable's data type
1378 * \param[in] parent_location_id asociated values mesh location, or 0
1379 * if values are passed directly
1380 * \param[in] interpolate_func pointer to interpolation function,
1381 * or NULL for default
1382 * \param[in] interpolate_input pointer to optional interpolation input
1383 * data, or NULL for default
1384 * \param[in] vals variable's values
1385 * \param[in] ts time step status structure, or NULL
1386 */
1387/*----------------------------------------------------------------------------*/
1388
1389void
1390cs_post_write_probe_values(int mesh_id,
1391 int writer_id,
1392 const char *var_name,
1393 int var_dim,
1394 cs_datatype_t datatype,
1395 int parent_location_id,
1396 cs_interpolate_from_location_t *interpolate_func,
1397 void *interpolate_input,
1398 const void *vals,
1399 const cs_time_step_t *ts);
1400
1401/*----------------------------------------------------------------------------*/
1402/*
1403 * \brief Output function-evaluated values at cells or faces of a
1404 * post-processing probe set using associated writers.
1405 *
1406 * - For real-valued data with interpolation, the function is evaluated on the
1407 * whole parent domain so as to be able to compute gradients, then
1408 * interpolate on the probe set.
1409 * * For vertex-based values, a lighter, cell-based interpolation would
1410 * be feasible, but is not available yet.
1411 * * For cell or face-based values, likewise, only the immediate neighborhood
1412 * of elements containing probes are needed, but such filtering would
1413 * require building the matching element list and adding an indirection
1414 * to the gradients computation.
1415 *
1416 * - In the specific case where the function evaluation uses an analytic
1417 * function, to which the exact coordinates are provides, such interpolation
1418 * is not deemed necessary, as the anaytic function may handle this more
1419 * efficiently.
1420 *
1421 * - For non-real-based values, or real-based values other than cs_real_t,
1422 * no interpolation is performed
1423 *
1424 * \param[in] mesh_id id of associated mesh
1425 * \param[in] writer_id id of specified associated writer,
1426 * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1427 * \param[in] f pointer to associated function object
1428 * \param[in] parent_location_id associated values at mesh location, or 0
1429 * if values are passed directly
1430 * \param[in] interpolate_func pointer to interpolation function,
1431 * or NULL for default
1432 * \param[in] interpolate_input pointer to optional interpolation input
1433 * data, or NULL for default
1434 * \param[in] ts time step status structure, or NULL
1435 */
1436/*----------------------------------------------------------------------------*/
1437
1438void
1440 int writer_id,
1441 const cs_function_t *f,
1442 int parent_location_id,
1443 cs_interpolate_from_location_t *interpolate_func,
1444 void *interpolate_input,
1445 const cs_time_step_t *ts);
1446
1447/*----------------------------------------------------------------------------*/
1448/*
1449 * \brief Update references to parent mesh of post-processing meshes in case of
1450 * computational mesh cell renumbering.
1451 *
1452 * This function may be called only once, after possible renumbering of cells,
1453 * to update existing post-processing meshes. Post-processing meshes defined
1454 * after renumbering will automatically be based upon the new numbering,
1455 * so this function will not need to be called again.
1456 *
1457 * \param[in] init_cell_num initial cell numbering (new -> old)
1458 */
1459/*----------------------------------------------------------------------------*/
1460
1461void
1462cs_post_renum_cells(const cs_lnum_t init_cell_num[]);
1463
1464/*----------------------------------------------------------------------------*/
1465/*
1466 * \brief Update references to parent mesh of post-processing meshes in case of
1467 * computational mesh interior and/or boundary faces renumbering.
1468 *
1469 * This function may be called only once, after possible renumbering of faces,
1470 * to update existing post-processing meshes. Post-processing meshes defined
1471 * after renumbering will automatically be based upon the new numbering,
1472 * so this function will not need to be called again.
1473 *
1474 * \param[in] init_i_face_num initial interior numbering (new -> old)
1475 * \param[in] init_b_face_num initial boundary numbering (new -> old)
1476 */
1477/*----------------------------------------------------------------------------*/
1478
1479void
1480cs_post_renum_faces(const cs_lnum_t init_i_face_num[],
1481 const cs_lnum_t init_b_face_num[]);
1482
1483/*----------------------------------------------------------------------------*/
1484/*
1485 * \brief Configure the post-processing output so that mesh connectivity
1486 * may be automatically updated.
1487 *
1488 * This is done for meshes defined using selection criteria or functions.
1489 * The behavior of Lagrangian meshes is unchanged.
1490 *
1491 * To be effective, this function should be called before defining
1492 * postprocessing meshes.
1493 */
1494/*----------------------------------------------------------------------------*/
1495
1496void
1498
1499/*----------------------------------------------------------------------------*/
1503/*----------------------------------------------------------------------------*/
1504
1505void
1507
1508/*----------------------------------------------------------------------------*/
1509/*
1510 * \brief Initialize main post-processing meshes
1511 *
1512 * The check_flag variable is a mask, used for additionnal post-processing:
1513 *
1514 * - If (check_flag & 1), volume submeshes are output by groups if more
1515 * than one group is present and the default writer uses the EnSight format.
1516 *
1517 * - If (check_flag & 2), boundary submeshes are output by groups if more
1518 * than one group is present and the default writer uses the EnSight format.
1519 *
1520 * It is recommended that post-processing meshes be defined before calling
1521 * this function, though specific "automatic" meshes (for example those
1522 * related to couplings) may be defined between this call and a time loop.
1523 *
1524 * \param[in] check_mask mask used for additional output
1525 */
1526/*----------------------------------------------------------------------------*/
1527
1528void
1529cs_post_init_meshes(int check_mask);
1530
1531/*----------------------------------------------------------------------------*/
1532/*
1533 * \brief Check if post-processing is activated and then update post-processing
1534 * of meshes if there is a need to update time-dependent meshes
1535 *
1536 * \param[in] ts time step status structure, or NULL
1537 */
1538/*----------------------------------------------------------------------------*/
1539
1540void
1542
1543/*----------------------------------------------------------------------------*/
1544/*
1545 * \brief Loop on post-processing meshes to output variables.
1546 *
1547 * This handles all default fields output, as well as all
1548 * registered output functions and outputs defined in
1549 * \ref cs_user_postprocess_values
1550 *
1551 * \param[in] ts time step status structure, or NULL
1552 */
1553/*----------------------------------------------------------------------------*/
1554
1555void
1557
1558/*----------------------------------------------------------------------------*/
1559/*
1560 * \brief Flush writers and free time-varying and Lagragian mesh if needed
1561 * of meshes if there is a time-dependent mesh
1562 */
1563/*----------------------------------------------------------------------------*/
1564
1565void
1567
1568/*----------------------------------------------------------------------------*/
1569/*
1570 * \brief Loop on post-processing meshes to output variables.
1571 *
1572 * This handles all default fields output, as well as all
1573 * registered output functions and outputs defined in
1574 * \ref cs_user_postprocess_values
1575 *
1576 * \param[in] ts time step status structure, or NULL
1577 */
1578/*----------------------------------------------------------------------------*/
1579
1580void
1582
1583/*----------------------------------------------------------------------------*/
1584/*
1585 * \brief Destroy all structures associated with post-processing
1586 */
1587/*----------------------------------------------------------------------------*/
1588
1589void
1590cs_post_finalize(void);
1591
1592/*----------------------------------------------------------------------------*/
1593/*
1594 * \brief Postprocess free (isolated) faces of the current global mesh
1595 */
1596/*----------------------------------------------------------------------------*/
1597
1598void
1600
1601/*----------------------------------------------------------------------------*/
1602/*
1603 * \brief Initialize post-processing writer with same format and associated
1604 * options as default writer, but no time dependency, intended to
1605 * troubleshoot errors.
1606 */
1607/*----------------------------------------------------------------------------*/
1608
1609void
1611
1612/*----------------------------------------------------------------------------*/
1613/*
1614 * \brief Initialize post-processing writer with same format and associated
1615 * options as default writer, but no time dependency, and associate
1616 * and output global volume mesh.
1617 *
1618 * This is intended to help troubleshoot errors using fields based
1619 * on cells.
1620 *
1621 * \return id of error output mesh (< 0), or 0 if all writers are deactivated
1622 */
1623/*----------------------------------------------------------------------------*/
1624
1625int
1627
1628/*----------------------------------------------------------------------------*/
1629/*
1630 * \brief Register a processing of time-dependent variables to the call to
1631 * cs_post_write_vars().
1632 *
1633 * Note: if the input pointer is non-null, it must point to valid data
1634 * when the output function is called, so either:
1635 * - that value or structure should not be temporary (i.e. local);
1636 * - post-processing output must be ensured using cs_post_write_var()
1637 * or similar before the data pointed to goes out of scope.
1638 *
1639 * \param[in] function function to register
1640 * \param[in, out] input pointer to optional (untyped) value or structure
1641 */
1642/*----------------------------------------------------------------------------*/
1643
1644void
1646 void *input);
1647
1648/*----------------------------------------------------------------------------*/
1649/*
1650 * \brief Register a processing of time-dependent variables than can be output
1651 * on different meshes to the call to cs_post_write_vars().
1652 *
1653 * Note: if the input pointer is non-null, it must point to valid data
1654 * when the output function is called, so either:
1655 * - that value or structure should not be temporary (i.e. local);
1656 * - post-processing output must be ensured using cs_post_write_var()
1657 * or similar before the data pointed to goes out of scope.
1658 *
1659 * \param[in] function function to register
1660 * \param[in, out] input pointer to optional (untyped) value or structure
1661 */
1662/*----------------------------------------------------------------------------*/
1663
1664void
1666 void *input);
1667
1668/*----------------------------------------------------------------------------*/
1669
1670#endif /* CS_POST_H */
Definition: cs_time_control.h:92
time step descriptor
Definition: cs_time_step.h:60
cs_datatype_t
Definition: cs_defs.h:290
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
@ t
Definition: cs_field_pointer.h:91
void() cs_interpolate_from_location_t(void *input, cs_datatype_t datatype, int val_dim, cs_lnum_t n_points, const cs_lnum_t point_location[], const cs_real_3_t point_coords[], const void *location_vals, void *point_vals)
Function pointer for interpolatation of values defined on a mesh location at a given set of points.
Definition: cs_interpolate.h:67
const char * cs_post_get_default_format_options(void)
Return the default writer format options.
Definition: cs_post.cpp:5806
int cs_post_get_free_mesh_id(void)
Return the next "reservable" (i.e. non-user) mesh id available.
Definition: cs_post.cpp:5834
void cs_post_mesh_get_b_face_ids(int mesh_id, cs_lnum_t b_face_ids[])
Get a postprocessing mesh's list of boundary faces.
Definition: cs_post.cpp:5520
void cs_post_write_probe_values(int mesh_id, int writer_id, const char *var_name, int var_dim, cs_datatype_t datatype, int parent_location_id, cs_interpolate_from_location_t *interpolate_func, void *interpolate_input, const void *vals, const cs_time_step_t *ts)
Output a variable defined at cells or faces of a post-processing mesh using associated writers.
Definition: cs_post.cpp:7158
void cs_post_define_existing_mesh(int mesh_id, fvm_nodal_t *exp_mesh, int dim_shift, bool transfer, bool auto_variables, bool child_of_global, int n_writers, const int writer_ids[])
Create a post-processing mesh associated with an existing exportable mesh representation.
Definition: cs_post.cpp:4796
void cs_post_time_step_output(const cs_time_step_t *ts)
Loop on post-processing meshes to output variables.
Definition: cs_post.cpp:7956
void cs_post_assign_existing_mesh(int mesh_id, fvm_nodal_t *exp_mesh, int dim_shift, bool transfer)
Update a post-processing mesh created with cs_post_define_future_mesh with an existing exportable mes...
Definition: cs_post.cpp:5033
void cs_post_add_time_mesh_dep_output(cs_post_time_mesh_dep_output_t *function, void *input)
Register a processing of time-dependent variables than can be output on different meshes to the call ...
Definition: cs_post.cpp:8762
int cs_post_get_free_writer_id(void)
Return the next "reservable" (i.e. non-user) writer id available.
Definition: cs_post.cpp:5820
void cs_post_init_error_writer(void)
Initialize post-processing writer with same format and associated options as default writer,...
Definition: cs_post.cpp:8629
void cs_post_add_writer_t_step(int writer_id, int nt)
Add an activation time step for a specific writer or for all writers.
Definition: cs_post.cpp:6167
void cs_post_renum_faces(const cs_lnum_t init_i_face_num[], const cs_lnum_t init_b_face_num[])
Update references to parent mesh of post-processing meshes in case of computational mesh interior and...
Definition: cs_post.cpp:7538
void cs_post_init_meshes(int check_mask)
Initialize main post-processing meshes.
Definition: cs_post.cpp:7763
void cs_post_add_free_faces(void)
Postprocess free (isolated) faces of the current global mesh.
Definition: cs_post.cpp:8418
void cs_post_time_step_begin(const cs_time_step_t *ts)
Check if post-processing is activated and then update post-processing of meshes if there is a need to...
Definition: cs_post.cpp:7923
void() cs_post_time_mesh_dep_output_t(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_ids[], const cs_lnum_t i_face_ids[], const cs_lnum_t b_face_ids[], const cs_time_step_t *ts)
Definition: cs_post.h:180
void cs_post_finalize(void)
Destroy all structures associated with post-processing.
Definition: cs_post.cpp:8323
void cs_post_define_mesh_by_location(int mesh_id, const char *mesh_name, int location_id, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
Define a volume or surface post-processing mesh by associated mesh location id.
Definition: cs_post.cpp:4558
void cs_post_define_volume_mesh(int mesh_id, const char *mesh_name, const char *cell_criteria, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
Define a volume post-processing mesh.
Definition: cs_post.cpp:4312
void cs_post_define_volume_mesh_by_func(int mesh_id, const char *mesh_name, cs_post_elt_select_t *cell_select_func, void *cell_select_input, bool time_varying, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
Define a volume post-processing mesh using a selection function.
Definition: cs_post.cpp:4377
void cs_post_mesh_get_vertex_ids(int mesh_id, cs_lnum_t *vertex_ids)
Get a postprocessing mesh's list of vertices.
Definition: cs_post.cpp:5589
void cs_post_write_vertex_var(int mesh_id, int writer_id, const char *var_name, int var_dim, bool interlace, bool use_parent, cs_datatype_t datatype, const void *vtx_vals, const cs_time_step_t *ts)
Output a variable defined at vertices of a post-processing mesh using associated writers.
Definition: cs_post.cpp:6762
void cs_post_write_particle_values(int mesh_id, int writer_id, int attr_id, const char *var_name, int component_id, const cs_time_step_t *ts)
Output an existing lagrangian particle attribute at particle positions or trajectory endpoints of a p...
Definition: cs_post.cpp:6995
cs_lnum_t cs_post_mesh_get_n_vertices(int mesh_id)
Get a postprocessing mesh's number of vertices.
Definition: cs_post.cpp:5559
cs_time_control_t * cs_post_get_time_control(int writer_id)
Return a pointer to the time control associated to a writer_id.
Definition: cs_post.cpp:6117
void cs_post_define_1d_thermal_mesh(int mesh_id, bool time_varying, bool auto_variable, int n_writers, const int writer_ids[])
Define 1D mesh for the 1D wall thermal module.
Definition: cs_post.cpp:4744
fvm_writer_t * cs_post_get_writer(int writer_id)
Return a pointer to the FVM writer associated to a writer_id.
Definition: cs_post.cpp:6092
void cs_post_define_particles_mesh_by_func(int mesh_id, const char *mesh_name, cs_post_elt_select_t *p_select_func, void *p_select_input, bool trajectory, bool auto_variables, int n_writers, const int writer_ids[])
Define a particles post-processing mesh using a selection function.
Definition: cs_post.cpp:4703
void cs_post_write_var(int mesh_id, int writer_id, const char *var_name, int var_dim, bool interlace, bool use_parent, cs_datatype_t datatype, const void *cel_vals, const void *i_face_vals, const void *b_face_vals, const cs_time_step_t *ts)
Output a variable defined at cells or faces of a post-processing mesh using associated writers.
Definition: cs_post.cpp:6279
void cs_post_write_meshes(const cs_time_step_t *ts)
Output post-processing meshes using associated writers.
Definition: cs_post.cpp:6222
int cs_post_init_error_writer_cells(void)
Initialize post-processing writer with same format and associated options as default writer,...
Definition: cs_post.cpp:8679
bool cs_post_writer_exists(int writer_id)
Check for the existence of a writer of the given id.
Definition: cs_post.cpp:5701
void cs_post_write_vertex_function(int mesh_id, int writer_id, const cs_function_t *f, const cs_time_step_t *ts)
Output a function evaluation at cells or faces of a post-processing mesh using associated writers.
Definition: cs_post.cpp:6881
void cs_post_set_changing_connectivity(void)
Configure the post-processing output so that mesh connectivity may be automatically updated.
Definition: cs_post.cpp:7637
void cs_post_define_writer(int writer_id, const char *case_name, const char *dir_name, const char *fmt_name, const char *fmt_opts, fvm_writer_time_dep_t time_dep, bool output_at_start, bool output_at_end, int interval_n, double interval_t)
Define a writer; this objects manages a case's name, directory, and format, as well as associated mes...
Definition: cs_post.cpp:4159
void cs_post_define_particles_mesh(int mesh_id, const char *mesh_name, const char *cell_criteria, double density, bool trajectory, bool auto_variables, int n_writers, const int writer_ids[])
Define a particles post-processing mesh.
Definition: cs_post.cpp:4635
void cs_post_write_probe_function(int mesh_id, int writer_id, const cs_function_t *f, int parent_location_id, cs_interpolate_from_location_t *interpolate_func, void *interpolate_input, const cs_time_step_t *ts)
Output function-evaluated values at cells or faces of a post-processing probe set using associated wr...
Definition: cs_post.cpp:7296
const char * cs_post_get_default_format(void)
Return the default writer format name.
Definition: cs_post.cpp:5792
cs_lnum_t cs_post_mesh_get_n_cells(int mesh_id)
Get a postprocessing mesh's number of cells.
Definition: cs_post.cpp:5363
void cs_post_write_vars(const cs_time_step_t *ts)
Loop on post-processing meshes to output variables.
Definition: cs_post.cpp:8301
void cs_post_add_time_dep_output(cs_post_time_dep_output_t *function, void *input)
Register a processing of time-dependent variables to the call to cs_post_write_vars().
Definition: cs_post.cpp:8721
cs_lnum_t cs_post_mesh_get_n_b_faces(int mesh_id)
Get a postprocessing mesh's number of boundary faces.
Definition: cs_post.cpp:5490
cs_datatype_t cs_post_type_t
Definition: cs_post.h:92
void cs_post_add_writer_t_value(int writer_id, double t)
Add an activation time value for a specific writer or for all writers.
Definition: cs_post.cpp:6195
void cs_post_mesh_set_post_domain(int mesh_id, bool post_domain)
Set whether postprocessing mesh's parallel domain should be output.
Definition: cs_post.cpp:5614
void() cs_post_time_dep_output_t(void *input, const cs_time_step_t *ts)
Definition: cs_post.h:146
void cs_post_activate_by_time_step(const cs_time_step_t *ts)
Update "active" or "inactive" flag of writers based on the time step.
Definition: cs_post.cpp:5852
void cs_post_activate_writer_if_enabled(int writer_id, bool activate)
Force the "active" or "inactive" flag for a specific writer or for all writers for the current time s...
Definition: cs_post.cpp:5986
void cs_post_mesh_get_cell_ids(int mesh_id, cs_lnum_t *cell_ids)
Get a postprocessing mesh's list of cells.
Definition: cs_post.cpp:5393
void cs_post_define_future_mesh(int mesh_id, int cat_id, bool auto_variables, int n_writers, const int writer_ids[])
Create a post-processing mesh associated with an exportable mesh representation that will be built la...
Definition: cs_post.cpp:4971
void cs_post_write_function(int mesh_id, int writer_id, const cs_function_t *cel_f, const cs_function_t *i_face_f, const cs_function_t *b_face_f, const cs_time_step_t *ts)
Output a function evaluation at cells or faces of a post-processing mesh using associated writers.
Definition: cs_post.cpp:6549
void() cs_post_elt_select_t(void *input, cs_lnum_t *n_elts, cs_lnum_t **elt_list)
Function pointer to elements selection definition.
Definition: cs_post.h:123
void cs_post_disable_writer(int writer_id)
Disable specific writer or all writers not currently active until cs_post_enable_writer or cs_post_ac...
Definition: cs_post.cpp:6024
void cs_post_free_mesh(int mesh_id)
Remove a post-processing mesh.
Definition: cs_post.cpp:5637
void cs_post_activate_writer(int writer_id, bool activate)
Force the "active" or "inactive" flag for a specific writer or for all writers for the current time s...
Definition: cs_post.cpp:5957
void cs_post_define_surface_mesh(int mesh_id, const char *mesh_name, const char *i_face_criteria, const char *b_face_criteria, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
Define a surface post-processing mesh.
Definition: cs_post.cpp:4424
void cs_post_mesh_detach_writer(int mesh_id, int writer_id)
De-associate a writer from a postprocessing mesh.
Definition: cs_post.cpp:5215
void cs_post_mesh_get_i_face_ids(int mesh_id, cs_lnum_t i_face_ids[])
Get a postprocessing mesh's list of boundary faces.
Definition: cs_post.cpp:5448
void cs_post_define_edges_mesh(int mesh_id, int base_mesh_id, int n_writers, const int writer_ids[])
Create a mesh based upon the extraction of edges from an existing mesh.
Definition: cs_post.cpp:5098
void cs_post_mesh_attach_field(int mesh_id, int writer_id, int field_id, int comp_id)
Associate a field to a writer and postprocessing mesh combination.
Definition: cs_post.cpp:5279
cs_lnum_t cs_post_mesh_get_n_i_faces(int mesh_id)
Get a postprocessing mesh's number of interior faces.
Definition: cs_post.cpp:5418
void cs_post_time_step_end(void)
Flush writers and free time-varying and Lagragian mesh if needed of meshes if there is a time-depende...
Definition: cs_post.cpp:8257
void cs_post_renum_cells(const cs_lnum_t init_cell_num[])
Update references to parent mesh of post-processing meshes in case of computational mesh cell renumbe...
Definition: cs_post.cpp:7463
const int * cs_post_mesh_get_ent_flag(int mesh_id)
Get a postprocessing meshes entity presence flag.
Definition: cs_post.cpp:5345
void cs_post_define_surface_mesh_by_func(int mesh_id, const char *mesh_name, cs_post_elt_select_t *i_face_select_func, cs_post_elt_select_t *b_face_select_func, void *i_face_select_input, void *b_face_select_input, bool time_varying, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
Define a surface post-processing mesh using selection functions.
Definition: cs_post.cpp:4501
int cs_post_mesh_find_next_with_cat_id(int cat_id, int start_mesh_id)
Find next mesh with a given category id.
Definition: cs_post.cpp:5758
void cs_post_init_writers(void)
Initialize post-processing writers.
Definition: cs_post.cpp:7649
void cs_post_mesh_attach_writer(int mesh_id, int writer_id)
Associate a writer to a postprocessing mesh.
Definition: cs_post.cpp:5170
void cs_post_mesh_set_element_centers_only(int mesh_id, bool centers_only)
Set restriction of a postprocessing mesh to element centers.
Definition: cs_post.cpp:5142
void cs_post_enable_writer(int writer_id)
Enable a specific writer or all writers currently disabled by previous calls to cs_post_disable_write...
Definition: cs_post.cpp:6061
bool cs_post_writer_is_active(int writer_id)
Query if a given writer is currently active.
Definition: cs_post.cpp:5938
bool cs_post_mesh_exists(int mesh_id)
Check for the existence of a post-processing mesh of the given id.
Definition: cs_post.cpp:5730
fvm_writer_time_dep_t cs_post_get_writer_time_dep(int writer_id)
Return time dependency associated to a writer_id.
Definition: cs_post.cpp:6136
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
Definition: cs_function.h:117