42 linearInterpolationWeights,
60 if (s < -SMALL || s > 1+SMALL)
63 <<
"Value " << t <<
" outside range " <<
samples_[i]
70 return Pair<scalar>(d*0.5*(1-
s), d*0.5*(1+
s));
95 bool indexChanged =
false;
101 && index_ < samples_.size()
103 samples_[index_] <= t
104 && (index_ == samples_.size()-1 || t <= samples_[index_+1])
126 else if (index_ == samples_.size()-1)
131 indices[0] = samples_.size()-1;
141 indices[1] = index_+1;
143 scalar t0 = samples_[indices[0]];
144 scalar t1 = samples_[indices[1]];
145 scalar deltaT = t1-t0;
147 weights[0] = (t1-t)/deltaT;
148 weights[1] = 1.0-weights[0];
155 bool Foam::linearInterpolationWeights::integrationWeights
163 if (t2 < t1 - ROOTVSMALL)
166 <<
"Integration should be in positive direction."
167 <<
" t1:" << t1 <<
" t2:" << t2
176 if (t2 <= t1 + ROOTVSMALL)
180 bool anyChanged = (indices.size() != 1 || indices[0] != i1);
185 weights[0] = scalar(0);
191 const label i2 =
findLower(samples_, t2);
194 if (i1 == -1 || i2 == samples_.size()-1)
197 <<
"Integrating outside table " << samples_[0] <<
".."
198 << samples_.last() <<
" not implemented."
202 const label nIndices = i2-i1+2;
206 bool anyChanged =
false;
208 if (nIndices != indices.size())
219 if (indices[i] != index)
229 weights.setSize(nIndices);
233 for (label i = i1+1; i <= i2; i++)
235 const scalar d = samples_[i+1]-samples_[i];
237 weights[i-i1] += 0.5*d;
238 indices[i+1-i1] = i+1;
239 weights[i+1-i1] += 0.5*d;
247 weights[0] += i1Tot1.first();
248 weights[1] += i1Tot1.
second();
255 indices[i2-i1+1] = i2+1;
256 weights[i2-i1] += -wghts.first();
257 weights[i2-i1+1] += -wghts.
second();