8.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-2023 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 #include "cs_defs.h"
31 
32 /*----------------------------------------------------------------------------
33  * Standard C library headers
34  *----------------------------------------------------------------------------*/
35 
36 /*----------------------------------------------------------------------------
37  * Local headers
38  *----------------------------------------------------------------------------*/
39 
40 #include "fvm_nodal.h"
41 #include "fvm_writer.h"
42 
43 #include "cs_base.h"
44 #include "cs_function.h"
45 #include "cs_interpolate.h"
46 #include "cs_probe.h"
47 #include "cs_time_step.h"
48 #include "cs_time_control.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 */
67 
68 /* Default writer ids and filters */
69 
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 */
81 
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) */
98 
100 
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 BFT_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 
129 typedef 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 
152 typedef 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 
186 typedef 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 
294 void
295 cs_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 
321 void
322 cs_post_define_volume_mesh(int mesh_id,
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 
359 void
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 
386 void
387 cs_post_define_surface_mesh(int mesh_id,
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 
429 void
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 
458 void
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 
494 void
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 
536 void
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 
578 void
579 cs_post_define_existing_mesh(int mesh_id,
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 /*----------------------------------------------------------------------------*/
588 /*
589  * \brief Create a mesh based upon the extraction of edges from an existing mesh.
590  *
591  * The newly created edges have no link to their parent elements, so
592  * no variable referencing parent elements may be output to this mesh,
593  * whose main use is to visualize "true" face edges when polygonal faces
594  * are subdivided by the writer. In this way, even highly non-convex
595  * faces may be visualized correctly if their edges are overlaid on
596  * the surface mesh with subdivided polygons.
597  *
598  * \param[in] mesh_id id of edges mesh to create
599  * (< 0 reserved, > 0 for user)
600  * \param[in] base_mesh_id id of existing mesh (< 0 reserved, > 0 for user)
601  * \param[in] n_writers number of associated writers
602  * \param[in] writer_ids ids of associated writers
603  */
604 /*----------------------------------------------------------------------------*/
605 
606 void
607 cs_post_define_edges_mesh(int mesh_id,
608  int base_mesh_id,
609  int n_writers,
610  const int writer_ids[]);
611 
612 /*----------------------------------------------------------------------------*/
613 /*
614  * \brief Set restriction of a postprocessing mesh to element centers
615  *
616  * This allow simply using element centers instead of full representations.
617  *
618  * This function must be called during the postprocessing output definition
619  * stage, before any output actually occurs.
620  *
621  * If called with a non-existing mesh or writer id, or if the writer was not
622  * previously associated, no setting is changed, and this function
623  * returns silently.
624  *
625  * \param[in] mesh_id id of mesh to define
626  * (< 0 reserved, > 0 for user)
627  * \param[in] centers_only true if only element centers sould be output,
628  * false fo normal connectivity.
629  */
630 /*----------------------------------------------------------------------------*/
631 
632 void
634  bool centers_only);
635 
636 /*----------------------------------------------------------------------------*/
637 /*
638  * \brief Associate a writer to a postprocessing mesh.
639  *
640  * This function must be called during the postprocessing output definition
641  * stage, before any output actually occurs.
642  *
643  * If called with a non-existing mesh or writer id, or if the writer is
644  * already associated, no setting is changed, and this function
645  * returns silently.
646  *
647  * \param[in] mesh_id id of mesh to define
648  * (< 0 reserved, > 0 for user)
649  * \param[in] writer_id id of writer to associate
650  */
651 /*----------------------------------------------------------------------------*/
652 
653 void
654 cs_post_mesh_attach_writer(int mesh_id,
655  int writer_id);
656 
657 /*----------------------------------------------------------------------------*/
658 /*
659  * \brief De-associate a writer from a postprocessing mesh.
660  *
661  * This function must be called during the postprocessing output definition
662  * stage, before any output actually occurs.
663  *
664  * If called with a non-existing mesh or writer id, or if the writer was not
665  * previously associated, no setting is changed, and this function
666  * returns silently.
667  *
668  * \param[in] mesh_id id of mesh to define
669  * (< 0 reserved, > 0 for user)
670  * \param[in] writer_id id of writer to associate
671  */
672 /*----------------------------------------------------------------------------*/
673 
674 void
675 cs_post_mesh_detach_writer(int mesh_id,
676  int writer_id);
677 
678 /*----------------------------------------------------------------------------*/
679 /*
680  * \brief Associate a field to a writer and postprocessing mesh combination.
681  *
682  * This function must be called during the postprocessing output definition
683  * stage, before any output actually occurs.
684  *
685  * If the field should already be output automatically based on the mesh
686  * category and field output keywords, it will not be added.
687  *
688  * \param[in] mesh_id id of associated mesh
689  * \param[in] writer_id id of specified associated writer,
690  * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
691  * \param[in] field_id id of field to attach
692  * \param[in] comp_id id of field component (-1 for all)
693  */
694 /*----------------------------------------------------------------------------*/
695 
696 void
697 cs_post_mesh_attach_field(int mesh_id,
698  int writer_id,
699  int field_id,
700  int comp_id);
701 
702 /*----------------------------------------------------------------------------*/
703 /*
704  * \brief Get a postprocessing meshes entity presence flag.
705  *
706  * This flag is an array of 5 integers, indicating the presence of elements
707  * of given types on at least one subdomain (i.e. rank):
708  * 0: presence of cells
709  * 1: presence of interior faces
710  * 2: presence of boundary faces
711  * 3: presence of particles
712  * 4: presence of probes
713  *
714  * \param[in] mesh_id postprocessing mesh id
715  *
716  * \return pointer to entity presence flag
717  */
718 /*----------------------------------------------------------------------------*/
719 
720 const int *
721 cs_post_mesh_get_ent_flag(int mesh_id);
722 
723 /*----------------------------------------------------------------------------*/
724 /*
725  * \brief Get a postprocessing mesh's number of cells
726  *
727  * \param[in] mesh_id postprocessing mesh id
728  *
729  * \return number of cells of postprocessing mesh.
730  */
731 /*----------------------------------------------------------------------------*/
732 
733 cs_lnum_t
734 cs_post_mesh_get_n_cells(int mesh_id);
735 
736 /*----------------------------------------------------------------------------*/
737 /*
738  * \brief Get a postprocessing mesh's list of cells
739  *
740  * The array of cell ids must be of at least size
741  * cs_post_mesh_get_n_cells(mesh_id).
742  *
743  * \param[in] mesh_id postprocessing mesh id
744  * \param[out] cell_ids array of associated cell ids (0 to n-1 numbering,
745  * relative to main mesh)
746  */
747 /*----------------------------------------------------------------------------*/
748 
749 void
750 cs_post_mesh_get_cell_ids(int mesh_id,
751  cs_lnum_t *cell_ids);
752 
753 /*----------------------------------------------------------------------------*/
754 /*
755  * \brief Get a postprocessing mesh's number of interior faces
756  *
757  * \param[in] mesh_id postprocessing mesh id
758  *
759  * \return number of cells of postprocessing mesh.
760  */
761 /*----------------------------------------------------------------------------*/
762 
763 cs_lnum_t
764 cs_post_mesh_get_n_i_faces(int mesh_id);
765 
766 /*----------------------------------------------------------------------------*/
767 /*
768  * \brief Get a postprocessing mesh's list of boundary faces.
769  *
770  * The array of boundary face ids must be of at least size
771  * cs_post_mesh_get_n_b_faces(mesh_id).
772  *
773  * \param[in] mesh_id postprocessing mesh id
774  * \param[out] i_face_ids array of associated interior faces ids
775  * (0 to n-1 numbering, relative to main mesh)
776  */
777 /*----------------------------------------------------------------------------*/
778 
779 void
780 cs_post_mesh_get_i_face_ids(int mesh_id,
781  cs_lnum_t i_face_ids[]);
782 
783 /*----------------------------------------------------------------------------*/
784 /*
785  * \brief Get a postprocessing mesh's number of boundary faces
786  *
787  * \param[in] mesh_id postprocessing mesh id
788  *
789  * \return number of cells of postprocessing mesh.
790  */
791 /*----------------------------------------------------------------------------*/
792 
793 cs_lnum_t
794 cs_post_mesh_get_n_b_faces(int mesh_id);
795 
796 /*----------------------------------------------------------------------------*/
797 /*
798  * \brief Get a postprocessing mesh's list of boundary faces.
799  *
800  * The array of boundary face ids must be of at least size
801  * cs_post_mesh_get_n_b_faces(mesh_id).
802  *
803  * \param[in] mesh_id postprocessing mesh id
804  * \param[out] b_face_ids array of associated boundary faces ids
805  * (0 to n-1 numbering, relative to main mesh)
806  */
807 /*----------------------------------------------------------------------------*/
808 
809 void
810 cs_post_mesh_get_b_face_ids(int mesh_id,
811  cs_lnum_t b_face_ids[]);
812 
813 /*----------------------------------------------------------------------------*/
814 /*
815  * \brief Get a postprocessing mesh's number of vertices
816  *
817  * \param[in] mesh_id postprocessing mesh id
818  *
819  * \return number of vertices of postprocessing mesh.
820  */
821 /*----------------------------------------------------------------------------*/
822 
823 cs_lnum_t
824 cs_post_mesh_get_n_vertices(int mesh_id);
825 
826 /*----------------------------------------------------------------------------*/
827 /*
828  * \brief Get a postprocessing mesh's list of vertices
829  *
830  * The array of vertex ids must be of at least size
831  * cs_post_mesh_get_n_vertices(mesh_id).
832  *
833  * \param[in] mesh_id postprocessing mesh id
834  * \param[out] vertex_ids array of associated vertex ids (0 to n-1 numbering,
835  * relative to main mesh)
836  */
837 /*----------------------------------------------------------------------------*/
838 
839 void
840 cs_post_mesh_get_vertex_ids(int mesh_id,
841  cs_lnum_t *vertex_ids);
842 
843 /*----------------------------------------------------------------------------*/
844 /*
845  * \brief Set whether postprocessing mesh's parallel domain should be output.
846  *
847  * \param[in] mesh_id postprocessing mesh id
848  * \param[in] post_domain true if parallel domain should be output,
849  * false otherwise.
850  */
851 /*----------------------------------------------------------------------------*/
852 
853 void
854 cs_post_mesh_set_post_domain(int mesh_id,
855  bool post_domain);
856 
857 /*----------------------------------------------------------------------------*/
858 /*
859  * \brief Remove a post-processing mesh.
860  *
861  * No further post-processing output will be allowed on this mesh,
862  * so the associated structures may be freed.
863  *
864  * A post-processing mesh that has been associated with a time-varying
865  * writer may not be removed.
866  *
867  * \param[in] mesh_id postprocessing mesh id
868  */
869 /*----------------------------------------------------------------------------*/
870 
871 void
872 cs_post_free_mesh(int mesh_id);
873 
874 /*----------------------------------------------------------------------------*/
875 /*
876  * \brief Check for the existence of a writer of the given id.
877  *
878  * \param[in] writer_id writer id to check
879  *
880  * \return true if writer with this id exists, false otherwise
881  */
882 /*----------------------------------------------------------------------------*/
883 
884 bool
885 cs_post_writer_exists(int writer_id);
886 
887 /*----------------------------------------------------------------------------*/
888 /*
889  * \brief Check for the existence of a post-processing mesh of the given id.
890  *
891  * \param[in] mesh_id mesh id to check
892  *
893  * \return true if mesh with this id exists, false otherwise
894  */
895 /*----------------------------------------------------------------------------*/
896 
897 bool
898 cs_post_mesh_exists(int mesh_id);
899 
900 /*----------------------------------------------------------------------------*/
901 /*
902  * \brief Find next mesh with a given category id
903  *
904  * \param[in] cat_id mesh category id filter
905  * \param[in] start_mesh_id O at start, then previously returned mesh id
906  *
907  * \return id of next mesh matching catogory, or 0 if none is found
908  */
909 /*----------------------------------------------------------------------------*/
910 
911 int
913  int start_mesh_id);
914 
915 /*----------------------------------------------------------------------------*/
916 /*
917  * \brief Return the default writer format name
918  *
919  * \return name of the default writer format
920  */
921 /*----------------------------------------------------------------------------*/
922 
923 const char *
925 
926 /*----------------------------------------------------------------------------*/
927 /*
928  * \brief Return the default writer format options
929  *
930  * \return default writer format options string
931  */
932 /*----------------------------------------------------------------------------*/
933 
934 const char *
936 
937 /*----------------------------------------------------------------------------*/
938 /*
939  * \brief Return the next "reservable" (i.e. non-user) writer id available.
940  *
941  * \return the smallest negative integer present, -1
942  */
943 /*----------------------------------------------------------------------------*/
944 
945 int
947 
948 /*----------------------------------------------------------------------------*/
949 /*
950  * \brief Return the next "reservable" (i.e. non-user) mesh id available.
951  *
952  * \return the smallest negative integer present, -1
953  */
954 /*----------------------------------------------------------------------------*/
955 
956 int
958 
959 /*----------------------------------------------------------------------------*/
960 /*
961  * \brief Update "active" or "inactive" flag of writers based on the time step.
962  *
963  * Writers are activated if their output interval is a divisor of the
964  * current time step, or if their optional time step and value output lists
965  * contain matches for the current time step.
966  *
967  * \param[in] ts time step status structure
968  */
969 /*----------------------------------------------------------------------------*/
970 
971 void
973 
974 /*----------------------------------------------------------------------------*/
975 /*
976  * \brief Query if a given writer is currently active.
977  *
978  * \param[in] writer_id writer id
979  *
980  * \return true if writer is active at this time step, false otherwise
981  */
982 /*----------------------------------------------------------------------------*/
983 
984 bool
985 cs_post_writer_is_active(int writer_id);
986 
987 /*----------------------------------------------------------------------------*/
988 /*
989  * \brief Force the "active" or "inactive" flag for a specific writer or for all
990  * writers for the current time step.
991  *
992  * \param[in] writer_id writer id, or 0 for all writers
993  * \param[in] activate false to deactivate, true to activate
994  */
995 /*----------------------------------------------------------------------------*/
996 
997 void
998 cs_post_activate_writer(int writer_id,
999  bool activate);
1000 
1001 /*----------------------------------------------------------------------------*/
1002 /*
1003  * \brief Force the "active" or "inactive" flag for a specific writer or for all
1004  * writers for the current time step.
1005  *
1006  * This is ignored for writers which are currently disabled.
1007  *
1008  * \param[in] writer_id writer id, or 0 for all writers
1009  * \param[in] activate false to deactivate, true to activate
1010  */
1011 /*----------------------------------------------------------------------------*/
1012 
1013 void
1015  bool activate);
1016 
1017 /*----------------------------------------------------------------------------*/
1018 /*
1019  * \brief Disable specific writer or all writers not currently active until
1020  * \ref cs_post_enable_writer or \ref cs_post_activate_writer
1021  * is called for those writers.
1022  *
1023  * For each call to this function for a given writer, the same number
1024  * of calls to \ref cs_post_enable_writer or a single call to
1025  * \ref cs_post_activate_writer is required to re-enable the writer.
1026  *
1027  * This is useful to disable output even of fixed meshes in preprocessing
1028  * stages.
1029  *
1030  * \param[in] writer_id writer id, or 0 for all writers
1031  */
1032 /*----------------------------------------------------------------------------*/
1033 
1034 void
1035 cs_post_disable_writer(int writer_id);
1036 
1037 /*----------------------------------------------------------------------------*/
1038 /*
1039  * \brief Enable a specific writer or all writers currently disabled by
1040  * previous calls to \ref cs_post_disable_writer.
1041  *
1042  * For each previous call to \ref cs_post_disable_writer for a given writer,
1043  * a call to this function (or a single call to \ref cs_post_activate_writer)
1044  * is required to re-enable the writer.
1045  *
1046  * This is useful to disable output even of fixed meshes in preprocessing
1047  * stages.
1048  *
1049  * \param[in] writer_id writer id, or 0 for all writers
1050  */
1051 /*----------------------------------------------------------------------------*/
1052 
1053 void
1054 cs_post_enable_writer(int writer_id);
1055 
1056 /*----------------------------------------------------------------------------*/
1057 /*
1058  * \brief Return a pointer to the FVM writer associated to a writer_id.
1059  *
1060  * \param[in] writer_id associated writer id
1061  *
1062  * \return a pointer to a fvm_writer_t structure
1063  */
1064 /*----------------------------------------------------------------------------*/
1065 
1066 fvm_writer_t *
1067 cs_post_get_writer(int writer_id);
1068 
1069 /*----------------------------------------------------------------------------*/
1070 /*
1071  * \brief Return a pointer to the time control associated to a writer_id.
1072  *
1073  * \param[in] writer_id associated writer id
1074  *
1075  * \return a pointer to a cs_time_control_t structure
1076  */
1077 /*----------------------------------------------------------------------------*/
1078 
1080 cs_post_get_time_control(int writer_id);
1081 
1082 /*----------------------------------------------------------------------------*/
1083 /*
1084  * \brief Return time dependency associated to a writer_id.
1085  *
1086  * \param[in] writer_id associated writer id
1087  *
1088  * \return associated writer's time dependency
1089  */
1090 /*----------------------------------------------------------------------------*/
1091 
1093 cs_post_get_writer_time_dep(int writer_id);
1094 
1095 /*----------------------------------------------------------------------------*/
1096 /*
1097  * \brief Add an activation time step for a specific writer or for all writers.
1098  *
1099  * If a negative value is provided, a previously added activation time
1100  * step matching that absolute value will be removed, if present.
1101  *
1102  * \param[in] writer_id writer id, or 0 for all writers
1103  * \param[in] nt time step value to add (or remove)
1104  */
1105 /*----------------------------------------------------------------------------*/
1106 
1107 void
1108 cs_post_add_writer_t_step(int writer_id,
1109  int nt);
1110 
1111 /*----------------------------------------------------------------------------*/
1112 /*
1113  * \brief Add an activation time value for a specific writer or for all writers.
1114  *
1115  * If a negative value is provided, a previously added activation time
1116  * step matching that absolute value will be removed, if present.
1117  *
1118  * \param[in] writer_id writer id, or 0 for all writers
1119  * \param[in] t time value to add (or remove)
1120  */
1121 /*----------------------------------------------------------------------------*/
1122 
1123 void
1124 cs_post_add_writer_t_value(int writer_id,
1125  double t);
1126 
1127 /*----------------------------------------------------------------------------*/
1128 /*
1129  * \brief Output post-processing meshes using associated writers.
1130  *
1131  * If the time step structure argument passed is NULL, a time-independent
1132  * output will be assumed.
1133  *
1134  * \param[in] ts time step status structure, or NULL
1135  */
1136 /*----------------------------------------------------------------------------*/
1137 
1138 void
1140 
1141 /*----------------------------------------------------------------------------*/
1142 /*
1143  * \brief Output a variable defined at cells or faces of a post-processing mesh
1144  * using associated writers.
1145  *
1146  * \param[in] mesh_id id of associated mesh
1147  * \param[in] writer_id id of specified associated writer,
1148  * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1149  * \param[in] var_name name of variable to output
1150  * \param[in] var_dim 1 for scalar, 3 for vector, 6 for symmetric tensor,
1151  * 9 for non-symmetric tensor
1152  * \param[in] interlace if a vector, true for interlaced values,
1153  * false otherwise
1154  * \param[in] use_parent true if values are defined on "parent" mesh,
1155  * false if values are defined on post-processing mesh
1156  * \param[in] datatype variable's data type
1157  * \param[in] cel_vals cell values
1158  * \param[in] i_face_vals interior face values
1159  * \param[in] b_face_vals boundary face values
1160  * \param[in] ts time step status structure, or NULL
1161  */
1162 /*----------------------------------------------------------------------------*/
1163 
1164 void
1165 cs_post_write_var(int mesh_id,
1166  int writer_id,
1167  const char *var_name,
1168  int var_dim,
1169  bool interlace,
1170  bool use_parent,
1171  cs_datatype_t datatype,
1172  const void *cel_vals,
1173  const void *i_face_vals,
1174  const void *b_face_vals,
1175  const cs_time_step_t *ts);
1176 
1177 /*----------------------------------------------------------------------------*/
1178 /*
1179  * \brief Output a function evaluation at cells or faces of a
1180  * post-processing mesh using associated writers.
1181  *
1182  * The associated mesh and function locations must have compatible types.
1183  *
1184  * Note that while providing functions for multiple mesh locations
1185  * (such as interior and boundary faces when a postprocessing mesh contains
1186  * both) is possible, it is not handled yet, so such cases will be ignored.
1187  *
1188  * \param[in] mesh_id id of associated mesh
1189  * \param[in] writer_id id of specified associated writer,
1190  * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1191  * \param[in] cell_f pointer to function object at cells
1192  * \param[in] i_face_f pointer to function object at interior faces
1193  * \param[in] b_face_f pointer to function object at boundary faces
1194  * \param[in] ts time step status structure, or NULL
1195  */
1196 /*----------------------------------------------------------------------------*/
1197 
1198 void
1199 cs_post_write_function(int mesh_id,
1200  int writer_id,
1201  const cs_function_t *cel_f,
1202  const cs_function_t *i_face_f,
1203  const cs_function_t *b_face_f,
1204  const cs_time_step_t *ts);
1205 
1206 /*----------------------------------------------------------------------------*/
1207 /*
1208  * \brief Output a variable defined at vertices of a post-processing mesh using
1209  * associated writers.
1210  *
1211  * \param[in] mesh_id id of associated mesh
1212  * \param[in] writer_id id of specified associated writer,
1213  * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1214  * \param[in] var_name name of variable to output
1215  * \param[in] var_dim 1 for scalar, 3 for vector, 6 for symmetric tensor,
1216  * 9 for non-symmetric tensor
1217  * \param[in] interlace if a vector, true for interlaced values,
1218  * false otherwise
1219  * \param[in] use_parent true if values are defined on "parent" mesh,
1220  * false if values are defined on post-processing mesh
1221  * \param[in] datatype variable's data type
1222  * \param[in] vtx_vals vertex values
1223  * \param[in] ts time step status structure, or NULL
1224  */
1225 /*----------------------------------------------------------------------------*/
1226 
1227 void
1228 cs_post_write_vertex_var(int mesh_id,
1229  int writer_id,
1230  const char *var_name,
1231  int var_dim,
1232  bool interlace,
1233  bool use_parent,
1234  cs_datatype_t datatype,
1235  const void *vtx_vals,
1236  const cs_time_step_t *ts);
1237 
1238 /*----------------------------------------------------------------------------*/
1239 /*
1240  * \brief Output a function evaluation at cells or faces of a
1241  * post-processing mesh using associated writers.
1242  *
1243  * The associated mesh and function locations must have compatible types.
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] f pointer to function object at vertices
1249  * \param[in] ts time step status structure, or NULL
1250  */
1251 /*----------------------------------------------------------------------------*/
1252 
1253 void
1254 cs_post_write_vertex_function(int mesh_id,
1255  int writer_id,
1256  const cs_function_t *f,
1257  const cs_time_step_t *ts);
1258 
1259 /*----------------------------------------------------------------------------*/
1260 /*
1261  * \brief Output an existing lagrangian particle attribute at particle
1262  * positions or trajectory endpoints of a particle mesh using
1263  * associated writers.
1264  *
1265  * \param[in] mesh_id id of associated mesh
1266  * \param[in] writer_id id of specified associated writer,
1267  * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1268  * \param[in] attr_id associated particle attribute id
1269  * \param[in] var_name name of variable to output
1270  * \param[in] component_id if -1 : extract the whole attribute
1271  * if >0 : id of the component to extract
1272  * \param[in] ts time step status structure, or NULL
1273  */
1274 /*----------------------------------------------------------------------------*/
1275 
1276 void
1277 cs_post_write_particle_values(int mesh_id,
1278  int writer_id,
1279  int attr_id,
1280  const char *var_name,
1281  int component_id,
1282  const cs_time_step_t *ts);
1283 
1284 /*----------------------------------------------------------------------------*/
1285 /*
1286  * \brief Output a variable defined at cells or faces of a post-processing mesh
1287  * using associated writers.
1288  *
1289  * \param[in] mesh_id id of associated mesh
1290  * \param[in] writer_id id of specified associated writer,
1291  * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1292  * \param[in] var_name name of variable to output
1293  * \param[in] var_dim 1 for scalar, 3 for vector, 6 for symmetric
1294  * tensor, 9 for non-symmetric tensor
1295  * \param[in] datatype variable's data type
1296  * \param[in] parent_location_id asociated values mesh location, or 0
1297  * if values are passed directly
1298  * \param[in] interpolate_func pointer to interpolation function,
1299  * or NULL for default
1300  * \param[in] interpolate_input pointer to optional interpolation input
1301  * data, or NULL for default
1302  * \param[in] vals variable's values
1303  * \param[in] ts time step status structure, or NULL
1304  */
1305 /*----------------------------------------------------------------------------*/
1306 
1307 void
1308 cs_post_write_probe_values(int mesh_id,
1309  int writer_id,
1310  const char *var_name,
1311  int var_dim,
1312  cs_datatype_t datatype,
1313  int parent_location_id,
1314  cs_interpolate_from_location_t *interpolate_func,
1315  void *interpolate_input,
1316  const void *vals,
1317  const cs_time_step_t *ts);
1318 
1319 /*----------------------------------------------------------------------------*/
1320 /*
1321  * \brief Output function-evaluated values at cells or faces of a
1322  * post-processing probe set using associated writers.
1323  *
1324  * - For real-valued data with interpolation, the function is evaluated on the
1325  * whole parent domain so as to be able to compute gradients, then
1326  * interpolate on the probe set.
1327  * * For vertex-based values, a lighter, cell-based interpolation would
1328  * be feasible, but is not available yet.
1329  * * For cell or face-based values, likewise, only the immediate neighborhood
1330  * of elements containing probes are needed, but such filtering would
1331  * require building the matching element list and adding an indirection
1332  * to the gradients computation.
1333  *
1334  * - In the specific case where the function evaluation uses an analytic
1335  * function, to which the exact coordinates are provides, such interpolation
1336  * is not deemed necessary, as the anaytic function may handle this more
1337  * efficiently.
1338  *
1339  * - For non-real-based values, or real-based values other than cs_real_t,
1340  * no interpolation is performed
1341  *
1342  * \param[in] mesh_id id of associated mesh
1343  * \param[in] writer_id id of specified associated writer,
1344  * or \ref CS_POST_WRITER_ALL_ASSOCIATED for all
1345  * \param[in] f pointer to associated function object
1346  * \param[in] parent_location_id associated values at mesh location, or 0
1347  * if values are passed directly
1348  * \param[in] interpolate_func pointer to interpolation function,
1349  * or NULL for default
1350  * \param[in] interpolate_input pointer to optional interpolation input
1351  * data, or NULL for default
1352  * \param[in] ts time step status structure, or NULL
1353  */
1354 /*----------------------------------------------------------------------------*/
1355 
1356 void
1357 cs_post_write_probe_function(int mesh_id,
1358  int writer_id,
1359  const cs_function_t *f,
1360  int parent_location_id,
1361  cs_interpolate_from_location_t *interpolate_func,
1362  void *interpolate_input,
1363  const cs_time_step_t *ts);
1364 
1365 /*----------------------------------------------------------------------------*/
1366 /*
1367  * \brief Update references to parent mesh of post-processing meshes in case of
1368  * computational mesh cell renumbering.
1369  *
1370  * This function may be called only once, after possible renumbering of cells,
1371  * to update existing post-processing meshes. Post-processing meshes defined
1372  * after renumbering will automatically be based upon the new numbering,
1373  * so this function will not need to be called again.
1374  *
1375  * \param[in] init_cell_num initial cell numbering (new -> old)
1376  */
1377 /*----------------------------------------------------------------------------*/
1378 
1379 void
1380 cs_post_renum_cells(const cs_lnum_t init_cell_num[]);
1381 
1382 /*----------------------------------------------------------------------------*/
1383 /*
1384  * \brief Update references to parent mesh of post-processing meshes in case of
1385  * computational mesh interior and/or boundary faces renumbering.
1386  *
1387  * This function may be called only once, after possible renumbering of faces,
1388  * to update existing post-processing meshes. Post-processing meshes defined
1389  * after renumbering will automatically be based upon the new numbering,
1390  * so this function will not need to be called again.
1391  *
1392  * \param[in] init_i_face_num initial interior numbering (new -> old)
1393  * \param[in] init_b_face_num initial boundary numbering (new -> old)
1394  */
1395 /*----------------------------------------------------------------------------*/
1396 
1397 void
1398 cs_post_renum_faces(const cs_lnum_t init_i_face_num[],
1399  const cs_lnum_t init_b_face_num[]);
1400 
1401 /*----------------------------------------------------------------------------*/
1402 /*
1403  * \brief Configure the post-processing output so that mesh connectivity
1404  * may be automatically updated.
1405  *
1406  * This is done for meshes defined using selection criteria or functions.
1407  * The behavior of Lagrangian meshes is unchanged.
1408  *
1409  * To be effective, this function should be called before defining
1410  * postprocessing meshes.
1411  */
1412 /*----------------------------------------------------------------------------*/
1413 
1414 void
1416 
1417 /*----------------------------------------------------------------------------*/
1421 /*----------------------------------------------------------------------------*/
1422 
1423 void
1424 cs_post_init_writers(void);
1425 
1426 /*----------------------------------------------------------------------------*/
1427 /*
1428  * \brief Initialize main post-processing meshes
1429  *
1430  * The check_flag variable is a mask, used for additionnal post-processing:
1431  *
1432  * - If (check_flag & 1), volume submeshes are output by groups if more
1433  * than one group is present and the default writer uses the EnSight format.
1434  *
1435  * - If (check_flag & 2), boundary submeshes are output by groups if more
1436  * than one group is present and the default writer uses the EnSight format.
1437  *
1438  * It is recommended that post-processing meshes be defined before calling
1439  * this function, though specific "automatic" meshes (for example those
1440  * related to couplings) may be defined between this call and a time loop.
1441  *
1442  * \param[in] check_mask mask used for additional output
1443  */
1444 /*----------------------------------------------------------------------------*/
1445 
1446 void
1447 cs_post_init_meshes(int check_mask);
1448 
1449 /*----------------------------------------------------------------------------*/
1450 /*
1451  * \brief Check if post-processing is activated and then update post-processing
1452  * of meshes if there is a need to update time-dependent meshes
1453  *
1454  * \param[in] ts time step status structure, or NULL
1455  */
1456 /*----------------------------------------------------------------------------*/
1457 
1458 void
1460 
1461 /*----------------------------------------------------------------------------*/
1462 /*
1463  * \brief Loop on post-processing meshes to output variables.
1464  *
1465  * This handles all default fields output, as well as all
1466  * registered output functions and outputs defined in
1467  * \ref cs_user_postprocess_values
1468  *
1469  * \param[in] ts time step status structure, or NULL
1470  */
1471 /*----------------------------------------------------------------------------*/
1472 
1473 void
1475 
1476 /*----------------------------------------------------------------------------*/
1477 /*
1478  * \brief Flush writers and free time-varying and Lagragian mesh if needed
1479  * of meshes if there is a time-dependent mesh
1480  */
1481 /*----------------------------------------------------------------------------*/
1482 
1483 void
1484 cs_post_time_step_end(void);
1485 
1486 /*----------------------------------------------------------------------------*/
1487 /*
1488  * \brief Loop on post-processing meshes to output variables.
1489  *
1490  * This handles all default fields output, as well as all
1491  * registered output functions and outputs defined in
1492  * \ref cs_user_postprocess_values
1493  *
1494  * \param[in] ts time step status structure, or NULL
1495  */
1496 /*----------------------------------------------------------------------------*/
1497 
1498 void
1500 
1501 /*----------------------------------------------------------------------------*/
1502 /*
1503  * \brief Destroy all structures associated with post-processing
1504  */
1505 /*----------------------------------------------------------------------------*/
1506 
1507 void
1508 cs_post_finalize(void);
1509 
1510 /*----------------------------------------------------------------------------*/
1511 /*
1512  * \brief Postprocess free (isolated) faces of the current global mesh
1513  */
1514 /*----------------------------------------------------------------------------*/
1515 
1516 void
1518 
1519 /*----------------------------------------------------------------------------*/
1520 /*
1521  * \brief Initialize post-processing writer with same format and associated
1522  * options as default writer, but no time dependency, intended to
1523  * troubleshoot errors.
1524  */
1525 /*----------------------------------------------------------------------------*/
1526 
1527 void
1529 
1530 /*----------------------------------------------------------------------------*/
1531 /*
1532  * \brief Initialize post-processing writer with same format and associated
1533  * options as default writer, but no time dependency, and associate
1534  * and output global volume mesh.
1535  *
1536  * This is intended to help troubleshoot errors using fields based
1537  * on cells.
1538  *
1539  * \return id of error output mesh (< 0), or 0 if all writers are deactivated
1540  */
1541 /*----------------------------------------------------------------------------*/
1542 
1543 int
1545 
1546 /*----------------------------------------------------------------------------*/
1547 /*
1548  * \brief Register a processing of time-dependent variables to the call to
1549  * cs_post_write_vars().
1550  *
1551  * Note: if the input pointer is non-NULL, it must point to valid data
1552  * when the output function is called, so either:
1553  * - that value or structure should not be temporary (i.e. local);
1554  * - post-processing output must be ensured using cs_post_write_var()
1555  * or similar before the data pointed to goes out of scope.
1556  *
1557  * \param[in] function function to register
1558  * \param[in, out] input pointer to optional (untyped) value or structure
1559  */
1560 /*----------------------------------------------------------------------------*/
1561 
1562 void
1564  void *input);
1565 
1566 /*----------------------------------------------------------------------------*/
1567 /*
1568  * \brief Register a processing of time-dependent variables than can be output
1569  * on different meshes to the call to cs_post_write_vars().
1570  *
1571  * Note: if the input pointer is non-NULL, it must point to valid data
1572  * when the output function is called, so either:
1573  * - that value or structure should not be temporary (i.e. local);
1574  * - post-processing output must be ensured using cs_post_write_var()
1575  * or similar before the data pointed to goes out of scope.
1576  *
1577  * \param[in] function function to register
1578  * \param[in, out] input pointer to optional (untyped) value or structure
1579  */
1580 /*----------------------------------------------------------------------------*/
1581 
1582 void
1584  void *input);
1585 
1586 /*----------------------------------------------------------------------------*/
1587 
1589 
1590 #endif /* __CS_POST_H__ */
cs_datatype_t
Definition: cs_defs.h:272
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
#define END_C_DECLS
Definition: cs_defs.h:515
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
@ t
Definition: cs_field_pointer.h:92
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
int cs_post_get_free_mesh_id(void)
Return the next "reservable" (i.e. non-user) mesh id available.
Definition: cs_post.c:5655
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.c:5334
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.c:6978
void cs_post_time_step_output(const cs_time_step_t *ts)
Loop on post-processing meshes to output variables.
Definition: cs_post.c:7769
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.c:8573
int cs_post_get_free_writer_id(void)
Return the next "reservable" (i.e. non-user) writer id available.
Definition: cs_post.c:5641
void cs_post_init_error_writer(void)
Initialize post-processing writer with same format and associated options as default writer,...
Definition: cs_post.c:8440
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.c:5988
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.c:7353
void cs_post_init_meshes(int check_mask)
Initialize main post-processing meshes.
Definition: cs_post.c:7574
void cs_post_add_free_faces(void)
Postprocess free (isolated) faces of the current global mesh.
Definition: cs_post.c:8229
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.c:7736
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.c:8134
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.c:4570
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.c:4319
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.c:4382
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.c:5406
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.c:6582
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.c:6815
cs_lnum_t cs_post_mesh_get_n_vertices(int mesh_id)
Get a postprocessing mesh's number of vertices.
Definition: cs_post.c:5376
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.c:4717
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.c:6100
void cs_post_write_meshes(const cs_time_step_t *ts)
Output post-processing meshes using associated writers.
Definition: cs_post.c:6043
int cs_post_init_error_writer_cells(void)
Initialize post-processing writer with same format and associated options as default writer,...
Definition: cs_post.c:8490
bool cs_post_writer_exists(int writer_id)
Check for the existence of a writer of the given id.
Definition: cs_post.c:5522
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.c:6701
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.c:5938
void cs_post_set_changing_connectivity(void)
Configure the post-processing output so that mesh connectivity may be automatically updated.
Definition: cs_post.c:7448
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.c:4164
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.c:4649
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.c:5913
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.c:7116
cs_lnum_t cs_post_mesh_get_n_cells(int mesh_id)
Get a postprocessing mesh's number of cells.
Definition: cs_post.c:5172
void cs_post_write_vars(const cs_time_step_t *ts)
Loop on post-processing meshes to output variables.
Definition: cs_post.c:8112
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.c:8532
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.c:5304
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.c:6016
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.c:5435
const int * cs_post_mesh_get_ent_flag(int mesh_id)
Get a postprocessing meshes entity presence flag.
Definition: cs_post.c:5154
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.c:5673
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.c:5807
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.c:5202
const char * cs_post_get_default_format(void)
Return the default writer format name.
Definition: cs_post.c:5613
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.c:6369
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.c:5845
void cs_post_free_mesh(int mesh_id)
Remove a post-processing mesh.
Definition: cs_post.c:5458
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.c:5778
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.c:4432
void cs_post_mesh_detach_writer(int mesh_id, int writer_id)
De-associate a writer from a postprocessing mesh.
Definition: cs_post.c:5024
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.c:5261
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.c:4907
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.c:5088
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.c:5231
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.c:8068
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.c:7277
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.c:4510
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.c:5579
void cs_post_init_writers(void)
Initialize post-processing writers.
Definition: cs_post.c:7460
void cs_post_mesh_attach_writer(int mesh_id, int writer_id)
Associate a writer to a postprocessing mesh.
Definition: cs_post.c:4979
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.c:4951
const char * cs_post_get_default_format_options(void)
Return the default writer format options.
Definition: cs_post.c:5627
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.c:5882
bool cs_post_writer_is_active(int writer_id)
Query if a given writer is currently active.
Definition: cs_post.c:5759
bool cs_post_mesh_exists(int mesh_id)
Check for the existence of a post-processing mesh of the given id.
Definition: cs_post.c:5551
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.c:4783
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.c:5957
fvm_writer_time_dep_t
Definition: fvm_writer.h:57
double precision, dimension(:,:,:), allocatable density
Definition: atimbr.f90:124
Definition: cs_function.h:121
Definition: cs_time_control.h:96
time step descriptor
Definition: cs_time_step.h:64