Code_Saturne
CFD tool
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fvm_selector_postfix.h
Go to the documentation of this file.
1 #ifndef __FVM_SELECTOR_POSTFIX_H__
2 #define __FVM_SELECTOR_POSTFIX_H__
3 
4 /*============================================================================
5  * Expression handling 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  * Create a postfix expression from an infix expression
62  *
63  * parameters:
64  * infix <-- infix expression
65  * n_groups <-- number of groups
66  * n_attributes <-- number of attributes
67  * group_name <-- array group names (sorted)
68  * attribute <-- array of attribute numbers (sorted)
69  *
70  * returns:
71  * pointer to created postfix structure
72  *----------------------------------------------------------------------------*/
73 
76  int n_groups,
77  int n_attributes,
78  const char *group_name[],
79  const int attribute[]);
80 
81 /*----------------------------------------------------------------------------
82  * Destroy a postfix expression
83  *
84  * parameters:
85  * pf <-> pointer to postfix structure pointer
86  *----------------------------------------------------------------------------*/
87 
88 void
90 
91 /*----------------------------------------------------------------------------
92  * Return a pointer to the infix string associated with a postfix expression
93  *
94  * parameters:
95  * pf <-- pointer to postfix structure
96  *
97  * returns:
98  * pointer to original infix string
99  *----------------------------------------------------------------------------*/
100 
101 const char *
103 
104 /*----------------------------------------------------------------------------
105  * Indicate if a postfix expression depends on coordinates
106  *
107  * parameters:
108  * pf <-- pointer to postfix structure
109  *
110  * returns:
111  * true if expression depends on coordinates, false otherwise
112  *----------------------------------------------------------------------------*/
113 
114 _Bool
116 
117 /*----------------------------------------------------------------------------
118  * Indicate if a postfix expression depends on normals
119  *
120  * parameters:
121  * pf <-- pointer to postfix structure
122  *
123  * returns:
124  * true if expression depends on normals, false otherwise
125  *----------------------------------------------------------------------------*/
126 
127 _Bool
129 
130 /*----------------------------------------------------------------------------
131  * Return the number of operands associated with a postfix expression
132  * missing in the associated group class set
133  *
134  * parameters:
135  * pf <-- pointer to postfix structure
136  *
137  * returns:
138  * number of missing operands
139  *----------------------------------------------------------------------------*/
140 
141 int
143 
144 /*----------------------------------------------------------------------------
145  * Return a pointer to the name of an of operand associated with a postfix
146  * expression but missing in the associated group class set
147  *
148  * parameters:
149  * pf <-- pointer to postfix structure
150  * id <-- id of missing operand (0 to fvm_selector_postfix_n_missing())
151  *
152  * returns:
153  * pointer to name of missing operand
154  *----------------------------------------------------------------------------*/
155 
156 const char *
158  int id);
159 
160 /*----------------------------------------------------------------------------
161  * Evaluate a postfix expression
162  *
163  * parameters:
164  * pf <-- pointer to postfix structure
165  * n_groups <-- number of groups associated with group class
166  * n_attributes <-- number of attributes associated with group class
167  * group_id <-- array group ids associated with group class
168  * attribute_id <-- array of attribute ids associated with group class
169  * coords <-- coordinates associated with evaluation, or NULL
170  * normal <-- normal associated with evaluation, or NULL
171  *
172  * returns:
173  * true or false base on expression evaluation
174  *----------------------------------------------------------------------------*/
175 
176 _Bool
178  int n_groups,
179  int n_attributes,
180  const int group_id[],
181  const int attribute_id[],
182  const double coords[],
183  const double normal[]);
184 
185 /*----------------------------------------------------------------------------
186  * Dump the contents of a postfix structure in human readable form
187  *
188  * parameters:
189  * pf <-> pointer to postfix structure
190  * n_groups <-- number of groups
191  * n_attributes <-- number of attributes
192  * group_name <-- array group names (sorted)
193  * attribute <-- array of attribute numbers (sorted)
194  *----------------------------------------------------------------------------*/
195 
196 void
198  int n_groups,
199  int n_attributes,
200  const char *group_name[],
201  const int attribute[]);
202 
203 /*----------------------------------------------------------------------------*/
204 
205 #ifdef __cplusplus
206 }
207 #endif /* __cplusplus */
208 
209 #endif /* __FVM_SELECTOR_POSTFIX_H__ */
fvm_selector_postfix_t * fvm_selector_postfix_create(const char *infix, int n_groups, int n_attributes, const char *group_name[], const int attribute[])
Definition: fvm_selector_postfix.c:2776
void fvm_selector_postfix_destroy(fvm_selector_postfix_t **postfix)
Definition: fvm_selector_postfix.c:2812
const char * fvm_selector_postfix_get_infix(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2835
_Bool fvm_selector_postfix_eval(const fvm_selector_postfix_t *pf, int n_groups, int n_attributes, const int group_id[], const int attribute_id[], const double coords[], const double normal[])
Definition: fvm_selector_postfix.c:2939
char * infix
Definition: fvm_selector_postfix.c:263
void fvm_selector_postfix_dump(const fvm_selector_postfix_t *pf, int n_groups, int n_attributes, const char *group_name[], const int attribute[])
Definition: fvm_selector_postfix.c:3177
Definition: fvm_selector_postfix.c:255
_Bool fvm_selector_postfix_normals_dep(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2871
int fvm_selector_postfix_n_missing(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2890
#define _Bool
Definition: cs_defs.h:154
_Bool fvm_selector_postfix_coords_dep(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2853
const char * fvm_selector_postfix_get_missing(const fvm_selector_postfix_t *pf, int id)
Definition: fvm_selector_postfix.c:2910