discretize.base.BaseMesh.nodes#

property BaseMesh.nodes#

Return gridded node locations.

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

Returns:
(n_nodes, dim) numpy.ndarray of float

Gridded node locations

Examples

The following is a 1D example.

>>> from discretize import TensorMesh
>>> hx = np.ones(5)
>>> mesh_1D = TensorMesh([hx], '0')
>>> mesh_1D.nodes
array([0., 1., 2., 3., 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.nodes
array([[0., 0., 0.],
       [1., 0., 0.],
       [2., 0., 0.],
       [0., 2., 0.],
       [1., 2., 0.],
       [2., 2., 0.],
       [0., 4., 0.],
       [1., 4., 0.],
       [2., 4., 0.],
       [0., 0., 3.],
       [1., 0., 3.],
       [2., 0., 3.],
       [0., 2., 3.],
       [1., 2., 3.],
       [2., 2., 3.],
       [0., 4., 3.],
       [1., 4., 3.],
       [2., 4., 3.],
       [0., 0., 6.],
       [1., 0., 6.],
       [2., 0., 6.],
       [0., 2., 6.],
       [1., 2., 6.],
       [2., 2., 6.],
       [0., 4., 6.],
       [1., 4., 6.],
       [2., 4., 6.]])