Skip to content

Commit 8869f2e

Browse files
committed
speed optimization
1 parent 017d184 commit 8869f2e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/pyinterpolate/core/data_models/point_support.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ def get_points_array(self, block_id=None) -> np.ndarray:
267267
else:
268268
ps = self.point_support[
269269
self.point_support[
270-
self.point_support_blocks_index_name] == block_id
270+
self.point_support_blocks_index_name
271+
] == block_id
271272
]
272273
return ps[
273274
[self._lon_col_name,

src/pyinterpolate/core/data_models/point_support_distances.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def calc_pair_distances(self,
9898
Distances between point supports from two blocks.
9999
"""
100100

101+
if block_pair in self._calculated_block_pairs:
102+
return self.distances_between_point_supports[block_pair]
103+
101104
block_a = block_pair[0]
102105
block_b = block_pair[1]
103106

@@ -109,7 +112,6 @@ def calc_pair_distances(self,
109112
points_b)
110113

111114
# Update distances
112-
113115
if update:
114116
if block_pair not in self._calculated_block_pairs:
115117
self.distances_between_point_supports.update(

0 commit comments

Comments
 (0)