Skip to content

Commit 44cc8fb

Browse files
committed
fix: adding ones column for constraints when weights missing
1 parent 72e2f06 commit 44cc8fb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

LoopStructural/interpolators/_geological_interpolator.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def set_value_constraints(self, points: np.ndarray):
106106
107107
"""
108108
points = self.check_array(points)
109+
if points.shape[1] == 4:
110+
points = np.hstack([points, np.ones((points.shape[0], 1))])
109111
if points.shape[1] < 5:
110112
raise ValueError("Value points must at least have X,Y,Z,val,w")
111113
self.data["value"] = points
@@ -125,7 +127,9 @@ def set_gradient_constraints(self, points: np.ndarray):
125127
-------
126128
127129
"""
128-
if points.shape[1] < 6:
130+
if points.shape[1] == 6:
131+
points = np.hstack([points, np.ones((points.shape[0], 1))])
132+
if points.shape[1] < 7:
129133
raise ValueError("Gradient constraints must at least have X,Y,Z,gx,gy,gz")
130134
self.n_g = points.shape[0]
131135
self.data["gradient"] = points
@@ -144,7 +148,9 @@ def set_normal_constraints(self, points: np.ndarray):
144148
-------
145149
146150
"""
147-
if points.shape[1] < 6:
151+
if points.shape[1] == 6:
152+
points = np.hstack([points, np.ones((points.shape[0], 1))])
153+
if points.shape[1] < 7:
148154
raise ValueError("Nonrmal constraints must at least have X,Y,Z,nx,ny,nz")
149155
self.n_n = points.shape[0]
150156
self.data["normal"] = points
@@ -163,7 +169,9 @@ def set_tangent_constraints(self, points: np.ndarray):
163169
-------
164170
165171
"""
166-
if points.shape[1] < 6:
172+
if points.shape[1] == 6:
173+
points = np.hstack([points, np.ones((points.shape[0], 1))])
174+
if points.shape[1] < 7:
167175
raise ValueError("Tangent constraints must at least have X,Y,Z,tx,ty,tz")
168176
self.data["tangent"] = points
169177
self.up_to_date = False

0 commit comments

Comments
 (0)