pyvista.ExplicitStructuredGrid

class ExplicitStructuredGrid(*args, **kwargs)

Extend the functionality of the vtk.vtkExplicitStructuredGrid class.

Can be initialized by the following:

  • Creating an empty grid

  • From a vtk.vtkExplicitStructuredGrid or vtk.vtkUnstructuredGrid object

  • From a VTU or VTK file

  • From dims and corners arrays

Examples

>>> import numpy as np
>>> import pyvista as pv
>>> 
>>> # grid size: ni*nj*nk cells; si, sj, sk steps
>>> ni, nj, nk = 4, 5, 6
>>> si, sj, sk = 20, 10, 1
>>> 
>>> # create raw coordinate grid
>>> grid_ijk = np.mgrid[:(ni+1)*si:si, :(nj+1)*sj:sj, :(nk+1)*sk:sk]
>>> 
>>> # repeat array along each Cartesian axis for connectivity
>>> for axis in range(1, 4):
...     grid_ijk = grid_ijk.repeat(2, axis=axis)
>>> 
>>> # slice off unnecessarily doubled edge coordinates
>>> grid_ijk = grid_ijk[:, 1:-1, 1:-1, 1:-1]
>>> 
>>> # reorder and reshape to VTK order
>>> corners = grid_ijk.transpose().reshape(-1, 3)
>>> 
>>> dims = np.array([ni, nj, nk]) + 1
>>> grid = pv.ExplicitStructuredGrid(dims, corners)
>>> _ = grid.compute_connectivity()
>>> grid.plot(show_edges=True)  

Methods

ExplicitStructuredGrid.add_field_array(...)

Add field data.

ExplicitStructuredGrid.add_field_data(array, ...)

Add field data.

ExplicitStructuredGrid.cast_to_unstructured_grid()

Cast to an unstructured grid.

ExplicitStructuredGrid.cell_bounds(ind)

Return the bounding box of a cell.

ExplicitStructuredGrid.cell_centers([...])

Generate points at the center of the cells in this dataset.

ExplicitStructuredGrid.cell_coords(ind)

Return the cell structured coordinates.

ExplicitStructuredGrid.cell_data_to_point_data([...])

Transform cell data into point data.

ExplicitStructuredGrid.cell_id(coords)

Return the cell ID.

ExplicitStructuredGrid.cell_n_points(ind)

Return the number of points in a cell.

ExplicitStructuredGrid.cell_points(ind)

Return the points in a cell.

ExplicitStructuredGrid.cell_type(ind)

Return the type of a cell.

ExplicitStructuredGrid.center_of_mass([...])

Return the coordinates for the center of mass of the mesh.

ExplicitStructuredGrid.clear_arrays()

Remove all arrays from point/cell/field data.

ExplicitStructuredGrid.clear_cell_arrays()

Remove all cell data.

ExplicitStructuredGrid.clear_cell_data()

Remove all cell arrays.

ExplicitStructuredGrid.clear_data()

Remove all arrays from point/cell/field data.

ExplicitStructuredGrid.clear_field_arrays()

Remove all field data.

ExplicitStructuredGrid.clear_field_data()

Remove all field data.

ExplicitStructuredGrid.clear_point_arrays()

Remove all point data.

ExplicitStructuredGrid.clear_point_data()

Remove all point arrays.

ExplicitStructuredGrid.clear_textures()

Clear the textures from this mesh.

ExplicitStructuredGrid.clip([normal, ...])

Clip a dataset by a plane by specifying the origin and normal.

ExplicitStructuredGrid.clip_box([bounds, ...])

Clip a dataset by a bounding box defined by the bounds.

ExplicitStructuredGrid.clip_scalar([...])

Clip a dataset by a scalar.

ExplicitStructuredGrid.clip_surface(surface)

Clip any mesh type using a pyvista.PolyData surface mesh.

ExplicitStructuredGrid.compute_cell_quality([...])

Compute a function of (geometric) quality for each cell of a mesh.

ExplicitStructuredGrid.compute_cell_sizes([...])

Compute sizes for 1D (length), 2D (area) and 3D (volume) cells.

ExplicitStructuredGrid.compute_connections([...])

Compute an array with the number of connected cell faces.

ExplicitStructuredGrid.compute_connectivity([...])

Compute the faces connectivity flags array.

ExplicitStructuredGrid.compute_derivative([...])

Compute derivative-based quantities of point/cell scalar field.

ExplicitStructuredGrid.compute_implicit_distance(surface)

Compute the implicit distance from the points to a surface.

ExplicitStructuredGrid.connectivity([...])

Find and label connected bodies/volumes.

ExplicitStructuredGrid.contour([...])

Contour an input self by an array.

ExplicitStructuredGrid.copy([deep])

Return a copy of the object.

ExplicitStructuredGrid.copy_attributes(dataset)

Copy the data attributes of the input dataset object.

ExplicitStructuredGrid.copy_meta_from(ido)

Copy pyvista meta data onto this object from another object.

ExplicitStructuredGrid.copy_structure(dataset)

Copy the structure (geometry and topology) of the input dataset object.

ExplicitStructuredGrid.ctp([pass_cell_data, ...])

Transform cell data into point data.

ExplicitStructuredGrid.decimate_boundary([...])

Return a decimated version of a triangulation of the boundary.

ExplicitStructuredGrid.deep_copy(to_copy)

Overwrite this data object with another data object as a deep copy.

ExplicitStructuredGrid.delaunay_3d([alpha, ...])

Construct a 3D Delaunay triangulation of the mesh.

ExplicitStructuredGrid.elevation([...])

Generate scalar values on a dataset.

ExplicitStructuredGrid.extract_all_edges([...])

Extract all the internal/external edges of the dataset as PolyData.

ExplicitStructuredGrid.extract_cells(ind[, ...])

Return a subset of the grid.

ExplicitStructuredGrid.extract_feature_edges([...])

Extract edges from the surface of the mesh.

ExplicitStructuredGrid.extract_geometry([...])

Extract the outer surface of a volume or structured grid dataset.

ExplicitStructuredGrid.extract_largest([...])

Extract largest connected set in mesh.

ExplicitStructuredGrid.extract_points(ind[, ...])

Return a subset of the grid (with cells) that contains any of the given point indices.

ExplicitStructuredGrid.extract_surface([...])

Extract surface mesh of the grid.

ExplicitStructuredGrid.find_closest_cell(point)

Find index of closest cell in this mesh to the given point.

ExplicitStructuredGrid.find_closest_point(point)

Find index of closest point in this mesh to the given point.

ExplicitStructuredGrid.flip_normal(normal[, ...])

Flip mesh about the normal.

ExplicitStructuredGrid.flip_x([point, ...])

Flip mesh about the x-axis.

ExplicitStructuredGrid.flip_y([point, ...])

Flip mesh about the y-axis.

ExplicitStructuredGrid.flip_z([point, ...])

Flip mesh about the z-axis.

ExplicitStructuredGrid.get_array(name[, ...])

Search both point, cell and field data for an array.

ExplicitStructuredGrid.get_array_association(name)

Get the association of an array.

ExplicitStructuredGrid.get_data_range([...])

Get the non-NaN min and max of a named array.

ExplicitStructuredGrid.glyph([orient, ...])

Copy a geometric representation (called a glyph) to the input dataset.

ExplicitStructuredGrid.head([display, html])

Return the header stats of this dataset.

ExplicitStructuredGrid.hide_cells(ind[, inplace])

Hide specific cells.

ExplicitStructuredGrid.interpolate(target[, ...])

Interpolate values onto this mesh from a given dataset.

ExplicitStructuredGrid.merge([grid, ...])

Join one or many other grids to this grid.

ExplicitStructuredGrid.neighbors(ind[, rel])

Return the indices of neighboring cells.

ExplicitStructuredGrid.outline([...])

Produce an outline of the full extent for the input dataset.

ExplicitStructuredGrid.outline_corners([...])

Produce an outline of the corners for the input dataset.

ExplicitStructuredGrid.overwrite(mesh)

Overwrite this dataset inplace with the new dataset's geometries and data.

ExplicitStructuredGrid.plot([off_screen, ...])

Plot a vtk or numpy object.

ExplicitStructuredGrid.plot_curvature([...])

Plot the curvature of the external surface of the grid.

ExplicitStructuredGrid.plot_over_circular_arc(...)

Sample a dataset along a circular arc and plot it.

ExplicitStructuredGrid.plot_over_circular_arc_normal(center)

Sample a dataset along a resolution circular arc defined by a normal and polar vector and plot it.

ExplicitStructuredGrid.plot_over_line(...[, ...])

Sample a dataset along a high resolution line and plot.

ExplicitStructuredGrid.point_data_to_cell_data([...])

Transform point data into cell data.

ExplicitStructuredGrid.points_to_double()

Convert the points datatype to double precision.

ExplicitStructuredGrid.probe(points[, ...])

Sample data values at specified point locations.

ExplicitStructuredGrid.ptc([...])

Transform point data into cell data.

ExplicitStructuredGrid.reconstruct_surface([...])

Reconstruct a surface from the points in this dataset.

ExplicitStructuredGrid.reflect(normal[, ...])

Reflect a dataset across a plane.

ExplicitStructuredGrid.remove_cells(ind[, ...])

Remove cells.

ExplicitStructuredGrid.rename_array(...[, ...])

Change array name by searching for the array then renaming it.

ExplicitStructuredGrid.rotate_vector(vector, ...)

Rotate mesh about a vector.

ExplicitStructuredGrid.rotate_x(angle[, ...])

Rotate mesh about the x-axis.

ExplicitStructuredGrid.rotate_y(angle[, ...])

Rotate mesh about the y-axis.

ExplicitStructuredGrid.rotate_z(angle[, ...])

Rotate mesh about the z-axis.

ExplicitStructuredGrid.sample(target[, ...])

Resample array data from a passed mesh onto this mesh.

ExplicitStructuredGrid.sample_over_circular_arc(...)

Sample a dataset over a circular arc.

ExplicitStructuredGrid.sample_over_circular_arc_normal(center)

Sample a dataset over a circular arc defined by a normal and polar vector and plot it.

ExplicitStructuredGrid.sample_over_line(...)

Sample a dataset onto a line.

ExplicitStructuredGrid.save(filename[, binary])

Save this VTK object to file.

ExplicitStructuredGrid.scale(xyz)

Scale the mesh.

ExplicitStructuredGrid.select_enclosed_points(surface)

Mark points as to whether they are inside a closed surface.

ExplicitStructuredGrid.set_active_scalars(name)

Find the scalars by name and appropriately sets it as active.

ExplicitStructuredGrid.set_active_tensors(name)

Find the tensors by name and appropriately sets it as active.

ExplicitStructuredGrid.set_active_vectors(name)

Find the vectors by name and appropriately sets it as active.

ExplicitStructuredGrid.shallow_copy(to_copy)

Create a shallow copy from a different dataset into this one.

ExplicitStructuredGrid.show_cells([inplace])

Show hidden cells.

ExplicitStructuredGrid.shrink([...])

Shrink the individual faces of a mesh.

ExplicitStructuredGrid.slice([normal, ...])

Slice a dataset by a plane at the specified origin and normal vector orientation.

ExplicitStructuredGrid.slice_along_axis([n, ...])

Create many slices of the input dataset along a specified axis.

ExplicitStructuredGrid.slice_along_line(line)

Slice a dataset using a polyline/spline as the path.

ExplicitStructuredGrid.slice_orthogonal([x, ...])

Create three orthogonal slices through the dataset on the three cartesian planes.

ExplicitStructuredGrid.split_bodies([label, ...])

Find, label, and split connected bodies/volumes.

ExplicitStructuredGrid.streamlines([...])

Integrate a vector field to generate streamlines.

ExplicitStructuredGrid.streamlines_evenly_spaced_2D([...])

Generate evenly spaced streamlines on a 2D dataset.

ExplicitStructuredGrid.streamlines_from_source(source)

Generate streamlines of vectors from the points of a source mesh.

ExplicitStructuredGrid.surface_indices([...])

Return the surface indices of a grid.

ExplicitStructuredGrid.texture_map_to_plane([...])

Texture map this dataset to a user defined plane.

ExplicitStructuredGrid.texture_map_to_sphere([...])

Texture map this dataset to a user defined sphere.

ExplicitStructuredGrid.threshold([value, ...])

Apply a vtkThreshold filter to the input dataset.

ExplicitStructuredGrid.threshold_percent([...])

Threshold the dataset by a percentage of its range on the active scalars array.

ExplicitStructuredGrid.transform(trans[, ...])

Transform this mesh with a 4x4 transform.

ExplicitStructuredGrid.translate(xyz)

Translate the mesh.

ExplicitStructuredGrid.triangulate([...])

Return an all triangle mesh.

ExplicitStructuredGrid.warp_by_scalar([...])

Warp the dataset's points by a point data scalars array's values.

ExplicitStructuredGrid.warp_by_vector([...])

Warp the dataset's points by a point data vectors array's values.

Attributes

ExplicitStructuredGrid.active_normals

Return the active normals as an array.

ExplicitStructuredGrid.active_scalars

Return the active scalars as an array.

ExplicitStructuredGrid.active_scalars_info

Return the active scalar's association and name.

ExplicitStructuredGrid.active_scalars_name

Return the name of the active scalars.

ExplicitStructuredGrid.active_t_coords

Return or set the active texture coordinates on the points.

ExplicitStructuredGrid.active_tensors

Return the active tensors array.

ExplicitStructuredGrid.active_tensors_info

Return the active tensor's field and name: [field, name].

ExplicitStructuredGrid.active_tensors_name

Return the name of the active tensor array.

ExplicitStructuredGrid.active_vectors

Return the active vectors array.

ExplicitStructuredGrid.active_vectors_info

Return the active vector's association and name.

ExplicitStructuredGrid.active_vectors_name

Return the name of the active vectors array.

ExplicitStructuredGrid.actual_memory_size

Return the actual size of the dataset object.

ExplicitStructuredGrid.array_names

Return a list of array names for the dataset.

ExplicitStructuredGrid.arrows

Return a glyph representation of the active vector data as arrows.

ExplicitStructuredGrid.bounds

Return the bounding box of this dataset.

ExplicitStructuredGrid.cell_arrays

Return vtkCellData as DataSetAttributes.

ExplicitStructuredGrid.cell_data

Return vtkCellData as DataSetAttributes.

ExplicitStructuredGrid.center

Return the center of the bounding box.

ExplicitStructuredGrid.dimensions

Return the topological dimensions of the grid.

ExplicitStructuredGrid.extent

Return the range of the bounding box.

ExplicitStructuredGrid.field_arrays

Return vtkFieldData as DataSetAttributes.

ExplicitStructuredGrid.field_data

Return FieldData as DataSetAttributes.

ExplicitStructuredGrid.length

Return the length of the diagonal of the bounding box.

ExplicitStructuredGrid.memory_address

Get address of the underlying VTK C++ object.

ExplicitStructuredGrid.n_arrays

Return the number of arrays present in the dataset.

ExplicitStructuredGrid.n_cells

Return the number of cells in the entire dataset.

ExplicitStructuredGrid.n_points

Return the number of points in the entire dataset.

ExplicitStructuredGrid.number_of_cells

Return the number of cells.

ExplicitStructuredGrid.number_of_points

Return the number of points.

ExplicitStructuredGrid.point_arrays

Return vtkPointData as DataSetAttributes.

ExplicitStructuredGrid.point_data

Return vtkPointData as DataSetAttributes.

ExplicitStructuredGrid.points

Return a reference to the points as a numpy object.

ExplicitStructuredGrid.t_coords

Return the active texture coordinates on the points.

ExplicitStructuredGrid.textures

Return a dictionary to hold compatible vtk.vtkTexture objects.

ExplicitStructuredGrid.vectors

Return active vectors.

ExplicitStructuredGrid.visible_bounds

Return the bounding box of the visible cells.

ExplicitStructuredGrid.volume

Compute the volume of the point grid.