9.1
general documentation
fvm_selector.h
Go to the documentation of this file.
1#ifndef __FVM_SELECTOR_H__
2#define __FVM_SELECTOR_H__
3
4/*============================================================================
5 * Mechanism for entity selection based on groups or attributes
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2025 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#include "base/cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Local headers
34 *----------------------------------------------------------------------------*/
35
36#include "fvm/fvm_defs.h"
37#include "fvm/fvm_group.h"
38
39/*----------------------------------------------------------------------------*/
40
42
43/*=============================================================================
44 * Macro definitions
45 *============================================================================*/
46
47/*============================================================================
48 * Type definitions
49 *============================================================================*/
50
51typedef struct _fvm_selector_t fvm_selector_t;
52
53/*=============================================================================
54 * Public function prototypes
55 *============================================================================*/
56
57/*----------------------------------------------------------------------------
58 * Creation of a selector object.
59 *
60 * parameters:
61 * dim <-- spatial dimension (coordinates and normals)
62 * n_elements <-- number of selectable elements
63 * group_class_set <-- pointer to group class set definition
64 * group_class_id <-- group class id associated with each element
65 * (size: n_elements)
66 * group_class_id_base; <-- Starting group class id base (usually 0 or 1)
67 * coords <-- coordinates associated with each
68 * element, whether vertex, face or cell center, ...
69 * u_normals <-- unit normals associated with each element
70 * if applicable (such as for face normals), or NULL
71 *
72 * returns:
73 * pointer to new selector
74 *----------------------------------------------------------------------------*/
75
78 cs_lnum_t n_elements,
79 const fvm_group_class_set_t *group_class_set,
80 const int group_class_id[],
81 int group_class_id_base,
82 const cs_real_3_t coords[],
83 const cs_nreal_3_t u_normals[]);
84
85/*----------------------------------------------------------------------------
86 * Destruction of a selector structure.
87 *
88 * parameters:
89 * this_selector <-> selector to destroy
90 *
91 * returns:
92 * null pointer
93 *----------------------------------------------------------------------------*/
94
97
98/*----------------------------------------------------------------------------
99 * Define the list of the elements verifying the criteria described
100 * by a character string
101 *
102 * The selected_element[] array must be pre-allocated, and be of sufficient
103 * size to contain all elements associated with the selector.
104 *
105 * parameters:
106 * this_selector <-> pointer to selector
107 * str <-- string defining selection criteria
108 * elt_id_base <-- element id base (usually 0 or 1)
109 * n_selected_elements <-- number of elements selected
110 * selected_elements <-> selected elements list (1 to n numbering)
111 *
112 * returns:
113 * criteria id associated by selector with str
114 *----------------------------------------------------------------------------*/
115
116int
118 const char *str,
119 cs_lnum_t elt_id_base,
120 cs_lnum_t *n_selected_elements,
121 cs_lnum_t *selected_elements);
122
123/*----------------------------------------------------------------------------
124 * Define the list of group classes verifying the criteria described
125 * by a character string.
126 *
127 * The selected_gc[] array must be pre-allocated, and be of sufficient
128 * size to contain all elements associated with the selector.
129 *
130 * parameters:
131 * this_selector <-> pointer to selector
132 * str <-- string defining selection criteria
133 * n_selected_gcs <-- number of group classes selected
134 * selected_gcs <-> selected group class list (0 to n numbering,
135 * as group class "zero" may exist)
136 *
137 * returns:
138 * criteria id associated by selector with str
139 *----------------------------------------------------------------------------*/
140
141int
143 const char *str,
144 int *n_selected_gcs,
145 int selected_gcs[]);
146
147/*----------------------------------------------------------------------------
148 * Return the number of operands associated with a selection criteria
149 * which are missing in the selector's associated group class set.
150 *
151 * parameters:
152 * this_selector <-- pointer to selector
153 * criteria_id <-- id of criteria returned by fvm_selector_get_list()
154 *
155 * returns:
156 * number of missing operands
157 *----------------------------------------------------------------------------*/
158
159int
160fvm_selector_n_missing(const fvm_selector_t *this_selector,
161 int criteria_id);
162
163/*----------------------------------------------------------------------------
164 * Return a pointer to the name of an of operand associated with a selection
165 * criteria which is missing in the selector's associated group class set.
166 *
167 * parameters:
168 * this_selector <-- pointer to selector
169 * criteria_id <-- id of criteria returned by fvm_selector_get_list()
170 * missing_id <-- id of missing operand for this criteria
171 *
172 * returns:
173 * pointer to name of missing operand
174 *----------------------------------------------------------------------------*/
175
176const char *
177fvm_selector_get_missing(const fvm_selector_t *this_selector,
178 int criteria_id,
179 int missing_id);
180
181/*----------------------------------------------------------------------------
182 * Get statistics on selector usage
183 *
184 * parameters:
185 * this_selector <-- pointer to selector
186 * n_evals <-> number of evaluations, or NULL
187 * eval_wtime <-> evaluation wall-clock time, or NULL
188 *----------------------------------------------------------------------------*/
189
190void
191fvm_selector_get_stats(const fvm_selector_t *this_selector,
192 int *n_evals,
193 double *eval_wtime);
194
195/*----------------------------------------------------------------------------
196 * Dump the contents of a selector structure in human readable form
197 *
198 * parameters:
199 * this_selector <-- pointer to selector
200 *----------------------------------------------------------------------------*/
201
202void
203fvm_selector_dump(const fvm_selector_t *this_selector);
204
205/*----------------------------------------------------------------------------*/
206
208
209#endif /* __FVM_SELECTOR_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
cs_nreal_t cs_nreal_3_t[3]
Definition: cs_defs.h:400
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:374
#define END_C_DECLS
Definition: cs_defs.h:555
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:350
struct _fvm_group_class_set_t fvm_group_class_set_t
Definition: fvm_group.h:60
int fvm_selector_get_gc_list(fvm_selector_t *this_selector, const char *str, int *n_selected_gcs, int selected_gcs[])
Definition: fvm_selector.cpp:1061
struct _fvm_selector_t fvm_selector_t
Definition: fvm_selector.h:51
int fvm_selector_n_missing(const fvm_selector_t *this_selector, int criteria_id)
Definition: fvm_selector.cpp:1125
int fvm_selector_get_list(fvm_selector_t *this_selector, const char *str, cs_lnum_t elt_id_base, cs_lnum_t *n_selected_elements, cs_lnum_t *selected_elements)
Definition: fvm_selector.cpp:928
fvm_selector_t * fvm_selector_destroy(fvm_selector_t *this_selector)
Definition: fvm_selector.cpp:866
fvm_selector_t * fvm_selector_create(int dim, cs_lnum_t n_elements, const fvm_group_class_set_t *group_class_set, const int group_class_id[], int group_class_id_base, const cs_real_3_t coords[], const cs_nreal_3_t u_normals[])
Definition: fvm_selector.cpp:766
void fvm_selector_get_stats(const fvm_selector_t *this_selector, int *n_evals, double *eval_wtime)
Definition: fvm_selector.cpp:1186
const char * fvm_selector_get_missing(const fvm_selector_t *this_selector, int criteria_id, int missing_id)
Definition: fvm_selector.cpp:1157
void fvm_selector_dump(const fvm_selector_t *this_selector)
Definition: fvm_selector.cpp:1206