pymor.discretizers.builtin.grids.unstructured
¶
Module Contents¶
Classes¶
A generic unstructured, triangular grid. |
Functions¶
- class pymor.discretizers.builtin.grids.unstructured.UnstructuredTriangleGrid(sizes, subentity_data, embedding_data)[source]¶
Bases:
pymor.discretizers.builtin.grids.interfaces.Grid
A generic unstructured, triangular grid.
Use
from_vertices
to instantiate the grid from vertex coordinates and connectivity data.- classmethod from_vertices(cls, vertices, faces)[source]¶
Instantiate grid from vertex coordinates and connectivity data.
Parameters
- vertices
A (num_vertices, 2)-shaped
NumPy array
containing the coordinates of all vertices in the grid. The row numbers in the array will be the global indices of the given vertices (codim 2 entities).- faces
A (num_faces, 3)-shaped
NumPy array
containing the global indices of the vertices which define a given triangle in the grid. The row numbers in the array will be the global indices of the given triangles (codim 0 entities).
- subentities(self, codim=0, subentity_codim=None)[source]¶
retval[e,s]
is the global index of thes
-th codim-subentity_codim
subentity of the codim-codim
entity with global indexe
.The ordering of
subentities(0, subentity_codim)[e]
has to correspond, w.r.t. the embedding ofe
, to the local ordering inside the reference element.For
codim > 0
, we provide a default implementation by calculating the subentities ofe
as follows:Find the
codim-1
parent entitye_0
ofe
with minimal global indexLookup the local indices of the subentities of
e
insidee_0
using the reference element.Map these local indices to global indices using
subentities(codim - 1, subentity_codim)
.
This procedures assures that
subentities(codim, subentity_codim)[e]
has the right ordering w.r.t. the embedding determined bye_0
, which agrees with what is returned byembeddings(codim)
- embeddings(self, codim=0)[source]¶
Returns tuple
(A, B)
whereA[e]
andB[e]
are the linear part and the translation part of the map from the reference element ofe
toe
.For
codim > 0
, we provide a default implementation by taking the embedding of the codim-1 parent entitye_0
ofe
with lowest global index and composing it with the subentity_embedding ofe
intoe_0
determined by the reference element.
- visualize(self, U, codim=2, **kwargs)[source]¶
Visualize scalar data associated to the grid as a patch plot.
Parameters
- U
NumPy array
of the data to visualize. IfU.dim == 2 and len(U) > 1
, the data is visualized as a time series of plots. Alternatively, a tuple ofNumPy arrays
can be provided, in which case a subplot is created for each entry of the tuple. The lengths of all arrays have to agree.- codim
The codimension of the entities the data in
U
is attached to (either 0 or 2).- kwargs
See
visualize