algorithm_to_mesh_handler

algorithm_to_mesh_handler#

algorithm_to_mesh_handler(
mesh_or_algo: Any,
port: int = 0,
) → tuple[DataSet, _vtk.vtkAlgorithm | _vtk.vtkAlgorithmOutput | None][source]#

Handle vtkAlgorithm where mesh objects are expected.

This is a convenience method to handle vtkAlgorithm when passed to methods that expect a DataSet. This method will check if the passed object is a vtkAlgorithm or vtkAlgorithmOutput and if so, return that algorithm’s output dataset (mesh) as the mesh to be used by the calling function.

Parameters:
mesh_or_algoDataObject | vtkAlgorithm | vtkAlgorithmOutput

The input to be used as a data set (mesh) or vtkAlgorithm object.

portint, default: 0

If the input (mesh_or_algo) is an algorithm, this specifies which output port to use on that algorithm for the returned mesh.

Returns:
meshpyvista.DataSet

The algorithm’s output data set, or the input returned unchanged.

algorithmvtkAlgorithm | vtkAlgorithmOutput | None

If an algorithm is passed, it will be returned. Otherwise returns None.