ddg.optimize.he.functional module
- class ddg.optimize.he.functional.HalfEdgeFunctional(surface, attr_name, cell_type, attr_dimension=None, boundary_cells={}, interior_cell_index_attr_name='interior_cell_index')[source]
Bases:
ABCAbstract base class for functionals on half-edge objects. When creating functionals inheriting from this class the __init__ function should be inherited as the defined attributes are being used in optimization.
- Parameters:
- surface
- attr_name
- attr_dimension
- boundary_cells
- interior_cells
Notes
The functional can additionally implement the following methods which are then used in the optimization process: - gradient - hessian
- Attributes:
- surfaceddg.datastructures.halfedge.Surface
Half-edge surface to work on
- attr_namestr
Name of the attribute for minimization
- attr_dimensionint (optional)
Dimension of the attribute. If not given it will be determined automatically.
- cell_typestr
Either “verts”, “edges” or “faces” depending on where the minimization attribute is located
- boundary_cellsset (default = set())
Boundary cells for the minimization, i.e. vertices that have and keep a fixed value and are excluded from minimization process
- interior_cell_index_attr_namestr (default = “interior_cell_index”)
Attribute name for indices of interior cells. The interior cells are enumerated using this attribute.
Methods
evaluate(x)Evaluation function of the functional
- abstract evaluate(x) float[source]
Evaluation function of the functional
- Parameters:
- x: numpy.ndarray of shape (n, d)
Variables of the minimization process, where n is the number of interior cells, and d=attr_dimension. The n interior cells are ordered according to the attribute given by interior_cell_index_attr_name. The values of the attribute on the boundary cells need to be retrieved directly from the surface.
- Returns:
- float
Value of the functional
- property interior_cells
Method to distinguish the interior cells of the surface from the specified boundary cells. Equal to the complement of boundary_cells attribute in the surface.