discretize.base.BaseRectangularMesh.reshape#
- BaseRectangularMesh.reshape(x, x_type='cell_centers', out_type='cell_centers', return_format='V', **kwargs)[source]#
Reshape tensor quantities.
Reshape is a quick command that will do its best to reshape discrete quantities living on meshes than inherit the
discretize.base_mesh.RectangularMesh
class. For example, you may have a 1D array defining a vector on mesh faces, and you would like to extract the x-component and reshaped it to a 3D matrix.- Parameters:
- x
numpy.ndarray
orlist
of
numpy.ndarray
The input quantity. , ndarray (tensor) or a list
- x_type{‘CC’, ‘N’, ‘F’, ‘Fx’, ‘Fy’, ‘Fz’, ‘E’, ‘Ex’, ‘Ey’, ‘Ez’}
Defines the locations on the mesh where input parameter x lives.
- out_type
str
Defines the output quantity. Choice depends on your input for x_type:
x_type = ‘CC’ —> out_type = ‘CC’
x_type = ‘N’ —> out_type = ‘N’
x_type = ‘F’ —> out_type = {‘F’, ‘Fx’, ‘Fy’, ‘Fz’}
x_type = ‘E’ —> out_type = {‘E’, ‘Ex’, ‘Ey’, ‘Ez’}
- return_format
str
The dimensions of quantity being returned
V: return a vector (1D array) or a list of vectors
M: return matrix (nD array) or a list of matrices
- x