Skip to content

Commit

Permalink
fix: adding clean function to interpolator
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Feb 9, 2023
1 parent bfa90ac commit d0de548
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions LoopStructural/interpolators/_geological_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,9 @@ def __init__(self):
this should be callable by using any of these functions. This will
enable interpolators to be interchanged.
"""
self.data = {} # None
self.clean() # init data structure

self.data = {
"gradient": np.zeros((0, 7)),
"value": np.zeros((0, 5)),
"normal": np.zeros((0, 7)),
"tangent": np.zeros((0, 7)),
"interface": np.zeros((0, 5)),
"inequality": np.zeros((0, 6)),
}
self.n_g = 0
self.n_i = 0
self.n_n = 0
Expand Down Expand Up @@ -200,7 +194,7 @@ def get_data_locations(self):
numpy array
Nx3 - X,Y,Z location of all data points
"""
return np.vstack([d for d in self.data.values()[:, :3]])
return np.vstack([d[:, :3] for d in self.data.values()])

def get_interface_constraints(self):
"""Get the location of interface constraints
Expand Down Expand Up @@ -231,14 +225,23 @@ def solve_system(self, **kwargs):
def update(self):
return False

def reset(self):
def clean(self):
"""
Removes all of the data from an interpolator
Returns
-------
"""
self.data = {
"gradient": np.zeros((0, 7)),
"value": np.zeros((0, 5)),
"normal": np.zeros((0, 7)),
"tangent": np.zeros((0, 7)),
"interface": np.zeros((0, 5)),
"inequality": np.zeros((0, 6)),
}
self.up_to_date = False
self.n_g = 0
self.n_i = 0
self.n_n = 0
Expand Down

0 comments on commit d0de548

Please sign in to comment.