File: lattice.py

package info (click to toggle)
fenics-basix 0.10.0.post0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,156 kB
  • sloc: cpp: 23,435; python: 10,829; makefile: 43; sh: 26
file content (37 lines) | stat: -rw-r--r-- 1,093 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright (C) 2023-2024 Matthew Scroggs and Garth N. Wells
#
# This file is part of Basix (https://www.fenicsproject.org)
#
# SPDX-License-Identifier:    MIT
"""Functions to manipulate lattice types."""

import numpy.typing as npt

from basix._basixcpp import LatticeSimplexMethod, LatticeType
from basix._basixcpp import create_lattice as _create_lattice
from basix.cell import CellType

__all__ = ["create_lattice"]


def create_lattice(
    celltype: CellType,
    n: int,
    ltype: LatticeType,
    exterior: bool,
    method: LatticeSimplexMethod = LatticeSimplexMethod.none,
) -> npt.ArrayLike:
    """Create a lattice of points on a reference cell.

    Args:
        celltype: Cell type.
        n: The size in each direction. There will be ``n+1`` points
            along each edge of the cell.
        ltype: Lattice type.
        exterior: If ``True``, the points on the edges will be included.
        method: The simplex method used to generate points on simplices.

    Returns:
        Lattice points
    """
    return _create_lattice(celltype, n, ltype, exterior, method)