1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
//! Méthodes de délégation — la face « sujet » des opérateurs de ce module.
//!
//! Une fonction libre qui remplit les trois conditions de `CONVENTIONS.md`
//! (§ « Le verbe exposé aussi en méthode ») est **aussi** exposée comme
//! méthode de son sujet, pour permettre le chaînage. Ces méthodes ne
//! contiennent **aucune** logique : elles appellent la fonction libre,
//! receveur compris. La fonction libre reste la forme canonique et porte la
//! documentation.
//!
//! Les `impl` vivent ici plutôt que dans `containers/` : un conteneur ne doit
//! pas dépendre d'un opérateur, et Rust autorise un `impl` inhérent dans
//! n'importe quel module de la crate de définition.
use crate::atoms::Band;
use crate::atoms::ElementType;
use crate::containers::element_field::{ElementField, SubElementField};
use crate::containers::mesh::Mesh;
use crate::containers::node_field::{NodeField, SubNodeField};
use crate::error::Result;
impl Mesh {
/// Voir [`mesh::barycenter`](fn@crate::ops::mesh::barycenter).
pub fn barycenter(&self) -> Result<Mesh> {
crate::ops::mesh::barycenter(self)
}
/// Voir [`mesh::border`](fn@crate::ops::mesh::border).
pub fn border(&self, angle_deg: Option<f64>) -> Result<Mesh> {
crate::ops::mesh::border(self, angle_deg)
}
/// Voir [`mesh::chain`](fn@crate::ops::mesh::chain).
pub fn chain(&self) -> Result<Mesh> {
crate::ops::mesh::chain(self)
}
/// Voir [`mesh::consolidate`](fn@crate::ops::mesh::consolidate).
pub fn consolidate(&self) -> Result<Mesh> {
crate::ops::mesh::consolidate(self)
}
/// Voir [`mesh::convert`](fn@crate::ops::mesh::convert).
pub fn convert(&self, target: ElementType) -> Result<Mesh> {
crate::ops::mesh::convert(self, target)
}
/// Voir [`mesh::elements_on`](fn@crate::ops::mesh::elements_on).
pub fn elements_on(&self, points: &Mesh, strict: bool) -> Result<Mesh> {
crate::ops::mesh::elements_on(self, points, strict)
}
/// Voir [`mesh::extrude`](fn@crate::ops::mesh::extrude).
pub fn extrude(&self, direction: &[f64], n_layers: usize) -> Result<Mesh> {
crate::ops::mesh::extrude(self, direction, n_layers)
}
/// Voir [`mesh::invert`](fn@crate::ops::mesh::invert).
pub fn invert(&self) -> Result<Mesh> {
crate::ops::mesh::invert(self)
}
/// Voir [`mesh::merge_nodes`](fn@crate::ops::mesh::merge_nodes).
pub fn merge_nodes(&self, tol: f64, in_place: bool) -> Result<Mesh> {
crate::ops::mesh::merge_nodes(self, tol, in_place)
}
/// Voir [`mesh::orient`](fn@crate::ops::mesh::orient).
pub fn orient(&self) -> Result<Mesh> {
crate::ops::mesh::orient(self)
}
/// Voir [`mesh::pave_surface`](fn@crate::ops::mesh::pave_surface).
pub fn pave_surface(
&self,
element_type: ElementType,
target_size: Option<f64>,
all_quad: bool,
) -> Result<Mesh> {
crate::ops::mesh::pave_surface(self, element_type, target_size, all_quad)
}
/// Voir [`mesh::pave_volume`](fn@crate::ops::mesh::pave_volume).
pub fn pave_volume(
&self,
layers: usize,
thickness: Option<f64>,
core_size: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::pave_volume(self, layers, thickness, core_size)
}
/// Voir [`mesh::points_below_plane`](fn@crate::ops::mesh::points_below_plane).
pub fn points_below_plane(
&self,
origin: &[f64],
normal: &[f64],
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_below_plane(self, origin, normal, tol)
}
/// Voir [`mesh::points_in_cone`](fn@crate::ops::mesh::points_in_cone).
pub fn points_in_cone(
&self,
base: &[f64],
top: &[f64],
base_radius: f64,
top_radius: f64,
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_in_cone(self, base, top, base_radius, top_radius, tol)
}
/// Voir [`mesh::points_in_cylinder`](fn@crate::ops::mesh::points_in_cylinder).
pub fn points_in_cylinder(
&self,
base: &[f64],
top: &[f64],
radius: f64,
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_in_cylinder(self, base, top, radius, tol)
}
/// Voir [`mesh::points_in_sphere`](fn@crate::ops::mesh::points_in_sphere).
pub fn points_in_sphere(&self, center: &[f64], radius: f64, tol: Option<f64>) -> Result<Mesh> {
crate::ops::mesh::points_in_sphere(self, center, radius, tol)
}
/// Voir [`mesh::points_in_torus`](fn@crate::ops::mesh::points_in_torus).
pub fn points_in_torus(
&self,
center: &[f64],
axis: &[f64],
major_radius: f64,
minor_radius: f64,
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_in_torus(self, center, axis, major_radius, minor_radius, tol)
}
/// Voir [`mesh::points_on_cone`](fn@crate::ops::mesh::points_on_cone).
pub fn points_on_cone(
&self,
base: &[f64],
top: &[f64],
base_radius: f64,
top_radius: f64,
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_on_cone(self, base, top, base_radius, top_radius, tol)
}
/// Voir [`mesh::points_on_cylinder`](fn@crate::ops::mesh::points_on_cylinder).
pub fn points_on_cylinder(
&self,
base: &[f64],
top: &[f64],
radius: f64,
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_on_cylinder(self, base, top, radius, tol)
}
/// Voir [`mesh::points_on_line`](fn@crate::ops::mesh::points_on_line).
pub fn points_on_line(&self, a: &[f64], b: &[f64], tol: Option<f64>) -> Result<Mesh> {
crate::ops::mesh::points_on_line(self, a, b, tol)
}
/// Voir [`mesh::points_on_plane`](fn@crate::ops::mesh::points_on_plane).
pub fn points_on_plane(
&self,
origin: &[f64],
normal: &[f64],
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_on_plane(self, origin, normal, tol)
}
/// Voir [`mesh::points_on_sphere`](fn@crate::ops::mesh::points_on_sphere).
pub fn points_on_sphere(&self, center: &[f64], radius: f64, tol: Option<f64>) -> Result<Mesh> {
crate::ops::mesh::points_on_sphere(self, center, radius, tol)
}
/// Voir [`mesh::points_on_torus`](fn@crate::ops::mesh::points_on_torus).
pub fn points_on_torus(
&self,
center: &[f64],
axis: &[f64],
major_radius: f64,
minor_radius: f64,
tol: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::points_on_torus(self, center, axis, major_radius, minor_radius, tol)
}
/// Voir [`mesh::revolve`](fn@crate::ops::mesh::revolve).
pub fn revolve(
&self,
angle: f64,
n_layers: usize,
center: &[f64],
axis: Option<&[f64]>,
) -> Result<Mesh> {
crate::ops::mesh::revolve(self, angle, n_layers, center, axis)
}
/// Voir [`mesh::rotate`](fn@crate::ops::mesh::rotate).
pub fn rotate(&self, angle: f64, center: &[f64], axis: Option<&[f64]>) -> Result<Mesh> {
crate::ops::mesh::rotate(self, angle, center, axis)
}
/// Voir [`mesh::skin`](fn@crate::ops::mesh::skin).
pub fn skin(&self, angle_deg: Option<f64>) -> Result<Mesh> {
crate::ops::mesh::skin(self, angle_deg)
}
/// Voir [`mesh::sweep`](fn@crate::ops::mesh::sweep).
pub fn sweep(&self, mesh_b: &Mesh, n_layers: usize, element_type: ElementType) -> Result<Mesh> {
crate::ops::mesh::sweep(self, mesh_b, n_layers, element_type)
}
/// Voir [`mesh::sweep_solid`](fn@crate::ops::mesh::sweep_solid).
pub fn sweep_solid(&self, mesh_b: &Mesh, n_layers: usize) -> Result<Mesh> {
crate::ops::mesh::sweep_solid(self, mesh_b, n_layers)
}
/// Voir [`mesh::symmetry_line`](fn@crate::ops::mesh::symmetry_line).
pub fn symmetry_line(&self, a: &[f64], b: &[f64]) -> Result<Mesh> {
crate::ops::mesh::symmetry_line(self, a, b)
}
/// Voir [`mesh::symmetry_plane`](fn@crate::ops::mesh::symmetry_plane).
pub fn symmetry_plane(&self, a: &[f64], b: &[f64], c: &[f64]) -> Result<Mesh> {
crate::ops::mesh::symmetry_plane(self, a, b, c)
}
/// Voir [`mesh::symmetry_point`](fn@crate::ops::mesh::symmetry_point).
pub fn symmetry_point(&self, center: &[f64]) -> Result<Mesh> {
crate::ops::mesh::symmetry_point(self, center)
}
/// Voir [`mesh::to_poi1`](fn@crate::ops::mesh::to_poi1).
pub fn to_poi1(&self) -> Result<Mesh> {
crate::ops::mesh::to_poi1(self)
}
/// Voir [`mesh::to_quadratic`](fn@crate::ops::mesh::to_quadratic).
pub fn to_quadratic(&self) -> Result<Mesh> {
crate::ops::mesh::to_quadratic(self)
}
/// Voir [`mesh::transfinite`](fn@crate::ops::mesh::transfinite).
pub fn transfinite(
&self,
side2: &Mesh,
side3: &Mesh,
side4: &Mesh,
element_type: ElementType,
) -> Result<Mesh> {
crate::ops::mesh::transfinite(self, side2, side3, side4, element_type)
}
/// Voir [`mesh::translate`](fn@crate::ops::mesh::translate).
pub fn translate(&self, vector: &[f64]) -> Result<Mesh> {
crate::ops::mesh::translate(self, vector)
}
/// Voir [`mesh::triangulate_surface`](fn@crate::ops::mesh::triangulate_surface).
pub fn triangulate_surface(
&self,
element_type: ElementType,
target_size: Option<f64>,
) -> Result<Mesh> {
crate::ops::mesh::triangulate_surface(self, element_type, target_size)
}
/// Voir [`mesh::triangulate_volume`](fn@crate::ops::mesh::triangulate_volume).
pub fn triangulate_volume(
&self,
target_size: Option<f64>,
allow_surface_nodes: bool,
) -> Result<Mesh> {
crate::ops::mesh::triangulate_volume(self, target_size, allow_surface_nodes)
}
}
// `select` part d'un champ mais rend un `Mesh` : la fonction libre vit donc
// dans `ops::mesh`, et l'`impl` la suit. Le nom perd son qualificatif — le
// type du sujet dit déjà s'il s'agit de nœuds ou de mailles.
impl NodeField {
/// Voir [`mesh::select_nodes`](fn@crate::ops::mesh::select_nodes).
pub fn select(&self, band: &Band, components: Option<Vec<String>>) -> Result<Mesh> {
crate::ops::mesh::select_nodes(self, band, components)
}
}
impl ElementField {
/// Voir [`mesh::select_cells`](fn@crate::ops::mesh::select_cells).
pub fn select(&self, band: &Band, components: Option<Vec<String>>) -> Result<Mesh> {
crate::ops::mesh::select_cells(self, band, components)
}
}
impl SubNodeField {
/// Voir [`mesh::select_sub_nodes`](fn@crate::ops::mesh::select_sub_nodes).
pub fn select(&self, band: &Band, components: Option<Vec<String>>) -> Result<Mesh> {
crate::ops::mesh::select_sub_nodes(self, band, components)
}
}
impl SubElementField {
/// Voir [`mesh::select_sub_cells`](fn@crate::ops::mesh::select_sub_cells).
pub fn select(&self, band: &Band, components: Option<Vec<String>>) -> Result<Mesh> {
crate::ops::mesh::select_sub_cells(self, band, components)
}
}