File: sobolev_spaces.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 (26 lines) | stat: -rw-r--r-- 694 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
# 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 for handling Sobolev spaces."""

from basix._basixcpp import SobolevSpace
from basix._basixcpp import sobolev_space_intersection as _ssi

__all__ = ["intersection"]


def intersection(spaces: list[SobolevSpace]) -> SobolevSpace:
    """Compute the intersection of a list of Sobolev spaces.

    Args:
        spaces: List of Sobolev spaces.

    Returns:
        Intersection of the Sobolev spaces.
    """
    space = spaces[0]
    for s in spaces[1:]:
        space = _ssi(space, s)
    return SobolevSpace[space.name]