Skip to content

add cpp stub files#4096

Open
qbisi wants to merge 2 commits intoFEniCS:mainfrom
qbisi:cpp_stub
Open

add cpp stub files#4096
qbisi wants to merge 2 commits intoFEniCS:mainfrom
qbisi:cpp_stub

Conversation

@qbisi
Copy link
Contributor

@qbisi qbisi commented Feb 18, 2026

Hi, this patch generate stub files for dolfinx.cpp module using nanobind's builtin nanobind_add_stub macro.
An extra marker file py.typed will be generated under site-packages/dolfinx/cpp/py.typed. Not sure if this is needed as we have a top-level one in site-packages/dolfinx/py.typed.

@schnellerhase schnellerhase added type-hints python Pull requests that update Python code labels Feb 18, 2026
@schnellerhase
Copy link
Contributor

Nice! Fixes #3238.

Not sure if this is needed as we have a top-level one in site-packages/dolfinx/py.typed.

No need, top-level will override anyways.

@jhale
Copy link
Member

jhale commented Feb 18, 2026

Thanks for doing this!

We should sanity check the output particularly for NDArrays in/out - wjakob/nanobind#1155

@schnellerhase
Copy link
Contributor

schnellerhase commented Feb 18, 2026

Output looks good to me, for example mesh.pyi:

Details
"""Mesh library module"""

from collections.abc import Callable, Sequence
import enum
from typing import Annotated, overload

import numpy
from numpy.typing import NDArray

import dolfinx.cpp.common
import dolfinx.cpp.fem
import dolfinx.cpp.graph


class CellType(enum.Enum):
    point = 1

    interval = 2

    triangle = 3

    quadrilateral = -4

    tetrahedron = 4

    pyramid = -5

    prism = -6

    hexahedron = -8

    @property
    def name(self) -> object: ...

def to_type(cell: str) -> CellType: ...

def to_string(type: CellType) -> str: ...

def is_simplex(type: CellType) -> bool: ...

def cell_entity_type(type: CellType, dim: int, index: int) -> CellType: ...

def cell_dim(type: CellType) -> int: ...

def cell_num_entities(type: CellType, dim: int) -> int: ...

def cell_num_vertices(type: CellType) -> int: ...

def get_entity_vertices(type: CellType, dim: int) -> dolfinx.cpp.graph.AdjacencyList_int32: ...

def extract_topology(cell_type: CellType, layout: dolfinx.cpp.fem.ElementDofLayout, cells: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)]) -> NDArray[numpy.int64]: ...

@overload
def build_dual_graph(comm: MPICommWrapper, cell_type: CellType, cells: dolfinx.cpp.graph.AdjacencyList_int64, max_facet_to_cell_links: int | None) -> dolfinx.cpp.graph.AdjacencyList_int64:
    """Build dual graph for cells"""

@overload
def build_dual_graph(comm: MPICommWrapper, cell_types: Sequence[CellType], cells: Sequence[Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)]], max_facet_to_cell_links: int | None) -> dolfinx.cpp.graph.AdjacencyList_int64: ...

class GhostMode(enum.Enum):
    none = 0

    shared_facet = 1

def compute_entities(topology: Topology, dim: int, entity_type: CellType, num_threads: int = 1) -> tuple[list[dolfinx.cpp.graph.AdjacencyList_int32], dolfinx.cpp.graph.AdjacencyList_int32, dolfinx.cpp.common.IndexMap, list[int]]: ...

def compute_connectivity(topology: Topology, d0: Sequence[int], d1: Sequence[int]) -> list[dolfinx.cpp.graph.AdjacencyList_int32]: ...

class EntityMap:
    """EntityMap object"""

    def __init__(self, topology: Topology, sub_topology: Topology, dim: int, sub_topology_to_topology: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> None: ...

    def sub_topology_to_topology(self, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], inverse: bool) -> NDArray[numpy.int32]: ...

    @property
    def dim(self) -> int: ...

    @property
    def topology(self) -> Topology: ...

    @property
    def sub_topology(self) -> Topology: ...

class Topology:
    """Topology object"""

    def __init__(self, cell_type: CellType, vertex_map: dolfinx.cpp.common.IndexMap, cell_map: dolfinx.cpp.common.IndexMap, cells: dolfinx.cpp.graph.AdjacencyList_int32, original_index: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)] | None) -> None: ...

    def create_entities(self, dim: int, num_threads: int = 1) -> bool: ...

    def create_entity_permutations(self) -> None: ...

    def create_connectivity(self, d0: int, d1: int) -> None: ...

    def get_facet_permutations(self) -> Annotated[NDArray[numpy.uint8], dict(writable=False)]: ...

    def get_cell_permutation_info(self) -> Annotated[NDArray[numpy.uint32], dict(writable=False)]: ...

    @property
    def dim(self) -> int:
        """Topological dimension"""

    @property
    def original_cell_index(self) -> Annotated[NDArray[numpy.int64], dict(writable=False)]: ...

    @original_cell_index.setter
    def original_cell_index(self, original_cell_indices: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)]) -> None: ...

    @property
    def original_cell_indices(self) -> list[Annotated[NDArray[numpy.int64], dict(writable=False)]]: ...

    @overload
    def connectivity(self, d0: int, d1: int) -> dolfinx.cpp.graph.AdjacencyList_int32: ...

    @overload
    def connectivity(self, d0: Sequence[int], d1: Sequence[int]) -> dolfinx.cpp.graph.AdjacencyList_int32: ...

    def index_map(self, dim: int) -> dolfinx.cpp.common.IndexMap: ...

    def index_maps(self, dim: int) -> list[dolfinx.cpp.common.IndexMap]: ...

    @property
    def cell_type(self) -> CellType: ...

    @property
    def cell_types(self) -> list[CellType]: ...

    @property
    def entity_types(self) -> list[list[CellType]]: ...

    def interprocess_facets(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    @property
    def comm(self) -> MPICommWrapper: ...

def create_topology(arg0: MPICommWrapper, arg1: Sequence[CellType], arg2: Sequence[Sequence[int]], arg3: Sequence[Sequence[int]], arg4: Sequence[Sequence[int]], arg5: Sequence[int], /) -> Topology:
    """Create a Topology object."""

def compute_mixed_cell_pairs(arg0: Topology, arg1: CellType, /) -> list[list[int]]: ...

class MeshTags_int8:
    """MeshTags object"""

    def __init__(self, arg0: Topology, arg1: int, arg2: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], arg3: Annotated[NDArray[numpy.int8], dict(shape=(None,), order='C', writable=False)], /) -> None: ...

    @property
    def dtype(self) -> str: ...

    @property
    def name(self) -> str: ...

    @name.setter
    def name(self, arg: str, /) -> None: ...

    @property
    def dim(self) -> int: ...

    @property
    def topology(self) -> Topology: ...

    @property
    def values(self) -> Annotated[NDArray[numpy.int8], dict(writable=False)]: ...

    @property
    def indices(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    def find(self, arg: int, /) -> NDArray[numpy.int32]: ...

@overload
def create_meshtags(arg0: Topology, arg1: int, arg2: dolfinx.cpp.graph.AdjacencyList_int32, arg3: Annotated[NDArray[numpy.int8], dict(shape=(None,), order='C', writable=False)], /) -> MeshTags_int8: ...

@overload
def create_meshtags(arg0: Topology, arg1: int, arg2: dolfinx.cpp.graph.AdjacencyList_int32, arg3: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], /) -> MeshTags_int32: ...

@overload
def create_meshtags(arg0: Topology, arg1: int, arg2: dolfinx.cpp.graph.AdjacencyList_int32, arg3: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)], /) -> MeshTags_int64: ...

@overload
def create_meshtags(arg0: Topology, arg1: int, arg2: dolfinx.cpp.graph.AdjacencyList_int32, arg3: Annotated[NDArray[numpy.float64], dict(shape=(None,), order='C', writable=False)], /) -> MeshTags_float64: ...

class MeshTags_int32:
    """MeshTags object"""

    def __init__(self, arg0: Topology, arg1: int, arg2: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], arg3: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], /) -> None: ...

    @property
    def dtype(self) -> str: ...

    @property
    def name(self) -> str: ...

    @name.setter
    def name(self, arg: str, /) -> None: ...

    @property
    def dim(self) -> int: ...

    @property
    def topology(self) -> Topology: ...

    @property
    def values(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    @property
    def indices(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    def find(self, arg: int, /) -> NDArray[numpy.int32]: ...

class MeshTags_int64:
    """MeshTags object"""

    def __init__(self, arg0: Topology, arg1: int, arg2: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], arg3: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)], /) -> None: ...

    @property
    def dtype(self) -> str: ...

    @property
    def name(self) -> str: ...

    @name.setter
    def name(self, arg: str, /) -> None: ...

    @property
    def dim(self) -> int: ...

    @property
    def topology(self) -> Topology: ...

    @property
    def values(self) -> Annotated[NDArray[numpy.int64], dict(writable=False)]: ...

    @property
    def indices(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    def find(self, arg: int, /) -> NDArray[numpy.int32]: ...

class MeshTags_float64:
    """MeshTags object"""

    def __init__(self, arg0: Topology, arg1: int, arg2: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], arg3: Annotated[NDArray[numpy.float64], dict(shape=(None,), order='C', writable=False)], /) -> None: ...

    @property
    def dtype(self) -> str: ...

    @property
    def name(self) -> str: ...

    @name.setter
    def name(self, arg: str, /) -> None: ...

    @property
    def dim(self) -> int: ...

    @property
    def topology(self) -> Topology: ...

    @property
    def values(self) -> Annotated[NDArray[numpy.float64], dict(writable=False)]: ...

    @property
    def indices(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    def find(self, arg: float, /) -> NDArray[numpy.int32]: ...

class Geometry_float32:
    """Geometry object"""

    def __init__(self, index_map: dolfinx.cpp.common.IndexMap, dofmap: Annotated[NDArray[numpy.int32], dict(shape=(None, None), order='C', writable=False)], element: dolfinx.cpp.fem.CoordinateElement_float32, x: Annotated[NDArray[numpy.float32], dict(shape=(None, None), writable=False)], input_global_indices: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)]) -> None: ...

    @property
    def dim(self) -> int:
        """Geometric dimension"""

    @property
    def dofmap(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    def dofmaps(self, i: int) -> Annotated[NDArray[numpy.int32], dict(writable=False)]:
        """
        Get the geometry dofmap associated with coordinate element i (mixed topology)
        """

    def index_map(self) -> dolfinx.cpp.common.IndexMap: ...

    @property
    def x(self) -> Annotated[NDArray[numpy.float32], dict(shape=(None, 3))]:
        """
        Return coordinates of all geometry points. Each row is the coordinate of a point.
        """

    @property
    def cmap(self) -> dolfinx.cpp.fem.CoordinateElement_float32:
        """The coordinate map"""

    def cmaps(self, arg: int, /) -> dolfinx.cpp.fem.CoordinateElement_float32:
        """The ith coordinate map"""

    @property
    def input_global_indices(self) -> Annotated[NDArray[numpy.int64], dict(writable=False)]: ...

class Mesh_float32:
    """Mesh object"""

    def __init__(self, comm: MPICommWrapper, topology: Topology, geometry: Geometry_float32) -> None: ...

    @property
    def geometry(self) -> Geometry_float32:
        """Mesh geometry"""

    @property
    def topology(self) -> Topology:
        """Mesh topology"""

    @property
    def comm(self) -> MPICommWrapper: ...

    @property
    def name(self) -> str: ...

    @name.setter
    def name(self, arg: str, /) -> None: ...

def create_interval_float32(comm: MPICommWrapper, n: int, p: Sequence[float], ghost_mode: GhostMode, partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None) -> Mesh_float32: ...

def create_rectangle_float32(comm: MPICommWrapper, p: Sequence[Sequence[float]], n: Sequence[int], celltype: CellType, partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None, diagonal: DiagonalType) -> Mesh_float32: ...

def create_box_float32(comm: MPICommWrapper, p: Sequence[Sequence[float]], n: Sequence[int], celltype: CellType, partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None) -> Mesh_float32: ...

@overload
def create_mesh(arg0: MPICommWrapper, arg1: Sequence[Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)]], arg2: Sequence[dolfinx.cpp.fem.CoordinateElement_float32], arg3: Annotated[NDArray[numpy.float32], dict(order='C', writable=False)], arg4: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32], arg5: int | None) -> Mesh_float32: ...

@overload
def create_mesh(comm: MPICommWrapper, cells: Annotated[NDArray[numpy.int64], dict(shape=(None, None), order='C', writable=False)], element: dolfinx.cpp.fem.CoordinateElement_float32, x: Annotated[NDArray[numpy.float32], dict(order='C', writable=False)], partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None, max_facet_to_cell_links: int | None) -> Mesh_float32:
    """Helper function for creating meshes."""

@overload
def create_mesh(arg0: MPICommWrapper, arg1: Sequence[Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)]], arg2: Sequence[dolfinx.cpp.fem.CoordinateElement_float64], arg3: Annotated[NDArray[numpy.float64], dict(order='C', writable=False)], arg4: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32], arg5: int | None) -> Mesh_float64: ...

@overload
def create_mesh(comm: MPICommWrapper, cells: Annotated[NDArray[numpy.int64], dict(shape=(None, None), order='C', writable=False)], element: dolfinx.cpp.fem.CoordinateElement_float64, x: Annotated[NDArray[numpy.float64], dict(order='C', writable=False)], partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None, max_facet_to_cell_links: int | None) -> Mesh_float64:
    """Helper function for creating meshes."""

@overload
def create_submesh(mesh: Mesh_float32, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> tuple[Mesh_float32, EntityMap, EntityMap, NDArray[numpy.int32]]: ...

@overload
def create_submesh(mesh: Mesh_float64, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> tuple[Mesh_float64, EntityMap, EntityMap, NDArray[numpy.int32]]: ...

@overload
def cell_normals(mesh: Mesh_float32, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> NDArray[numpy.float32]: ...

@overload
def cell_normals(mesh: Mesh_float64, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> NDArray[numpy.float64]: ...

@overload
def h(mesh: Mesh_float32, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> NDArray[numpy.float32]:
    """Compute maximum distsance between any two vertices."""

@overload
def h(mesh: Mesh_float64, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> NDArray[numpy.float64]: ...

@overload
def compute_midpoints(mesh: Mesh_float32, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> NDArray[numpy.float32]: ...

@overload
def compute_midpoints(mesh: Mesh_float64, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)]) -> NDArray[numpy.float64]: ...

@overload
def locate_entities(mesh: Mesh_float32, dim: int, marker: Callable[[Annotated[NDArray[numpy.float32], dict(shape=(None, None), writable=False)]], Annotated[NDArray[numpy.bool_], dict(shape=(None,), order='C')]]) -> NDArray[numpy.int32]: ...

@overload
def locate_entities(mesh: Mesh_float32, dim: int, marker: Callable[[Annotated[NDArray[numpy.float32], dict(shape=(None, None), writable=False)]], Annotated[NDArray[numpy.bool_], dict(shape=(None,), order='C')]], entity_type_idx: int) -> NDArray[numpy.int32]: ...

@overload
def locate_entities(mesh: Mesh_float64, dim: int, marker: Callable[[Annotated[NDArray[numpy.float64], dict(shape=(None, None), writable=False)]], Annotated[NDArray[numpy.bool_], dict(shape=(None,), order='C')]]) -> NDArray[numpy.int32]: ...

@overload
def locate_entities(mesh: Mesh_float64, dim: int, marker: Callable[[Annotated[NDArray[numpy.float64], dict(shape=(None, None), writable=False)]], Annotated[NDArray[numpy.bool_], dict(shape=(None,), order='C')]], entity_type_idx: int) -> NDArray[numpy.int32]: ...

@overload
def locate_entities_boundary(mesh: Mesh_float32, dim: int, marker: Callable[[Annotated[NDArray[numpy.float32], dict(shape=(None, None), writable=False)]], Annotated[NDArray[numpy.bool_], dict(shape=(None,), order='C')]]) -> NDArray[numpy.int32]: ...

@overload
def locate_entities_boundary(mesh: Mesh_float64, dim: int, marker: Callable[[Annotated[NDArray[numpy.float64], dict(shape=(None, None), writable=False)]], Annotated[NDArray[numpy.bool_], dict(shape=(None,), order='C')]]) -> NDArray[numpy.int32]: ...

@overload
def entities_to_geometry(mesh: Mesh_float32, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], permute: bool) -> NDArray[numpy.int32]: ...

@overload
def entities_to_geometry(mesh: Mesh_float64, dim: int, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], permute: bool) -> NDArray[numpy.int32]: ...

@overload
def create_geometry(arg0: Topology, arg1: Sequence[dolfinx.cpp.fem.CoordinateElement_float32], arg2: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)], arg3: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)], arg4: Annotated[NDArray[numpy.float32], dict(shape=(None,), order='C', writable=False)], arg5: int, /) -> Geometry_float32: ...

@overload
def create_geometry(arg0: Topology, arg1: Sequence[dolfinx.cpp.fem.CoordinateElement_float64], arg2: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)], arg3: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)], arg4: Annotated[NDArray[numpy.float64], dict(shape=(None,), order='C', writable=False)], arg5: int, /) -> Geometry_float64: ...

class Geometry_float64:
    """Geometry object"""

    def __init__(self, index_map: dolfinx.cpp.common.IndexMap, dofmap: Annotated[NDArray[numpy.int32], dict(shape=(None, None), order='C', writable=False)], element: dolfinx.cpp.fem.CoordinateElement_float64, x: Annotated[NDArray[numpy.float64], dict(shape=(None, None), writable=False)], input_global_indices: Annotated[NDArray[numpy.int64], dict(shape=(None,), order='C', writable=False)]) -> None: ...

    @property
    def dim(self) -> int:
        """Geometric dimension"""

    @property
    def dofmap(self) -> Annotated[NDArray[numpy.int32], dict(writable=False)]: ...

    def dofmaps(self, i: int) -> Annotated[NDArray[numpy.int32], dict(writable=False)]:
        """
        Get the geometry dofmap associated with coordinate element i (mixed topology)
        """

    def index_map(self) -> dolfinx.cpp.common.IndexMap: ...

    @property
    def x(self) -> Annotated[NDArray[numpy.float64], dict(shape=(None, 3))]:
        """
        Return coordinates of all geometry points. Each row is the coordinate of a point.
        """

    @property
    def cmap(self) -> dolfinx.cpp.fem.CoordinateElement_float64:
        """The coordinate map"""

    def cmaps(self, arg: int, /) -> dolfinx.cpp.fem.CoordinateElement_float64:
        """The ith coordinate map"""

    @property
    def input_global_indices(self) -> Annotated[NDArray[numpy.int64], dict(writable=False)]: ...

class Mesh_float64:
    """Mesh object"""

    def __init__(self, comm: MPICommWrapper, topology: Topology, geometry: Geometry_float64) -> None: ...

    @property
    def geometry(self) -> Geometry_float64:
        """Mesh geometry"""

    @property
    def topology(self) -> Topology:
        """Mesh topology"""

    @property
    def comm(self) -> MPICommWrapper: ...

    @property
    def name(self) -> str: ...

    @name.setter
    def name(self, arg: str, /) -> None: ...

def create_interval_float64(comm: MPICommWrapper, n: int, p: Sequence[float], ghost_mode: GhostMode, partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None) -> Mesh_float64: ...

def create_rectangle_float64(comm: MPICommWrapper, p: Sequence[Sequence[float]], n: Sequence[int], celltype: CellType, partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None, diagonal: DiagonalType) -> Mesh_float64: ...

def create_box_float64(comm: MPICommWrapper, p: Sequence[Sequence[float]], n: Sequence[int], celltype: CellType, partitioner: Callable[[MPICommWrapper, int, Sequence[CellType], Sequence[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32] | None) -> Mesh_float64: ...

@overload
def create_cell_partitioner(mode: GhostMode, max_facet_to_cell_links: int | None) -> Callable[[MPICommWrapper, int, list[CellType], list[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32]:
    """Create default cell partitioner."""

@overload
def create_cell_partitioner(part: Callable[[MPICommWrapper, int, dolfinx.cpp.graph.AdjacencyList_int64, bool], dolfinx.cpp.graph.AdjacencyList_int32], ghost_mode: GhostMode, max_facet_to_cell_links: int | None) -> Callable[[MPICommWrapper, int, list[CellType], list[Annotated[NDArray[numpy.int64], dict(writable=False)]]], dolfinx.cpp.graph.AdjacencyList_int32]:
    """Create a cell partitioner from a graph partitioning function."""

def exterior_facet_indices(topology: Topology) -> NDArray[numpy.int32]: ...

def compute_incident_entities(mesh: Topology, entities: Annotated[NDArray[numpy.int32], dict(shape=(None,), order='C', writable=False)], d0: int, d1: int) -> NDArray[numpy.int32]: ...

class DiagonalType(enum.Enum):
    left = 0

    right = 1

    crossed = 2

    left_right = 4

    right_left = 5

@schnellerhase
Copy link
Contributor

Thanks for doing this!

We should sanity check the output particularly for NDArrays in/out - wjakob/nanobind#1155

Seems to be not triggered for us. Maybe because of the no convert() usages.

Copy link
Contributor

@schnellerhase schnellerhase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should go in after FEniCS/basix#991.

Note that these OUTPUT are not actually passed to the stub
generator and purely used for dependency management
within CMake.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code type-hints

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments