dynabench.grid

Module for representing a grid for finite difference methods.

Classes

CartesianGrid(bounds, shape[, periodic])

d-dimensional Cartesian grid with uniform discretization for each axis

Grid([grid_size, grid_limits])

Base class for all grids.

UnitGrid([grid_size])

Class for a unit grid.

class dynabench.grid.Grid(grid_size: tuple = (64, 64), grid_limits: tuple = ((0, 64), (0, 64)), **kwargs)[source]

Bases: object

Base class for all grids.

Parameters:
  • grid_size (tuple, default (64, 64)) – Size of the grid. Defaults to (64, 64).

  • grid_limits (tuple, default ((0, 1), (0, 1))) – Limits of the grid. Defaults to ((0, 1), (0, 1)).

property dx

Get the step size in the x direction.

property dy

Get the step size in the y direction.

export_as_pypde_grid()[source]

Export the grid as a PyPDE grid.

get_meshgrid()[source]

Get the meshgrid of the grid.

get_random_point()[source]

Get a random point on the grid.

get_random_point_within_domain()[source]

Get a random point within the domain of the grid, but not necessarily on the grid.

property shape

Get the shape of the grid.

class dynabench.grid.UnitGrid(grid_size: tuple = (64, 64), **kwargs)[source]

Bases: Grid

Class for a unit grid. For a given grid size N, M, the grid limits are (0, N) and (0, M).

Parameters:

grid_size (tuple, default (64, 64)) – Size of the grid. Defaults to (64, 64).