9.2
general documentation
cs_measures_util.h
Go to the documentation of this file.
1#ifndef CS_MEASURES_H
2#define CS_MEASURES_H
3
4/*============================================================================
5 * Field management.
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#if defined(HAVE_MPI)
31#include <mpi.h>
32#endif
33
34/*----------------------------------------------------------------------------
35 * Local headers
36 *----------------------------------------------------------------------------*/
37
38#include "base/cs_defs.h"
39
40/*----------------------------------------------------------------------------
41 * Definition of the measures set structure
42 *----------------------------------------------------------------------------*/
43
44typedef struct {
45
46 const char *name; /* Name */
47 int id; /* Measures set id */
48 int type; /* Measures set type flag
49 not yet used */
50 int dim; /* Measures set dimension */
51 int *comp_ids; /* index of components of measures if
52 dim > 1 */
53 cs_lnum_t nb_measures; /* Number of measures */
54 cs_lnum_t nb_measures_max; /* Dynamic reallocation parameter */
55 bool interleaved; /* Is measures set interleaved ? */
56 int *is_cressman; /* Is measure cressman interpolated?
57 0: no
58 1: yes */
59 int *is_interpol; /* Is measure taken into account for
60 interpolation ?
61 0: no
62 1: yes */
63 cs_real_t *coords; /* measures coordinates */
64 cs_real_t *measures; /* measures values */
65 cs_real_t *inf_radius; /* influence radius */
66
68
69typedef struct {
70
71 const char *name; /* Name */
72 int id; /* Grid id */
73 cs_lnum_t nb_points; /* Number of grid points */
74 bool is_connect; /* Is connectivity computed? */
75 cs_real_t *coords; /* measures coordinates */
76 cs_lnum_t *cell_connect; /* Mesh -> grid connectivity */
77 int *rank_connect; /* Rank location */
78
80
81/*----------------------------------------------------------------------------
82 * Interpolate mesh field on interpol grid structure.
83 *
84 * This function is deprecated because it take 1 value of the 3D field to
85 * the 1D grid...
86 *
87 * parameters:
88 * ig <-- pointer to the interpolation grid structure
89 * values_to_interpol <-- field on mesh (size = n_cells)
90 * interpolated_values --> interpolated values on the interpolation grid
91 * structure (size = ig->nb_point)
92 *----------------------------------------------------------------------------*/
93
94[[deprecated]] void
96 const cs_real_t *values_to_interpol,
97 cs_real_t *interpoled_values);
98
99/*----------------------------------------------------------------------------
100 * Interpolate mesh field on interpol grid structure.
101 *
102 * parameters:
103 * ig <-- pointer to the interpolation grid structure
104 * values_to_interpol <-- field on mesh (size = n_cells)
105 * interpolated_values --> interpolated values on the interpolation grid
106 * structure (size = ig->nb_point)
107 *----------------------------------------------------------------------------*/
108
109void
111 const cs_real_t *values_to_interpol,
112 cs_real_t *interpoled_values);
113
114/*----------------------------------------------------------------------------
115 * Create an interpolation grid descriptor.
116 *
117 * For measures set with a dimension greater than 1, components are interleaved.
118 *
119 * parameters:
120 * name <-- grid name
121 *
122 * returns:
123 * pointer to new interpolation grid.
124 *
125 *----------------------------------------------------------------------------*/
126
128cs_interpol_grid_create(const char *name);
129
130/*----------------------------------------------------------------------------
131 * Create interpolation grid.
132 *
133 * parameters:
134 * ig <-- pointer to an interpol grid structure
135 * nb_points <-- number of considered points
136 * coord <-- coordonates of considered points
137 *----------------------------------------------------------------------------*/
138
139void
141 const cs_lnum_t nb_points,
142 const cs_real_t *coords);
143
144/*----------------------------------------------------------------------------
145 * Create a measures set descriptor.
146 *
147 * For measures set with a dimension greater than 1, components are interleaved.
148 *
149 * parameters:
150 * name <-- measures set name
151 * type_flag <-- mask of field property and category values (not used yet)
152 * dim <-- measure set dimension (number of components)
153 * interleaved <-- if dim > 1, indicate if field is interleaved
154 *
155 * returns:
156 * pointer to new measures set.
157 *
158 *----------------------------------------------------------------------------*/
159
161cs_measures_set_create(const char *name,
162 int type_flag,
163 int dim,
164 bool interleaved);
165
166/*----------------------------------------------------------------------------
167 * (re)Allocate and fill in a measures set structure with an array of measures.
168 *
169 * parameters:
170 * ms <-- pointer to the measures set
171 * nb_measures <-- number of measures
172 * is_cressman <-- for each measure cressman interpolation is:
173 * 0: not used
174 * 1: used
175 * is_interpol <-- for the interpolation on mesh, each measure is
176 * 0: not taken into account
177 * 1: taken into account
178 * measures_coords <-- measures spaces coordonates
179 * measures <-- measures values (associated to coordinates)
180 * influence_radius <-- influence radius for interpolation (xyz interleaved)
181 *----------------------------------------------------------------------------*/
182
183void
185 const cs_lnum_t nb_measures,
186 const int *is_cressman,
187 const int *is_interpol,
188 const cs_real_t *measures_coords,
189 const cs_real_t *measures,
190 const cs_real_t *influence_radius);
191
192/*----------------------------------------------------------------------------
193 * Add new measures to an existing measures set (already declared and
194 * allocated).
195 *
196 * parameters:
197 * ms <-- pointer to the existing measures set
198 * nb_measures <-- number of new measures
199 * is_cressman <-- for each new measure cressman interpolation is:
200 * 0: not used
201 * 1: used
202 * is_interpol <-- for the interpolation on mesh, each new measure is
203 * 0: not taken into account
204 * 1: taken into account
205 * measures_coords <-- new measures spaces coordonates
206 * measures <-- new measures values (associated to coordonates)
207 * influence_radius <-- influence radius for interpolation (xyz interleaved)
208 *----------------------------------------------------------------------------*/
209
210void
212 const cs_lnum_t nb_measures,
213 const int *is_cressman,
214 const int *is_interpol,
215 const cs_real_t *measures_coords,
216 const cs_real_t *measures,
217 const cs_real_t *influence_radius);
218
219/*----------------------------------------------------------------------------
220 * Compute a Cressman interpolation on the global mesh.
221 *
222 * parameters:
223 * ms <-- pointer to the measures set structure
224 * (values to interpolate)
225 * interpolated_values --> interpolated values on the global mesh
226 * (size = n_cells or nb_faces)
227 * id_type <-- parameter:
228 * 1: interpolation on volumes
229 * 2: interpolation on boundary faces
230 *----------------------------------------------------------------------------*/
231
232void
234 cs_real_t *interpolated_values,
235 int id_type);
236
237/*----------------------------------------------------------------------------
238 * Return a pointer to a measures set based on its id.
239 *
240 * This function requires that a measures set of the given id is defined.
241 *
242 * parameters:
243 * id <-- measures set id
244 *
245 * return:
246 * pointer to the measures set structure
247 *
248 *----------------------------------------------------------------------------*/
249
252
253/*----------------------------------------------------------------------------
254 * Return a pointer to a grid based on its id.
255 *
256 * This function requires that a grid of the given id is defined.
257 *
258 * parameters:
259 * id <-- grid id
260 *
261 * return:
262 * pointer to the grid structure
263 *
264 *----------------------------------------------------------------------------*/
265
268
269/*----------------------------------------------------------------------------
270 * Return a pointer to a measure set based on its name.
271 *
272 * This function requires that a measure set of the given name is defined.
273 *
274 * parameters:
275 * name <-- measure set name
276 *
277 * return:
278 * pointer to the measures set structure
279 *----------------------------------------------------------------------------*/
280
282cs_measures_set_by_name(const char *name);
283
284/*----------------------------------------------------------------------------
285 * Return a pointer to a grid based on its name.
286 *
287 * This function requires that a grid of the given name is defined.
288 *
289 * parameters:
290 * name <-- grid name
291 *
292 * return:
293 * pointer to the grid structure
294 *----------------------------------------------------------------------------*/
295
297cs_interpol_grid_by_name(const char *name);
298
299/*----------------------------------------------------------------------------
300 * Destroy all defined measures sets.
301 *----------------------------------------------------------------------------*/
302
303void
305
306/*----------------------------------------------------------------------------
307 * Destroy all defined grids.
308 *----------------------------------------------------------------------------*/
309
310void
312
313/*----------------------------------------------------------------------------*/
314
315#endif /* CS_MEASURES_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
void cs_interpol_field_on_grid(cs_interpol_grid_t *ig, const cs_real_t *values_to_interpol, cs_real_t *interpoled_values)
cs_interpol_grid_t * cs_interpol_grid_by_name(const char *name)
cs_measures_set_t * cs_measures_set_by_id(int id)
void cs_measures_set_map_values(cs_measures_set_t *ms, const cs_lnum_t nb_measures, const int *is_cressman, const int *is_interpol, const cs_real_t *measures_coords, const cs_real_t *measures, const cs_real_t *influence_radius)
void cs_interpol_grid_init(cs_interpol_grid_t *ig, const cs_lnum_t nb_points, const cs_real_t *coords)
cs_interpol_grid_t * cs_interpol_grid_create(const char *name)
void cs_measures_set_add_values(cs_measures_set_t *ms, const cs_lnum_t nb_measures, const int *is_cressman, const int *is_interpol, const cs_real_t *measures_coords, const cs_real_t *measures, const cs_real_t *influence_radius)
void cs_cressman_interpol(cs_measures_set_t *ms, cs_real_t *interpolated_values, int id_type)
cs_interpol_grid_t * cs_interpol_grid_by_id(int id)
cs_measures_set_t * cs_measures_set_create(const char *name, int type_flag, int dim, bool interleaved)
cs_measures_set_t * cs_measures_set_by_name(const char *name)
void cs_interpol_grids_destroy(void)
void cs_interpol_field_on_grid_deprecated(cs_interpol_grid_t *ig, const cs_real_t *values_to_interpol, cs_real_t *interpoled_values)
void cs_measures_sets_destroy(void)
Definition: cs_measures_util.h:69
cs_real_t * coords
Definition: cs_measures_util.h:75
cs_lnum_t nb_points
Definition: cs_measures_util.h:73
int * rank_connect
Definition: cs_measures_util.h:77
bool is_connect
Definition: cs_measures_util.h:74
cs_lnum_t * cell_connect
Definition: cs_measures_util.h:76
int id
Definition: cs_measures_util.h:72
const char * name
Definition: cs_measures_util.h:71
Definition: cs_measures_util.h:44
cs_lnum_t nb_measures
Definition: cs_measures_util.h:53
int * is_cressman
Definition: cs_measures_util.h:56
cs_real_t * coords
Definition: cs_measures_util.h:63
cs_lnum_t nb_measures_max
Definition: cs_measures_util.h:54
int dim
Definition: cs_measures_util.h:50
cs_real_t * measures
Definition: cs_measures_util.h:64
int id
Definition: cs_measures_util.h:47
int * is_interpol
Definition: cs_measures_util.h:59
int * comp_ids
Definition: cs_measures_util.h:51
const char * name
Definition: cs_measures_util.h:46
cs_real_t * inf_radius
Definition: cs_measures_util.h:65
int type
Definition: cs_measures_util.h:48
bool interleaved
Definition: cs_measures_util.h:55