discretize.CylindricalMesh.cell_centers

property CylindricalMesh.cell_centers

Return gridded cell center locations

This property returns a numpy array of shape (n_cells, dim) containing gridded cell center locations for all cells in the mesh. The cells are ordered along the x, then y, then z directions.

Returns
(n_cells, dim) numpy.ndarray of float

Gridded cell center locations

Examples

The following is a 1D example.

>>> from discretize import TensorMesh
>>> hx = np.ones(5)
>>> mesh_1D = TensorMesh([hx], '0')
>>> mesh_1D.cell_centers
array([0.5, 1.5, 2.5, 3.5, 4.5])

The following is a 3D example.

>>> hx, hy, hz = np.ones(2), 2*np.ones(2), 3*np.ones(2)
>>> mesh_3D = TensorMesh([hx, hy, hz], '000')
>>> mesh_3D.cell_centers
array([[0.5, 1. , 1.5],
       [1.5, 1. , 1.5],
       [0.5, 3. , 1.5],
       [1.5, 3. , 1.5],
       [0.5, 1. , 4.5],
       [1.5, 1. , 4.5],
       [0.5, 3. , 4.5],
       [1.5, 3. , 4.5]])