|
21 | 21 | """ |
22 | 22 |
|
23 | 23 | from functools import reduce |
24 | | -from numbers import Real |
25 | 24 | from typing import Optional, Union, Any, Tuple, Dict, List, Set, Sequence |
26 | 25 |
|
27 | 26 | from dataclasses import dataclass |
@@ -151,9 +150,10 @@ def _filter_mesh_groups( |
151 | 150 | # {{{ filter vertex indices |
152 | 151 |
|
153 | 152 | filtered_vertex_indices = [ |
154 | | - mesh.groups[igrp].vertex_indices[ |
| 153 | + grp.vertex_indices[ |
155 | 154 | filtered_group_elements[igrp], :] |
156 | | - for igrp in range(len(mesh.groups))] |
| 155 | + for igrp, grp in enumerate(mesh.groups) |
| 156 | + if grp.vertex_indices is not None] |
157 | 157 |
|
158 | 158 | filtered_vertex_indices_flat = np.concatenate([indices.ravel() for indices |
159 | 159 | in filtered_vertex_indices]) |
@@ -1322,14 +1322,14 @@ def map_mesh(mesh, f): # noqa |
1322 | 1322 | # {{{ affine map |
1323 | 1323 |
|
1324 | 1324 | def affine_map(mesh, |
1325 | | - A: Optional[Union[Real, np.ndarray]] = None, # noqa: N803 |
1326 | | - b: Optional[Union[Real, np.ndarray]] = None): |
| 1325 | + A: Optional[Union[np.generic, np.ndarray]] = None, # noqa: N803 |
| 1326 | + b: Optional[Union[np.generic, np.ndarray]] = None): |
1327 | 1327 | """Apply the affine map :math:`f(x) = A x + b` to the geometry of *mesh*.""" |
1328 | 1328 |
|
1329 | | - if isinstance(A, Real): |
| 1329 | + if np.isscalar(A): |
1330 | 1330 | A = np.diag([A] * mesh.ambient_dim) # noqa: N806 |
1331 | 1331 |
|
1332 | | - if isinstance(b, Real): |
| 1332 | + if np.isscalar(b): |
1333 | 1333 | b = np.array([b] * mesh.ambient_dim) |
1334 | 1334 |
|
1335 | 1335 | if A is None and b is None: |
@@ -1432,7 +1432,7 @@ def _get_rotation_matrix_from_angle_and_axis(theta, axis): |
1432 | 1432 |
|
1433 | 1433 |
|
1434 | 1434 | def rotate_mesh_around_axis(mesh, *, |
1435 | | - theta: Real, |
| 1435 | + theta: np.generic, |
1436 | 1436 | axis: Optional[np.ndarray] = None): |
1437 | 1437 | """Rotate the mesh by *theta* radians around the axis *axis*. |
1438 | 1438 |
|
|
0 commit comments