9.2
general 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-2026 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 "base/cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Local headers
34 *----------------------------------------------------------------------------*/
35
36#include "fvm/fvm_defs.h"
37#include "fvm/fvm_group.h"
38
39/*=============================================================================
40 * Macro definitions
41 *============================================================================*/
42
43/*============================================================================
44 * Type definitions
45 *============================================================================*/
46
47typedef struct _fvm_selector_postfix_t fvm_selector_postfix_t;
48
49/*=============================================================================
50 * Public function prototypes
51 *============================================================================*/
52
53/*----------------------------------------------------------------------------
54 * Create a postfix expression from an infix expression
55 *
56 * parameters:
57 * infix <-- infix expression
58 * n_groups <-- number of groups
59 * n_attributes <-- number of attributes
60 * group_name <-- array group names (sorted)
61 * attribute <-- array of attribute numbers (sorted)
62 *
63 * returns:
64 * pointer to created postfix structure
65 *----------------------------------------------------------------------------*/
66
68fvm_selector_postfix_create(const char *infix,
69 int n_groups,
70 int n_attributes,
71 const char *group_name[],
72 const int attribute[]);
73
74/*----------------------------------------------------------------------------
75 * Destroy a postfix expression
76 *
77 * parameters:
78 * pf <-> pointer to postfix structure pointer
79 *----------------------------------------------------------------------------*/
80
81void
83
84/*----------------------------------------------------------------------------
85 * Return a pointer to the infix string associated with a postfix expression
86 *
87 * parameters:
88 * pf <-- pointer to postfix structure
89 *
90 * returns:
91 * pointer to original infix string
92 *----------------------------------------------------------------------------*/
93
94const char *
96
97/*----------------------------------------------------------------------------
98 * Indicate if a postfix expression depends on coordinates
99 *
100 * parameters:
101 * pf <-- pointer to postfix structure
102 *
103 * returns:
104 * true if expression depends on coordinates, false otherwise
105 *----------------------------------------------------------------------------*/
106
107bool
109
110/*----------------------------------------------------------------------------
111 * Indicate if a postfix expression depends on normals
112 *
113 * parameters:
114 * pf <-- pointer to postfix structure
115 *
116 * returns:
117 * true if expression depends on normals, false otherwise
118 *----------------------------------------------------------------------------*/
119
120bool
122
123/*----------------------------------------------------------------------------
124 * Return the number of operands associated with a postfix expression
125 * missing in the associated group class set
126 *
127 * parameters:
128 * pf <-- pointer to postfix structure
129 *
130 * returns:
131 * number of missing operands
132 *----------------------------------------------------------------------------*/
133
134int
136
137/*----------------------------------------------------------------------------
138 * Return a pointer to the name of an of operand associated with a postfix
139 * expression but missing in the associated group class set
140 *
141 * parameters:
142 * pf <-- pointer to postfix structure
143 * id <-- id of missing operand (0 to fvm_selector_postfix_n_missing())
144 *
145 * returns:
146 * pointer to name of missing operand
147 *----------------------------------------------------------------------------*/
148
149const char *
151 int id);
152
153/*----------------------------------------------------------------------------
154 * Evaluate a postfix expression
155 *
156 * parameters:
157 * pf <-- pointer to postfix structure
158 * n_groups <-- number of groups associated with group class
159 * n_attributes <-- number of attributes associated with group class
160 * group_name <-- array of group names (ordered)
161 * group_id <-- array group ids associated with group class
162 * attribute_id <-- array of attribute ids associated with group class
163 * coords <-- coordinates associated with evaluation, or null
164 * u_normal <-- unit normal associated with evaluation, or null
165 *
166 * returns:
167 * true or false base on expression evaluation
168 *----------------------------------------------------------------------------*/
169
170bool
172 int n_groups,
173 int n_attributes,
174 const char *group_name[],
175 const int group_id[],
176 const int attribute_id[],
177 const cs_real_t coords[],
178 const cs_nreal_t u_normal[]);
179
180/*----------------------------------------------------------------------------
181 * Dump the contents of a postfix structure in human readable form
182 *
183 * parameters:
184 * pf <-> pointer to postfix structure
185 * n_groups <-- number of groups
186 * n_attributes <-- number of attributes
187 * group_name <-- array group names (sorted)
188 * attribute <-- array of attribute numbers (sorted)
189 *----------------------------------------------------------------------------*/
190
191void
193 int n_groups,
194 int n_attributes,
195 const char *group_name[],
196 const int attribute[]);
197
198/*----------------------------------------------------------------------------*/
199
200#endif /* FVM_SELECTOR_POSTFIX_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
double cs_nreal_t
Definition: cs_defs.h:336
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.cpp:2934
void fvm_selector_postfix_destroy(fvm_selector_postfix_t **postfix)
Definition: fvm_selector_postfix.cpp:2970
const char * fvm_selector_postfix_get_infix(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.cpp:2993
const char * fvm_selector_postfix_get_missing(const fvm_selector_postfix_t *pf, int id)
Definition: fvm_selector_postfix.cpp:3068
int fvm_selector_postfix_n_missing(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.cpp:3048
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.cpp:3357
bool fvm_selector_postfix_eval(const fvm_selector_postfix_t *pf, int n_groups, int n_attributes, const char *group_name[], const int group_id[], const int attribute_id[], const cs_real_t coords[], const cs_nreal_t u_normal[])
Definition: fvm_selector_postfix.cpp:3098
struct _fvm_selector_postfix_t fvm_selector_postfix_t
Definition: fvm_selector_postfix.h:47
bool fvm_selector_postfix_normals_dep(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.cpp:3029
bool fvm_selector_postfix_coords_dep(const fvm_selector_postfix_t *pf)
Definition: fvm_selector_postfix.cpp:3011