@@ -111,11 +111,22 @@ where
111111
112112 /// View interpolator data.
113113 pub fn view ( & self ) -> InterpDataNDViewed < & D :: Elem > {
114- InterpDataND {
114+ InterpDataNDViewed {
115115 grid : self . grid . iter ( ) . map ( |g| g. view ( ) ) . collect ( ) ,
116116 values : self . values . view ( ) ,
117117 }
118118 }
119+
120+ /// Turn the data into an [`InterpDataNDOwned`], cloning the array elements if necessary.
121+ pub fn into_owned ( self ) -> InterpDataNDOwned < D :: Elem >
122+ where
123+ D :: Elem : Clone ,
124+ {
125+ InterpDataNDOwned {
126+ grid : self . grid . into_iter ( ) . map ( |g| g. into_owned ( ) ) . collect ( ) ,
127+ values : self . values . into_owned ( ) ,
128+ }
129+ }
119130}
120131
121132/// N-D interpolator
@@ -233,12 +244,25 @@ where
233244 S : for < ' a > StrategyND < ViewRepr < & ' a D :: Elem > > ,
234245 D :: Elem : Clone ,
235246 {
236- InterpND {
247+ InterpNDViewed {
237248 data : self . data . view ( ) ,
238249 strategy : self . strategy . clone ( ) ,
239250 extrapolate : self . extrapolate . clone ( ) ,
240251 }
241252 }
253+
254+ /// Turn the interpolator into an [`InterpNDOwned`], cloning the array elements if necessary.
255+ pub fn into_owned ( self ) -> InterpNDOwned < D :: Elem , S >
256+ where
257+ S : StrategyND < OwnedRepr < D :: Elem > > ,
258+ D :: Elem : Clone ,
259+ {
260+ InterpNDOwned {
261+ data : self . data . into_owned ( ) ,
262+ strategy : self . strategy . clone ( ) ,
263+ extrapolate : self . extrapolate . clone ( ) ,
264+ }
265+ }
242266}
243267
244268impl < D , S > Interpolator < D :: Elem > for InterpND < D , S >
0 commit comments