My Project
programmer's documentation
Macros | Typedefs | Enumerations | Functions
cs_post.h File Reference
#include "fvm_nodal.h"
#include "fvm_writer.h"
#include "cs_base.h"
#include "cs_interpolate.h"
#include "cs_probe.h"
#include "cs_time_step.h"
Include dependency graph for cs_post.h:

Go to the source code of this file.

Macros

#define CS_POST_ON_LOCATION
 
#define CS_POST_BOUNDARY_NR
 
#define CS_POST_MONITOR   (1 << 2) /* monitor variables */
 
#define CS_POST_WRITER_ALL_ASSOCIATED   0 /* all associated writers */
 
#define CS_POST_WRITER_DEFAULT   -1 /* default visualisation */
 
#define CS_POST_WRITER_ERRORS   -2 /* error visualisation */
 
#define CS_POST_WRITER_PARTICLES   -3 /* particle visualisation */
 
#define CS_POST_WRITER_TRAJECTORIES   -4 /* trajectories visualisation */
 
#define CS_POST_WRITER_PROBES   -5 /* probe monitoring */
 
#define CS_POST_WRITER_PROFILES   -6 /* profiles */
 
#define CS_POST_WRITER_HISTOGRAMS   -7 /* histograms */
 
#define CS_POST_MESH_VOLUME   -1 /* volume mesh output */
 
#define CS_POST_MESH_BOUNDARY   -2 /* boundary mesh output */
 
#define CS_POST_MESH_PARTICLES   -3 /* particle output */
 
#define CS_POST_MESH_TRAJECTORIES   -4 /* particle output */
 
#define CS_POST_MESH_PROBES   -5 /* probes output */
 
#define CS_POST_MESH_SURFACE
 

Typedefs

typedef void() cs_post_elt_select_t(void *input, cs_lnum_t *n_elts, cs_lnum_t **elt_list)
 Function pointer to elements selection definition. More...
 
typedef void() cs_post_time_dep_output_t(void *input, const cs_time_step_t *ts)
 
typedef void() cs_post_time_mesh_dep_output_t(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_ids[], const cs_lnum_t i_face_ids[], const cs_lnum_t b_face_ids[], const cs_time_step_t *ts)
 

Enumerations

enum  cs_post_type_t {
  CS_POST_TYPE_cs_int_t, CS_POST_TYPE_cs_real_t, CS_POST_TYPE_int, CS_POST_TYPE_float,
  CS_POST_TYPE_double
}
 Postprocessing input variable type. More...
 

Functions

void cs_post_define_writer (int writer_id, const char *case_name, const char *dir_name, const char *fmt_name, const char *fmt_opts, fvm_writer_time_dep_t time_dep, bool output_at_start, bool output_at_end, int frequency_n, double frequency_t)
 Define a writer; this objects manages a case's name, directory, and format, as well as associated mesh's time dependency, and the default output frequency for associated variables. More...
 
void cs_post_define_volume_mesh (int mesh_id, const char *mesh_name, const char *cell_criteria, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
 Define a volume post-processing mesh. More...
 
void cs_post_define_volume_mesh_by_func (int mesh_id, const char *mesh_name, cs_post_elt_select_t *cell_select_func, void *cell_select_input, bool time_varying, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
 Define a volume post-processing mesh using a selection function. More...
 
void cs_post_define_surface_mesh (int mesh_id, const char *mesh_name, const char *i_face_criteria, const char *b_face_criteria, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
 Define a surface post-processing mesh. More...
 
void cs_post_define_surface_mesh_by_func (int mesh_id, const char *mesh_name, cs_post_elt_select_t *i_face_select_func, cs_post_elt_select_t *b_face_select_func, void *i_face_select_input, void *b_face_select_input, bool time_varying, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
 Define a surface post-processing mesh using selection functions. More...
 
void cs_post_define_particles_mesh (int mesh_id, const char *mesh_name, const char *cell_criteria, double density, bool trajectory, bool auto_variables, int n_writers, const int writer_ids[])
 Define a particles post-processing mesh. More...
 
void cs_post_define_particles_mesh_by_func (int mesh_id, const char *mesh_name, cs_post_elt_select_t *p_select_func, void *p_select_input, bool trajectory, bool auto_variables, int n_writers, const int writer_ids[])
 Define a particles post-processing mesh using a selection function. More...
 
void cs_post_define_existing_mesh (int mesh_id, fvm_nodal_t *exp_mesh, int dim_shift, bool transfer, bool auto_variables, int n_writers, const int writer_ids[])
 Create a post-processing mesh associated with an existing exportable mesh representation. More...
 
void cs_post_define_edges_mesh (int mesh_id, int base_mesh_id, int n_writers, const int writer_ids[])
 Create a mesh based upon the extraction of edges from an existing mesh. More...
 
void cs_post_mesh_attach_writer (int mesh_id, int writer_id)
 Associate a writer to a postprocessing mesh. More...
 
void cs_post_mesh_detach_writer (int mesh_id, int writer_id)
 De-associate a writer from a postprocessing mesh. More...
 
const int * cs_post_mesh_get_ent_flag (int mesh_id)
 Get a postprocessing meshes entity presence flag. More...
 
cs_lnum_t cs_post_mesh_get_n_cells (int mesh_id)
 Get a postprocessing mesh's number of cells. More...
 
void cs_post_mesh_get_cell_ids (int mesh_id, cs_lnum_t *cell_ids)
 Get a postprocessing mesh's list of cells. More...
 
cs_lnum_t cs_post_mesh_get_n_i_faces (int mesh_id)
 Get a postprocessing mesh's number of interior faces. More...
 
void cs_post_mesh_get_i_face_ids (int mesh_id, cs_lnum_t i_face_ids[])
 Get a postprocessing mesh's list of boundary faces. More...
 
cs_lnum_t cs_post_mesh_get_n_b_faces (int mesh_id)
 Get a postprocessing mesh's number of boundary faces. More...
 
void cs_post_mesh_get_b_face_ids (int mesh_id, cs_lnum_t b_face_ids[])
 Get a postprocessing mesh's list of boundary faces. More...
 
cs_lnum_t cs_post_mesh_get_n_vertices (int mesh_id)
 Get a postprocessing mesh's number of vertices. More...
 
void cs_post_mesh_get_vertex_ids (int mesh_id, cs_lnum_t *vertex_ids)
 Get a postprocessing mesh's list of vertices. More...
 
void cs_post_mesh_set_post_domain (int mesh_id, bool post_domain)
 Set whether postprocessing mesh's parallel domain should be output. More...
 
void cs_post_free_mesh (int mesh_id)
 Remove a post-processing mesh. More...
 
bool cs_post_writer_exists (int writer_id)
 Check for the existence of a writer of the given id. More...
 
bool cs_post_mesh_exists (int mesh_id)
 Check for the existence of a post-processing mesh of the given id. More...
 
const char * cs_post_get_default_format (void)
 Return the default writer format name. More...
 
const char * cs_post_get_default_format_options (void)
 Return the default writer format options. More...
 
int cs_post_get_free_writer_id (void)
 Return the next "reservable" (i.e. non-user) writer id available. More...
 
int cs_post_get_free_mesh_id (void)
 Return the next "reservable" (i.e. non-user) mesh id available. More...
 
void cs_post_activate_by_time_step (const cs_time_step_t *ts)
 Update "active" or "inactive" flag of writers based on the time step. More...
 
void cs_post_activate_writer (int writer_id, bool activate)
 Force the "active" or "inactive" flag for a specific writer or for all writers for the current time step. More...
 
void cs_post_disable_writer (int writer_id)
 Disable specific writer or all writers not currently active until cs_post_enable_writer or cs_post_activate_writer is called for those writers. More...
 
void cs_post_enable_writer (int writer_id)
 Enable a specific writer or all writers currently disabled by previous calls to cs_post_disable_writer. More...
 
fvm_writer_t * cs_post_get_writer (int writer_id)
 Return a pointer to the FVM writer associated to a writer_id. More...
 
fvm_writer_time_dep_t cs_post_get_writer_time_dep (int writer_id)
 Return time dependency associated to a writer_id. More...
 
void cs_post_add_writer_t_step (int writer_id, int nt)
 Add an activation time step for a specific writer or for all writers. More...
 
void cs_post_add_writer_t_value (int writer_id, double t)
 Add an activation time value for a specific writer or for all writers. More...
 
void cs_post_write_meshes (const cs_time_step_t *ts)
 Output post-processing meshes using associated writers. More...
 
void cs_post_write_var (int mesh_id, int writer_id, const char *var_name, int var_dim, bool interlace, bool use_parent, cs_post_type_t var_type, const void *cel_vals, const void *i_face_vals, const void *b_face_vals, const cs_time_step_t *ts)
 Output a variable defined at cells or faces of a post-processing mesh using associated writers. More...
 
void cs_post_write_vertex_var (int mesh_id, int writer_id, const char *var_name, int var_dim, bool interlace, bool use_parent, cs_post_type_t var_type, const void *vtx_vals, const cs_time_step_t *ts)
 Output a variable defined at vertices of a post-processing mesh using associated writers. More...
 
void cs_post_write_particle_values (int mesh_id, int writer_id, int attr_id, const char *var_name, int component_id, const cs_time_step_t *ts)
 Output an existing lagrangian particle attribute at particle positions or trajectory endpoints of a particle mesh using associated writers. More...
 
void cs_post_write_probe_values (int mesh_id, int writer_id, const char *var_name, int var_dim, cs_post_type_t var_type, int parent_location_id, cs_interpolate_from_location_t *interpolate_func, void *interpolate_input, const void *vals, const cs_time_step_t *ts)
 Output a variable defined at cells or faces of a post-processing mesh using associated writers. More...
 
void cs_post_renum_cells (const cs_lnum_t init_cell_num[])
 Update references to parent mesh of post-processing meshes in case of computational mesh cell renumbering. More...
 
void cs_post_renum_faces (const cs_lnum_t init_i_face_num[], const cs_lnum_t init_b_face_num[])
 Update references to parent mesh of post-processing meshes in case of computational mesh interior and/or boundary faces renumbering. More...
 
void cs_post_set_deformable (void)
 Configure the post-processing output so that a mesh displacement field may be output automatically for meshes based on the global volume mesh. More...
 
void cs_post_set_changing_connectivity (void)
 Configure the post-processing output so that mesh connectivity may be automatically updated. More...
 
void cs_post_init_writers (void)
 Initialize post-processing writers. More...
 
void cs_post_init_meshes (int check_mask)
 Initialize main post-processing meshes. More...
 
void cs_post_time_step_begin (const cs_time_step_t *ts)
 Check if post-processing is activated and then update post-processing of meshes if there is a need to update time-dependent meshes. More...
 
void cs_post_time_step_output (const cs_time_step_t *ts)
 Loop on post-processing meshes to output variables. More...
 
void cs_post_time_step_end (void)
 Flush writers and free time-varying and Lagragian mesh if needed of meshes if there is a time-dependent mesh. More...
 
void cs_post_write_vars (const cs_time_step_t *ts)
 Loop on post-processing meshes to output variables. More...
 
void cs_post_finalize (void)
 Destroy all structures associated with post-processing. More...
 
void cs_post_add_free_faces (void)
 Postprocess free (isolated) faces of the current global mesh. More...
 
void cs_post_init_error_writer (void)
 Initialize post-processing writer with same format and associated options as default writer, but no time dependency, intended to troubleshoot errors. More...
 
int cs_post_init_error_writer_cells (void)
 Initialize post-processing writer with same format and associated options as default writer, but no time dependency, and associate and output global volume mesh. More...
 
void cs_post_add_time_dep_output (cs_post_time_dep_output_t *function, void *input)
 Register a processing of time-dependent variables to the call to cs_post_write_vars(). More...
 
void cs_post_add_time_mesh_dep_output (cs_post_time_mesh_dep_output_t *function, void *input)
 Register a processing of time-dependent variables than can be output on different meshes to the call to cs_post_write_vars(). More...
 

Macro Definition Documentation

◆ CS_POST_BOUNDARY_NR

CS_POST_BOUNDARY_NR
Value:
(1 << 1) /* postprocess boundary
without reconstruction */

postprocess boundary without reconstruction

◆ CS_POST_MESH_BOUNDARY

#define CS_POST_MESH_BOUNDARY   -2 /* boundary mesh output */

◆ CS_POST_MESH_PARTICLES

#define CS_POST_MESH_PARTICLES   -3 /* particle output */

◆ CS_POST_MESH_PROBES

#define CS_POST_MESH_PROBES   -5 /* probes output */

◆ CS_POST_MESH_SURFACE

#define CS_POST_MESH_SURFACE
Value:
-12 /* surface (boundary and/or
interior) mesh */

◆ CS_POST_MESH_TRAJECTORIES

#define CS_POST_MESH_TRAJECTORIES   -4 /* particle output */

◆ CS_POST_MESH_VOLUME

#define CS_POST_MESH_VOLUME   -1 /* volume mesh output */

◆ CS_POST_MONITOR

#define CS_POST_MONITOR   (1 << 2) /* monitor variables */

◆ CS_POST_ON_LOCATION

CS_POST_ON_LOCATION
Value:
(1 << 0) /* postprocess variables
on their base location
(volume for variables) */

postprocess variables on their base location (volume for variables)

◆ CS_POST_WRITER_ALL_ASSOCIATED

#define CS_POST_WRITER_ALL_ASSOCIATED   0 /* all associated writers */

◆ CS_POST_WRITER_DEFAULT

#define CS_POST_WRITER_DEFAULT   -1 /* default visualisation */

◆ CS_POST_WRITER_ERRORS

#define CS_POST_WRITER_ERRORS   -2 /* error visualisation */

◆ CS_POST_WRITER_HISTOGRAMS

#define CS_POST_WRITER_HISTOGRAMS   -7 /* histograms */

◆ CS_POST_WRITER_PARTICLES

#define CS_POST_WRITER_PARTICLES   -3 /* particle visualisation */

◆ CS_POST_WRITER_PROBES

#define CS_POST_WRITER_PROBES   -5 /* probe monitoring */

◆ CS_POST_WRITER_PROFILES

#define CS_POST_WRITER_PROFILES   -6 /* profiles */

◆ CS_POST_WRITER_TRAJECTORIES

#define CS_POST_WRITER_TRAJECTORIES   -4 /* trajectories visualisation */

Typedef Documentation

◆ cs_post_elt_select_t

cs_post_elt_select_t

Function pointer to elements selection definition.

Each function of this sort may be used to select a given type of element, usually cells, interior faces, or boundary faces.

If non-empty and not containing all elements, a list of elements of the main mesh should be allocated (using BFT_MALLOC) and defined by this function when called. This list's lifecycle is then managed by the postprocessing subsystem.

Note: if the input pointer is non-NULL, it must point to valid data when the selection function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_meshes() with a fixed-mesh writer before the data pointed to goes out of scope;
Parameters
[in,out]inputpointer to optional (untyped) value or structure
[out]n_eltsnumber of selected elements
[out]elt_listlist of selected elements (0 to n-1 numbering)

◆ cs_post_time_dep_output_t

cs_post_time_dep_output_t

Function pointer associated with a specific post-processing output.

Such functions are registered using the cs_post_add_time_dep_output, and all registered functions are automatically called by cs_post_write_vars.

Note: if the input pointer is non-NULL, it must point to valid data when the output function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_var() or similar before the data pointed to goes out of scope.
Parameters
[in,out]inputpointer to optional (untyped) value or structure
[in]nt_cur_abscurrent time step number
[in]t_cur_absabsolute time at the current time step

◆ cs_post_time_mesh_dep_output_t

cs_post_time_mesh_dep_output_t

Function pointer associated with a specific post-processing output on multiple meshes.

Such functions are registered using the cs_post_add_time_mesh_dep_vars(), and all registered functions are automatically called by cs_post_write_vars().

Note: if the input pointer is non-NULL, it must point to valid data when the output function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_var() or similar before the data pointed to goes out of scope.
Parameters
[in,out]inputpointer to optional (untyped) value or structure
[in]mesh_idid of the output mesh for the current call
[in]cat_idcategory id of the output mesh for the current call
[in]ent_flagindicate global presence of cells (ent_flag[0]), interior faces (ent_flag[1]), boundary faces (ent_flag[2]), particles (ent_flag[3]) or probes (ent_flag[4])
[in]n_cellslocal number of cells of post_mesh
[in]n_i_faceslocal number of interior faces of post_mesh
[in]n_b_faceslocal number of boundary faces of post_mesh
[in]cell_listlist of cells (1 to n) of post-processing mesh
[in]i_face_listlist of interior faces (1 to n) of post-processing mesh
[in]b_face_listlist of boundary faces (1 to n) of post-processing mesh
[in]nt_cur_abscurrent time step number
[in]t_cur_abscurrent physical time
[in]nt_cur_abscurrent time step number
[in]t_cur_absabsolute time at the current time step

Enumeration Type Documentation

◆ cs_post_type_t

Postprocessing input variable type.

Enumerator
CS_POST_TYPE_cs_int_t 

Fortran integer

CS_POST_TYPE_cs_real_t 

Fortran double precision

CS_POST_TYPE_int 

integer

CS_POST_TYPE_float 

single precision floating-point value

CS_POST_TYPE_double 

double precision floating-point value

Function Documentation

◆ cs_post_activate_by_time_step()

void cs_post_activate_by_time_step ( const cs_time_step_t ts)

Update "active" or "inactive" flag of writers based on the time step.

Writers are activated if their output frequency is a divisor of the current time step, or if their optional time step and value output lists contain matches for the current time step.

Parameters
[in]tstime step status structure

◆ cs_post_activate_writer()

void cs_post_activate_writer ( int  writer_id,
bool  activate 
)

Force the "active" or "inactive" flag for a specific writer or for all writers for the current time step.

Parameters
[in]writer_idwriter id, or 0 for all writers
[in]activatefalse to deactivate, true to activate

◆ cs_post_add_free_faces()

void cs_post_add_free_faces ( void  )

Postprocess free (isolated) faces of the current global mesh.

◆ cs_post_add_time_dep_output()

void cs_post_add_time_dep_output ( cs_post_time_dep_output_t function,
void *  input 
)

Register a processing of time-dependent variables to the call to cs_post_write_vars().

Note: if the input pointer is non-NULL, it must point to valid data when the output function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_var() or similar before the data pointed to goes out of scope.
Parameters
[in]functionfunction to register
[in,out]inputpointer to optional (untyped) value or structure

◆ cs_post_add_time_mesh_dep_output()

void cs_post_add_time_mesh_dep_output ( cs_post_time_mesh_dep_output_t function,
void *  input 
)

Register a processing of time-dependent variables than can be output on different meshes to the call to cs_post_write_vars().

Note: if the input pointer is non-NULL, it must point to valid data when the output function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_var() or similar before the data pointed to goes out of scope.
Parameters
[in]functionfunction to register
[in,out]inputpointer to optional (untyped) value or structure

◆ cs_post_add_writer_t_step()

void cs_post_add_writer_t_step ( int  writer_id,
int  nt 
)

Add an activation time step for a specific writer or for all writers.

If a negative value is provided, a previously added activation time step matching that absolute value will be removed, if present.

Parameters
[in]writer_idwriter id, or 0 for all writers
[in]nttime step value to add (or remove)

◆ cs_post_add_writer_t_value()

void cs_post_add_writer_t_value ( int  writer_id,
double  t 
)

Add an activation time value for a specific writer or for all writers.

If a negative value is provided, a previously added activation time step matching that absolute value will be removed, if present.

Parameters
[in]writer_idwriter id, or 0 for all writers
[in]ttime value to add (or remove)

◆ cs_post_define_edges_mesh()

void cs_post_define_edges_mesh ( int  mesh_id,
int  base_mesh_id,
int  n_writers,
const int  writer_ids[] 
)

Create a mesh based upon the extraction of edges from an existing mesh.

The newly created edges have no link to their parent elements, so no variable referencing parent elements may be output to this mesh, whose main use is to visualize "true" face edges when polygonal faces are subdivided by the writer. In this way, even highly non-convex faces may be visualized correctly if their edges are overlaid on the surface mesh with subdivided polygons.

Parameters
[in]mesh_idid of edges mesh to create (< 0 reserved, > 0 for user)
[in]base_mesh_idid of existing mesh (< 0 reserved, > 0 for user)
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_existing_mesh()

void cs_post_define_existing_mesh ( int  mesh_id,
fvm_nodal_t *  exp_mesh,
int  dim_shift,
bool  transfer,
bool  auto_variables,
int  n_writers,
const int  writer_ids[] 
)

Create a post-processing mesh associated with an existing exportable mesh representation.

If the exportable mesh is not intended to be used elsewhere, one can choose to transfer its property to the post-processing mesh, which will then manage its lifecycle based on its own requirements.

If the exportable mesh must still be shared, one must be careful to maintain consistency between this mesh and the post-processing output.

The mesh in exportable dimension may be of a lower dimension than its parent mesh, if it has been projected. In this case, a dim_shift value of 1 indicates that parent cells are mapped to exportable faces, and faces to edges, while a dim_shift value of 2 would indicate that parent cells are mapped to edges. This is important when variables values are exported.

Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]exp_meshmesh in exportable representation (i.e. fvm_nodal_t)
[in]dim_shiftnonzero if exp_mesh has been projected
[in]transferif true, ownership of exp_mesh is transferred to the post-processing mesh
[in]auto_variablesif true, automatic output of main variables
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_particles_mesh()

void cs_post_define_particles_mesh ( int  mesh_id,
const char *  mesh_name,
const char *  cell_criteria,
double  density,
bool  trajectory,
bool  auto_variables,
int  n_writers,
const int  writer_ids[] 
)

Define a particles post-processing mesh.

Such a mesh is always time-varying, and will only be output by writers defined with the FVM_WRITER_TRANSIENT_CONNECT option.

If the trajectory_mode argument is set to true, this logic is reversed, and output will only occur for writers defined with the FVM_WRITER_FIXED_MESH option. In this case, a submesh consisting of trajectory segments for the current time step will be added to the output at each output time step.

Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]mesh_nameassociated mesh name
[in]cell_criteriaselection criteria for cells containing particles, or NULL.
[in]densityfraction of the particles in the selected area which should be output (0 < density <= 1)
[in]trajectoryif true, activate trajectory mode
[in]auto_variablesif true, automatic output of main variables
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_particles_mesh_by_func()

void cs_post_define_particles_mesh_by_func ( int  mesh_id,
const char *  mesh_name,
cs_post_elt_select_t p_select_func,
void *  p_select_input,
bool  trajectory,
bool  auto_variables,
int  n_writers,
const int  writer_ids[] 
)

Define a particles post-processing mesh using a selection function.

The selection may be updated over time steps.

Such a mesh is always time-varying, and will only be output by writers defined with the FVM_WRITER_TRANSIENT_CONNECT option.

If the trajectory_mode argument is set to true, this logic is reversed, and output will only occur for writers defined with the FVM_WRITER_FIXED_MESH option. In this case, a submesh consisting of trajectory segments for the current time step will be added to the output at each output time step.

Note: if the p_select_input pointer is non-NULL, it must point to valid data when the selection function is called, so that value or structure should not be temporary (i.e. local);

Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]mesh_nameassociated mesh name
[in]p_select_funcpointer to particles selection function
[in]p_select_inputpointer to optional input data for the particles selection function, or NULL
[in]trajectoryif true, activate trajectory mode
[in]auto_variablesif true, automatic output of main variables
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_surface_mesh()

void cs_post_define_surface_mesh ( int  mesh_id,
const char *  mesh_name,
const char *  i_face_criteria,
const char *  b_face_criteria,
bool  add_groups,
bool  auto_variables,
int  n_writers,
const int  writer_ids[] 
)

Define a surface post-processing mesh.

Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]mesh_nameassociated mesh name
[in]i_face_criteriaselection criteria for interior faces
[in]b_face_criteriaselection criteria for boundary faces
[in]add_groupsif true, add group information if present
[in]auto_variablesif true, automatic output of main variables
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_surface_mesh_by_func()

void cs_post_define_surface_mesh_by_func ( int  mesh_id,
const char *  mesh_name,
cs_post_elt_select_t i_face_select_func,
cs_post_elt_select_t b_face_select_func,
void *  i_face_select_input,
void *  b_face_select_input,
bool  time_varying,
bool  add_groups,
bool  auto_variables,
int  n_writers,
const int  writer_ids[] 
)

Define a surface post-processing mesh using selection functions.

The selection may be updated over time steps if both the time_varying flag is set to true and the mesh is only associated with writers defined with the FVM_WRITER_TRANSIENT_CONNECT option.

Note: if i_face_select_input or b_face_select_input pointer is non-NULL, it must point to valid data when the selection function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_meshes() with a fixed-mesh writer before the data pointed to goes out of scope;
Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]mesh_nameassociated mesh name
[in]i_face_select_funcpointer to interior faces selection function
[in]b_face_select_funcpointer to boundary faces selection function
[in]i_face_select_inputpointer to optional input data for the interior faces selection function, or NULL
[in]b_face_select_inputpointer to optional input data for the boundary faces selection function, or NULL
[in]time_varyingif true, try to redefine mesh at each output time
[in]add_groupsif true, add group information if present
[in]auto_variablesif true, automatic output of main variables
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_volume_mesh()

void cs_post_define_volume_mesh ( int  mesh_id,
const char *  mesh_name,
const char *  cell_criteria,
bool  add_groups,
bool  auto_variables,
int  n_writers,
const int  writer_ids[] 
)

Define a volume post-processing mesh.

Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]mesh_nameassociated mesh name
[in]cell_criteriaselection criteria for cells
[in]add_groupsif true, add group information if present
[in]auto_variablesif true, automatic output of main variables
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_volume_mesh_by_func()

void cs_post_define_volume_mesh_by_func ( int  mesh_id,
const char *  mesh_name,
cs_post_elt_select_t cell_select_func,
void *  cell_select_input,
bool  time_varying,
bool  add_groups,
bool  auto_variables,
int  n_writers,
const int  writer_ids[] 
)

Define a volume post-processing mesh using a selection function.

The selection may be updated over time steps if both the time_varying flag is set to true and the mesh is only associated with writers defined with the FVM_WRITER_TRANSIENT_CONNECT option.

Note: if the cell_select_input pointer is non-NULL, it must point to valid data when the selection function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_meshes() with a fixed-mesh writer before the data pointed to goes out of scope;
Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]mesh_nameassociated mesh name
[in]cell_select_funcpointer to cells selection function
[in]cell_select_inputpointer to optional input data for the cell selection function, or NULL
[in]time_varyingif true, try to redefine mesh at each output time
[in]add_groupsif true, add group information if present
[in]auto_variablesif true, automatic output of main variables
[in]n_writersnumber of associated writers
[in]writer_idsids of associated writers

◆ cs_post_define_writer()

void cs_post_define_writer ( int  writer_id,
const char *  case_name,
const char *  dir_name,
const char *  fmt_name,
const char *  fmt_opts,
fvm_writer_time_dep_t  time_dep,
bool  output_at_start,
bool  output_at_end,
int  frequency_n,
double  frequency_t 
)

Define a writer; this objects manages a case's name, directory, and format, as well as associated mesh's time dependency, and the default output frequency for associated variables.

This function must be called before the time loop. If a writer with a given id is defined multiple times, the last definition supercedes the previous ones.

Current reserved ids are the following: CS_POST_WRITER_DEFAULT for main/default output, CS_POST_WRITER_ERRORS for error visualization, CS_POST_WRITER_PROBES for main probes, CS_POST_WRITER_PARTICLES for particles, CS_POST_WRITER_TRAJECTORIES for trajectories. Other negative ids may be dynamically reserved by the code depending on options. Positive ids identify user-defined writers.

Warning
depending on the chosen format, the case_name may be shortened (maximum number of characters: 32 for MED, 19 for EnSight, or modified automatically (white-space or forbidden characters will be replaced by "_").

The format_name argument is used to choose the output format, and the following values are allowed (assuming the matching support was built):

  • EnSight Gold (EnSight also accepted)
  • MED CGNS CCM (only for the full volume and boundary meshes)
  • Catalyst (in-situ visualization)
  • MEDCoupling (in-memory structure, to be used from other code)
  • plot (comma or whitespace separated 2d plot files)
  • time_plot (comma or whitespace separated time plot files)

The format name is case-sensitive, so ensight or cgns are also valid.

The optional fmt_opts character string contains a list of options related to the format, separated by spaces or commas; these options include:

  • binary for a binary format version (default)
  • big_endian to force outputs to be in big-endian mode (for EnSight).
  • text for a text format version (for EnSight).
  • adf for ADF file type (for CGNS).
  • hdf5 for HDF5 file type (for CGNS, normally the default if HDF5 support is available).
  • discard_polygons to prevent from exporting faces with more than four edges (which may not be recognized by some post-processing tools); such faces will therefore not appear in the post-processing mesh.
  • discard_polyhedra to prevent from exporting elements which are neither tetrahedra, prisms, pyramids nor hexahedra (which may not be recognized by some post-processing tools); such elements will therefore not appear in the post-processing mesh.
  • divide_polygons to divide faces with more than four edges into triangles, so that any post-processing tool can recognize them.
  • divide_polyhedra} to divide elements which are neither tetrahedra, prisms, pyramids nor hexahedra into simpler elements (tetrahedra and pyramids), so that any post-processing tool can recognize them.
  • separate_meshes to multiple meshes and associated fields to separate outputs.

Note that the white-spaces in the beginning or in the end of the character strings given as arguments here are suppressed automatically.

Parameters
[in]writer_idid of writer to create. (< 0 reserved, > 0 for user); eveb for reserved ids, the matching writer's options may be redifined by calls to this function
[in]case_nameassociated case name
[in]dir_nameassociated directory name
[in]fmt_nameassociated format name
[in]fmt_optsassociated format options string
[in]time_depFVM_WRITER_FIXED_MESH if mesh definitions are fixed, FVM_WRITER_TRANSIENT_COORDS if coordinates change, FVM_WRITER_TRANSIENT_CONNECT if connectivity changes
[in]output_at_startforce output at calculation start if true
[in]output_at_endforce output at calculation end if true
[in]frequency_ndefault output frequency in time-steps, or < 0
[in]frequency_tdefault output frequency in seconds, or < 0 (has priority over frequency_n)

◆ cs_post_disable_writer()

void cs_post_disable_writer ( int  writer_id)

Disable specific writer or all writers not currently active until cs_post_enable_writer or cs_post_activate_writer is called for those writers.

For each call to this function for a given writer, the same number of calls to cs_post_enable_writer or a single call to cs_post_activate_writer is required to re-enable the writer.

This is useful to disable output even of fixed meshes in preprocessing stages.

Parameters
[in]writer_idwriter id, or 0 for all writers

◆ cs_post_enable_writer()

void cs_post_enable_writer ( int  writer_id)

Enable a specific writer or all writers currently disabled by previous calls to cs_post_disable_writer.

For each previous call to cs_post_disable_writer for a given writer, a call to this function (or a single call to cs_post_activate_writer) is required to re-enable the writer.

This is useful to disable output even of fixed meshes in preprocessing stages.

Parameters
[in]writer_idwriter id, or 0 for all writers

◆ cs_post_finalize()

void cs_post_finalize ( void  )

Destroy all structures associated with post-processing.

◆ cs_post_free_mesh()

void cs_post_free_mesh ( int  mesh_id)

Remove a post-processing mesh.

No further post-processing output will be allowed on this mesh, so the associated structures may be freed.

A post-processing mesh that has been associated with a time-varying writer may not be removed.

Parameters
[in]mesh_idpostprocessing mesh id

◆ cs_post_get_default_format()

const char* cs_post_get_default_format ( void  )

Return the default writer format name.

Returns
name of the default writer format

◆ cs_post_get_default_format_options()

const char* cs_post_get_default_format_options ( void  )

Return the default writer format options.

Returns
default writer format options string

◆ cs_post_get_free_mesh_id()

int cs_post_get_free_mesh_id ( void  )

Return the next "reservable" (i.e. non-user) mesh id available.

Returns
the smallest negative integer present, -1

◆ cs_post_get_free_writer_id()

int cs_post_get_free_writer_id ( void  )

Return the next "reservable" (i.e. non-user) writer id available.

Returns
the smallest negative integer present, -1

◆ cs_post_get_writer()

fvm_writer_t* cs_post_get_writer ( int  writer_id)

Return a pointer to the FVM writer associated to a writer_id.

Parameters
[in]writer_idassociated writer id
Returns
a pointer to a fvm_writer_t structure

◆ cs_post_get_writer_time_dep()

fvm_writer_time_dep_t cs_post_get_writer_time_dep ( int  writer_id)

Return time dependency associated to a writer_id.

Parameters
[in]writer_idassociated writer id
Returns
associated writer's time dependency

◆ cs_post_init_error_writer()

void cs_post_init_error_writer ( void  )

Initialize post-processing writer with same format and associated options as default writer, but no time dependency, intended to troubleshoot errors.

◆ cs_post_init_error_writer_cells()

int cs_post_init_error_writer_cells ( void  )

Initialize post-processing writer with same format and associated options as default writer, but no time dependency, and associate and output global volume mesh.

This is intended to help troubleshoot errors using fields based on cells.

Returns
id of error output mesh (< 0), or 0 if all writers are deactivated

◆ cs_post_init_meshes()

void cs_post_init_meshes ( int  check_mask)

Initialize main post-processing meshes.

The check_flag variable is a mask, used for additionnal post-processing:

  • If (check_flag & 1), volume submeshes are output by groups if more than one group is present and the default writer uses the EnSight format.
  • If (check_flag & 2), boundary submeshes are output by groups if more than one group is present and the default writer uses the EnSight format.

It is recommended that post-processing meshes be defined before calling this function, though specific "automatic" meshes (for example those related to couplings) may be defined between this call and a time loop.

Parameters
[in]check_maskmask used for additional output

◆ cs_post_init_writers()

void cs_post_init_writers ( void  )

Initialize post-processing writers.

◆ cs_post_mesh_attach_writer()

void cs_post_mesh_attach_writer ( int  mesh_id,
int  writer_id 
)

Associate a writer to a postprocessing mesh.

This function must be called during the postprocessing output definition stage, before any output actually occurs.

If called with a non-existing mesh or writer id, or if the writer is already associated, no setting is changed, and this function returns silently.

Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]writer_idid of writer to associate

◆ cs_post_mesh_detach_writer()

void cs_post_mesh_detach_writer ( int  mesh_id,
int  writer_id 
)

De-associate a writer from a postprocessing mesh.

This function must be called during the postprocessing output definition stage, before any output actually occurs.

If called with a non-existing mesh or writer id, or if the writer was not previously associated, no setting is changed, and this function returns silently.

Parameters
[in]mesh_idid of mesh to define (< 0 reserved, > 0 for user)
[in]writer_idid of writer to associate

◆ cs_post_mesh_exists()

bool cs_post_mesh_exists ( int  mesh_id)

Check for the existence of a post-processing mesh of the given id.

Parameters
[in]mesh_idmesh id to check
Returns
true if mesh with this id exists, false otherwise

◆ cs_post_mesh_get_b_face_ids()

void cs_post_mesh_get_b_face_ids ( int  mesh_id,
cs_lnum_t  b_face_ids[] 
)

Get a postprocessing mesh's list of boundary faces.

The array of boundary face ids must be of at least size cs_post_mesh_get_n_b_faces(mesh_id).

Parameters
[in]mesh_idpostprocessing mesh id
[out]b_face_idsarray of associated boundary faces ids (0 to n-1 numbering, relative to main mesh)

◆ cs_post_mesh_get_cell_ids()

void cs_post_mesh_get_cell_ids ( int  mesh_id,
cs_lnum_t cell_ids 
)

Get a postprocessing mesh's list of cells.

The array of cell ids must be of at least size cs_post_mesh_get_n_cells(mesh_id).

Parameters
[in]mesh_idpostprocessing mesh id
[out]cell_idsarray of associated cell ids (0 to n-1 numbering, relative to main mesh)

◆ cs_post_mesh_get_ent_flag()

const int* cs_post_mesh_get_ent_flag ( int  mesh_id)

Get a postprocessing meshes entity presence flag.

This flag is an array of 5 integers, indicating the presence of elements of given types on at least one subdomain (i.e. rank): 0: presence of cells 1: presence of interior faces 2: presence of boundary faces 3: presence of particles 4: presence of probes

Parameters
[in]mesh_idpostprocessing mesh id
Returns
pointer to entity presence flag

This flag is an array of 3 integers, indicating the presence of elements of given types on at least one subdomain (i.e. rank): 0: presence of cells 1: presence of interior faces 2: presence of boundary faces

Parameters
[in]mesh_idpostprocessing mesh id
Returns
pointer to entity presence flag

◆ cs_post_mesh_get_i_face_ids()

void cs_post_mesh_get_i_face_ids ( int  mesh_id,
cs_lnum_t  i_face_ids[] 
)

Get a postprocessing mesh's list of boundary faces.

The array of boundary face ids must be of at least size cs_post_mesh_get_n_b_faces(mesh_id).

Parameters
[in]mesh_idpostprocessing mesh id
[out]i_face_idsarray of associated interior faces ids (0 to n-1 numbering, relative to main mesh)

◆ cs_post_mesh_get_n_b_faces()

cs_lnum_t cs_post_mesh_get_n_b_faces ( int  mesh_id)

Get a postprocessing mesh's number of boundary faces.

Parameters
[in]mesh_idpostprocessing mesh id
Returns
number of cells of postprocessing mesh.

◆ cs_post_mesh_get_n_cells()

cs_lnum_t cs_post_mesh_get_n_cells ( int  mesh_id)

Get a postprocessing mesh's number of cells.

Parameters
[in]mesh_idpostprocessing mesh id
Returns
number of cells of postprocessing mesh.

◆ cs_post_mesh_get_n_i_faces()

cs_lnum_t cs_post_mesh_get_n_i_faces ( int  mesh_id)

Get a postprocessing mesh's number of interior faces.

Parameters
[in]mesh_idpostprocessing mesh id
Returns
number of cells of postprocessing mesh.

◆ cs_post_mesh_get_n_vertices()

cs_lnum_t cs_post_mesh_get_n_vertices ( int  mesh_id)

Get a postprocessing mesh's number of vertices.

Parameters
[in]mesh_idpostprocessing mesh id
Returns
number of vertices of postprocessing mesh.

◆ cs_post_mesh_get_vertex_ids()

void cs_post_mesh_get_vertex_ids ( int  mesh_id,
cs_lnum_t vertex_ids 
)

Get a postprocessing mesh's list of vertices.

The array of vertex ids must be of at least size cs_post_mesh_get_n_vertices(mesh_id).

Parameters
[in]mesh_idpostprocessing mesh id
[out]vertex_idsarray of associated vertex ids (0 to n-1 numbering, relative to main mesh)

◆ cs_post_mesh_set_post_domain()

void cs_post_mesh_set_post_domain ( int  mesh_id,
bool  post_domain 
)

Set whether postprocessing mesh's parallel domain should be output.

Parameters
[in]mesh_idpostprocessing mesh id
[in]post_domaintrue if parallel domain should be output, false otherwise.

◆ cs_post_renum_cells()

void cs_post_renum_cells ( const cs_lnum_t  init_cell_num[])

Update references to parent mesh of post-processing meshes in case of computational mesh cell renumbering.

This function may be called only once, after possible renumbering of cells, to update existing post-processing meshes. Post-processing meshes defined after renumbering will automatically be based upon the new numbering, so this function will not need to be called again.

Parameters
[in]init_cell_numinitial cell numbering (new -> old)

◆ cs_post_renum_faces()

void cs_post_renum_faces ( const cs_lnum_t  init_i_face_num[],
const cs_lnum_t  init_b_face_num[] 
)

Update references to parent mesh of post-processing meshes in case of computational mesh interior and/or boundary faces renumbering.

This function may be called only once, after possible renumbering of faces, to update existing post-processing meshes. Post-processing meshes defined after renumbering will automatically be based upon the new numbering, so this function will not need to be called again.

Parameters
[in]init_i_face_numinitial interior numbering (new -> old)
[in]init_b_face_numinitial boundary numbering (new -> old)

◆ cs_post_set_changing_connectivity()

void cs_post_set_changing_connectivity ( void  )

Configure the post-processing output so that mesh connectivity may be automatically updated.

This is done for meshes defined using selection criteria or functions. The behavior of Lagrangian meshes is unchanged.

To be effective, this function should be called before defining postprocessing meshes.

◆ cs_post_set_deformable()

void cs_post_set_deformable ( void  )

Configure the post-processing output so that a mesh displacement field may be output automatically for meshes based on the global volume mesh.

◆ cs_post_time_step_begin()

void cs_post_time_step_begin ( const cs_time_step_t ts)

Check if post-processing is activated and then update post-processing of meshes if there is a need to update time-dependent meshes.

Parameters
[in]tstime step status structure, or NULL

◆ cs_post_time_step_end()

void cs_post_time_step_end ( void  )

Flush writers and free time-varying and Lagragian mesh if needed of meshes if there is a time-dependent mesh.

◆ cs_post_time_step_output()

void cs_post_time_step_output ( const cs_time_step_t ts)

Loop on post-processing meshes to output variables.

This handles all default fields output, as well as all registered output functions and outputs defined in cs_user_postprocess_values

Parameters
[in]tstime step status structure, or NULL

◆ cs_post_write_meshes()

void cs_post_write_meshes ( const cs_time_step_t ts)

Output post-processing meshes using associated writers.

If the time step structure argument passed is NULL, a time-independent output will be assumed.

Parameters
[in]tstime step status structure, or NULL

◆ cs_post_write_particle_values()

void cs_post_write_particle_values ( int  mesh_id,
int  writer_id,
int  attr_id,
const char *  var_name,
int  component_id,
const cs_time_step_t ts 
)

Output an existing lagrangian particle attribute at particle positions or trajectory endpoints of a particle mesh using associated writers.

Parameters
[in]mesh_idid of associated mesh
[in]writer_idid of specified associated writer, or CS_POST_WRITER_ALL_ASSOCIATED for all
[in]attr_idassociated particle attribute id
[in]var_namename of variable to output
[in]component_idif -1 : extract the whole attribute if >0 : id of the component to extract
[in]tstime step status structure, or NULL

◆ cs_post_write_probe_values()

void cs_post_write_probe_values ( int  mesh_id,
int  writer_id,
const char *  var_name,
int  var_dim,
cs_post_type_t  var_type,
int  parent_location_id,
cs_interpolate_from_location_t interpolate_func,
void *  interpolate_input,
const void *  vals,
const cs_time_step_t ts 
)

Output a variable defined at cells or faces of a post-processing mesh using associated writers.

Parameters
[in]mesh_idid of associated mesh
[in]writer_idid of specified associated writer, or CS_POST_WRITER_ALL_ASSOCIATED for all
[in]var_namename of variable to output
[in]var_dim1 for scalar, 3 for vector, 6 for symmetric tensor, 9 for non-symmetric tensor
[in]var_typevariable's data type
[in]parent_location_idasociated values mesh location, or 0 if values are passed directly
[in]interpolate_funcpointer to interpolation function, or NULL for default
[in]interpolate_inputpointer to optional interpolation input data, or NULL for default
[in]valsvariable's values
[in]tstime step status structure, or NULL

◆ cs_post_write_var()

void cs_post_write_var ( int  mesh_id,
int  writer_id,
const char *  var_name,
int  var_dim,
bool  interlace,
bool  use_parent,
cs_post_type_t  var_type,
const void *  cel_vals,
const void *  i_face_vals,
const void *  b_face_vals,
const cs_time_step_t ts 
)

Output a variable defined at cells or faces of a post-processing mesh using associated writers.

Parameters
[in]mesh_idid of associated mesh
[in]writer_idid of specified associated writer, or CS_POST_WRITER_ALL_ASSOCIATED for all
[in]var_namename of variable to output
[in]var_dim1 for scalar, 3 for vector, 6 for symmetric tensor, 9 for non-symmetric tensor
[in]interlaceif a vector, true for interlaced values, false otherwise
[in]use_parenttrue if values are defined on "parent" mesh, false if values are defined on post-processing mesh
[in]var_typevariable's data type
[in]cel_valscell values
[in]i_face_valsinterior face values
[in]b_face_valsboundary face values
[in]tstime step status structure, or NULL

◆ cs_post_write_vars()

void cs_post_write_vars ( const cs_time_step_t ts)

Loop on post-processing meshes to output variables.

This handles all default fields output, as well as all registered output functions and outputs defined in cs_user_postprocess_values

Parameters
[in]tstime step status structure, or NULL

◆ cs_post_write_vertex_var()

void cs_post_write_vertex_var ( int  mesh_id,
int  writer_id,
const char *  var_name,
int  var_dim,
bool  interlace,
bool  use_parent,
cs_post_type_t  var_type,
const void *  vtx_vals,
const cs_time_step_t ts 
)

Output a variable defined at vertices of a post-processing mesh using associated writers.

Parameters
[in]mesh_idid of associated mesh
[in]writer_idid of specified associated writer, or CS_POST_WRITER_ALL_ASSOCIATED for all
[in]var_namename of variable to output
[in]var_dim1 for scalar, 3 for vector, 6 for symmetric tensor, 9 for non-symmetric tensor
[in]interlaceif a vector, true for interlaced values, false otherwise
[in]use_parenttrue if values are defined on "parent" mesh, false if values are defined on post-processing mesh
[in]var_typevariable's data type
[in]vtx_valsvertex values
[in]tstime step status structure, or NULL

◆ cs_post_writer_exists()

bool cs_post_writer_exists ( int  writer_id)

Check for the existence of a writer of the given id.

Parameters
[in]writer_idwriter id to check
Returns
true if writer with this id exists, false otherwise