Skip to content

Commit 8277304

Browse files
committed
fix: change pyvista property to vtk
1 parent 6bfadc5 commit 8277304

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

LoopStructural/datatypes/_bounding_box.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22
from typing import Optional
33
from LoopStructural.utils.exceptions import LoopValueError
4+
from LoopStructural.utils import rng
45
import numpy as np
56

67

@@ -27,14 +28,8 @@ def __init__(
2728
nsteps : Optional[np.ndarray], optional
2829
_description_, by default None
2930
"""
30-
# if origin is None:
31-
# raise LoopValueError("Origin is not set")
3231
if maximum is None and nsteps is not None and step_vector is not None:
3332
maximum = origin + nsteps * step_vector
34-
# if maximum is None:
35-
# raise LoopValueError(
36-
# "Maximum is not set, either specify nsteps and step vector or maximum"
37-
# )
3833
self._origin = np.array(origin)
3934
self._maximum = np.array(maximum)
4035
self.dimensions = dimensions
@@ -100,7 +95,6 @@ def nelements(self, nelements):
10095
# calculate the step vector of a regular cube
10196
step_vector = np.zeros(3)
10297
step_vector[:] = ele_vol ** (1.0 / 3.0)
103-
# step_vector /= np.array([1,1,2])
10498
# number of steps is the length of the box / step vector
10599
nsteps = np.ceil((self.maximum - self.origin) / step_vector).astype(int)
106100
self.nsteps = nsteps
@@ -196,6 +190,5 @@ def regular_grid(self, nsteps=None, shuffle=False, order="C"):
196190
[xx.flatten(order=order), yy.flatten(order=order), zz.flatten(order=order)]
197191
).T
198192
if shuffle:
199-
# logger.info("Shuffling points")
200-
np.random.Generator.shuffle(locs)
193+
rng.shuffle(locs)
201194
return locs

LoopStructural/interpolators/supports/_3d_base_structured.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ def global_cell_indices(self, indexes) -> np.ndarray:
439439
"""
440440
return self._global_indicies(indexes, self.nsteps_cells)
441441

442-
def pyvista(self):
442+
@property
443+
def vtk(self):
443444
try:
444445
import pyvista as pv
445446
except ImportError:

0 commit comments

Comments
 (0)