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
166 <<
"Integration should be in positive direction."
167 <<
" t1:" << t1 <<
" t2:" << t2
177 const label i2 =
findLower(samples_, t2);
180 if (i1 == -1 || i2 == samples_.size()-1)
183 <<
"Integrating outside table " << samples_[0] <<
".."
184 << samples_.last() <<
" not implemented."
188 const label nIndices = i2-i1+2;
192 bool anyChanged =
false;
194 if (nIndices != indices.size())
205 if (indices[i] != index)
215 weights.setSize(nIndices);
219 for (label i = i1+1; i <= i2; i++)
221 const scalar d = samples_[i+1]-samples_[i];
223 weights[i-i1] += 0.5*d;
224 indices[i+1-i1] = i+1;
225 weights[i+1-i1] += 0.5*d;
233 weights[0] += i1Tot1.first();
234 weights[1] += i1Tot1.
second();
241 indices[i2-i1+1] = i2+1;
242 weights[i2-i1] += -wghts.first();
243 weights[i2-i1+1] += -wghts.
second();