Skip to content

Commit 3b93f7f

Browse files
committed
fix: 🐛 add default solver to discrete interpolator
1 parent 51dc6ff commit 3b93f7f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

LoopStructural/interpolators/_discrete_interpolator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, support):
4545
# self.col = []
4646
# self.row = [] # sparse matrix storage
4747
# self.w = []
48-
self.solver = None
48+
self.solver = "cg"
4949

5050
self.eq_const_C = []
5151
self.eq_const_row = []
@@ -802,6 +802,7 @@ def _solve(self, solver="cg", **kwargs):
802802
logging.info(
803803
f"Solving interpolation: {self.propertyname} took: {time()-starttime}"
804804
)
805+
self.up_to_date = True
805806

806807
def update(self):
807808
"""
@@ -815,6 +816,7 @@ def update(self):
815816
bool
816817
817818
"""
819+
818820
if self.solver is None:
819821
logging.debug("Cannot rerun interpolator")
820822
return False
@@ -835,6 +837,7 @@ def evaluate_value(self, evaluation_points: np.ndarray) -> np.ndarray:
835837
np.ndarray
836838
value of the interpolator
837839
"""
840+
self.update()
838841
evaluation_points = np.array(evaluation_points)
839842
evaluated = np.zeros(evaluation_points.shape[0])
840843
mask = np.any(evaluation_points == np.nan, axis=1)
@@ -857,6 +860,7 @@ def evaluate_gradient(self, evaluation_points: np.ndarray) -> np.ndarray:
857860
-------
858861
859862
"""
863+
self.update()
860864
if evaluation_points.shape[0] > 0:
861865
return self.support.evaluate_gradient(evaluation_points, self.c)
862866
return np.zeros((0, 3))

0 commit comments

Comments
 (0)