pygeon.grids.regularizers module
- pygeon.grids.regularizers.lloyd_regularization(sd, num_iter)[source]
Perform Lloyd’s relaxation on the Voronoi grid. The topology of the grid is not preserved.
- Parameters:
sd (pg.VoronoiGrid) – The Voronoi grid to relax. num_iter (int): The number of iterations to perform.
num_iter (int) – The number of regularization iterations.
- Returns:
The regularized Voronoi grid.
- pygeon.grids.regularizers.graph_laplace_regularization(sd, sliding=True)[source]
Perform Laplace regularization on the grid by solving a graph laplacian over the face-ridges in 2d and ridge-peaks in 3d. The topology of the grid is preserved.
- Parameters:
sd (pg.Grid) – The grid to regularize.
sliding (bool) – Whether the boundary is sliding, defaults to True.
- Returns:
The Laplace regularized grid.
- pygeon.grids.regularizers.graph_laplace_dual_regularization(sd, sliding=True)[source]
Perform Laplace regularization on the dual grid by solving a graph laplacian over the cell-faces. A Voronoi grid is constructed based on the new cell centers. The topology of the grid is not preserved.
- Parameters:
sd (pg.Grid) – The grid to regularize.
sliding (bool) – Whether the boundary is sliding, defaults to True.
- Returns:
The regularized Voronoi grid.
- pygeon.grids.regularizers.elasticity_regularization(sd, spring_const=1, key='reg', sliding=True)[source]
Regularize the grid using the elasticity regularization. The topology of the grid is preserved.
- pygeon.grids.regularizers.compute_displacement(sd, A, b, coords, ess=None)[source]
Solve the regularizing system to compute the displacement field.
- Parameters:
sd (pg.Grid) – The grid to regularize.
A (sps.csc_matrix) – The system matrix.
b (np.ndarray) – The right-hand side.
coords (np.ndarray) – The coordinates of the nodes in the graph.
ess (np.ndarray) – The sliding degrees of freedom.
- Returns:
The displacement field.
- pygeon.grids.regularizers.update_grid(sd, u)[source]
Update the grid with the displacement field by modifiying the node coordinates.
- Parameters:
sd (pg.Grid) – The grid to update.
u (np.ndarray) – The displacement field.
- Returns:
The updated grid.