Create a Geometry object. Args: index_map: Index map describing the layout of the geometry points (nodes). dofmap: The geometry (point) dofmap. For a cell, it gives the row in the point coordinates ``x`` of each local geometry node. ``shape=(n
(
index_map: _IndexMap,
dofmap: npt.NDArray[np.int32],
element: _CoordinateElement,
x: np.ndarray,
input_global_indices: npt.NDArray[np.int64],
)
| 1283 | |
| 1284 | |
| 1285 | def create_geometry( |
| 1286 | index_map: _IndexMap, |
| 1287 | dofmap: npt.NDArray[np.int32], |
| 1288 | element: _CoordinateElement, |
| 1289 | x: np.ndarray, |
| 1290 | input_global_indices: npt.NDArray[np.int64], |
| 1291 | ) -> Geometry: |
| 1292 | """Create a Geometry object. |
| 1293 | |
| 1294 | Args: |
| 1295 | index_map: Index map describing the layout of the geometry |
| 1296 | points (nodes). |
| 1297 | dofmap: The geometry (point) dofmap. For a cell, it gives the |
| 1298 | row in the point coordinates ``x`` of each local geometry |
| 1299 | node. ``shape=(num_cells, num_dofs_per_cell)``. |
| 1300 | element: Element that describes the cell geometry map. |
| 1301 | x: The point coordinates. The shape is |
| 1302 | ``(num_points, geometric_dimension).`` |
| 1303 | input_global_indices: The 'global' input index of each point, |
| 1304 | commonly from a mesh input file. |
| 1305 | """ |
| 1306 | if x.dtype == np.float64: |
| 1307 | ftype = _cpp.mesh.Geometry_float64 |
| 1308 | elif x.dtype == np.float32: |
| 1309 | ftype = _cpp.mesh.Geometry_float32 |
| 1310 | else: |
| 1311 | raise ValueError("Unknown floating type for geometry, got: {x.dtype}") |
| 1312 | |
| 1313 | if (dtype := np.dtype(element.dtype)) != x.dtype: |
| 1314 | raise ValueError(f"Mismatch in x dtype ({x.dtype}) and coordinate element ({dtype})") |
| 1315 | return Geometry(ftype(index_map, dofmap, element._cpp_object, x, input_global_indices)) |
| 1316 | |
| 1317 | |
| 1318 | def transfer_meshtags_to_submesh( |