pyvista.ExplicitStructuredGrid#
- class ExplicitStructuredGrid(*args, **kwargs)[source]#
Extend the functionality of the
vtk.vtkExplicitStructuredGrid
class.Can be initialized by the following:
Creating an empty grid
From a
vtk.vtkExplicitStructuredGrid
orvtk.vtkUnstructuredGrid
objectFrom a VTU or VTK file
From
dims
andcorners
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 = grid.compute_connectivity() >>> grid.plot(show_edges=True)
Methods
Add field data.
ExplicitStructuredGrid.add_field_data
(array, ...)Add field data.
Get a new representation of this object as a
pyvista.PointSet
.Cast to an unstructured grid.
Return the bounding box of a cell.
Generate points at the center of the cells in this dataset.
Return the cell structured coordinates.
Transform cell data into point data.
ExplicitStructuredGrid.cell_id
(coords)Return the cell ID.
Return the number of points in a cell.
Return the points in a cell.
Return the type of a cell.
Return the coordinates for the center of mass of the mesh.
Remove all arrays from point/cell/field data.
Remove all cell data.
Remove all cell arrays.
Remove all arrays from point/cell/field data.
Remove all field data.
Remove all field data.
Remove all point data.
Remove all point arrays.
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.
Clip a dataset by a scalar.
ExplicitStructuredGrid.clip_surface
(surface)Clip any mesh type using a
pyvista.PolyData
surface mesh.Compute a function of (geometric) quality for each cell of a mesh.
Compute sizes for 1D (length), 2D (area) and 3D (volume) cells.
Compute an array with the number of connected cell faces.
Compute the faces connectivity flags array.
Compute derivative-based quantities of point/cell scalar field.
Compute the implicit distance from the points to a surface.
Find and label connected bodies/volumes.
Contour an input self by an array.
ExplicitStructuredGrid.copy
([deep])Return a copy of the object.
Copy the data attributes of the input dataset object.
Copy pyvista meta data onto this object from another object.
Copy the structure (geometry and topology) of the input dataset object.
ExplicitStructuredGrid.ctp
([pass_cell_data, ...])Transform cell data into point data.
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.
Generate scalar values on a dataset.
Extract all the internal/external edges of the dataset as PolyData.
ExplicitStructuredGrid.extract_cells
(ind[, ...])Return a subset of the grid.
Extract edges from the surface of the mesh.
Extract the outer surface of a volume or structured grid dataset.
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.
Extract surface mesh of the grid.
Find the index of cells in this mesh along a line.
Find the index of cells in this mesh within bounds.
Find index of closest cell in this mesh to the given point.
Find index of closest point in this mesh to the given point.
Find index of a cell that contains 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.
Get the association of an array.
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.
Produce an outline of the full extent for the input dataset.
Produce an outline of the corners for the input dataset.
Overwrite this dataset inplace with the new dataset's geometries and data.
ExplicitStructuredGrid.plot
([off_screen, ...])Plot a vtk or numpy object.
Plot the curvature of the external surface of the grid.
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.
Transform point data into cell data.
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.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.
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.
Sample a dataset onto a line.
Sample a dataset onto a multiple lines.
ExplicitStructuredGrid.save
(filename[, binary])Save this VTK object to file.
ExplicitStructuredGrid.scale
(xyz[, ...])Scale the mesh.
Mark points as to whether they are inside a closed surface.
Find the scalars by name and appropriately sets it as active.
Find the tensors by name and appropriately sets it as active.
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.
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.
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.
Integrate a vector field to generate streamlines.
Generate evenly spaced streamlines on a 2D dataset.
Generate streamlines of vectors from the points of a source mesh.
Return the surface indices of a grid.
Tessellate a mesh.
Texture map this dataset to a user defined plane.
Texture map this dataset to a user defined sphere.
ExplicitStructuredGrid.threshold
([value, ...])Apply a
vtkThreshold
filter to the input dataset.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.
Return an all triangle mesh.
Warp the dataset's points by a point data scalars array's values.
Warp the dataset's points by a point data vectors array's values.
Attributes
Return the active normals as an array.
Return the active scalars as an array.
Return the active scalar's association and name.
Return the name of the active scalars.
Return or set the active texture coordinates on the points.
Return the active tensors array.
Return the active tensor's field and name: [field, name].
Return the name of the active tensor array.
Return the active vectors array.
Return the active vector's association and name.
Return the name of the active vectors array.
Return the actual size of the dataset object.
Return a list of array names for the dataset.
Return a glyph representation of the active vector data as arrows.
Return the bounding box of this dataset.
Return vtkCellData as DataSetAttributes.
Return vtkCellData as DataSetAttributes.
Return the center of the bounding box.
Return the topological dimensions of the grid.
Return the range of the bounding box.
Return vtkFieldData as DataSetAttributes.
Return FieldData as DataSetAttributes.
Return the length of the diagonal of the bounding box.
Get address of the underlying VTK C++ object.
Return the number of arrays present in the dataset.
Return the number of cells in the entire dataset.
Return the number of points in the entire dataset.
Return the number of cells.
Return the number of points.
Return vtkPointData as DataSetAttributes.
Return vtkPointData as DataSetAttributes.
Return a reference to the points as a numpy object.
Return the active texture coordinates on the points.
Return a dictionary to hold compatible
vtk.vtkTexture
objects.Return active vectors.
Return the bounding box of the visible cells.
Compute the volume of the point grid.