File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
LoopStructural/interpolators/supports Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,15 @@ def origin(self, origin):
134134 origin = np .array (origin )
135135 length = self .maximum - origin
136136 length /= self .step_vector
137- self ._nsteps = np .ceil (length ).astype (int )
137+ self ._nsteps = np .ceil (length ).astype (np .int64 )
138+ self ._nsteps [self ._nsteps == 0 ] = (
139+ 3 # need to have a minimum of 3 elements to apply the finite difference mask
140+ )
141+ if np .any (~ (self ._nsteps > 0 )):
142+ logger .error (
143+ f"Cannot resize the interpolation support. The proposed number of steps is { self ._nsteps } , these must be all > 0"
144+ )
145+ raise ValueError ("Cannot resize the interpolation support." )
138146 self ._origin = origin
139147 self .onGeometryChange ()
140148
@@ -150,7 +158,8 @@ def maximum(self, maximum):
150158 maximum = np .array (maximum , dtype = float )
151159 length = maximum - self .origin
152160 length /= self .step_vector
153- self ._nsteps = np .ceil (length ).astype (np .int64 ) + 1
161+ self ._nsteps = np .ceil (length ).astype (np .int64 )
162+ self ._nsteps [self ._nsteps == 0 ] = 3
154163 if np .any (~ (self ._nsteps > 0 )):
155164 logger .error (
156165 f"Cannot resize the interpolation support. The proposed number of steps is { self ._nsteps } , these must be all > 0"
You can’t perform that action at this time.
0 commit comments