Module Contents



A subgrid of a Grid.



Derives a BoundaryInfo for a SubGrid.

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.



Grid of which a subgrid is to be created.


NumPy array of global indices of the codim-0 entities which are to be contained in the subgrid.


The Grid from which the subgrid was constructed. Subgrid only stores a weakref to the grid, so accessing this property might return None if the original grid has been destroyed.

parent_indices(self, codim)[source]

retval[e] is the index of the e-th codim-codim entity in the parent grid.

indices_from_parent_indices(self, ind, codim)[source]

Maps indices of codim-codim entities of the parent grid to indices of the subgrid.



NumPy array of indices of codim-codim entities of the parent grid


codim of the entities indicated by ind



Not all provided indices correspond to entities contained in the subgrid.

size(self, codim)[source]

The number of entities of codimension codim.

subentities(self, codim, subentity_codim)[source]

retval[e,s] is the global index of the s-th codim-subentity_codim subentity of the codim-codim entity with global index e.

The ordering of subentities(0, subentity_codim)[e] has to correspond, w.r.t. the embedding of e, to the local ordering inside the reference element.

For codim > 0, we provide a default implementation by calculating the subentities of e as follows:

  1. Find the codim-1 parent entity e_0 of e with minimal global index

  2. Lookup the local indices of the subentities of e inside e_0 using the reference element.

  3. 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 by e_0, which agrees with what is returned by embeddings(codim)

embeddings(self, codim)[source]

Returns tuple (A, B) where A[e] and B[e] are the linear part and the translation part of the map from the reference element of e to e.

For codim > 0, we provide a default implementation by taking the embedding of the codim-1 parent entity e_0 of e with lowest global index and composing it with the subentity_embedding of e into e_0 determined 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 BoundaryInfo for a SubGrid.



The SubGrid for which a BoundaryInfo is created.


The parent Grid.


The BoundaryInfo of the parent Grid from which to derive the BoundaryInfo


The boundary type which is assigned to the new boundaries of subgrid. If None, no boundary type is assigned.


BoundaryInfo associated with sub_grid.