8.3
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-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#include "cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Local headers
34 *----------------------------------------------------------------------------*/
35
36#include "fvm_defs.h"
37#include "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 (interlaced) associated with each
68 * element, whether vertex, face or cell center, ...
69 * (size: n_elements * dim)
70 * normals <-- normals (interlaced) associated with each element
71 * if applicable (such as for face normals), or NULL
72 *
73 * returns:
74 * pointer to new selector
75 *----------------------------------------------------------------------------*/
76
79 cs_lnum_t n_elements,
80 const fvm_group_class_set_t *group_class_set,
81 const int group_class_id[],
82 int group_class_id_base,
83 const double coords[],
84 const double normals[]);
85
86/*----------------------------------------------------------------------------
87 * Destruction of a selector structure.
88 *
89 * parameters:
90 * this_selector <-> selector to destroy
91 *
92 * returns:
93 * null pointer
94 *----------------------------------------------------------------------------*/
95
98
99/*----------------------------------------------------------------------------
100 * Define the list of the elements verifying the criteria described
101 * by a character string
102 *
103 * The selected_element[] array must be pre-allocated, and be of sufficient
104 * size to contain all elements associated with the selector.
105 *
106 * parameters:
107 * this_selector <-> pointer to selector
108 * str <-- string defining selection criteria
109 * elt_id_base <-- element id base (usually 0 or 1)
110 * n_selected_elements <-- number of elements selected
111 * selected_elements <-> selected elements list (1 to n numbering)
112 *
113 * returns:
114 * criteria id associated by selector with str
115 *----------------------------------------------------------------------------*/
116
117int
119 const char *str,
120 cs_lnum_t elt_id_base,
121 cs_lnum_t *n_selected_elements,
122 cs_lnum_t *selected_elements);
123
124/*----------------------------------------------------------------------------
125 * Define the list of group classes verifying the criteria described
126 * by a character string.
127 *
128 * The selected_gc[] array must be pre-allocated, and be of sufficient
129 * size to contain all elements associated with the selector.
130 *
131 * parameters:
132 * this_selector <-> pointer to selector
133 * str <-- string defining selection criteria
134 * n_selected_gcs <-- number of group classes selected
135 * selected_gcs <-> selected group class list (0 to n numbering,
136 * as group class "zero" may exist)
137 *
138 * returns:
139 * criteria id associated by selector with str
140 *----------------------------------------------------------------------------*/
141
142int
144 const char *str,
145 int *n_selected_gcs,
146 int selected_gcs[]);
147
148/*----------------------------------------------------------------------------
149 * Return the number of operands associated with a selection criteria
150 * which are missing in the selector's associated group class set.
151 *
152 * parameters:
153 * this_selector <-- pointer to selector
154 * criteria_id <-- id of criteria returned by fvm_selector_get_list()
155 *
156 * returns:
157 * number of missing operands
158 *----------------------------------------------------------------------------*/
159
160int
161fvm_selector_n_missing(const fvm_selector_t *this_selector,
162 int criteria_id);
163
164/*----------------------------------------------------------------------------
165 * Return a pointer to the name of an of operand associated with a selection
166 * criteria which is missing in the selector's associated group class set.
167 *
168 * parameters:
169 * this_selector <-- pointer to selector
170 * criteria_id <-- id of criteria returned by fvm_selector_get_list()
171 * missing_id <-- id of missing operand for this criteria
172 *
173 * returns:
174 * pointer to name of missing operand
175 *----------------------------------------------------------------------------*/
176
177const char *
178fvm_selector_get_missing(const fvm_selector_t *this_selector,
179 int criteria_id,
180 int missing_id);
181
182/*----------------------------------------------------------------------------
183 * Get statistics on selector usage
184 *
185 * parameters:
186 * this_selector <-- pointer to selector
187 * n_evals <-> number of evaluations, or NULL
188 * eval_wtime <-> evaluation wall-clock time, or NULL
189 *----------------------------------------------------------------------------*/
190
191void
192fvm_selector_get_stats(const fvm_selector_t *this_selector,
193 int *n_evals,
194 double *eval_wtime);
195
196/*----------------------------------------------------------------------------
197 * Dump the contents of a selector structure in human readable form
198 *
199 * parameters:
200 * this_selector <-- pointer to selector
201 *----------------------------------------------------------------------------*/
202
203void
204fvm_selector_dump(const fvm_selector_t *this_selector);
205
206/*----------------------------------------------------------------------------*/
207
209
210#endif /* __FVM_SELECTOR_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
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:1060
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:1124
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:929
fvm_selector_t * fvm_selector_destroy(fvm_selector_t *this_selector)
Definition: fvm_selector.cpp:863
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 double coords[], const double normals[])
Definition: fvm_selector.cpp:763
void fvm_selector_get_stats(const fvm_selector_t *this_selector, int *n_evals, double *eval_wtime)
Definition: fvm_selector.cpp:1185
const char * fvm_selector_get_missing(const fvm_selector_t *this_selector, int criteria_id, int missing_id)
Definition: fvm_selector.cpp:1156
void fvm_selector_dump(const fvm_selector_t *this_selector)
Definition: fvm_selector.cpp:1205