lagrange.polyddg¶
Classes¶
Polygonal mesh discrete differential operators |
Module Contents¶
- class lagrange.polyddg.DifferentialOperators(mesh)¶
Polygonal mesh discrete differential operators
- Parameters:
mesh (lagrange.core.SurfaceMesh)
- connection_laplacian(*, beta: float = 1) scipy.sparse.csc_matrix[float]¶
- connection_laplacian(fid: int, *, beta: float = 1) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete connection Laplacian operator for a single facet.
- Parameters:
fid – Facet index.
beta – Weight of projection term (default: 1).
- Returns:
A dense matrix representing the per-facet connection Laplacian operator.
- connection_laplacian_nrosy(*, n: int, beta: float = 1) scipy.sparse.csc_matrix[float]¶
- connection_laplacian_nrosy(fid: int, *, n: int, beta: float = 1) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete connection Laplacian operator for a single facet for n-rosy fields.
- Parameters:
fid – Facet index.
n – Number of times to apply the connection.
beta – Weight of projection term (default: 1).
- Returns:
A dense matrix representing the per-facet connection Laplacian operator.
- covariant_derivative() scipy.sparse.csc_matrix[float]¶
- covariant_derivative(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=4, None, order='F')]
Compute the discrete covariant derivative operator for a single facet.
- Parameters:
fid – Facet index.
- Returns:
A dense matrix representing the per-facet covariant derivative operator.
- covariant_derivative_nrosy(*, n: int) scipy.sparse.csc_matrix[float]¶
- covariant_derivative_nrosy(fid: int, n: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=4, None, order='F')]
Compute the discrete covariant derivative operator for a single facet for n-rosy fields.
- Parameters:
fid – Facet index.
n – Number of times to apply the connection.
- Returns:
A dense matrix representing the per-facet covariant derivative operator.
- covariant_projection(fid)¶
Compute the discrete covariant projection operator for a single facet.
- Parameters:
fid (int) – Facet index.
- Returns:
A dense matrix representing the per-facet covariant projection operator.
- Return type:
Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=(None, None), order=’F’)]
- covariant_projection_nrosy(fid, n)¶
Compute the discrete covariant projection operator for a single facet for n-rosy fields.
- Parameters:
fid (int) – Facet index.
n (int) – Number of times to apply the connection.
- Returns:
A dense matrix representing the per-facet covariant projection operator.
- Return type:
Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=(None, None), order=’F’)]
- curl()¶
Compute the discrete polygonal curl operator.
- Returns:
A sparse matrix representing the curl operator.
- Return type:
scipy.sparse.csc_matrix[float]
- d0() scipy.sparse.csc_matrix[float]¶
- d0(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete d0 operator for a single facet.
The discrete d0 operator for a single facet is a n by n matrix, where n is the number vertices/edges in the facet. It maps a scalar functions defined on the vertices to a 1-form defined on the edges.
- Parameters:
fid – Facet index.
- Returns:
A dense matrix representing the per-facet d0 operator.
- d1() scipy.sparse.csc_matrix[float]¶
- d1(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, order='C')]
Compute the discrete d1 operator for a single facet.
The discrete d1 operator for a single facet is a row vector of size 1 by n, where n is the number edges in the facet. It maps a 1-form defined on the edges to a 2-form defined on the facet.
- Parameters:
fid – Facet index.
- Returns:
A dense matrix representing the per-facet d1 operator.
- divergence(*, beta=1)¶
Compute the discrete polygonal divergence operator.
- Parameters:
beta (float) – Weight of projection term for the 1-form inner product (default: 1).
- Returns:
A sparse matrix representing the divergence operator.
- Return type:
scipy.sparse.csc_matrix[float]
- facet_tangent_coordinates()¶
Compute the coordinate transformation that maps a per-facet tangent vector field expressed in the global 3D coordinate to the local tangent basis at each facet.
- Returns:
A sparse matrix representing the coordinate transformation.
- Return type:
scipy.sparse.csc_matrix[float]
- flat() scipy.sparse.csc_matrix[float]¶
- flat(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, 3, order='F')]
Compute the discrete flat operator for a single facet.
The discrete flat operator for a single facet is a n by 3 matrix, where n is the number of edges of the facet. It maps a vector field defined on the facet to a 1-form defined on the edges of the facet.
- Parameters:
fid – Facet index.
- Returns:
A Nx3 dense matrix representing the per-facet flat operator.
- gradient() scipy.sparse.csc_matrix[float]¶
- gradient(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=3, None, order='F')]
Compute the discrete gradient operator for a single facet.
The discrete gradient operator for a single facet is a 3 by n vector, where n is the number vertices in the facet. It maps a scalar functions defined on the vertices to a gradient vector defined on the facet.
- Parameters:
fid – Facet index.
- Returns:
A dense matrix representing the per-facet gradient operator.
- inner_product_0_form() scipy.sparse.csc_matrix[float]¶
- inner_product_0_form(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete inner product operator for 0-forms for a single facet.
- Parameters:
fid – Facet index.
- Returns:
A dense matrix representing the per-facet inner product operator for 0-forms.
- inner_product_1_form(*, beta: float = 1) scipy.sparse.csc_matrix[float]¶
- inner_product_1_form(fid: int, beta: float = 1) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete inner product operator for 1-forms for a single facet.
- Parameters:
fid – Facet index.
beta – Weight of projection term (default: 1).
- Returns:
A dense matrix representing the per-facet inner product operator for 1-forms.
- inner_product_2_form() scipy.sparse.csc_matrix[float]¶
- inner_product_2_form(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=1, order='C')]
Compute the discrete inner product operator for 2-forms for a single facet.
- Parameters:
fid – Facet index.
- Returns:
A 1x1 dense matrix representing the per-facet inner product operator for 2-forms.
- laplacian(*, beta: float = 1) scipy.sparse.csc_matrix[float]¶
- laplacian(fid: int, *, beta: float = 1) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete Laplacian operator for a single facet.
- Parameters:
fid – Facet index.
beta – Weight of projection term (default: 1).
- Returns:
A dense matrix representing the per-facet Laplacian operator.
- levi_civita() scipy.sparse.csc_matrix[float]¶
- levi_civita(fid: int, lv: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=2, 2, order='F')]
- levi_civita(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete Levi-Civita connection for a single facet.
- Parameters:
fid – Facet index.
- Returns:
A dense matrix representing the per-facet Levi-Civita connection.
- levi_civita_nrosy(*, n: int) scipy.sparse.csc_matrix[float]¶
- levi_civita_nrosy(fid: int, lv: int, *, n: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=2, 2, order='F')]
- levi_civita_nrosy(fid: int, *, n: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, order='F')]
Compute the discrete Levi-Civita connection for a single facet for n-rosy fields.
- Parameters:
fid – Facet index.
n – Number of times to apply the connection.
- Returns:
A dense matrix representing the per-facet Levi-Civita connection.
- projection(fid)¶
Compute the discrete projection operator for a single facet.
- Parameters:
fid (int) – Facet index.
- Returns:
A dense matrix representing the per-facet projection operator.
- Return type:
Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=(None, None), order=’F’)]
- sharp() scipy.sparse.csc_matrix[float]¶
- sharp(fid: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=3, None, order='F')]
Compute the discrete sharp operator for a single facet.
- Parameters:
fid – Facet index.
- Returns:
A 3xN dense matrix representing the per-facet sharp operator.
- star0()¶
Compute the discrete Hodge star operator for 0-forms.
The Hodge star operator maps a k-form to a dual (n-k)-form, where n is the dimension of the manifold.
- Returns:
A sparse matrix representing the discrete Hodge star operator for 0-forms.
- Return type:
scipy.sparse.csc_matrix[float]
- star1()¶
Compute the discrete Hodge star operator for 1-forms.
The Hodge star operator maps a k-form to a dual (n-k)-form, where n is the dimension of the manifold.
- Returns:
A sparse matrix representing the discrete Hodge star operator for 1-forms.
- Return type:
scipy.sparse.csc_matrix[float]
- star2()¶
Compute the discrete Hodge star operator for 2-forms.
The Hodge star operator maps a k-form to a dual (n-k)-form, where n is the dimension of the manifold.
- Returns:
A sparse matrix representing the discrete Hodge star operator for 2-forms.
- Return type:
scipy.sparse.csc_matrix[float]
- vertex_tangent_coordinates()¶
Compute the coordinate transformation that maps a per-vertex tangent vector field expressed in the global 3D coordinate to the local tangent basis at each vertex.
- Returns:
A sparse matrix representing the coordinate transformation.
- Return type:
scipy.sparse.csc_matrix[float]
- property centroid_attribute_id: int¶
Get the attribute ID of the per-facet centroid attribute used in the differential operators.
- Return type:
int
- property vector_area_attribute_id: int¶
Get the attribute ID of the per-facet vector area attribute used in the differential operators.
- Return type:
int
- property vertex_normal_attribute_id: int¶
Get the attribute ID of the per-vertex normal attribute used in the differential operators.
- Return type:
int