Code_Saturne
CFD tool
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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-2012 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  * BFT library headers
36  *----------------------------------------------------------------------------*/
37 
38 /*----------------------------------------------------------------------------
39  * FVM library headers
40  *----------------------------------------------------------------------------*/
41 
42 #include <fvm_nodal.h>
43 #include <fvm_writer.h>
44 
45 /*----------------------------------------------------------------------------
46  * Local headers
47  *----------------------------------------------------------------------------*/
48 
49 #include "cs_base.h"
50 
51 /*----------------------------------------------------------------------------*/
52 
54 
55 /*============================================================================
56  * Macro definitions
57  *============================================================================*/
58 
59 /*
60  * Output type masks
61  */
62 
63 #define CS_POST_ON_LOCATION (1 << 0) /* postprocess variables
64  on their base location
65  (volume for variables) */
66 #define CS_POST_BOUNDARY_NR (1 << 1) /* postprocess boundary
67  without reconstruction */
68 
69 /*============================================================================
70  * Local type definitions
71  *============================================================================*/
72 
73 /* Datatype enumeration */
74 
75 typedef enum {
82 
83 /*----------------------------------------------------------------------------
84  * Function pointer to elements selection definition.
85  *
86  * Each function of this sort may be used to select a given type of element,
87  * usually cells, interior faces, or boundary faces.
88  *
89  * If non-empty and not containing all elements, a list of elements of the
90  * main mesh should be allocated (using BFT_MALLOC) and defined by this
91  * function when called. This list's lifecycle is then managed by the
92  * postprocessing subsystem.
93  *
94  * Note: if the input pointer is non-NULL, it must point to valid data
95  * when the selection function is called, so either:
96  * - that value or structure should not be temporary (i.e. local);
97  * - post-processing output must be ensured using cs_post_write_meshes()
98  * with a fixed-mesh writer before the data pointed to goes out of scope;
99  *
100  * parameters:
101  * input <-> pointer to optional (untyped) value or structure.
102  * n_elts --> number of selected elements.
103  * elt_list --> list of selected elements (0 to n-1 numbering).
104  *----------------------------------------------------------------------------*/
105 
106 typedef void
107 (cs_post_elt_select_t) (void *input,
108  cs_lnum_t *n_elts,
109  cs_lnum_t **elt_list);
110 
111 /*----------------------------------------------------------------------------
112  * Function pointer associated with a specific post-processing output.
113  *
114  * Such functions are registered using the cs_post_add_time_dep_vars(),
115  * and all registered functions are automatically called by
116  * cs_post_write_vars().
117  *
118  * Note: if the input pointer is non-NULL, it must point to valid data
119  * when the output function is called, so either:
120  * - that value or structure should not be temporary (i.e. local);
121  * - post-processing output must be ensured using cs_post_write_var()
122  * or similar before the data pointed to goes out of scope.
123  *
124  * parameters:
125  * input <-> pointer to optional (untyped) value or structure.
126  * nt_cur_abs <-- current time step number
127  * t_cur_abs <-- absolute time at the current time step
128  *----------------------------------------------------------------------------*/
129 
130 typedef void
132  int nt_cur_abs,
133  cs_real_t t_cur_abs);
134 
135 /*----------------------------------------------------------------------------
136  * Function pointer associated with a specific post-processing output
137  * on multiple meshes.
138  *
139  * Such functions are registered using the cs_post_add_time_mesh_dep_vars(),
140  * and all registered functions are automatically called by
141  * cs_post_write_vars().
142  *
143  * Note: if the input pointer is non-NULL, it must point to valid data
144  * when the output function is called, so either:
145  * - that value or structure should not be temporary (i.e. local);
146  * - post-processing output must be ensured using cs_post_write_var()
147  * or similar before the data pointed to goes out of scope.
148  *
149  * parameters:
150  * input <-> pointer to optional (untyped) value or structure.
151  * mesh_id <-- id of the output mesh for the current call
152  * cat_id <-- category id of the output mesh for the current call
153  * ent_flag <-- indicate global presence of cells (ent_flag[0]), interior
154  * faces (ent_flag[1]), or boundary faces (ent_flag[2])
155  * n_cells <-- local number of cells of post_mesh
156  * n_i_faces <-- local number of interior faces of post_mesh
157  * n_b_faces <-- local number of boundary faces of post_mesh
158  * cell_list <-- list of cells (1 to n) of post-processing mesh
159  * i_face_list <-- list of interior faces (1 to n) of post-processing mesh
160  * b_face_list <-- list of boundary faces (1 to n) of post-processing mesh
161  * nt_cur_abs <-- current time step number
162  * t_cur_abs <-- current physical time
163  * nt_cur_abs <-- current time step number
164  * t_cur_abs <-- absolute time at the current time step
165  *----------------------------------------------------------------------------*/
166 
167 typedef void
169  int mesh_id,
170  int cat_id,
171  int ent_flag[3],
172  cs_lnum_t n_cells,
173  cs_lnum_t n_i_faces,
174  cs_lnum_t n_b_faces,
175  const cs_lnum_t cell_list[],
176  const cs_lnum_t i_face_list[],
177  const cs_lnum_t b_face_list[],
178  int nt_cur_abs,
179  cs_real_t t_cur_abs);
180 
181 /*=============================================================================
182  * Global variables
183  *============================================================================*/
184 
185 /*============================================================================
186  * Public Fortran function prototypes
187  *============================================================================*/
188 
189 /*----------------------------------------------------------------------------
190  * Configure the post-processing output so that a mesh displacement field
191  * may be output automatically for meshes based on the global volume mesh/
192  *
193  * Fortran interface:
194  *
195  * subroutine pstdfm
196  * *****************
197  *----------------------------------------------------------------------------*/
198 
199 void CS_PROCF (pstdfm, PSTDFM)
200 (
201  void
202 );
203 
204 /*----------------------------------------------------------------------------
205  * Update the "active" or "inactive" flag for writers based on the current
206  * time step and their default output frequency.
207  *
208  * Fortran interface:
209  *
210  * subroutine pstntc (ntmabs, ntcabs, ttcabs)
211  * *****************
212  *
213  * integer ntmabs : <-- : maximum time step number
214  * integer ntcabs : <-- : current time step number
215  * double precision ttcabs : <-- : absolute time at the current time step
216  *----------------------------------------------------------------------------*/
217 
218 void CS_PROCF (pstntc, PSTNTC)
219 (
220  const cs_int_t *ntmabs,
221  const cs_int_t *ntcabs,
222  const cs_real_t *ttcabs
223 );
224 
225 /*----------------------------------------------------------------------------
226  * Force the "active" or "inactive" flag for a specific writer or for all
227  * writers for the current time step.
228  *
229  * Fortran interface:
230  *
231  * subroutine pstact (numwri, indact)
232  * *****************
233  *
234  * integer numwri : <-- : writer number, or 0 for all writers
235  * integer indact : <-- : 0 to deactivate, 1 to activate
236  *----------------------------------------------------------------------------*/
237 
238 void CS_PROCF (pstact, PSTACT)
239 (
240  const cs_int_t *numwri,
241  const cs_int_t *indact
242 );
243 
244 /*----------------------------------------------------------------------------
245  * Output post-processing meshes using associated writers.
246  *
247  * Fortran interface:
248  *
249  * subroutine pstema (ntcabs, ttcabs)
250  * *****************
251  *
252  * integer ntcabs : <-- : current time step number
253  * double precision ttcabs : <-- : current physical time
254  *----------------------------------------------------------------------------*/
255 
256 void CS_PROCF (pstema, PSTEMA)
257 (
258  const cs_int_t *ntcabs,
259  const cs_real_t *ttcabs
260 );
261 
262 /*----------------------------------------------------------------------------
263  * Post-processing output of a variable defined on cells or faces of a mesh
264  * using associated writers.
265  *
266  * fortran interface; use psteva (see cs_post_f2c.f90)
267  *
268  * subroutine pstev1 (nummai, nomvar, lnmvar, idimt, ientla, ivarpr,
269  * *****************
270  * ntcabs, ttcabs, varcel, varfac, varfbr)
271  *
272  * integer nummai : <-- : number of associated output mesh
273  * character nomvar : <-- : name of associated variable
274  * integer lnmvar : <-- : variable name length
275  * integer idimt : <-- : 1 for scalar, 3 for vector
276  * integer ientla : <-- : if a vector, 1 for interlaced values
277  * : : (x1, y1, z1, x2, y2, ..., yn, zn),
278  * : : 0 otherwise (x1, x2, ...xn, y1, y2, ...)
279  * integer ivarpr : <-- : 1 if variable is defined on "parent"
280  * : : mesh, 2 if defined on output mesh
281  * integer ntcabs : <-- : current time step number
282  * double precision ttcabs : <-- : current physical time
283  * double precision varcel(*) : <-- : cell values
284  * double precision varfac(*) : <-- : interior face values
285  * double precision varfbo(*) : <-- : boundary face values
286  *----------------------------------------------------------------------------*/
287 
288 void CS_PROCF (pstev1, PSTEV1)
289 (
290  const cs_int_t *nummai,
291  const char *nomvar,
292  const cs_int_t *lnmvar,
293  const cs_int_t *idimt,
294  const cs_int_t *ientla,
295  const cs_int_t *ivarpr,
296  const cs_int_t *ntcabs,
297  const cs_real_t *ttcabs,
298  const cs_real_t varcel[],
299  const cs_real_t varfac[],
300  const cs_real_t varfbr[]
301  CS_ARGF_SUPP_CHAINE /* (possible 'length' arguments added
302  by many Fortran compilers) */
303 );
304 
305 /*----------------------------------------------------------------------------
306  * User override of default frequency or calculation end based output.
307  *
308  * Fortran interface:
309  *
310  * subroutine pstusn (ntmabs, ntcabs, ttcabs)
311  * *****************
312  *
313  * integer ntmabs : <-- : maximum time step number
314  * integer ntcabs : <-- : current time step number
315  * double precision ttcabs : <-- : absolute time at the current time step
316  *----------------------------------------------------------------------------*/
317 
318 void CS_PROCF (pstusn, PSTUSN)
319 (
320  const cs_int_t *ntmabs,
321  const cs_int_t *ntcabs,
322  const cs_real_t *ttcabs
323 );
324 
325 /*============================================================================
326  * Public function prototypes
327  *============================================================================*/
328 
329 /*----------------------------------------------------------------------------
330  * Configure the post-processing output so that a mesh displacement field
331  * may be output automatically for meshes based on the global volume mesh/
332  *----------------------------------------------------------------------------*/
333 
334 void
336 
337 /*----------------------------------------------------------------------------
338  * Define a writer; this objects manages a case's name, directory, and format,
339  * as well as associated mesh's time dependency, and the default output
340  * frequency for associated variables.
341  *
342  * This function must be called before the time loop. If a writer with a
343  * given id is defined multiple times, the last definition supercedes the
344  * previous ones.
345  *
346  * parameters:
347  * writer_id <-- number of writer to create (< 0 reserved, > 0 for user)
348  * case_name <-- associated case name
349  * dir_name <-- associated directory name
350  * fmt_name <-- associated format name
351  * fmt_opts <-- associated format options string
352  * time_dep <-- FVM_WRITER_FIXED_MESH if mesh definitions are fixed,
353  * FVM_WRITER_TRANSIENT_COORDS if coordinates change,
354  * FVM_WRITER_TRANSIENT_CONNECT if connectivity changes
355  * output_at_end <-- force output at calculation end if not 0
356  * frequency_n <-- default output frequency in time-steps, or < 0
357  * frequency_t <-- default output frequency in seconds, or < 0
358  * (has priority over frequency_n)
359  *----------------------------------------------------------------------------*/
360 
361 void
362 cs_post_define_writer(int writer_id,
363  const char *case_name,
364  const char *dir_name,
365  const char *fmt_name,
366  const char *fmt_opts,
367  fvm_writer_time_dep_t time_dep,
368  bool output_at_end,
369  int frequency_n,
370  double frequency_t);
371 
372 /*----------------------------------------------------------------------------
373  * Define a volume post-processing mesh.
374  *
375  * parameters:
376  * mesh_id <-- id of mesh to define (< 0 reserved, > 0 for user)
377  * mesh_name <-- associated mesh name
378  * cell_criteria <-- selection criteria for cells
379  * add_groups <-- if true, add group information if present
380  * auto_variables <-- if true, automatic output of main variables
381  * n_writers <-- number of associated writers
382  * writer_ids <-- ids of associated writers
383  *----------------------------------------------------------------------------*/
384 
385 void
386 cs_post_define_volume_mesh(int mesh_id,
387  const char *mesh_name,
388  const char *cell_criteria,
389  bool add_groups,
390  bool auto_variables,
391  int n_writers,
392  const int writer_ids[]);
393 
394 /*----------------------------------------------------------------------------
395  * Define a volume post-processing mesh using a selection function.
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 the cell_select_input pointer is non-NULL, it must point
402  * to valid data when the selection function is called, so either:
403  * - that value or structure should not be temporary (i.e. local);
404  * - post-processing output must be ensured using cs_post_write_meshes()
405  * with a fixed-mesh writer before the data pointed to goes out of scope;
406  *
407  * parameters:
408  * mesh_id <-- id of mesh to define (< 0 reserved, > 0 for user)
409  * mesh_name <-- associated mesh name
410  * cell_select_func <-- pointer to cells selection function
411  * cell_select_input <-> pointer to optional input data for the cell
412  * selection function, or NULL
413  * time_varying <-- if true, try to redefine mesh at each output time
414  * add_groups <-- if true, add group information if present
415  * auto_variables <-- if true, automatic output of main variables
416  * n_writers <-- number of associated writers
417  * writer_ids <-- ids of associated writers
418  *----------------------------------------------------------------------------*/
419 
420 void
422  const char *mesh_name,
423  cs_post_elt_select_t *cell_select_func,
424  void *cell_select_input,
425  bool time_varying,
426  bool add_groups,
427  bool auto_variables,
428  int n_writers,
429  const int writer_ids[]);
430 
431 /*----------------------------------------------------------------------------
432  * Define a surface post-processing mesh.
433  *
434  * parameters:
435  * mesh_id <-- id of mesh to define (< 0 reserved, > 0 for user)
436  * mesh_name <-- associated mesh name
437  * i_face_criteria <-- selection criteria for interior faces
438  * b_face_criteria <-- selection criteria for boundary faces
439  * add_groups <-- if true, add group information if present
440  * auto_variables <-- if true, automatic output of main variables
441  * n_writers <-- number of associated writers
442  * writer_ids <-- ids of associated writers
443  *----------------------------------------------------------------------------*/
444 
445 void
446 cs_post_define_surface_mesh(int mesh_id,
447  const char *mesh_name,
448  const char *i_face_criteria,
449  const char *b_face_criteria,
450  bool add_groups,
451  bool auto_variables,
452  int n_writers,
453  const int writer_ids[]);
454 
455 /*----------------------------------------------------------------------------
456  * Define a surface post-processing mesh using selection functions.
457  *
458  * The selection may be updated over time steps if both the time_varying
459  * flag is set to true and the mesh is only associated with writers defined
460  * with the FVM_WRITER_TRANSIENT_CONNECT option.
461  *
462  * Note: if i_face_select_input or b_face_select_input pointer is non-NULL,
463  * it must point to valid data when the selection function is called,
464  * so either:
465  * - that value or structure should not be temporary (i.e. local);
466  * - post-processing output must be ensured using cs_post_write_meshes()
467  * with a fixed-mesh writer before the data pointed to goes out of scope;
468  *
469  * parameters:
470  * mesh_id <-- id of mesh to define (< 0 reserved, > 0 for user)
471  * mesh_name <-- associated mesh name
472  * i_face_select_func <-- pointer to interior faces selection function
473  * b_face_select_func <-- pointer to boundary faces selection function
474  * i_face_select_input <-> pointer to optional input data for the interior
475  * faces selection function, or NULL
476  * b_face_select_input <-> pointer to optional input data for the boundary
477  * faces selection function, or NULL
478  * time_varying <-- if true, try to redefine mesh at each output time
479  * add_groups <-- if true, add group information if present
480  * auto_variables <-- if true, automatic output of main variables
481  * n_writers <-- number of associated writers
482  * writer_ids <-- ids of associated writers
483  *----------------------------------------------------------------------------*/
484 
485 void
487  const char *mesh_name,
488  cs_post_elt_select_t *i_face_select_func,
489  cs_post_elt_select_t *b_face_select_func,
490  void *i_face_select_input,
491  void *b_face_select_input,
492  bool time_varying,
493  bool add_groups,
494  bool auto_variables,
495  int n_writers,
496  const int writer_ids[]);
497 
498 /*----------------------------------------------------------------------------
499  * Create an alias to a post-processing mesh.
500  *
501  * An alias allows association of an extra identifier (id) to an
502  * existing post-processing mesh, and thus to associate different writers
503  * than those associated with the existing mesh. For example, this allows
504  * outputting a set of main variables every n1 time steps with one writer,
505  * and outputting a specific set of variables every n2 time time steps to
506  * another post-processing set using another writer, without the overhead
507  * that would be incurred by duplication of the post-processing mesh.
508  *
509  * An alias is thus treated in all points like its associated mesh;
510  * if the definition of either one is modified, that of the other is
511  * modified also.
512  *
513  * It is forbidden to associate an alias to another alias (as there is no
514  * identified use for this, and it would make consistency checking more
515  * difficult), but multiple aliases may be associated with a given mesh.
516  *
517  * parameters:
518  * mesh_id <-- id of mesh to define (< 0 reserved, > 0 for user)
519  * aliased_mesh_id <-- id of aliased mesh
520  * auto_variables <-- if true, automatic output of main variables
521  * n_writers <-- number of associated writers
522  * writer_ids <-- ids of associated writers
523  *----------------------------------------------------------------------------*/
524 
525 void
526 cs_post_define_alias_mesh(int mesh_id,
527  int aliased_mesh_id,
528  bool auto_variables,
529  int n_writers,
530  const int writer_ids[]);
531 
532 /*----------------------------------------------------------------------------
533  * Create a post-processing mesh associated with an existing exportable mesh
534  * representation.
535  *
536  * If the exportable mesh is not intended to be used elsewhere, one can choose
537  * to transfer its property to the post-processing mesh, which will then
538  * manage its lifecycle based on its own requirements.
539  *
540  * If the exportable mesh must still be shared, one must be careful to
541  * maintain consistency between this mesh and the post-processing output.
542  *
543  * The mesh in exportable dimension may be of a lower dimension than
544  * its parent mesh, if it has been projected. In this case, a
545  * dim_shift value of 1 indicates that parent cells are mapped to
546  * exportable faces, and faces to edges, while a dim_shift value of 2
547  * would indicate that parent cells are mapped to edges.
548  * This is important when variables values are exported.
549  *
550  * parameters:
551  * mesh_id <-- number of mesh to create (< 0 reserved, > 0 for user)
552  * exp_mesh <-- mesh in exportable representation (i.e. fvm_nodal_t)
553  * dim_shift <-- nonzero if exp_mesh has been projected
554  * transfer <-- if true, ownership of exp_mesh is transferred to
555  * the post-processing mesh
556  * auto_variables <-- if true, automatic output of main variables
557  * n_writers <-- number of associated writers
558  * writer_ids <-- ids of associated writers
559  *----------------------------------------------------------------------------*/
560 
561 void
562 cs_post_define_existing_mesh(int mesh_id,
563  fvm_nodal_t *exp_mesh,
564  int dim_shift,
565  bool transfer,
566  bool auto_variables,
567  int n_writers,
568  const int writer_ids[]);
569 
570 /*----------------------------------------------------------------------------
571  * Create a mesh based upon the extraction of edges from an existing mesh.
572  *
573  * The newly created edges have no link to their parent elements, so
574  * no variable referencing parent elements may be output to this mesh,
575  * whose main use is to visualize "true" face edges when polygonal faces
576  * are subdivided by the writer. In this way, even highly non-convex
577  * faces may be visualized correctly if their edges are overlaid on
578  * the surface mesh with subdivided polygons.
579  *
580  * parameters:
581  * mesh_id <-- id of edges mesh to create (< 0 reserved, > 0 for user)
582  * base_mesh_id <-- id of existing mesh (< 0 reserved, > 0 for user)
583  * n_writers <-- number of associated writers
584  * writer_ids <-- ids of associated writers
585  *----------------------------------------------------------------------------*/
586 
587 void
588 cs_post_define_edges_mesh(int mesh_id,
589  int base_mesh_id,
590  int n_writers,
591  const int writer_ids[]);
592 
593 /*----------------------------------------------------------------------------
594  * Get a postprocessing meshes entity presence flag.
595  *
596  * This flag is an array of 3 integers, indicating the presence of elements
597  * of given types on at least one subdomain (i.e. rank):
598  * 0: presence of cells
599  * 1: presence of interior faces
600  * 2: presence of boundary faces
601  *
602  * parameters:
603  * mesh_id <-- postprocessing mesh id
604  *
605  * returns:
606  * pointer to entity presence flag
607  *----------------------------------------------------------------------------*/
608 
609 const int *
610 cs_post_mesh_get_ent_flag(int mesh_id);
611 
612 /*----------------------------------------------------------------------------
613  * Get a postprocessing mesh's number of cells.
614  *
615  * parameters:
616  * mesh_id <-- postprocessing mesh id
617  *
618  * returns:
619  * number of cells of postprocessing mesh.
620  *----------------------------------------------------------------------------*/
621 
622 cs_lnum_t
623 cs_post_mesh_get_n_cells(int mesh_id);
624 
625 /*----------------------------------------------------------------------------
626  * Get a postprocessing mesh's list of cells.
627  *
628  * The array of cell ids must be of at least size
629  * cs_post_mesh_get_n_cells(mesh_id).
630  *
631  * parameters:
632  * mesh_id <-- postprocessing mesh id
633  * cell_ids --> array of associated cell ids (0 to n-1 numbering,
634  * relative to main mesh)
635  *----------------------------------------------------------------------------*/
636 
637 void
638 cs_post_mesh_get_cell_ids(int mesh_id,
639  cs_lnum_t *cell_ids);
640 
641 /*----------------------------------------------------------------------------
642  * Get a postprocessing mesh's number of interior faces.
643  *
644  * parameters:
645  * mesh_id <-- postprocessing mesh id
646  *
647  * returns:
648  * number of cells of postprocessing mesh.
649  *----------------------------------------------------------------------------*/
650 
651 cs_lnum_t
652 cs_post_mesh_get_n_i_faces(int mesh_id);
653 
654 /*----------------------------------------------------------------------------
655  * Get a postprocessing mesh's list of boundary faces.
656  *
657  * The array of boundary face ids must be of at least size
658  * cs_post_mesh_get_n_b_faces(mesh_id).
659  *
660  * parameters:
661  * mesh_id <-- postprocessing mesh id
662  * i_face_ids --> array of associated interior faces ids
663  * (0 to n-1 numbering, relative to main mesh)
664  *----------------------------------------------------------------------------*/
665 
666 void
667 cs_post_mesh_get_i_face_ids(int mesh_id,
668  cs_lnum_t i_face_ids[]);
669 
670 /*----------------------------------------------------------------------------
671  * Get a postprocessing mesh's number of boundary faces
672  *
673  * parameters:
674  * mesh_id <-- postprocessing mesh id
675  *
676  * returns:
677  * number of cells of postprocessing mesh.
678  *----------------------------------------------------------------------------*/
679 
680 cs_lnum_t
681 cs_post_mesh_get_n_b_faces(int mesh_id);
682 
683 /*----------------------------------------------------------------------------
684  * Get a postprocessing mesh's list of boundary faces.
685  *
686  * The array of boundary face ids must be of at least size
687  * cs_post_mesh_get_n_b_faces(mesh_id).
688  *
689  * parameters:
690  * mesh_id <-- postprocessing mesh id
691  * b_face_ids --> array of associated boundary faces ids
692  * (0 to n-1 numbering, relative to main mesh)
693  *----------------------------------------------------------------------------*/
694 
695 void
696 cs_post_mesh_get_b_face_ids(int mesh_id,
697  cs_lnum_t b_face_ids[]);
698 
699 /*----------------------------------------------------------------------------
700  * Remove a post-processing mesh.
701  *
702  * No further post-processing output will be allowed on this mesh,
703  * so the associated structures may be freed.
704  *
705  * A post-processing mesh that has been associated with a time-varying
706  * writer or that is referenced by an alias may not be removed.
707  *
708  * parameters:
709  * mesh_id <-- id of mesh to remove
710  *----------------------------------------------------------------------------*/
711 
712 void
713 cs_post_free_mesh(int mesh_id);
714 
715 /*----------------------------------------------------------------------------
716  * Check for the existence of a writer of the given id.
717  *
718  * parameters:
719  * writer_id <-- writer id to check
720  *
721  * returns:
722  * true if writer with this id exists, false otherwise
723  *----------------------------------------------------------------------------*/
724 
725 bool
726 cs_post_writer_exists(int writer_id);
727 
728 /*----------------------------------------------------------------------------
729  * Return a pointer to the FVM library writer associated to a writer_id.
730  *
731  * parameters:
732  * writer_id <-- associated writer id
733  *
734  * Returns:
735  * a pointer to a fvm_writer_t structure
736  *----------------------------------------------------------------------------*/
737 
738 fvm_writer_t *
739 cs_post_get_writer(int writer_id);
740 
741 /*----------------------------------------------------------------------------
742  * Check for the existence of a post-processing mesh of the given id.
743  *
744  * parameters:
745  * mesh_id <-- mesh id to check
746  *
747  * returns:
748  * true if mesh with this id exists, false otherwise
749  *----------------------------------------------------------------------------*/
750 
751 bool
752 cs_post_mesh_exists(int mesh_id);
753 
754 /*----------------------------------------------------------------------------
755  * Modify an existing post-processing mesh.
756  *
757  * The lists of cells or faces are redefined, for example to update an
758  * extracted mesh based in "interesting" zones.
759  *
760  * It is not necessary to use this function if a mesh is simply deformed.
761  *
762  * parameters:
763  * mesh_id <-- id of mesh to modify (< 0 reserved, > 0 for user)
764  * n_cells <-- number of associated cells
765  * n_i_faces <-- number of associated interior faces
766  * n_b_faces <-- number of associated boundary faces
767  * cell_list <-> list of associated cells
768  * i_face_list <-> list of associated interior faces
769  * b_face_list <-> list of associated boundary faces
770  *
771  *----------------------------------------------------------------------------*/
772 
773 void
774 cs_post_modify_mesh(int mesh_id,
775  cs_lnum_t n_cells,
776  cs_lnum_t n_i_faces,
777  cs_lnum_t n_b_faces,
778  cs_lnum_t cell_list[],
779  cs_lnum_t i_face_list[],
780  cs_lnum_t b_face_list[]);
781 
782 /*----------------------------------------------------------------------------
783  * Return the default writer format name
784  *
785  * Returns:
786  * name of the default writer format
787  *----------------------------------------------------------------------------*/
788 
789 const char *
791 
792 /*----------------------------------------------------------------------------
793  * Return the default writer format options
794  *
795  * Returns:
796  * default writer format options string
797  *----------------------------------------------------------------------------*/
798 
799 const char *
801 
802 /*----------------------------------------------------------------------------
803  * Return the next "reservable" (i.e. non-user) writer id available.
804  *
805  * Returns:
806  * the smallest negative integer present, -1
807  *----------------------------------------------------------------------------*/
808 
809 int
811 
812 /*----------------------------------------------------------------------------
813  * Return the next "reservable" (i.e. non-user) mesh id available.
814  *
815  * Returns:
816  * the smallest negative integer present, -1
817  *----------------------------------------------------------------------------*/
818 
819 int
821 
822 /*----------------------------------------------------------------------------
823  * Update "active" or "inactive" flag of writers whose output frequency
824  * is a divisor of the current time step number.
825  *
826  * parameters:
827  * nt_max_abs <-- maximum time step number
828  * nt_cur_abs <-- current time step number
829  * t_cur_abs <-- absolute time at the current time step
830  *----------------------------------------------------------------------------*/
831 
832 void
833 cs_post_activate_if_default(int nt_max_abs,
834  int nt_cur_abs,
835  double t_cur_abs);
836 
837 /*----------------------------------------------------------------------------
838  * Force the "active" or "inactive" flag for a specific writer or for all
839  * writers for the current time step.
840  *
841  * parameters:
842  * writer_id <-- writer id, or 0 for all writers
843  * activate <-- false to deactivate, true to activate
844  *----------------------------------------------------------------------------*/
845 
846 void
847 cs_post_activate_writer(int writer_id,
848  bool activate);
849 
850 /*----------------------------------------------------------------------------
851  * Output post-processing meshes using associated writers.
852  *
853  * parameters:
854  * nt_cur_abs <-- current time step number
855  * t_cur_abs <-- current physical time
856  *----------------------------------------------------------------------------*/
857 
858 void
859 cs_post_write_meshes(int nt_cur_abs,
860  double t_cur_abs);
861 
862 /*----------------------------------------------------------------------------
863  * Output a variable defined at cells or faces of a post-processing mesh
864  * using associated writers.
865  *
866  * parameters:
867  * mesh_id <-- id of associated mesh
868  * var_name <-- name of variable to output
869  * var_dim <-- 1 for scalar, 3 for vector
870  * interlace <-- if a vector, true for interlaced values, false otherwise
871  * use_parent <-- true if values are defined on "parent" mesh,
872  * false if values are defined on post-processing mesh
873  * var_type <-- variable's data type
874  * nt_cur_abs <-- current time step number
875  * t_cur_abs <-- current physical time
876  * cel_vals <-- cell values
877  * i_face_vals <-- interior face values
878  * b_face_vals <-- boundary face values
879  *----------------------------------------------------------------------------*/
880 
881 void
882 cs_post_write_var(int mesh_id,
883  const char *var_name,
884  int var_dim,
885  bool interlace,
886  bool use_parent,
887  cs_post_type_t var_type,
888  int nt_cur_abs,
889  double t_cur_abs,
890  const void *cel_vals,
891  const void *i_face_vals,
892  const void *b_face_vals);
893 
894 /*----------------------------------------------------------------------------
895  * Output a variable defined at vertices of a post-processing mesh using
896  * associated writers.
897  *
898  * parameters:
899  * mesh_id <-- id of associated mesh
900  * var_name <-- name of variable to output
901  * var_dim <-- 1 for scalar, 3 for vector
902  * interlace <-- if a vector, true for interlaced values, false otherwise
903  * use_parent <-- true if values are defined on "parent" mesh,
904  * false if values are defined on post-processing mesh
905  * var_type <-- variable's data type
906  * nt_cur_abs <-- current time step number
907  * t_cur_abs <-- current physical time
908  * vtx_vals <-- vertex values
909  *----------------------------------------------------------------------------*/
910 
911 void
912 cs_post_write_vertex_var(int mesh_id,
913  const char *var_name,
914  int var_dim,
915  bool interlace,
916  bool use_parent,
917  cs_post_type_t var_type,
918  int nt_cur_abs,
919  double t_cur_abs,
920  const void *vtx_vals);
921 
922 /*----------------------------------------------------------------------------
923  * Update references to parent mesh of post-processing meshes in case of
924  * computational mesh cell renumbering.
925  *
926  * This function may be called only once, after possible renumbering of cells,
927  * to update existing post-processing meshes. Post-processing meshes defined
928  * after renumbering will automatically be based upon the new numbering,
929  * so this function will not need to be called again.
930  *
931  * parameters:
932  * init_cell_num <-- initial cell numbering (1 to n, new -> old)
933  *----------------------------------------------------------------------------*/
934 
935 void
936 cs_post_renum_cells(const cs_lnum_t init_cell_num[]);
937 
938 /*----------------------------------------------------------------------------
939  * Update references to parent mesh of post-processing meshes in case of
940  * computational mesh interior and/or boundary faces renumbering.
941  *
942  * This function may be called only once, after possible renumbering of faces,
943  * to update existing post-processing meshes. Post-processing meshes defined
944  * after renumbering will automatically be based upon the new numbering,
945  * so this function will not need to be called again.
946  *
947  * parameters:
948  * init_i_face_num <-- initial interior numbering (1 to n, new -> old)
949  * init_b_face_num <-- initial boundary numbering (1 to n, new -> old)
950  *----------------------------------------------------------------------------*/
951 
952 void
953 cs_post_renum_faces(const cs_lnum_t init_i_face_num[],
954  const cs_lnum_t init_b_face_num[]);
955 
956 /*----------------------------------------------------------------------------
957  * Initialize post-processing writers
958  *----------------------------------------------------------------------------*/
959 
960 void
962 
963 /*----------------------------------------------------------------------------
964  * Initialize main post-processing meshes
965  *
966  * The check_flag variable is a mask, used for additionnal post-processing:
967  *
968  * - If (check_flag & 1), volume submeshes are output by groups if more
969  * than one group is present and the default writer uses the EnSight format.
970  *
971  * - If (check_flag & 2), boundary submeshes are output by groups if more
972  * than one group is present and the default writer uses the EnSight format.
973  *
974  * Note that all alias-type post-processing meshes and the meshes they
975  * relate to should have been defined before calling this function, so it is
976  * recommended that user-defined post-processing meshes be defined before
977  * calling this function, though specific "automatic" meshes (for example
978  * those related to couplings) may be defined between this call and a
979  * time loop.
980  *
981  * parameters:
982  * check_flag <-- mask used for additional output
983  *----------------------------------------------------------------------------*/
984 
985 void
986 cs_post_init_meshes(int check_mask);
987 
988 /*----------------------------------------------------------------------------
989  * Loop on post-processing meshes to output variables.
990  *
991  * This handles all default fields output, as well as all
992  * registred output functions.
993  *
994  * parameters:
995  * nt_cur_abs <-- current time step number
996  * t_cur_abs <-- current physical time
997  *----------------------------------------------------------------------------*/
998 
999 void
1000 cs_post_write_vars(int nt_cur_abs,
1001  double t_cur_abs);
1002 
1003 /*----------------------------------------------------------------------------
1004  * Destroy all structures associated with post-processing
1005  *----------------------------------------------------------------------------*/
1006 
1007 void
1008 cs_post_finalize(void);
1009 
1010 /*----------------------------------------------------------------------------
1011  * Postprocess free (isolated) faces of the current global mesh
1012  *----------------------------------------------------------------------------*/
1013 
1014 void
1016 
1017 /*----------------------------------------------------------------------------
1018  * Initialize post-processing writer with same format and associated
1019  * options as default writer, but no time dependency, intended to
1020  * troubleshoot errors.
1021  *----------------------------------------------------------------------------*/
1022 
1023 void
1025 
1026 /*----------------------------------------------------------------------------
1027  * Initialize post-processing writer with same format and associated
1028  * options as default writer, but no time dependency, and associate
1029  * and output global volume mesh.
1030  *
1031  * This is intended to help troubleshoot errors using fields based
1032  * on cells.
1033  *
1034  * returns:
1035  * id of error output mesh (< 0), or 0 if all writers are deactivated
1036  *----------------------------------------------------------------------------*/
1037 
1038 int
1040 
1041 /*----------------------------------------------------------------------------
1042  * Register a processing of time-dependent variables to the call to
1043  * cs_post_write_vars().
1044  *
1045  * Note: if the input pointer is non-NULL, it must point to valid data
1046  * when the output function is called, so either:
1047  * - that value or structure should not be temporary (i.e. local);
1048  * - post-processing output must be ensured using cs_post_write_var()
1049  * or similar before the data pointed to goes out of scope.
1050  *
1051  * parameters:
1052  * function <-- function to register
1053  * input <-> pointer to optional (untyped) value or structure.
1054  *----------------------------------------------------------------------------*/
1055 
1056 void
1058  void *input);
1059 
1060 /*----------------------------------------------------------------------------
1061  * Register a processing of time-dependent variables than can be output
1062  * on different meshes to the call to cs_post_write_vars().
1063  *
1064  * Note: if the input pointer is non-NULL, it must point to valid data
1065  * when the output function is called, so either:
1066  * - that value or structure should not be temporary (i.e. local);
1067  * - post-processing output must be ensured using cs_post_write_var()
1068  * or similar before the data pointed to goes out of scope.
1069  *
1070  * parameters:
1071  * function <-- function to register
1072  * input <-> pointer to optional (untyped) value or structure.
1073  *----------------------------------------------------------------------------*/
1074 
1075 void
1077  void *input);
1078 
1079 /*----------------------------------------------------------------------------*/
1080 
1082 
1083 #endif /* __CS_POST_H__ */
const char * cs_post_get_default_format(void)
Definition: cs_post.c:3286
void cs_post_mesh_get_i_face_ids(int mesh_id, cs_lnum_t i_face_ids[])
Definition: cs_post.c:3061
void cs_post_init_error_writer(void)
Definition: cs_post.c:4730
cs_post_type_t
Definition: cs_post.h:75
void pstema(const cs_int_t *ntcabs, const cs_real_t *ttcabs)
Definition: cs_post.c:2210
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[])
Definition: cs_post.c:2646
void cs_post_write_vertex_var(int mesh_id, const char *var_name, int var_dim, bool interlace, bool use_parent, cs_post_type_t var_type, int nt_cur_abs, double t_cur_abs, const void *vtx_vals)
Definition: cs_post.c:3741
void cs_post_free_mesh(int mesh_id)
Definition: cs_post.c:3178
void cs_post_init_writers(void)
Definition: cs_post.c:4024
void( cs_post_time_mesh_dep_output_t)(void *input, int mesh_id, int cat_id, int ent_flag[3], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_list[], const cs_lnum_t i_face_list[], const cs_lnum_t b_face_list[], int nt_cur_abs, cs_real_t t_cur_abs)
Definition: cs_post.h:168
Definition: fvm_nodal_priv.h:152
Definition: fvm_writer_priv.h:171
#define BEGIN_C_DECLS
Definition: cs_defs.h:365
const int * cs_post_mesh_get_ent_flag(int mesh_id)
Definition: cs_post.c:2956
Definition: cs_post.h:80
int cs_post_get_free_writer_id(void)
Definition: cs_post.c:3312
int cs_post_init_error_writer_cells(void)
Definition: cs_post.c:4765
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[])
Definition: cs_post.c:2776
fvm_writer_time_dep_t
Definition: fvm_writer.h:58
fvm_writer_t * cs_post_get_writer(int writer_id)
Definition: cs_post.c:3434
#define CS_ARGF_SUPP_CHAINE
Definition: cs_defs.h:394
void cs_post_renum_faces(const cs_lnum_t init_i_face_num[], const cs_lnum_t init_b_face_num[])
Definition: cs_post.c:3926
void pstdfm(void)
Definition: cs_post.c:2143
void cs_post_init_meshes(int check_mask)
Definition: cs_post.c:4067
int cs_int_t
Definition: cs_defs.h:263
void cs_post_write_var(int mesh_id, const char *var_name, int var_dim, bool interlace, bool use_parent, cs_post_type_t var_type, int nt_cur_abs, double t_cur_abs, const void *cel_vals, const void *i_face_vals, const void *b_face_vals)
Definition: cs_post.c:3504
void cs_post_mesh_get_b_face_ids(int mesh_id, cs_lnum_t b_face_ids[])
Definition: cs_post.c:3133
cs_lnum_t cs_post_mesh_get_n_b_faces(int mesh_id)
Definition: cs_post.c:3104
cs_lnum_t cs_post_mesh_get_n_i_faces(int mesh_id)
Definition: cs_post.c:3032
void pstusn(const cs_int_t *ntmabs, const cs_int_t *ntcabs, const cs_real_t *ttcabs)
Definition: cs_post.c:2322
const char * cs_post_get_default_format_options(void)
Definition: cs_post.c:3299
void pstev1(const cs_int_t *nummai, const char *nomvar, const cs_int_t *lnmvar, const cs_int_t *idimt, const cs_int_t *ientla, const cs_int_t *ivarpr, const cs_int_t *ntcabs, const cs_real_t *ttcabs, const cs_real_t varcel[], const cs_real_t varfac[], const cs_real_t varfbr[] CS_ARGF_SUPP_CHAINE)
Definition: cs_post.c:2245
void cs_post_add_time_mesh_dep_output(cs_post_time_mesh_dep_output_t *function, void *input)
Definition: cs_post.c:4865
Definition: cs_post.h:76
Definition: cs_post.h:77
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[])
Definition: cs_post.c:2480
void( cs_post_time_dep_output_t)(void *input, int nt_cur_abs, cs_real_t t_cur_abs)
Definition: cs_post.h:131
int cs_lnum_t
Definition: cs_defs.h:260
void cs_post_finalize(void)
Definition: cs_post.c:4430
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_end, int frequency_n, double frequency_t)
Definition: cs_post.c:2360
void cs_post_write_vars(int nt_cur_abs, double t_cur_abs)
Definition: cs_post.c:4177
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[])
Definition: cs_post.c:2580
void cs_post_modify_mesh(int mesh_id, cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, cs_lnum_t cell_list[], cs_lnum_t i_face_list[], cs_lnum_t b_face_list[])
void pstntc(const cs_int_t *ntmabs, const cs_int_t *ntcabs, const cs_real_t *ttcabs)
Definition: cs_post.c:2165
int cs_post_get_free_mesh_id(void)
Definition: cs_post.c:3325
void cs_post_activate_if_default(int nt_max_abs, int nt_cur_abs, double t_cur_abs)
Definition: cs_post.c:3341
void cs_post_set_deformable(void)
Definition: cs_post.c:4014
cs_lnum_t cs_post_mesh_get_n_cells(int mesh_id)
Definition: cs_post.c:2974
void cs_post_mesh_get_cell_ids(int mesh_id, cs_lnum_t *cell_ids)
Definition: cs_post.c:3003
void cs_post_activate_writer(int writer_id, bool activate)
Definition: cs_post.c:3404
void cs_post_add_free_faces(void)
Definition: cs_post.c:4521
#define END_C_DECLS
Definition: cs_defs.h:366
double cs_real_t
Definition: cs_defs.h:264
void cs_post_write_meshes(int nt_cur_abs, double t_cur_abs)
Definition: cs_post.c:3457
void cs_post_add_time_dep_output(cs_post_time_dep_output_t *function, void *input)
Definition: cs_post.c:4825
#define CS_PROCF(x, y)
Definition: cs_defs.h:379
void cs_post_define_edges_mesh(int mesh_id, int base_mesh_id, int n_writers, const int writer_ids[])
Definition: cs_post.c:2898
void( cs_post_elt_select_t)(void *input, cs_lnum_t *n_elts, cs_lnum_t **elt_list)
Definition: cs_post.h:107
void cs_post_define_alias_mesh(int mesh_id, int aliased_mesh_id, bool auto_variables, int n_writers, const int writer_ids[])
Definition: cs_post.c:2708
bool cs_post_mesh_exists(int mesh_id)
Definition: cs_post.c:3262
void pstact(const cs_int_t *numwri, const cs_int_t *indact)
Definition: cs_post.c:2188
bool cs_post_writer_exists(int writer_id)
Definition: cs_post.c:3233
Definition: cs_post.h:78
Definition: cs_post.h:79
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[])
Definition: cs_post.c:2536
void cs_post_renum_cells(const cs_lnum_t init_cell_num[])
Definition: cs_post.c:3851