graphlow.TensorMesh.extract_surface#
- TensorMesh.extract_surface(*, keep_graph: bool = True) TensorMesh[T]#
Extract the boundary surface as a new 2D mesh.
The returned surface mesh reuses this mesh’s point tensor, so autograd remains connected to the original volume points.
The mapping from surface points to parent volume points is available via
surface.parent_point_idsand related gather/scatter helpers.- Parameters:
- keep_graphbool, default=True
If True, surface points (and transferred
point_data) are views into the original backend tensors, preserving the computation graph. If False, the returned tensors are detached, so gradients do not flow back to this mesh.
- Returns:
- TensorMesh[T]
Surface mesh (2D boundary cells) with:
points: subset of the volumepoints,point_data: subset of the volumepoint_data,parent_point_map: metadata mapping surface points back to parent volume points.