My Project
programmer's documentation
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-2019 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_postfix_t fvm_selector_postfix_t;
52 
53 /*=============================================================================
54  * Public function prototypes
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------
58  * Create a postfix expression from an infix expression
59  *
60  * parameters:
61  * infix <-- infix expression
62  * n_groups <-- number of groups
63  * n_attributes <-- number of attributes
64  * group_name <-- array group names (sorted)
65  * attribute <-- array of attribute numbers (sorted)
66  *
67  * returns:
68  * pointer to created postfix structure
69  *----------------------------------------------------------------------------*/
70 
72 fvm_selector_postfix_create(const char *infix,
73  int n_groups,
74  int n_attributes,
75  const char *group_name[],
76  const int attribute[]);
77 
78 /*----------------------------------------------------------------------------
79  * Destroy a postfix expression
80  *
81  * parameters:
82  * pf <-> pointer to postfix structure pointer
83  *----------------------------------------------------------------------------*/
84 
85 void
87 
88 /*----------------------------------------------------------------------------
89  * Return a pointer to the infix string associated with a postfix expression
90  *
91  * parameters:
92  * pf <-- pointer to postfix structure
93  *
94  * returns:
95  * pointer to original infix string
96  *----------------------------------------------------------------------------*/
97 
98 const char *
100 
101 /*----------------------------------------------------------------------------
102  * Indicate if a postfix expression depends on coordinates
103  *
104  * parameters:
105  * pf <-- pointer to postfix structure
106  *
107  * returns:
108  * true if expression depends on coordinates, false otherwise
109  *----------------------------------------------------------------------------*/
110 
111 bool
113 
114 /*----------------------------------------------------------------------------
115  * Indicate if a postfix expression depends on normals
116  *
117  * parameters:
118  * pf <-- pointer to postfix structure
119  *
120  * returns:
121  * true if expression depends on normals, false otherwise
122  *----------------------------------------------------------------------------*/
123 
124 bool
126 
127 /*----------------------------------------------------------------------------
128  * Return the number of operands associated with a postfix expression
129  * missing in the associated group class set
130  *
131  * parameters:
132  * pf <-- pointer to postfix structure
133  *
134  * returns:
135  * number of missing operands
136  *----------------------------------------------------------------------------*/
137 
138 int
140 
141 /*----------------------------------------------------------------------------
142  * Return a pointer to the name of an of operand associated with a postfix
143  * expression but missing in the associated group class set
144  *
145  * parameters:
146  * pf <-- pointer to postfix structure
147  * id <-- id of missing operand (0 to fvm_selector_postfix_n_missing())
148  *
149  * returns:
150  * pointer to name of missing operand
151  *----------------------------------------------------------------------------*/
152 
153 const char *
155  int id);
156 
157 /*----------------------------------------------------------------------------
158  * Evaluate a postfix expression
159  *
160  * parameters:
161  * pf <-- pointer to postfix structure
162  * n_groups <-- number of groups associated with group class
163  * n_attributes <-- number of attributes associated with group class
164  * group_id <-- array group ids associated with group class
165  * attribute_id <-- array of attribute ids associated with group class
166  * coords <-- coordinates associated with evaluation, or NULL
167  * normal <-- normal associated with evaluation, or NULL
168  *
169  * returns:
170  * true or false base on expression evaluation
171  *----------------------------------------------------------------------------*/
172 
173 bool
175  int n_groups,
176  int n_attributes,
177  const int group_id[],
178  const int attribute_id[],
179  const double coords[],
180  const double normal[]);
181 
182 /*----------------------------------------------------------------------------
183  * Dump the contents of a postfix structure in human readable form
184  *
185  * parameters:
186  * pf <-> pointer to postfix structure
187  * n_groups <-- number of groups
188  * n_attributes <-- number of attributes
189  * group_name <-- array group names (sorted)
190  * attribute <-- array of attribute numbers (sorted)
191  *----------------------------------------------------------------------------*/
192 
193 void
195  int n_groups,
196  int n_attributes,
197  const char *group_name[],
198  const int attribute[]);
199 
200 /*----------------------------------------------------------------------------*/
201 
203 
204 #endif /* __FVM_SELECTOR_POSTFIX_H__ */
fvm_selector_postfix_normals_dep
bool fvm_selector_postfix_normals_dep(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2866
cs_defs.h
fvm_selector_postfix_create
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:2771
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
fvm_group.h
fvm_selector_postfix_coords_dep
bool fvm_selector_postfix_coords_dep(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2848
fvm_selector_postfix_get_missing
const char * fvm_selector_postfix_get_missing(const fvm_selector_postfix_t *pf, int id)
Definition: fvm_selector_postfix.c:2905
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
fvm_selector_postfix_get_infix
const char * fvm_selector_postfix_get_infix(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2830
fvm_selector_postfix_dump
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:3174
fvm_selector_postfix_t
struct _fvm_selector_postfix_t fvm_selector_postfix_t
Definition: fvm_selector_postfix.h:51
fvm_selector_postfix_eval
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:2934
fvm_selector_postfix_n_missing
int fvm_selector_postfix_n_missing(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.c:2885
fvm_defs.h
coords
void const cs_int_t const cs_real_t const cs_real_t * coords
Definition: cs_measures_util.h:360
fvm_selector_postfix_destroy
void fvm_selector_postfix_destroy(fvm_selector_postfix_t **postfix)
Definition: fvm_selector_postfix.c:2807