RectPartition¶
-
class
odl.discr.partition.
RectPartition
(intv_prod, grid)[source]¶ Bases:
object
Rectangular partition by hypercubes based on
RectGrid
.In 1d, a partition of an interval is implicitly defined by a collection of points x[0], …, x[N-1] (a grid) which are chosen to lie in the center of the subintervals. The i-th subinterval is thus given by
I[i] = [(x[i-1]+x[i])/2, (x[i]+x[i+1])/2]
- Attributes
boundary_cell_fractions
Return a tuple of contained fractions of boundary cells.
byaxis
Object to index
self
along axes.cell_boundary_vecs
Return the cell boundaries as coordinate vectors.
cell_sides
Side lengths of all ‘inner’ cells of a uniform partition.
cell_sizes_vecs
Return the cell sizes as coordinate vectors.
cell_volume
Volume of the ‘inner’ cells of a uniform partition.
coord_vectors
Coordinate vectors of the grid.
extent
Return a vector containing the total extent (max - min).
grid
RectGrid
defining this partition.has_isotropic_cells
True
ifgrid
is uniform andcell_sides
are all equal.is_uniform
True
ifgrid
is uniform.is_uniform_byaxis
Boolean tuple showing uniformity of
self.grid
per axis.max_pt
Maximum coordinates of the partitioned set.
meshgrid
Return the sparse meshgrid of sampling points.
mid_pt
Midpoint of the partitioned set.
min_pt
Minimum coordinates of the partitioned set.
ndim
Number of dimensions.
nodes_on_bdry
Encoding of grid points lying on the boundary.
nodes_on_bdry_byaxis
Nested tuple of booleans for
nodes_on_bdry
.set
Partitioned set, an
IntervalProd
.shape
Number of cells per axis, equal to
self.grid.shape
.size
Total number of cells, equal to
self.grid.size
.
Methods
append
(self, \*parts)Insert
parts
at the end as a block.approx_equals
(self, other, atol)Return
True
in case of approximate equality.index
(self, value[, floating])Return the index of a value in the domain.
insert
(self, index, \*parts)Return a copy with
parts
inserted beforeindex
.max
(self)Return the maximum point of the partitioned set.
min
(self)Return the minimum point of the partitioned set.
points
(self[, order])Return the sampling grid points.
squeeze
(self[, axis])Return the partition with removed degenerate (length 1) dimensions.
-
__init__
(self, intv_prod, grid)[source]¶ Initialize a new instance.
- Parameters
- intv_prod
IntervalProd
Set to be partitioned
- grid
RectGrid
Spatial points supporting the partition. They must be contained in
intv_prod
.
- intv_prod