halfedge 0.5.1__py3-none-any.whl → 0.7.0__py3-none-any.whl

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.
@@ -84,11 +84,31 @@ class MeshElementBase:
84
84
  """
85
85
  self.sn = next(self._sn_generator)
86
86
  self.attrib: dict[str, Attrib[Any]] = {}
87
- self.mesh = mesh
87
+ self._mesh = mesh
88
88
 
89
89
  for attribute in attributes:
90
90
  self.set_attrib(attribute)
91
91
 
92
+ @property
93
+ def mesh(self) -> BlindHalfEdges:
94
+ """Return the mesh instance.
95
+
96
+ :return: the mesh instance
97
+ :raise AttributeError: if mesh not set for self
98
+ """
99
+ if self._mesh is not None:
100
+ return self._mesh
101
+ msg = "mesh not set for self"
102
+ raise AttributeError(msg)
103
+
104
+ @mesh.setter
105
+ def mesh(self, mesh: BlindHalfEdges) -> None:
106
+ """Set the mesh instance.
107
+
108
+ :param mesh: the mesh instance
109
+ """
110
+ self._mesh = mesh
111
+
92
112
  def set_attrib(self, attrib: Attrib[Any]) -> None:
93
113
  """Set an attribute.
94
114
 
halfedge/type_attrib.py CHANGED
@@ -79,7 +79,7 @@ class StaticAttrib(Generic[_T]):
79
79
  merged or split.
80
80
  """
81
81
 
82
- __slots__ = ("_value", "mesh")
82
+ __slots__ = ("_value", "_mesh")
83
83
 
84
84
  def __new__(
85
85
  cls: type[_TStaticAttrib],
@@ -99,7 +99,7 @@ class StaticAttrib(Generic[_T]):
99
99
  ) -> None:
100
100
  """Set value and mesh."""
101
101
  self._value = value
102
- self.mesh = mesh
102
+ self._mesh = mesh
103
103
 
104
104
  def copy_to_element(
105
105
  self: StaticAttrib[_T], mesh: BlindHalfEdges
@@ -127,6 +127,18 @@ class StaticAttrib(Generic[_T]):
127
127
  msg = "no value set and failed to infer from 'self.mesh'"
128
128
  raise AttributeError(msg)
129
129
 
130
+ @property
131
+ def mesh(self) -> BlindHalfEdges:
132
+ """Return the mesh to which this attribute is assigned.
133
+
134
+ :return: BlindHalfEdges instance
135
+ :raise AttributeError: If no mesh is set
136
+ """
137
+ if self._mesh is None:
138
+ msg = "no mesh set"
139
+ raise AttributeError(msg)
140
+ return self._mesh
141
+
130
142
  def _infer_value(self) -> _T:
131
143
  """Get value of self from self._mesh.
132
144
 
@@ -181,7 +193,7 @@ class Attrib(Generic[_T]):
181
193
  every case.
182
194
  """
183
195
 
184
- __slots__ = ("_value", "element")
196
+ __slots__ = ("_value", "_element")
185
197
 
186
198
  def __new__(
187
199
  cls: type[_TAttrib],
@@ -201,7 +213,7 @@ class Attrib(Generic[_T]):
201
213
  ) -> None:
202
214
  """Set value and element."""
203
215
  self._value = value
204
- self.element = element
216
+ self._element = element
205
217
 
206
218
  @property
207
219
  def value(self) -> _T:
@@ -219,6 +231,18 @@ class Attrib(Generic[_T]):
219
231
  msg = "no value set and failed to infer from 'self.element'"
220
232
  raise AttributeError(msg)
221
233
 
234
+ @property
235
+ def element(self) -> MeshElementBase:
236
+ """Return the element to which this attribute is assigned.
237
+
238
+ :return: MeshElementBase instance
239
+ :raise AttributeError: If no element is set
240
+ """
241
+ if self._element is None:
242
+ msg = "no element set"
243
+ raise AttributeError(msg)
244
+ return self._element
245
+
222
246
  def copy_to_element(self: Attrib[_T], element: MeshElementBase) -> Attrib[_T]:
223
247
  """Return a new instance with the same value, assigned to a new element.
224
248
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halfedge
3
- Version: 0.5.1
3
+ Version: 0.7.0
4
4
  Summary: A typical half-edge data structure with some padding
5
5
  Author-email: Shay Hill <shay_public@hotmail.com>
6
6
  License: MIT
@@ -1,12 +1,12 @@
1
1
  halfedge/__init__.py,sha256=O5tfw3JIBJH83JlpwdYoTNHFsmcg959rAJd6RU51E4s,661
2
2
  halfedge/half_edge_constructors.py,sha256=ToGcOYW2b848ynlY59xRNd7ibZuu3OqQpauPCl-N1YE,8654
3
- halfedge/half_edge_elements.py,sha256=6PkPjGxe_0FYSWXi5MY8Yp4an7yYMWir8MPZn8QlUOc,18042
3
+ halfedge/half_edge_elements.py,sha256=oX4ti6f6L1gcYsoP-KGNwdF4-cRpTJeBoMGMTJuIN14,18554
4
4
  halfedge/half_edge_object.py,sha256=Cc1t_hy2tF52O9iD5tvZN6_w4H7Wt9hwDGFLdBqUxr4,28451
5
5
  halfedge/half_edge_querries.py,sha256=q5xVOFdpw7t6fhs-Z8yF5j3RlG4DOrOgoLbBsAfkm4A,5179
6
6
  halfedge/py.typed,sha256=MsSFjiLMLJZ7QhUPpVBWKiyDnCzryquRyr329NoCACI,2
7
- halfedge/type_attrib.py,sha256=bo0Tw-9dhvi0XwehaYY9WowEZuRKlg07Vx0vRuJtDPw,19702
7
+ halfedge/type_attrib.py,sha256=1W06nlyTSc0Q6f6PnQec_VNNRLVSgdNStoBlJmMgJNQ,20420
8
8
  halfedge/validations.py,sha256=FhUv_J7XcaAduyudYGmi7ZL1tEqwJoCxKZwJU2zQolg,4512
9
- halfedge-0.5.1.dist-info/METADATA,sha256=0p_OCw3YXuTavQt879G_uThY4dWSGMZwc5I7fFN3uBc,7411
10
- halfedge-0.5.1.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
11
- halfedge-0.5.1.dist-info/top_level.txt,sha256=iqphKHiIR4DfFMs14-gkFOWTXVkRWfGmDZmCYHhuoFM,9
12
- halfedge-0.5.1.dist-info/RECORD,,
9
+ halfedge-0.7.0.dist-info/METADATA,sha256=UYimfFRmGpY38Ipy9QgOqWwrW28El8aKnTybjhjKQVc,7411
10
+ halfedge-0.7.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
11
+ halfedge-0.7.0.dist-info/top_level.txt,sha256=iqphKHiIR4DfFMs14-gkFOWTXVkRWfGmDZmCYHhuoFM,9
12
+ halfedge-0.7.0.dist-info/RECORD,,