Skip to content

Commit 5d050ca

Browse files
committed
fix: updating product to prod
1 parent 0d383cf commit 5d050ca

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

LoopStructural/interpolators/_builders.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
FiniteDifferenceInterpolator,
88
GeologicalInterpolator,
99
DiscreteInterpolator,
10+
DiscreteFoldInterpolator,
1011
StructuredGrid,
1112
TetMesh,
1213
)
@@ -31,7 +32,7 @@ def get_interpolator(
3132
# buffer = bb[1, :]
3233
origin = bounding_box.with_buffer(buffer).origin
3334
maximum = bounding_box.with_buffer(buffer).maximum
34-
box_vol = np.product(maximum - origin)
35+
box_vol = np.prod(maximum - origin)
3536
if interpolatortype == "PLI":
3637
if support is None:
3738
if element_volume is None:
@@ -98,6 +99,23 @@ def get_interpolator(
9899
"for modelling using FDI"
99100
)
100101
return FiniteDifferenceInterpolator(grid)
102+
if interpolatortype == "DFI":
103+
if element_volume is None:
104+
nelements /= 5
105+
element_volume = box_vol / nelements
106+
# calculate the step vector of a regular cube
107+
step_vector = np.zeros(3)
108+
step_vector[:] = element_volume ** (1.0 / 3.0)
109+
# number of steps is the length of the box / step vector
110+
nsteps = np.ceil((maximum - origin) / step_vector).astype(int)
111+
# create a structured grid using the origin and number of steps
112+
113+
mesh = TetMesh(origin=origin, nsteps=nsteps, step_vector=step_vector)
114+
logger.info(
115+
f"Creating regular tetrahedron mesh with {mesh.ntetra} elements \n"
116+
"for modelling using DFI"
117+
)
118+
return DiscreteFoldInterpolator(mesh, None)
101119
raise LoopException("No interpolator")
102120
# fi interpolatortype == "DFI" and dfi is True:
103121
# if element_volume is None:

LoopStructural/interpolators/supports/_3d_base_structured.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ def maximum(self, maximum):
134134

135135
@property
136136
def n_nodes(self):
137-
return np.product(self.nsteps)
137+
return np.prod(self.nsteps)
138138

139139
@property
140140
def n_elements(self):
141-
return np.product(self.nsteps_cells)
141+
return np.prod(self.nsteps_cells)
142142

143143
def __str__(self):
144144
return (

LoopStructural/interpolators/supports/_3d_structured_tetra.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ def __init__(
3232

3333
@property
3434
def ntetra(self) -> int:
35-
return np.product(self.nsteps_cells) * 5
35+
return np.prod(self.nsteps_cells) * 5
3636

3737
@property
3838
def n_elements(self) -> int:
3939
return self.ntetra
4040

4141
@property
4242
def n_cells(self) -> int:
43-
return np.product(self.nsteps_cells)
43+
return np.prod(self.nsteps_cells)
4444

4545
@property
4646
def barycentre(self) -> np.ndarray:

LoopStructural/interpolators/supports/_3d_unstructured_tetra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(
6060
self.minimum -= length * 0.1
6161
self.maximum += length * 0.1
6262
if aabb_nsteps == None:
63-
box_vol = np.product(self.maximum - self.minimum)
63+
box_vol = np.prod(self.maximum - self.minimum)
6464
element_volume = box_vol / (len(self.elements) / 20)
6565
# calculate the step vector of a regular cube
6666
step_vector = np.zeros(3)

0 commit comments

Comments
 (0)