pymor.discretizers.builtin.grids.subgrid¶
Module Contents¶
Classes¶
A subgrid of a |
Functions¶
Derives a |
- class pymor.discretizers.builtin.grids.subgrid.SubGrid(parent_grid, parent_entities)[source]¶
Bases:
pymor.discretizers.builtin.grids.interfaces.GridA subgrid of a
Grid.Given a
Gridand a list of codim-0 entities we construct the minimal subgrid of the grid, containing all the given entities.Parameters
- parent_grid
Gridof which a subgrid is to be created.- parent_entities
NumPy arrayof global indices of the codim-0 entities which are to be contained in the subgrid.
- parent_grid[source]¶
The
Gridfrom which the subgrid was constructed.Subgridonly stores aweakrefto the grid, so accessing this property might returnNoneif the original grid has been destroyed.
- parent_indices(self, codim)[source]¶
retval[e]is the index of thee-th codim-codimentity in the parent grid.
- indices_from_parent_indices(self, ind, codim)[source]¶
Maps indices of codim-
codimentities of the parent grid to indices of the subgrid.Parameters
- ind
NumPy arrayof indices of codim-codimentities 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.
- subentities(self, codim, subentity_codim)[source]¶
retval[e,s]is the global index of thes-th codim-subentity_codimsubentity of the codim-codimentity 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 ofeas follows:Find the
codim-1parent entitye_0ofewith minimal global indexLookup the local indices of the subentities of
einsidee_0using 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)[source]¶
Returns tuple
(A, B)whereA[e]andB[e]are the linear part and the translation part of the map from the reference element ofetoe.For
codim > 0, we provide a default implementation by taking the embedding of the codim-1 parent entitye_0ofewith lowest global index and composing it with the subentity_embedding ofeintoe_0determined by the reference element.
- 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
BoundaryInfofor aSubGrid.Parameters
- sub_grid
The
SubGridfor which aBoundaryInfois created.- parent_grid
The parent
Grid.- parent_grid_boundary_info
The
BoundaryInfoof the parentGridfrom 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
BoundaryInfoassociated with sub_grid.