Module Contents



One-dimensional Grid on an interval.

class pymor.discretizers.builtin.grids.oned.OnedGrid(domain=(0, 1), num_intervals=4, identify_left_right=False)[source]

Bases: pymor.discretizers.builtin.grids.interfaces.GridWithOrthogonalCenters

One-dimensional Grid on an interval.



Tuple (left, right) containing the left and right boundary of the domain.


The number of codim-0 entities.

dim = 1[source]

Helper for pickle.


Return str(self).

size(self, codim=0)[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.


Returns a (2, dim)-shaped array containing lower/upper bounding box coordinates.


retval[e] is a point inside the codim-0 entity with global index e such that the line segment from retval[e] to retval[e2] is always orthogonal to the codim-1 entity shared by the codim-0 entities with global index e and e2.

(This is mainly useful for gradient approximation in finite volume schemes.)

visualize(self, U, codim=1, **kwargs)[source]

Visualize scalar data associated to the grid as a patch plot.



NumPy array of the data to visualize. If U.dim == 2 and len(U) > 1, the data is visualized as a time series of plots. Alternatively, a tuple of NumPy 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.


The codimension of the entities the data in U is attached to (either 0 or 1).


See visualize