8.0
general documentation
cs_probe.h
Go to the documentation of this file.
1 #ifndef __CS_PROBE_H__
2 #define __CS_PROBE_H__
3 
4 /*============================================================================
5  * Set of structures and functions to handle probes and profiles
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "fvm_nodal.h"
35 
36 #include "cs_base.h"
37 #include "cs_mesh.h"
38 #include "cs_mesh_location.h"
39 #include "fvm_nodal.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 typedef struct _cs_probe_set_t cs_probe_set_t;
54 
55 typedef enum {
56 
62 
63 /*============================================================================
64  * Local type definitions
65  *============================================================================*/
66 
67 /*----------------------------------------------------------------------------*/
86 /*----------------------------------------------------------------------------*/
87 
88 typedef void
89 (cs_probe_set_define_local_t) (void *input,
90  cs_lnum_t *n_elts,
91  cs_real_3_t **coords,
92  cs_real_t **s);
93 
94 /*============================================================================
95  * Global variables
96  *============================================================================*/
97 
98 /*============================================================================
99  * Semi-private function prototypes
100  *
101  * The following functions are intended to be used by the postprocessing layer
102  * (cs_post.c), not directly by the user.
103  *============================================================================*/
104 
105 /*----------------------------------------------------------------------------*/
109 /*----------------------------------------------------------------------------*/
110 
111 void
113 
114 /*----------------------------------------------------------------------------*/
126 /*----------------------------------------------------------------------------*/
127 
128 void
130  int *n_fields,
131  int **field_info);
132 
133 /*=============================================================================
134  * Public function prototypes.
135  *============================================================================*/
136 
137 /*----------------------------------------------------------------------------*/
143 /*----------------------------------------------------------------------------*/
144 
145 int
146 cs_probe_get_n_sets(void);
147 
148 /*----------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------*/
157 
159 cs_probe_set_get(const char *name);
160 
161 /*----------------------------------------------------------------------------*/
169 /*----------------------------------------------------------------------------*/
170 
172 cs_probe_set_get_by_id(int pset_id);
173 
174 /*----------------------------------------------------------------------------*/
182 /*----------------------------------------------------------------------------*/
183 
184 const char *
186 
187 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void
208  bool *time_varying,
209  bool *on_boundary,
210  bool *on_curve,
211  bool *auto_variables,
212  bool *auto_curve_coo,
213  bool *auto_cart_coo,
214  int *n_writers,
215  int *writer_ids[]);
216 
217 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
228 const char *
230 
231 /*----------------------------------------------------------------------------*/
241 /*----------------------------------------------------------------------------*/
242 
243 int
245 
246 /*----------------------------------------------------------------------------*/
254 /*----------------------------------------------------------------------------*/
255 
257 cs_probe_set_create(const char *name);
258 
259 /*----------------------------------------------------------------------------*/
269 /*----------------------------------------------------------------------------*/
270 
271 void
273  cs_real_t x,
274  cs_real_t y,
275  cs_real_t z,
276  const char *label);
277 
278 /*----------------------------------------------------------------------------*/
289 /*----------------------------------------------------------------------------*/
290 
292 cs_probe_set_create_from_array(const char *name,
293  int n_probes,
294  const cs_real_3_t *coords,
295  const char **labels);
296 
297 /*----------------------------------------------------------------------------*/
317 /*----------------------------------------------------------------------------*/
318 
320 cs_probe_set_create_from_segment(const char *name,
321  int n_probes,
322  const cs_real_t start_coords[3],
323  const cs_real_t end_coords[3]);
324 
325 /*----------------------------------------------------------------------------*/
343 /*----------------------------------------------------------------------------*/
344 
346 cs_probe_set_create_from_local(const char *name,
347  cs_probe_set_define_local_t *p_define_func,
348  void *p_define_input);
349 
350 /*----------------------------------------------------------------------------*/
358 /*----------------------------------------------------------------------------*/
359 
360 void
361 cs_probe_set_allow_overwrite(const char *name);
362 
363 /*----------------------------------------------------------------------------*/
382 /*----------------------------------------------------------------------------*/
383 
384 void
386  const cs_real_t *s);
387 
388 /*----------------------------------------------------------------------------*/
396 /*----------------------------------------------------------------------------*/
397 
398 void
400  int n_writers,
401  const int *writer_ids);
402 
403 /*----------------------------------------------------------------------------*/
419 /*----------------------------------------------------------------------------*/
420 
421 void
423  int writer_id,
424  int field_id,
425  int comp_id);
426 
427 /*----------------------------------------------------------------------------*/
434 /*----------------------------------------------------------------------------*/
435 
436 void
438  bool mode);
439 
440 /*----------------------------------------------------------------------------*/
447 /*----------------------------------------------------------------------------*/
448 
449 void
451  bool mode);
452 
453 /*----------------------------------------------------------------------------*/
460 /*----------------------------------------------------------------------------*/
461 
462 void
464  bool mode);
465 
466 /*----------------------------------------------------------------------------*/
473 /*----------------------------------------------------------------------------*/
474 
475 void
477  cs_probe_snap_t snap_mode);
478 
479 /*----------------------------------------------------------------------------*/
503 /*----------------------------------------------------------------------------*/
504 
505 void
507  const char *keyname,
508  const char *keyval);
509 
510 /*----------------------------------------------------------------------------*/
524 /*----------------------------------------------------------------------------*/
525 
526 void
528  const fvm_nodal_t *location_mesh);
529 
530 /*----------------------------------------------------------------------------*/
539 /*----------------------------------------------------------------------------*/
540 
541 fvm_nodal_t *
543  const char *mesh_name);
544 
545 /*----------------------------------------------------------------------------*/
554 /*----------------------------------------------------------------------------*/
555 
556 fvm_nodal_t *
558  const char *mesh_name);
559 
560 /*----------------------------------------------------------------------------*/
566 /*----------------------------------------------------------------------------*/
567 
568 void
569 cs_probe_set_dump(const cs_probe_set_t *pset);
570 
571 /*----------------------------------------------------------------------------*/
580 /*----------------------------------------------------------------------------*/
581 
582 void
584  cs_probe_snap_t *snap_mode,
585  int *n_probes,
586  cs_real_3_t *coords[]);
587 
588 /*----------------------------------------------------------------------------*/
596 /*----------------------------------------------------------------------------*/
597 
598 int
600 
601 /*----------------------------------------------------------------------------*/
609 /*----------------------------------------------------------------------------*/
610 
611 const cs_real_t *
613 
614 /*----------------------------------------------------------------------------*/
625 /*----------------------------------------------------------------------------*/
626 
627 cs_real_t *
629 
630 /*----------------------------------------------------------------------------*/
641 /*----------------------------------------------------------------------------*/
642 
643 const cs_lnum_t *
645  int mesh_location_id);
646 
647 /*----------------------------------------------------------------------------*/
648 
650 
651 #endif /* __CS_PROBE_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:332
#define END_C_DECLS
Definition: cs_defs.h:510
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
cs_probe_set_t * cs_probe_set_create(const char *name)
Create a new set of probes.
Definition: cs_probe.c:947
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.
Definition: cs_probe.c:1987
const char * cs_probe_set_get_name(cs_probe_set_t *pset)
Retrieve the name related to a cs_probe_set_t structure.
Definition: cs_probe.c:836
void cs_probe_finalize(void)
Free all structures related to a set of probes.
cs_probe_set_t * cs_probe_set_get(const char *name)
Retrieve a cs_probe_set_t structure.
Definition: cs_probe.c:786
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.
Definition: cs_probe.c:864
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.
Definition: cs_probe.c:1434
cs_probe_snap_t
Definition: cs_probe.h:55
@ CS_PROBE_SNAP_NONE
Definition: cs_probe.h:57
@ CS_PROBE_SNAP_VERTEX
Definition: cs_probe.h:59
@ CS_PROBE_SNAP_ELT_CENTER
Definition: cs_probe.h:58
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.
Definition: cs_probe.c:1528
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.
Definition: cs_probe.c:2193
int cs_probe_get_n_sets(void)
Retrieve the number of probe sets defined.
Definition: cs_probe.c:770
int cs_probe_set_get_n_local(const cs_probe_set_t *pset)
Return the number probes in the local domain.
Definition: cs_probe.c:2148
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.
Definition: cs_probe.c:908
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.
Definition: cs_probe.c:1068
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.
Definition: cs_probe.c:971
cs_probe_set_t * cs_probe_set_get_by_id(int pset_id)
Retrieve a cs_probe_set_t structure from its id.
Definition: cs_probe.c:816
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.
Definition: cs_probe.c:1157
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.
Definition: cs_probe.c:2169
struct _cs_probe_set_t cs_probe_set_t
Definition: cs_probe.h:53
void cs_probe_set_transfer_associated_field_info(cs_probe_set_t *pset, int *n_fields, int **field_info)
Transfer info on associated fields to the caller.
int cs_probe_set_get_interpolation(cs_probe_set_t *pset)
Return the interpolation option for a given probe set.
Definition: cs_probe.c:929
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.
Definition: cs_probe.c:1214
void cs_probe_set_auto_curvilinear_coords(cs_probe_set_t *pset, bool mode)
Set automatic output of curvilinear coordinates.
Definition: cs_probe.c:1350
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.
Definition: cs_probe.c:1840
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.
Definition: cs_probe.c:1291
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.
Definition: cs_probe.c:2117
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.
Definition: cs_probe.c:1398
void cs_probe_set_allow_overwrite(const char *name)
allow overwriting the definition of a given probe set.
Definition: cs_probe.c:1184
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.
Definition: cs_probe.c:2222
void cs_probe_set_auto_var(cs_probe_set_t *pset, bool mode)
Set automatic output of variables behavior.
Definition: cs_probe.c:1326
void cs_probe_set_auto_cartesian_coords(cs_probe_set_t *pset, bool mode)
Set automatic output of cartesian coordinates.
Definition: cs_probe.c:1374
void() cs_probe_set_define_local_t(void *input, cs_lnum_t *n_elts, cs_real_3_t **coords, cs_real_t **s)
Function pointer to definition of probes based on rank-local points.
Definition: cs_probe.h:89
void cs_probe_set_dump(const cs_probe_set_t *pset)
Dump a cs_probe_set_t structure.
Definition: cs_probe.c:2067
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.
Definition: cs_probe.c:1019
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.
Definition: cs_probe.c:1254
char * label
Definition: keywords.h:71