TensorProductGrid

About the TensorProductGrid 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 TensorProductGrid

Class documentation

class WaveBlocksND.TensorProductGrid(limits, number_nodes)[source]

This class represents a dense tensor product grid. It can have an arbitrary dimension D. The grid nodes are enclosed in a hypercubic bounding box. This box can have different limits min_i, max_i along each axis x_i. In each of these intervals we place N_i grid nodes. Note that the point max_i is not part of the grid. The grid interior is build as the tensor product of all the grid nodes along all the axes.

get_axes(axes=None)[source]

Returns the one-dimensional grids along the axes.

Parameters:axes (A single integer or a list of integers. If set to None (default) we return the data for all axes.) – The axes for which we want to get the grid.
Returns:A list of ndarrays, each having a shape of (1,...,N_i,...,1). We return a list even if it contains just a single element.
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_meshwidths(axes=None)[source]

Returns the meshwidths of the grid.

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

Returns all grid nodes of the full tensor product grid.

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.
  • 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(axes=None, overall=False)[source]

Returns the number of grid nodes along a set of axes.

Parameters:
  • axes (A single integer or a list of integers. If set to None (default) we return the data for all axes.) – The axes for which we want to get the number of nodes.
  • overall (Boolean, default is False) – Compute the product \prod_i^D N_i of the number N_i of grid nodes along each axis i specified.
Returns:

A list of N_i values or a single value N.

is_regular()

Answers the question if the grid spacing is regular. (It can still be different along each axis!)