Skip to content

Commit 5e51e7c

Browse files
committed
Merge branch 'master' into fix/model-data
2 parents c837d6c + 8a2ec05 commit 5e51e7c

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

LoopStructural/datatypes/_bounding_box.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,10 @@ def reproject(self, xyz, inplace=False):
547547
return xyz + self.global_origin
548548

549549
def __repr__(self):
550-
return f"BoundingBox({self.origin}, {self.maximum}, {self.nsteps})"
550+
return f"BoundingBox(origin:{self.origin}, maximum:{self.maximum}, nsteps:{self.nsteps})"
551551

552552
def __str__(self):
553-
return f"BoundingBox({self.origin}, {self.maximum}, {self.nsteps})"
553+
return f"BoundingBox(origin:{self.origin}, maximum:{self.maximum}, nsteps:{self.nsteps})"
554554

555555
def __eq__(self, other):
556556
if not isinstance(other, BoundingBox):

LoopStructural/interpolators/supports/_2d_structured_grid.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,22 @@ def node_indexes_to_position(self, node_indexes: np.ndarray) -> np.ndarray:
372372
return xy
373373

374374
def position_to_cell_corners(self, pos):
375+
"""Get the global indices of the vertices (corner) nodes of the cell containing each point.
376+
377+
Parameters
378+
----------
379+
pos : np.array
380+
(N, 2) array of xy coordinates representing the positions of N points.
381+
382+
Returns
383+
-------
384+
globalidx : np.array
385+
(N, 4) array of global indices corresponding to the 4 corner nodes of the cell
386+
each point lies in. If a point lies outside the support, its corresponding entry
387+
will be set to -1.
388+
inside : np.array
389+
(N,) boolean array indicating whether each point is inside the support domain.
390+
"""
375391
corner_index, inside = self.position_to_cell_index(pos)
376392
corners = self.cell_corner_indexes(corner_index)
377393
globalidx = self.global_node_indices(corners)

LoopStructural/interpolators/supports/_3d_base_structured.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,22 @@ def cell_corner_indexes(self, cell_indexes: np.ndarray) -> np.ndarray:
373373
return corner_indexes
374374

375375
def position_to_cell_corners(self, pos):
376+
"""Get the global indices of the vertices (corners) of the cell containing each point.
377+
378+
Parameters
379+
----------
380+
pos : np.array
381+
(N, 3) array of xyz coordinates representing the positions of N points.
382+
383+
Returns
384+
-------
385+
globalidx : np.array
386+
(N, 8) array of global indices corresponding to the 8 corner nodes of the cell
387+
each point lies in. If a point lies outside the support, its corresponding entry
388+
will be set to -1.
389+
inside : np.array
390+
(N,) boolean array indicating whether each point is inside the support domain.
391+
"""
376392
cell_indexes, inside = self.position_to_cell_index(pos)
377393
corner_indexes = self.cell_corner_indexes(cell_indexes)
378394
globalidx = self.global_node_indices(corner_indexes)

0 commit comments

Comments
 (0)