Code_Saturne
CFD tool
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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-2012 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 "fvm_defs.h"
35 #include "fvm_group.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #if 0
42 } /* Fake brace to force Emacs auto-indentation back to column 0 */
43 #endif
44 #endif /* __cplusplus */
45 
46 /*=============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Type definitions
52  *============================================================================*/
53 
55 
56 /*=============================================================================
57  * Public function prototypes
58  *============================================================================*/
59 
60 /*----------------------------------------------------------------------------
61  * Creation of a selector object.
62  *
63  * parameters:
64  * dim <-- spatial dimension (coordinates and normals)
65  * n_elements <-- number of selectable elements
66  * group_class_set <-- pointer to group class set definition
67  * group_class_id <-- group class id associated with each element
68  * (size: n_elements)
69  * group_class_id_base; <-- Starting group class id base (usually 0 or 1)
70  * coords <-- coordinates (interlaced) associated with each
71  * element, whether vertex, face or cell center, ...
72  * (size: n_elements * dim)
73  * normals <-- normals (interlaced) associated with each element
74  * if applicable (such as for face normals), or NULL
75  *
76  * returns:
77  * pointer to new selector
78  *----------------------------------------------------------------------------*/
79 
83  const fvm_group_class_set_t *group_class_set,
84  const int group_class_id[],
86  const double coords[],
87  const double normals[]);
88 
89 /*----------------------------------------------------------------------------
90  * Destruction of a selector structure.
91  *
92  * parameters:
93  * this_selector <-> selector to destroy
94  *
95  * returns:
96  * NULL pointer
97  *----------------------------------------------------------------------------*/
98 
100 fvm_selector_destroy(fvm_selector_t *this_selector);
101 
102 /*----------------------------------------------------------------------------
103  * Define the list of the elements verifying the criteria described
104  * by a character string
105  *
106  * The selected_element[] array must be pre-allocated, and be of sufficient
107  * size to contain all elements associated with the selector.
108  *
109  * parameters:
110  * this_selector <-> pointer to selector
111  * str <-- string defining selection criteria
112  * n_selected_elements <-- number of elements selected
113  * selected_elements <-> selected elements list (1 to n numbering)
114  *
115  * returns:
116  * criteria id associated by selector with str
117  *----------------------------------------------------------------------------*/
118 
119 int
121  const char *str,
122  cs_lnum_t *n_selected_elements,
123  cs_lnum_t *selected_elements);
124 
125 /*----------------------------------------------------------------------------
126  * Define the list of group classes verifying the criteria described
127  * by a character string.
128  *
129  * The selected_gc[] array must be pre-allocated, and be of sufficient
130  * size to contain all elements associated with the selector.
131  *
132  * parameters:
133  * this_selector <-> pointer to selector
134  * str <-- string defining selection criteria
135  * n_selected_gcs <-- number of group classes selected
136  * selected_gcs <-> selected group class list (0 to n numbering,
137  * as group class "zero" may exist)
138  *
139  * returns:
140  * criteria id associated by selector with str
141  *----------------------------------------------------------------------------*/
142 
143 int
145  const char *str,
146  int *n_selected_gcs,
147  int selected_gcs[]);
148 
149 /*----------------------------------------------------------------------------
150  * Return the number of operands associated with a selection criteria
151  * which are missing in the selector's associated group class set.
152  *
153  * parameters:
154  * this_selector <-- pointer to selector
155  * criteria_id <-- id of criteria returned by fvm_selector_get_list()
156  *
157  * returns:
158  * number of missing operands
159  *----------------------------------------------------------------------------*/
160 
161 int
162 fvm_selector_n_missing(const fvm_selector_t *this_selector,
163  int criteria_id);
164 
165 /*----------------------------------------------------------------------------
166  * Return a pointer to the name of an of operand associated with a selection
167  * criteria which is missing in the selector's associated group class set.
168  *
169  * parameters:
170  * this_selector <-- pointer to selector
171  * criteria_id <-- id of criteria returned by fvm_selector_get_list()
172  * missing_id <-- id of missing operand for this criteria
173  *
174  * returns:
175  * pointer to name of missing operand
176  *----------------------------------------------------------------------------*/
177 
178 const char *
179 fvm_selector_get_missing(const fvm_selector_t *this_selector,
180  int criteria_id,
181  int missing_id);
182 
183 /*----------------------------------------------------------------------------
184  * Get statistics on selector usage
185  *
186  * parameters:
187  * this_selector <-- pointer to selector
188  * n_evals <-> number of evaluations, or NULL
189  * eval_wtime <-> evaluation wall-clock time, or NULL
190  *----------------------------------------------------------------------------*/
191 
192 void
193 fvm_selector_get_stats(const fvm_selector_t *this_selector,
194  int *n_evals,
195  double *eval_wtime);
196 
197 /*----------------------------------------------------------------------------
198  * Dump the contents of a selector structure in human readable form
199  *
200  * parameters:
201  * this_selector <-- pointer to selector
202  *----------------------------------------------------------------------------*/
203 
204 void
205 fvm_selector_dump(const fvm_selector_t *this_selector);
206 
207 /*----------------------------------------------------------------------------*/
208 
209 #ifdef __cplusplus
210 }
211 #endif /* __cplusplus */
212 
213 #endif /* __FVM_SELECTOR_H__ */
fvm_selector_t * fvm_selector_destroy(fvm_selector_t *this_selector)
Definition: fvm_selector.c:864
cs_lnum_t n_elements
Definition: fvm_selector.c:107
const int * group_class_id
Definition: fvm_selector.c:109
const double * coords
Definition: fvm_selector.c:131
int n_evals
Definition: fvm_selector.c:146
int cs_lnum_t
Definition: cs_defs.h:260
int dim
Definition: fvm_selector.c:106
int fvm_selector_n_missing(const fvm_selector_t *this_selector, int criteria_id)
Definition: fvm_selector.c:1123
int fvm_selector_get_gc_list(fvm_selector_t *this_selector, const char *str, int *n_selected_gcs, int selected_gcs[])
Definition: fvm_selector.c:1059
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.c:764
Definition: fvm_group.c:83
void fvm_selector_dump(const fvm_selector_t *this_selector)
Definition: fvm_selector.c:1204
double eval_wtime
Definition: fvm_selector.c:147
Definition: fvm_selector.c:104
int group_class_id_base
Definition: fvm_selector.c:112
void fvm_selector_get_stats(const fvm_selector_t *this_selector, int *n_evals, double *eval_wtime)
Definition: fvm_selector.c:1184
const char * fvm_selector_get_missing(const fvm_selector_t *this_selector, int criteria_id, int missing_id)
Definition: fvm_selector.c:1155
const double * normals
Definition: fvm_selector.c:135
int fvm_selector_get_list(fvm_selector_t *this_selector, const char *str, cs_lnum_t *n_selected_elements, cs_lnum_t *selected_elements)
Definition: fvm_selector.c:929