programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups 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-2013 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 
51 typedef 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 
77 fvm_selector_t *
78 fvm_selector_create(int dim,
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 
96 fvm_selector_t *
97 fvm_selector_destroy(fvm_selector_t *this_selector);
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  * 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 
116 int
117 fvm_selector_get_list(fvm_selector_t *this_selector,
118  const char *str,
119  cs_lnum_t *n_selected_elements,
120  cs_lnum_t *selected_elements);
121 
122 /*----------------------------------------------------------------------------
123  * Define the list of group classes verifying the criteria described
124  * by a character string.
125  *
126  * The selected_gc[] array must be pre-allocated, and be of sufficient
127  * size to contain all elements associated with the selector.
128  *
129  * parameters:
130  * this_selector <-> pointer to selector
131  * str <-- string defining selection criteria
132  * n_selected_gcs <-- number of group classes selected
133  * selected_gcs <-> selected group class list (0 to n numbering,
134  * as group class "zero" may exist)
135  *
136  * returns:
137  * criteria id associated by selector with str
138  *----------------------------------------------------------------------------*/
139 
140 int
141 fvm_selector_get_gc_list(fvm_selector_t *this_selector,
142  const char *str,
143  int *n_selected_gcs,
144  int selected_gcs[]);
145 
146 /*----------------------------------------------------------------------------
147  * Return the number of operands associated with a selection criteria
148  * which are missing in the selector's associated group class set.
149  *
150  * parameters:
151  * this_selector <-- pointer to selector
152  * criteria_id <-- id of criteria returned by fvm_selector_get_list()
153  *
154  * returns:
155  * number of missing operands
156  *----------------------------------------------------------------------------*/
157 
158 int
159 fvm_selector_n_missing(const fvm_selector_t *this_selector,
160  int criteria_id);
161 
162 /*----------------------------------------------------------------------------
163  * Return a pointer to the name of an of operand associated with a selection
164  * criteria which is missing in the selector's associated group class set.
165  *
166  * parameters:
167  * this_selector <-- pointer to selector
168  * criteria_id <-- id of criteria returned by fvm_selector_get_list()
169  * missing_id <-- id of missing operand for this criteria
170  *
171  * returns:
172  * pointer to name of missing operand
173  *----------------------------------------------------------------------------*/
174 
175 const char *
176 fvm_selector_get_missing(const fvm_selector_t *this_selector,
177  int criteria_id,
178  int missing_id);
179 
180 /*----------------------------------------------------------------------------
181  * Get statistics on selector usage
182  *
183  * parameters:
184  * this_selector <-- pointer to selector
185  * n_evals <-> number of evaluations, or NULL
186  * eval_wtime <-> evaluation wall-clock time, or NULL
187  *----------------------------------------------------------------------------*/
188 
189 void
190 fvm_selector_get_stats(const fvm_selector_t *this_selector,
191  int *n_evals,
192  double *eval_wtime);
193 
194 /*----------------------------------------------------------------------------
195  * Dump the contents of a selector structure in human readable form
196  *
197  * parameters:
198  * this_selector <-- pointer to selector
199  *----------------------------------------------------------------------------*/
200 
201 void
202 fvm_selector_dump(const fvm_selector_t *this_selector);
203 
204 /*----------------------------------------------------------------------------*/
205 
207 
208 #endif /* __FVM_SELECTOR_H__ */