From 4a493f6e1d3cfd9cc762d2a9b461179997534090 Mon Sep 17 00:00:00 2001 From: AxMeNi <159522803+AxMeNi@users.noreply.github.com> Date: Mon, 16 Jun 2025 09:50:52 +1000 Subject: [PATCH 1/3] Modified str method of _bounding_box for clarity --- LoopStructural/datatypes/_bounding_box.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LoopStructural/datatypes/_bounding_box.py b/LoopStructural/datatypes/_bounding_box.py index a2e1eb25..c4ea65eb 100644 --- a/LoopStructural/datatypes/_bounding_box.py +++ b/LoopStructural/datatypes/_bounding_box.py @@ -547,10 +547,10 @@ def reproject(self, xyz, inplace=False): return xyz + self.global_origin def __repr__(self): - return f"BoundingBox({self.origin}, {self.maximum}, {self.nsteps})" + return f"BoundingBox(origin:{self.origin}, maximum:{self.maximum}, nsteps:{self.nsteps})" def __str__(self): - return f"BoundingBox({self.origin}, {self.maximum}, {self.nsteps})" + return f"BoundingBox(origin:{self.origin}, maximum:{self.maximum}, nsteps:{self.nsteps})" def __eq__(self, other): if not isinstance(other, BoundingBox): From 0c1c16cce88580d1168daf141f7230ee5ceee23b Mon Sep 17 00:00:00 2001 From: AxMeNi <159522803+AxMeNi@users.noreply.github.com> Date: Wed, 18 Jun 2025 14:23:34 +1000 Subject: [PATCH 2/3] Update _3d_base_structured.py --- .../supports/_3d_base_structured.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/LoopStructural/interpolators/supports/_3d_base_structured.py b/LoopStructural/interpolators/supports/_3d_base_structured.py index 4c91322c..621da7be 100644 --- a/LoopStructural/interpolators/supports/_3d_base_structured.py +++ b/LoopStructural/interpolators/supports/_3d_base_structured.py @@ -373,6 +373,22 @@ def cell_corner_indexes(self, cell_indexes: np.ndarray) -> np.ndarray: return corner_indexes def position_to_cell_corners(self, pos): + """Get the global indices of the vertices (corners) of the cell containing each point. + + Parameters + ---------- + pos : np.array + (N, 3) array of xyz coordinates representing the positions of N points. + + Returns + ------- + globalidx : np.array + (N, 8) array of global indices corresponding to the 8 corner nodes of the cell + each point lies in. If a point lies outside the support, its corresponding entry + will be set to -1. + inside : np.array + (N,) boolean array indicating whether each point is inside the support domain. + """ cell_indexes, inside = self.position_to_cell_index(pos) corner_indexes = self.cell_corner_indexes(cell_indexes) globalidx = self.global_node_indices(corner_indexes) From 22f73fffa97017a126ee3e2c9a91c6534c5267a6 Mon Sep 17 00:00:00 2001 From: AxMeNi <159522803+AxMeNi@users.noreply.github.com> Date: Wed, 18 Jun 2025 14:25:19 +1000 Subject: [PATCH 3/3] Update _2d_structured_grid.py --- .../supports/_2d_structured_grid.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/LoopStructural/interpolators/supports/_2d_structured_grid.py b/LoopStructural/interpolators/supports/_2d_structured_grid.py index 61e8d825..3731c306 100644 --- a/LoopStructural/interpolators/supports/_2d_structured_grid.py +++ b/LoopStructural/interpolators/supports/_2d_structured_grid.py @@ -372,6 +372,22 @@ def node_indexes_to_position(self, node_indexes: np.ndarray) -> np.ndarray: return xy def position_to_cell_corners(self, pos): + """Get the global indices of the vertices (corner) nodes of the cell containing each point. + + Parameters + ---------- + pos : np.array + (N, 2) array of xy coordinates representing the positions of N points. + + Returns + ------- + globalidx : np.array + (N, 4) array of global indices corresponding to the 4 corner nodes of the cell + each point lies in. If a point lies outside the support, its corresponding entry + will be set to -1. + inside : np.array + (N,) boolean array indicating whether each point is inside the support domain. + """ corner_index, inside = self.position_to_cell_index(pos) corners = self.cell_corner_indexes(corner_index) globalidx = self.global_node_indices(corners)