pymor.discretizers.builtin.grids.subgrid
¶
Module Contents¶
- class pymor.discretizers.builtin.grids.subgrid.SubGrid(parent_grid, parent_entities)[source]¶
Bases:
pymor.discretizers.builtin.grids.interfaces.Grid
A subgrid of a
Grid
.Given a
Grid
and a list of codim-0 entities we construct the minimal subgrid of the grid, containing all the given entities.Parameters
- parent_grid
Grid
of which a subgrid is to be created.- parent_entities
NumPy array
of global indices of the codim-0 entities which are to be contained in the subgrid.
- parent_grid[source]¶
The
Grid
from which the subgrid was constructed.SubGrid
only stores aweakref
to the grid, so accessing this property might returnNone
if the original grid has been destroyed.
Methods
Return embeddings.
Maps indices of codim-
codim
entities of the parent grid to indices of the subgrid.retval[e]
is the index of thee
-th codim-codim
entity in the parent grid.The number of entities of codimension
codim
.Return subentities.
- embeddings(codim)[source]¶
Return embeddings.
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.
- indices_from_parent_indices(ind, codim)[source]¶
Maps indices of codim-
codim
entities of the parent grid to indices of the subgrid.Parameters
- ind
NumPy array
of indices of codim-codim
entities of the parent grid- codim
codim of the entities indicated by
ind
Raises
- ValueError
Not all provided indices correspond to entities contained in the subgrid.
- parent_indices(codim)[source]¶
retval[e]
is the index of thee
-th codim-codim
entity in the parent grid.
- subentities(codim, subentity_codim)[source]¶
Return subentities.
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)
- pymor.discretizers.builtin.grids.subgrid.make_sub_grid_boundary_info(sub_grid, parent_grid, parent_grid_boundary_info, new_boundary_type=None)[source]¶
Derives a
BoundaryInfo
for aSubGrid
.Parameters
- sub_grid
The
SubGrid
for which aBoundaryInfo
is created.- parent_grid
The parent
Grid
.- parent_grid_boundary_info
The
BoundaryInfo
of the parentGrid
from which to derive theBoundaryInfo
- new_boundary_type
The boundary type which is assigned to the new boundaries of
subgrid
. IfNone
, no boundary type is assigned.
Returns
BoundaryInfo
associated with sub_grid.