DeepSDFStruct.mesh#

Functions

create_3D_mesh(sdf, N_base, mesh_type[, ...])

export_abaqus_surf_mesh(surf_mesh, filename)

export a mesh and adds corresponding boundary conditions

export_sdf_grid_vtk(sdf, filename[, N, ...])

export_surface_mesh(filename, mesh[, dSurf])

export_volume_mesh(volume_mesh, filename[, ...])

export a mesh and adds corresponding boundary conditions

generate_2D_surf_mesh(sdf, n_squares[, ...])

get_verts(sdf, samples, constructor, cube_idx, N)

process_N_base_input(N, tiling)

prune_collinear(points[, tol])

Remove nearly collinear points from a polyline (closed loop).

sdf_to_triangle_dict(x, y, sdf[, level, ...])

Convert an SDF array to a PSLG dict for triangle.triangulate.

tetrahedralize_surface(surface_mesh)

Classes

torchSurfMesh(vertices, faces)

torchVolumeMesh(vertices, volumes)

DeepSDFStruct.mesh.create_3D_mesh(sdf, N_base, mesh_type, differentiate=False, device='cpu')#
Return type:

Tuple[Union[torchSurfMesh, torchVolumeMesh], Optional[Tensor]]

Parameters:
DeepSDFStruct.mesh.export_abaqus_surf_mesh(surf_mesh, filename)#

export a mesh and adds corresponding boundary conditions

Parameters:
  • surf_mesh (gustaf.faces.Faces)

  • filename (str)

DeepSDFStruct.mesh.export_sdf_grid_vtk(sdf, filename, N=64, bounds=None, device='cpu')#
Parameters:

sdf (DeepSDFStruct.SDF.SDFBase)

DeepSDFStruct.mesh.export_surface_mesh(filename, mesh, dSurf=None)#
Parameters:
DeepSDFStruct.mesh.export_volume_mesh(volume_mesh, filename, export_abaqus=False)#

export a mesh and adds corresponding boundary conditions

Parameters:
  • volume_mesh (gustaf.volumes.Volumes)

  • filename (str)

DeepSDFStruct.mesh.generate_2D_surf_mesh(sdf, n_squares, n_elements=50000, bounds=None)#
Parameters:
DeepSDFStruct.mesh.get_verts(sdf, samples, constructor, cube_idx, N, return_faces=False, output_tetmesh=False)#
Parameters:
DeepSDFStruct.mesh.process_N_base_input(N, tiling)#
DeepSDFStruct.mesh.prune_collinear(points, tol=1e-09)#

Remove nearly collinear points from a polyline (closed loop). :type points: :param points: Nx2 array of (x,y) vertices. :type points: ndarray :type tol: :param tol: area tolerance. Smaller = stricter (keep more points). :type tol: float

Returns:

pruned Nx2 array of vertices.

Return type:

ndarray

DeepSDFStruct.mesh.sdf_to_triangle_dict(x, y, sdf, level=0.0, pad_value=1.0, collinear_tol=1e-08)#

Convert an SDF array to a PSLG dict for triangle.triangulate. Includes domain boundary and hole polygons.

Parameters:
  • sdf (np.ndarray) – 2D signed distance field.

  • level (float) – Contour level (usually 0 for boundary).

  • pad_value (float) – Value outside domain to close boundaries.

Returns:

{“vertices”: …, “segments”: …, “holes”: …}

Return type:

dict

DeepSDFStruct.mesh.tetrahedralize_surface(surface_mesh)#
Return type:

tuple[Volumes, ndarray]

Parameters:

surface_mesh (gustaf.faces.Faces)

class DeepSDFStruct.mesh.torchSurfMesh(vertices, faces)#

Bases: object

Parameters:
  • vertices (torch.Tensor)

  • faces (torch.Tensor)

to_gus()#
to_trimesh()#
class DeepSDFStruct.mesh.torchVolumeMesh(vertices, volumes)#

Bases: object

Parameters:
  • vertices (torch.Tensor)

  • volumes (torch.Tensor)

to_gus()#
to_trimesh()#