39 fileName fName(fileName_);
44 reader_()(fName, *
this);
49 <<
"table read from " << fName <<
" is empty" <<
nl
65 fileName_(
"fileNameIsUndefined"),
125 bounding_(interpTable.bounding_),
126 fileName_(interpTable.fileName_),
127 reader_(interpTable.reader_)
142 for (
const auto& item : list)
144 const scalar& currValue = item.first();
147 if (i && currValue <= prevValue)
150 <<
"out-of-order value: "
151 << currValue <<
" at index " << i <<
nl
154 prevValue = currValue;
177 const label n = list.size();
185 const scalar minLimit = list.first().first();
186 const scalar maxLimit = list.last().first();
188 if (lookupValue < minLimit)
192 case bounds::repeatableBounding::ERROR:
195 <<
"value (" << lookupValue <<
") less than lower "
196 <<
"bound (" << minLimit <<
")\n"
200 case bounds::repeatableBounding::WARN:
203 <<
"value (" << lookupValue <<
") less than lower "
204 <<
"bound (" << minLimit <<
")\n"
205 <<
" Zero rate of change." <<
endl;
211 case bounds::repeatableBounding::CLAMP:
216 case bounds::repeatableBounding::REPEAT:
219 scalar span = maxLimit-minLimit;
220 lookupValue = fmod(lookupValue - minLimit, span) + minLimit;
225 else if (lookupValue >= maxLimit)
229 case bounds::repeatableBounding::ERROR:
232 <<
"value (" << lookupValue <<
") greater than upper "
233 <<
"bound (" << maxLimit <<
")\n"
237 case bounds::repeatableBounding::WARN:
240 <<
"value (" << lookupValue <<
") greater than upper "
241 <<
"bound (" << maxLimit <<
")\n"
242 <<
" Zero rate of change." <<
endl;
248 case bounds::repeatableBounding::CLAMP:
253 case bounds::repeatableBounding::REPEAT:
256 scalar span = maxLimit-minLimit;
257 lookupValue = fmod(lookupValue - minLimit, span) + minLimit;
267 for (
label i = 0; i <
n; ++i)
269 if (lookupValue >= list[i].first())
295 (list[hi].second() - list[lo].second())
296 / (list[hi].first() + minLimit - list[lo].first())
304 (list[hi].second() - list[lo].second())
305 / (list[hi].first() - list[lo].first())
318 const label n = list.size();
326 <<
"Cannot interpolate from zero-sized table" <<
nl
331 return list.first().second();
334 const scalar minLimit = list.first().first();
335 const scalar maxLimit = list.last().first();
337 if (lookupValue < minLimit)
341 case bounds::repeatableBounding::ERROR:
344 <<
"value (" << lookupValue <<
") less than lower "
345 <<
"bound (" << minLimit <<
")\n"
349 case bounds::repeatableBounding::WARN:
352 <<
"value (" << lookupValue <<
") less than lower "
353 <<
"bound (" << minLimit <<
")\n"
354 <<
" Continuing with the first entry" <<
endl;
357 return list.first().second();
360 case bounds::repeatableBounding::CLAMP:
362 return list.first().second();
365 case bounds::repeatableBounding::REPEAT:
368 const scalar span = maxLimit-minLimit;
369 lookupValue = fmod(lookupValue - minLimit, span) + minLimit;
374 else if (lookupValue >= maxLimit)
378 case bounds::repeatableBounding::ERROR:
381 <<
"value (" << lookupValue <<
") greater than upper "
382 <<
"bound (" << maxLimit <<
")\n"
386 case bounds::repeatableBounding::WARN:
389 <<
"value (" << lookupValue <<
") greater than upper "
390 <<
"bound (" << maxLimit <<
")\n"
391 <<
" Continuing with the last entry" <<
endl;
394 return list.last().second();
397 case bounds::repeatableBounding::CLAMP:
399 return list.last().second();
402 case bounds::repeatableBounding::REPEAT:
405 const scalar span = maxLimit-minLimit;
406 lookupValue = fmod(lookupValue - minLimit, span) + minLimit;
417 for (
label i = 0; i <
n; ++i)
419 if (lookupValue >= list[i].first())
432 return list[hi].second();
446 + (list[hi].second() - list[lo].second())
447 * (lookupValue / minLimit)
456 + (list[hi].second() - list[lo].second())
457 * (lookupValue - list[lo].first())
458 / (list[hi].first() - list[lo].first())
469 return interpolateValue(*
this, lookupValue, bounding_);
481 auto&
fld = tfld.ref();
485 fld[i] = interpolateValue(vals[i]);
499 const label n = list.size();
509 <<
"Cannot interpolate from zero-sized table" <<
nl
518 case bounds::repeatableBounding::ERROR:
521 <<
"index (" << idx <<
") underflow" <<
nl
525 case bounds::repeatableBounding::WARN:
528 <<
"index (" << idx <<
") underflow" <<
nl
529 <<
" Continuing with the first entry" <<
nl;
535 case bounds::repeatableBounding::CLAMP:
540 case bounds::repeatableBounding::REPEAT:
554 case bounds::repeatableBounding::ERROR:
557 <<
"index (" << idx <<
") overflow" <<
nl
561 case bounds::repeatableBounding::WARN:
564 <<
"index (" << idx <<
") overflow" <<
nl
565 <<
" Continuing with the last entry" <<
nl;
571 case bounds::repeatableBounding::CLAMP:
576 case bounds::repeatableBounding::REPEAT:
594 return interpolateValue(*
this, lookupValue, bounding_);