Skip to content

Commit ba4548e

Browse files
committed
Merge branch 'main' into cubic
2 parents 9968ebe + 31c179e commit ba4548e

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed

src/n/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ where
190190
fn validate(&self) -> Result<(), ValidateError> {
191191
self.check_extrapolate(&self.extrapolate)?;
192192
self.data.validate()?;
193+
self.strategy.init(&self.data)?;
193194
Ok(())
194195
}
195196

src/one/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ where
126126
fn validate(&self) -> Result<(), ValidateError> {
127127
self.check_extrapolate(&self.extrapolate)?;
128128
self.data.validate()?;
129+
self.strategy.init(&self.data)?;
129130
Ok(())
130131
}
131132

src/strategy.rs

+40
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ where
77
D: Data + RawDataClone + Clone,
88
D::Elem: PartialEq + Debug,
99
{
10+
fn init(&self, _data: &InterpData1D<D>) -> Result<(), ValidateError> {
11+
Ok(())
12+
}
13+
1014
fn interpolate(
1115
&self,
1216
data: &InterpData1D<D>,
1317
point: &[D::Elem; 1],
1418
) -> Result<D::Elem, InterpolateError>;
19+
1520
/// Does this type's [`Strategy1D::interpolate`] provision for extrapolation?
1621
fn allow_extrapolate(&self) -> bool;
1722
}
@@ -23,13 +28,18 @@ where
2328
D: Data + RawDataClone + Clone,
2429
D::Elem: PartialEq + Debug,
2530
{
31+
fn init(&self, data: &InterpData1D<D>) -> Result<(), ValidateError> {
32+
(**self).init(data)
33+
}
34+
2635
fn interpolate(
2736
&self,
2837
data: &InterpData1D<D>,
2938
point: &[D::Elem; 1],
3039
) -> Result<D::Elem, InterpolateError> {
3140
(**self).interpolate(data, point)
3241
}
42+
3343
fn allow_extrapolate(&self) -> bool {
3444
(**self).allow_extrapolate()
3545
}
@@ -40,11 +50,16 @@ where
4050
D: Data + RawDataClone + Clone,
4151
D::Elem: PartialEq + Debug,
4252
{
53+
fn init(&self, _data: &InterpData2D<D>) -> Result<(), ValidateError> {
54+
Ok(())
55+
}
56+
4357
fn interpolate(
4458
&self,
4559
data: &InterpData2D<D>,
4660
point: &[D::Elem; 2],
4761
) -> Result<D::Elem, InterpolateError>;
62+
4863
/// Does this type's [`Strategy2D::interpolate`] provision for extrapolation?
4964
fn allow_extrapolate(&self) -> bool;
5065
}
@@ -56,13 +71,18 @@ where
5671
D: Data + RawDataClone + Clone,
5772
D::Elem: PartialEq + Debug,
5873
{
74+
fn init(&self, data: &InterpData2D<D>) -> Result<(), ValidateError> {
75+
(**self).init(data)
76+
}
77+
5978
fn interpolate(
6079
&self,
6180
data: &InterpData2D<D>,
6281
point: &[D::Elem; 2],
6382
) -> Result<D::Elem, InterpolateError> {
6483
(**self).interpolate(data, point)
6584
}
85+
6686
fn allow_extrapolate(&self) -> bool {
6787
(**self).allow_extrapolate()
6888
}
@@ -73,11 +93,16 @@ where
7393
D: Data + RawDataClone + Clone,
7494
D::Elem: PartialEq + Debug,
7595
{
96+
fn init(&self, _data: &InterpData3D<D>) -> Result<(), ValidateError> {
97+
Ok(())
98+
}
99+
76100
fn interpolate(
77101
&self,
78102
data: &InterpData3D<D>,
79103
point: &[D::Elem; 3],
80104
) -> Result<D::Elem, InterpolateError>;
105+
81106
/// Does this type's [`Strategy3D::interpolate`] provision for extrapolation?
82107
fn allow_extrapolate(&self) -> bool;
83108
}
@@ -89,13 +114,18 @@ where
89114
D: Data + RawDataClone + Clone,
90115
D::Elem: PartialEq + Debug,
91116
{
117+
fn init(&self, data: &InterpData3D<D>) -> Result<(), ValidateError> {
118+
(**self).init(data)
119+
}
120+
92121
fn interpolate(
93122
&self,
94123
data: &InterpData3D<D>,
95124
point: &[D::Elem; 3],
96125
) -> Result<D::Elem, InterpolateError> {
97126
(**self).interpolate(data, point)
98127
}
128+
99129
fn allow_extrapolate(&self) -> bool {
100130
(**self).allow_extrapolate()
101131
}
@@ -106,11 +136,16 @@ where
106136
D: Data + RawDataClone + Clone,
107137
D::Elem: PartialEq + Debug,
108138
{
139+
fn init(&self, _data: &InterpDataND<D>) -> Result<(), ValidateError> {
140+
Ok(())
141+
}
142+
109143
fn interpolate(
110144
&self,
111145
data: &InterpDataND<D>,
112146
point: &[D::Elem],
113147
) -> Result<D::Elem, InterpolateError>;
148+
114149
/// Does this type's [`StrategyND::interpolate`] provision for extrapolation?
115150
fn allow_extrapolate(&self) -> bool;
116151
}
@@ -122,13 +157,18 @@ where
122157
D: Data + RawDataClone + Clone,
123158
D::Elem: PartialEq + Debug,
124159
{
160+
fn init(&self, data: &InterpDataND<D>) -> Result<(), ValidateError> {
161+
(**self).init(data)
162+
}
163+
125164
fn interpolate(
126165
&self,
127166
data: &InterpDataND<D>,
128167
point: &[D::Elem],
129168
) -> Result<D::Elem, InterpolateError> {
130169
(**self).interpolate(data, point)
131170
}
171+
132172
fn allow_extrapolate(&self) -> bool {
133173
(**self).allow_extrapolate()
134174
}

src/three/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ where
145145
fn validate(&self) -> Result<(), ValidateError> {
146146
self.check_extrapolate(&self.extrapolate)?;
147147
self.data.validate()?;
148+
self.strategy.init(&self.data)?;
148149
Ok(())
149150
}
150151

src/two/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ where
131131
fn validate(&self) -> Result<(), ValidateError> {
132132
self.check_extrapolate(&self.extrapolate)?;
133133
self.data.validate()?;
134+
self.strategy.init(&self.data)?;
134135
Ok(())
135136
}
136137

0 commit comments

Comments
 (0)