polycubetools 1.1.1__tar.gz → 1.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {polycubetools-1.1.1/src/polycubetools.egg-info → polycubetools-1.1.2}/PKG-INFO +1 -1
  2. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/__init__.py +1 -1
  3. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/hull.py +40 -0
  4. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/utils.py +11 -2
  5. {polycubetools-1.1.1 → polycubetools-1.1.2/src/polycubetools.egg-info}/PKG-INFO +1 -1
  6. {polycubetools-1.1.1 → polycubetools-1.1.2}/LICENSE +0 -0
  7. {polycubetools-1.1.1 → polycubetools-1.1.2}/README.md +0 -0
  8. {polycubetools-1.1.1 → polycubetools-1.1.2}/pyproject.toml +0 -0
  9. {polycubetools-1.1.1 → polycubetools-1.1.2}/requirements.txt +0 -0
  10. {polycubetools-1.1.1 → polycubetools-1.1.2}/setup.cfg +0 -0
  11. {polycubetools-1.1.1 → polycubetools-1.1.2}/setup.py +0 -0
  12. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/data/heptacubes.json +0 -0
  13. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/data/hexacubes.json +0 -0
  14. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/data/pentacubes.json +0 -0
  15. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/errors.py +0 -0
  16. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/grid.py +0 -0
  17. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/models.py +0 -0
  18. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/py.typed +0 -0
  19. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools/solver.py +0 -0
  20. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools.egg-info/SOURCES.txt +0 -0
  21. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools.egg-info/dependency_links.txt +0 -0
  22. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools.egg-info/requires.txt +0 -0
  23. {polycubetools-1.1.1 → polycubetools-1.1.2}/src/polycubetools.egg-info/top_level.txt +0 -0
  24. {polycubetools-1.1.1 → polycubetools-1.1.2}/tests/test_grid.py +0 -0
  25. {polycubetools-1.1.1 → polycubetools-1.1.2}/tests/test_hull.py +0 -0
  26. {polycubetools-1.1.1 → polycubetools-1.1.2}/tests/test_models.py +0 -0
  27. {polycubetools-1.1.1 → polycubetools-1.1.2}/tests/test_parallel_solver.py +0 -0
  28. {polycubetools-1.1.1 → polycubetools-1.1.2}/tests/test_solver.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polycubetools
3
- Version: 1.1.1
3
+ Version: 1.1.2
4
4
  Summary: Basic framework for working with polycubes in a 3-dimensional grid.
5
5
  Author: Team Polycube
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -10,7 +10,7 @@ Basic framework for working with polycubes in a 3-dimensional grid.
10
10
  __author__ = "Team Polycube"
11
11
  __title__ = "polycubetools"
12
12
  __license__ = "MIT"
13
- __version__ = "1.1.1"
13
+ __version__ = "1.1.2"
14
14
 
15
15
  from . import utils as utils
16
16
  from .errors import *
@@ -134,3 +134,43 @@ class CuboidHull(AbstractHull):
134
134
  minc, maxc = self.min_coord, self.max_coord
135
135
  px, py, pz = pos.x, pos.y, pos.z
136
136
  return minc.x < px < maxc.x and minc.y < py < maxc.y and minc.z < pz < maxc.z
137
+
138
+
139
+ class CoordinateSetHull(AbstractHull):
140
+ def __init__(
141
+ self,
142
+ coords: frozenset[Coordinate],
143
+ inner_coords: frozenset[Coordinate],
144
+ frontier: set[Coordinate] | None = None,
145
+ ) -> None:
146
+ super().__init__()
147
+ self.coords = coords
148
+ self.inner_coords = inner_coords
149
+ if frontier is None:
150
+ self.frontier = set(coords)
151
+ else:
152
+ self.frontier = frontier
153
+
154
+ @classmethod
155
+ def from_snapshot(cls, snapshot: SNAPSHOT) -> Self:
156
+ coords = frozenset(Coordinate.from_tuple(t) for t in snapshot["coords"])
157
+ frontier = {Coordinate.from_tuple(t) for t in snapshot["frontier"]}
158
+ inner_coords = frozenset(Coordinate.from_tuple(t) for t in snapshot["inner_coords"])
159
+
160
+ return cls(coords, inner_coords, frontier)
161
+
162
+ def to_snapshot(self) -> SNAPSHOT:
163
+ return {
164
+ "coords": tuple(c.to_tuple() for c in self.coords),
165
+ "frontier": tuple(c.to_tuple() for c in self.frontier),
166
+ "inner_coords": tuple(c.to_tuple() for c in self.inner_coords),
167
+ }
168
+
169
+ def in_hull(self, pos: Coordinate) -> bool:
170
+ return pos in self.coords
171
+
172
+ def inside_hull(self, pos: Coordinate) -> bool:
173
+ return pos in self.coords or self.in_inner_part(pos)
174
+
175
+ def in_inner_part(self, pos: Coordinate) -> bool:
176
+ return pos in self.inner_coords
@@ -100,13 +100,22 @@ def collect_volume(coords: set[Coordinate]) -> set[Coordinate]:
100
100
  }
101
101
 
102
102
  # the here popped coordinate is always outside the hull; this is because we added this outside new layer!
103
- find_connected_component(visible_coords)
103
+ first_component = find_connected_component(visible_coords)
104
104
 
105
105
  if not visible_coords:
106
106
  _logger.warning("No volume found! Only one component detected.")
107
107
  return set()
108
108
 
109
- volume_cubes = find_connected_component(visible_coords)
109
+ second_component = find_connected_component(visible_coords)
110
+
111
+ if min_extreme_point in second_component and max_extreme_point in second_component:
112
+ volume_cubes = first_component
113
+ elif min_extreme_point in first_component and max_extreme_point in first_component:
114
+ volume_cubes = second_component
115
+ else:
116
+ _logger.warning("Error. Couldn't find one outside component")
117
+ raise InvalidVolumeException("Couldn't find one outside component")
118
+
110
119
  if visible_coords:
111
120
  _logger.warning(
112
121
  f"Found {len(volume_cubes)} as volume, but still {len(visible_coords)} unvisited cubes left. Another enclosed area exists!"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polycubetools
3
- Version: 1.1.1
3
+ Version: 1.1.2
4
4
  Summary: Basic framework for working with polycubes in a 3-dimensional grid.
5
5
  Author: Team Polycube
6
6
  Classifier: Development Status :: 3 - Alpha
File without changes
File without changes
File without changes
File without changes