Skip to content

Commit

Permalink
Fix linked clamps bug (did not update properly)
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzBangar committed May 31, 2024
1 parent a7ebdd3 commit 7d453a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/classy_blocks/modify/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def update(self, junction: Junction) -> None:
if junction.clamp is not None:
if junction.clamp.is_linked:
linked_junction = self.get_junction_from_clamp(junction.clamp)
self.points[linked_junction.vertex.index] = linked_junction.vertex.position
for cell in linked_junction.cells:
cell.invalidate()

Expand All @@ -82,4 +83,4 @@ def clamps(self) -> List[ClampBase]:
@property
def quality(self) -> float:
"""Returns summed qualities of all junctions"""
return sum([junction.quality for junction in self.junctions])
return sum([cell.quality for cell in self.cells])
7 changes: 0 additions & 7 deletions src/classy_blocks/modify/junction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
from classy_blocks.modify.clamps.clamp import ClampBase


class ClampExistsError(Exception):
"""Raised when attempting to add a vertex that's already among existing clamps"""


class Junction:
"""A class that collects Cells/Blocks that
share the same Vertex"""
Expand All @@ -28,9 +24,6 @@ def add_cell(self, cell: Cell) -> None:
return

def add_clamp(self, clamp: ClampBase) -> None:
if self.clamp is not None:
raise ClampExistsError(f"A clamp has already been defined for vertex {self.vertex}")

self.clamp = clamp

@property
Expand Down

0 comments on commit 7d453a6

Please sign in to comment.