9.2
general documentation
cs_medcoupling_postprocess.h
Go to the documentation of this file.
1#ifndef CS_MEDCOUPLING_POSTPROCESS_HXX
2#define CS_MEDCOUPLING_POSTPROCESS_HXX
3
4/*============================================================================
5 * Postprocessing utilities based on MEDCoupling functions
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 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 "base/cs_defs.h"
35
36/*============================================================================
37 * Type definitions
38 *============================================================================*/
39
40/*============================================================================
41 * Structure definitions
42 *============================================================================*/
43
44typedef struct _medcoupling_slice_t cs_medcoupling_slice_t;
45
46/*============================================================================
47 * Public function prototypes
48 *============================================================================*/
49
50/*----------------------------------------------------------------------------*/
51/*
52 * Get pointer to a slice based on id
53 *
54 * return pointer to slice. Raises an error if index is out of
55 * bounds.
56 */
57/*----------------------------------------------------------------------------*/
58
59cs_medcoupling_slice_t *
61
62/*----------------------------------------------------------------------------*/
63/*
64 * Get pointer to slice based on name, raises an error
65 * if not found.
66 *
67 * return pointer to slice, raises error if not found.
68 */
69/*----------------------------------------------------------------------------*/
70
71cs_medcoupling_slice_t *
72cs_medcoupling_slice_by_name(const char *name);
73
74/*----------------------------------------------------------------------------*/
75/*
76 * Get pointer to slice based on name. Returns NULL if
77 * not found.
78 *
79 * return pointer to slice, NULL if not found.
80 */
81/*----------------------------------------------------------------------------*/
82
83cs_medcoupling_slice_t *
84cs_medcoupling_slice_by_name_try(const char *name);
85
86/*----------------------------------------------------------------------------*/
87/*
88 * Add a slice based on a plane.
89 */
90/*----------------------------------------------------------------------------*/
91
92void
94 const char *selection_criteria,
95 const cs_real_t origin[],
96 const cs_real_t normal[],
97 const cs_real_t length1,
98 const cs_real_t length2);
99
100/*----------------------------------------------------------------------------*/
101/*
102 * Add a slice based on a disc
103 */
104/*----------------------------------------------------------------------------*/
105
106void
108 const char *selection_criteria,
109 const cs_real_t origin[],
110 const cs_real_t normal[],
111 const cs_real_t radius,
112 const int n_sectors);
113
114/*----------------------------------------------------------------------------*/
115/*
116 * Add a slice based on an annulus
117 */
118/*----------------------------------------------------------------------------*/
119
120void
122 const char *selection_criteria,
123 const cs_real_t origin[],
124 const cs_real_t normal[],
125 const cs_real_t radius1,
126 const cs_real_t radius2,
127 const int n_sectors);
128
129/*----------------------------------------------------------------------------*/
130/*
131 * Get number cells that may be intersected by the slice.
132 *
133 * return Number of elements
134 */
135/*----------------------------------------------------------------------------*/
136
138cs_medcoupling_slice_get_n_elts(const char *name);
139
140/*----------------------------------------------------------------------------*/
141/*
142 * Get list of ids of the elements which may be intersected.
143 *
144 * return Pointer to list of ids (cs_lnum_t *). Do not deallocate!
145 */
146/*----------------------------------------------------------------------------*/
147
148cs_lnum_t *
149cs_medcoupling_slice_get_elt_ids(const char *name);
150
151/*----------------------------------------------------------------------------*/
152/*
153 * Get list of intersection surfaces for each cell intersected.
154 *
155 * return Pointer to list of intersection surfaces (cs_real_t *)
156 */
157/*----------------------------------------------------------------------------*/
158
159cs_real_t *
160cs_medcoupling_slice_get_surfaces(const char *name);
161
162/*----------------------------------------------------------------------------*/
163/*
164 * Get total intersection surface between a slice and volume mesh
165 *
166 * return Value of total intersection surface
167 */
168/*----------------------------------------------------------------------------*/
169
172
173/*----------------------------------------------------------------------------*/
174/*
175 * Activate postprocessing of intersected cells
176 */
177/*----------------------------------------------------------------------------*/
178
179void
181(
182 const char *name
183);
184
185/*----------------------------------------------------------------------------*/
186/*
187 * Compute integral of a scalar over a slice.
188 *
189 * return Global integrated value. A cs_parall_sum is used.
190 */
191/*----------------------------------------------------------------------------*/
192
195 const cs_real_t *scalar);
196
197/*----------------------------------------------------------------------------*/
198/*
199 * Compute mean value of a scalar over a slice.
200 *
201 * return Global integrated value. A cs_parall_sum is used.
202 */
203/*----------------------------------------------------------------------------*/
204
206cs_medcoupling_slice_scalar_mean(const char *name,
207 const cs_real_t *scalar);
208
209/*----------------------------------------------------------------------------*/
210/*
211 * Compute integral of a scalar over a slice using a scalar and/or
212 * vectorial weights. If NULL is provided for both weights,
213 * the non-weighted function is called.
214 *
215 * return Computed integral value over entire slice (parallel)
216 */
217/*----------------------------------------------------------------------------*/
218
221 const cs_real_t *scalar,
222 const cs_real_t *weight_s,
223 const cs_real_3_t *weight_v);
224
225/*----------------------------------------------------------------------------*/
226/*
227 * Compute mean of a scalar over a slice using a scalar and/or vectorial
228 * weights. If NULL is provided for both weights, the non-weighted
229 * function is called.
230 *
231 * return Computed mean value over entire slice (parallel)
232 */
233/*----------------------------------------------------------------------------*/
234
237 const cs_real_t *scalar,
238 const cs_real_t *weight_s,
239 const cs_real_3_t *weight_v);
240
241/*----------------------------------------------------------------------------*/
242/*
243 * Destroy all slices
244 */
245/*----------------------------------------------------------------------------*/
246
247void
249
250/*----------------------------------------------------------------------------*/
251
252#endif /* CS_MEDCOUPLING_POSTPROCESS_HXX */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:349
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
cs_real_t cs_medcoupling_slice_scalar_integral(const char *name, const cs_real_t *scalar)
Compute integral of a scalar over a slice.
Definition: cs_medcoupling_postprocess.cxx:873
cs_medcoupling_slice_t * cs_medcoupling_slice_by_id(int id)
Get pointer to a slice based on id.
Definition: cs_medcoupling_postprocess.cxx:568
void cs_medcoupling_slice_destroy_all(void)
Destroy all slices.
Definition: cs_medcoupling_postprocess.cxx:1056
cs_real_t * cs_medcoupling_slice_get_surfaces(const char *name)
Get list of intersection surfaces for each cell intersected.
Definition: cs_medcoupling_postprocess.cxx:818
void cs_medcoupling_postprocess_add_annulus_slice(const char *name, const char *selection_criteria, const cs_real_t origin[], const cs_real_t normal[], const cs_real_t radius1, const cs_real_t radius2, const int n_sectors)
Add a slice based on an annulus.
Definition: cs_medcoupling_postprocess.cxx:732
cs_real_t cs_medcoupling_slice_scalar_integral_weighted(const char *name, const cs_real_t *scalar, const cs_real_t *weight_s, const cs_real_3_t *weight_v)
Compute integral of a scalar over a slice using a scalar and/or vectorial weights....
Definition: cs_medcoupling_postprocess.cxx:930
cs_lnum_t * cs_medcoupling_slice_get_elt_ids(const char *name)
Get list of ids of the elements which may be intersected.
Definition: cs_medcoupling_postprocess.cxx:799
void cs_medcoupling_postprocess_add_plane_slice(const char *name, const char *selection_criteria, const cs_real_t origin[], const cs_real_t normal[], const cs_real_t length1, const cs_real_t length2)
Add a slice based on a plane.
Definition: cs_medcoupling_postprocess.cxx:640
void cs_medcoupling_slice_activate_postprocess(const char *name)
Activate postprocessing of intersected cells.
Definition: cs_medcoupling_postprocess.cxx:854
cs_medcoupling_slice_t * cs_medcoupling_slice_by_name_try(const char *name)
Get pointer to slice based on name. Returns nullptr if not found.
Definition: cs_medcoupling_postprocess.cxx:613
cs_medcoupling_slice_t * cs_medcoupling_slice_by_name(const char *name)
Get pointer to slice based on name, raises an error if not found.
Definition: cs_medcoupling_postprocess.cxx:589
cs_real_t cs_medcoupling_slice_scalar_mean_weighted(const char *name, const cs_real_t *scalar, const cs_real_t *weight_s, const cs_real_3_t *weight_v)
Compute mean of a scalar over a slice using a scalar and/or vectorial weights. If nullptr is provided...
Definition: cs_medcoupling_postprocess.cxx:993
cs_real_t cs_medcoupling_slice_scalar_mean(const char *name, const cs_real_t *scalar)
Compute mean value of a scalar over a slice.
Definition: cs_medcoupling_postprocess.cxx:906
cs_real_t cs_medcoupling_slice_get_total_surface(const char *name)
Get total intersection surface between a slice and volume mesh.
Definition: cs_medcoupling_postprocess.cxx:837
cs_lnum_t cs_medcoupling_slice_get_n_elts(const char *name)
Get number cells that may be intersected by the slice.
Definition: cs_medcoupling_postprocess.cxx:780
void cs_medcoupling_postprocess_add_disc_slice(const char *name, const char *selection_criteria, const cs_real_t origin[], const cs_real_t normal[], const cs_real_t radius, const int n_sectors)
Add a slice based on a disc.
Definition: cs_medcoupling_postprocess.cxx:689