DeepSDFStruct.lattice_structure#

Lattice Structure Generation#

This module provides tools for creating periodic lattice structures with deformable geometries. Lattices are built by tiling a unit cell (microtile) in a regular pattern and applying optional smooth deformations via B-splines.

The main class, LatticeSDFStruct, enables creation of complex microstructured materials with spatially-varying properties, useful for applications in: - Topology optimization - Additive manufacturing - Metamaterial design - Lightweight structural components

Key Features#

  • Periodic tiling of arbitrary unit cell geometries

  • Smooth deformations via spline-based mapping

  • Spatially-varying parametrization (e.g., varying strut thickness)

  • Support for 2D and 3D lattices

  • Integration with boundary conditions and capping

Functions

check_tiling_input(tiling)

constantLatvec(value)

transform(x, t[, bounds])

Classes

LatticeSDFStruct([tiling, ...])

Helper class to facilitate the construction of periodic lattice SDF structures.

class DeepSDFStruct.lattice_structure.LatticeSDFStruct(tiling=None, deformation_spline=None, microtile=None, parametrization=None, cap_border_dict=None, cap_outside_of_unitcube=True)#

Bases: DeepSDFStruct.SDF.SDFBase

Helper class to facilitate the construction of periodic lattice SDF structures.

This class creates periodic lattice structures by tiling a unit cell geometry (microtile) in a regular pattern and optionally deforming the result through a spline-based mapping. The microtile can be parametrized to have spatially- varying properties (e.g., thickness that varies across the structure).

The lattice is defined in parametric space [0,1]^d and can be mapped to physical space through a deformation spline. Boundary conditions can be applied to cap the structure at domain boundaries.

Parameters:
  • tiling (list of int or int, optional) – Number of repetitions of the microtile in each parametric dimension. If an int, uses the same tiling in all dimensions.

  • deformation_spline (TorchSpline, optional) – Spline function that maps from parametric to physical space, enabling smooth geometric deformations of the lattice.

  • microtile (SDFBase, optional) – The unit cell geometry to be tiled. Should be defined in the unit cube [0,1]^d.

  • parametrization (torch.nn.Module, optional) – Function that provides spatially-varying parameters for the microtile (e.g., varying strut thickness). Takes parametric coordinates and returns parameter values.

  • cap_border_dict (CapBorderDict, optional) – Dictionary specifying whether material should be added or removed at domain faces (for capping the structure at boundaries).

  • cap_outside_of_unitcube (bool, default True) – If True, caps geometry outside the unit cube.

tiling#

Number of tiles in each dimension.

Type:

list of int

microtile#

The unit cell geometry.

Type:

SDFBase

geometric_dim#

Geometric dimensionality (2 or 3).

Type:

int

parametric_dimension#

Parametric dimensionality (equal to geometric_dim).

Type:

int

Notes

The microtile should ideally have periodic boundary conditions to ensure smooth connections between adjacent tiles. For parametrized microtiles, the microtile must provide: - evaluation_points: Points where parameters are evaluated - para_dim: Dimensionality of the parameter space - _set_param: Method to update parameters

Examples

>>> from DeepSDFStruct.lattice_structure import LatticeSDFStruct
>>> from DeepSDFStruct.sdf_primitives import SphereSDF
>>> from DeepSDFStruct.torch_spline import TorchSpline
>>> import torch
>>>
>>> # Create a simple unit cell
>>> unit_cell = SphereSDF(center=[0.5, 0.5, 0.5], radius=0.3)
>>>
>>> # Create lattice with 3x3x3 tiling
>>> lattice = LatticeSDFStruct(
...     tiling=[3, 3, 3],
...     microtile=unit_cell
... )
>>>
>>> # Query lattice SDF
>>> points = torch.rand(100, 3)
>>> distances = lattice(points)
property parametric_dimension#
plot_intermesh(verts, faces)#
Parameters:
  • verts (torch.Tensor)

  • faces (torch.Tensor)

plot_samples(samples, sdf_values)#
plot_slice(*args, **kwargs)#
DeepSDFStruct.lattice_structure.check_tiling_input(tiling)#
DeepSDFStruct.lattice_structure.constantLatvec(value)#
DeepSDFStruct.lattice_structure.transform(x, t, bounds=[0, 1])#