8.3
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-2024 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 "cs_defs.h"
35
36/*----------------------------------------------------------------------------*/
37
39
40/*============================================================================
41 * Type definitions
42 *============================================================================*/
43
44/*============================================================================
45 * Structure definitions
46 *============================================================================*/
47
48typedef struct _medcoupling_slice_t cs_medcoupling_slice_t;
49
50/*============================================================================
51 * Public function prototypes
52 *============================================================================*/
53
54/*----------------------------------------------------------------------------*/
55/*
56 * Get pointer to a slice based on id
57 *
58 * return pointer to slice. Raises an error if index is out of
59 * bounds.
60 */
61/*----------------------------------------------------------------------------*/
62
63cs_medcoupling_slice_t *
65
66/*----------------------------------------------------------------------------*/
67/*
68 * Get pointer to slice based on name, raises an error
69 * if not found.
70 *
71 * return pointer to slice, raises error if not found.
72 */
73/*----------------------------------------------------------------------------*/
74
75cs_medcoupling_slice_t *
76cs_medcoupling_slice_by_name(const char *name);
77
78/*----------------------------------------------------------------------------*/
79/*
80 * Get pointer to slice based on name. Returns NULL if
81 * not found.
82 *
83 * return pointer to slice, NULL if not found.
84 */
85/*----------------------------------------------------------------------------*/
86
87cs_medcoupling_slice_t *
88cs_medcoupling_slice_by_name_try(const char *name);
89
90/*----------------------------------------------------------------------------*/
91/*
92 * Add a slice based on a plane.
93 */
94/*----------------------------------------------------------------------------*/
95
96void
98 const char *selection_criteria,
99 const cs_real_t origin[],
100 const cs_real_t normal[],
101 const cs_real_t length1,
102 const cs_real_t length2);
103
104/*----------------------------------------------------------------------------*/
105/*
106 * Add a slice based on a disc
107 */
108/*----------------------------------------------------------------------------*/
109
110void
112 const char *selection_criteria,
113 const cs_real_t origin[],
114 const cs_real_t normal[],
115 const cs_real_t radius,
116 const int n_sectors);
117
118/*----------------------------------------------------------------------------*/
119/*
120 * Add a slice based on an annulus
121 */
122/*----------------------------------------------------------------------------*/
123
124void
126 const char *selection_criteria,
127 const cs_real_t origin[],
128 const cs_real_t normal[],
129 const cs_real_t radius1,
130 const cs_real_t radius2,
131 const int n_sectors);
132
133/*----------------------------------------------------------------------------*/
134/*
135 * Get number cells that may be intersected by the slice.
136 *
137 * return Number of elements
138 */
139/*----------------------------------------------------------------------------*/
140
142cs_medcoupling_slice_get_n_elts(const char *name);
143
144/*----------------------------------------------------------------------------*/
145/*
146 * Get list of ids of the elements which may be intersected.
147 *
148 * return Pointer to list of ids (cs_lnum_t *). Do not deallocate!
149 */
150/*----------------------------------------------------------------------------*/
151
152cs_lnum_t *
153cs_medcoupling_slice_get_elt_ids(const char *name);
154
155/*----------------------------------------------------------------------------*/
156/*
157 * Get list of intersection surfaces for each cell intersected.
158 *
159 * return Pointer to list of intersection surfaces (cs_real_t *)
160 */
161/*----------------------------------------------------------------------------*/
162
163cs_real_t *
164cs_medcoupling_slice_get_surfaces(const char *name);
165
166/*----------------------------------------------------------------------------*/
167/*
168 * Get total intersection surface between a slice and volume mesh
169 *
170 * return Value of total intersection surface
171 */
172/*----------------------------------------------------------------------------*/
173
176
177/*----------------------------------------------------------------------------*/
178/*
179 * Activate postprocessing of intersected cells
180 */
181/*----------------------------------------------------------------------------*/
182
183void
185(
186 const char *name
187);
188
189/*----------------------------------------------------------------------------*/
190/*
191 * Compute integral of a scalar over a slice.
192 *
193 * return Global integrated value. A cs_parall_sum is used.
194 */
195/*----------------------------------------------------------------------------*/
196
199 const cs_real_t *scalar);
200
201/*----------------------------------------------------------------------------*/
202/*
203 * Compute mean value of a scalar over a slice.
204 *
205 * return Global integrated value. A cs_parall_sum is used.
206 */
207/*----------------------------------------------------------------------------*/
208
210cs_medcoupling_slice_scalar_mean(const char *name,
211 const cs_real_t *scalar);
212
213/*----------------------------------------------------------------------------*/
214/*
215 * Compute integral of a scalar over a slice using a scalar and/or
216 * vectorial weights. If NULL is provided for both weights,
217 * the non-weighted function is called.
218 *
219 * return Computed integral value over entire slice (parallel)
220 */
221/*----------------------------------------------------------------------------*/
222
225 const cs_real_t *scalar,
226 const cs_real_t *weight_s,
227 const cs_real_3_t *weight_v);
228
229/*----------------------------------------------------------------------------*/
230/*
231 * Compute mean of a scalar over a slice using a scalar and/or vectorial
232 * weights. If NULL is provided for both weights, the non-weighted
233 * function is called.
234 *
235 * return Computed mean value over entire slice (parallel)
236 */
237/*----------------------------------------------------------------------------*/
238
241 const cs_real_t *scalar,
242 const cs_real_t *weight_s,
243 const cs_real_3_t *weight_v);
244
245/*----------------------------------------------------------------------------*/
246/*
247 * Destroy all slices
248 */
249/*----------------------------------------------------------------------------*/
250
251void
253
254/*----------------------------------------------------------------------------*/
255
257
258#endif /* __CS_MEDCOUPLING_POSTPROCESS_HXX__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:359
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
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:875
cs_medcoupling_slice_t * cs_medcoupling_slice_by_id(int id)
Get pointer to a slice based on id.
Definition: cs_medcoupling_postprocess.cxx:570
void cs_medcoupling_slice_destroy_all(void)
Destroy all slices.
Definition: cs_medcoupling_postprocess.cxx:1058
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:820
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:734
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:932
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:801
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:642
void cs_medcoupling_slice_activate_postprocess(const char *name)
Activate postprocessing of intersected cells.
Definition: cs_medcoupling_postprocess.cxx:856
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:615
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:591
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:995
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:908
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:839
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:782
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:691