37 fileName fName(fileName_);
42 reader_()(fName, *
this);
48 "Foam::interpolationTable<Type>::readTable()"
49 ) <<
"table read from " << fName <<
" is empty" <<
nl
65 fileName_(
"fileNameIsUndefined"),
79 boundsHandling_(bounds),
101 boundsHandling_(wordToBoundsHandling(dict.lookup(
"outOfBounds"))),
102 fileName_(dict.lookup(
"fileName")),
116 boundsHandling_(interpTable.boundsHandling_),
117 fileName_(interpTable.fileName_),
118 reader_(interpTable.reader_)
130 word enumName(
"warn");
167 if (bound ==
"error")
171 else if (bound ==
"warn")
175 else if (bound ==
"clamp")
179 else if (bound ==
"repeat")
187 "Foam::interpolationTable<Type>::wordToBoundsHandling(const word&)"
188 ) <<
"bad outOfBounds specifier " << bound <<
" using 'warn'" <<
endl;
203 boundsHandling_ =
bound;
211 label n = this->size();
214 for (label i=1; i<n; ++i)
216 const scalar currValue =
220 if (currValue <= prevValue)
224 "Foam::interpolationTable<Type>::checkOrder() const"
225 ) <<
"out-of-order value: "
226 << currValue <<
" at index " << i <<
nl
229 prevValue = currValue;
255 label n = this->size();
263 switch (boundsHandling_)
269 "Foam::interpolationTable<Type>::operator[]"
270 "(const label) const"
271 ) <<
"index (" << ii <<
") underflow" <<
nl
279 "Foam::interpolationTable<Type>::operator[]"
280 "(const label) const"
281 ) <<
"index (" << ii <<
") underflow" <<
nl
282 <<
" Continuing with the first entry"
303 switch (boundsHandling_)
309 "Foam::interpolationTable<Type>::operator[]"
310 "(const label) const"
311 ) <<
"index (" << ii <<
") overflow" <<
nl
319 "Foam::interpolationTable<Type>::operator[]"
320 "(const label) const"
321 ) <<
"index (" << ii <<
") overflow" <<
nl
322 <<
" Continuing with the last entry"
349 label n = this->size();
358 scalar lookupValue = value;
360 if (lookupValue < minLimit)
362 switch (boundsHandling_)
368 "Foam::interpolationTable<Type>::operator[]"
369 "(const scalar) const"
370 ) <<
"value (" << lookupValue <<
") underflow" <<
nl
378 "Foam::interpolationTable<Type>::operator[]"
379 "(const scalar) const"
380 ) <<
"value (" << lookupValue <<
") underflow" <<
nl
381 <<
" Continuing with the first entry"
393 scalar span = maxLimit-minLimit;
394 lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
399 else if (lookupValue >= maxLimit)
401 switch (boundsHandling_)
407 "Foam::interpolationTable<Type>::operator[]"
408 "(const label) const"
409 ) <<
"value (" << lookupValue <<
") overflow" <<
nl
417 "Foam::interpolationTable<Type>::operator[]"
418 "(const label) const"
419 ) <<
"value (" << lookupValue <<
") overflow" <<
nl
420 <<
" Continuing with the last entry"
432 scalar span = maxLimit-minLimit;
433 lookupValue = fmod(lookupValue-minLimit, span) + minLimit;
443 for (label i = 0; i < n; ++i)
477 *(lookupValue / minLimit)