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