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
//! Python wrappers for [`crate::ops::coords`] — the three operators that
//! write back into the coordinates. `in_config` is the method
//! `Coords.in_config`, a context manager.
use cratePyNodeField;
use *;
/// Set the coordinates of the nodes of `field` to its values, in absolute.
///
/// For every node of the field, the coordinate on axis `a` of the active
/// configuration becomes the value of `components[a]`. The `Coords` of the
/// field is changed in place.
///
/// # Parameters
///
/// - `field`: the positions, at the nodes; every node must carry every
/// component.
/// - `components`: one component name per spatial axis, in axis order; `None`
/// → `["X", "Y", "Z"][:dim]`, the components of
/// `pyrucast.node_field.positions`.
///
/// # Raises
///
/// `RuntimeError` if a node of `field` lacks one of `components`, or if
/// `components` does not hold one name per axis.
/// Move the nodes of `field` by its values, an increment: `x += u`.
///
/// The increment is added to the active configuration of the field's
/// `Coords`, in place, each distinct node once. What the field carries is
/// applied, and nothing else: a node carrying none of the components (a
/// multiplier node of a solution) does not move, and a component a node lacks
/// moves it by 0 along that axis.
///
/// # Parameters
///
/// - `field`: the displacement, at the nodes.
/// - `components`: one displacement component per spatial axis, in axis
/// order; `None` → `["u_x", "u_y", "u_z"][:dim]`.
///
/// # Raises
///
/// `RuntimeError` if `components` does not hold one name per axis.
///
/// # See also
///
/// `pyrucast.coords.displace_from`, which lays a configuration at `X + u`
/// without accumulating.
/// Lay configuration `target` at `reference` displaced by `field`: `x = X + u`.
///
/// The position is absolute: called again, it lands at `X + u` again, nothing
/// accumulates. What the field carries is applied, and nothing else: a node it
/// does not define, or that carries none of the components (a multiplier node
/// of a solution), stays at its reference position, and a component a node
/// lacks counts as 0 — the output of `pyrucast.solver.solve` is given as it
/// is. The active configuration is left as it is; `Coords.in_config` computes
/// on `target`.
///
/// # Parameters
///
/// - `field`: the displacement `u`, at the nodes.
/// - `reference`: the index of the configuration holding `X`, left unchanged.
/// - `target`: the index of the configuration to write, another than
/// `reference`; what it held before is replaced.
/// - `components`: one displacement component per spatial axis, in axis
/// order; `None` → `["u_x", "u_y", "u_z"][:dim]`.
///
/// # Raises
///
/// `RuntimeError` if `reference` or `target` is not a configuration of the
/// `Coords`, if `target` is `reference`, if `components` does not hold one name
/// per axis, or if a node would get a negative radius on an axisymmetric
/// `Coords`.