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