quickpaver 0.4.0__tar.gz → 0.6.0__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 (210) hide show
  1. {quickpaver-0.4.0 → quickpaver-0.6.0}/CHANGELOG.rst +29 -0
  2. {quickpaver-0.4.0 → quickpaver-0.6.0}/PKG-INFO +3 -3
  3. {quickpaver-0.4.0 → quickpaver-0.6.0}/pyproject.toml +7 -1
  4. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/__about__.py +1 -1
  5. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/__init__.py +3 -0
  6. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/_grid.py +217 -15
  7. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/_tiling.py +231 -39
  8. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/_transfer_matrix.py +28 -28
  9. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver.egg-info/PKG-INFO +3 -3
  10. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver.egg-info/requires.txt +2 -2
  11. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_grid.py +496 -0
  12. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_tiling.py +280 -0
  13. {quickpaver-0.4.0 → quickpaver-0.6.0}/AUTHORS.rst +0 -0
  14. {quickpaver-0.4.0 → quickpaver-0.6.0}/CONTRIBUTING.rst +0 -0
  15. {quickpaver-0.4.0 → quickpaver-0.6.0}/LICENSE +0 -0
  16. {quickpaver-0.4.0 → quickpaver-0.6.0}/MANIFEST.in +0 -0
  17. {quickpaver-0.4.0 → quickpaver-0.6.0}/README.rst +0 -0
  18. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/Makefile +0 -0
  19. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/make.bat +0 -0
  20. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Disk.as_array.rst +0 -0
  21. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Disk.bounds.rst +0 -0
  22. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Disk.center.rst +0 -0
  23. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Disk.centroid.rst +0 -0
  24. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Disk.radius.rst +0 -0
  25. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Disk.to_polygon.rst +0 -0
  26. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Grid.make_spatial_gradient_matrices.rst +0 -0
  27. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Grid.make_spatial_permutation_matrices.rst +0 -0
  28. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.Grid.n_grid_cells.rst +0 -0
  29. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.HEXAGON.rst +0 -0
  30. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.RECTANGLE.rst +0 -0
  31. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.TRIANGLE.rst +0 -0
  32. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.capitalize.rst +0 -0
  33. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.casefold.rst +0 -0
  34. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.center.rst +0 -0
  35. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.count.rst +0 -0
  36. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.encode.rst +0 -0
  37. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.endswith.rst +0 -0
  38. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.expandtabs.rst +0 -0
  39. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.find.rst +0 -0
  40. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.format.rst +0 -0
  41. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.format_map.rst +0 -0
  42. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.index.rst +0 -0
  43. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isalnum.rst +0 -0
  44. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isalpha.rst +0 -0
  45. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isascii.rst +0 -0
  46. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isdecimal.rst +0 -0
  47. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isdigit.rst +0 -0
  48. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isidentifier.rst +0 -0
  49. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.islower.rst +0 -0
  50. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isnumeric.rst +0 -0
  51. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isprintable.rst +0 -0
  52. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isspace.rst +0 -0
  53. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.istitle.rst +0 -0
  54. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.isupper.rst +0 -0
  55. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.join.rst +0 -0
  56. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.ljust.rst +0 -0
  57. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.lower.rst +0 -0
  58. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.lstrip.rst +0 -0
  59. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.maketrans.rst +0 -0
  60. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.partition.rst +0 -0
  61. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.removeprefix.rst +0 -0
  62. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.removesuffix.rst +0 -0
  63. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.replace.rst +0 -0
  64. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.rfind.rst +0 -0
  65. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.rindex.rst +0 -0
  66. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.rjust.rst +0 -0
  67. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.rpartition.rst +0 -0
  68. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.rsplit.rst +0 -0
  69. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.rstrip.rst +0 -0
  70. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.split.rst +0 -0
  71. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.splitlines.rst +0 -0
  72. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.startswith.rst +0 -0
  73. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.strip.rst +0 -0
  74. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.swapcase.rst +0 -0
  75. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.title.rst +0 -0
  76. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.to_list.rst +0 -0
  77. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.translate.rst +0 -0
  78. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.upper.rst +0 -0
  79. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.PolygonType.zfill.rst +0 -0
  80. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.bounding_box_vertices_coordinates.rst +0 -0
  81. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.bounds.rst +0 -0
  82. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.center_coords.rst +0 -0
  83. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.center_coords_2d.rst +0 -0
  84. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.contour.rst +0 -0
  85. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.copy.rst +0 -0
  86. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.cx.rst +0 -0
  87. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.cy.rst +0 -0
  88. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.cz.rst +0 -0
  89. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.dims.rst +0 -0
  90. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.dx.rst +0 -0
  91. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.dy.rst +0 -0
  92. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.dz.rst +0 -0
  93. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.gamma_ij_x_m2.rst +0 -0
  94. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.gamma_ij_y_m2.rst +0 -0
  95. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.gamma_ij_z_m2.rst +0 -0
  96. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.grid_cell_volume_m3.rst +0 -0
  97. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.indices.rst +0 -0
  98. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.make_spatial_gradient_matrices.rst +0 -0
  99. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.make_spatial_permutation_matrices.rst +0 -0
  100. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.n_grid_cells.rst +0 -0
  101. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.non_rot_center_coords.rst +0 -0
  102. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.non_rot_center_coords_2d.rst +0 -0
  103. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.nx.rst +0 -0
  104. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.ny.rst +0 -0
  105. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.nz.rst +0 -0
  106. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.origin.rst +0 -0
  107. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.origin_coords.rst +0 -0
  108. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.phi.rst +0 -0
  109. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.psi.rst +0 -0
  110. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.rot_center.rst +0 -0
  111. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.shape.rst +0 -0
  112. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.theta.rst +0 -0
  113. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.to_pyvista.rst +0 -0
  114. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.to_shapely.rst +0 -0
  115. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.total_volume_m3.rst +0 -0
  116. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.x0.rst +0 -0
  117. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.x_extent.rst +0 -0
  118. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.x_indices.rst +0 -0
  119. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.xmax.rst +0 -0
  120. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.xmin.rst +0 -0
  121. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.y0.rst +0 -0
  122. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.y_extent.rst +0 -0
  123. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.y_indices.rst +0 -0
  124. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.ymax.rst +0 -0
  125. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.ymin.rst +0 -0
  126. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.z0.rst +0 -0
  127. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.z_extent.rst +0 -0
  128. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.z_indices.rst +0 -0
  129. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.zmax.rst +0 -0
  130. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.RectilinearGrid.zmin.rst +0 -0
  131. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.area_m2.rst +0 -0
  132. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.edge_lengths_m.rst +0 -0
  133. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.n_tri.rst +0 -0
  134. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.n_verts.rst +0 -0
  135. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.to_shapely.rst +0 -0
  136. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.transform.rst +0 -0
  137. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.tri_area_m2.rst +0 -0
  138. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.tri_verts.rst +0 -0
  139. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/generated/quickpaver.TriMesh.verts_xy.rst +0 -0
  140. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.Disk.rst +0 -0
  141. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.Grid.rst +0 -0
  142. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.PolygonType.rst +0 -0
  143. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.RectilinearGrid.rst +0 -0
  144. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.TriMesh.rst +0 -0
  145. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.adjacency_by_shared_vertices.rst +0 -0
  146. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.adjacency_to_edges.rst +0 -0
  147. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.binary_dilation.rst +0 -0
  148. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.compute_transfer_matrix.rst +0 -0
  149. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.compute_transfer_matrix_with_intersections.rst +0 -0
  150. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.conservative_upsample.rst +0 -0
  151. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.create_selections_array_2d.rst +0 -0
  152. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.draw_adjacency.rst +0 -0
  153. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.duplicative_upsample.rst +0 -0
  154. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.extract_tiling_centers.rst +0 -0
  155. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.extract_tiling_vertices.rst +0 -0
  156. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.gen_hexagonal_tiling.rst +0 -0
  157. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.gen_polygon.rst +0 -0
  158. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.gen_polygonal_tiling.rst +0 -0
  159. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.gen_rectangular_tiling.rst +0 -0
  160. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.gen_triangular_tiling.rst +0 -0
  161. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.get_array_borders_selection.rst +0 -0
  162. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.get_owner_neigh_indices.rst +0 -0
  163. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.get_polygon_selection_with_dilation_2d.rst +0 -0
  164. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.get_polygon_selection_with_dilation_3d.rst +0 -0
  165. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.get_rlg_perm_mat.rst +0 -0
  166. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.get_rlg_spatial_grad_mat.rst +0 -0
  167. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.intersects_mask.rst +0 -0
  168. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.load_corsica_contour.rst +0 -0
  169. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.load_france_and_corsica_contour.rst +0 -0
  170. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.load_france_contour.rst +0 -0
  171. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.make_rlg_spatial_gradient_matrices.rst +0 -0
  172. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.make_rlg_spatial_permutation_matrices.rst +0 -0
  173. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.resample_grid.rst +0 -0
  174. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.rlg_idx_to_nn.rst +0 -0
  175. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.rlg_nn_to_idx.rst +0 -0
  176. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.span_to_node_numbers_2d.rst +0 -0
  177. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_autosummary/quickpaver.span_to_node_numbers_3d.rst +0 -0
  178. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_templates/autosummary/base.rst +0 -0
  179. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_templates/autosummary/class.rst +0 -0
  180. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/_templates/autosummary/module.rst +0 -0
  181. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/api_reference.rst +0 -0
  182. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/authors.rst +0 -0
  183. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/bibliography.rst +0 -0
  184. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/changelog.rst +0 -0
  185. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/conf.py +0 -0
  186. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/contributing.rst +0 -0
  187. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/index.rst +0 -0
  188. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/installation.rst +0 -0
  189. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/readme.rst +0 -0
  190. {quickpaver-0.4.0 → quickpaver-0.6.0}/docs/sources/usage.rst +0 -0
  191. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/_plot.py +0 -0
  192. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/_tm_test_utils.py +0 -0
  193. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/_types.py +0 -0
  194. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/data/__init__.py +0 -0
  195. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/data/corsica.geojson +0 -0
  196. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver/data/france.geojson +0 -0
  197. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver.egg-info/SOURCES.txt +0 -0
  198. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver.egg-info/dependency_links.txt +0 -0
  199. {quickpaver-0.4.0 → quickpaver-0.6.0}/quickpaver.egg-info/top_level.txt +0 -0
  200. {quickpaver-0.4.0 → quickpaver-0.6.0}/setup.cfg +0 -0
  201. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/__init__.py +0 -0
  202. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_data.py +0 -0
  203. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_plot.py +0 -0
  204. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_transfer_matrix.py +0 -0
  205. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_transfer_matrix_internals.py +0 -0
  206. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_transfer_matrix_mixed_polygon.py +0 -0
  207. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_transfer_matrix_rectilinear.py +0 -0
  208. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_transfer_matrix_trimesh.py +0 -0
  209. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_trimesh_flat.py +0 -0
  210. {quickpaver-0.4.0 → quickpaver-0.6.0}/tests/test_types.py +0 -0
@@ -2,6 +2,35 @@
2
2
  Changelog
3
3
  ==============
4
4
 
5
+ 0.6.0 (2026-10-06)
6
+ ------------------
7
+
8
+ * ENH: add ``extract_tiling_edge_centers`` to extract the centres of the polygon
9
+ edges, deduplicating the edges shared between adjacent polygons. It also returns
10
+ the adjacency between edges and polygons, and between polygons and edges (in ring
11
+ order, so that opposite edges of a rectangle are easy to retrieve).
12
+ * FIX: ``extract_tiling_vertices`` (and therefore ``adjacency_by_shared_vertices``)
13
+ could fail to merge coincident vertices when a coordinate fell on a rounding tie
14
+ (e.g. ``1.035`` scaled to ``103.5``), because float noise sent copies of the same
15
+ corner to different buckets. Vertices are now merged by gap clustering, which has
16
+ no rounding boundary.
17
+ * FIX: the vertex-to-polygon adjacency returned by ``extract_tiling_vertices`` was
18
+ wrong (some vertices had no polygon) on tilings with more polygons than vertices,
19
+ such as triangular tilings, due to colliding keys when grouping the pairs.
20
+ * ENH: ``n_decimals`` in ``extract_tiling_vertices`` is now the merge tolerance
21
+ (``10**-n_decimals``); the returned coordinates are still rounded to ``n_decimals``.
22
+ * TEST: add tests for ``extract_tiling_edge_centers`` and for the vertex clustering
23
+ (rounding ties, float noise, large coordinates), reaching 100% coverage of the
24
+ tiling module.
25
+
26
+ 0.5.0 (2026-09-27)
27
+ ------------------
28
+
29
+ * ENH: generalize ``get_array_borders_selection`` to any dim.
30
+ * ENH: add methods to RectilinearGrid: ``gc_face_area_m2``, ``pipj_m``, ``get_slicer_forward`` and ``get_slicer_backward``.
31
+ * STYLE: upgrade to `ty==0.0.84`.
32
+
33
+
5
34
  0.4.0 (2026-08-25)
6
35
  ------------------
7
36
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: quickpaver
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: A python package providing a paving toolbox.
5
5
  Author-email: Antoine Collet <antoinecollet5@gmail.com>
6
6
  License: BSD 3-Clause License
@@ -87,8 +87,8 @@ Provides-Extra: lint
87
87
  Requires-Dist: pre-commit; extra == "lint"
88
88
  Requires-Dist: pre-commit-hooks; extra == "lint"
89
89
  Requires-Dist: codespell; extra == "lint"
90
- Requires-Dist: ruff; extra == "lint"
91
- Requires-Dist: ty==0.0.74; extra == "lint"
90
+ Requires-Dist: ruff==0.16.10; extra == "lint"
91
+ Requires-Dist: ty==0.0.84; extra == "lint"
92
92
  Provides-Extra: install
93
93
  Requires-Dist: pip; extra == "install"
94
94
  Requires-Dist: wheel; extra == "install"
@@ -75,7 +75,13 @@ examples = [
75
75
  "nested_grid_plotter>=2.1.0",
76
76
  "pyvista[all]",
77
77
  ]
78
- lint = ["pre-commit", "pre-commit-hooks", "codespell", "ruff", "ty==0.0.74"]
78
+ lint = [
79
+ "pre-commit",
80
+ "pre-commit-hooks",
81
+ "codespell",
82
+ "ruff==0.16.10",
83
+ "ty==0.0.84",
84
+ ]
79
85
  install = ["pip", "wheel"]
80
86
  pyvista = ["pyvista"]
81
87
 
@@ -3,6 +3,6 @@
3
3
 
4
4
  """Get the metadata."""
5
5
 
6
- __version__ = "0.4.0"
6
+ __version__ = "0.6.0"
7
7
  __author__ = "Antoine Collet"
8
8
  __email__ = "antoine.collet5@gmail.com"
@@ -44,6 +44,7 @@ both the generated polygons and adjacency information between kept tiles.
44
44
  gen_polygonal_tiling
45
45
  extract_tiling_centers
46
46
  extract_tiling_vertices
47
+ extract_tiling_edge_centers
47
48
  adjacency_by_shared_vertices
48
49
  adjacency_to_edges
49
50
  draw_adjacency
@@ -136,6 +137,7 @@ from quickpaver._tiling import (
136
137
  PolygonType,
137
138
  adjacency_by_shared_vertices,
138
139
  extract_tiling_centers,
140
+ extract_tiling_edge_centers,
139
141
  extract_tiling_vertices,
140
142
  gen_hexagonal_tiling,
141
143
  gen_polygon,
@@ -189,6 +191,7 @@ __all__ = [
189
191
  "load_france_and_corsica_contour",
190
192
  "extract_tiling_centers",
191
193
  "extract_tiling_vertices",
194
+ "extract_tiling_edge_centers",
192
195
  "compute_transfer_matrix",
193
196
  "compute_transfer_matrix_with_intersections",
194
197
  "get_array_borders_selection",
@@ -338,35 +338,71 @@ def span_to_node_numbers_3d(
338
338
  return np.array(rlg_idx_to_nn(ix, nx=nx, iy=iy, ny=ny, iz=iz), dtype=np.int32)
339
339
 
340
340
 
341
- def get_array_borders_selection(nx: int, ny: int) -> NDArrayBool:
341
+ def get_array_borders_selection(*dims: int) -> NDArrayBool:
342
342
  """
343
- Get a selection of the array border as a bool array.
343
+ Get a selection of the array borders as a bool array.
344
+
345
+ This function works for any number of dimensions (1D, 2D, 3D, ..., nD).
346
+ A position is on the border if at least one of its coordinates is at the
347
+ boundary (0 or dimension_size-1) along any axis.
344
348
 
345
349
  Note
346
350
  ----
347
- There is no border for an axis of dim 1.
351
+ - There is no interior for an axis of dimension 1 (all elements are borders).
352
+ - For a 1D array, all elements are considered borders.
353
+ - For empty arrays (any dimension is 0), returns an all-False array.
348
354
 
349
355
  Parameters
350
356
  ----------
351
- nx: int
352
- Number of grid cells along the x axis.
353
- ny: int
354
- Number of grid cells along the y axis.
357
+ *dims : int
358
+ Number of grid cells along each axis. Supports any number of dimensions.
355
359
 
356
360
  Returns
357
361
  -------
358
362
  NDArrayBool
359
- Boolean array with shape ``(nx, ny)``.
363
+ Boolean array with shape ``dims``, where True indicates border elements.
364
+
365
+ Raises
366
+ ------
367
+ ValueError
368
+ If no dimensions are provided.
369
+
370
+ Examples
371
+ --------
372
+ >>> border_1d = get_array_borders_selection(5)
373
+ >>> border_1d
374
+ array([ True, False, False, False, True])
375
+
376
+ >>> border_2d = get_array_borders_selection(3, 3)
377
+ >>> border_2d
378
+ array([[ True, True, True],
379
+ [ True, False, True],
380
+ [ True, True, True]])
381
+
382
+ >>> border_3d = get_array_borders_selection(2, 3, 2)
383
+ >>> border_3d.shape
384
+ (2, 3, 2)
360
385
  """
361
- border = np.zeros((nx, ny), dtype=np.bool_)
386
+ if len(dims) == 0:
387
+ raise ValueError("At least 1 dimension is required")
388
+
389
+ # Handle zero dimensions - return empty array
390
+ if any(d == 0 for d in dims):
391
+ return np.zeros(dims, dtype=np.bool_)
362
392
 
363
- if nx == 0 or ny == 0:
364
- return border
393
+ # Create border array - start by marking all as NOT border, then mark borders
394
+ # A position is interior (not border) only if ALL coordinates are in interior
395
+ border = np.ones(dims, dtype=np.bool_)
396
+
397
+ # Mark interior (non-border) positions
398
+ # An interior position has all coordinates in range [1, dim_size-2]
399
+ interior_slices = tuple(
400
+ slice(1, dim_size - 1) if dim_size > 2 else slice(0, 0) for dim_size in dims
401
+ )
365
402
 
366
- border[0, :] = True
367
- border[-1, :] = True
368
- border[:, 0] = True
369
- border[:, -1] = True
403
+ # Only set interior to False if there actually is an interior
404
+ if all(dim_size > 2 for dim_size in dims):
405
+ border[interior_slices] = False
370
406
 
371
407
  return border
372
408
 
@@ -1256,6 +1292,172 @@ class RectilinearGrid(Grid):
1256
1292
 
1257
1293
  return pv_grid
1258
1294
 
1295
+ def gc_face_area_m2(self, axis: int) -> float:
1296
+ """
1297
+ Return the area of a grid-cell face perpendicular to ``axis``, in m2.
1298
+
1299
+ Parameters
1300
+ ----------
1301
+ axis : int
1302
+ Axis normal to the face: 0 for x, 1 for y, 2 for z.
1303
+
1304
+ Returns
1305
+ -------
1306
+ float
1307
+ Face area in square metres:
1308
+
1309
+ - ``axis=0`` -> ``dy * dz`` (face normal to the x-axis)
1310
+ - ``axis=1`` -> ``dx * dz`` (face normal to the y-axis)
1311
+ - ``axis=2`` -> ``dx * dy`` (face normal to the z-axis)
1312
+
1313
+ Raises
1314
+ ------
1315
+ ValueError
1316
+ If ``axis`` is not in ``[0, 1, 2]``.
1317
+
1318
+ See Also
1319
+ --------
1320
+ gamma_ij_x_m2, gamma_ij_y_m2, gamma_ij_z_m2 :
1321
+ Equivalent per-axis face areas exposed as properties.
1322
+ """
1323
+ if axis == 0:
1324
+ return self.dy * self.dz
1325
+ elif axis == 1:
1326
+ return self.dx * self.dz
1327
+ elif axis == 2:
1328
+ return self.dx * self.dy
1329
+ raise ValueError("`axis` should be among [0, 1, 2]")
1330
+
1331
+ def pipj_m(self, axis: int) -> float:
1332
+ """
1333
+ Return the distance between the centers of two contiguous grid cells.
1334
+
1335
+ Since the grid is rectilinear with a uniform cell size along each local axis,
1336
+ this distance is simply the cell dimension along ``axis``.
1337
+
1338
+ Parameters
1339
+ ----------
1340
+ axis : int
1341
+ Axis along which the two contiguous cells are considered: 0 for x, 1 for y,
1342
+ 2 for z.
1343
+
1344
+ Returns
1345
+ -------
1346
+ float
1347
+ The inter-cell-center distance in metres: ``dx``, ``dy`` or ``dz``
1348
+ for ``axis`` equal to 0, 1 or 2 respectively.
1349
+
1350
+ Raises
1351
+ ------
1352
+ ValueError
1353
+ If ``axis`` is not in ``[0, 1, 2]``.
1354
+ """
1355
+ if axis == 0:
1356
+ return self.dx
1357
+ if axis == 1:
1358
+ return self.dy
1359
+ if axis == 2:
1360
+ return self.dz
1361
+ raise ValueError("`axis` should be among [0, 1, 2]")
1362
+
1363
+ def get_slicer_forward(
1364
+ self, axis: int, shift: int = 0
1365
+ ) -> Tuple[slice, slice, slice]:
1366
+ """
1367
+ Return a 3D slicer selecting all cells but the last one(s) along ``axis``.
1368
+
1369
+ Meant to be paired with :meth:`get_slicer_backward` (same ``axis`` and
1370
+ ``shift``) to compute finite differences: applied to a
1371
+ ``(nx, ny, nz)``-shaped field, this slicer selects the "left" neighbour of every
1372
+ interior face along ``axis``, while :meth:`get_slicer_backward` selects the
1373
+ corresponding "right" neighbour, so ``field[get_slicer_backward(axis)]
1374
+ - field[get_slicer_forward(axis)]``
1375
+ gives the forward difference across every interior face along ``axis``.
1376
+
1377
+ Parameters
1378
+ ----------
1379
+ axis : int
1380
+ Axis along which to build the slicer: 0 for x, 1 for y, 2 for z.
1381
+ shift : int, optional
1382
+ Offset added to the upper bound of the slice along ``axis``
1383
+ (``slice(0, n - 1 + shift)``, where ``n`` is the number of cells
1384
+ along ``axis``). The default is 0, which selects every cell except
1385
+ the last one along ``axis``.
1386
+
1387
+ Returns
1388
+ -------
1389
+ Tuple[slice, slice, slice]
1390
+ A tuple of 3 slices, one per axis (x, y, z), usable to index a
1391
+ ``(nx, ny, nz)``-shaped array. The slice along ``axis`` is
1392
+ ``slice(0, n - 1 + shift)``; the slices along the other two axes
1393
+ are ``slice(None)`` (select everything).
1394
+
1395
+ Raises
1396
+ ------
1397
+ ValueError
1398
+ If ``axis`` is not in ``[0, 1, 2]``.
1399
+
1400
+ See Also
1401
+ --------
1402
+ get_slicer_backward : The complementary "right neighbour" slicer.
1403
+ """
1404
+ if axis == 0:
1405
+ return (slice(0, self.nx - 1 + shift), slice(None), slice(None))
1406
+ if axis == 1:
1407
+ return (slice(None), slice(0, self.ny - 1 + shift), slice(None))
1408
+ if axis == 2:
1409
+ return (slice(None), slice(None), slice(0, self.nz - 1 + shift))
1410
+ raise ValueError("axis should be in [0, 1, 2]")
1411
+
1412
+ def get_slicer_backward(
1413
+ self, axis: int, shift: int = 0
1414
+ ) -> Tuple[slice, slice, slice]:
1415
+ """
1416
+ Return a 3D slicer selecting all cells but the first one(s) along ``axis``.
1417
+
1418
+ Meant to be paired with :meth:`get_slicer_forward` (same ``axis`` and
1419
+ ``shift``) to compute finite differences: applied to a
1420
+ ``(nx, ny, nz)``-shaped field, this slicer selects the "right" neighbour
1421
+ of every interior face along ``axis``, while :meth:`get_slicer_forward`
1422
+ selects the corresponding "left" neighbour, so
1423
+ ``field[get_slicer_backward(axis)] - field[get_slicer_forward(axis)]``
1424
+ gives the forward difference across every interior face along ``axis``.
1425
+
1426
+ Parameters
1427
+ ----------
1428
+ axis : int
1429
+ Axis along which to build the slicer: 0 for x, 1 for y, 2 for z.
1430
+ shift : int, optional
1431
+ Offset added to the upper bound of the slice along ``axis``
1432
+ (``slice(1, n + shift)``, where ``n`` is the number of cells along
1433
+ ``axis``). The default is 0, which selects every cell except the
1434
+ first one along ``axis``.
1435
+
1436
+ Returns
1437
+ -------
1438
+ Tuple[slice, slice, slice]
1439
+ A tuple of 3 slices, one per axis (x, y, z), usable to index a
1440
+ ``(nx, ny, nz)``-shaped array. The slice along ``axis`` is
1441
+ ``slice(1, n + shift)``; the slices along the other two axes are
1442
+ ``slice(None)`` (select everything).
1443
+
1444
+ Raises
1445
+ ------
1446
+ ValueError
1447
+ If ``axis`` is not in ``[0, 1, 2]``.
1448
+
1449
+ See Also
1450
+ --------
1451
+ get_slicer_forward : The complementary "left neighbour" slicer.
1452
+ """
1453
+ if axis == 0:
1454
+ return (slice(1, self.nx + shift), slice(None), slice(None))
1455
+ if axis == 1:
1456
+ return (slice(None), slice(1, self.ny + shift), slice(None))
1457
+ if axis == 2:
1458
+ return (slice(None), slice(None), slice(1, self.nz + shift))
1459
+ raise ValueError("axis should be in [0, 1, 2]")
1460
+
1259
1461
 
1260
1462
  def _get_vertices_centroid(
1261
1463
  vertices: Union[NDArrayFloat, List[Tuple[float, float]]],
@@ -208,10 +208,12 @@ def _pairs_to_adj(
208
208
  Parameters
209
209
  ----------
210
210
  src, dst : NDArrayInt, shape (n_edges,)
211
- Compact source and destination indices of every edge. Both must
212
- lie in ``[0, n_nodes)``.
211
+ Compact source and destination indices of every edge. ``src`` must
212
+ lie in ``[0, n_nodes)``. ``dst`` is any non-negative integer: it
213
+ need not be a node id (e.g. vertex -> polygon pairs, where there
214
+ can be more polygons than vertices).
213
215
  n_nodes : int
214
- Total number of nodes. Nodes without any edge are present in the
216
+ Number of source nodes. Nodes without any edge are present in the
215
217
  output with an empty neighbour list.
216
218
 
217
219
  Returns
@@ -229,10 +231,13 @@ def _pairs_to_adj(
229
231
  # is used rather than np.unique, whose hash-based path is an order of
230
232
  # magnitude slower on this many keys; duplicates are then dropped in a
231
233
  # single linear scan of the sorted array.
232
- code = src.astype(np.int64, copy=False) * n_nodes + dst
234
+ # The stride must exceed every destination, which can outnumber the
235
+ # source nodes; packing with n_nodes would then make keys collide.
236
+ stride = max(n_nodes, int(np.max(dst)) + 1)
237
+ code = src.astype(np.int64, copy=False) * stride + dst
233
238
  code.sort()
234
239
  code = code[np.concatenate(([True], np.diff(code) != 0))]
235
- src_sorted, dst_sorted = np.divmod(code, n_nodes)
240
+ src_sorted, dst_sorted = np.divmod(code, stride)
236
241
 
237
242
  # Slice the sorted destinations into one contiguous run per source.
238
243
  counts = np.bincount(src_sorted, minlength=n_nodes)
@@ -829,6 +834,128 @@ def extract_tiling_centers(
829
834
  return shapely.get_coordinates(centroids)
830
835
 
831
836
 
837
+ def _cluster_points(
838
+ coords: NDArrayFloat, tol: float
839
+ ) -> Tuple[NDArrayInt, NDArrayFloat]:
840
+ """Group coincident points, immune to floating-point noise.
841
+
842
+ Snapping coordinates to a grid (``rint(x / tol)``) is fragile: a value
843
+ lying on a grid boundary is sent to either neighbouring bucket by
844
+ ~1e-15 of float noise, so the same physical point computed by two
845
+ different tiles may be split. Here points are instead merged by
846
+ *gaps*: they are sorted, and a new group starts only where two
847
+ consecutive values are further apart than ``tol``. A grid has
848
+ boundaries, a gap criterion does not, so noise far below ``tol`` can
849
+ never separate two copies of a point.
850
+
851
+ The grouping is done on ``x`` first, then on ``y`` inside every ``x``
852
+ group, so two points share a cluster when they are chained within
853
+ ``tol`` along both axes. Distinct points closer than ``tol`` are
854
+ merged; callers must pick ``tol`` well below the smallest feature.
855
+
856
+ Cost is ``O(n log n)`` with two sorts, both vectorised. The second one
857
+ sorts a small unsigned group id (radix sort for up to 65535 groups),
858
+ which is far cheaper than a two-key ``lexsort`` on floats.
859
+
860
+ Parameters
861
+ ----------
862
+ coords : NDArrayFloat, shape (n, 2)
863
+ Point coordinates (``n >= 1``).
864
+ tol : float
865
+ Largest gap, per axis, still considered the same point.
866
+
867
+ Returns
868
+ -------
869
+ cluster_indices : NDArrayInt, shape (n,)
870
+ Cluster id of every point. Ids are ordered lexicographically by
871
+ ``(x, y)``.
872
+ representatives : NDArrayFloat, shape (n_clusters, 2)
873
+ One coordinate per cluster, in cluster-id order. All clusters of
874
+ an ``x`` group share that group's smallest ``x``, so rounding the
875
+ representatives preserves the strict lexicographic order.
876
+ """
877
+ x, y = coords[:, 0], coords[:, 1]
878
+
879
+ # x groups: sorted x values chained within tol.
880
+ by_x = np.argsort(x, kind="stable")
881
+ x_sorted = x[by_x]
882
+ new_x_group = np.concatenate(([False], np.diff(x_sorted) > tol))
883
+ group_of_sorted_x = np.cumsum(new_x_group)
884
+ x_group = np.empty(len(x), dtype=group_of_sorted_x.dtype)
885
+ x_group[by_x] = group_of_sorted_x
886
+
887
+ # Order by (x group, y): sort y, then stably sort the group id, stored
888
+ # in the smallest unsigned dtype that holds it so numpy radix-sorts it.
889
+ by_y = np.argsort(y, kind="stable")
890
+ small = x_group[by_y].astype(np.min_scalar_type(int(group_of_sorted_x[-1])))
891
+ order = by_y[np.argsort(small, kind="stable")]
892
+
893
+ # y clusters inside every x group: split on gaps or group change.
894
+ group_sorted = x_group[order]
895
+ y_sorted = y[order]
896
+ new_cluster = np.concatenate(
897
+ (
898
+ [True],
899
+ (group_sorted[1:] != group_sorted[:-1]) | (np.diff(y_sorted) > tol),
900
+ )
901
+ )
902
+ cluster_indices = np.empty(len(x), dtype=np.int64)
903
+ cluster_indices[order] = np.cumsum(new_cluster) - 1
904
+
905
+ # Representatives: smallest x of the group, smallest y of the cluster.
906
+ first_in_cluster = np.flatnonzero(new_cluster)
907
+ group_x_min = x_sorted[np.flatnonzero(np.concatenate(([True], new_x_group[1:])))]
908
+ representatives = np.column_stack(
909
+ (group_x_min[group_sorted[first_in_cluster]], y_sorted[first_in_cluster])
910
+ )
911
+ return cluster_indices, representatives
912
+
913
+
914
+ def _vertex_clusters(
915
+ geom_array: NDArrayFloat, n_decimals: int
916
+ ) -> Tuple[NDArrayFloat, NDArrayInt, NDArrayInt, NDArrayFloat]:
917
+ """Array stage shared by the vertex and edge extractors.
918
+
919
+ Parameters
920
+ ----------
921
+ geom_array : NDArray of shapely.Polygon, shape (n_polys,)
922
+ Polygons whose vertices are extracted.
923
+ n_decimals : int
924
+ Vertices closer than ``10**-n_decimals`` along both axes are merged.
925
+
926
+ Returns
927
+ -------
928
+ coords : NDArrayFloat, shape (n_input_verts, 2)
929
+ Raw vertex coordinates, closing repeats dropped, in polygon order.
930
+ poly_indices : NDArrayInt, shape (n_input_verts,)
931
+ Polygon id of every input vertex.
932
+ cluster_indices : NDArrayInt, shape (n_input_verts,)
933
+ Deduplicated vertex id of every input vertex.
934
+ unique_coords : NDArrayFloat, shape (n_verts, 2)
935
+ Deduplicated vertex coordinates rounded to ``n_decimals``, in
936
+ lexicographic ``(x, y)`` order.
937
+ """
938
+ rings = shapely.get_rings(geom_array) # single call
939
+ n_per_ring = shapely.get_num_coordinates(rings)
940
+ all_coords, poly_indices = shapely.get_coordinates(geom_array, return_index=True)
941
+
942
+ # drop closing repeat (last vertex of every ring)
943
+ drop = np.zeros(len(all_coords), dtype=bool)
944
+ drop[np.cumsum(n_per_ring) - 1] = True
945
+ coords = all_coords[~drop]
946
+ poly_indices = poly_indices[~drop]
947
+
948
+ # merge coincident vertices by gap clustering (no rounding grid, hence no
949
+ # rounding ties for float noise to fall on)
950
+ cluster_indices, representatives = _cluster_points(coords, 10.0**-n_decimals)
951
+ return (
952
+ coords,
953
+ poly_indices,
954
+ cluster_indices,
955
+ np.round(representatives, decimals=n_decimals),
956
+ )
957
+
958
+
832
959
  def extract_tiling_vertices(
833
960
  polygons: Union[shapely.MultiPolygon, Iterable[shapely.Polygon]],
834
961
  n_decimals: int = 2,
@@ -837,25 +964,26 @@ def extract_tiling_vertices(
837
964
  Extract the vertices of all polygons, deduplicating shared vertices.
838
965
 
839
966
  Vertices shared between adjacent polygons (identical coordinates up to
840
- ``n_decimals`` decimal places) are merged into a single entry. The
841
- closing repeat of each exterior ring is dropped before deduplication.
842
- Both adjacency mappings are built from the same
843
- ``(cluster_indices, poly_indices)`` arrays so ``shapely.get_rings`` is
844
- called only once.
845
-
846
- Deduplication is performed on a single integer key per vertex, obtained
847
- by scaling the rounded coordinates and packing ``(x, y)`` into one
848
- ``int64``. Sorting integers is markedly cheaper than sorting the void
849
- dtype of a structured array, and the resulting order is the same
850
- lexicographic ``(x, y)`` order.
967
+ ``10**-n_decimals``) are merged into a single entry. The closing repeat
968
+ of each exterior ring is dropped before deduplication. Both adjacency
969
+ mappings are built from the same ``(cluster_indices, poly_indices)``
970
+ arrays so ``shapely.get_rings`` is called only once.
971
+
972
+ Deduplication is a gap clustering (see :func:`_cluster_points`): two
973
+ vertices are the same point when they are chained within
974
+ ``10**-n_decimals`` along both axes. Unlike snapping to a rounding
975
+ grid, this cannot be fooled by float noise on a rounding tie (e.g. a
976
+ coordinate of ``1.035`` computed as ``1.0349999999999999`` by one tile
977
+ and ``1.035`` by its neighbour). Cost is two sorts of the vertices.
851
978
 
852
979
  Parameters
853
980
  ----------
854
981
  polygons : Union[shapely.MultiPolygon, Iterable[shapely.Polygon]]
855
982
  Polygons whose vertices are to be extracted.
856
983
  n_decimals : int, optional
857
- Number of decimal places used when rounding coordinates before
858
- hashing for duplicate removal. By default ``2``.
984
+ Vertices closer than ``10**-n_decimals`` along both axes are merged,
985
+ and the returned coordinates are rounded to this many decimals.
986
+ By default ``2``.
859
987
 
860
988
  Returns
861
989
  -------
@@ -878,27 +1006,9 @@ def extract_tiling_vertices(
878
1006
  else:
879
1007
  geom_array = np.asarray(list(polygons))
880
1008
 
881
- rings = shapely.get_rings(geom_array) # single call
882
- n_per_ring = shapely.get_num_coordinates(rings)
883
- all_coords, poly_indices = shapely.get_coordinates(geom_array, return_index=True)
884
-
885
- # drop closing repeat (last vertex of every ring)
886
- drop = np.zeros(len(all_coords), dtype=bool)
887
- drop[np.cumsum(n_per_ring) - 1] = True
888
- coords = all_coords[~drop]
889
- poly_indices = poly_indices[~drop]
890
-
891
- # quantise the coordinates on the rounding grid, shifted to non-negative
892
- # values so the packing below is monotonic in x then y
893
- key = np.rint(coords * 10.0**n_decimals).astype(np.int64)
894
- key -= key.min(axis=0)
895
-
896
- # pack (x, y) into a single integer and deduplicate
897
- stride = int(key[:, 1].max()) + 1
898
- code = key[:, 0] * stride + key[:, 1]
899
- _, first, inverse = np.unique(code, return_index=True, return_inverse=True)
900
- cluster_indices = inverse.ravel().astype(np.int64)
901
- unique_coords = np.round(coords[first], decimals=n_decimals)
1009
+ _, poly_indices, cluster_indices, unique_coords = _vertex_clusters(
1010
+ geom_array, n_decimals
1011
+ )
902
1012
 
903
1013
  # vertex → polygons, grouped in a single pass
904
1014
  vert_to_polys = _pairs_to_adj(cluster_indices, poly_indices, len(unique_coords))
@@ -919,6 +1029,88 @@ def extract_tiling_vertices(
919
1029
  )
920
1030
 
921
1031
 
1032
+ def extract_tiling_edge_centers(
1033
+ polygons: Union[shapely.MultiPolygon, Iterable[shapely.Polygon]],
1034
+ n_decimals: int = 2,
1035
+ ) -> Tuple[NDArrayFloat, Dict[int, List[int]], Dict[int, List[int]]]:
1036
+ """
1037
+ Extract the edge centres of all polygons, deduplicating shared edges.
1038
+
1039
+ The edge ``k`` of a polygon joins its ring vertex ``k`` to vertex
1040
+ ``k + 1`` (the last edge wraps back to vertex ``0``). Two edges are the
1041
+ same edge when they join the same pair of *deduplicated vertices* (see
1042
+ :func:`extract_tiling_vertices`), irrespective of direction, so an edge
1043
+ shared by two adjacent tiles yields a single centre. Deduplicating on
1044
+ vertex-id pairs rather than on rounded midpoints keeps the topology
1045
+ consistent with :func:`extract_tiling_vertices` and inherits its
1046
+ immunity to rounding ties, while the returned coordinates are the exact
1047
+ (unrounded) midpoints.
1048
+
1049
+ Cost is one vertex clustering plus one integer sort of the edge keys;
1050
+ everything else is vectorised NumPy. The per-vertex dictionaries of
1051
+ :func:`extract_tiling_vertices` are not built.
1052
+
1053
+ Parameters
1054
+ ----------
1055
+ polygons : Union[shapely.MultiPolygon, Iterable[shapely.Polygon]]
1056
+ Hole-free polygons (every tile built by this module is) whose edge
1057
+ centres are to be extracted.
1058
+ n_decimals : int, optional
1059
+ Vertices closer than ``10**-n_decimals`` are merged, forwarded to
1060
+ :func:`extract_tiling_vertices`. By default ``2``.
1061
+
1062
+ Returns
1063
+ -------
1064
+ edge_centers : NDArrayFloat, shape (n_edges, 2)
1065
+ Midpoints of the ``n_edges`` deduplicated edges, ordered by their
1066
+ (min vertex id, max vertex id) key.
1067
+ edge_to_polys : Dict[int, List[int]]
1068
+ Deduplicated edge id -> sorted list of polygon ids sharing it.
1069
+ Interior edges have two entries, boundary edges exactly one.
1070
+ poly_to_edges : Dict[int, List[int]]
1071
+ Polygon id -> deduplicated edge ids in ring order, i.e. entry ``k``
1072
+ is the edge from ring vertex ``k`` to ring vertex ``k + 1``. For a
1073
+ rectangle, entries ``(0, 2)`` and ``(1, 3)`` are the opposite pairs.
1074
+ """
1075
+ if isinstance(polygons, shapely.MultiPolygon):
1076
+ geom_array = np.array(polygons.geoms)
1077
+ else:
1078
+ geom_array = np.asarray(list(polygons))
1079
+
1080
+ n_polys = len(geom_array)
1081
+ if n_polys == 0:
1082
+ return np.empty((0, 2), dtype=float), {}, {}
1083
+
1084
+ coords, poly_indices, cluster, _ = _vertex_clusters(geom_array, n_decimals)
1085
+
1086
+ # Index of the next vertex along each ring, wrapping at the ring end.
1087
+ n_per_poly = np.bincount(poly_indices, minlength=n_polys)
1088
+ ends = np.cumsum(n_per_poly)
1089
+ nxt = np.arange(len(coords)) + 1
1090
+ nxt[ends - 1] = ends - n_per_poly
1091
+
1092
+ # Undirected edge key from the two vertex ids, then one sort to dedupe
1093
+ # (a plain sort is far cheaper than np.unique with its index outputs).
1094
+ va = cluster
1095
+ vb = cluster[nxt]
1096
+ code = np.minimum(va, vb) * (int(np.max(cluster)) + 1) + np.maximum(va, vb)
1097
+ order = np.argsort(code, kind="stable")
1098
+ sorted_code = code[order]
1099
+ is_first = np.concatenate(([True], sorted_code[1:] != sorted_code[:-1]))
1100
+ edge_id = np.empty(len(code), dtype=np.int64)
1101
+ edge_id[order] = np.cumsum(is_first) - 1
1102
+ first = order[is_first] # stable sort: first occurrence of every edge
1103
+
1104
+ edge_centers = 0.5 * (coords[first] + coords[nxt[first]])
1105
+
1106
+ edge_to_polys = _pairs_to_adj(edge_id, poly_indices, len(first))
1107
+ poly_to_edges = {
1108
+ i: group.tolist() for i, group in enumerate(np.split(edge_id, ends[:-1]))
1109
+ }
1110
+
1111
+ return edge_centers, edge_to_polys, poly_to_edges
1112
+
1113
+
922
1114
  def adjacency_by_shared_vertices(
923
1115
  polygons: List[shapely.Polygon],
924
1116
  ) -> Dict[int, List[int]]: