The geometry of a :class:`dolfinx.mesh.Mesh`.
| 274 | |
| 275 | |
| 276 | class Geometry(typing.Generic[Real]): |
| 277 | """The geometry of a :class:`dolfinx.mesh.Mesh`.""" |
| 278 | |
| 279 | _cpp_object: _cpp.mesh.Geometry_float32 | _cpp.mesh.Geometry_float64 |
| 280 | |
| 281 | def __init__(self, geometry: _cpp.mesh.Geometry_float32 | _cpp.mesh.Geometry_float64): |
| 282 | """Initialize a geometry from a C++ geometry. |
| 283 | |
| 284 | Args: |
| 285 | geometry: The C++ geometry object. |
| 286 | |
| 287 | Note: |
| 288 | Geometry objects should usually be constructed with the |
| 289 | :func:`create_geometry` and not using this class |
| 290 | initializer. This class is combined with different base |
| 291 | classes that depend on the scalar type used in the Geometry. |
| 292 | """ |
| 293 | self._cpp_object = geometry |
| 294 | |
| 295 | @property |
| 296 | def cmaps(self) -> list[_CoordinateElement]: |
| 297 | """The coordinate maps.""" |
| 298 | return [_CoordinateElement(cm) for cm in self._cpp_object.cmaps] |
| 299 | |
| 300 | @property |
| 301 | def cmap(self) -> _CoordinateElement: |
| 302 | """The coordinate map (deprecated, use ``cmaps[0]``).""" |
| 303 | warnings.warn( |
| 304 | "cmap is deprecated. Use cmaps[0] instead.", |
| 305 | DeprecationWarning, |
| 306 | stacklevel=2, |
| 307 | ) |
| 308 | return self.cmaps[0] |
| 309 | |
| 310 | @property |
| 311 | def dim(self): |
| 312 | """Dimension of the Euclidean coordinate system.""" |
| 313 | return self._cpp_object.dim |
| 314 | |
| 315 | @property |
| 316 | def dofmaps(self) -> list[npt.NDArray[np.int32]]: |
| 317 | """The geometry dofmaps, one per cell type.""" |
| 318 | return self._cpp_object.dofmaps |
| 319 | |
| 320 | @property |
| 321 | def dofmap(self) -> npt.NDArray[np.int32]: |
| 322 | """Dofmap for the geometry (deprecated, use ``dofmaps[0]``). |
| 323 | |
| 324 | Shape is ``(num_cells, dofs_per_cell)``. |
| 325 | """ |
| 326 | warnings.warn( |
| 327 | "dofmap is deprecated. Use dofmaps[0] instead.", |
| 328 | DeprecationWarning, |
| 329 | stacklevel=2, |
| 330 | ) |
| 331 | return self._cpp_object.dofmaps[0] |
| 332 | |
| 333 | def index_map(self) -> _IndexMap: |
no outgoing calls
no test coverage detected