_slope module¶
Slope class for pyrockfall¶
This module defines the Slope class, which represents a slope geometry
for rockfall simulation. A slope is defined by:
Nodes: coordinates of the geometry (mandatory).
Elements: connectivity between nodes (optional; if omitted, sequential connectivity is assumed).
Materials: material assignment to elements, with optional support for material tables and IDs.
The class supports stochastic perturbation of nodes, material assignment, combination of contiguous slopes, and efficient queries.
- class pyrockfall._slope.Slope(geometry: Geometry, materials: Material | Sequence[Material], materialIDs: Sequence[int] | NDArray[integer] | None = None)[source]¶
Bases:
objectRepresents a slope geometry for rockfall simulations.
- Parameters:
nodes (np.ndarray of shape (N, D)) – Node coordinates, where N is the number of nodes and D is the number of dimensions (2 or 3). Internally stored transposed as shape (D, N) for efficient vectorised operations.
materials (Union[Material, List[Material], np.ndarray]) – Material assignment. Can be: - A single
Material(applied to all elements). - A list/array of length E (oneMaterialper element). - A list of unique materials (materialTable) if materialIDs is also provided.elements (Optional[np.ndarray of shape (E, M)], default=None) – Connectivity array. If not provided, defaults to sequential pairs [[0, 1], [1, 2], …, [E, E+1]] with E = len(materials).
materialIDs (Optional[np.ndarray of shape (E,)], default=None) – Integer material IDs mapping each element to an entry in materials (interpreted as the material table). If provided, materials must be the material table. If omitted, materials is interpreted directly as per-element materials.
- elements¶
Element connectivity array.
- Type:
np.ndarray of shape (E, M)
- materialIDs¶
Integer material IDs mapping each element to an entry in materialTable.
- Type:
np.ndarray of shape (E,)