GridWrapper

About the GridWrapper class

The WaveBlocks Project

@author: R. Bourquin @copyright: Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 R. Bourquin @license: Modified BSD License

Inheritance diagram

Inheritance diagram of GridWrapper

Class documentation

class WaveBlocksND.GridWrapper(anarray)[source]

This class constructs a thin layer around an ndarray and wraps it as Grid subclass for API compatibility. The array must have a shape of (D, N) with N the overall number of nodes.

get_dimension()

Return the dimension D of the grid.

get_extensions(axes=None)[source]

Returns the extensions (length of the edges) of the bounding box.

Parameters:axes (A single integer or a list of integers. If set to None (default) we return the extensions for all axes.) – The axes for which we want to get the extensions.
Returns:A list of |max_i-min_i| values.
get_limits(axes=None)[source]

Returns the limits of the bounding box.

Parameters:axes (A single integer or a list of integers. If set to None (default) we return the limits for all axes.) – The axes for which we want to get the limits.
Returns:A list of (min_i, max_i) ndarrays.
get_nodes(flat=True, split=False)[source]

Returns all grid nodes.

Parameters:
  • flat (Boolean, default is True.) – Whether to return the grid with a hypercubic (D, N_1, ..., N_D) shape or a flat (D, \prod_i^D N_i) shape. Note that the hypercubic shape is not implemented!
  • split (Boolean, default is False.) – Whether to return the different components, one for each dimension inside a single ndarray or a list with ndarrays, with one item per dimension.
Returns:

Depends of the optional arguments.

get_number_nodes(overall=False)[source]

Returns the number of grid nodes.

Parameters:overall (Boolean, default is False) – Compute the product N = \prod_i^D N_i of the number N_i of grid nodes along each dimension i specified.
Returns:A list of N_i values or a single value N.