Probes and profiles management. More...
#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "bft_printf.h"
#include "fvm_nodal.h"
#include "fvm_point_location.h"
#include "cs_base.h"
#include "cs_map.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_mesh_connect.h"
#include "cs_mesh_location.h"
#include "cs_mesh_quantities.h"
#include "cs_mesh_intersect.h"
#include "cs_order.h"
#include "cs_parall.h"
#include "cs_selector.h"
#include "cs_timer.h"
#include "cs_probe.h"
Functions | |
int | cs_probe_get_n_sets (void) |
Retrieve the number of probe sets defined. More... | |
cs_probe_set_t * | cs_probe_set_get (const char *name) |
Retrieve a cs_probe_set_t structure. More... | |
cs_probe_set_t * | cs_probe_set_get_by_id (int pset_id) |
Retrieve a cs_probe_set_t structure from its id. More... | |
const char * | cs_probe_set_get_name (cs_probe_set_t *pset) |
Retrieve the name related to a cs_probe_set_t structure. More... | |
void | cs_probe_set_get_post_info (const cs_probe_set_t *pset, bool *time_varying, bool *on_boundary, bool *on_curve, bool *auto_variables, bool *auto_curve_coo, bool *auto_cart_coo, int *n_writers, int *writer_ids[]) |
Retrieve information useful for the postprocessing step. More... | |
const char * | cs_probe_set_get_location_criteria (cs_probe_set_t *pset) |
Return the location filter selection criteria string for a given probe set. More... | |
int | cs_probe_set_get_interpolation (cs_probe_set_t *pset) |
Return the interpolation option for a given probe set. More... | |
cs_probe_set_t * | cs_probe_set_create (const char *name) |
Create a new set of probes. More... | |
void | cs_probe_set_add_probe (cs_probe_set_t *pset, cs_real_t x, cs_real_t y, cs_real_t z, const char *label) |
Add a new probe to an existing set of probes. More... | |
cs_probe_set_t * | cs_probe_set_create_from_array (const char *name, int n_probes, const cs_real_3_t *coords, const char **labels) |
Define a new set of probes from an array of coordinates. More... | |
cs_probe_set_t * | cs_probe_set_create_from_segment (const char *name, int n_probes, const cs_real_t start_coords[3], const cs_real_t end_coords[3]) |
Define a new set of probes from the segment spanned by two points. More... | |
cs_probe_set_t * | cs_probe_set_create_from_local (const char *name, cs_probe_set_define_local_t *p_define_func, void *p_define_input) |
Define a new set of probes from rank-local definition function. More... | |
void | cs_probe_set_allow_overwrite (const char *name) |
allow overwriting the definition of a given probe set. More... | |
void | cs_probe_set_assign_curvilinear_abscissa (cs_probe_set_t *pset, const cs_real_t *s) |
Assign curvilinear abscissa for the given probe set. More... | |
void | cs_probe_set_associate_writers (cs_probe_set_t *pset, int n_writers, const int *writer_ids) |
Associate a list of writers to a probe set. More... | |
void | cs_probe_set_associate_field (cs_probe_set_t *pset, int writer_id, int field_id, int comp_id) |
Associate a field to a probe set. More... | |
void | cs_probe_set_auto_var (cs_probe_set_t *pset, bool mode) |
Set to true or false the automatic post-processing of variables. More... | |
void | cs_probe_set_auto_curvilinear_coords (cs_probe_set_t *pset, bool mode) |
Set automatic output of curvilinear coordinates. More... | |
void | cs_probe_set_auto_cartesian_coords (cs_probe_set_t *pset, bool mode) |
Set automatic output of cartesian coordinates. More... | |
void | cs_probe_set_snap_mode (cs_probe_set_t *pset, cs_probe_snap_t snap_mode) |
Set snap mode related to the management of a set of probes. More... | |
void | cs_probe_set_option (cs_probe_set_t *pset, const char *keyname, const char *keyval) |
Set optional parameters related to the management of a set of probes. More... | |
void | cs_probe_set_locate (cs_probe_set_t *pset, const fvm_nodal_t *location_mesh) |
Try to locate each probe and define the coordinate really used for the postprocessing step. More... | |
fvm_nodal_t * | cs_probe_set_export_mesh (cs_probe_set_t *pset, const char *mesh_name) |
Define a fvm_nodal_t structure from the set of probes. More... | |
fvm_nodal_t * | cs_probe_set_unlocated_export_mesh (cs_probe_set_t *pset, const char *mesh_name) |
Define a fvm_nodal_t structure from the set of unlocated probes. More... | |
void | cs_probe_set_dump (const cs_probe_set_t *pset) |
Dump a cs_probe_set_t structure. More... | |
void | cs_probe_set_get_members (const cs_probe_set_t *pset, cs_probe_snap_t *snap_mode, int *n_probes, cs_real_3_t *coords[]) |
Retrieve the main members of a cs_probe_set_t structure. More... | |
int | cs_probe_set_get_n_local (const cs_probe_set_t *pset) |
Return the number probes in the local domain. More... | |
const cs_real_t * | cs_probe_set_get_curvilinear_abscissa (const cs_probe_set_t *pset) |
Return the list of curvilinear abscissa for the given probe set. More... | |
cs_real_t * | cs_probe_set_get_loc_curvilinear_abscissa (const cs_probe_set_t *pset) |
Return the list of curvilinear abscissa of probes located on the local ranks for the given probe set. More... | |
const cs_lnum_t * | cs_probe_set_get_elt_ids (const cs_probe_set_t *pset, int mesh_location_id) |
Return the ids of a probe set's local matching elements, relative to a given mesh location. More... | |
Probes and profiles management.
int cs_probe_get_n_sets | ( | void | ) |
Retrieve the number of probe sets defined.
void cs_probe_set_add_probe | ( | cs_probe_set_t * | pset, |
cs_real_t | x, | ||
cs_real_t | y, | ||
cs_real_t | z, | ||
const char * | label | ||
) |
Add a new probe to an existing set of probes.
[in,out] | pset | set of probes |
[in] | x | x coordinate of the point to add |
[in] | y | y coordinate of the point to add |
[in] | z | z coordinate of the point to add |
[in] | label | NULL or the name of the point (optional) |
void cs_probe_set_allow_overwrite | ( | const char * | name | ) |
allow overwriting the definition of a given probe set.
If no a probe set of the given name exists, the operation is ignored.
[in] | name | name of the probe set |
void cs_probe_set_assign_curvilinear_abscissa | ( | cs_probe_set_t * | pset, |
const cs_real_t * | s | ||
) |
Assign curvilinear abscissa for the given probe set.
This is effective only when using probe sets to which curvilinear coordinates have not already been assigned.
So this may be used following cs_probe_set_create (and probe additions) or cs_probe_set_create_from_array, but will be ignored for probe sets defined using cs_probe_set_create_from_segment and cs_probe_set_create_from_local.
If provided, the array of curvilinear absicssa must match the size of the probe set. If set to NULL, it is assumed a uniform spacing is provided between points.
[in] | pset | pointer to a cs_probe_set_t structure |
[in] | s | array of curvilinear abscissa, or NULL |
void cs_probe_set_associate_field | ( | cs_probe_set_t * | pset, |
int | writer_id, | ||
int | field_id, | ||
int | comp_id | ||
) |
Associate a field to a probe set.
This function must be called during the postprocessing output definition stage, before any output actually occurs.
If the field should already be output automatically based on the mesh category and field output keywords, it will be filtered at a later stage.
[in] | pset | pointer to a cs_probe_set_t structure |
[in] | writer_id | id of specified associated writer, or 0 (CS_POST_WRITER_ALL_ASSOCIATED) for all |
[in] | field_id | id of field to attach |
[in] | comp_id | id of field component (-1 for all) |
void cs_probe_set_associate_writers | ( | cs_probe_set_t * | pset, |
int | n_writers, | ||
const int * | writer_ids | ||
) |
Associate a list of writers to a probe set.
[in,out] | pset | pointer to a cs_probe_set_t structure to set |
[in] | n_writers | number of writers assocuated to this probe set |
[in] | writer_ids | list of writer ids |
void cs_probe_set_auto_cartesian_coords | ( | cs_probe_set_t * | pset, |
bool | mode | ||
) |
Set automatic output of cartesian coordinates.
[in,out] | pset | pointer to a cs_probe_set_t structure |
[in] | mode | true or false |
void cs_probe_set_auto_curvilinear_coords | ( | cs_probe_set_t * | pset, |
bool | mode | ||
) |
Set automatic output of curvilinear coordinates.
[in,out] | pset | pointer to a cs_probe_set_t structure |
[in] | mode | true or false |
void cs_probe_set_auto_var | ( | cs_probe_set_t * | pset, |
bool | mode | ||
) |
Set to true or false the automatic post-processing of variables.
Set automatic output of variables behavior.
[in,out] | pset | pointer to a cs_probe_set_t structure |
[in] | mode | true or false |
cs_probe_set_t* cs_probe_set_create | ( | const char * | name | ) |
Create a new set of probes.
[in] | name | name of the set of probes |
cs_probe_set_t* cs_probe_set_create_from_array | ( | const char * | name, |
int | n_probes, | ||
const cs_real_3_t * | coords, | ||
const char ** | labels | ||
) |
Define a new set of probes from an array of coordinates.
[in] | name | name of the set of probes |
[in] | n_probes | number of probes in coords and labels |
[in] | coords | list of coordinates related to each probe |
[in] | labels | list of label related to each probe (optional) |
cs_probe_set_t* cs_probe_set_create_from_local | ( | const char * | name, |
cs_probe_set_define_local_t * | p_define_func, | ||
void * | p_define_input | ||
) |
Define a new set of probes from rank-local definition function.
The local definition function given by the p_define_func pointer is called just before locating probes on the parent mesh, so this allows building probe sets based on subsets of the computational mesh.
Note: if the p_define_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);
[in] | name | name of the set of probes |
[in] | p_define_func | function used for local definition |
[in] | p_define_input | optional input for local definition function |
cs_probe_set_t* cs_probe_set_create_from_segment | ( | const char * | name, |
int | n_probes, | ||
const cs_real_t | start_coords[3], | ||
const cs_real_t | end_coords[3] | ||
) |
Define a new set of probes from the segment spanned by two points.
If n_probes > 0, the given number of probes will be used for sampling, and will be evenly distributed along the segment.
If n_probes <= 0, one probe will be defined for each cell intersected by the line segment, and its position based on the projection of those cell centers on the given segment.
In both cases, using cs_probe_set_snap_mode can further modify this behavior.
[in] | name | name of the set of probes |
[in] | n_probes | number of probes, or <= 0 for mesh intersection |
[in] | start_coords | coordinates of the starting point |
[in] | end_coords | coordinates of the ending point |
void cs_probe_set_dump | ( | const cs_probe_set_t * | pset | ) |
Dump a cs_probe_set_t structure.
[in] | pset | pointer to a cs_probe_set_t structure |
fvm_nodal_t* cs_probe_set_export_mesh | ( | cs_probe_set_t * | pset, |
const char * | mesh_name | ||
) |
Define a fvm_nodal_t structure from the set of probes.
[in,out] | pset | pointer to a cs_probe_set_t structure |
[in] | mesh_name | name of the mesh to export |
cs_probe_set_t* cs_probe_set_get | ( | const char * | name | ) |
Retrieve a cs_probe_set_t structure.
[in] | name | name of the set of probes to find |
cs_probe_set_t* cs_probe_set_get_by_id | ( | int | pset_id | ) |
Retrieve a cs_probe_set_t structure from its id.
[in] | pset_id | id related to the set of probes to find |
const cs_real_t* cs_probe_set_get_curvilinear_abscissa | ( | const cs_probe_set_t * | pset | ) |
Return the list of curvilinear abscissa for the given probe set.
[in] | pset | pointer to a cs_probe_set_t structure |
const cs_lnum_t* cs_probe_set_get_elt_ids | ( | const cs_probe_set_t * | pset, |
int | mesh_location_id | ||
) |
Return the ids of a probe set's local matching elements, relative to a given mesh location.
The mesh_location id must match one of CS_MESH_LOCATION_CELLS, CS_MESH_LOCATION_BOUNDARY_FACES, or CS_MESH_LOCATION_VERTICES.
[in] | pset | pointer to a cs_probe_set_t structure |
[in] | mesh_location_id | id of parent mesh location |
int cs_probe_set_get_interpolation | ( | cs_probe_set_t * | pset | ) |
Return the interpolation option for a given probe set.
Interpolation will be applied only where possible.
[in] | pset | pointer to a cs_probe_set_t structure |
cs_real_t* cs_probe_set_get_loc_curvilinear_abscissa | ( | const cs_probe_set_t * | pset | ) |
Return the list of curvilinear abscissa of probes located on the local ranks for the given probe set.
The caller is responsible for freeing the returned array.
[in] | pset | pointer to a cs_probe_set_t structure |
const char* cs_probe_set_get_location_criteria | ( | cs_probe_set_t * | pset | ) |
Return the location filter selection criteria string for a given probe set.
[in] | pset | pointer to a cs_probe_set_t structure |
void cs_probe_set_get_members | ( | const cs_probe_set_t * | pset, |
cs_probe_snap_t * | snap_mode, | ||
int * | n_probes, | ||
cs_real_3_t * | coords[] | ||
) |
Retrieve the main members of a cs_probe_set_t structure.
[in] | pset | pointer to a cs_probe_set_t structure |
[in,out] | snap_mode | mode of location |
[in,out] | n_probes | number of probes |
[in,out] | coords | probe coordinates |
int cs_probe_set_get_n_local | ( | const cs_probe_set_t * | pset | ) |
Return the number probes in the local domain.
[in] | pset | pointer to a cs_probe_set_t structure |
const char* cs_probe_set_get_name | ( | cs_probe_set_t * | pset | ) |
Retrieve the name related to a cs_probe_set_t structure.
[in] | pset | pointer to a cs_probe_set_t structure |
void cs_probe_set_get_post_info | ( | const cs_probe_set_t * | pset, |
bool * | time_varying, | ||
bool * | on_boundary, | ||
bool * | on_curve, | ||
bool * | auto_variables, | ||
bool * | auto_curve_coo, | ||
bool * | auto_cart_coo, | ||
int * | n_writers, | ||
int * | writer_ids[] | ||
) |
Retrieve information useful for the postprocessing step.
Output arguments may be set to NULL if we do not need to query them.
[in] | pset | pointer to a cs_probe_set_t structure |
[out] | time_varying | true if probe locations may change with time |
[out] | on_boundary | true if probes are located on boundary |
[out] | on_curve | true if the probe set has cuvilinear coordinates |
[out] | auto_variables | true if set of variables to output is predefined |
[out] | auto_curve_coo | true if curvilinear coordinates should be output |
[out] | auto_cart_coo | true if cartesian coordinates should be output |
[out] | n_writers | number of associated user-defined writers, or -1 if default unchanged |
[out] | writer_ids | pointer to a list of writer ids |
void cs_probe_set_locate | ( | cs_probe_set_t * | pset, |
const fvm_nodal_t * | location_mesh | ||
) |
Try to locate each probe and define the coordinate really used for the postprocessing step.
For better performance when using multiple probe sets, a pointer to an existing location mesh may be passed to this function. The caller is responsible for ensuring this mesh matches selection criteria for the probe set.
[in,out] | pset | pointer to a cs_probe_set_t structure |
[in] | location_mesh | optional pointer to mesh relative to which probe set should be located, or NULL |
void cs_probe_set_option | ( | cs_probe_set_t * | pset, |
const char * | keyname, | ||
const char * | keyval | ||
) |
Set optional parameters related to the management of a set of probes.
Available option key names accepting true
or false:
transient_location if
true
, relocate probes relative to deforming or moving mesh (default: false
)boundary if
\ c true, locate on boundary mesh; if false
, locate on volume mesh (default)Other options:
selection_criteria where
keyval is selection criteria stringtolerance where
keyval is for instance "0.05" (default "0.10")interpolation if
\ c 0, P0 interpolation (default); if 1
, simple gradient-based interpolation for volume probes (ignored for boundaries). Other interpolation options might be added in the future.[in,out] | pset | pointer to a cs_probe_set_t structure to set |
[in] | keyname | name of the keyword related to the parameter to set |
[in] | keyval | value of the keyword to set |
void cs_probe_set_snap_mode | ( | cs_probe_set_t * | pset, |
cs_probe_snap_t | snap_mode | ||
) |
Set snap mode related to the management of a set of probes.
[in,out] | pset | pointer to a cs_probe_set_t structure |
[in] | snap_mode | snap mode to set |
fvm_nodal_t* cs_probe_set_unlocated_export_mesh | ( | cs_probe_set_t * | pset, |
const char * | mesh_name | ||
) |
Define a fvm_nodal_t structure from the set of unlocated probes.
[in,out] | pset | pointer to a cs_probe_set_t structure |
[in] | mesh_name | name of the mesh to export |