Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
# update self.ei_dot_ej
self.ei_dot_ej[:, cell_ids] = numpy.einsum(
"ijk, ijk->ij",
self.half_edge_coords[[1, 2, 0]][:, cell_ids],
self.half_edge_coords[[2, 0, 1]][:, cell_ids],
)
# update self.ei_dot_ei
e = self.half_edge_coords[:, cell_ids]
self.ei_dot_ei[:, cell_ids] = numpy.einsum("ijk, ijk->ij", e, e)
# update cell_volumes, ce_ratios_per_half_edge
cv = compute_tri_areas(self.ei_dot_ej[:, cell_ids])
ce = compute_ce_ratios(self.ei_dot_ej[:, cell_ids], cv)
self.cell_volumes[cell_ids] = cv
self._ce_ratios[:, cell_ids] = ce
if self._interior_ce_ratios is not None:
self._interior_ce_ratios[interior_edge_ids] = 0.0
edge_gids = self._edge_to_edge_gid[2][interior_edge_ids]
adj_cells = self._edges_cells[2][interior_edge_ids]
is0 = self.cells["edges"][adj_cells[:, 0]][:, 0] == edge_gids
is1 = self.cells["edges"][adj_cells[:, 0]][:, 1] == edge_gids
is2 = self.cells["edges"][adj_cells[:, 0]][:, 2] == edge_gids
assert numpy.all(
numpy.sum(numpy.column_stack([is0, is1, is2]), axis=1) == 1
)
#
self._interior_ce_ratios[interior_edge_ids[is0]] += self.ce_ratios[
def ce_ratios(self):
if self._ce_ratios is None:
self._ce_ratios = compute_ce_ratios(self.ei_dot_ej, self.cell_volumes)
return self._ce_ratios
)
if self.ei_dot_ej is not None:
self.ei_dot_ej = numpy.einsum(
"ijk, ijk->ij",
self.half_edge_coords[[1, 2, 0]],
self.half_edge_coords[[2, 0, 1]],
)
if self.ei_dot_ei is not None:
e = self.half_edge_coords
self.ei_dot_ei = numpy.einsum("ijk, ijk->ij", e, e)
if self.cell_volumes is not None or self.ce_ratios is not None:
self.cell_volumes = compute_tri_areas(self.ei_dot_ej)
self._ce_ratios = compute_ce_ratios(self.ei_dot_ej, self.cell_volumes)
self._interior_edge_lengths = None
self._cell_circumcenters = None
self._interior_ce_ratios = None
self._control_volumes = None
self._cell_partitions = None
self._cv_centroids = None
self._cvc_cell_mask = None
self._surface_areas = None
self._signed_cell_areas = None
self._cell_centroids = None
return